@bloom-housing/ui-components 4.0.1-alpha.45 → 4.0.1-alpha.46
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/CHANGELOG.md +8 -0
- package/package.json +2 -2
- package/src/forms/FieldGroup.tsx +15 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.0.1-alpha.46](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.45...@bloom-housing/ui-components@4.0.1-alpha.46) (2022-02-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @bloom-housing/ui-components
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [4.0.1-alpha.45](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@4.0.1-alpha.44...@bloom-housing/ui-components@4.0.1-alpha.45) (2022-02-07)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @bloom-housing/ui-components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloom-housing/ui-components",
|
|
3
|
-
"version": "4.0.1-alpha.
|
|
3
|
+
"version": "4.0.1-alpha.46",
|
|
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/bloom/tree/master/shared/ui-components",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"tailwindcss": "2.2.10",
|
|
101
101
|
"typesafe-actions": "^5.1.0"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "05adf4166eacf3605b0a2b395119cfb1cef68387"
|
|
104
104
|
}
|
package/src/forms/FieldGroup.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect } from "react"
|
|
1
|
+
import React, { useState, useEffect, useCallback } from "react"
|
|
2
2
|
import { ExpandableContent } from "../actions/ExpandableContent"
|
|
3
3
|
import { ErrorMessage } from "../notifications/ErrorMessage"
|
|
4
4
|
import { UseFormMethods, RegisterOptions } from "react-hook-form"
|
|
@@ -111,22 +111,25 @@ const FieldGroup = ({
|
|
|
111
111
|
)
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
const checkSelected = (
|
|
115
|
-
formFields
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
114
|
+
const checkSelected = useCallback(
|
|
115
|
+
(formFields: FieldSingle[] | undefined, checkedValues: string[]) => {
|
|
116
|
+
formFields?.forEach((field) => {
|
|
117
|
+
if (field.defaultChecked) {
|
|
118
|
+
checkedValues.push(field.label)
|
|
119
|
+
}
|
|
120
|
+
if (field.subFields) {
|
|
121
|
+
checkSelected(field.subFields, checkedValues)
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
},
|
|
125
|
+
[]
|
|
126
|
+
)
|
|
124
127
|
|
|
125
128
|
useEffect(() => {
|
|
126
129
|
const initialValues: string[] = []
|
|
127
130
|
checkSelected(fields, initialValues)
|
|
128
131
|
setCheckedInputs([...initialValues])
|
|
129
|
-
}, [])
|
|
132
|
+
}, [checkSelected, setCheckedInputs, fields])
|
|
130
133
|
|
|
131
134
|
const getInputSet = (item: FieldSingle): React.ReactNode => {
|
|
132
135
|
return (
|