@thecb/components 10.8.2-beta.0 → 10.9.0-beta.1

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": "10.8.2-beta.0",
3
+ "version": "10.9.0-beta.1",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
Binary file
@@ -11,7 +11,9 @@ const CountryDropdown = ({
11
11
  showErrors,
12
12
  onChange,
13
13
  isRequired = false,
14
- dataQa = null
14
+ dataQa = null,
15
+ htmlFor = null,
16
+ inputId = null
15
17
  }) => (
16
18
  <FormSelect
17
19
  options={options}
@@ -23,6 +25,8 @@ const CountryDropdown = ({
23
25
  showErrors={showErrors}
24
26
  onChange={onChange}
25
27
  autocompleteValue="country-name"
28
+ htmlFor={htmlFor}
29
+ inputId={inputId}
26
30
  isRequired={isRequired}
27
31
  />
28
32
  );
@@ -135,7 +135,8 @@ const Dropdown = ({
135
135
  autocompleteValue, // browser autofill value, like country-name
136
136
  smoothScroll = true,
137
137
  ariaInvalid = false,
138
- isRequired = false
138
+ isRequired = false,
139
+ inputId = false
139
140
  }) => {
140
141
  const [inputValue, setInputValue] = useState("");
141
142
  const [optionsState, setOptionsState] = useState([]);
@@ -329,6 +330,7 @@ const Dropdown = ({
329
330
  dataQa={`${ariaLabelledby}-dropdown`}
330
331
  >
331
332
  <Box
333
+ id={inputId}
332
334
  as="input"
333
335
  autoComplete={autocompleteValue}
334
336
  aria-controls={`${ariaLabelledby}_listbox`}
@@ -117,6 +117,8 @@ const FormInput = ({
117
117
  removeFromValue, // regex of characters to remove before setting value
118
118
  dataQa = null,
119
119
  isRequired = false,
120
+ htmlFor = null,
121
+ inputId = null,
120
122
  ...props
121
123
  }) => {
122
124
  const [showPassword, setShowPassword] = useState(false);
@@ -154,6 +156,7 @@ const FormInput = ({
154
156
  text-transform: uppercase;
155
157
  }`}
156
158
  id={createIdFromString(labelTextWhenNoError)}
159
+ htmlFor={htmlFor}
157
160
  >
158
161
  {labelTextWhenNoError}
159
162
  </Text>
@@ -173,6 +176,7 @@ const FormInput = ({
173
176
  text-transform: uppercase;
174
177
  }`}
175
178
  id={createIdFromString(labelTextWhenNoError)}
179
+ htmlFor={htmlFor}
176
180
  >
177
181
  {labelTextWhenNoError}
178
182
  </Text>
@@ -204,6 +208,7 @@ const FormInput = ({
204
208
  <Box padding="0">
205
209
  {formatter ? (
206
210
  <FormattedInputField
211
+ id={inputId || props?.id}
207
212
  aria-labelledby={createIdFromString(labelTextWhenNoError)}
208
213
  aria-describedby={createIdFromString(
209
214
  labelTextWhenNoError,
@@ -241,6 +246,7 @@ const FormInput = ({
241
246
  />
242
247
  ) : (
243
248
  <InputField
249
+ id={inputId || props?.id}
244
250
  aria-labelledby={createIdFromString(labelTextWhenNoError)}
245
251
  aria-describedby={createIdFromString(
246
252
  labelTextWhenNoError,
@@ -25,7 +25,9 @@ const FormSelect = ({
25
25
  smoothScroll = true, // whether the browser should animate scroll to selected item on first open
26
26
  dataQa = null,
27
27
  widthFitOptions = false,
28
- isRequired = false
28
+ isRequired = false,
29
+ htmlFor = null,
30
+ inputId = null
29
31
  }) => {
30
32
  const [open, setOpen] = useState(false);
31
33
  const dropdownRef = useRef(null);
@@ -63,12 +65,14 @@ const FormSelect = ({
63
65
  text-transform: uppercase;
64
66
  }`}
65
67
  id={createIdFromString(labelTextWhenNoError)}
68
+ htmlFor={htmlFor}
66
69
  >
67
70
  {labelTextWhenNoError}
68
71
  </Text>
69
72
  </Cluster>
70
73
  </Box>
71
74
  <Dropdown
75
+ inputId={inputId}
72
76
  ariaLabelledby={createIdFromString(labelTextWhenNoError)}
73
77
  ariaDescribedby={createIdFromString(
74
78
  labelTextWhenNoError,
@@ -24,6 +24,8 @@ export interface FormSelectProps {
24
24
  smoothScroll?: boolean;
25
25
  dataQa?: string | null;
26
26
  widthFitOptions?: boolean;
27
+ htmlFor?: string;
28
+ inputId?: string;
27
29
  }
28
30
 
29
31
  export const FormSelect: React.FC<Expand<FormSelectProps> &
@@ -27,6 +27,7 @@ export interface BoxProps {
27
27
  extraStyles?: string;
28
28
  srOnly?: boolean;
29
29
  dataQa?: string;
30
+ id?: string;
30
31
  }
31
32
 
32
33
  export const Box: React.FC<Expand<BoxProps> &
@@ -46,6 +46,7 @@ const Box = forwardRef(
46
46
  extraStyles,
47
47
  srOnly = false,
48
48
  dataQa,
49
+ id,
49
50
  children,
50
51
  ...rest
51
52
  },
@@ -87,6 +88,7 @@ const Box = forwardRef(
87
88
  onBlur={onBlur}
88
89
  onTouchEnd={onTouchEnd}
89
90
  ref={ref}
91
+ id={id}
90
92
  {...rest}
91
93
  >
92
94
  {children && safeChildren(children, <Fragment />)}
@@ -10,7 +10,9 @@ const FormStateDropdown = ({
10
10
  fieldActions,
11
11
  showErrors,
12
12
  countryCode,
13
- isRequired = false
13
+ isRequired = false,
14
+ htmlFor = null,
15
+ inputId = null
14
16
  }) => {
15
17
  const placeholder =
16
18
  countryCode === "US" ? placeHolderOptionUS : placeHolderOption;
@@ -24,6 +26,8 @@ const FormStateDropdown = ({
24
26
  errorMessages={errorMessages}
25
27
  showErrors={showErrors}
26
28
  autocompleteValue="address-level1"
29
+ htmlFor={htmlFor}
30
+ inputId={inputId}
27
31
  isRequired={isRequired}
28
32
  />
29
33
  );
@@ -10,6 +10,8 @@ export interface TextProps {
10
10
  as?: string;
11
11
  dataQa?: string;
12
12
  variant?: string;
13
+ htmlFor?: string;
14
+ inputId?: string;
13
15
  }
14
16
 
15
17
  export const Text: React.FC<Expand<TextProps> &
@@ -70,6 +70,8 @@ const AddressForm = ({
70
70
  }
71
71
  }}
72
72
  showErrors={showErrors}
73
+ htmlFor="country-name"
74
+ inputId="country-name"
73
75
  dataQa="Country"
74
76
  isRequired={true}
75
77
  />
@@ -81,6 +83,8 @@ const AddressForm = ({
81
83
  showErrors={showErrors}
82
84
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
83
85
  autocompleteValue="address-line1"
86
+ htmlFor="address-line1"
87
+ inputId="address-line1"
84
88
  dataQa="Address"
85
89
  isRequired={true}
86
90
  />
@@ -91,6 +95,8 @@ const AddressForm = ({
91
95
  showErrors={showErrors}
92
96
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
93
97
  autocompleteValue="address-line2"
98
+ htmlFor="address-line2"
99
+ inputId="address-line2"
94
100
  dataQa="Address Line 2"
95
101
  />
96
102
  <FormInput
@@ -101,6 +107,8 @@ const AddressForm = ({
101
107
  showErrors={showErrors}
102
108
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
103
109
  autocompleteValue="address-level2"
110
+ htmlFor="city"
111
+ inputId="city"
104
112
  dataQa="City"
105
113
  isRequired={true}
106
114
  />
@@ -112,6 +120,9 @@ const AddressForm = ({
112
120
  fieldActions={actions.fields.stateProvince}
113
121
  showErrors={showErrors}
114
122
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
123
+ autocompleteValue="address-level1"
124
+ htmlFor="stateOrProvince"
125
+ inputId="stateOrProvince"
115
126
  dataQa="State or Province"
116
127
  isRequired={true}
117
128
  />
@@ -125,6 +136,8 @@ const AddressForm = ({
125
136
  showErrors={showErrors}
126
137
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
127
138
  autocompleteValue="postal-code"
139
+ htmlFor="postal-code"
140
+ inputId="postal-code"
128
141
  dataQa="Zip code"
129
142
  isRequired={true}
130
143
  />
@@ -260,6 +260,7 @@ const PaymentDetails = ({
260
260
  // end partial void section
261
261
  isLoading = false,
262
262
  isError = false,
263
+ multiCartEnabled = false,
263
264
  agencyDisplayName
264
265
  }) => {
265
266
  const [isOpen, setIsOpen] = useState(initiallyOpen);
@@ -291,7 +292,7 @@ const PaymentDetails = ({
291
292
  ));
292
293
  const agencySubheading = (
293
294
  <>
294
- {agencyDisplayName && (
295
+ {multiCartEnabled && agencyDisplayName && (
295
296
  <Cluster
296
297
  justify="space-between"
297
298
  align="center"
@@ -160,6 +160,7 @@ export const paymentDetails = () => (
160
160
  collapsibleOnMobile={boolean("collapsibleOnMobile", false, "props")}
161
161
  initiallyOpen={boolean("initiallyOpen", true, "props")}
162
162
  hideTitle={boolean("hideTitle", false, "props")}
163
+ multiCartEnabled={true}
163
164
  agencyDisplayName="Office of Charitable Trust"
164
165
  />
165
166
  );