@bloom-housing/ui-components 3.0.1-alpha.3 → 3.0.1-alpha.33

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.
@@ -1,4 +1,5 @@
1
1
  import "@testing-library/jest-dom/extend-expect"
2
+ import { configure } from "@testing-library/dom"
2
3
 
3
4
  import { addTranslation } from "../src/helpers/translator"
4
5
  import general from "../src/locales/general.json"
@@ -18,3 +19,5 @@ window.matchMedia = jest.fn().mockImplementation((query) => {
18
19
  })
19
20
 
20
21
  addTranslation(general)
22
+
23
+ configure({ testIdAttribute: "data-test-id" })
package/CHANGELOG.md CHANGED
@@ -3,6 +3,285 @@
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
+ ## [3.0.1-alpha.33](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.32...@bloom-housing/ui-components@3.0.1-alpha.33) (2021-12-07)
7
+
8
+
9
+ ### Features
10
+
11
+ * overrides fallback to english, tagalog support ([#2262](https://github.com/bloom-housing/bloom/issues/2262)) ([679ab9b](https://github.com/bloom-housing/bloom/commit/679ab9b1816d5934f48f02ca5f5696952ef88ae7))
12
+
13
+
14
+
15
+
16
+
17
+ ## [3.0.1-alpha.32](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.31...@bloom-housing/ui-components@3.0.1-alpha.32) (2021-12-07)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Fix modal styles on mobile ([#2280](https://github.com/bloom-housing/bloom/issues/2280)) ([95f45e5](https://github.com/bloom-housing/bloom/commit/95f45e5a6d2c38c512f59d8cb35847cab59dc8bb)), closes [#2253](https://github.com/bloom-housing/bloom/issues/2253)
23
+
24
+
25
+
26
+
27
+
28
+ ## [3.0.1-alpha.31](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.30...@bloom-housing/ui-components@3.0.1-alpha.31) (2021-12-06)
29
+
30
+ **Note:** Version bump only for package @bloom-housing/ui-components
31
+
32
+
33
+
34
+
35
+
36
+ ## [3.0.1-alpha.30](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.29...@bloom-housing/ui-components@3.0.1-alpha.30) (2021-12-03)
37
+
38
+ **Note:** Version bump only for package @bloom-housing/ui-components
39
+
40
+
41
+
42
+
43
+
44
+ ## [3.0.1-alpha.29](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.28...@bloom-housing/ui-components@3.0.1-alpha.29) (2021-12-03)
45
+
46
+ **Note:** Version bump only for package @bloom-housing/ui-components
47
+
48
+
49
+
50
+
51
+
52
+ ## [3.0.1-alpha.28](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.27...@bloom-housing/ui-components@3.0.1-alpha.28) (2021-12-03)
53
+
54
+ **Note:** Version bump only for package @bloom-housing/ui-components
55
+
56
+
57
+
58
+
59
+
60
+ ## [3.0.1-alpha.27](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.26...@bloom-housing/ui-components@3.0.1-alpha.27) (2021-12-01)
61
+
62
+ **Note:** Version bump only for package @bloom-housing/ui-components
63
+
64
+
65
+
66
+
67
+
68
+ ## [3.0.1-alpha.26](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.25...@bloom-housing/ui-components@3.0.1-alpha.26) (2021-12-01)
69
+
70
+ **Note:** Version bump only for package @bloom-housing/ui-components
71
+
72
+
73
+
74
+
75
+
76
+ ## [3.0.1-alpha.25](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.24...@bloom-housing/ui-components@3.0.1-alpha.25) (2021-11-30)
77
+
78
+ **Note:** Version bump only for package @bloom-housing/ui-components
79
+
80
+
81
+
82
+
83
+
84
+ ## [3.0.1-alpha.24](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.23...@bloom-housing/ui-components@3.0.1-alpha.24) (2021-11-29)
85
+
86
+
87
+ ### Bug Fixes
88
+
89
+ * guard against 0 output ([0ea9012](https://github.com/bloom-housing/bloom/commit/0ea9012fdac02fb1cb4357abec2ec69633902654))
90
+ * remove bold style from current waitlist size ([2e2f414](https://github.com/bloom-housing/bloom/commit/2e2f4141e62c8544c0828b29de0b99bb97abb201))
91
+ * show waitlist values even if they're zero ([6a35e67](https://github.com/bloom-housing/bloom/commit/6a35e679f142105e40719e89bda3d957e3200e1d))
92
+ * simpler conditionals ([f3e588d](https://github.com/bloom-housing/bloom/commit/f3e588d5e6dd0a39d1aed99ef6eba0054540ed14))
93
+ * waitlist: handle both null and undefined ([90fd369](https://github.com/bloom-housing/bloom/commit/90fd369b471c7f9baa0a1d58f452159449fe6fcf))
94
+
95
+
96
+ ### Features
97
+
98
+ * simplify Waitlist component and use more flexible schema ([96df149](https://github.com/bloom-housing/bloom/commit/96df1496f377ddfa6f0e6c016c84954b6a43ff4a))
99
+
100
+
101
+
102
+
103
+
104
+ ## [3.0.1-alpha.23](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.22...@bloom-housing/ui-components@3.0.1-alpha.23) (2021-11-29)
105
+
106
+ **Note:** Version bump only for package @bloom-housing/ui-components
107
+
108
+
109
+
110
+
111
+
112
+ ## [3.0.1-alpha.22](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.21...@bloom-housing/ui-components@3.0.1-alpha.22) (2021-11-23)
113
+
114
+
115
+ ### Bug Fixes
116
+
117
+ * remove alameda reference in demographics ([#2209](https://github.com/bloom-housing/bloom/issues/2209)) ([7d5991c](https://github.com/bloom-housing/bloom/commit/7d5991cbf6dbe0b61f2b14d265e87ce3687f743d))
118
+
119
+
120
+
121
+
122
+
123
+ ## [3.0.1-alpha.21](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.20...@bloom-housing/ui-components@3.0.1-alpha.21) (2021-11-23)
124
+
125
+
126
+ ### Bug Fixes
127
+
128
+ * change the yes/no radio text to be more descriptive ([#2208](https://github.com/bloom-housing/bloom/issues/2208)) ([0c46054](https://github.com/bloom-housing/bloom/commit/0c46054574535523d6f217bb0677bbe732b8945f))
129
+
130
+
131
+
132
+
133
+
134
+ ## [3.0.1-alpha.20](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.19...@bloom-housing/ui-components@3.0.1-alpha.20) (2021-11-23)
135
+
136
+
137
+ ### Bug Fixes
138
+
139
+ * add ariaLabel prop to Button component ([509ddc8](https://github.com/bloom-housing/bloom/commit/509ddc898ba44c05e26f8ed8c777f1ba456eeee5))
140
+
141
+
142
+
143
+
144
+
145
+ ## [3.0.1-alpha.19](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.18...@bloom-housing/ui-components@3.0.1-alpha.19) (2021-11-23)
146
+
147
+
148
+ ### Bug Fixes
149
+
150
+ * add ariaHidden to Icon component ([c7bb86a](https://github.com/bloom-housing/bloom/commit/c7bb86aec6fd5ad386c7ca50087d0113b14503be))
151
+
152
+
153
+
154
+
155
+
156
+ ## [3.0.1-alpha.18](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.17...@bloom-housing/ui-components@3.0.1-alpha.18) (2021-11-23)
157
+
158
+
159
+ ### Features
160
+
161
+ * new demographics sub-race questions ([#2109](https://github.com/bloom-housing/bloom/issues/2109)) ([9ab8926](https://github.com/bloom-housing/bloom/commit/9ab892694c1ad2fa8890b411b3b32af68ade1fc3))
162
+
163
+
164
+
165
+
166
+
167
+ ## [3.0.1-alpha.17](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.16...@bloom-housing/ui-components@3.0.1-alpha.17) (2021-11-22)
168
+
169
+ **Note:** Version bump only for package @bloom-housing/ui-components
170
+
171
+
172
+
173
+
174
+
175
+ ## [3.0.1-alpha.16](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.15...@bloom-housing/ui-components@3.0.1-alpha.16) (2021-11-22)
176
+
177
+ **Note:** Version bump only for package @bloom-housing/ui-components
178
+
179
+
180
+
181
+
182
+
183
+ ## [3.0.1-alpha.15](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.14...@bloom-housing/ui-components@3.0.1-alpha.15) (2021-11-16)
184
+
185
+ **Note:** Version bump only for package @bloom-housing/ui-components
186
+
187
+
188
+
189
+
190
+
191
+ ## [3.0.1-alpha.14](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.13...@bloom-housing/ui-components@3.0.1-alpha.14) (2021-11-16)
192
+
193
+
194
+ ### Bug Fixes
195
+
196
+ * preference cleanup for avance ([d0aebbc](https://github.com/bloom-housing/bloom/commit/d0aebbcd334dfffc4a7a1a39e9964c90155c5bfb))
197
+
198
+
199
+
200
+
201
+
202
+ ## [3.0.1-alpha.13](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.12...@bloom-housing/ui-components@3.0.1-alpha.13) (2021-11-16)
203
+
204
+ **Note:** Version bump only for package @bloom-housing/ui-components
205
+
206
+
207
+
208
+
209
+
210
+ ## [3.0.1-alpha.12](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.11...@bloom-housing/ui-components@3.0.1-alpha.12) (2021-11-16)
211
+
212
+ **Note:** Version bump only for package @bloom-housing/ui-components
213
+
214
+
215
+
216
+
217
+
218
+ ## [3.0.1-alpha.11](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.10...@bloom-housing/ui-components@3.0.1-alpha.11) (2021-11-15)
219
+
220
+ **Note:** Version bump only for package @bloom-housing/ui-components
221
+
222
+
223
+
224
+
225
+
226
+ ## [3.0.1-alpha.10](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.9...@bloom-housing/ui-components@3.0.1-alpha.10) (2021-11-12)
227
+
228
+
229
+ ### Features
230
+
231
+ * refactor and add public site application flow cypress tests ([#2118](https://github.com/bloom-housing/bloom/issues/2118)) ([9ec0e8d](https://github.com/bloom-housing/bloom/commit/9ec0e8d05f9570773110754e7fdaf49254d1eab8))
232
+
233
+
234
+
235
+
236
+
237
+ ## [3.0.1-alpha.9](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.8...@bloom-housing/ui-components@3.0.1-alpha.9) (2021-11-12)
238
+
239
+ **Note:** Version bump only for package @bloom-housing/ui-components
240
+
241
+
242
+
243
+
244
+
245
+ ## [3.0.1-alpha.8](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.7...@bloom-housing/ui-components@3.0.1-alpha.8) (2021-11-09)
246
+
247
+ **Note:** Version bump only for package @bloom-housing/ui-components
248
+
249
+
250
+
251
+
252
+
253
+ ## [3.0.1-alpha.7](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.6...@bloom-housing/ui-components@3.0.1-alpha.7) (2021-11-09)
254
+
255
+ **Note:** Version bump only for package @bloom-housing/ui-components
256
+
257
+
258
+
259
+
260
+
261
+ ## [3.0.1-alpha.6](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.5...@bloom-housing/ui-components@3.0.1-alpha.6) (2021-11-09)
262
+
263
+ **Note:** Version bump only for package @bloom-housing/ui-components
264
+
265
+
266
+
267
+
268
+
269
+ ## [3.0.1-alpha.5](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.4...@bloom-housing/ui-components@3.0.1-alpha.5) (2021-11-09)
270
+
271
+ **Note:** Version bump only for package @bloom-housing/ui-components
272
+
273
+
274
+
275
+
276
+
277
+ ## [3.0.1-alpha.4](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.3...@bloom-housing/ui-components@3.0.1-alpha.4) (2021-11-09)
278
+
279
+ **Note:** Version bump only for package @bloom-housing/ui-components
280
+
281
+
282
+
283
+
284
+
6
285
  ## [3.0.1-alpha.3](https://github.com/bloom-housing/bloom/compare/@bloom-housing/ui-components@3.0.1-alpha.2...@bloom-housing/ui-components@3.0.1-alpha.3) (2021-11-08)
7
286
 
8
287
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloom-housing/ui-components",
3
- "version": "3.0.1-alpha.3",
3
+ "version": "3.0.1-alpha.33",
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",
@@ -69,7 +69,7 @@
69
69
  "webpack": "^4.44.2"
70
70
  },
71
71
  "dependencies": {
72
- "@bloom-housing/backend-core": "^3.0.1-alpha.3",
72
+ "@bloom-housing/backend-core": "^3.0.1-alpha.33",
73
73
  "@mapbox/mapbox-sdk": "^0.13.0",
74
74
  "@types/body-scroll-lock": "^2.6.1",
75
75
  "@types/jwt-decode": "^2.2.1",
@@ -80,7 +80,7 @@
80
80
  "@types/react-dom": "^16.9.5",
81
81
  "@types/react-text-mask": "^5.4.6",
82
82
  "@types/react-transition-group": "^4.4.0",
83
- "axios": "^0.21.1",
83
+ "axios": "0.21.1",
84
84
  "body-scroll-lock": "^3.1.5",
85
85
  "jwt-decode": "^2.2.0",
86
86
  "markdown-to-jsx": "^6.11.4",
@@ -100,5 +100,5 @@
100
100
  "tailwindcss": "2.2.10",
101
101
  "typesafe-actions": "^5.1.0"
102
102
  },
103
- "gitHead": "e0fcb37b598e3d6bcd9916b70d7d578322c6196d"
103
+ "gitHead": "4d1181baccd2a4b19765420e55a31593639fdb38"
104
104
  }
@@ -19,6 +19,7 @@ export interface ButtonProps extends AppearanceProps {
19
19
  className?: string
20
20
  disabled?: boolean
21
21
  loading?: boolean
22
+ ariaLabel?: string
22
23
  }
23
24
 
24
25
  export const buttonClassesForProps = (props: Omit<ButtonProps, "onClick">) => {
@@ -67,11 +68,13 @@ const Button = (props: ButtonProps) => {
67
68
 
68
69
  return (
69
70
  <button
71
+ {...props}
70
72
  id={props.id}
71
73
  type={props.type}
72
74
  className={buttonClasses.join(" ")}
73
75
  onClick={props.onClick}
74
76
  disabled={props.disabled || props.loading}
77
+ aria-label={props.ariaLabel}
75
78
  >
76
79
  {buttonInner(props)}
77
80
  </button>
@@ -6,6 +6,7 @@ import { isExternalLink } from "../helpers/links"
6
6
 
7
7
  export interface LinkButtonProps extends Omit<ButtonProps, "onClick"> {
8
8
  href: string
9
+ dataTestId?: string
9
10
  }
10
11
 
11
12
  const LinkButton = (props: LinkButtonProps) => {
@@ -14,13 +15,17 @@ const LinkButton = (props: LinkButtonProps) => {
14
15
 
15
16
  if (isExternalLink(props.href)) {
16
17
  return (
17
- <a href={props.href} className={buttonClasses.join(" ")}>
18
+ <a href={props.href} className={buttonClasses.join(" ")} data-test-id={props.dataTestId}>
18
19
  {buttonInner(props)}
19
20
  </a>
20
21
  )
21
22
  } else {
22
23
  return (
23
- <LinkComponent href={props.href} className={buttonClasses.join(" ")}>
24
+ <LinkComponent
25
+ href={props.href}
26
+ className={buttonClasses.join(" ")}
27
+ data-test-id={props.dataTestId}
28
+ >
24
29
  {buttonInner(props)}
25
30
  </LinkComponent>
26
31
  )
@@ -7,6 +7,7 @@ interface DashBlockProps {
7
7
  subtitle?: string
8
8
  icon: React.ReactNode
9
9
  children?: React.ReactNode
10
+ dataTestId?: string
10
11
  }
11
12
  const DashBlock = (props: DashBlockProps) => {
12
13
  const { href, title, subtitle, icon, children } = props
@@ -37,6 +38,10 @@ const DashBlock = (props: DashBlockProps) => {
37
38
  </>
38
39
  )
39
40
  }
40
- return <div className="dash-block">{wrapper}</div>
41
+ return (
42
+ <div className="dash-block" data-test-id={props.dataTestId}>
43
+ {wrapper}
44
+ </div>
45
+ )
41
46
  }
42
47
  export { DashBlock as default, DashBlock }
@@ -71,6 +71,7 @@ const DOBField = (props: DOBFieldProps) => {
71
71
  }}
72
72
  inputProps={{ maxLength: 2 }}
73
73
  register={register}
74
+ dataTestId={"dob-field-month"}
74
75
  />
75
76
  <Field
76
77
  name={getFieldName("birthDay")}
@@ -92,6 +93,7 @@ const DOBField = (props: DOBFieldProps) => {
92
93
  }}
93
94
  inputProps={{ maxLength: 2 }}
94
95
  register={register}
96
+ dataTestId={"dob-field-day"}
95
97
  />
96
98
  <Field
97
99
  name={getFieldName("birthYear")}
@@ -115,6 +117,7 @@ const DOBField = (props: DOBFieldProps) => {
115
117
  }}
116
118
  inputProps={{ maxLength: 4 }}
117
119
  register={register}
120
+ dataTestId={"dob-field-year"}
118
121
  />
119
122
  </div>
120
123
 
@@ -29,6 +29,7 @@ export interface FieldProps {
29
29
  describedBy?: string
30
30
  getValues?: UseFormMethods["getValues"]
31
31
  setValue?: UseFormMethods["setValue"]
32
+ dataTestId?: string
32
33
  }
33
34
 
34
35
  const Field = (props: FieldProps) => {
@@ -94,6 +95,7 @@ const Field = (props: FieldProps) => {
94
95
  <div className={controlClasses.join(" ")}>
95
96
  {props.prepend && <span className="prepend">{props.prepend}</span>}
96
97
  <input
98
+ {...props}
97
99
  aria-describedby={props.describedBy ? props.describedBy : `${idOrName}`}
98
100
  aria-invalid={!!props.error || false}
99
101
  className="input"
@@ -107,6 +109,7 @@ const Field = (props: FieldProps) => {
107
109
  onPaste={props.onPaste}
108
110
  onDrop={props.onDrop}
109
111
  onChange={props.onChange}
112
+ data-test-id={props.dataTestId}
110
113
  {...inputProps}
111
114
  />
112
115
  {isRadioOrCheckbox && label}
@@ -1,14 +1,22 @@
1
- import React from "react"
1
+ import React, { useState, useEffect } from "react"
2
+ import { ExpandableContent } from "../actions/ExpandableContent"
2
3
  import { ErrorMessage } from "../notifications/ErrorMessage"
3
4
  import { UseFormMethods } from "react-hook-form"
5
+ import { Field } from "./Field"
6
+ import { t } from "../helpers/translator"
4
7
 
5
8
  interface FieldSingle {
6
9
  id: string
7
10
  label: string
8
11
  value?: string
9
12
  defaultChecked?: boolean
13
+ description?: React.ReactNode
14
+ defaultText?: string
10
15
  note?: string
11
16
  inputProps?: Record<string, unknown>
17
+ subFields?: FieldSingle[]
18
+ type?: string
19
+ additionalText?: boolean
12
20
  }
13
21
 
14
22
  interface FieldGroupProps {
@@ -25,6 +33,7 @@ interface FieldGroupProps {
25
33
  fieldGroupClassName?: string
26
34
  fieldClassName?: string
27
35
  fieldLabelClassName?: string
36
+ dataTestId?: string
28
37
  }
29
38
 
30
39
  const FieldGroup = ({
@@ -41,12 +50,94 @@ const FieldGroup = ({
41
50
  fieldClassName,
42
51
  fieldLabelClassName,
43
52
  groupSubNote,
53
+ dataTestId,
44
54
  }: FieldGroupProps) => {
45
55
  // Always align two-option radio groups side by side
46
56
  if (fields?.length === 2) {
47
57
  fieldGroupClassName = `${fieldGroupClassName} flex`
48
58
  fieldClassName = `${fieldClassName} flex-initial mr-4`
49
59
  }
60
+
61
+ const [checkedInputs, setCheckedInputs] = useState<string[]>([])
62
+
63
+ const subfieldsExist = () => {
64
+ return fields?.filter((field) => field.subFields).length
65
+ }
66
+
67
+ const getIndividualInput = (item: FieldSingle): React.ReactNode => {
68
+ return (
69
+ <div key={item.value}>
70
+ <input
71
+ aria-describedby={`${name}-error`}
72
+ aria-invalid={!!error || false}
73
+ type={type}
74
+ id={item.id}
75
+ defaultValue={item.value || item.id}
76
+ name={subfieldsExist() ? `${name}-${item.value}` : name}
77
+ onClick={(e) => {
78
+ // We cannot reliably target an individual checkbox in a field group since they have the same name, so we keep track on our own
79
+ if (e.currentTarget.checked) {
80
+ setCheckedInputs([...checkedInputs, item.label])
81
+ } else {
82
+ setCheckedInputs(checkedInputs.filter((subset) => item.label !== subset))
83
+ }
84
+ }}
85
+ defaultChecked={item.defaultChecked || false}
86
+ ref={register(validation)}
87
+ {...item.inputProps}
88
+ data-test-id={dataTestId}
89
+ />
90
+ <label htmlFor={item.id} className={`font-semibold ${fieldLabelClassName}`}>
91
+ {item.label}
92
+ </label>
93
+ {item.note && <span className={"field-note font-normal"}>{item.note}</span>}
94
+
95
+ {item.description && (
96
+ <div className="ml-8 -mt-1 mb-5">
97
+ <ExpandableContent>
98
+ <p className="field-note mb-2 -mt-2">{item.description}</p>
99
+ </ExpandableContent>
100
+ </div>
101
+ )}
102
+ </div>
103
+ )
104
+ }
105
+
106
+ const checkSelected = (formFields: FieldSingle[] | undefined, checkedValues: string[]) => {
107
+ formFields?.forEach((field) => {
108
+ if (field.defaultChecked) {
109
+ checkedValues.push(field.label)
110
+ }
111
+ if (field.subFields) {
112
+ checkSelected(field.subFields, checkedValues)
113
+ }
114
+ })
115
+ }
116
+
117
+ useEffect(() => {
118
+ const initialValues: string[] = []
119
+ checkSelected(fields, initialValues)
120
+ setCheckedInputs([...initialValues])
121
+ }, [])
122
+
123
+ const getInputSet = (item: FieldSingle): React.ReactNode => {
124
+ return (
125
+ <div key={item.value}>
126
+ {getIndividualInput(item)}
127
+ {item.additionalText && checkedInputs.indexOf(item.label) >= 0 && (
128
+ <Field
129
+ id={item.id}
130
+ key={`${item.value}-additionalText`}
131
+ name={`${name}-${item.value}`}
132
+ register={register}
133
+ defaultValue={item.defaultText}
134
+ placeholder={t("t.description")}
135
+ className={"mb-4"}
136
+ />
137
+ )}
138
+ </div>
139
+ )
140
+ }
50
141
  return (
51
142
  <>
52
143
  {groupLabel && <label className="field-label--caps">{groupLabel}</label>}
@@ -55,21 +146,14 @@ const FieldGroup = ({
55
146
  <div className={`field ${error && "error"} ${fieldGroupClassName || ""} mb-0`}>
56
147
  {fields?.map((item) => (
57
148
  <div className={`field ${fieldClassName || ""} mb-1`} key={item.id}>
58
- <input
59
- aria-describedby={`${name}-error`}
60
- aria-invalid={!!error || false}
61
- type={type}
62
- id={item.id}
63
- defaultValue={item.value || item.id}
64
- name={name}
65
- defaultChecked={item.defaultChecked || false}
66
- ref={register(validation)}
67
- {...item.inputProps}
68
- />
69
- <label htmlFor={item.id} className={`font-semibold ${fieldLabelClassName}`}>
70
- {item.label}
71
- </label>
72
- {item.note && <span className={"field-note font-normal"}>{item.note}</span>}
149
+ {getInputSet(item)}
150
+ {item.subFields && checkedInputs.indexOf(item.label) >= 0 && (
151
+ <div className={"ml-8"} key={`${item.value}-subfields`}>
152
+ {item.subFields?.map((subItem) => {
153
+ return getInputSet(subItem)
154
+ })}
155
+ </div>
156
+ )}
73
157
  </div>
74
158
  ))}
75
159
  </div>
@@ -20,10 +20,11 @@ const HouseholdMemberForm = (props: HouseholdMemberFormProps) => {
20
20
  {props.memberFirstName} {props.memberLastName}
21
21
  {editMode ? (
22
22
  <button
23
- id="edit-member"
23
+ id={`edit-member-${props.memberFirstName}-${props.memberLastName}`}
24
24
  className="edit-link"
25
25
  onClick={() => props.editMember && props.editMember(props.memberId)}
26
26
  type={"button"}
27
+ data-test-id={"app-household-member-edit-button"}
27
28
  >
28
29
  {t("t.edit")}
29
30
  </button>
@@ -19,6 +19,7 @@ export const PhoneField = (props: {
19
19
  disabled?: boolean
20
20
  required?: boolean
21
21
  mask?: (args: any) => JSX.Element
22
+ dataTestId?: string
22
23
  }) => {
23
24
  const labelClasses = ["label"]
24
25
  if (props.caps) labelClasses.push("field-label--caps")
@@ -55,7 +56,7 @@ export const PhoneField = (props: {
55
56
  return (
56
57
  <div className={"field " + (props.error ? "error" : "")}>
57
58
  {props.label && <label className={labelClasses.join(" ")}>{props.label}</label>}
58
- <div className={props.controlClassName}>
59
+ <div className={props.controlClassName} data-test-id={props.dataTestId}>
59
60
  {props.mask ? (
60
61
  <Controller {...controllerProps} render={props.mask} />
61
62
  ) : (
@@ -27,6 +27,7 @@ interface SelectProps {
27
27
  keyPrefix?: string
28
28
  describedBy?: string
29
29
  inputProps?: Record<string, unknown>
30
+ dataTestId?: string
30
31
  }
31
32
 
32
33
  export const Select = ({
@@ -47,6 +48,7 @@ export const Select = ({
47
48
  inputProps,
48
49
  defaultValue,
49
50
  subNote,
51
+ dataTestId,
50
52
  }: SelectProps) => {
51
53
  return (
52
54
  <div className={`field ${error ? "error" : ""}`}>
@@ -58,8 +60,10 @@ export const Select = ({
58
60
  className="input"
59
61
  id={id || name}
60
62
  name={name}
63
+ data-test-id={dataTestId}
61
64
  aria-describedby={describedBy ? describedBy : `${id}-error`}
62
65
  aria-invalid={!!error || false}
66
+ aria-label={label}
63
67
  ref={register && register(validation)}
64
68
  disabled={disabled}
65
69
  defaultValue={defaultValue ?? ""}
@@ -323,6 +323,7 @@ input[type="number"] {
323
323
  @apply text-tiny;
324
324
  @apply text-gray-700;
325
325
  @apply font-semibold;
326
+ white-space: pre-line;
326
327
  }
327
328
 
328
329
  .error-message {
@@ -37,7 +37,7 @@ const Hero = (props: HeroProps) => {
37
37
  classNames = "centered"
38
38
  }
39
39
  return (
40
- <div className={`hero ${classNames}`} style={styles}>
40
+ <div className={`hero ${classNames}`} style={styles} data-test-id={"hero-component"}>
41
41
  <h1 className={`hero__title ${props.extraLargeTitle ? "lg:text-6.5xl" : ""}`}>
42
42
  {props.title}
43
43
  </h1>