ferns-ui 0.2.0 → 0.2.3
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/dist/ActionSheet.js.map +1 -1
- package/dist/Button.js +1 -2
- package/dist/Button.js.map +1 -1
- package/dist/CheckBox.js +1 -1
- package/dist/CheckBox.js.map +1 -1
- package/dist/Common.d.ts +3 -3
- package/dist/Common.js.map +1 -1
- package/dist/DateTimeActionSheet.js.map +1 -1
- package/dist/DecimalRangeActionSheet.js.map +1 -1
- package/dist/ErrorBoundary.d.ts +1 -1
- package/dist/Field.d.ts +12 -14
- package/dist/Field.js +95 -98
- package/dist/Field.js.map +1 -1
- package/dist/HeightActionSheet.js.map +1 -1
- package/dist/Icon.d.ts +0 -3
- package/dist/Icon.js +4 -112
- package/dist/Icon.js.map +1 -1
- package/dist/IconButton.js +1 -1
- package/dist/IconButton.js.map +1 -1
- package/dist/NumberPickerActionSheet.js.map +1 -1
- package/dist/PickerSelect.d.ts +4 -4
- package/dist/Pog.js +1 -1
- package/dist/Pog.js.map +1 -1
- package/dist/SplitPage.js.map +1 -1
- package/dist/TapToEdit.js +1 -1
- package/dist/TapToEdit.js.map +1 -1
- package/dist/TextField.js +1 -1
- package/dist/TextField.js.map +1 -1
- package/dist/TextFieldNumberActionSheet.js.map +1 -1
- package/dist/Unifier.js +1 -9
- package/dist/Unifier.js.map +1 -1
- package/package.json +31 -30
- package/src/Button.tsx +1 -1
- package/src/CheckBox.tsx +1 -1
- package/src/Common.ts +3 -2
- package/src/Field.tsx +91 -98
- package/src/Icon.tsx +3 -122
- package/src/IconButton.tsx +1 -1
- package/src/Pog.tsx +2 -2
- package/src/TapToEdit.tsx +1 -1
- package/src/TextField.tsx +1 -1
- package/src/TextFieldNumberActionSheet.tsx +1 -1
- package/dist/Banner.stories.d.ts +0 -1
- package/dist/Banner.stories.js +0 -13
- package/dist/Banner.stories.js.map +0 -1
- package/dist/Box.stories.d.ts +0 -1
- package/dist/Box.stories.js +0 -45
- package/dist/Box.stories.js.map +0 -1
- package/dist/Button.stories.d.ts +0 -1
- package/dist/Button.stories.js +0 -41
- package/dist/Button.stories.js.map +0 -1
- package/dist/Card.stories.d.ts +0 -6
- package/dist/Card.stories.js +0 -18
- package/dist/Card.stories.js.map +0 -1
- package/dist/CheckBox.stories.d.ts +0 -1
- package/dist/CheckBox.stories.js +0 -28
- package/dist/CheckBox.stories.js.map +0 -1
- package/dist/Field.stories.d.ts +0 -6
- package/dist/Field.stories.js +0 -38
- package/dist/Field.stories.js.map +0 -1
- package/dist/Form.stories.d.ts +0 -6
- package/dist/Form.stories.js +0 -36
- package/dist/Form.stories.js.map +0 -1
- package/dist/HeaderButtons.stories.d.ts +0 -6
- package/dist/HeaderButtons.stories.js +0 -6
- package/dist/HeaderButtons.stories.js.map +0 -1
- package/dist/Heading.stories.d.ts +0 -1
- package/dist/Heading.stories.js +0 -22
- package/dist/Heading.stories.js.map +0 -1
- package/dist/Icon.stories.d.ts +0 -1
- package/dist/Icon.stories.js +0 -30
- package/dist/Icon.stories.js.map +0 -1
- package/dist/IconButton.stories.d.ts +0 -1
- package/dist/IconButton.stories.js +0 -16
- package/dist/IconButton.stories.js.map +0 -1
- package/dist/Link.stories.d.ts +0 -1
- package/dist/Link.stories.js +0 -18
- package/dist/Link.stories.js.map +0 -1
- package/dist/Mask.stories.d.ts +0 -1
- package/dist/Mask.stories.js +0 -28
- package/dist/Mask.stories.js.map +0 -1
- package/dist/Pill.stories.d.ts +0 -1
- package/dist/Pill.stories.js +0 -38
- package/dist/Pill.stories.js.map +0 -1
- package/dist/SegmentedControl.stories.d.ts +0 -1
- package/dist/SegmentedControl.stories.js +0 -31
- package/dist/SegmentedControl.stories.js.map +0 -1
- package/dist/SelectList.stories.d.ts +0 -1
- package/dist/SelectList.stories.js +0 -26
- package/dist/SelectList.stories.js.map +0 -1
- package/dist/Spinner.stories.d.ts +0 -1
- package/dist/Spinner.stories.js +0 -12
- package/dist/Spinner.stories.js.map +0 -1
- package/dist/SplitPage.stories.d.ts +0 -1
- package/dist/SplitPage.stories.js +0 -15
- package/dist/SplitPage.stories.js.map +0 -1
- package/dist/StorybookContainer.d.ts +0 -4
- package/dist/StorybookContainer.js +0 -8
- package/dist/StorybookContainer.js.map +0 -1
- package/dist/Switch.stories.d.ts +0 -1
- package/dist/Switch.stories.js +0 -34
- package/dist/Switch.stories.js.map +0 -1
- package/dist/Text.stories.d.ts +0 -1
- package/dist/Text.stories.js +0 -37
- package/dist/Text.stories.js.map +0 -1
- package/dist/TextArea.stories.d.ts +0 -10
- package/dist/TextArea.stories.js +0 -24
- package/dist/TextArea.stories.js.map +0 -1
- package/dist/TextField.stories.d.ts +0 -6
- package/dist/TextField.stories.js +0 -18
- package/dist/TextField.stories.js.map +0 -1
- package/dist/dist/ActionSheet.d.ts +0 -139
- package/dist/dist/ActionSheet.js +0 -637
- package/dist/dist/ActionSheet.js.map +0 -1
- package/dist/dist/Banner.d.ts +0 -12
- package/dist/dist/Banner.js +0 -49
- package/dist/dist/Banner.js.map +0 -1
- package/dist/dist/Banner.stories.d.ts +0 -1
- package/dist/dist/Banner.stories.js +0 -9
- package/dist/dist/Banner.stories.js.map +0 -1
- package/dist/dist/BlurBox.d.ts +0 -7
- package/dist/dist/BlurBox.js +0 -29
- package/dist/dist/BlurBox.js.map +0 -1
- package/dist/dist/BlurBox.native.d.ts +0 -9
- package/dist/dist/BlurBox.native.js +0 -32
- package/dist/dist/BlurBox.native.js.map +0 -1
- package/dist/dist/Body.d.ts +0 -12
- package/dist/dist/Body.js +0 -19
- package/dist/dist/Body.js.map +0 -1
- package/dist/dist/Box.d.ts +0 -205
- package/dist/dist/Box.js +0 -229
- package/dist/dist/Box.js.map +0 -1
- package/dist/dist/Box.stories.d.ts +0 -1
- package/dist/dist/Box.stories.js +0 -37
- package/dist/dist/Box.stories.js.map +0 -1
- package/dist/dist/Button.d.ts +0 -16
- package/dist/dist/Button.js +0 -98
- package/dist/dist/Button.js.map +0 -1
- package/dist/dist/Button.stories.d.ts +0 -13
- package/dist/dist/Button.stories.js +0 -26
- package/dist/dist/Button.stories.js.map +0 -1
- package/dist/dist/Card.d.ts +0 -6
- package/dist/dist/Card.js +0 -9
- package/dist/dist/Card.js.map +0 -1
- package/dist/dist/Card.stories.d.ts +0 -6
- package/dist/dist/Card.stories.js +0 -11
- package/dist/dist/Card.stories.js.map +0 -1
- package/dist/dist/CheckBox.d.ts +0 -8
- package/dist/dist/CheckBox.js +0 -23
- package/dist/dist/CheckBox.js.map +0 -1
- package/dist/dist/CheckBox.stories.d.ts +0 -1
- package/dist/dist/CheckBox.stories.js +0 -22
- package/dist/dist/CheckBox.stories.js.map +0 -1
- package/dist/dist/Common.d.ts +0 -5
- package/dist/dist/Common.js +0 -47
- package/dist/dist/Common.js.map +0 -1
- package/dist/dist/DateTimeActionSheet.d.ts +0 -5
- package/dist/dist/DateTimeActionSheet.js +0 -24
- package/dist/dist/DateTimeActionSheet.js.map +0 -1
- package/dist/dist/DecimalRangeActionSheet.d.ts +0 -9
- package/dist/dist/DecimalRangeActionSheet.js +0 -57
- package/dist/dist/DecimalRangeActionSheet.js.map +0 -1
- package/dist/dist/ErrorBoundary.d.ts +0 -12
- package/dist/dist/ErrorBoundary.js +0 -32
- package/dist/dist/ErrorBoundary.js.map +0 -1
- package/dist/dist/ErrorPage.d.ts +0 -7
- package/dist/dist/ErrorPage.js +0 -15
- package/dist/dist/ErrorPage.js.map +0 -1
- package/dist/dist/Field.d.ts +0 -17
- package/dist/dist/Field.js +0 -136
- package/dist/dist/Field.js.map +0 -1
- package/dist/dist/Field.stories.d.ts +0 -6
- package/dist/dist/Field.stories.js +0 -25
- package/dist/dist/Field.stories.js.map +0 -1
- package/dist/dist/FieldWithLabels.d.ts +0 -10
- package/dist/dist/FieldWithLabels.js +0 -7
- package/dist/dist/FieldWithLabels.js.map +0 -1
- package/dist/dist/FlatList.d.ts +0 -1
- package/dist/dist/FlatList.js +0 -4
- package/dist/dist/FlatList.js.map +0 -1
- package/dist/dist/Form.d.ts +0 -15
- package/dist/dist/Form.js +0 -56
- package/dist/dist/Form.js.map +0 -1
- package/dist/dist/Form.stories.d.ts +0 -6
- package/dist/dist/Form.stories.js +0 -27
- package/dist/dist/Form.stories.js.map +0 -1
- package/dist/dist/HeaderButtons.d.ts +0 -39
- package/dist/dist/HeaderButtons.js +0 -50
- package/dist/dist/HeaderButtons.js.map +0 -1
- package/dist/dist/HeaderButtons.stories.d.ts +0 -6
- package/dist/dist/HeaderButtons.stories.js +0 -7
- package/dist/dist/HeaderButtons.stories.js.map +0 -1
- package/dist/dist/Heading.d.ts +0 -32
- package/dist/dist/Heading.js +0 -47
- package/dist/dist/Heading.js.map +0 -1
- package/dist/dist/Heading.stories.d.ts +0 -1
- package/dist/dist/Heading.stories.js +0 -11
- package/dist/dist/Heading.stories.js.map +0 -1
- package/dist/dist/HeightActionSheet.d.ts +0 -9
- package/dist/dist/HeightActionSheet.js +0 -50
- package/dist/dist/HeightActionSheet.js.map +0 -1
- package/dist/dist/Icon.d.ts +0 -12
- package/dist/dist/Icon.js +0 -126
- package/dist/dist/Icon.js.map +0 -1
- package/dist/dist/Icon.stories.d.ts +0 -1
- package/dist/dist/Icon.stories.js +0 -11
- package/dist/dist/Icon.stories.js.map +0 -1
- package/dist/dist/IconButton.d.ts +0 -42
- package/dist/dist/IconButton.js +0 -41
- package/dist/dist/IconButton.js.map +0 -1
- package/dist/dist/IconButton.stories.d.ts +0 -1
- package/dist/dist/IconButton.stories.js +0 -8
- package/dist/dist/IconButton.stories.js.map +0 -1
- package/dist/dist/Image.d.ts +0 -9
- package/dist/dist/Image.js +0 -37
- package/dist/dist/Image.js.map +0 -1
- package/dist/dist/ImageBackground.d.ts +0 -6
- package/dist/dist/ImageBackground.js +0 -9
- package/dist/dist/ImageBackground.js.map +0 -1
- package/dist/dist/Layer.d.ts +0 -5
- package/dist/dist/Layer.js +0 -13
- package/dist/dist/Layer.js.map +0 -1
- package/dist/dist/Link.d.ts +0 -7
- package/dist/dist/Link.js +0 -13
- package/dist/dist/Link.js.map +0 -1
- package/dist/dist/Link.stories.d.ts +0 -1
- package/dist/dist/Link.stories.js +0 -8
- package/dist/dist/Link.stories.js.map +0 -1
- package/dist/dist/Mask.d.ts +0 -5
- package/dist/dist/Mask.js +0 -23
- package/dist/dist/Mask.js.map +0 -1
- package/dist/dist/Mask.stories.d.ts +0 -1
- package/dist/dist/Mask.stories.js +0 -13
- package/dist/dist/Mask.stories.js.map +0 -1
- package/dist/dist/MediaQuery.d.ts +0 -2
- package/dist/dist/MediaQuery.js +0 -34
- package/dist/dist/MediaQuery.js.map +0 -1
- package/dist/dist/Meta.d.ts +0 -6
- package/dist/dist/Meta.js +0 -8
- package/dist/dist/Meta.js.map +0 -1
- package/dist/dist/ModalSheet.d.ts +0 -3
- package/dist/dist/ModalSheet.js +0 -43
- package/dist/dist/ModalSheet.js.map +0 -1
- package/dist/dist/NumberPickerActionSheet.d.ts +0 -5
- package/dist/dist/NumberPickerActionSheet.js +0 -25
- package/dist/dist/NumberPickerActionSheet.js.map +0 -1
- package/dist/dist/Page.d.ts +0 -9
- package/dist/dist/Page.js +0 -26
- package/dist/dist/Page.js.map +0 -1
- package/dist/dist/Permissions.d.ts +0 -1
- package/dist/dist/Permissions.js +0 -36
- package/dist/dist/Permissions.js.map +0 -1
- package/dist/dist/PickerSelect.d.ts +0 -172
- package/dist/dist/PickerSelect.js +0 -403
- package/dist/dist/PickerSelect.js.map +0 -1
- package/dist/dist/Pill.d.ts +0 -7
- package/dist/dist/Pill.js +0 -10
- package/dist/dist/Pill.js.map +0 -1
- package/dist/dist/Pill.stories.d.ts +0 -1
- package/dist/dist/Pill.stories.js +0 -36
- package/dist/dist/Pill.stories.js.map +0 -1
- package/dist/dist/Pog.d.ts +0 -7
- package/dist/dist/Pog.js +0 -144
- package/dist/dist/Pog.js.map +0 -1
- package/dist/dist/ProgressBar.d.ts +0 -16
- package/dist/dist/ProgressBar.js +0 -40
- package/dist/dist/ProgressBar.js.map +0 -1
- package/dist/dist/ScrollView.d.ts +0 -1
- package/dist/dist/ScrollView.js +0 -4
- package/dist/dist/ScrollView.js.map +0 -1
- package/dist/dist/SegmentedControl.d.ts +0 -9
- package/dist/dist/SegmentedControl.js +0 -18
- package/dist/dist/SegmentedControl.js.map +0 -1
- package/dist/dist/SegmentedControl.stories.d.ts +0 -1
- package/dist/dist/SegmentedControl.stories.js +0 -32
- package/dist/dist/SegmentedControl.stories.js.map +0 -1
- package/dist/dist/SelectList.d.ts +0 -9
- package/dist/dist/SelectList.js +0 -29
- package/dist/dist/SelectList.js.map +0 -1
- package/dist/dist/SelectList.stories.d.ts +0 -1
- package/dist/dist/SelectList.stories.js +0 -24
- package/dist/dist/SelectList.stories.js.map +0 -1
- package/dist/dist/Spinner.d.ts +0 -44
- package/dist/dist/Spinner.js +0 -58
- package/dist/dist/Spinner.js.map +0 -1
- package/dist/dist/Spinner.stories.d.ts +0 -1
- package/dist/dist/Spinner.stories.js +0 -10
- package/dist/dist/Spinner.stories.js.map +0 -1
- package/dist/dist/SplitPage.d.ts +0 -7
- package/dist/dist/SplitPage.js +0 -20
- package/dist/dist/SplitPage.js.map +0 -1
- package/dist/dist/SplitPage.stories.d.ts +0 -1
- package/dist/dist/SplitPage.stories.js +0 -7
- package/dist/dist/SplitPage.stories.js.map +0 -1
- package/dist/dist/StorybookContainer.d.ts +0 -7
- package/dist/dist/StorybookContainer.js +0 -9
- package/dist/dist/StorybookContainer.js.map +0 -1
- package/dist/dist/Switch.d.ts +0 -6
- package/dist/dist/Switch.js +0 -10
- package/dist/dist/Switch.js.map +0 -1
- package/dist/dist/Switch.stories.d.ts +0 -1
- package/dist/dist/Switch.stories.js +0 -27
- package/dist/dist/Switch.stories.js.map +0 -1
- package/dist/dist/TapToEdit.d.ts +0 -9
- package/dist/dist/TapToEdit.js +0 -27
- package/dist/dist/TapToEdit.js.map +0 -1
- package/dist/dist/Text.d.ts +0 -36
- package/dist/dist/Text.js +0 -86
- package/dist/dist/Text.js.map +0 -1
- package/dist/dist/Text.stories.d.ts +0 -1
- package/dist/dist/Text.stories.js +0 -13
- package/dist/dist/Text.stories.js.map +0 -1
- package/dist/dist/TextArea.d.ts +0 -6
- package/dist/dist/TextArea.js +0 -13
- package/dist/dist/TextArea.js.map +0 -1
- package/dist/dist/TextArea.stories.d.ts +0 -12
- package/dist/dist/TextArea.stories.js +0 -21
- package/dist/dist/TextArea.stories.js.map +0 -1
- package/dist/dist/TextField.d.ts +0 -47
- package/dist/dist/TextField.js +0 -199
- package/dist/dist/TextField.js.map +0 -1
- package/dist/dist/TextField.stories.d.ts +0 -6
- package/dist/dist/TextField.stories.js +0 -15
- package/dist/dist/TextField.stories.js.map +0 -1
- package/dist/dist/TextFieldNumberActionSheet.d.ts +0 -5
- package/dist/dist/TextFieldNumberActionSheet.js +0 -24
- package/dist/dist/TextFieldNumberActionSheet.js.map +0 -1
- package/dist/dist/UnifiedScreens.d.ts +0 -2
- package/dist/dist/UnifiedScreens.js +0 -26
- package/dist/dist/UnifiedScreens.js.map +0 -1
- package/dist/dist/Unifier.d.ts +0 -131
- package/dist/dist/Unifier.js +0 -198
- package/dist/dist/Unifier.js.map +0 -1
- package/dist/dist/Utilities.d.ts +0 -51
- package/dist/dist/Utilities.js +0 -77
- package/dist/dist/Utilities.js.map +0 -1
- package/dist/dist/WithLabel.d.ts +0 -6
- package/dist/dist/WithLabel.js +0 -23
- package/dist/dist/WithLabel.js.map +0 -1
- package/dist/dist/index.d.ts +0 -43
- package/dist/dist/index.js +0 -49
- package/dist/dist/index.js.map +0 -1
package/src/Field.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import isDate from "lodash/isDate";
|
|
2
2
|
import isNumber from "lodash/isNumber";
|
|
3
3
|
import moment from "moment-timezone";
|
|
4
|
-
import React from "react";
|
|
4
|
+
import React, {useState} from "react";
|
|
5
5
|
|
|
6
6
|
import {Box} from "./Box";
|
|
7
7
|
import {FieldProps, TextFieldType} from "./Common";
|
|
@@ -15,60 +15,58 @@ interface State {
|
|
|
15
15
|
value: any;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Field is a fully uncontrolled component for creating various inputs. Fully uncontrolled means Field manages its own
|
|
20
|
+
* state for the TextFields/Switches/etc, not the parent component. When values are updated, Field will pass the data to
|
|
21
|
+
* the parent through the handleChange prop. You can set an initialValue, but you should not update initialValue
|
|
22
|
+
* this prop with the result of handleChange.
|
|
23
|
+
*
|
|
24
|
+
* Note: You MUST set a key={} prop for this component, otherwise you may wind up with stale data. Just changing
|
|
25
|
+
* initialValue will not work.
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
export function Field(props: FieldProps) {
|
|
29
|
+
const [value, setValue] = useState(props.initialValue || "");
|
|
23
30
|
|
|
24
|
-
|
|
25
|
-
if (
|
|
26
|
-
|
|
31
|
+
const handleChange = (newValue: string) => {
|
|
32
|
+
if (props.type === "currency") {
|
|
33
|
+
newValue = newValue.replace("$", "");
|
|
34
|
+
} else if (props.type === "percent") {
|
|
35
|
+
newValue = newValue.replace("%", "");
|
|
27
36
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (this.props.type === "currency") {
|
|
32
|
-
value = value.replace("$", "");
|
|
33
|
-
} else if (this.props.type === "percent") {
|
|
34
|
-
value = value.replace("%", "");
|
|
35
|
-
}
|
|
36
|
-
this.setState({value});
|
|
37
|
-
if (this.props.handleChange) {
|
|
38
|
-
this.props.handleChange(this.props.name, value);
|
|
37
|
+
setValue(newValue);
|
|
38
|
+
if (props.handleChange) {
|
|
39
|
+
props.handleChange(props.name, newValue);
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
|
|
42
|
-
handleSwitchChange = (
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
43
|
+
const handleSwitchChange = (switchValue: boolean) => {
|
|
44
|
+
setValue(switchValue);
|
|
45
|
+
if (props.handleChange) {
|
|
46
|
+
props.handleChange(props.name, switchValue);
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
|
|
49
|
-
validate = () => {
|
|
50
|
-
// console.log("VALIDATE",
|
|
51
|
-
if (
|
|
50
|
+
const validate = () => {
|
|
51
|
+
// console.log("VALIDATE", props.validate && props.validate(value));
|
|
52
|
+
if (props.validate && !props.validate(value)) {
|
|
52
53
|
return false;
|
|
53
54
|
}
|
|
54
|
-
switch (
|
|
55
|
+
switch (props.type) {
|
|
55
56
|
case "boolean":
|
|
56
57
|
return true;
|
|
57
58
|
case "currency":
|
|
58
59
|
return true;
|
|
59
60
|
case "date":
|
|
60
|
-
return !
|
|
61
|
+
return !value || isDate(value);
|
|
61
62
|
case "email":
|
|
62
|
-
return (
|
|
63
|
-
!this.state.value ||
|
|
64
|
-
(this.state.value.search("@") > -1 && this.state.value.search(".") > -1)
|
|
65
|
-
);
|
|
63
|
+
return !value || (value.search("@") > -1 && value.search(".") > -1);
|
|
66
64
|
case "number":
|
|
67
|
-
return !
|
|
65
|
+
return !value || isNumber(value);
|
|
68
66
|
case "password":
|
|
69
67
|
return true;
|
|
70
68
|
case "percent":
|
|
71
|
-
return !
|
|
69
|
+
return !value || isNumber(value.replace("%", ""));
|
|
72
70
|
case "select":
|
|
73
71
|
return true;
|
|
74
72
|
case "text":
|
|
@@ -83,64 +81,62 @@ export class Field extends React.Component<FieldProps, State> {
|
|
|
83
81
|
}
|
|
84
82
|
};
|
|
85
83
|
|
|
86
|
-
renderField() {
|
|
87
|
-
if (
|
|
88
|
-
if (!
|
|
84
|
+
const renderField = () => {
|
|
85
|
+
if (props.type === "select") {
|
|
86
|
+
if (!props.options) {
|
|
89
87
|
console.error("Field with type=select require options");
|
|
90
88
|
return null;
|
|
91
89
|
}
|
|
92
90
|
return (
|
|
93
91
|
<SelectList
|
|
94
|
-
disabled={
|
|
95
|
-
id={
|
|
96
|
-
options={
|
|
97
|
-
value={
|
|
98
|
-
onChange={
|
|
92
|
+
disabled={props.disabled}
|
|
93
|
+
id={props.name}
|
|
94
|
+
options={props.options}
|
|
95
|
+
value={value}
|
|
96
|
+
onChange={handleChange}
|
|
99
97
|
/>
|
|
100
98
|
);
|
|
101
|
-
} else if (
|
|
99
|
+
} else if (props.type === "textarea") {
|
|
102
100
|
return (
|
|
103
101
|
<TextArea
|
|
104
|
-
disabled={
|
|
105
|
-
id={
|
|
106
|
-
placeholder={
|
|
107
|
-
rows={
|
|
108
|
-
value={String(
|
|
109
|
-
onChange={(
|
|
102
|
+
disabled={props.disabled}
|
|
103
|
+
id={props.name}
|
|
104
|
+
placeholder={props.placeholder}
|
|
105
|
+
rows={props.rows}
|
|
106
|
+
value={String(value)}
|
|
107
|
+
onChange={(result) => handleChange(result.value)}
|
|
110
108
|
/>
|
|
111
109
|
);
|
|
112
|
-
} else if (
|
|
110
|
+
} else if (props.type === "boolean") {
|
|
113
111
|
return (
|
|
114
112
|
<Switch
|
|
115
|
-
disabled={
|
|
116
|
-
id={
|
|
117
|
-
name={
|
|
118
|
-
switched={Boolean(
|
|
119
|
-
onChange={(result) =>
|
|
113
|
+
disabled={props.disabled}
|
|
114
|
+
id={props.name}
|
|
115
|
+
name={props.name}
|
|
116
|
+
switched={Boolean(value)}
|
|
117
|
+
onChange={(result) => handleSwitchChange(result)}
|
|
120
118
|
/>
|
|
121
119
|
);
|
|
122
|
-
} else if (
|
|
123
|
-
const
|
|
124
|
-
? moment(this.state.value.seconds * 1000)
|
|
125
|
-
: moment(this.state.value);
|
|
120
|
+
} else if (props.type === "date") {
|
|
121
|
+
const date = value.seconds ? moment(value.seconds * 1000) : moment(value);
|
|
126
122
|
return (
|
|
127
123
|
<TextField
|
|
128
124
|
disabled
|
|
129
|
-
id={
|
|
130
|
-
placeholder={
|
|
125
|
+
id={props.name}
|
|
126
|
+
placeholder={props.placeholder}
|
|
131
127
|
type="text"
|
|
132
128
|
// TODO: allow editing with a date picker
|
|
133
|
-
value={
|
|
134
|
-
onChange={(result) =>
|
|
129
|
+
value={date.format("MM/DD/YYYY HH:mmA")}
|
|
130
|
+
onChange={(result) => handleChange(result.value)}
|
|
135
131
|
/>
|
|
136
132
|
);
|
|
137
133
|
} else {
|
|
138
134
|
let type: TextFieldType = "text";
|
|
139
135
|
// Number is supported differently because we need fractional numbers and they don't work
|
|
140
136
|
// well on iOS.
|
|
141
|
-
if (
|
|
142
|
-
type =
|
|
143
|
-
} else if (
|
|
137
|
+
if (props.type && ["date", "email", "password", "url"].indexOf(props.type) > -1) {
|
|
138
|
+
type = props.type as TextFieldType;
|
|
139
|
+
} else if (props.type === "percent" || props.type === "currency") {
|
|
144
140
|
type = "text";
|
|
145
141
|
}
|
|
146
142
|
let autoComplete: "on" | "current-password" | "username" = "on";
|
|
@@ -149,46 +145,43 @@ export class Field extends React.Component<FieldProps, State> {
|
|
|
149
145
|
} else if (type === "email") {
|
|
150
146
|
autoComplete = "username";
|
|
151
147
|
}
|
|
152
|
-
const
|
|
153
|
-
// if (
|
|
154
|
-
// value = `${Number(
|
|
155
|
-
// } else if (
|
|
148
|
+
const stringValue = String(value);
|
|
149
|
+
// if (props.type === "percent") {
|
|
150
|
+
// value = `${Number(value).toFixed(0)}%`;
|
|
151
|
+
// } else if (props.type === "currency") {
|
|
156
152
|
// value = `$${Number(value).toFixed(2)}`;
|
|
157
153
|
// }
|
|
158
154
|
// console.log("VAL", value);
|
|
159
155
|
return (
|
|
160
156
|
<TextField
|
|
161
157
|
autoComplete={autoComplete}
|
|
162
|
-
disabled={
|
|
163
|
-
id={
|
|
164
|
-
placeholder={
|
|
158
|
+
disabled={props.disabled}
|
|
159
|
+
id={props.name}
|
|
160
|
+
placeholder={props.placeholder}
|
|
165
161
|
type={type as "date" | "email" | "number" | "password" | "text" | "url"}
|
|
166
|
-
value={
|
|
167
|
-
onChange={(result) =>
|
|
162
|
+
value={stringValue}
|
|
163
|
+
onChange={(result) => handleChange(result.value)}
|
|
168
164
|
/>
|
|
169
165
|
);
|
|
170
166
|
}
|
|
171
|
-
}
|
|
167
|
+
};
|
|
172
168
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
</Box>
|
|
192
|
-
);
|
|
193
|
-
}
|
|
169
|
+
const children = renderField();
|
|
170
|
+
const {errorMessage, errorMessageColor, helperText, helperTextColor, label, labelColor} = props;
|
|
171
|
+
return (
|
|
172
|
+
<Box marginBottom={5}>
|
|
173
|
+
<FieldWithLabels
|
|
174
|
+
{...{
|
|
175
|
+
errorMessage,
|
|
176
|
+
errorMessageColor,
|
|
177
|
+
helperText,
|
|
178
|
+
helperTextColor,
|
|
179
|
+
label,
|
|
180
|
+
labelColor,
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
{children}
|
|
184
|
+
</FieldWithLabels>
|
|
185
|
+
</Box>
|
|
186
|
+
);
|
|
194
187
|
}
|
package/src/Icon.tsx
CHANGED
|
@@ -2,55 +2,7 @@ import {FontAwesome} from "@expo/vector-icons";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
|
|
4
4
|
import {iconNumberToSize, IconProps, iconSizeToNumber} from "./Common";
|
|
5
|
-
// import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
|
|
6
|
-
// // import {library} from "@fortawesome/fontawesome-svg-core";
|
|
7
|
-
// import {library} from "@fortawesome/fontawesome-svg-core";
|
|
8
|
-
// // import {fal as proFal} from "@fortawesome/pro-light-svg-icons";
|
|
9
|
-
// import {
|
|
10
|
-
// faHeart as farHeart,
|
|
11
|
-
// // faPlus as farPlus,
|
|
12
|
-
// faEdit as farEdit,
|
|
13
|
-
// faNewspaper as farNewspaper,
|
|
14
|
-
// } from "@fortawesome/free-regular-svg-icons";
|
|
15
|
-
// import {
|
|
16
|
-
// faChevronLeft,
|
|
17
|
-
// faEnvelopeOpen,
|
|
18
|
-
// faCarrot,
|
|
19
|
-
// faComment,
|
|
20
|
-
// faUserCircle,
|
|
21
|
-
// faSearch,
|
|
22
|
-
// faChevronRight,
|
|
23
|
-
// faEllipsisV,
|
|
24
|
-
// faPaperPlane,
|
|
25
|
-
// faExclamationCircle,
|
|
26
|
-
// faMailBulk,
|
|
27
|
-
// faTrashAlt,
|
|
28
|
-
// faTrashRestoreAlt,
|
|
29
|
-
// faEnvelope,
|
|
30
|
-
// faSpinner,
|
|
31
|
-
// } from "@fortawesome/free-solid-svg-icons";
|
|
32
5
|
import {Unifier} from "./Unifier";
|
|
33
|
-
// library.add(
|
|
34
|
-
// farHeart,
|
|
35
|
-
// // farPlus,
|
|
36
|
-
// farEdit,
|
|
37
|
-
// farNewspaper,
|
|
38
|
-
// faChevronLeft,
|
|
39
|
-
// faCarrot,
|
|
40
|
-
// faComment,
|
|
41
|
-
// faUserCircle,
|
|
42
|
-
// faEnvelopeOpen,
|
|
43
|
-
// faSearch,
|
|
44
|
-
// faChevronRight,
|
|
45
|
-
// faEllipsisV,
|
|
46
|
-
// faPaperPlane,
|
|
47
|
-
// faExclamationCircle,
|
|
48
|
-
// faMailBulk,
|
|
49
|
-
// faTrashAlt,
|
|
50
|
-
// faTrashRestoreAlt,
|
|
51
|
-
// faEnvelope,
|
|
52
|
-
// faSpinner
|
|
53
|
-
// );
|
|
54
6
|
|
|
55
7
|
export function initIcons() {
|
|
56
8
|
console.debug("Initializing icons");
|
|
@@ -58,82 +10,11 @@ export function initIcons() {
|
|
|
58
10
|
|
|
59
11
|
const iconSet = new Set();
|
|
60
12
|
|
|
61
|
-
|
|
62
|
-
const prev = new Set(iconSet);
|
|
63
|
-
iconSet.add(`${prefix}-${icon}`);
|
|
64
|
-
if (
|
|
65
|
-
prev.size !== iconSet.size &&
|
|
66
|
-
(!process.env.NODE_ENV || process.env.NODE_ENV === "development")
|
|
67
|
-
) {
|
|
68
|
-
console.debug("[Icon] current icon set:", iconSet);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
13
|
+
// TODO: Update <Icon /> to be closer to Expo's Vector Icon, letting multiple icon packs be used, etc.
|
|
72
14
|
export class Icon extends React.Component<IconProps, {}> {
|
|
73
|
-
render() {
|
|
74
|
-
addIcon(this.props.name, this.props.prefix);
|
|
75
|
-
const color = Unifier.theme[this.props.color || "primary"];
|
|
76
|
-
let size: string = iconNumberToSize(this.props.size);
|
|
77
|
-
if (size === "xl") {
|
|
78
|
-
size = "2x";
|
|
79
|
-
} else if (size === "md") {
|
|
80
|
-
size = "1x";
|
|
81
|
-
}
|
|
82
|
-
return <FontAwesome color={color} icon={this.props.name as any} size={size as any} />;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export class IconExpo extends React.Component<IconProps, {}> {
|
|
87
15
|
render() {
|
|
88
16
|
const color = Unifier.theme[this.props.color || "primary"];
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return (
|
|
92
|
-
<FontAwesome
|
|
93
|
-
color={color}
|
|
94
|
-
icon={[this.props.prefix || "far", this.props.name as any]}
|
|
95
|
-
size={size}
|
|
96
|
-
/>
|
|
97
|
-
);
|
|
98
|
-
// const {name, prefix} = this.props;
|
|
99
|
-
// const color = Unifier.theme[this.props.color || "primary"];
|
|
100
|
-
// const size = this.props.size;
|
|
101
|
-
|
|
102
|
-
// const map = {
|
|
103
|
-
// fapro: FAPro,
|
|
104
|
-
// fas: FAIcon,
|
|
105
|
-
// fa: FAIcon,
|
|
106
|
-
// fal: FAIcon,
|
|
107
|
-
// "fa-brand": FAIcon,
|
|
108
|
-
// ant: AntDesignIcon,
|
|
109
|
-
// entypo: EntypoIcon,
|
|
110
|
-
// evil: EvilIcons,
|
|
111
|
-
// material: MaterialIcons,
|
|
112
|
-
// "material-community": MaterialCommunityIcons,
|
|
113
|
-
// ionicon: Ionicons,
|
|
114
|
-
// octicon: Octicons,
|
|
115
|
-
// zocial: Zocial,
|
|
116
|
-
// "simple-line": SimpleLineIcons,
|
|
117
|
-
// feather: Feather,
|
|
118
|
-
// };
|
|
119
|
-
// const Component: any = map[prefix];
|
|
120
|
-
// if (!Component) {
|
|
121
|
-
// console.warn(`[icons] could not find icon: ${prefix}:${name}`);
|
|
122
|
-
// return null;
|
|
123
|
-
// }
|
|
124
|
-
|
|
125
|
-
// if (["fapro", "fal", "fa", "fas", "fa-brand"].indexOf(this.props.prefix) > -1) {
|
|
126
|
-
// return (
|
|
127
|
-
// <Component
|
|
128
|
-
// solid={this.props.prefix === "fas"}
|
|
129
|
-
// light={this.props.prefix === "fal"}
|
|
130
|
-
// brand={this.props.prefix === "fa-brand"}
|
|
131
|
-
// name={name}
|
|
132
|
-
// color={color}
|
|
133
|
-
// size={size}
|
|
134
|
-
// />
|
|
135
|
-
// );
|
|
136
|
-
// }
|
|
137
|
-
// return <Component name={name} color={color} size={size} />;
|
|
17
|
+
const size = iconSizeToNumber(this.props.size);
|
|
18
|
+
return <FontAwesome color={color} name={this.props.name as any} size={size} />;
|
|
138
19
|
}
|
|
139
20
|
}
|
package/src/IconButton.tsx
CHANGED
|
@@ -44,7 +44,7 @@ export class IconButton extends React.Component<IconButtonProps, {}> {
|
|
|
44
44
|
color={this.props.iconColor}
|
|
45
45
|
name={this.props.icon}
|
|
46
46
|
prefix={this.props.prefix || "fas"}
|
|
47
|
-
size={
|
|
47
|
+
size={this.props.size}
|
|
48
48
|
/>
|
|
49
49
|
</TouchableOpacity>
|
|
50
50
|
);
|
package/src/Pog.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {Box} from "./Box";
|
|
|
5
5
|
import {AllColors, IconPrefix, IconSize} from "./Common";
|
|
6
6
|
import {Icon} from "./Icon";
|
|
7
7
|
|
|
8
|
-
/*
|
|
8
|
+
/*
|
|
9
9
|
Originally based on https://github.com/pinterest/gestalt
|
|
10
10
|
Forked, added type definitions, and added features.
|
|
11
11
|
*/
|
|
@@ -203,7 +203,7 @@ export default function Pog(props: Props) {
|
|
|
203
203
|
// dangerouslySetSvgPath={dangerouslySetSvgPath}
|
|
204
204
|
name={icon}
|
|
205
205
|
prefix={iconPrefix}
|
|
206
|
-
size={
|
|
206
|
+
size={size}
|
|
207
207
|
/>
|
|
208
208
|
</Box>
|
|
209
209
|
</div>
|
package/src/TapToEdit.tsx
CHANGED
|
@@ -19,7 +19,7 @@ export class TapToEdit extends React.Component<TextFieldProps, TapToEditState> {
|
|
|
19
19
|
return (
|
|
20
20
|
<Box direction="row" display="flex" onClick={() => this.setState({showEdit: true})}>
|
|
21
21
|
<Box marginRight={2}>
|
|
22
|
-
<Icon color="primaryDark" name="edit" prefix="far" size=
|
|
22
|
+
<Icon color="primaryDark" name="edit" prefix="far" size="lg" />
|
|
23
23
|
</Box>
|
|
24
24
|
<Text>{this.props.children}</Text>
|
|
25
25
|
</Box>
|
package/src/TextField.tsx
CHANGED
package/dist/Banner.stories.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/Banner.stories.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Box } from "./Box";
|
|
2
|
-
import { Banner } from "./Banner";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import { storiesOf } from "@storybook/react-native";
|
|
5
|
-
storiesOf("Banner", module)
|
|
6
|
-
.add("Plain banner", () => (React.createElement(Box, { width: "100%", height: "100%", display: "flex", direction: "column" },
|
|
7
|
-
React.createElement(Banner, { id: "banner", text: "When you click this banner, it dismisses", subtext: "And in a real app, it would stay dismissed", color: "primary", textColor: "white" }))))
|
|
8
|
-
.add("Shape banner", () => (React.createElement(Box, { width: "100%", height: "100%", display: "flex", direction: "column" },
|
|
9
|
-
React.createElement(Box, { paddingY: 2, width: "100%" },
|
|
10
|
-
React.createElement(Banner, { id: "banner", text: "Banners can have multiple shapes like Boxes", subtext: "Here's a pill.", color: "primary", textColor: "white", shape: "pill" })),
|
|
11
|
-
React.createElement(Box, { paddingY: 2, width: "100%" },
|
|
12
|
-
React.createElement(Banner, { id: "banner", text: "And a rounded banner", color: "secondary", textColor: "white", shape: 3 })))));
|
|
13
|
-
//# sourceMappingURL=Banner.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.stories.js","sourceRoot":"","sources":["../unifier/Banner.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAElD,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;KACxB,GAAG,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CACzB,oBAAC,GAAG,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ;IAC/D,oBAAC,MAAM,IACL,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,0CAA0C,EAC/C,OAAO,EAAC,4CAA4C,EACpD,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,OAAO,GACjB,CACE,CACP,CAAC;KACD,GAAG,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CACzB,oBAAC,GAAG,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ;IAC/D,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM;QAC5B,oBAAC,MAAM,IACL,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,6CAA6C,EAClD,OAAO,EAAC,gBAAgB,EACxB,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,OAAO,EACjB,KAAK,EAAC,MAAM,GACZ,CACE;IACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM;QAC5B,oBAAC,MAAM,IACL,EAAE,EAAC,QAAQ,EACX,IAAI,EAAC,sBAAsB,EAC3B,KAAK,EAAC,WAAW,EACjB,SAAS,EAAC,OAAO,EACjB,KAAK,EAAE,CAAC,GACR,CACE,CACF,CACP,CAAC,CAAC"}
|
package/dist/Box.stories.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/Box.stories.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Box } from "./Box";
|
|
3
|
-
import { storiesOf } from "@storybook/react-native";
|
|
4
|
-
import { Text } from "./Text";
|
|
5
|
-
import { StorybookContainer } from "./StorybookContainer";
|
|
6
|
-
const colors = [
|
|
7
|
-
"primary",
|
|
8
|
-
"secondary",
|
|
9
|
-
"tertiary",
|
|
10
|
-
"accent",
|
|
11
|
-
"blue",
|
|
12
|
-
"darkGray",
|
|
13
|
-
"eggplant",
|
|
14
|
-
"gray",
|
|
15
|
-
"green",
|
|
16
|
-
"lightGray",
|
|
17
|
-
"maroon",
|
|
18
|
-
"midnight",
|
|
19
|
-
"navy",
|
|
20
|
-
"olive",
|
|
21
|
-
"orange",
|
|
22
|
-
"orchid",
|
|
23
|
-
"pine",
|
|
24
|
-
"purple",
|
|
25
|
-
"red",
|
|
26
|
-
"watermelon",
|
|
27
|
-
"white",
|
|
28
|
-
"neutral900",
|
|
29
|
-
"neutral200",
|
|
30
|
-
"neutral70",
|
|
31
|
-
"neutral10",
|
|
32
|
-
];
|
|
33
|
-
storiesOf("Box", module)
|
|
34
|
-
.add("FlexBox", () => (React.createElement(StorybookContainer, null,
|
|
35
|
-
React.createElement(Box, { display: "flex", justifyContent: "center", alignItems: "center", width: 50, height: 50, rounding: "circle", color: "blue", marginRight: 2 },
|
|
36
|
-
React.createElement(Text, { size: "lg" }, "JG")),
|
|
37
|
-
React.createElement(Box, { paddingX: 2, direction: "column" },
|
|
38
|
-
React.createElement(Text, { weight: "bold" }, "Josh Gachnang"),
|
|
39
|
-
React.createElement(Text, null, "joined 2 years ago")))))
|
|
40
|
-
.add("Box Colors", () => (React.createElement(StorybookContainer, null, colors.map((c) => (React.createElement(Box, { key: c, display: "flex", direction: "column" },
|
|
41
|
-
React.createElement(Box, { marginBottom: 2 },
|
|
42
|
-
React.createElement(Text, { align: "center" }, c)),
|
|
43
|
-
React.createElement(Box, { key: c, color: c, rounding: "circle", height: 50, width: 50 },
|
|
44
|
-
React.createElement(Text, null, " "))))))));
|
|
45
|
-
//# sourceMappingURL=Box.stories.js.map
|
package/dist/Box.stories.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Box.stories.js","sourceRoot":"","sources":["../unifier/Box.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,GAAgB;IAC1B,SAAS;IACT,WAAW;IACX,UAAU;IACV,QAAQ;IACR,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;IACN,OAAO;IACP,WAAW;IACX,QAAQ;IACR,UAAU;IACV,MAAM;IACN,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;IACL,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,WAAW;CACZ,CAAC;AAEF,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;KACrB,GAAG,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,CACpB,oBAAC,kBAAkB;IACjB,oBAAC,GAAG,IACF,OAAO,EAAC,MAAM,EACd,cAAc,EAAC,QAAQ,EACvB,UAAU,EAAC,QAAQ,EACnB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,QAAQ,EAAC,QAAQ,EACjB,KAAK,EAAC,MAAM,EACZ,WAAW,EAAE,CAAC;QAEd,oBAAC,IAAI,IAAC,IAAI,EAAC,IAAI,SAAU,CACrB;IACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAC,QAAQ;QAClC,oBAAC,IAAI,IAAC,MAAM,EAAC,MAAM,oBAAqB;QACxC,oBAAC,IAAI,6BAA0B,CAC3B,CACa,CACtB,CAAC;KACD,GAAG,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,CACvB,oBAAC,kBAAkB,QAChB,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACjB,oBAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ;IAC5C,oBAAC,GAAG,IAAC,YAAY,EAAE,CAAC;QAClB,oBAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,IAAE,CAAC,CAAQ,CAC3B;IACN,oBAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAC,QAAQ,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE;QAC5D,oBAAC,IAAI,YAAS,CACV,CACF,CACP,CAAC,CACiB,CACtB,CAAC,CAAC"}
|
package/dist/Button.stories.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Primary: any;
|
package/dist/Button.stories.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { action } from "@storybook/addon-actions";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { Button } from "./Button";
|
|
4
|
-
import { storiesOf } from "@storybook/react-native";
|
|
5
|
-
import { Box } from "./Box";
|
|
6
|
-
import { StorybookContainer } from "./StorybookContainer";
|
|
7
|
-
function allColorButtons(props) {
|
|
8
|
-
return (React.createElement(StorybookContainer, null,
|
|
9
|
-
React.createElement(Box, { paddingY: 1 },
|
|
10
|
-
React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Default" }, props))),
|
|
11
|
-
React.createElement(Box, { paddingY: 1 },
|
|
12
|
-
React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Primary", color: "primary" }, props))),
|
|
13
|
-
React.createElement(Box, { paddingY: 1 },
|
|
14
|
-
React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Secondary", color: "secondary" }, props))),
|
|
15
|
-
React.createElement(Box, { paddingY: 1 },
|
|
16
|
-
React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Tertiary", color: "tertiary" }, props))),
|
|
17
|
-
React.createElement(Box, { paddingY: 1 },
|
|
18
|
-
React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Accent", color: "accent" }, props))),
|
|
19
|
-
React.createElement(Box, { paddingY: 1 },
|
|
20
|
-
React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Red", color: "red" }, props))),
|
|
21
|
-
React.createElement(Box, { paddingY: 1 },
|
|
22
|
-
React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Dark Gray", color: "darkGray" }, props))),
|
|
23
|
-
React.createElement(Box, { paddingY: 1 },
|
|
24
|
-
React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Gray", color: "gray" }, props)))));
|
|
25
|
-
}
|
|
26
|
-
storiesOf("Button", module)
|
|
27
|
-
.add("Colors", () => allColorButtons({}))
|
|
28
|
-
.add("Loading", () => allColorButtons({ loading: true }))
|
|
29
|
-
.add("Ghost", () => allColorButtons({ type: "ghost" }))
|
|
30
|
-
.add("Outline", () => allColorButtons({ type: "outline" }));
|
|
31
|
-
const Template = (args) => React.createElement(Button, Object.assign({ onClick: action("clicked"), text: "Button" }, args));
|
|
32
|
-
export const Primary = Template.bind({});
|
|
33
|
-
Primary.args = {
|
|
34
|
-
size: "md",
|
|
35
|
-
color: "primary",
|
|
36
|
-
text: "PRIMARY",
|
|
37
|
-
type: "solid",
|
|
38
|
-
inline: false,
|
|
39
|
-
disabled: false,
|
|
40
|
-
};
|
|
41
|
-
//# sourceMappingURL=Button.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.stories.js","sourceRoot":"","sources":["../unifier/Button.stories.tsx"],"names":[],"mappings":"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"}
|
package/dist/Card.stories.d.ts
DELETED
package/dist/Card.stories.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Box } from "./Box";
|
|
3
|
-
import { Card } from "./Card";
|
|
4
|
-
import { storiesOf } from "@storybook/react-native";
|
|
5
|
-
export default {
|
|
6
|
-
title: "Card",
|
|
7
|
-
component: Card,
|
|
8
|
-
};
|
|
9
|
-
storiesOf("Card", module).add("Plain", () => (React.createElement(Box, { width: "100%", height: "100%", display: "flex", direction: "column", color: "lightGray", padding: 12 },
|
|
10
|
-
React.createElement(Card, null,
|
|
11
|
-
React.createElement(Box, { display: "flex", direction: "row", alignItems: "center" },
|
|
12
|
-
React.createElement(Box, { display: "flex", justifyContent: "center", alignItems: "center", width: 50, height: 50, rounding: "circle", color: "blue", marginRight: 2 },
|
|
13
|
-
React.createElement("h2", null, "JG")),
|
|
14
|
-
React.createElement(Box, { paddingX: 2, direction: "column" },
|
|
15
|
-
React.createElement("div", null,
|
|
16
|
-
React.createElement("b", null, "Josh Gachnang")),
|
|
17
|
-
React.createElement("div", null, "joined 2 years ago")))))));
|
|
18
|
-
//# sourceMappingURL=Card.stories.js.map
|
package/dist/Card.stories.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Card.stories.js","sourceRoot":"","sources":["../unifier/Card.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAElD,eAAe;IACb,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAC3C,oBAAC,GAAG,IAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,QAAQ,EAAC,KAAK,EAAC,WAAW,EAAC,OAAO,EAAE,EAAE;IAC7F,oBAAC,IAAI;QACH,oBAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,KAAK,EAAC,UAAU,EAAC,QAAQ;YACrD,oBAAC,GAAG,IACF,OAAO,EAAC,MAAM,EACd,cAAc,EAAC,QAAQ,EACvB,UAAU,EAAC,QAAQ,EACnB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,QAAQ,EAAC,QAAQ,EACjB,KAAK,EAAC,MAAM,EACZ,WAAW,EAAE,CAAC;gBAEd,qCAAW,CACP;YACN,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAC,QAAQ;gBAClC;oBACE,+CAAoB,CAChB;gBACN,sDAA6B,CACzB,CACF,CACD,CACH,CACP,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|