@bloom-housing/ui-components 12.0.13 → 12.0.15
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/src/forms/Field.js
CHANGED
|
@@ -13,6 +13,7 @@ import React, { useMemo } from "react";
|
|
|
13
13
|
import { ErrorMessage } from "../notifications/ErrorMessage";
|
|
14
14
|
import { httpsRegex, urlRegex } from "../helpers/validators";
|
|
15
15
|
var Field = function (props) {
|
|
16
|
+
var _a;
|
|
16
17
|
var classes = ["field"];
|
|
17
18
|
if (props.error) {
|
|
18
19
|
classes.push("error");
|
|
@@ -56,16 +57,15 @@ var Field = function (props) {
|
|
|
56
57
|
}
|
|
57
58
|
if (props.type === "url") {
|
|
58
59
|
inputProps = __assign(__assign({}, inputProps), { ref: props.register &&
|
|
59
|
-
props.register(props.validation
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
props.register(__assign(__assign({}, props.validation), { validate: __assign({ https: function (value) {
|
|
61
|
+
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
62
|
+
return true;
|
|
62
63
|
return httpsRegex.test(value);
|
|
63
|
-
},
|
|
64
|
-
|
|
64
|
+
}, invalid: function (value) {
|
|
65
|
+
if (!(value === null || value === void 0 ? void 0 : value.length))
|
|
66
|
+
return true;
|
|
65
67
|
return urlRegex.test(value);
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
}) });
|
|
68
|
+
} }, (_a = props.validation) === null || _a === void 0 ? void 0 : _a.validate) })) });
|
|
69
69
|
}
|
|
70
70
|
var type = (props.type === "currency" && "text") || props.type || "text";
|
|
71
71
|
var isRadioOrCheckbox = ["radio", "checkbox"].includes(type);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../src/forms/Field.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAe,OAAO,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAA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AAI,KAAK,gBACxB,KAAK,CAAC,SAAS,EAC3B,SAAS,EAAC,OAAO,EACjB,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,KAAK,CAAC,IAAI,EAChB,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,GAAG,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,EACvD,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,QAAQ,EAAE,KAAK,CAAC,QAAQ,iBACX,KAAK,CAAC,UAAU,IACzB,UAAU,IACd,MAAM,EAAE,KAAK,CAAC,MAAM,IACpB;YACD,iBAAiB,IAAI,KAAK,CACvB;QACL,KAAK,CAAC,OAAO,IAAI,2BAAG,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAC,OAAO,CAAK;QAClE,KAAK,CAAC,YAAY,IAAI,CACrB,oBAAC,YAAY,IAAC,EAAE,EAAE,UAAG,QAAQ,WAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,IACtD,KAAK,CAAC,YAAY,CACN,CAChB,CACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { t, GridSection, ViewItem, GridCell, Field, Select, resolveObject
|
|
2
|
+
import { t, GridSection, ViewItem, GridCell, Field, Select, resolveObject } from "../../";
|
|
3
3
|
export var FormAddress = function (_a) {
|
|
4
|
-
var
|
|
4
|
+
var _b, _c, _d;
|
|
5
|
+
var subtitle = _a.subtitle, dataKey = _a.dataKey, _e = _a.enableMailCheckbox, enableMailCheckbox = _e === void 0 ? false : _e, register = _a.register, errors = _a.errors, required = _a.required, stateKeys = _a.stateKeys;
|
|
5
6
|
return (React.createElement(React.Fragment, null,
|
|
6
7
|
React.createElement(GridSection, { subtitle: subtitle },
|
|
7
8
|
React.createElement(GridCell, { span: 2 },
|
|
8
9
|
React.createElement(ViewItem, { label: t("application.contact.streetAddress") },
|
|
9
|
-
React.createElement(Field, { id: "".concat(dataKey, ".street"), name: "".concat(dataKey, ".street"), label: t("application.contact.streetAddress"), placeholder: t("application.contact.streetAddress"), register: register, validation: { required: required }, error: !!resolveObject("".concat(dataKey, ".street"), errors), errorMessage:
|
|
10
|
+
React.createElement(Field, { id: "".concat(dataKey, ".street"), name: "".concat(dataKey, ".street"), label: t("application.contact.streetAddress"), placeholder: t("application.contact.streetAddress"), register: register, validation: { required: required, maxLength: 64 }, error: !!resolveObject("".concat(dataKey, ".street"), errors), errorMessage: ((_b = resolveObject("".concat(dataKey, ".street"), errors)) === null || _b === void 0 ? void 0 : _b.type) === "maxLength"
|
|
11
|
+
? t("errors.maxLength")
|
|
12
|
+
: t("errors.streetError"), readerOnly: true }))),
|
|
10
13
|
React.createElement(GridCell, null,
|
|
11
14
|
React.createElement(ViewItem, { label: t("application.contact.apt") },
|
|
12
|
-
React.createElement(Field, { id: "".concat(dataKey, ".street2"), name: "".concat(dataKey, ".street2"), label: t("application.contact.apt"), placeholder: t("application.contact.apt"), register: register, readerOnly: true }))),
|
|
15
|
+
React.createElement(Field, { id: "".concat(dataKey, ".street2"), name: "".concat(dataKey, ".street2"), label: t("application.contact.apt"), placeholder: t("application.contact.apt"), register: register, readerOnly: true, error: !!resolveObject("".concat(dataKey, ".street2"), errors), validation: { maxLength: 64 }, errorMessage: t("errors.maxLength") }))),
|
|
13
16
|
React.createElement(GridCell, null,
|
|
14
17
|
React.createElement(ViewItem, { label: t("application.contact.city") },
|
|
15
|
-
React.createElement(Field, { id: "".concat(dataKey, ".city"), name: "".concat(dataKey, ".city"), label: t("application.contact.cityName"), placeholder: t("application.contact.cityName"), register: register, validation: { required: required }, error: !!resolveObject("".concat(dataKey, ".city"), errors), errorMessage:
|
|
18
|
+
React.createElement(Field, { id: "".concat(dataKey, ".city"), name: "".concat(dataKey, ".city"), label: t("application.contact.cityName"), placeholder: t("application.contact.cityName"), register: register, validation: { required: required, maxLength: 64 }, error: !!resolveObject("".concat(dataKey, ".city"), errors), errorMessage: ((_c = resolveObject("".concat(dataKey, ".city"), errors)) === null || _c === void 0 ? void 0 : _c.type) === "maxLength"
|
|
19
|
+
? t("errors.maxLength")
|
|
20
|
+
: t("errors.cityError"), readerOnly: true }))),
|
|
16
21
|
React.createElement(GridCell, { className: "md:grid md:grid-cols-2 md:gap-8", span: 2 },
|
|
17
22
|
React.createElement(ViewItem, { label: t("application.contact.state"), className: "mb-0" },
|
|
18
23
|
React.createElement(Select, { id: "".concat(dataKey, ".state"), name: "".concat(dataKey, ".state"), label: t("application.contact.state"), labelClassName: "sr-only", register: register, controlClassName: "control", options: stateKeys, keyPrefix: "states", validation: { required: required }, error: !!resolveObject("".concat(dataKey, ".state"), errors), errorMessage: t("errors.stateError") })),
|
|
19
24
|
React.createElement(ViewItem, { label: t("application.contact.zip") },
|
|
20
|
-
React.createElement(Field, { id: "".concat(dataKey, ".zipCode"), name: "".concat(dataKey, ".zipCode"), label: t("application.contact.zip"), placeholder: t("application.contact.zipCode"), register: register, validation: { required: required }, error: !!resolveObject("".concat(dataKey, ".zipCode"), errors), errorMessage:
|
|
25
|
+
React.createElement(Field, { id: "".concat(dataKey, ".zipCode"), name: "".concat(dataKey, ".zipCode"), label: t("application.contact.zip"), placeholder: t("application.contact.zipCode"), register: register, validation: { required: required, maxLength: 64 }, error: !!resolveObject("".concat(dataKey, ".zipCode"), errors), errorMessage: ((_d = resolveObject("".concat(dataKey, ".zipCode"), errors)) === null || _d === void 0 ? void 0 : _d.type) === "maxLength"
|
|
26
|
+
? t("errors.maxLength")
|
|
27
|
+
: t("errors.zipCodeError"), readerOnly: true }))),
|
|
21
28
|
enableMailCheckbox && (React.createElement(GridCell, { span: 2 },
|
|
22
29
|
React.createElement(Field, { id: "application.sendMailToMailingAddress", name: "application.sendMailToMailingAddress", type: "checkbox", label: t("application.contact.sendMailToMailingAddress"), register: register }))))));
|
|
23
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../../src/helpers/preferences.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,
|
|
1
|
+
{"version":3,"file":"preferences.js","sourceRoot":"","sources":["../../../src/helpers/preferences.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAYzF,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,EAQT;;QAPjB,QAAQ,cAAA,EACR,OAAO,aAAA,EACP,0BAA0B,EAA1B,kBAAkB,mBAAG,KAAK,KAAA,EAC1B,QAAQ,cAAA,EACR,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,SAAS,eAAA;IAET,OAAO,CACL;QACE,oBAAC,WAAW,IAAC,QAAQ,EAAE,QAAQ;YAC7B,oBAAC,QAAQ,IAAC,IAAI,EAAE,CAAC;gBACf,oBAAC,QAAQ,IAAC,KAAK,EAAE,CAAC,CAAC,mCAAmC,CAAC;oBACrD,oBAAC,KAAK,IACJ,EAAE,EAAE,UAAG,OAAO,YAAS,EACvB,IAAI,EAAE,UAAG,OAAO,YAAS,EACzB,KAAK,EAAE,CAAC,CAAC,mCAAmC,CAAC,EAC7C,WAAW,EAAE,CAAC,CAAC,mCAAmC,CAAC,EACnD,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,EAAE,QAAQ,UAAA,EAAE,SAAS,EAAE,EAAE,EAAE,EACvC,KAAK,EAAE,CAAC,CAAC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D,YAAY,EACV,CAAA,MAAA,aAAa,CAAC,UAAG,OAAO,aAAU,EAAE,MAAM,CAAC,0CAAE,IAAI,MAAK,WAAW;4BAC/D,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC;4BACvB,CAAC,CAAC,CAAC,CAAC,qBAAqB,CAAC,EAE9B,UAAU,SACV,CACO,CACF;YAEV,kBAAkB,IAAI,CACrB,oBAAC,QAAQ,IAAC,IAAI,EAAE,CAAC;gBACf,oBAAC,KAAK,IACJ,EAAE,EAAC,sCAAsC,EACzC,IAAI,EAAC,sCAAsC,EAC3C,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,CAAC,CAAC,8CAA8C,CAAC,EACxD,QAAQ,EAAE,QAAQ,GAClB,CACO,CACZ,CACW,CACb,CACJ,CAAA;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloom-housing/ui-components",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.15",
|
|
4
4
|
"author": "Sean Albert <sean.albert@exygy.com>",
|
|
5
5
|
"description": "Shared user interface components for Bloom affordable housing system",
|
|
6
6
|
"homepage": "https://github.com/bloom-housing/ui-components",
|
package/src/forms/Field.tsx
CHANGED
|
@@ -99,18 +99,20 @@ const Field = (props: FieldProps) => {
|
|
|
99
99
|
...inputProps,
|
|
100
100
|
ref:
|
|
101
101
|
props.register &&
|
|
102
|
-
props.register(
|
|
103
|
-
props.validation
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
invalid: (value) => {
|
|
109
|
-
return urlRegex.test(value)
|
|
110
|
-
},
|
|
102
|
+
props.register({
|
|
103
|
+
...props.validation,
|
|
104
|
+
validate: {
|
|
105
|
+
https: (value) => {
|
|
106
|
+
if (!value?.length) return true
|
|
107
|
+
return httpsRegex.test(value)
|
|
111
108
|
},
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
invalid: (value) => {
|
|
110
|
+
if (!value?.length) return true
|
|
111
|
+
return urlRegex.test(value)
|
|
112
|
+
},
|
|
113
|
+
...props.validation?.validate,
|
|
114
|
+
},
|
|
115
|
+
}),
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import { UseFormMethods } from "react-hook-form"
|
|
3
|
-
import {
|
|
4
|
-
t,
|
|
5
|
-
GridSection,
|
|
6
|
-
ViewItem,
|
|
7
|
-
GridCell,
|
|
8
|
-
Field,
|
|
9
|
-
Select,
|
|
10
|
-
resolveObject,
|
|
11
|
-
} from "../../"
|
|
3
|
+
import { t, GridSection, ViewItem, GridCell, Field, Select, resolveObject } from "../../"
|
|
12
4
|
|
|
13
5
|
type FormAddressProps = {
|
|
14
6
|
subtitle: string
|
|
@@ -40,9 +32,13 @@ export const FormAddress = ({
|
|
|
40
32
|
label={t("application.contact.streetAddress")}
|
|
41
33
|
placeholder={t("application.contact.streetAddress")}
|
|
42
34
|
register={register}
|
|
43
|
-
validation={{ required }}
|
|
35
|
+
validation={{ required, maxLength: 64 }}
|
|
44
36
|
error={!!resolveObject(`${dataKey}.street`, errors)}
|
|
45
|
-
errorMessage={
|
|
37
|
+
errorMessage={
|
|
38
|
+
resolveObject(`${dataKey}.street`, errors)?.type === "maxLength"
|
|
39
|
+
? t("errors.maxLength")
|
|
40
|
+
: t("errors.streetError")
|
|
41
|
+
}
|
|
46
42
|
readerOnly
|
|
47
43
|
/>
|
|
48
44
|
</ViewItem>
|
|
@@ -56,6 +52,9 @@ export const FormAddress = ({
|
|
|
56
52
|
placeholder={t("application.contact.apt")}
|
|
57
53
|
register={register}
|
|
58
54
|
readerOnly
|
|
55
|
+
error={!!resolveObject(`${dataKey}.street2`, errors)}
|
|
56
|
+
validation={{ maxLength: 64 }}
|
|
57
|
+
errorMessage={t("errors.maxLength")}
|
|
59
58
|
/>
|
|
60
59
|
</ViewItem>
|
|
61
60
|
</GridCell>
|
|
@@ -68,9 +67,13 @@ export const FormAddress = ({
|
|
|
68
67
|
label={t("application.contact.cityName")}
|
|
69
68
|
placeholder={t("application.contact.cityName")}
|
|
70
69
|
register={register}
|
|
71
|
-
validation={{ required }}
|
|
70
|
+
validation={{ required, maxLength: 64 }}
|
|
72
71
|
error={!!resolveObject(`${dataKey}.city`, errors)}
|
|
73
|
-
errorMessage={
|
|
72
|
+
errorMessage={
|
|
73
|
+
resolveObject(`${dataKey}.city`, errors)?.type === "maxLength"
|
|
74
|
+
? t("errors.maxLength")
|
|
75
|
+
: t("errors.cityError")
|
|
76
|
+
}
|
|
74
77
|
readerOnly
|
|
75
78
|
/>
|
|
76
79
|
</ViewItem>
|
|
@@ -100,9 +103,13 @@ export const FormAddress = ({
|
|
|
100
103
|
label={t("application.contact.zip")}
|
|
101
104
|
placeholder={t("application.contact.zipCode")}
|
|
102
105
|
register={register}
|
|
103
|
-
validation={{ required }}
|
|
106
|
+
validation={{ required, maxLength: 64 }}
|
|
104
107
|
error={!!resolveObject(`${dataKey}.zipCode`, errors)}
|
|
105
|
-
errorMessage={
|
|
108
|
+
errorMessage={
|
|
109
|
+
resolveObject(`${dataKey}.zipCode`, errors)?.type === "maxLength"
|
|
110
|
+
? t("errors.maxLength")
|
|
111
|
+
: t("errors.zipCodeError")
|
|
112
|
+
}
|
|
106
113
|
readerOnly
|
|
107
114
|
/>
|
|
108
115
|
</ViewItem>
|