ferns-ui 0.7.0 → 0.10.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/dist/Common.d.ts +8 -1
- package/dist/Constants.d.ts +4 -0
- package/dist/Constants.js +54 -0
- package/dist/Constants.js.map +1 -0
- package/dist/Field.d.ts +1 -1
- package/dist/Field.js +16 -0
- package/dist/Field.js.map +1 -1
- package/dist/Modal.d.ts +17 -0
- package/dist/Modal.js +62 -0
- package/dist/Modal.js.map +1 -0
- package/dist/SelectList.d.ts +3 -2
- package/dist/SelectList.js +20 -17
- package/dist/SelectList.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/package.json +37 -37
- package/src/Common.ts +9 -1
- package/src/Constants.ts +53 -0
- package/src/Field.tsx +60 -2
- package/src/Modal.tsx +143 -0
- package/src/SelectList.tsx +29 -24
- package/src/index.tsx +3 -2
package/dist/Common.d.ts
CHANGED
|
@@ -602,7 +602,7 @@ export interface ScrollViewProps {
|
|
|
602
602
|
}
|
|
603
603
|
declare type ItemT = any;
|
|
604
604
|
declare type ViewStyle = any;
|
|
605
|
-
interface StyleProp {
|
|
605
|
+
export interface StyleProp {
|
|
606
606
|
[key: string]: any;
|
|
607
607
|
}
|
|
608
608
|
interface LayoutRectangle {
|
|
@@ -838,4 +838,11 @@ export interface ProgressBarProps {
|
|
|
838
838
|
color: Color;
|
|
839
839
|
completed: number;
|
|
840
840
|
}
|
|
841
|
+
export interface AddressInterface {
|
|
842
|
+
address1: string;
|
|
843
|
+
address2?: string;
|
|
844
|
+
city: string;
|
|
845
|
+
state: string;
|
|
846
|
+
zipcode: string;
|
|
847
|
+
}
|
|
841
848
|
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const USSTATESLIST = [
|
|
2
|
+
{ label: "AL", value: "Alabama" },
|
|
3
|
+
{ label: "AK", value: "Alaska" },
|
|
4
|
+
{ label: "AZ", value: "Arizona" },
|
|
5
|
+
{ label: "AR", value: "Arkansas" },
|
|
6
|
+
{ label: "CA", value: "California" },
|
|
7
|
+
{ label: "CO", value: "Colorado" },
|
|
8
|
+
{ label: "CT", value: "Connecticut" },
|
|
9
|
+
{ label: "DE", value: "Delaware" },
|
|
10
|
+
{ label: "DC", value: "District Of Columbia" },
|
|
11
|
+
{ label: "FL", value: "Florida" },
|
|
12
|
+
{ label: "GA", value: "Georgia" },
|
|
13
|
+
{ label: "HI", value: "Hawaii" },
|
|
14
|
+
{ label: "ID", value: "Idaho" },
|
|
15
|
+
{ label: "IL", value: "Illinois" },
|
|
16
|
+
{ label: "IN", value: "Indiana" },
|
|
17
|
+
{ label: "IA", value: "Iowa" },
|
|
18
|
+
{ label: "KS", value: "Kansas" },
|
|
19
|
+
{ label: "KY", value: "Kentucky" },
|
|
20
|
+
{ label: "LA", value: "Louisiana" },
|
|
21
|
+
{ label: "ME", value: "Maine" },
|
|
22
|
+
{ label: "MD", value: "Maryland" },
|
|
23
|
+
{ label: "MA", value: "Massachusetts" },
|
|
24
|
+
{ label: "MI", value: "Michigan" },
|
|
25
|
+
{ label: "MN", value: "Minnesota" },
|
|
26
|
+
{ label: "MS", value: "Mississippi" },
|
|
27
|
+
{ label: "MO", value: "Missouri" },
|
|
28
|
+
{ label: "MT", value: "Montana" },
|
|
29
|
+
{ label: "NE", value: "Nebraska" },
|
|
30
|
+
{ label: "NV", value: "Nevada" },
|
|
31
|
+
{ label: "NH", value: "New Hampshire" },
|
|
32
|
+
{ label: "NJ", value: "New Jersey" },
|
|
33
|
+
{ label: "NM", value: "New Mexico" },
|
|
34
|
+
{ label: "NY", value: "New York" },
|
|
35
|
+
{ label: "NC", value: "North Carolina" },
|
|
36
|
+
{ label: "ND", value: "North Dakota" },
|
|
37
|
+
{ label: "OH", value: "Ohio" },
|
|
38
|
+
{ label: "OK", value: "Oklahoma" },
|
|
39
|
+
{ label: "OR", value: "Oregon" },
|
|
40
|
+
{ label: "PA", value: "Pennsylvania" },
|
|
41
|
+
{ label: "RI", value: "Rhode Island" },
|
|
42
|
+
{ label: "SC", value: "South Carolina" },
|
|
43
|
+
{ label: "SD", value: "South Dakota" },
|
|
44
|
+
{ label: "TN", value: "Tennessee" },
|
|
45
|
+
{ label: "TX", value: "Texas" },
|
|
46
|
+
{ label: "UT", value: "Utah" },
|
|
47
|
+
{ label: "VT", value: "Vermont" },
|
|
48
|
+
{ label: "VA", value: "Virginia" },
|
|
49
|
+
{ label: "WA", value: "Washington" },
|
|
50
|
+
{ label: "WV", value: "West Virginia" },
|
|
51
|
+
{ label: "WI", value: "Wisconsin" },
|
|
52
|
+
{ label: "WY", value: "Wyoming" },
|
|
53
|
+
];
|
|
54
|
+
//# sourceMappingURL=Constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../src/Constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAC;IAC/B,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAC;IAC9B,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAC;IAC/B,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAC;IAChC,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAC;IAClC,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAC;IAChC,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAC;IACnC,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAC;IAChC,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,sBAAsB,EAAC;IAC5C,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAC;IAC/B,EAAC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EAAE,SAAS,EAAC;CAChC,CAAC"}
|
package/dist/Field.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface FieldProps extends FieldWithLabelsProps {
|
|
|
9
9
|
handleChange: any;
|
|
10
10
|
validate?: (value: any) => boolean;
|
|
11
11
|
validateErrorMessage?: string;
|
|
12
|
-
type?: "boolean" | "email" | "text" | "textarea" | "number" | "currency" | "percent" | "select" | "password" | "url" | "date" | "multiselect";
|
|
12
|
+
type?: "boolean" | "email" | "text" | "textarea" | "number" | "currency" | "percent" | "select" | "password" | "url" | "date" | "multiselect" | "address";
|
|
13
13
|
rows?: number;
|
|
14
14
|
options?: SelectListOptions;
|
|
15
15
|
placeholder?: string;
|
package/dist/Field.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import { Box } from "./Box";
|
|
3
|
+
import { USSTATESLIST } from "./Constants";
|
|
3
4
|
import { FieldWithLabels } from "./FieldWithLabels";
|
|
4
5
|
import { SelectList } from "./SelectList";
|
|
5
6
|
import { Switch } from "./Switch";
|
|
@@ -32,6 +33,12 @@ export function Field(props) {
|
|
|
32
33
|
props.handleChange(props.name, newValue);
|
|
33
34
|
}
|
|
34
35
|
};
|
|
36
|
+
const handleAddressChange = (field, newValue) => {
|
|
37
|
+
setValue(Object.assign(Object.assign({}, value), { [field]: newValue }));
|
|
38
|
+
if (props.handleChange) {
|
|
39
|
+
props.handleChange(props.name, Object.assign(Object.assign({}, value), { [field]: newValue }));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
35
42
|
const handleSwitchChange = (switchValue) => {
|
|
36
43
|
setValue(switchValue);
|
|
37
44
|
if (props.handleChange) {
|
|
@@ -84,6 +91,15 @@ export function Field(props) {
|
|
|
84
91
|
// TODO: allow editing with a date picker
|
|
85
92
|
value: value, onChange: (result) => handleChange(result.value) }));
|
|
86
93
|
}
|
|
94
|
+
else if (props.type === "address") {
|
|
95
|
+
const { address1 = "", address2 = "", city = "", state = "", zipcode = "", } = value;
|
|
96
|
+
return (React.createElement(React.Fragment, null,
|
|
97
|
+
React.createElement(TextField, { id: "address1", label: "Street Address", type: "text", value: address1, onChange: (result) => handleAddressChange("address1", result.value) }),
|
|
98
|
+
React.createElement(TextField, { id: "address2", label: "Apt, suite, etc", type: "text", value: address2, onChange: (result) => handleAddressChange("address2", result.value) }),
|
|
99
|
+
React.createElement(TextField, { id: "city", label: "City", type: "text", value: city, onChange: (result) => handleAddressChange("city", result.value) }),
|
|
100
|
+
React.createElement(SelectList, { id: "state", label: "State", options: USSTATESLIST, placeholder: "Select state", style: { borderRadius: 16 }, value: state, onChange: (result) => handleAddressChange("state", result) }),
|
|
101
|
+
React.createElement(TextField, { id: "zipcode", label: "Zipcode", type: "text", value: zipcode, onChange: (result) => handleAddressChange("zipcode", result.value) })));
|
|
102
|
+
}
|
|
87
103
|
else {
|
|
88
104
|
let type = "text";
|
|
89
105
|
// Number is supported differently because we need fractional numbers and they don't work
|
package/dist/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../src/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAoB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../src/Field.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,QAA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,GAAG,KAAK,CAAC;IAChG,OAAO,CACL,oBAAC,GAAG,IAAC,YAAY,EAAE,CAAC;QAClB,oBAAC,eAAe,oBACV;YACF,YAAY;YACZ,iBAAiB;YACjB,UAAU;YACV,eAAe;YACf,KAAK;YACL,UAAU;SACX,GAEA,QAAQ,CACO,CACd,CACP,CAAC;AACJ,CAAC"}
|
package/dist/Modal.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ModalProps {
|
|
3
|
+
onDismiss: () => void;
|
|
4
|
+
visible: boolean;
|
|
5
|
+
align?: "center" | "start";
|
|
6
|
+
children?: React.ReactElement;
|
|
7
|
+
footer?: React.ReactElement;
|
|
8
|
+
heading?: string;
|
|
9
|
+
size?: "sm" | "md" | "lg";
|
|
10
|
+
subHeading?: string;
|
|
11
|
+
primaryButtonText?: string;
|
|
12
|
+
primaryButtonOnClick?: (value?: any) => void;
|
|
13
|
+
secondaryButtonText?: string;
|
|
14
|
+
secondaryButtonOnClick?: (value?: any) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const Modal: ({ onDismiss, visible, align, children, footer, heading, size, subHeading, primaryButtonText, primaryButtonOnClick, secondaryButtonText, secondaryButtonOnClick, }: ModalProps) => React.ReactElement;
|
|
17
|
+
export {};
|
package/dist/Modal.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Dimensions, Modal as RNModal } from "react-native";
|
|
3
|
+
import { Box } from "./Box";
|
|
4
|
+
import { Button } from "./Button";
|
|
5
|
+
import { Heading } from "./Heading";
|
|
6
|
+
import { Text } from "./Text";
|
|
7
|
+
export const Modal = ({ onDismiss, visible, align = "center", children, footer, heading, size, subHeading, primaryButtonText, primaryButtonOnClick, secondaryButtonText, secondaryButtonOnClick, }) => {
|
|
8
|
+
if (subHeading && !heading) {
|
|
9
|
+
throw new Error("Cannot render Modal with subHeading and no heading");
|
|
10
|
+
}
|
|
11
|
+
if (!footer && !primaryButtonText && !secondaryButtonText) {
|
|
12
|
+
throw new Error("Cannot render Modal without footer, primaryButtonText, or secondaryButtonText");
|
|
13
|
+
}
|
|
14
|
+
function renderHeader() {
|
|
15
|
+
return (React.createElement(Box, { paddingY: 3, width: "100%" },
|
|
16
|
+
React.createElement(Box, null,
|
|
17
|
+
React.createElement(Heading, { align: align === "center" ? "center" : undefined, size: "sm" }, heading)),
|
|
18
|
+
Boolean(subHeading) && (React.createElement(Box, { paddingY: 2 },
|
|
19
|
+
React.createElement(Text, { align: align === "center" ? "center" : undefined }, subHeading)))));
|
|
20
|
+
}
|
|
21
|
+
function renderFooter() {
|
|
22
|
+
if (footer) {
|
|
23
|
+
return footer;
|
|
24
|
+
}
|
|
25
|
+
return (React.createElement(Box, { direction: "row", justifyContent: "end", width: "100%" },
|
|
26
|
+
Boolean(secondaryButtonText) && (React.createElement(Box, { marginRight: 4, minWidth: 120 },
|
|
27
|
+
React.createElement(Button, { color: "gray", text: secondaryButtonText !== null && secondaryButtonText !== void 0 ? secondaryButtonText : "", onClick: secondaryButtonOnClick }))),
|
|
28
|
+
React.createElement(Box, { minWidth: 120 },
|
|
29
|
+
React.createElement(Button, { color: "primary", text: primaryButtonText !== null && primaryButtonText !== void 0 ? primaryButtonText : "", onClick: primaryButtonOnClick }))));
|
|
30
|
+
}
|
|
31
|
+
let sizePx = 540;
|
|
32
|
+
if (size === "md") {
|
|
33
|
+
sizePx = 720;
|
|
34
|
+
}
|
|
35
|
+
else if (size === "lg") {
|
|
36
|
+
sizePx = 900;
|
|
37
|
+
}
|
|
38
|
+
// Adjust size for small screens
|
|
39
|
+
if (sizePx > Dimensions.get("window").width) {
|
|
40
|
+
sizePx = "90%";
|
|
41
|
+
}
|
|
42
|
+
return (React.createElement(Box, { alignItems: "center", flex: "grow", height: "100%", justifyContent: "center", width: "100%" },
|
|
43
|
+
React.createElement(RNModal, { animationType: "slide", transparent: true, visible: visible, onRequestClose: onDismiss },
|
|
44
|
+
React.createElement(Box, { alignItems: "center", alignSelf: "center", color: "white", dangerouslySetInlineStyle: {
|
|
45
|
+
__style: {
|
|
46
|
+
zIndex: 1,
|
|
47
|
+
shadowColor: "#999",
|
|
48
|
+
shadowOffset: {
|
|
49
|
+
width: 4,
|
|
50
|
+
height: 6,
|
|
51
|
+
},
|
|
52
|
+
shadowRadius: 4,
|
|
53
|
+
shadowOpacity: 1.0,
|
|
54
|
+
elevation: 8,
|
|
55
|
+
},
|
|
56
|
+
}, direction: "column", justifyContent: "center", marginTop: 12, maxWidth: sizePx, minWidth: 300, paddingX: 8, paddingY: 2, rounding: 6, shadow: true, width: sizePx },
|
|
57
|
+
React.createElement(Box, { marginBottom: 6, width: "100%" },
|
|
58
|
+
renderHeader(),
|
|
59
|
+
React.createElement(Box, { paddingY: 4 }, children),
|
|
60
|
+
React.createElement(Box, { paddingY: 4 }, renderFooter()))))));
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=Modal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.js","sourceRoot":"","sources":["../src/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAE,KAAK,IAAI,OAAO,EAAC,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAuB5B,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EACpB,SAAS,EACT,OAAO,EACP,KAAK,GAAG,QAAQ,EAChB,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,UAAU,EACV,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,GACX,EAAsB,EAAE;IACnC,IA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QAAQ,EAAE,CAAC,EACX,MAAM,QACN,KAAK,EAAE,MAAM;gBAEb,oBAAC,GAAG,IAAC,YAAY,EAAE,CAAC,EAAE,KAAK,EAAC,MAAM;oBAC/B,YAAY,EAAE;oBACf,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,IAAG,QAAQ,CAAO;oBAClC,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC,IAAG,YAAY,EAAE,CAAO,CACpC,CACF,CACE,CACN,CACP,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/SelectList.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FieldWithLabelsProps } from "./Common";
|
|
2
|
+
import { FieldWithLabelsProps, StyleProp } from "./Common";
|
|
3
3
|
export declare type SelectListOptions = {
|
|
4
4
|
label: string;
|
|
5
5
|
value: string;
|
|
@@ -13,5 +13,6 @@ export interface SelectListProps extends FieldWithLabelsProps {
|
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
size?: "md" | "lg";
|
|
15
15
|
placeholder?: string;
|
|
16
|
+
style?: StyleProp;
|
|
16
17
|
}
|
|
17
|
-
export declare function SelectList({ options, value, onChange }: SelectListProps): JSX.Element;
|
|
18
|
+
export declare function SelectList({ options, value, onChange, label, labelColor, style }: SelectListProps): JSX.Element;
|
package/dist/SelectList.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import RNPickerSelect from "./PickerSelect";
|
|
3
3
|
import { Unifier } from "./Unifier";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
4
|
+
import { WithLabel } from "./WithLabel";
|
|
5
|
+
export function SelectList({ options, value, onChange, label, labelColor, style }) {
|
|
6
|
+
const withLabelProps = { label, labelColor };
|
|
7
|
+
return (React.createElement(WithLabel, Object.assign({}, withLabelProps),
|
|
8
|
+
React.createElement(RNPickerSelect, { items: options, placeholder: {}, style: {
|
|
9
|
+
viewContainer: {
|
|
10
|
+
flexDirection: (style === null || style === void 0 ? void 0 : style.flexDirection) || "row",
|
|
11
|
+
justifyContent: (style === null || style === void 0 ? void 0 : style.justifyContent) || "center",
|
|
12
|
+
alignItems: (style === null || style === void 0 ? void 0 : style.alignItems) || "center",
|
|
13
|
+
minHeight: (style === null || style === void 0 ? void 0 : style.minHeight) || 50,
|
|
14
|
+
width: (style === null || style === void 0 ? void 0 : style.width) || "100%",
|
|
15
|
+
// Add padding so the border doesn't mess up layouts
|
|
16
|
+
paddingHorizontal: (style === null || style === void 0 ? void 0 : style.paddingHorizontal) || 6,
|
|
17
|
+
paddingVertical: (style === null || style === void 0 ? void 0 : style.paddingVertical) || 4,
|
|
18
|
+
borderColor: (style === null || style === void 0 ? void 0 : style.borderColor) || Unifier.theme.gray,
|
|
19
|
+
borderWidth: (style === null || style === void 0 ? void 0 : style.borderWidth) || 1,
|
|
20
|
+
borderRadius: (style === null || style === void 0 ? void 0 : style.borderRadius) || 5,
|
|
21
|
+
backgroundColor: (style === null || style === void 0 ? void 0 : style.backgroundColor) || Unifier.theme.white,
|
|
22
|
+
},
|
|
23
|
+
}, value: value, onValueChange: onChange })));
|
|
21
24
|
}
|
|
22
25
|
//# sourceMappingURL=SelectList.js.map
|
package/dist/SelectList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectList.js","sourceRoot":"","sources":["../src/SelectList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,cAAc,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectList.js","sourceR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D,WAAW,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,KAAI,CAAC;oBACpC,YAAY,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,KAAI,CAAC;oBACtC,eAAe,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,eAAe,KAAI,OAAO,CAAC,KAAK,CAAC,KAAK;iBAC/D;aACF,EACD,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,QAAQ,GACvB,CACQ,CACb,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./Constants";
|
|
1
2
|
export * from "./Common";
|
|
3
|
+
export * from "./ActionSheet";
|
|
2
4
|
export * from "./Avatar";
|
|
3
5
|
export * from "./Banner";
|
|
4
6
|
export * from "./BlurBox";
|
|
@@ -16,13 +18,13 @@ export * from "./Form";
|
|
|
16
18
|
export * from "./HeaderButtons";
|
|
17
19
|
export * from "./Heading";
|
|
18
20
|
export * from "./Icon";
|
|
19
|
-
export * from "./ActionSheet";
|
|
20
21
|
export * from "./IconButton";
|
|
21
22
|
export * from "./Image";
|
|
22
23
|
export * from "./ImageBackground";
|
|
23
24
|
export * from "./Link";
|
|
24
25
|
export * from "./Mask";
|
|
25
26
|
export * from "./Meta";
|
|
27
|
+
export * from "./Modal";
|
|
26
28
|
export * from "./Page";
|
|
27
29
|
export * from "./Pill";
|
|
28
30
|
export * from "./ScrollView";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./Constants";
|
|
1
2
|
export * from "./Common";
|
|
3
|
+
export * from "./ActionSheet";
|
|
2
4
|
export * from "./Avatar";
|
|
3
5
|
export * from "./Banner";
|
|
4
6
|
export * from "./BlurBox";
|
|
@@ -16,7 +18,6 @@ export * from "./Form";
|
|
|
16
18
|
export * from "./HeaderButtons";
|
|
17
19
|
export * from "./Heading";
|
|
18
20
|
export * from "./Icon";
|
|
19
|
-
export * from "./ActionSheet";
|
|
20
21
|
export * from "./IconButton";
|
|
21
22
|
export * from "./Image";
|
|
22
23
|
export * from "./ImageBackground";
|
|
@@ -25,7 +26,7 @@ export * from "./ImageBackground";
|
|
|
25
26
|
export * from "./Link";
|
|
26
27
|
export * from "./Mask";
|
|
27
28
|
export * from "./Meta";
|
|
28
|
-
|
|
29
|
+
export * from "./Modal";
|
|
29
30
|
export * from "./Page";
|
|
30
31
|
export * from "./Pill";
|
|
31
32
|
export * from "./ScrollView";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ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
121
121
|
},
|
|
122
122
|
"devDependencies": {
|
|
123
123
|
"@expo/vector-icons": "^13.0.0",
|
|
124
|
-
"@react-native-async-storage/async-storage": "^1.17.
|
|
125
|
-
"@react-native-community/blur": "^
|
|
126
|
-
"@react-native-community/datetimepicker": "^6.2
|
|
127
|
-
"@react-native-picker/picker": "2.4.
|
|
128
|
-
"@types/lodash": "^4.14.
|
|
124
|
+
"@react-native-async-storage/async-storage": "^1.17.10",
|
|
125
|
+
"@react-native-community/blur": "^4.2.0",
|
|
126
|
+
"@react-native-community/datetimepicker": "^6.3.2",
|
|
127
|
+
"@react-native-picker/picker": "2.4.4",
|
|
128
|
+
"@types/lodash": "^4.14.184",
|
|
129
129
|
"@types/mdurl": "^1.0.2",
|
|
130
130
|
"@types/react-native": "^0.69.1",
|
|
131
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
132
|
-
"@typescript-eslint/parser": "^5.
|
|
133
|
-
"eslint": "^8.
|
|
131
|
+
"@typescript-eslint/eslint-plugin": "^5.34.0",
|
|
132
|
+
"@typescript-eslint/parser": "^5.34.0",
|
|
133
|
+
"eslint": "^8.22.0",
|
|
134
134
|
"eslint-config-ferns": "^0.4.0",
|
|
135
135
|
"eslint-config-prettier": "^8.5.0",
|
|
136
136
|
"eslint-plugin-import": "^2.26.0",
|
|
@@ -142,51 +142,51 @@
|
|
|
142
142
|
"eslint-plugin-simple-import-sort": "^7.0.0",
|
|
143
143
|
"eslint-plugin-unused-imports": "2.0.0",
|
|
144
144
|
"expo-font": "^10.0.5",
|
|
145
|
-
"expo-haptics": "~11.
|
|
145
|
+
"expo-haptics": "~11.3.0",
|
|
146
146
|
"lodash": "^4.17.21",
|
|
147
147
|
"mixpanel-browser": "^2.38.0",
|
|
148
|
-
"moment-timezone": "^0.5.
|
|
148
|
+
"moment-timezone": "^0.5.35",
|
|
149
149
|
"prettier": "^2.6.2",
|
|
150
|
-
"react": "^
|
|
151
|
-
"react-app-polyfill": "^
|
|
150
|
+
"react": "^18.2.0",
|
|
151
|
+
"react-app-polyfill": "^3.0.0",
|
|
152
152
|
"react-dev-utils": "^12.0.1",
|
|
153
|
-
"react-dom": "
|
|
154
|
-
"react-native": "0.
|
|
155
|
-
"react-native-calendars": "^1.
|
|
153
|
+
"react-dom": "18.2.0",
|
|
154
|
+
"react-native": "0.69.4",
|
|
155
|
+
"react-native-calendars": "^1.1288.2",
|
|
156
156
|
"react-native-gesture-handler": "^2.1.0",
|
|
157
|
-
"react-native-modalize": "^2.
|
|
158
|
-
"react-native-permissions": "^3.1
|
|
157
|
+
"react-native-modalize": "^2.1.1",
|
|
158
|
+
"react-native-permissions": "^3.6.1",
|
|
159
159
|
"react-native-picker-select": "^8.0.0",
|
|
160
160
|
"react-native-portalize": "^1.0.7",
|
|
161
|
-
"react-native-svg": "^
|
|
162
|
-
"react-router": "^
|
|
163
|
-
"react-router-dom": "^
|
|
161
|
+
"react-native-svg": "^13.0.0",
|
|
162
|
+
"react-router": "^6.3.0",
|
|
163
|
+
"react-router-dom": "^6.3.0",
|
|
164
164
|
"typescript": "4.1.5"
|
|
165
165
|
},
|
|
166
166
|
"peerDependencies": {
|
|
167
167
|
"@expo/vector-icons": "^13.0.0",
|
|
168
|
-
"@react-native-async-storage/async-storage": "^1.17.
|
|
169
|
-
"@react-native-community/blur": "^
|
|
170
|
-
"@react-native-community/datetimepicker": "^6.2
|
|
171
|
-
"@react-native-picker/picker": "2.4.
|
|
168
|
+
"@react-native-async-storage/async-storage": "^1.17.10",
|
|
169
|
+
"@react-native-community/blur": "^4.2.0",
|
|
170
|
+
"@react-native-community/datetimepicker": "^6.3.2",
|
|
171
|
+
"@react-native-picker/picker": "2.4.4",
|
|
172
172
|
"expo-font": "^10.0.5",
|
|
173
|
-
"expo-haptics": "~11.
|
|
173
|
+
"expo-haptics": "~11.3.0",
|
|
174
174
|
"lodash": "^4.17.21",
|
|
175
175
|
"mixpanel-browser": "^2.38.0",
|
|
176
|
-
"moment-timezone": "^0.5.
|
|
177
|
-
"react": "^
|
|
178
|
-
"react-app-polyfill": "^
|
|
176
|
+
"moment-timezone": "^0.5.35",
|
|
177
|
+
"react": "^18.2.0",
|
|
178
|
+
"react-app-polyfill": "^3.0.0",
|
|
179
179
|
"react-dev-utils": "^12.0.1",
|
|
180
|
-
"react-dom": "
|
|
181
|
-
"react-native": "0.
|
|
182
|
-
"react-native-calendars": "^1.
|
|
180
|
+
"react-dom": "18.2.0",
|
|
181
|
+
"react-native": "0.69.4",
|
|
182
|
+
"react-native-calendars": "^1.1288.2",
|
|
183
183
|
"react-native-gesture-handler": "^2.1.0",
|
|
184
|
-
"react-native-modalize": "^2.
|
|
185
|
-
"react-native-permissions": "^3.1
|
|
184
|
+
"react-native-modalize": "^2.1.1",
|
|
185
|
+
"react-native-permissions": "^3.6.1",
|
|
186
186
|
"react-native-picker-select": "^8.0.0",
|
|
187
187
|
"react-native-portalize": "^1.0.7",
|
|
188
|
-
"react-native-svg": "^
|
|
189
|
-
"react-router": "^
|
|
190
|
-
"react-router-dom": "^
|
|
188
|
+
"react-native-svg": "^13.0.0",
|
|
189
|
+
"react-router": "^6.3.0",
|
|
190
|
+
"react-router-dom": "^6.3.0"
|
|
191
191
|
}
|
|
192
192
|
}
|
package/src/Common.ts
CHANGED
|
@@ -1026,7 +1026,7 @@ export interface ScrollViewProps {
|
|
|
1026
1026
|
|
|
1027
1027
|
type ItemT = any;
|
|
1028
1028
|
type ViewStyle = any;
|
|
1029
|
-
interface StyleProp {
|
|
1029
|
+
export interface StyleProp {
|
|
1030
1030
|
[key: string]: any;
|
|
1031
1031
|
}
|
|
1032
1032
|
|
|
@@ -1329,3 +1329,11 @@ export interface ProgressBarProps {
|
|
|
1329
1329
|
color: Color;
|
|
1330
1330
|
completed: number;
|
|
1331
1331
|
}
|
|
1332
|
+
|
|
1333
|
+
export interface AddressInterface {
|
|
1334
|
+
address1: string;
|
|
1335
|
+
address2?: string;
|
|
1336
|
+
city: string;
|
|
1337
|
+
state: string;
|
|
1338
|
+
zipcode: string;
|
|
1339
|
+
}
|
package/src/Constants.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const USSTATESLIST = [
|
|
2
|
+
{label: "AL", value: "Alabama"},
|
|
3
|
+
{label: "AK", value: "Alaska"},
|
|
4
|
+
{label: "AZ", value: "Arizona"},
|
|
5
|
+
{label: "AR", value: "Arkansas"},
|
|
6
|
+
{label: "CA", value: "California"},
|
|
7
|
+
{label: "CO", value: "Colorado"},
|
|
8
|
+
{label: "CT", value: "Connecticut"},
|
|
9
|
+
{label: "DE", value: "Delaware"},
|
|
10
|
+
{label: "DC", value: "District Of Columbia"},
|
|
11
|
+
{label: "FL", value: "Florida"},
|
|
12
|
+
{label: "GA", value: "Georgia"},
|
|
13
|
+
{label: "HI", value: "Hawaii"},
|
|
14
|
+
{label: "ID", value: "Idaho"},
|
|
15
|
+
{label: "IL", value: "Illinois"},
|
|
16
|
+
{label: "IN", value: "Indiana"},
|
|
17
|
+
{label: "IA", value: "Iowa"},
|
|
18
|
+
{label: "KS", value: "Kansas"},
|
|
19
|
+
{label: "KY", value: "Kentucky"},
|
|
20
|
+
{label: "LA", value: "Louisiana"},
|
|
21
|
+
{label: "ME", value: "Maine"},
|
|
22
|
+
{label: "MD", value: "Maryland"},
|
|
23
|
+
{label: "MA", value: "Massachusetts"},
|
|
24
|
+
{label: "MI", value: "Michigan"},
|
|
25
|
+
{label: "MN", value: "Minnesota"},
|
|
26
|
+
{label: "MS", value: "Mississippi"},
|
|
27
|
+
{label: "MO", value: "Missouri"},
|
|
28
|
+
{label: "MT", value: "Montana"},
|
|
29
|
+
{label: "NE", value: "Nebraska"},
|
|
30
|
+
{label: "NV", value: "Nevada"},
|
|
31
|
+
{label: "NH", value: "New Hampshire"},
|
|
32
|
+
{label: "NJ", value: "New Jersey"},
|
|
33
|
+
{label: "NM", value: "New Mexico"},
|
|
34
|
+
{label: "NY", value: "New York"},
|
|
35
|
+
{label: "NC", value: "North Carolina"},
|
|
36
|
+
{label: "ND", value: "North Dakota"},
|
|
37
|
+
{label: "OH", value: "Ohio"},
|
|
38
|
+
{label: "OK", value: "Oklahoma"},
|
|
39
|
+
{label: "OR", value: "Oregon"},
|
|
40
|
+
{label: "PA", value: "Pennsylvania"},
|
|
41
|
+
{label: "RI", value: "Rhode Island"},
|
|
42
|
+
{label: "SC", value: "South Carolina"},
|
|
43
|
+
{label: "SD", value: "South Dakota"},
|
|
44
|
+
{label: "TN", value: "Tennessee"},
|
|
45
|
+
{label: "TX", value: "Texas"},
|
|
46
|
+
{label: "UT", value: "Utah"},
|
|
47
|
+
{label: "VT", value: "Vermont"},
|
|
48
|
+
{label: "VA", value: "Virginia"},
|
|
49
|
+
{label: "WA", value: "Washington"},
|
|
50
|
+
{label: "WV", value: "West Virginia"},
|
|
51
|
+
{label: "WI", value: "Wisconsin"},
|
|
52
|
+
{label: "WY", value: "Wyoming"},
|
|
53
|
+
];
|
package/src/Field.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, {useState} from "react";
|
|
2
2
|
|
|
3
3
|
import {Box} from "./Box";
|
|
4
|
-
import {FieldWithLabelsProps, TextFieldType} from "./Common";
|
|
4
|
+
import {AddressInterface, FieldWithLabelsProps, TextFieldType} from "./Common";
|
|
5
|
+
import {USSTATESLIST} from "./Constants";
|
|
5
6
|
import {FieldWithLabels} from "./FieldWithLabels";
|
|
6
7
|
import {SelectList, SelectListOptions} from "./SelectList";
|
|
7
8
|
import {Switch} from "./Switch";
|
|
@@ -30,7 +31,8 @@ export interface FieldProps extends FieldWithLabelsProps {
|
|
|
30
31
|
| "password"
|
|
31
32
|
| "url"
|
|
32
33
|
| "date"
|
|
33
|
-
| "multiselect"
|
|
34
|
+
| "multiselect"
|
|
35
|
+
| "address";
|
|
34
36
|
rows?: number;
|
|
35
37
|
options?: SelectListOptions;
|
|
36
38
|
placeholder?: string;
|
|
@@ -63,6 +65,13 @@ export function Field(props: FieldProps) {
|
|
|
63
65
|
}
|
|
64
66
|
};
|
|
65
67
|
|
|
68
|
+
const handleAddressChange = (field: string, newValue: string) => {
|
|
69
|
+
setValue({...value, [field]: newValue});
|
|
70
|
+
if (props.handleChange) {
|
|
71
|
+
props.handleChange(props.name, {...value, [field]: newValue});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
66
75
|
const handleSwitchChange = (switchValue: boolean) => {
|
|
67
76
|
setValue(switchValue);
|
|
68
77
|
if (props.handleChange) {
|
|
@@ -159,6 +168,55 @@ export function Field(props: FieldProps) {
|
|
|
159
168
|
onChange={(result) => handleChange(result.value)}
|
|
160
169
|
/>
|
|
161
170
|
);
|
|
171
|
+
} else if (props.type === "address") {
|
|
172
|
+
const {
|
|
173
|
+
address1 = "",
|
|
174
|
+
address2 = "",
|
|
175
|
+
city = "",
|
|
176
|
+
state = "",
|
|
177
|
+
zipcode = "",
|
|
178
|
+
}: AddressInterface = value;
|
|
179
|
+
return (
|
|
180
|
+
<>
|
|
181
|
+
<TextField
|
|
182
|
+
id="address1"
|
|
183
|
+
label="Street Address"
|
|
184
|
+
type="text"
|
|
185
|
+
value={address1}
|
|
186
|
+
onChange={(result) => handleAddressChange("address1", result.value)}
|
|
187
|
+
/>
|
|
188
|
+
<TextField
|
|
189
|
+
id="address2"
|
|
190
|
+
label="Apt, suite, etc"
|
|
191
|
+
type="text"
|
|
192
|
+
value={address2}
|
|
193
|
+
onChange={(result) => handleAddressChange("address2", result.value)}
|
|
194
|
+
/>
|
|
195
|
+
<TextField
|
|
196
|
+
id="city"
|
|
197
|
+
label="City"
|
|
198
|
+
type="text"
|
|
199
|
+
value={city}
|
|
200
|
+
onChange={(result) => handleAddressChange("city", result.value)}
|
|
201
|
+
/>
|
|
202
|
+
<SelectList
|
|
203
|
+
id="state"
|
|
204
|
+
label="State"
|
|
205
|
+
options={USSTATESLIST}
|
|
206
|
+
placeholder="Select state"
|
|
207
|
+
style={{borderRadius: 16}}
|
|
208
|
+
value={state}
|
|
209
|
+
onChange={(result) => handleAddressChange("state", result)}
|
|
210
|
+
/>
|
|
211
|
+
<TextField
|
|
212
|
+
id="zipcode"
|
|
213
|
+
label="Zipcode"
|
|
214
|
+
type="text"
|
|
215
|
+
value={zipcode}
|
|
216
|
+
onChange={(result) => handleAddressChange("zipcode", result.value)}
|
|
217
|
+
/>
|
|
218
|
+
</>
|
|
219
|
+
);
|
|
162
220
|
} else {
|
|
163
221
|
let type: TextFieldType = "text";
|
|
164
222
|
// Number is supported differently because we need fractional numbers and they don't work
|
package/src/Modal.tsx
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {Dimensions, Modal as RNModal} from "react-native";
|
|
3
|
+
|
|
4
|
+
import {Box} from "./Box";
|
|
5
|
+
import {Button} from "./Button";
|
|
6
|
+
import {Heading} from "./Heading";
|
|
7
|
+
import {Text} from "./Text";
|
|
8
|
+
|
|
9
|
+
interface ModalProps {
|
|
10
|
+
onDismiss: () => void;
|
|
11
|
+
visible: boolean;
|
|
12
|
+
// Alignment of the header. Default is "center".
|
|
13
|
+
align?: "center" | "start";
|
|
14
|
+
// Element to render in the middle part of the modal.
|
|
15
|
+
children?: React.ReactElement;
|
|
16
|
+
// Element to render in the bottom of the modal. This takes precedence over primaryButton and secondaryButton.
|
|
17
|
+
footer?: React.ReactElement;
|
|
18
|
+
heading?: string;
|
|
19
|
+
size?: "sm" | "md" | "lg";
|
|
20
|
+
subHeading?: string;
|
|
21
|
+
// Renders a primary colored button all the way to the right in the footer, if no footer prop is provided.
|
|
22
|
+
primaryButtonText?: string;
|
|
23
|
+
primaryButtonOnClick?: (value?: any) => void;
|
|
24
|
+
// Renders a primary gray button to the left of the primary button in the footer, if no footer prop is provided.
|
|
25
|
+
// Requires primaryButtonText to be defined, but is not required itself.
|
|
26
|
+
secondaryButtonText?: string;
|
|
27
|
+
secondaryButtonOnClick?: (value?: any) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Modal = ({
|
|
31
|
+
onDismiss,
|
|
32
|
+
visible,
|
|
33
|
+
align = "center",
|
|
34
|
+
children,
|
|
35
|
+
footer,
|
|
36
|
+
heading,
|
|
37
|
+
size,
|
|
38
|
+
subHeading,
|
|
39
|
+
primaryButtonText,
|
|
40
|
+
primaryButtonOnClick,
|
|
41
|
+
secondaryButtonText,
|
|
42
|
+
secondaryButtonOnClick,
|
|
43
|
+
}: ModalProps): React.ReactElement => {
|
|
44
|
+
if (subHeading && !heading) {
|
|
45
|
+
throw new Error("Cannot render Modal with subHeading and no heading");
|
|
46
|
+
}
|
|
47
|
+
if (!footer && !primaryButtonText && !secondaryButtonText) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
"Cannot render Modal without footer, primaryButtonText, or secondaryButtonText"
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function renderHeader(): React.ReactElement {
|
|
54
|
+
return (
|
|
55
|
+
<Box paddingY={3} width="100%">
|
|
56
|
+
<Box>
|
|
57
|
+
<Heading align={align === "center" ? "center" : undefined} size="sm">
|
|
58
|
+
{heading}
|
|
59
|
+
</Heading>
|
|
60
|
+
</Box>
|
|
61
|
+
{Boolean(subHeading) && (
|
|
62
|
+
<Box paddingY={2}>
|
|
63
|
+
<Text align={align === "center" ? "center" : undefined}>{subHeading}</Text>
|
|
64
|
+
</Box>
|
|
65
|
+
)}
|
|
66
|
+
</Box>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
function renderFooter(): React.ReactElement | null {
|
|
70
|
+
if (footer) {
|
|
71
|
+
return footer;
|
|
72
|
+
}
|
|
73
|
+
return (
|
|
74
|
+
<Box direction="row" justifyContent="end" width="100%">
|
|
75
|
+
{Boolean(secondaryButtonText) && (
|
|
76
|
+
<Box marginRight={4} minWidth={120}>
|
|
77
|
+
<Button
|
|
78
|
+
color="gray"
|
|
79
|
+
text={secondaryButtonText ?? ""}
|
|
80
|
+
onClick={secondaryButtonOnClick}
|
|
81
|
+
/>
|
|
82
|
+
</Box>
|
|
83
|
+
)}
|
|
84
|
+
<Box minWidth={120}>
|
|
85
|
+
<Button color="primary" text={primaryButtonText ?? ""} onClick={primaryButtonOnClick} />
|
|
86
|
+
</Box>
|
|
87
|
+
</Box>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
let sizePx: string | number = 540;
|
|
92
|
+
if (size === "md") {
|
|
93
|
+
sizePx = 720;
|
|
94
|
+
} else if (size === "lg") {
|
|
95
|
+
sizePx = 900;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Adjust size for small screens
|
|
99
|
+
if (sizePx > Dimensions.get("window").width) {
|
|
100
|
+
sizePx = "90%";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Box alignItems="center" flex="grow" height="100%" justifyContent="center" width="100%">
|
|
105
|
+
<RNModal animationType="slide" transparent visible={visible} onRequestClose={onDismiss}>
|
|
106
|
+
<Box
|
|
107
|
+
alignItems="center"
|
|
108
|
+
alignSelf="center"
|
|
109
|
+
color="white"
|
|
110
|
+
dangerouslySetInlineStyle={{
|
|
111
|
+
__style: {
|
|
112
|
+
zIndex: 1,
|
|
113
|
+
shadowColor: "#999",
|
|
114
|
+
shadowOffset: {
|
|
115
|
+
width: 4,
|
|
116
|
+
height: 6,
|
|
117
|
+
},
|
|
118
|
+
shadowRadius: 4,
|
|
119
|
+
shadowOpacity: 1.0,
|
|
120
|
+
elevation: 8,
|
|
121
|
+
},
|
|
122
|
+
}}
|
|
123
|
+
direction="column"
|
|
124
|
+
justifyContent="center"
|
|
125
|
+
marginTop={12}
|
|
126
|
+
maxWidth={sizePx}
|
|
127
|
+
minWidth={300}
|
|
128
|
+
paddingX={8}
|
|
129
|
+
paddingY={2}
|
|
130
|
+
rounding={6}
|
|
131
|
+
shadow
|
|
132
|
+
width={sizePx}
|
|
133
|
+
>
|
|
134
|
+
<Box marginBottom={6} width="100%">
|
|
135
|
+
{renderHeader()}
|
|
136
|
+
<Box paddingY={4}>{children}</Box>
|
|
137
|
+
<Box paddingY={4}>{renderFooter()}</Box>
|
|
138
|
+
</Box>
|
|
139
|
+
</Box>
|
|
140
|
+
</RNModal>
|
|
141
|
+
</Box>
|
|
142
|
+
);
|
|
143
|
+
};
|
package/src/SelectList.tsx
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import {FieldWithLabelsProps} from "./Common";
|
|
3
|
+
import {FieldWithLabelsProps, StyleProp} from "./Common";
|
|
4
4
|
import RNPickerSelect from "./PickerSelect";
|
|
5
5
|
import {Unifier} from "./Unifier";
|
|
6
|
+
import {WithLabel} from "./WithLabel";
|
|
6
7
|
|
|
7
8
|
// Use "" if you want to have an "unset" value.
|
|
8
9
|
export type SelectListOptions = {label: string; value: string}[];
|
|
@@ -15,31 +16,35 @@ export interface SelectListProps extends FieldWithLabelsProps {
|
|
|
15
16
|
disabled?: boolean;
|
|
16
17
|
size?: "md" | "lg";
|
|
17
18
|
placeholder?: string;
|
|
19
|
+
style?: StyleProp;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
export function SelectList({options, value, onChange}: SelectListProps) {
|
|
22
|
+
export function SelectList({options, value, onChange, label, labelColor, style}: SelectListProps) {
|
|
23
|
+
const withLabelProps = {label, labelColor};
|
|
21
24
|
return (
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
<WithLabel {...withLabelProps}>
|
|
26
|
+
<RNPickerSelect
|
|
27
|
+
items={options}
|
|
28
|
+
placeholder={{}}
|
|
29
|
+
style={{
|
|
30
|
+
viewContainer: {
|
|
31
|
+
flexDirection: style?.flexDirection || "row",
|
|
32
|
+
justifyContent: style?.justifyContent || "center",
|
|
33
|
+
alignItems: style?.alignItems || "center",
|
|
34
|
+
minHeight: style?.minHeight || 50,
|
|
35
|
+
width: style?.width || "100%",
|
|
36
|
+
// Add padding so the border doesn't mess up layouts
|
|
37
|
+
paddingHorizontal: style?.paddingHorizontal || 6,
|
|
38
|
+
paddingVertical: style?.paddingVertical || 4,
|
|
39
|
+
borderColor: style?.borderColor || Unifier.theme.gray,
|
|
40
|
+
borderWidth: style?.borderWidth || 1,
|
|
41
|
+
borderRadius: style?.borderRadius || 5,
|
|
42
|
+
backgroundColor: style?.backgroundColor || Unifier.theme.white,
|
|
43
|
+
},
|
|
44
|
+
}}
|
|
45
|
+
value={value}
|
|
46
|
+
onValueChange={onChange}
|
|
47
|
+
/>
|
|
48
|
+
</WithLabel>
|
|
44
49
|
);
|
|
45
50
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export * from "./Constants";
|
|
1
2
|
export * from "./Common";
|
|
3
|
+
export * from "./ActionSheet";
|
|
2
4
|
export * from "./Avatar";
|
|
3
5
|
export * from "./Banner";
|
|
4
6
|
export * from "./BlurBox";
|
|
@@ -16,7 +18,6 @@ export * from "./Form";
|
|
|
16
18
|
export * from "./HeaderButtons";
|
|
17
19
|
export * from "./Heading";
|
|
18
20
|
export * from "./Icon";
|
|
19
|
-
export * from "./ActionSheet";
|
|
20
21
|
export * from "./IconButton";
|
|
21
22
|
export * from "./Image";
|
|
22
23
|
export * from "./ImageBackground";
|
|
@@ -25,7 +26,7 @@ export * from "./ImageBackground";
|
|
|
25
26
|
export * from "./Link";
|
|
26
27
|
export * from "./Mask";
|
|
27
28
|
export * from "./Meta";
|
|
28
|
-
|
|
29
|
+
export * from "./Modal";
|
|
29
30
|
|
|
30
31
|
export * from "./Page";
|
|
31
32
|
export * from "./Pill";
|