@wq/material-native 2.0.0-alpha.2 → 2.0.0
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/package.json +2 -2
- package/src/App.js +23 -5
- package/src/components/IconButton.js +1 -1
- package/src/components/Img.js +1 -1
- package/src/components/index.js +0 -8
- package/src/inputs/index.js +8 -0
- /package/src/{components → inputs}/Fieldset.js +0 -0
- /package/src/{components → inputs}/FieldsetArray.js +0 -0
- /package/src/{components → inputs}/FileArray.js +0 -0
- /package/src/{components → inputs}/FlatFieldset.js +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wq/material-native",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "React Native and Expo bindings for @wq/material",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://wq.io/@wq/material",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@wq/react": "^2.0.0
|
|
31
|
+
"@wq/react": "^2.0.0",
|
|
32
32
|
"date-fns": "^2.30.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
package/src/App.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import { App as DefaultApp, usePlugin } from "@wq/react";
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
MD2LightTheme,
|
|
5
|
+
MD3LightTheme,
|
|
6
|
+
MD2DarkTheme,
|
|
7
|
+
MD3DarkTheme,
|
|
6
8
|
Provider as PaperProvider,
|
|
7
9
|
} from "react-native-paper";
|
|
8
10
|
|
|
11
|
+
const THEMES = {
|
|
12
|
+
"light-2": MD2LightTheme,
|
|
13
|
+
"light-3": MD3LightTheme,
|
|
14
|
+
"dark-2": MD2DarkTheme,
|
|
15
|
+
"dark-3": MD3DarkTheme,
|
|
16
|
+
};
|
|
17
|
+
|
|
9
18
|
export default function App() {
|
|
10
19
|
const { theme: configTheme } = usePlugin("material").config,
|
|
11
20
|
theme = useMemo(() => createTheme(configTheme), [configTheme]),
|
|
@@ -26,9 +35,18 @@ export default function App() {
|
|
|
26
35
|
);
|
|
27
36
|
}
|
|
28
37
|
|
|
29
|
-
function createTheme({
|
|
38
|
+
function createTheme({
|
|
39
|
+
type = "light",
|
|
40
|
+
version = 3,
|
|
41
|
+
primary,
|
|
42
|
+
secondary,
|
|
43
|
+
background,
|
|
44
|
+
}) {
|
|
30
45
|
const colors = {},
|
|
31
|
-
base = type
|
|
46
|
+
base = THEMES[`${type}-${version}`];
|
|
47
|
+
if (!base) {
|
|
48
|
+
console.warn(`Unknown base theme type=${type} version=${version}`);
|
|
49
|
+
}
|
|
32
50
|
if (primary) {
|
|
33
51
|
colors.primary = primary;
|
|
34
52
|
}
|
|
@@ -41,7 +59,7 @@ function createTheme({ type, primary, secondary, background }) {
|
|
|
41
59
|
return {
|
|
42
60
|
...base,
|
|
43
61
|
colors: {
|
|
44
|
-
...base.colors,
|
|
62
|
+
...(base || {}).colors,
|
|
45
63
|
...colors,
|
|
46
64
|
},
|
|
47
65
|
};
|
package/src/components/Img.js
CHANGED
|
@@ -93,7 +93,7 @@ export default function Img({ src, onPress, onClick, style, ...props }) {
|
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
Img.propTypes = {
|
|
96
|
-
src: PropTypes.oneOfType(PropTypes.string, PropTypes.number),
|
|
96
|
+
src: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
97
97
|
width: PropTypes.number,
|
|
98
98
|
height: PropTypes.number,
|
|
99
99
|
onPress: PropTypes.func,
|
package/src/components/index.js
CHANGED
|
@@ -47,10 +47,6 @@ import TablePagination from "./TablePagination.js";
|
|
|
47
47
|
|
|
48
48
|
import FormRoot from "./FormRoot.js";
|
|
49
49
|
import FormError from "./FormError.js";
|
|
50
|
-
import Fieldset from "./Fieldset.js";
|
|
51
|
-
import FlatFieldset from "./FlatFieldset.js";
|
|
52
|
-
import FieldsetArray from "./FieldsetArray.js";
|
|
53
|
-
import FileArray from "./FileArray.js";
|
|
54
50
|
import CancelButton from "./CancelButton.js";
|
|
55
51
|
import SubmitButton from "./SubmitButton.js";
|
|
56
52
|
import IconSubmitButton from "./IconSubmitButton.js";
|
|
@@ -121,10 +117,6 @@ export {
|
|
|
121
117
|
export {
|
|
122
118
|
FormRoot,
|
|
123
119
|
FormError,
|
|
124
|
-
Fieldset,
|
|
125
|
-
FlatFieldset,
|
|
126
|
-
FieldsetArray,
|
|
127
|
-
FileArray,
|
|
128
120
|
CancelButton,
|
|
129
121
|
SubmitButton,
|
|
130
122
|
IconSubmitButton,
|
package/src/inputs/index.js
CHANGED
|
@@ -8,6 +8,10 @@ import Radio from "./Radio.js";
|
|
|
8
8
|
import Toggle from "./Toggle.js";
|
|
9
9
|
import Hidden from "./Hidden.js";
|
|
10
10
|
import HelperText from "./HelperText.js";
|
|
11
|
+
import Fieldset from "./Fieldset.js";
|
|
12
|
+
import FlatFieldset from "./FlatFieldset.js";
|
|
13
|
+
import FieldsetArray from "./FieldsetArray.js";
|
|
14
|
+
import FileArray from "./FileArray.js";
|
|
11
15
|
|
|
12
16
|
const Date = DateTime;
|
|
13
17
|
const Time = DateTime;
|
|
@@ -27,4 +31,8 @@ export {
|
|
|
27
31
|
Toggle,
|
|
28
32
|
Hidden,
|
|
29
33
|
HelperText,
|
|
34
|
+
Fieldset,
|
|
35
|
+
FlatFieldset,
|
|
36
|
+
FieldsetArray,
|
|
37
|
+
FileArray,
|
|
30
38
|
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|