react-native-molecules 0.5.0-beta.1 → 0.5.0-beta.2
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/index.tsx +1 -6
- package/components/Accordion/utils.ts +17 -14
- package/components/ActivityIndicator/ActivityIndicator.tsx +6 -5
- 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 +3 -1
- package/components/Button/index.tsx +1 -5
- package/components/Button/utils.ts +5 -6
- 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/index.tsx +1 -5
- package/components/Chip/utils.ts +2 -6
- 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 +1 -5
- package/components/DatePickerInput/utils.ts +5 -6
- 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/index.tsx +1 -5
- package/components/ElementGroup/utils.ts +5 -6
- package/components/FAB/index.tsx +1 -5
- package/components/FAB/utils.ts +2 -6
- 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 +2 -4
- package/components/Icon/index.tsx +1 -5
- package/components/IconButton/IconButton.tsx +3 -1
- package/components/IconButton/index.tsx +1 -5
- package/components/IconButton/utils.ts +11 -16
- 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 +2 -6
- package/components/ListItem/index.tsx +1 -5
- package/components/ListItem/utils.ts +13 -11
- 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/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 +1 -5
- package/components/RadioButton/utils.ts +9 -8
- package/components/Rating/index.tsx +1 -5
- package/components/Rating/utils.ts +6 -8
- package/components/StateLayer/index.tsx +1 -5
- package/components/StateLayer/utils.ts +5 -6
- package/components/Surface/index.tsx +1 -5
- package/components/Surface/utils.ts +5 -6
- package/components/Switch/index.tsx +1 -5
- package/components/Switch/utils.ts +2 -6
- 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 +1 -0
- 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/index.tsx +1 -5
- package/components/TimePickerModal/utils.ts +5 -6
- package/components/Tooltip/index.tsx +1 -5
- package/components/Tooltip/utils.ts +5 -6
- 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/package.json +1 -3
- package/utils/lodash.ts +0 -1
- package/utils/repository.ts +2 -52
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
React Native Molecules
|
|
2
|
+
================
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
<h3 align="center">
|
|
6
|
+
Material 3-powered primitives for React Native + Web.<br/>
|
|
7
|
+
<a href="https://github.com/webbeetechnologies/react-native-molecules/tree/main/docs">Explore the docs</a>
|
|
8
|
+
</h3>
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
[![Version][version-badge]][package] [![MIT License][license-badge]][license]
|
|
13
|
+
|
|
14
|
+
<p align="center"><i>React Native Molecules ships a comprehensive library of React Native + Web components powered by Material 3 tokens. Every component includes production-ready props, sensible defaults, and playground docs in the `/docs` site.</i></p>
|
|
15
|
+
|
|
16
|
+
Why React Native Molecules?
|
|
17
|
+
---------------------
|
|
18
|
+
|
|
19
|
+
- High performance – built on top of `react-native-unistyles`, with CSS variables on the web.
|
|
20
|
+
- Modular & lightweight – no barrel files, self-registerable components, and optional peer deps.
|
|
21
|
+
- Fully customizable – swap internal implementations or override styles using your own tokens.
|
|
22
|
+
- Unified design – ships with Material 3 light/dark themes out-of-the-box.
|
|
23
|
+
|
|
24
|
+
Quick start
|
|
25
|
+
-----------
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Button } from 'react-native-molecules/components/Button';
|
|
29
|
+
|
|
30
|
+
export function MyComponent() {
|
|
31
|
+
return <Button onPress={() => console.log('Pressed!')}>Click me</Button>;
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Installation overview
|
|
36
|
+
---------------------
|
|
37
|
+
|
|
38
|
+
> Refer to `docs/docs/getting-started/installation.mdx` for the full walkthrough.
|
|
39
|
+
|
|
40
|
+
1. **Prerequisites**
|
|
41
|
+
- React Native New Architecture (Fabric)
|
|
42
|
+
- React 19 or higher
|
|
43
|
+
2. **Install the package**
|
|
44
|
+
```bash
|
|
45
|
+
pnpm add react-native-molecules
|
|
46
|
+
```
|
|
47
|
+
(npm and yarn examples are in the docs; pnpm is recommended for the monorepo.)
|
|
48
|
+
3. **Add peer dependencies**
|
|
49
|
+
Required:
|
|
50
|
+
```bash
|
|
51
|
+
pnpm add react-native-unistyles
|
|
52
|
+
```
|
|
53
|
+
Optional per-component deps, e.g. `FilePicker` requires `@react-native-documents/picker`.
|
|
54
|
+
4. **Configure fonts & icons (web)**
|
|
55
|
+
- Copy `MaterialDesignIcons.ttf` from `@react-native-vector-icons/material-design-icons/Fonts/` into your public assets.
|
|
56
|
+
- Register the font via `@font-face`.
|
|
57
|
+
5. **Register Unistyles themes**
|
|
58
|
+
Set up `StyleSheet.configure` with provided MD3 light/dark themes and your breakpoints for typed theme access.
|
|
59
|
+
6. **Wrap with `PortalProvider` (optional)**
|
|
60
|
+
Needed for components that render inside portals (e.g., `Popover`, `Tooltip`, `Menu`, `Modal`).
|
|
61
|
+
|
|
62
|
+
Next steps
|
|
63
|
+
----------
|
|
64
|
+
|
|
65
|
+
1. Read `docs/docs/getting-started/introduction.mdx` for an overview of the component catalog, hooks, and customization guides.
|
|
66
|
+
2. Follow the Installation guide above to wire up peer dependencies, fonts, and theming.
|
|
67
|
+
3. Explore the rest of the docs to dive into components, hooks, and utilities. Each entry includes prop tables, behavior notes, and playground examples.
|
|
68
|
+
|
|
69
|
+
Contributing
|
|
70
|
+
------------
|
|
71
|
+
|
|
72
|
+
We welcome issues and pull requests. Please ensure any new component stories and docs accompany your changes so they appear in the React Native Molecules docs site.
|
|
73
|
+
|
|
74
|
+
[build-badge]: https://github.com/webbeetechnologies/react-native-molecules/actions/workflows/lint.yml/badge.svg
|
|
75
|
+
[build]: https://github.com/webbeetechnologies/react-native-molecules/actions/workflows/lint.yml
|
|
76
|
+
[version-badge]: https://img.shields.io/npm/v/react-native-molecules.svg
|
|
77
|
+
[package]: https://www.npmjs.com/package/react-native-molecules
|
|
78
|
+
[license-badge]: https://img.shields.io/badge/license-MIT-green.svg
|
|
79
|
+
[license]: https://github.com/webbeetechnologies/react-native-molecules/blob/main/LICENSE
|
|
80
|
+
[all-contributors-badge]: https://img.shields.io/badge/all_contributors-7-orange.svg?style=flat-square
|
|
81
|
+
[all-contributors]: #contributors
|
|
82
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
|
|
83
|
+
[prs-welcome]: https://github.com/webbeetechnologies/react-native-molecules/issues
|
|
84
|
+
[chat-badge]: https://img.shields.io/badge/chat-Discussions-5865F2.svg
|
|
85
|
+
[chat]: https://github.com/webbeetechnologies/react-native-molecules/discussions
|
|
86
|
+
[taylordb-badge]: https://img.shields.io/badge/sponsored%20by-TaylorDB-000000.svg
|
|
87
|
+
[taylordb]: https://taylordb.com/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import AccordionDefault from './Accordion';
|
|
3
3
|
import AccordionItemComponent from './AccordionItem';
|
|
4
4
|
import AccordionItemContent from './AccordionItemContent';
|
|
@@ -9,11 +9,6 @@ const AccordionItemDefault = Object.assign(AccordionItemComponent, {
|
|
|
9
9
|
Content: AccordionItemContent,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
registerMoleculesComponents({
|
|
13
|
-
Accordion: AccordionDefault,
|
|
14
|
-
AccordionItem: AccordionItemDefault,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
12
|
export const Accordion = getRegisteredComponentWithFallback('Accordion', AccordionDefault);
|
|
18
13
|
export const AccordionItem = getRegisteredComponentWithFallback(
|
|
19
14
|
'AccordionItem',
|
|
@@ -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
|
const accordionStylesDefault = StyleSheet.create({
|
|
6
6
|
root: {},
|
|
@@ -47,16 +47,19 @@ const accordionItemContentStylesDefault = StyleSheet.create(theme => ({
|
|
|
47
47
|
},
|
|
48
48
|
}));
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
Accordion
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
export const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
50
|
+
export const accordionStyles = getRegisteredComponentStylesWithFallback(
|
|
51
|
+
'Accordion',
|
|
52
|
+
accordionStylesDefault,
|
|
53
|
+
);
|
|
54
|
+
export const accordionItemStyles = getRegisteredComponentStylesWithFallback(
|
|
55
|
+
'AccordionItem',
|
|
56
|
+
accordionItemStylesDefault,
|
|
57
|
+
);
|
|
58
|
+
export const accordionItemHeaderStyles = getRegisteredComponentStylesWithFallback(
|
|
59
|
+
'AccordionItem_Header',
|
|
60
|
+
accordionItemHeaderStylesDefault,
|
|
61
|
+
);
|
|
62
|
+
export const accordionItemContentStyles = getRegisteredComponentStylesWithFallback(
|
|
63
|
+
'AccordionItem_Content',
|
|
64
|
+
accordionItemContentStylesDefault,
|
|
65
|
+
);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import { StyleSheet } from 'react-native-unistyles';
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
13
13
|
import AnimatedSpinner from './AnimatedSpinner';
|
|
14
14
|
|
|
15
15
|
export type Props = ActivityIndicatorProps & {
|
|
@@ -161,7 +161,7 @@ const ActivityIndicator = ({
|
|
|
161
161
|
return (
|
|
162
162
|
<AnimatedSpinner
|
|
163
163
|
key={index}
|
|
164
|
-
style={componentStyles.
|
|
164
|
+
style={componentStyles.layer}
|
|
165
165
|
index={index}
|
|
166
166
|
size={size}
|
|
167
167
|
color={color}
|
|
@@ -193,8 +193,9 @@ export const activityIndicatorStylesDefault = StyleSheet.create(theme => ({
|
|
|
193
193
|
},
|
|
194
194
|
}));
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
196
|
+
export const activityIndicatorStyles = getRegisteredComponentStylesWithFallback(
|
|
197
|
+
'ActivityIndicator',
|
|
198
|
+
activityIndicatorStylesDefault,
|
|
199
|
+
);
|
|
199
200
|
|
|
200
201
|
export default memo(ActivityIndicator);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import ActivityIndicatorDefault from './ActivityIndicator';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
ActivityIndicator: ActivityIndicatorDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const ActivityIndicator = getRegisteredComponentWithFallback(
|
|
9
5
|
'ActivityIndicator',
|
|
10
6
|
ActivityIndicatorDefault,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
|
|
3
|
-
import { getRegisteredComponentWithFallback
|
|
3
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
4
4
|
import AppbarActions from './AppbarActions';
|
|
5
5
|
import AppbarBase from './AppbarBase';
|
|
6
6
|
import AppbarCenterAligned from './AppbarCenterAligned';
|
|
@@ -23,9 +23,6 @@ export const AppbarDefault = Object.assign(AppbarBase as ComponentType<AppbarPro
|
|
|
23
23
|
Title: AppbarTitle,
|
|
24
24
|
Actions: AppbarActions,
|
|
25
25
|
});
|
|
26
|
-
registerMoleculesComponents({
|
|
27
|
-
Appbar: AppbarDefault,
|
|
28
|
-
});
|
|
29
26
|
|
|
30
27
|
export const Appbar = getRegisteredComponentWithFallback('Appbar', AppbarDefault);
|
|
31
28
|
|
|
@@ -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
|
const appbarBaseStylesDefault = StyleSheet.create(theme => ({
|
|
6
6
|
root: {
|
|
@@ -105,23 +105,35 @@ const appbarLeftDefault = StyleSheet.create(theme => ({
|
|
|
105
105
|
},
|
|
106
106
|
}));
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
Appbar
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
export const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
export const appbarLargeStyles =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
108
|
+
export const appbarBaseStyles = getRegisteredComponentStylesWithFallback(
|
|
109
|
+
'Appbar',
|
|
110
|
+
appbarBaseStylesDefault,
|
|
111
|
+
);
|
|
112
|
+
export const appbarCenterAlignedStyles = getRegisteredComponentStylesWithFallback(
|
|
113
|
+
'Appbar_CenterAligned',
|
|
114
|
+
appbarCenterAlignedStylesDefault,
|
|
115
|
+
);
|
|
116
|
+
export const appbarSmallStyles = getRegisteredComponentStylesWithFallback(
|
|
117
|
+
'Appbar_Small',
|
|
118
|
+
appbarSmallStylesDefault,
|
|
119
|
+
);
|
|
120
|
+
export const appbarMediumStyles = getRegisteredComponentStylesWithFallback(
|
|
121
|
+
'Appbar_Medium',
|
|
122
|
+
appbarMediumStylesDefault,
|
|
123
|
+
);
|
|
124
|
+
export const appbarLargeStyles = getRegisteredComponentStylesWithFallback(
|
|
125
|
+
'Appbar_Large',
|
|
126
|
+
appbarLargeStylesDefault,
|
|
127
|
+
);
|
|
128
|
+
export const appbarTitle = getRegisteredComponentStylesWithFallback(
|
|
129
|
+
'Appbar_Title',
|
|
130
|
+
appbarTitleDefault,
|
|
131
|
+
);
|
|
132
|
+
export const appbarRight = getRegisteredComponentStylesWithFallback(
|
|
133
|
+
'Appbar_Right',
|
|
134
|
+
appbarRightDefault,
|
|
135
|
+
);
|
|
136
|
+
export const appbarLeft = getRegisteredComponentStylesWithFallback(
|
|
137
|
+
'Appbar_Left',
|
|
138
|
+
appbarLeftDefault,
|
|
139
|
+
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import AvatarDefault from './Avatar';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
Avatar: AvatarDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const Avatar = getRegisteredComponentWithFallback('Avatar', AvatarDefault);
|
|
9
5
|
|
|
10
6
|
export type { Props as AvatarProps } from './Avatar';
|
|
@@ -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
|
const avatarStylesDefault = StyleSheet.create(theme => ({
|
|
6
6
|
root: {
|
|
@@ -28,8 +28,4 @@ const avatarStylesDefault = StyleSheet.create(theme => ({
|
|
|
28
28
|
},
|
|
29
29
|
}));
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
Avatar: avatarStylesDefault,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export const avatarStyles = getRegisteredMoleculesComponentStyles('Avatar');
|
|
31
|
+
export const avatarStyles = getRegisteredComponentStylesWithFallback('Avatar', avatarStylesDefault);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { memo } from 'react';
|
|
2
|
-
import { Pressable } from 'react-native';
|
|
2
|
+
import { Pressable, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import type { BackdropProps } from './types';
|
|
5
5
|
import { backdropStyles } from './utils';
|
|
@@ -10,7 +10,7 @@ const Backdrop = ({ style, ...rest }: BackdropProps) => {
|
|
|
10
10
|
accessible={false}
|
|
11
11
|
importantForAccessibility="no"
|
|
12
12
|
{...rest}
|
|
13
|
-
style={[backdropStyles.root, style]}
|
|
13
|
+
style={[backdropStyles.root, style as ViewStyle]}
|
|
14
14
|
/>
|
|
15
15
|
);
|
|
16
16
|
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import BackdropDefault from './Backdrop';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
Backdrop: BackdropDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const Backdrop = getRegisteredComponentWithFallback('Backdrop', BackdropDefault);
|
|
9
5
|
|
|
10
6
|
export type { BackdropProps } from './types';
|
|
@@ -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
|
const backdropStylesDefault = StyleSheet.create({
|
|
6
6
|
root: {
|
|
@@ -14,8 +14,7 @@ const backdropStylesDefault = StyleSheet.create({
|
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
Backdrop
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
export const backdropStyles = getRegisteredMoleculesComponentStyles('Backdrop');
|
|
17
|
+
export const backdropStyles = getRegisteredComponentStylesWithFallback(
|
|
18
|
+
'Backdrop',
|
|
19
|
+
backdropStylesDefault,
|
|
20
|
+
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import BadgeDefault from './Badge';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
Badge: BadgeDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const Badge = getRegisteredComponentWithFallback('Badge', BadgeDefault);
|
|
9
5
|
|
|
10
6
|
export type { Props as BadgeProps } from './Badge';
|
|
@@ -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
|
const badgeStylesDefault = StyleSheet.create(theme => ({
|
|
6
6
|
root: {
|
|
@@ -31,8 +31,4 @@ const badgeStylesDefault = StyleSheet.create(theme => ({
|
|
|
31
31
|
},
|
|
32
32
|
}));
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
Badge: badgeStylesDefault,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export const badgeStyles = getRegisteredMoleculesComponentStyles('Badge');
|
|
34
|
+
export const badgeStyles = getRegisteredComponentStylesWithFallback('Badge', badgeStylesDefault);
|
|
@@ -166,7 +166,8 @@ const Button = (
|
|
|
166
166
|
|
|
167
167
|
defaultStyles.useVariants({
|
|
168
168
|
variant,
|
|
169
|
-
|
|
169
|
+
// @ts-ignore // TODO - fix this
|
|
170
|
+
state: state as any,
|
|
170
171
|
size,
|
|
171
172
|
});
|
|
172
173
|
|
|
@@ -248,6 +249,7 @@ const Button = (
|
|
|
248
249
|
],
|
|
249
250
|
iconContainerStyle: [defaultStyles.iconContainer, iconContainerStyleProp],
|
|
250
251
|
textStyle: [
|
|
252
|
+
// @ts-ignore // TODO - fix this
|
|
251
253
|
isVariant('text') ? (iconName || loading ? labelTextAddons : labelText) : label,
|
|
252
254
|
textRelatedStyle,
|
|
253
255
|
labelStyle,
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
1
|
+
import { getRegisteredComponentWithFallback } from '../../core';
|
|
2
2
|
import ButtonDefault from './Button';
|
|
3
3
|
|
|
4
|
-
registerMoleculesComponents({
|
|
5
|
-
Button: ButtonDefault,
|
|
6
|
-
});
|
|
7
|
-
|
|
8
4
|
export const Button = getRegisteredComponentWithFallback('Button', ButtonDefault);
|
|
9
5
|
|
|
10
6
|
export type { Props as ButtonProps } from './Button';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { StyleSheet } from 'react-native-unistyles';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { getRegisteredComponentStylesWithFallback } from '../../core';
|
|
5
5
|
|
|
6
6
|
export const sizeToIconSizeMap = {
|
|
7
7
|
xs: 18,
|
|
@@ -407,8 +407,7 @@ const defaultStylesDefault = StyleSheet.create(theme => {
|
|
|
407
407
|
};
|
|
408
408
|
});
|
|
409
409
|
|
|
410
|
-
|
|
411
|
-
Button
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
export const defaultStyles = getRegisteredMoleculesComponentStyles('Button');
|
|
410
|
+
export const defaultStyles = getRegisteredComponentStylesWithFallback(
|
|
411
|
+
'Button',
|
|
412
|
+
defaultStylesDefault,
|
|
413
|
+
);
|
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
|
+
);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { getRegisteredComponentWithFallback
|
|
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';
|