@wq/material-native 2.0.0-alpha.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/README.md +29 -0
- package/babel.config.cjs +10 -0
- package/jest.config.js +9 -0
- package/package.json +58 -0
- package/setup-jest.js +5 -0
- package/src/App.js +48 -0
- package/src/components/Breadcrumbs.js +3 -0
- package/src/components/Button.js +46 -0
- package/src/components/ButtonLink.js +14 -0
- package/src/components/CancelButton.js +3 -0
- package/src/components/CheckboxButton.js +3 -0
- package/src/components/Chip.js +67 -0
- package/src/components/Container.js +3 -0
- package/src/components/DeleteForm.js +64 -0
- package/src/components/Divider.js +3 -0
- package/src/components/ExpandableListItem.js +46 -0
- package/src/components/ExpansionPanel.js +22 -0
- package/src/components/Fab.js +29 -0
- package/src/components/Fieldset.js +3 -0
- package/src/components/FieldsetArray.js +21 -0
- package/src/components/FileArray.js +3 -0
- package/src/components/FlatFieldset.js +3 -0
- package/src/components/Footer.js +3 -0
- package/src/components/FooterContent.js +3 -0
- package/src/components/FormError.js +15 -0
- package/src/components/FormRoot.js +3 -0
- package/src/components/FormatJson.js +15 -0
- package/src/components/Header.js +22 -0
- package/src/components/HomeLink.js +3 -0
- package/src/components/HorizontalView.js +22 -0
- package/src/components/IconButton.js +32 -0
- package/src/components/IconSubmitButton.js +12 -0
- package/src/components/Link.js +15 -0
- package/src/components/List.js +3 -0
- package/src/components/ListItem.js +22 -0
- package/src/components/ListItemLink.js +13 -0
- package/src/components/ListSubheader.js +3 -0
- package/src/components/Main.js +3 -0
- package/src/components/Pagination.js +3 -0
- package/src/components/Popup.js +3 -0
- package/src/components/RadioButton.js +3 -0
- package/src/components/ScrollView.js +22 -0
- package/src/components/SidePanel.js +3 -0
- package/src/components/Spinner.js +16 -0
- package/src/components/SubmitButton.js +17 -0
- package/src/components/Switch.js +3 -0
- package/src/components/Table.js +3 -0
- package/src/components/TableBody.js +3 -0
- package/src/components/TableCell.js +3 -0
- package/src/components/TableContainer.js +2 -0
- package/src/components/TableHead.js +3 -0
- package/src/components/TablePagination.js +3 -0
- package/src/components/TableRow.js +3 -0
- package/src/components/TableTitle.js +3 -0
- package/src/components/Text.js +3 -0
- package/src/components/Typography.js +39 -0
- package/src/components/View.js +3 -0
- package/src/components/index.js +119 -0
- package/src/hooks.js +6 -0
- package/src/icons.js +9 -0
- package/src/index.js +45 -0
- package/src/inputs/Checkbox.js +38 -0
- package/src/inputs/DateTime.js +61 -0
- package/src/inputs/File.js +3 -0
- package/src/inputs/HelperText.js +3 -0
- package/src/inputs/Hidden.js +22 -0
- package/src/inputs/Image.js +3 -0
- package/src/inputs/Input.js +72 -0
- package/src/inputs/Radio.js +3 -0
- package/src/inputs/Select.js +52 -0
- package/src/inputs/Toggle.js +3 -0
- package/src/inputs/date-utils.js +21 -0
- package/src/inputs/index.js +30 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import RNPickerSelect from "react-native-picker-select";
|
|
3
|
+
import { TextInput, useTheme } from "react-native-paper";
|
|
4
|
+
import { useField } from "formik";
|
|
5
|
+
import PropTypes from "prop-types";
|
|
6
|
+
|
|
7
|
+
export default function Select({ name, choices, label }) {
|
|
8
|
+
const theme = useTheme(),
|
|
9
|
+
[, meta, helpers] = useField(name),
|
|
10
|
+
{ value } = meta,
|
|
11
|
+
{ setValue } = helpers;
|
|
12
|
+
|
|
13
|
+
const styles = {
|
|
14
|
+
inputIOS: {
|
|
15
|
+
color: theme.colors.text,
|
|
16
|
+
marginLeft: 12,
|
|
17
|
+
paddingTop: 32,
|
|
18
|
+
fontSize: 16,
|
|
19
|
+
},
|
|
20
|
+
inputAndroid: {
|
|
21
|
+
color: theme.colors.text,
|
|
22
|
+
marginLeft: 4,
|
|
23
|
+
paddingTop: 40,
|
|
24
|
+
paddingBottom: 40,
|
|
25
|
+
marginBottom: -40,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<TextInput
|
|
31
|
+
label={label}
|
|
32
|
+
value={"-"}
|
|
33
|
+
render={() => (
|
|
34
|
+
<RNPickerSelect
|
|
35
|
+
value={value}
|
|
36
|
+
onValueChange={setValue}
|
|
37
|
+
items={choices.map(({ name, label }) => ({
|
|
38
|
+
value: name,
|
|
39
|
+
label,
|
|
40
|
+
}))}
|
|
41
|
+
style={styles}
|
|
42
|
+
/>
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
Select.propTypes = {
|
|
49
|
+
name: PropTypes.string,
|
|
50
|
+
label: PropTypes.string,
|
|
51
|
+
choices: PropTypes.arrayOf(PropTypes.object),
|
|
52
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { parseISO, formatISO9075 } from "date-fns";
|
|
2
|
+
|
|
3
|
+
export const format = {
|
|
4
|
+
date: (value) => tryFormat(value, { representation: "date" }),
|
|
5
|
+
time: (value) => tryFormat(value, { representation: "time" }),
|
|
6
|
+
datetime: (value) => tryFormat(value),
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function tryFormat(value, options) {
|
|
10
|
+
try {
|
|
11
|
+
return formatISO9075(value, options);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const parse = {
|
|
18
|
+
date: (value) => (value ? parseISO(value) : null),
|
|
19
|
+
time: (value) => (value ? parseISO("9999-01-01 " + value) : null),
|
|
20
|
+
datetime: (value) => (value ? parseISO(value) : null),
|
|
21
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Input from "./Input.js";
|
|
2
|
+
import Checkbox from "./Checkbox.js";
|
|
3
|
+
import DateTime from "./DateTime.js";
|
|
4
|
+
import File from "./File.js";
|
|
5
|
+
import Image from "./Image.js";
|
|
6
|
+
import Select from "./Select.js";
|
|
7
|
+
import Radio from "./Radio.js";
|
|
8
|
+
import Toggle from "./Toggle.js";
|
|
9
|
+
import Hidden from "./Hidden.js";
|
|
10
|
+
import HelperText from "./HelperText.js";
|
|
11
|
+
|
|
12
|
+
const Date = DateTime;
|
|
13
|
+
const Time = DateTime;
|
|
14
|
+
const dateTime = DateTime;
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
Input,
|
|
18
|
+
Checkbox,
|
|
19
|
+
DateTime,
|
|
20
|
+
Date,
|
|
21
|
+
Time,
|
|
22
|
+
dateTime,
|
|
23
|
+
File,
|
|
24
|
+
Image,
|
|
25
|
+
Select,
|
|
26
|
+
Radio,
|
|
27
|
+
Toggle,
|
|
28
|
+
Hidden,
|
|
29
|
+
HelperText,
|
|
30
|
+
};
|