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.
- package/README.md +87 -0
- package/components/Accordion/AccordionItem.tsx +3 -2
- package/components/Accordion/AccordionItemContent.tsx +1 -0
- package/components/Accordion/AccordionItemHeader.tsx +6 -5
- package/components/Accordion/index.tsx +8 -14
- package/components/Accordion/utils.ts +17 -14
- package/components/ActivityIndicator/ActivityIndicator.tsx +12 -20
- package/components/ActivityIndicator/index.tsx +1 -5
- package/components/Appbar/index.tsx +1 -4
- package/components/Appbar/utils.ts +33 -21
- package/components/Avatar/index.tsx +1 -5
- package/components/Avatar/utils.ts +2 -6
- package/components/Backdrop/Backdrop.tsx +2 -2
- package/components/Backdrop/index.tsx +1 -5
- package/components/Backdrop/utils.ts +5 -6
- package/components/Badge/index.tsx +1 -5
- package/components/Badge/utils.ts +2 -6
- package/components/Button/Button.tsx +211 -264
- package/components/Button/index.tsx +9 -7
- package/components/Button/types.ts +16 -2
- package/components/Button/utils.ts +231 -212
- package/components/Card/Card.tsx +8 -4
- package/components/Card/CardContent.tsx +5 -4
- package/components/Card/CardHeader.tsx +5 -3
- package/components/Card/CardMedia.tsx +5 -3
- package/components/Card/CardTypography.tsx +5 -3
- package/components/Card/index.tsx +1 -5
- package/components/Card/utils.ts +5 -6
- package/components/Checkbox/Checkbox.tsx +1 -0
- package/components/Checkbox/CheckboxBase.ios.tsx +1 -0
- package/components/Checkbox/CheckboxBase.tsx +1 -0
- package/components/Checkbox/index.tsx +1 -5
- package/components/Checkbox/utils.ts +6 -6
- package/components/Chip/Chip.tsx +40 -52
- package/components/Chip/index.tsx +1 -5
- package/components/Chip/utils.ts +5 -13
- package/components/DatePickerDocked/index.tsx +1 -5
- package/components/DatePickerDocked/utils.ts +21 -19
- package/components/DatePickerInline/index.tsx +1 -5
- package/components/DatePickerInline/utils.ts +41 -28
- package/components/DatePickerInput/index.tsx +2 -6
- package/components/DatePickerInput/utils.ts +5 -6
- package/components/DatePickerModal/DatePickerModalHeader.tsx +1 -1
- package/components/DatePickerModal/index.tsx +1 -5
- package/components/DatePickerModal/utils.ts +17 -16
- package/components/DateTimePicker/index.tsx +1 -5
- package/components/DateTimePicker/utils.ts +5 -6
- package/components/Dialog/index.tsx +1 -5
- package/components/Dialog/utils.ts +22 -16
- package/components/Drawer/Collapsible/utils.ts +13 -13
- package/components/Drawer/Drawer.tsx +2 -3
- package/components/Drawer/DrawerContent.tsx +5 -3
- package/components/Drawer/DrawerFooter.tsx +5 -4
- package/components/Drawer/DrawerHeader.tsx +5 -4
- package/components/Drawer/DrawerItem.tsx +5 -3
- package/components/Drawer/DrawerItemGroup.tsx +5 -4
- package/components/Drawer/index.tsx +1 -5
- package/components/Drawer/utils.ts +7 -7
- package/components/ElementGroup/ElementGroup.tsx +16 -14
- package/components/ElementGroup/index.tsx +1 -5
- package/components/ElementGroup/utils.ts +5 -6
- package/components/FAB/index.tsx +1 -5
- package/components/FAB/utils.ts +3 -7
- package/components/FilePicker/index.tsx +1 -5
- package/components/FilePicker/utils.ts +5 -6
- package/components/HelperText/index.tsx +1 -5
- package/components/HelperText/utils.ts +5 -7
- package/components/HorizontalDivider/HorizontalDivider.tsx +5 -3
- package/components/HorizontalDivider/index.tsx +1 -5
- package/components/Icon/CrossFadeIcon.tsx +3 -5
- package/components/Icon/Icon.tsx +3 -14
- package/components/Icon/iconFactory.tsx +3 -3
- package/components/Icon/index.tsx +2 -6
- package/components/Icon/types.ts +17 -6
- package/components/IconButton/IconButton.tsx +45 -58
- package/components/IconButton/index.tsx +1 -5
- package/components/IconButton/utils.ts +15 -26
- package/components/If/index.tsx +1 -5
- package/components/InputAddon/index.tsx +1 -5
- package/components/InputAddon/utils.ts +5 -6
- package/components/Link/index.tsx +1 -5
- package/components/Link/utils.ts +7 -9
- package/components/ListItem/index.tsx +1 -5
- package/components/ListItem/utils.ts +13 -11
- package/components/LoadingIndicator/LoadingIndicator.tsx +253 -0
- package/components/LoadingIndicator/LoadingIndicator.web.tsx +136 -0
- package/components/LoadingIndicator/index.tsx +13 -0
- package/components/LoadingIndicator/utils.ts +117 -0
- package/components/Menu/index.tsx +1 -5
- package/components/Menu/utils.ts +6 -8
- package/components/Modal/index.tsx +1 -5
- package/components/Modal/utils.ts +2 -6
- package/components/NavigationRail/NavigationRailHeader.tsx +1 -1
- package/components/NavigationRail/NavigationRailItem.tsx +2 -1
- package/components/NavigationRail/index.tsx +1 -5
- package/components/NavigationRail/utils.ts +21 -17
- package/components/NavigationStack/index.tsx +1 -5
- package/components/NavigationStack/utils.tsx +7 -1
- package/components/Portal/index.tsx +1 -5
- package/components/RadioButton/index.ts +5 -10
- package/components/RadioButton/utils.ts +9 -8
- package/components/Rating/RatingItem.tsx +2 -1
- package/components/Rating/index.tsx +1 -5
- package/components/Rating/utils.ts +6 -8
- package/components/Select/Select.tsx +360 -501
- package/components/Select/index.ts +7 -14
- package/components/Select/types.ts +2 -4
- package/components/Select/utils.ts +215 -0
- package/components/Slot/Slot.tsx +244 -0
- package/components/Slot/compose-refs.tsx +60 -0
- package/components/Slot/index.tsx +8 -0
- package/components/StateLayer/index.tsx +1 -5
- package/components/StateLayer/utils.ts +5 -6
- package/components/Surface/Surface.android.tsx +34 -8
- package/components/Surface/Surface.ios.tsx +36 -29
- package/components/Surface/Surface.tsx +31 -4
- package/components/Surface/index.tsx +1 -5
- package/components/Surface/utils.ts +49 -36
- package/components/Switch/Switch.tsx +8 -2
- package/components/Switch/index.tsx +1 -5
- package/components/Switch/utils.ts +2 -6
- package/components/Tabs/Tabs.tsx +14 -13
- package/components/Tabs/index.tsx +1 -5
- package/components/Tabs/utils.ts +10 -10
- package/components/Text/Text.tsx +2 -8
- package/components/TextInput/TextInput.tsx +5 -4
- package/components/TextInput/index.tsx +1 -5
- package/components/TextInput/utils.ts +8 -15
- package/components/TextInputWithMask/index.tsx +1 -5
- package/components/TimePicker/AmPmSwitcher.tsx +1 -1
- package/components/TimePicker/index.tsx +1 -5
- package/components/TimePicker/utils.ts +29 -21
- package/components/TimePickerField/index.tsx +1 -5
- package/components/TimePickerField/utils.ts +5 -6
- package/components/TimePickerModal/TimePickerModal.tsx +6 -2
- package/components/TimePickerModal/index.tsx +1 -5
- package/components/TimePickerModal/utils.ts +5 -6
- package/components/Tooltip/TooltipTrigger.tsx +25 -16
- package/components/Tooltip/index.tsx +5 -9
- package/components/Tooltip/utils.ts +5 -6
- package/components/TouchableRipple/TouchableRipple.native.tsx +49 -13
- package/components/TouchableRipple/TouchableRipple.tsx +136 -46
- package/components/TouchableRipple/index.tsx +1 -5
- package/components/TouchableRipple/utils.ts +5 -6
- package/components/VerticalDivider/VerticalDivider.tsx +9 -8
- package/components/VerticalDivider/index.tsx +1 -5
- package/core/componentsRegistry.ts +31 -19
- package/hocs/withPortal.tsx +1 -1
- package/hooks/index.tsx +0 -1
- package/hooks/useControlledValue.tsx +20 -4
- package/hooks/useSubcomponents.tsx +56 -22
- package/hooks/useWhatHasUpdated.tsx +48 -0
- package/package.json +10 -13
- package/shortcuts-manager/ShortcutsManager/ShortcutsManager.tsx +5 -2
- package/shortcuts-manager/ShortcutsManager/utils.tsx +3 -2
- package/shortcuts-manager/useShortcut/index.tsx +1 -1
- package/shortcuts-manager/useShortcut/useShortcut.tsx +1 -1
- package/styles/shadow.ts +2 -1
- package/styles/themes/LightTheme.tsx +1 -1
- package/utils/extractPropertiesFromStyles.ts +25 -0
- package/utils/lodash.ts +77 -6
- package/utils/repository.ts +2 -52
- package/utils/tokenStylesParser.ts +3 -1
- package/hooks/useBreakpoints.tsx +0 -7
|
@@ -1,34 +1,109 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createContext } from 'react';
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
5
|
+
import type { ButtonContextType } from './types';
|
|
5
6
|
|
|
6
7
|
export const sizeToIconSizeMap = {
|
|
7
|
-
xs:
|
|
8
|
-
sm:
|
|
8
|
+
xs: 20,
|
|
9
|
+
sm: 20,
|
|
9
10
|
md: 24,
|
|
10
|
-
lg:
|
|
11
|
+
lg: 32,
|
|
12
|
+
xl: 40,
|
|
11
13
|
};
|
|
12
14
|
|
|
13
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
76
|
+
height: 40,
|
|
77
|
+
paddingHorizontal: 16,
|
|
78
|
+
gap: 8,
|
|
23
79
|
},
|
|
24
80
|
md: {
|
|
25
81
|
minWidth: 64,
|
|
26
|
-
|
|
82
|
+
height: 56,
|
|
83
|
+
paddingHorizontal: 24,
|
|
84
|
+
gap: 8,
|
|
27
85
|
},
|
|
28
86
|
lg: {
|
|
29
|
-
minWidth:
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
-
|
|
217
|
-
|
|
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
|
-
|
|
261
|
-
|
|
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
|
-
|
|
278
|
-
|
|
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
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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
|
-
|
|
304
|
-
state: 'disabled',
|
|
305
|
-
styles: {
|
|
306
|
-
color: theme.colors.stateLayer.disabled.onSurface_Level4,
|
|
307
|
-
},
|
|
351
|
+
md: {
|
|
352
|
+
...theme.typescale.titleMedium,
|
|
308
353
|
},
|
|
309
|
-
{
|
|
310
|
-
|
|
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
|
-
|
|
327
|
-
|
|
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
|
-
|
|
338
|
-
|
|
339
|
-
color: theme.colors.onSurfaceDisabled,
|
|
340
|
-
},
|
|
341
|
-
hovered: {},
|
|
342
|
-
default: {},
|
|
365
|
+
outlined: {
|
|
366
|
+
color: theme.colors.primary,
|
|
343
367
|
},
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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
|
-
|
|
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
|
-
|
|
369
|
-
|
|
370
|
-
marginHorizontal: theme.spacings['4'],
|
|
386
|
+
},
|
|
387
|
+
}));
|
|
371
388
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
-
|
|
379
|
-
|
|
380
|
-
color: theme.colors.onSurfaceDisabled,
|
|
381
|
-
},
|
|
382
|
-
hovered: {},
|
|
383
|
-
default: {},
|
|
403
|
+
text: {
|
|
404
|
+
color: theme.colors.primary,
|
|
384
405
|
},
|
|
385
|
-
|
|
386
|
-
|
|
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
|
-
|
|
413
|
-
|
|
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
|
|
432
|
+
export const buttonActivityIndicatorStyles = getRegisteredComponentStylesWithFallback(
|
|
433
|
+
'ButtonActivityIndicator',
|
|
434
|
+
buttonActivityIndicatorStylesDefault,
|
|
435
|
+
);
|
package/components/Card/Card.tsx
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 {
|
|
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
|
-
|
|
29
|
-
|
|
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 {
|
|
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
|
-
|
|
32
|
-
|
|
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 {
|
|
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
|
-
|
|
111
|
-
|
|
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
|
|
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';
|
package/components/Card/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
4
4
|
|
|
5
5
|
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
|
-
|
|
20
|
-
Card_Actions
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export const cardActionsStyles = getRegisteredMoleculesComponentStyles('Card_Actions');
|
|
19
|
+
export const cardActionsStyles = getRegisteredComponentStylesWithFallback(
|
|
20
|
+
'Card_Actions',
|
|
21
|
+
cardActionsStylesDefault,
|
|
22
|
+
);
|