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

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 (165) 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 +12 -20
  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 +211 -264
  16. package/components/Button/index.tsx +9 -7
  17. package/components/Button/types.ts +16 -2
  18. package/components/Button/utils.ts +231 -210
  19. package/components/Card/Card.tsx +8 -4
  20. package/components/Card/CardContent.tsx +5 -4
  21. package/components/Card/CardHeader.tsx +5 -3
  22. package/components/Card/CardMedia.tsx +5 -3
  23. package/components/Card/CardTypography.tsx +5 -3
  24. package/components/Card/index.tsx +1 -5
  25. package/components/Card/utils.ts +5 -6
  26. package/components/Checkbox/Checkbox.tsx +1 -0
  27. package/components/Checkbox/CheckboxBase.ios.tsx +1 -0
  28. package/components/Checkbox/CheckboxBase.tsx +24 -128
  29. package/components/Checkbox/index.tsx +1 -5
  30. package/components/Checkbox/utils.ts +6 -31
  31. package/components/Chip/Chip.tsx +40 -52
  32. package/components/Chip/index.tsx +1 -5
  33. package/components/Chip/utils.ts +5 -13
  34. package/components/DatePickerDocked/index.tsx +1 -5
  35. package/components/DatePickerDocked/utils.ts +21 -19
  36. package/components/DatePickerInline/index.tsx +1 -5
  37. package/components/DatePickerInline/utils.ts +41 -28
  38. package/components/DatePickerInput/DatePickerInput.tsx +4 -2
  39. package/components/DatePickerInput/DatePickerInputWithoutModal.tsx +0 -4
  40. package/components/DatePickerInput/index.tsx +1 -5
  41. package/components/DatePickerInput/types.ts +1 -3
  42. package/components/DatePickerInput/utils.ts +5 -6
  43. package/components/DatePickerModal/CalendarEdit.tsx +10 -9
  44. package/components/DatePickerModal/DatePickerModalHeader.tsx +1 -1
  45. package/components/DatePickerModal/index.tsx +1 -5
  46. package/components/DatePickerModal/utils.ts +17 -16
  47. package/components/DateTimePicker/index.tsx +1 -5
  48. package/components/DateTimePicker/utils.ts +5 -6
  49. package/components/Dialog/index.tsx +1 -5
  50. package/components/Dialog/utils.ts +22 -16
  51. package/components/Drawer/Collapsible/utils.ts +13 -13
  52. package/components/Drawer/Drawer.tsx +2 -3
  53. package/components/Drawer/DrawerContent.tsx +5 -3
  54. package/components/Drawer/DrawerFooter.tsx +5 -4
  55. package/components/Drawer/DrawerHeader.tsx +5 -4
  56. package/components/Drawer/DrawerItem.tsx +5 -3
  57. package/components/Drawer/DrawerItemGroup.tsx +5 -4
  58. package/components/Drawer/index.tsx +1 -5
  59. package/components/Drawer/utils.ts +7 -7
  60. package/components/ElementGroup/ElementGroup.tsx +16 -14
  61. package/components/ElementGroup/index.tsx +1 -5
  62. package/components/ElementGroup/utils.ts +5 -6
  63. package/components/FAB/index.tsx +1 -5
  64. package/components/FAB/utils.ts +2 -6
  65. package/components/FilePicker/FilePicker.tsx +47 -76
  66. package/components/FilePicker/index.tsx +1 -5
  67. package/components/FilePicker/utils.ts +5 -6
  68. package/components/HelperText/HelperText.tsx +0 -35
  69. package/components/HelperText/index.tsx +1 -5
  70. package/components/HelperText/utils.ts +5 -7
  71. package/components/HorizontalDivider/HorizontalDivider.tsx +5 -3
  72. package/components/HorizontalDivider/index.tsx +1 -5
  73. package/components/Icon/CrossFadeIcon.tsx +3 -5
  74. package/components/Icon/Icon.tsx +2 -4
  75. package/components/Icon/iconFactory.tsx +3 -3
  76. package/components/Icon/index.tsx +2 -6
  77. package/components/Icon/types.ts +17 -6
  78. package/components/IconButton/IconButton.tsx +45 -58
  79. package/components/IconButton/index.tsx +1 -5
  80. package/components/IconButton/utils.ts +153 -49
  81. package/components/If/index.tsx +1 -5
  82. package/components/InputAddon/index.tsx +1 -5
  83. package/components/InputAddon/utils.ts +5 -6
  84. package/components/Link/index.tsx +1 -5
  85. package/components/Link/utils.ts +2 -6
  86. package/components/ListItem/index.tsx +1 -5
  87. package/components/ListItem/utils.ts +13 -11
  88. package/components/LoadingIndicator/LoadingIndicator.tsx +253 -0
  89. package/components/LoadingIndicator/LoadingIndicator.web.tsx +136 -0
  90. package/components/LoadingIndicator/index.tsx +13 -0
  91. package/components/LoadingIndicator/utils.ts +117 -0
  92. package/components/Menu/index.tsx +1 -5
  93. package/components/Menu/utils.ts +6 -8
  94. package/components/Modal/index.tsx +1 -5
  95. package/components/Modal/utils.ts +2 -6
  96. package/components/NavigationRail/NavigationRailHeader.tsx +1 -1
  97. package/components/NavigationRail/index.tsx +1 -5
  98. package/components/NavigationRail/utils.ts +21 -17
  99. package/components/NavigationStack/index.tsx +1 -5
  100. package/components/NavigationStack/utils.tsx +7 -1
  101. package/components/Portal/index.tsx +1 -5
  102. package/components/RadioButton/index.ts +1 -5
  103. package/components/RadioButton/utils.ts +9 -8
  104. package/components/Rating/index.tsx +1 -5
  105. package/components/Rating/utils.ts +6 -8
  106. package/components/Select/Select.tsx +369 -507
  107. package/components/Select/index.ts +7 -14
  108. package/components/Select/types.ts +2 -4
  109. package/components/Select/utils.ts +215 -0
  110. package/components/Slot/Slot.tsx +244 -0
  111. package/components/Slot/compose-refs.tsx +60 -0
  112. package/components/Slot/index.tsx +8 -0
  113. package/components/StateLayer/index.tsx +1 -5
  114. package/components/StateLayer/utils.ts +5 -6
  115. package/components/Surface/Surface.android.tsx +34 -8
  116. package/components/Surface/Surface.ios.tsx +36 -29
  117. package/components/Surface/Surface.tsx +31 -4
  118. package/components/Surface/index.tsx +1 -5
  119. package/components/Surface/utils.ts +49 -36
  120. package/components/Switch/Switch.tsx +8 -2
  121. package/components/Switch/index.tsx +1 -5
  122. package/components/Switch/utils.ts +2 -6
  123. package/components/Tabs/TabItem.tsx +35 -58
  124. package/components/Tabs/TabLabel.tsx +5 -9
  125. package/components/Tabs/Tabs.tsx +154 -149
  126. package/components/Tabs/index.tsx +1 -5
  127. package/components/Tabs/utils.ts +25 -12
  128. package/components/Text/Text.tsx +2 -8
  129. package/components/TextInput/TextInput.tsx +655 -571
  130. package/components/TextInput/index.tsx +19 -7
  131. package/components/TextInput/types.ts +76 -27
  132. package/components/TextInput/utils.ts +232 -159
  133. package/components/TextInputWithMask/index.tsx +1 -5
  134. package/components/TimePicker/AmPmSwitcher.tsx +1 -1
  135. package/components/TimePicker/index.tsx +1 -5
  136. package/components/TimePicker/utils.ts +29 -21
  137. package/components/TimePickerField/TimePickerField.tsx +7 -5
  138. package/components/TimePickerField/index.tsx +1 -5
  139. package/components/TimePickerField/utils.ts +5 -6
  140. package/components/TimePickerModal/TimePickerModal.tsx +6 -2
  141. package/components/TimePickerModal/index.tsx +1 -5
  142. package/components/TimePickerModal/utils.ts +5 -6
  143. package/components/Tooltip/TooltipTrigger.tsx +25 -16
  144. package/components/Tooltip/index.tsx +1 -5
  145. package/components/Tooltip/utils.ts +5 -6
  146. package/components/TouchableRipple/TouchableRipple.native.tsx +50 -14
  147. package/components/TouchableRipple/TouchableRipple.tsx +137 -47
  148. package/components/TouchableRipple/index.tsx +1 -5
  149. package/components/TouchableRipple/utils.ts +5 -6
  150. package/components/VerticalDivider/VerticalDivider.tsx +9 -8
  151. package/components/VerticalDivider/index.tsx +1 -5
  152. package/core/componentsRegistry.ts +31 -19
  153. package/hocs/withPortal.tsx +1 -1
  154. package/hooks/index.tsx +0 -5
  155. package/hooks/useControlledValue.tsx +20 -4
  156. package/hooks/useSubcomponents.tsx +63 -31
  157. package/hooks/useWhatHasUpdated.tsx +48 -0
  158. package/package.json +12 -15
  159. package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +5 -2
  160. package/styles/shadow.ts +2 -1
  161. package/styles/themes/LightTheme.tsx +1 -1
  162. package/utils/extractPropertiesFromStyles.ts +25 -0
  163. package/utils/lodash.ts +77 -6
  164. package/utils/repository.ts +2 -52
  165. package/hooks/useSearchable.tsx +0 -74
@@ -1,32 +1,109 @@
1
- import { Platform } from 'react-native';
1
+ import { createContext } from 'react';
2
2
  import { StyleSheet } from 'react-native-unistyles';
3
3
 
4
- import { getRegisteredMoleculesComponentStyles, registerComponentsStyles } from '../../core';
4
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
5
+ import type { ButtonContextType } from './types';
5
6
 
6
7
  export const sizeToIconSizeMap = {
7
- xs: 18,
8
- sm: 22,
8
+ xs: 20,
9
+ sm: 20,
9
10
  md: 24,
10
- lg: 26,
11
+ lg: 32,
12
+ xl: 40,
11
13
  };
12
14
 
13
- const defaultStylesDefault = StyleSheet.create(theme => {
15
+ export const sizeToHeightMap = {
16
+ xs: 32,
17
+ sm: 40,
18
+ md: 56,
19
+ lg: 96,
20
+ xl: 136,
21
+ };
22
+
23
+ export const sizeToPaddingMap = {
24
+ xs: 12,
25
+ sm: 16,
26
+ md: 24,
27
+ lg: 48,
28
+ xl: 64,
29
+ };
30
+
31
+ export const sizeToIconGapMap = {
32
+ xs: 4,
33
+ sm: 8,
34
+ md: 8,
35
+ lg: 12,
36
+ xl: 16,
37
+ };
38
+
39
+ export const elevationMap: Record<string, Record<string, number>> = {
40
+ true: {
41
+ contained: 1,
42
+ 'contained-tonal': 1,
43
+ elevated: 2,
44
+ },
45
+ false: {
46
+ elevated: 1,
47
+ },
48
+ };
49
+
50
+ export const ButtonContext = createContext<ButtonContextType>({
51
+ variant: 'text',
52
+ size: 'sm',
53
+ state: 'default',
54
+ disabled: false,
55
+ labelColor: undefined,
56
+ iconSize: undefined,
57
+ });
58
+
59
+ const buttonStylesDefault = StyleSheet.create(theme => {
14
60
  return {
15
61
  root: {
62
+ flexDirection: 'row',
63
+ alignItems: 'center',
64
+ justifyContent: 'center',
65
+ borderStyle: 'solid',
16
66
  variants: {
17
67
  size: {
68
+ xs: {
69
+ minWidth: 64,
70
+ height: 32,
71
+ paddingHorizontal: 12,
72
+ gap: 4,
73
+ },
18
74
  sm: {
19
75
  minWidth: 64,
20
- borderRadius: theme.shapes.corner.full,
76
+ height: 40,
77
+ paddingHorizontal: 16,
78
+ gap: 8,
21
79
  },
22
80
  md: {
23
81
  minWidth: 64,
24
- borderRadius: theme.shapes.corner.full,
82
+ height: 56,
83
+ paddingHorizontal: 24,
84
+ gap: 8,
25
85
  },
26
86
  lg: {
27
- minWidth: 64,
87
+ minWidth: 96,
88
+ height: 96,
89
+ paddingHorizontal: 48,
90
+ gap: 12,
91
+ },
92
+ xl: {
93
+ minWidth: 136,
94
+ height: 136,
95
+ paddingHorizontal: 64,
96
+ gap: 16,
97
+ },
98
+ },
99
+ shape: {
100
+ rounded: {
28
101
  borderRadius: theme.shapes.corner.full,
29
102
  },
103
+ square: {
104
+ // Base - will be overridden by compoundVariants for size-specific radii
105
+ borderRadius: 12,
106
+ },
30
107
  },
31
108
 
32
109
  state: {
@@ -128,6 +205,42 @@ const defaultStylesDefault = StyleSheet.create(theme => {
128
205
  // elevationLevel: theme.elevations.level1,
129
206
  },
130
207
  },
208
+ // Square shape + size compound variants for border radius
209
+ {
210
+ shape: 'square',
211
+ size: 'xs',
212
+ styles: {
213
+ borderRadius: theme.shapes.corner.medium,
214
+ },
215
+ },
216
+ {
217
+ shape: 'square',
218
+ size: 'sm',
219
+ styles: {
220
+ borderRadius: theme.shapes.corner.medium,
221
+ },
222
+ },
223
+ {
224
+ shape: 'square',
225
+ size: 'md',
226
+ styles: {
227
+ borderRadius: theme.shapes.corner.large,
228
+ },
229
+ },
230
+ {
231
+ shape: 'square',
232
+ size: 'lg',
233
+ styles: {
234
+ borderRadius: theme.shapes.corner.extraLarge,
235
+ },
236
+ },
237
+ {
238
+ shape: 'square',
239
+ size: 'xl',
240
+ styles: {
241
+ borderRadius: theme.shapes.corner.extraLarge,
242
+ },
243
+ },
131
244
  ],
132
245
  },
133
246
  stateLayer: {
@@ -184,231 +297,139 @@ const defaultStylesDefault = StyleSheet.create(theme => {
184
297
  },
185
298
  ],
186
299
  },
300
+ };
301
+ });
187
302
 
188
- button: {
189
- borderStyle: 'solid',
190
- },
191
- content: {
192
- flexDirection: 'row',
193
- alignItems: 'center',
194
- justifyContent: 'center',
195
- flexGrow: 1,
196
- },
197
- iconContainer: {
198
- ...(Platform.OS !== 'web'
199
- ? { marginLeft: theme.spacings['4'], marginRight: theme.spacings._4 }
200
- : {}),
201
- },
202
- icon: {
203
- ...(Platform.OS === 'web'
204
- ? { marginLeft: theme.spacings['4'], marginRight: theme.spacings._4 }
205
- : {}),
206
- variants: {
207
- state: {
208
- disabled: {
209
- color: theme.colors.onSurfaceDisabled,
210
- },
211
- hovered: {},
212
- default: {},
303
+ /**
304
+ * Styles for Button.Icon component
305
+ */
306
+ const buttonIconStylesDefault = StyleSheet.create(theme => ({
307
+ root: {
308
+ variants: {
309
+ state: {
310
+ disabled: {
311
+ color: theme.colors.onSurfaceDisabled,
312
+ },
313
+ hovered: {},
314
+ default: {},
315
+ },
316
+ variant: {
317
+ outlined: {
318
+ color: theme.colors.primary,
213
319
  },
214
- variant: {
215
- outlined: {
216
- color: theme.colors.primary,
217
- },
218
- text: {
219
- color: theme.colors.primary,
220
- },
221
- contained: {
222
- color: theme.colors.onPrimary,
223
- },
224
- elevated: {
225
- color: theme.colors.primary,
226
- },
227
- 'contained-tonal': {
228
- color: theme.colors.onSecondaryContainer,
229
- },
320
+ text: {
321
+ color: theme.colors.primary,
230
322
  },
231
- },
232
- },
233
- iconTextMode: {
234
- marginLeft: theme.spacings['3'],
235
- marginRight: theme.spacings._2,
236
- },
237
- label: {
238
- display: 'flex',
239
- alignItems: 'center',
240
- textAlign: 'center',
241
- marginVertical: theme.spacings['2l'],
242
- marginHorizontal: theme.spacings['6'],
243
- ...theme.typescale.labelLarge,
244
-
245
- variants: {
246
- size: {
247
- sm: {
248
- ...theme.typescale.labelMedium,
249
- },
250
- md: {
251
- ...theme.typescale.labelLarge,
252
- },
253
- lg: {
254
- ...theme.typescale.labelLarge,
255
- fontSize: theme.typescale.bodyLarge.fontSize,
256
- },
323
+ contained: {
324
+ color: theme.colors.onPrimary,
257
325
  },
258
- variant: {
259
- outlined: {
260
- color: theme.colors.primary,
261
- },
262
- text: {
263
- color: theme.colors.primary,
264
- },
265
- contained: {
266
- color: theme.colors.onPrimary,
267
- },
268
- elevated: {
269
- color: theme.colors.primary,
270
- },
271
- 'contained-tonal': {
272
- color: theme.colors.onSecondaryContainer,
273
- },
326
+ elevated: {
327
+ color: theme.colors.primary,
274
328
  },
275
- state: {
276
- disabled: {
277
- color: theme.colors.onSurfaceDisabled,
278
- },
279
- hovered: {},
280
- default: {},
329
+ 'contained-tonal': {
330
+ color: theme.colors.onSecondaryContainer,
281
331
  },
282
332
  },
333
+ },
334
+ },
335
+ }));
283
336
 
284
- compoundVariants: [
285
- {
286
- variant: 'outlined',
287
- state: 'disabled',
288
- styles: {
289
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
290
- },
337
+ /**
338
+ * Styles for Button.Text component
339
+ */
340
+ const buttonTextStylesDefault = StyleSheet.create(theme => ({
341
+ root: {
342
+ ...theme.typescale.labelLarge,
343
+ variants: {
344
+ size: {
345
+ xs: {
346
+ ...theme.typescale.labelLarge,
291
347
  },
292
-
293
- {
294
- variant: 'text',
295
- state: 'disabled',
296
- styles: {
297
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
298
- },
348
+ sm: {
349
+ ...theme.typescale.labelLarge,
299
350
  },
300
- {
301
- variant: 'contained',
302
- state: 'disabled',
303
- styles: {
304
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
305
- },
351
+ md: {
352
+ ...theme.typescale.titleMedium,
306
353
  },
307
- {
308
- variant: 'elevated',
309
- state: 'disabled',
310
- styles: {
311
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
312
- },
354
+ lg: {
355
+ ...theme.typescale.headlineSmall,
313
356
  },
314
-
315
- {
316
- variant: 'contained-tonal',
317
- state: 'disabled',
318
- styles: {
319
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
320
- },
357
+ xl: {
358
+ ...theme.typescale.headlineLarge,
321
359
  },
322
- ],
323
- },
324
- labelText: {
325
- marginVertical: theme.spacings['2l'],
326
- marginHorizontal: theme.spacings['3'],
327
- ...theme.typescale.labelLarge,
328
-
329
- variants: {
330
- variant: {
331
- text: {
332
- color: theme.colors.primary,
333
- },
360
+ },
361
+ variant: {
362
+ text: {
363
+ color: theme.colors.primary,
334
364
  },
335
- state: {
336
- disabled: {
337
- color: theme.colors.onSurfaceDisabled,
338
- },
339
- hovered: {},
340
- default: {},
365
+ outlined: {
366
+ color: theme.colors.primary,
341
367
  },
342
- size: {
343
- sm: {
344
- ...theme.typescale.labelMedium,
345
- },
346
- md: {
347
- ...theme.typescale.labelLarge,
348
- },
349
- lg: {
350
- ...theme.typescale.labelLarge,
351
- fontSize: theme.typescale.bodyLarge.fontSize,
352
- },
368
+ contained: {
369
+ color: theme.colors.onPrimary,
370
+ },
371
+ elevated: {
372
+ color: theme.colors.primary,
373
+ },
374
+ 'contained-tonal': {
375
+ color: theme.colors.onSecondaryContainer,
353
376
  },
354
377
  },
355
-
356
- compoundVariants: [
357
- {
358
- variant: 'text',
359
- state: 'disabled',
360
- styles: {
361
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
362
- },
378
+ state: {
379
+ disabled: {
380
+ color: theme.colors.onSurfaceDisabled,
363
381
  },
364
- ],
382
+ hovered: {},
383
+ default: {},
384
+ },
365
385
  },
366
- labelTextAddons: {
367
- marginVertical: theme.spacings['2l'],
368
- marginHorizontal: theme.spacings['4'],
386
+ },
387
+ }));
369
388
 
370
- variants: {
371
- variant: {
372
- text: {
373
- color: theme.colors.primary,
374
- },
389
+ const buttonActivityIndicatorStylesDefault = StyleSheet.create(theme => ({
390
+ root: {
391
+ variants: {
392
+ state: {
393
+ disabled: {
394
+ color: theme.colors.onSurfaceDisabled,
395
+ },
396
+ hovered: {},
397
+ default: {},
398
+ },
399
+ variant: {
400
+ outlined: {
401
+ color: theme.colors.primary,
375
402
  },
376
- state: {
377
- disabled: {
378
- color: theme.colors.onSurfaceDisabled,
379
- },
380
- hovered: {},
381
- default: {},
403
+ text: {
404
+ color: theme.colors.primary,
382
405
  },
383
- size: {
384
- sm: {
385
- ...theme.typescale.labelMedium,
386
- },
387
- md: {
388
- ...theme.typescale.labelLarge,
389
- },
390
- lg: {
391
- ...theme.typescale.labelLarge,
392
- fontSize: theme.typescale.bodyLarge.fontSize,
393
- },
406
+ contained: {
407
+ color: theme.colors.onPrimary,
394
408
  },
395
- },
396
-
397
- compoundVariants: [
398
- {
399
- variant: 'text',
400
- state: 'disabled',
401
- styles: {
402
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
403
- },
409
+ elevated: {
410
+ color: theme.colors.primary,
404
411
  },
405
- ],
412
+ 'contained-tonal': {
413
+ color: theme.colors.onSecondaryContainer,
414
+ },
415
+ },
406
416
  },
407
- };
408
- });
417
+ },
418
+ }));
409
419
 
410
- registerComponentsStyles({
411
- Button: defaultStylesDefault,
412
- });
420
+ export const buttonStyles = getRegisteredComponentStylesWithFallback('Button', buttonStylesDefault);
421
+
422
+ export const buttonIconStyles = getRegisteredComponentStylesWithFallback(
423
+ 'ButtonIcon',
424
+ buttonIconStylesDefault,
425
+ );
426
+
427
+ export const buttonTextStyles = getRegisteredComponentStylesWithFallback(
428
+ 'ButtonText',
429
+ buttonTextStylesDefault,
430
+ );
413
431
 
414
- export const defaultStyles = getRegisteredMoleculesComponentStyles('Button');
432
+ export const buttonActivityIndicatorStyles = getRegisteredComponentStylesWithFallback(
433
+ 'ButtonActivityIndicator',
434
+ buttonActivityIndicatorStylesDefault,
435
+ );
@@ -2,7 +2,7 @@ import { forwardRef, memo, useMemo } from 'react';
2
2
  import type { ViewStyle } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
4
 
5
- import { getRegisteredMoleculesComponentStyles, registerComponentStyles } from '../../core';
5
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
6
6
  import { useActionState } from '../../hooks';
7
7
  import type { MD3Elevation } from '../../types/theme';
8
8
  import { resolveStateVariant } from '../../utils';
@@ -41,7 +41,7 @@ const Card = (
41
41
 
42
42
  cardStyles.useVariants({
43
43
  variant,
44
- state,
44
+ state: state as 'disabled' | 'hovered' | 'pressed',
45
45
  });
46
46
 
47
47
  const elevationLevel = variant === 'elevated' ? (hovered ? 2 : 1) : hovered ? 1 : 0;
@@ -84,6 +84,11 @@ const cardStylesDefault = StyleSheet.create(theme => ({
84
84
  outlined: {},
85
85
  undefined: {},
86
86
  },
87
+ state: {
88
+ disabled: {},
89
+ hovered: {},
90
+ pressed: {},
91
+ },
87
92
  },
88
93
  compoundVariants: [
89
94
  {
@@ -154,7 +159,6 @@ const cardStylesDefault = StyleSheet.create(theme => ({
154
159
  },
155
160
  }));
156
161
 
157
- registerComponentStyles('Card', cardStylesDefault);
158
- export const cardStyles = getRegisteredMoleculesComponentStyles('Card');
162
+ export const cardStyles = getRegisteredComponentStylesWithFallback('Card', cardStylesDefault);
159
163
 
160
164
  export default memo(forwardRef(Card));
@@ -2,7 +2,7 @@ import { forwardRef, memo, type ReactNode } from 'react';
2
2
  import { View, type ViewProps } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
4
 
5
- import { getRegisteredMoleculesComponentStyles, registerComponentStyles } from '../../core';
5
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
6
6
 
7
7
  export type Props = ViewProps & {
8
8
  children: ReactNode | ReactNode[];
@@ -22,8 +22,9 @@ const cardContentStylesDefault = StyleSheet.create(theme => ({
22
22
  },
23
23
  }));
24
24
 
25
- registerComponentStyles('Card_Content', cardContentStylesDefault);
26
-
27
- export const cardContentStyles = getRegisteredMoleculesComponentStyles('Card_Content');
25
+ export const cardContentStyles = getRegisteredComponentStylesWithFallback(
26
+ 'Card_Content',
27
+ cardContentStylesDefault,
28
+ );
28
29
 
29
30
  export default CardContent;
@@ -2,7 +2,7 @@ import { forwardRef, memo, type ReactNode } from 'react';
2
2
  import { View, type ViewProps } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
4
 
5
- import { getRegisteredMoleculesComponentStyles, registerComponentStyles } from '../../core';
5
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
6
6
 
7
7
  export type Props = ViewProps & {
8
8
  children: ReactNode | ReactNode[];
@@ -25,7 +25,9 @@ const cardHeaderStylesDefault = StyleSheet.create(theme => ({
25
25
  justifyContent: 'space-between',
26
26
  },
27
27
  }));
28
- registerComponentStyles('Card_Header', cardHeaderStylesDefault);
29
- export const cardHeaderStyles = getRegisteredMoleculesComponentStyles('Card_Header');
28
+ export const cardHeaderStyles = getRegisteredComponentStylesWithFallback(
29
+ 'Card_Header',
30
+ cardHeaderStylesDefault,
31
+ );
30
32
 
31
33
  export default CardHeader;
@@ -2,7 +2,7 @@ import { forwardRef, memo, type ReactNode } from 'react';
2
2
  import { type StyleProp, View, type ViewProps, type ViewStyle } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
4
 
5
- import { getRegisteredMoleculesComponentStyles, registerComponentStyles } from '../../core';
5
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
6
6
 
7
7
  export type Props = ViewProps & {
8
8
  style?: StyleProp<ViewStyle>;
@@ -28,8 +28,10 @@ const cardMediaStylesDefault = StyleSheet.create(theme => ({
28
28
  },
29
29
  }));
30
30
 
31
- registerComponentStyles('Card_Media', cardMediaStylesDefault);
32
- export const cardMediaStyles = getRegisteredMoleculesComponentStyles('Card_Media');
31
+ export const cardMediaStyles = getRegisteredComponentStylesWithFallback(
32
+ 'Card_Media',
33
+ cardMediaStylesDefault,
34
+ );
33
35
 
34
36
  CardMedia.displayName = 'Card_Media';
35
37
 
@@ -2,7 +2,7 @@ import { forwardRef, memo } from 'react';
2
2
  import { type TextProps } from 'react-native';
3
3
  import { StyleSheet } from 'react-native-unistyles';
4
4
 
5
- import { getRegisteredMoleculesComponentStyles, registerComponentStyles } from '../../core';
5
+ import { getRegisteredComponentStylesWithFallback } from '../../core';
6
6
  import { Text } from '../Text';
7
7
 
8
8
  export type Props = TextProps & {
@@ -107,7 +107,9 @@ const cardTypograhyStylesDefault = StyleSheet.create(theme => ({
107
107
  },
108
108
  }));
109
109
 
110
- registerComponentStyles('Card_Typography', cardTypograhyStylesDefault);
111
- export const cardTypograhyStyles = getRegisteredMoleculesComponentStyles('Card_Typography');
110
+ export const cardTypograhyStyles = getRegisteredComponentStylesWithFallback(
111
+ 'Card_Typography',
112
+ cardTypograhyStylesDefault,
113
+ );
112
114
 
113
115
  export default memo(forwardRef(CardTypography));
@@ -1,4 +1,4 @@
1
- import { getRegisteredComponentWithFallback, registerMoleculesComponents } from '../../core';
1
+ import { getRegisteredComponentWithFallback } from '../../core';
2
2
  import { default as CardComponent } from './Card';
3
3
  import { default as CardActions } from './CardActions';
4
4
  import { default as CardContent } from './CardContent';
@@ -21,10 +21,6 @@ export const CardDefault = Object.assign(
21
21
  },
22
22
  );
23
23
 
24
- registerMoleculesComponents({
25
- Card: CardDefault,
26
- });
27
-
28
24
  export const Card = getRegisteredComponentWithFallback('Card', CardDefault);
29
25
 
30
26
  export { type Props as CardProps, cardStyles } from './Card';
@@ -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 = 'hovered' | 'focused' | 'pressed' | 'disabled';
6
6
  export type CardTypographyVariant = 'headline' | 'subhead' | 'text';
@@ -16,8 +16,7 @@ const cardActionsStylesDefault = StyleSheet.create(theme => ({
16
16
  },
17
17
  }));
18
18
 
19
- registerComponentsStyles({
20
- Card_Actions: cardActionsStylesDefault,
21
- });
22
-
23
- export const cardActionsStyles = getRegisteredMoleculesComponentStyles('Card_Actions');
19
+ export const cardActionsStyles = getRegisteredComponentStylesWithFallback(
20
+ 'Card_Actions',
21
+ cardActionsStylesDefault,
22
+ );
@@ -47,6 +47,7 @@ const Checkbox = (
47
47
  if (label) {
48
48
  styles.useVariants({
49
49
  variant: 'item',
50
+ // @ts-ignore // TODO - fix this
50
51
  state: state as States,
51
52
  isLeading,
52
53
  size,
@@ -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
  });