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
@@ -1,34 +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: {
16
- flexGrow: 1,
17
-
62
+ flexDirection: 'row',
63
+ alignItems: 'center',
64
+ justifyContent: 'center',
65
+ borderStyle: 'solid',
18
66
  variants: {
19
67
  size: {
68
+ xs: {
69
+ minWidth: 64,
70
+ height: 32,
71
+ paddingHorizontal: 12,
72
+ gap: 4,
73
+ },
20
74
  sm: {
21
75
  minWidth: 64,
22
- borderRadius: theme.shapes.corner.full,
76
+ height: 40,
77
+ paddingHorizontal: 16,
78
+ gap: 8,
23
79
  },
24
80
  md: {
25
81
  minWidth: 64,
26
- borderRadius: theme.shapes.corner.full,
82
+ height: 56,
83
+ paddingHorizontal: 24,
84
+ gap: 8,
27
85
  },
28
86
  lg: {
29
- 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: {
30
101
  borderRadius: theme.shapes.corner.full,
31
102
  },
103
+ square: {
104
+ // Base - will be overridden by compoundVariants for size-specific radii
105
+ borderRadius: 12,
106
+ },
32
107
  },
33
108
 
34
109
  state: {
@@ -130,6 +205,42 @@ const defaultStylesDefault = StyleSheet.create(theme => {
130
205
  // elevationLevel: theme.elevations.level1,
131
206
  },
132
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
+ },
133
244
  ],
134
245
  },
135
246
  stateLayer: {
@@ -186,231 +297,139 @@ const defaultStylesDefault = StyleSheet.create(theme => {
186
297
  },
187
298
  ],
188
299
  },
300
+ };
301
+ });
189
302
 
190
- button: {
191
- borderStyle: 'solid',
192
- },
193
- content: {
194
- flexDirection: 'row',
195
- alignItems: 'center',
196
- justifyContent: 'center',
197
- flexGrow: 1,
198
- },
199
- iconContainer: {
200
- ...(Platform.OS !== 'web'
201
- ? { marginLeft: theme.spacings['4'], marginRight: theme.spacings._4 }
202
- : {}),
203
- },
204
- icon: {
205
- ...(Platform.OS === 'web'
206
- ? { marginLeft: theme.spacings['4'], marginRight: theme.spacings._4 }
207
- : {}),
208
- variants: {
209
- state: {
210
- disabled: {
211
- color: theme.colors.onSurfaceDisabled,
212
- },
213
- hovered: {},
214
- 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,
215
319
  },
216
- variant: {
217
- outlined: {
218
- color: theme.colors.primary,
219
- },
220
- text: {
221
- color: theme.colors.primary,
222
- },
223
- contained: {
224
- color: theme.colors.onPrimary,
225
- },
226
- elevated: {
227
- color: theme.colors.primary,
228
- },
229
- 'contained-tonal': {
230
- color: theme.colors.onSecondaryContainer,
231
- },
320
+ text: {
321
+ color: theme.colors.primary,
232
322
  },
233
- },
234
- },
235
- iconTextMode: {
236
- marginLeft: theme.spacings['3'],
237
- marginRight: theme.spacings._2,
238
- },
239
- label: {
240
- display: 'flex',
241
- alignItems: 'center',
242
- textAlign: 'center',
243
- marginVertical: theme.spacings['2l'],
244
- marginHorizontal: theme.spacings['6'],
245
- ...theme.typescale.labelLarge,
246
-
247
- variants: {
248
- size: {
249
- sm: {
250
- ...theme.typescale.labelMedium,
251
- },
252
- md: {
253
- ...theme.typescale.labelLarge,
254
- },
255
- lg: {
256
- ...theme.typescale.labelLarge,
257
- fontSize: theme.typescale.bodyLarge.fontSize,
258
- },
323
+ contained: {
324
+ color: theme.colors.onPrimary,
259
325
  },
260
- variant: {
261
- outlined: {
262
- color: theme.colors.primary,
263
- },
264
- text: {
265
- color: theme.colors.primary,
266
- },
267
- contained: {
268
- color: theme.colors.onPrimary,
269
- },
270
- elevated: {
271
- color: theme.colors.primary,
272
- },
273
- 'contained-tonal': {
274
- color: theme.colors.onSecondaryContainer,
275
- },
326
+ elevated: {
327
+ color: theme.colors.primary,
276
328
  },
277
- state: {
278
- disabled: {
279
- color: theme.colors.onSurfaceDisabled,
280
- },
281
- hovered: {},
282
- default: {},
329
+ 'contained-tonal': {
330
+ color: theme.colors.onSecondaryContainer,
283
331
  },
284
332
  },
333
+ },
334
+ },
335
+ }));
285
336
 
286
- compoundVariants: [
287
- {
288
- variant: 'outlined',
289
- state: 'disabled',
290
- styles: {
291
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
292
- },
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,
293
347
  },
294
-
295
- {
296
- variant: 'text',
297
- state: 'disabled',
298
- styles: {
299
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
300
- },
348
+ sm: {
349
+ ...theme.typescale.labelLarge,
301
350
  },
302
- {
303
- variant: 'contained',
304
- state: 'disabled',
305
- styles: {
306
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
307
- },
351
+ md: {
352
+ ...theme.typescale.titleMedium,
308
353
  },
309
- {
310
- variant: 'elevated',
311
- state: 'disabled',
312
- styles: {
313
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
314
- },
354
+ lg: {
355
+ ...theme.typescale.headlineSmall,
315
356
  },
316
-
317
- {
318
- variant: 'contained-tonal',
319
- state: 'disabled',
320
- styles: {
321
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
322
- },
357
+ xl: {
358
+ ...theme.typescale.headlineLarge,
323
359
  },
324
- ],
325
- },
326
- labelText: {
327
- marginVertical: theme.spacings['2l'],
328
- marginHorizontal: theme.spacings['3'],
329
- ...theme.typescale.labelLarge,
330
-
331
- variants: {
332
- variant: {
333
- text: {
334
- color: theme.colors.primary,
335
- },
360
+ },
361
+ variant: {
362
+ text: {
363
+ color: theme.colors.primary,
336
364
  },
337
- state: {
338
- disabled: {
339
- color: theme.colors.onSurfaceDisabled,
340
- },
341
- hovered: {},
342
- default: {},
365
+ outlined: {
366
+ color: theme.colors.primary,
343
367
  },
344
- size: {
345
- sm: {
346
- ...theme.typescale.labelMedium,
347
- },
348
- md: {
349
- ...theme.typescale.labelLarge,
350
- },
351
- lg: {
352
- ...theme.typescale.labelLarge,
353
- fontSize: theme.typescale.bodyLarge.fontSize,
354
- },
368
+ contained: {
369
+ color: theme.colors.onPrimary,
370
+ },
371
+ elevated: {
372
+ color: theme.colors.primary,
373
+ },
374
+ 'contained-tonal': {
375
+ color: theme.colors.onSecondaryContainer,
355
376
  },
356
377
  },
357
-
358
- compoundVariants: [
359
- {
360
- variant: 'text',
361
- state: 'disabled',
362
- styles: {
363
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
364
- },
378
+ state: {
379
+ disabled: {
380
+ color: theme.colors.onSurfaceDisabled,
365
381
  },
366
- ],
382
+ hovered: {},
383
+ default: {},
384
+ },
367
385
  },
368
- labelTextAddons: {
369
- marginVertical: theme.spacings['2l'],
370
- marginHorizontal: theme.spacings['4'],
386
+ },
387
+ }));
371
388
 
372
- variants: {
373
- variant: {
374
- text: {
375
- color: theme.colors.primary,
376
- },
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,
377
402
  },
378
- state: {
379
- disabled: {
380
- color: theme.colors.onSurfaceDisabled,
381
- },
382
- hovered: {},
383
- default: {},
403
+ text: {
404
+ color: theme.colors.primary,
384
405
  },
385
- size: {
386
- sm: {
387
- ...theme.typescale.labelMedium,
388
- },
389
- md: {
390
- ...theme.typescale.labelLarge,
391
- },
392
- lg: {
393
- ...theme.typescale.labelLarge,
394
- fontSize: theme.typescale.bodyLarge.fontSize,
395
- },
406
+ contained: {
407
+ color: theme.colors.onPrimary,
396
408
  },
397
- },
398
-
399
- compoundVariants: [
400
- {
401
- variant: 'text',
402
- state: 'disabled',
403
- styles: {
404
- color: theme.colors.stateLayer.disabled.onSurface_Level4,
405
- },
409
+ elevated: {
410
+ color: theme.colors.primary,
406
411
  },
407
- ],
412
+ 'contained-tonal': {
413
+ color: theme.colors.onSecondaryContainer,
414
+ },
415
+ },
408
416
  },
409
- };
410
- });
417
+ },
418
+ }));
411
419
 
412
- registerComponentsStyles({
413
- Button: defaultStylesDefault,
414
- });
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
+ );
415
431
 
416
- 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,