@thecb/components 11.1.15-beta.2 → 11.1.15-beta.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "11.1.15-beta.2",
3
+ "version": "11.1.15-beta.4",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -98,6 +98,7 @@ const FormattedInputField = styled(({ showErrors, themeValues, ...props }) => (
98
98
  `;
99
99
 
100
100
  const FormInput = ({
101
+ ariaLabelledBy = undefined,
101
102
  type = "text",
102
103
  labelDisplayOverride = null,
103
104
  labelTextWhenNoError = "",
@@ -217,7 +218,11 @@ const FormInput = ({
217
218
  <Box padding="0">
218
219
  {formatter ? (
219
220
  <FormattedInputField
220
- aria-labelledby={createIdFromString(labelTextWhenNoError)}
221
+ aria-labelledby={
222
+ ariaLabelledBy === undefined
223
+ ? createIdFromString(labelTextWhenNoError)
224
+ : ariaLabelledBy
225
+ }
221
226
  aria-describedby={createIdFromString(
222
227
  labelTextWhenNoError,
223
228
  "error message"
@@ -254,7 +259,11 @@ const FormInput = ({
254
259
  />
255
260
  ) : (
256
261
  <InputField
257
- aria-labelledby={createIdFromString(labelTextWhenNoError)}
262
+ aria-labelledby={
263
+ ariaLabelledBy === undefined
264
+ ? createIdFromString(labelTextWhenNoError)
265
+ : ariaLabelledBy
266
+ }
258
267
  aria-describedby={createIdFromString(
259
268
  labelTextWhenNoError,
260
269
  "error message"
@@ -13,49 +13,59 @@ const PartialAmountField = ({
13
13
  moneyFormat,
14
14
  fieldActions,
15
15
  themeValues
16
- }) => (
17
- <FormInput
18
- labelTextWhenNoError={createIdFromString(
19
- `${lineItem.description}-${lineItem.subDescription}`
20
- )}
21
- labelDisplayOverride={
22
- <Stack childGap="0px">
23
- <Detail
24
- as="label"
25
- for={createIdFromString(
26
- `${lineItem.description}-${lineItem.subDescription}`
27
- )}
28
- variant={themeValues.detailVariant}
29
- weight={themeValues.weightTitle}
30
- >
31
- <Detail as="span" variant={themeValues.detailVariant} weight="400">
32
- {lineItem.subDescription}
33
- </Detail>
34
- <Box padding="0">{lineItem.description}</Box>
35
- </Detail>
36
- </Stack>
37
- }
38
- key={lineItem.id}
39
- field={field}
40
- fieldActions={fieldActions}
41
- showErrors={showErrors}
42
- errorMessages={errorMessages}
43
- style={{ textAlign: "right" }}
44
- placeholder="$0.00"
45
- formatter={moneyFormat}
46
- isNum
47
- decorator={
48
- <Text variant="p">
49
- Amount owed:{" "}
50
- {
51
- <Text variant="p" weight="600">
52
- {displayCurrency(lineItem.amount)}
53
- </Text>
54
- }
55
- </Text>
56
- }
57
- />
58
- );
16
+ }) => {
17
+ const id = createIdFromString(
18
+ `${lineItem.description}-${lineItem.subDescription}`
19
+ );
20
+ return (
21
+ <FormInput
22
+ ariaLabelledBy={null}
23
+ id={id}
24
+ labelTextWhenNoError={id}
25
+ labelDisplayOverride={
26
+ <Stack childGap="0px">
27
+ <Box as="label" for={id} padding="0">
28
+ <Detail
29
+ as="span"
30
+ extraStyles="display: block;"
31
+ variant={themeValues.detailVariant}
32
+ weight={themeValues.weightTitle}
33
+ >
34
+ {lineItem.description}
35
+ </Detail>
36
+ <Detail
37
+ as="span"
38
+ extraStyles="display: block;"
39
+ variant={themeValues.detailVariant}
40
+ weight="400"
41
+ >
42
+ {lineItem.subDescription}
43
+ </Detail>
44
+ </Box>
45
+ </Stack>
46
+ }
47
+ key={lineItem.id}
48
+ field={field}
49
+ fieldActions={fieldActions}
50
+ showErrors={showErrors}
51
+ errorMessages={errorMessages}
52
+ style={{ textAlign: "right" }}
53
+ placeholder="$0.00"
54
+ formatter={moneyFormat}
55
+ isNum
56
+ decorator={
57
+ <Text variant="p">
58
+ Amount owed:{" "}
59
+ {
60
+ <Text variant="p" weight="600">
61
+ {displayCurrency(lineItem.amount)}
62
+ </Text>
63
+ }
64
+ </Text>
65
+ }
66
+ />
67
+ );
68
+ };
59
69
 
60
70
  function arePropsEqual(prevProps, nextProps) {
61
71
  return (