ferns-ui 0.8.0 → 0.9.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/SelectList.d.ts +3 -2
- package/dist/SelectList.js +20 -17
- package/dist/SelectList.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Common.ts +9 -1
- package/src/Constants.ts +53 -0
- package/src/Field.tsx +60 -2
- package/src/SelectList.tsx +29 -24
- package/src/index.tsx +1 -0
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,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAC;IAC/B,EAAC,KAAK,EAAE,IAAI,EAAE,KA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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,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO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Ae,oBACV;YACF,YAAY;YACZ,iBAAiB;YACjB,UAAU;YACV,eAAe;YACf,KAAK;YACL,UAAU;SACX,GAEA,QAAQ,CACO,CACd,CACP,CAAC;AACJ,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","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;AAClC,OAAO,EAAC,SAAS,EAAC,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AAK,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
package/dist/index.js
CHANGED
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,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,4BAA4B;AAC5B,4BAA4B;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,2BAA2B;AAE3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,Q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AC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,2BAA2B;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
package/package.json
CHANGED
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/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