@thecb/components 9.2.4-beta.12 → 9.2.4-beta.13

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": "9.2.4-beta.12",
3
+ "version": "9.2.4-beta.13",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -133,7 +133,8 @@ const Dropdown = ({
133
133
  ariaDescribedby,
134
134
  autocompleteValue, // browser autofill value, like country-name
135
135
  smoothScroll = true,
136
- ariaInvalid = false
136
+ ariaInvalid = false,
137
+ isRequired = false
137
138
  }) => {
138
139
  const [inputValue, setInputValue] = useState("");
139
140
  const [optionsState, setOptionsState] = useState([]);
@@ -356,7 +357,7 @@ const Dropdown = ({
356
357
  }}
357
358
  padding="12px"
358
359
  placeholder={getSelection()}
359
- required={options.required}
360
+ required={options.required || isRequired}
360
361
  role="combobox"
361
362
  themeValues={themeValues}
362
363
  title={hasTitles ? getSelection() : null}
@@ -116,6 +116,7 @@ const FormInput = ({
116
116
  extraStyles,
117
117
  removeFromValue, // regex of characters to remove before setting value
118
118
  dataQa = null,
119
+ isRequired = false,
119
120
  ...props
120
121
  }) => {
121
122
  const [showPassword, setShowPassword] = useState(false);
@@ -221,6 +222,7 @@ const FormInput = ({
221
222
  $extraStyles={extraStyles}
222
223
  data-qa={dataQa || labelTextWhenNoError}
223
224
  autoComplete={autocompleteValue}
225
+ required={isRequired}
224
226
  {...props}
225
227
  />
226
228
  ) : (
@@ -247,6 +249,7 @@ const FormInput = ({
247
249
  $extraStyles={extraStyles}
248
250
  data-qa={dataQa || labelTextWhenNoError}
249
251
  autoComplete={autocompleteValue}
252
+ required={isRequired}
250
253
  {...props}
251
254
  />
252
255
  )}
@@ -24,7 +24,8 @@ const FormSelect = ({
24
24
  autocompleteValue, // browser autofill value, like country-name
25
25
  smoothScroll = true, // whether the browser should animate scroll to selected item on first open
26
26
  dataQa = null,
27
- widthFitOptions = false
27
+ widthFitOptions = false,
28
+ isRequired = false
28
29
  }) => {
29
30
  const [open, setOpen] = useState(false);
30
31
  const dropdownRef = useRef(null);
@@ -94,6 +95,7 @@ const FormSelect = ({
94
95
  disabled={disabled}
95
96
  autocompleteValue={autocompleteValue}
96
97
  smoothScroll={smoothScroll}
98
+ isRequired={isRequired}
97
99
  />
98
100
  <Stack direction="row" justify="space-between">
99
101
  {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
@@ -76,6 +76,7 @@ const PaymentFormACH = ({
76
76
  showErrors={showErrors}
77
77
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
78
78
  autocompleteValue="name"
79
+ isRequired={true}
79
80
  />
80
81
  <FormInput
81
82
  labelTextWhenNoError="Routing number"
@@ -97,6 +98,7 @@ const PaymentFormACH = ({
97
98
  />
98
99
  )}
99
100
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
101
+ isRequired={true}
100
102
  />
101
103
  <FormInput
102
104
  labelTextWhenNoError="Confirm routing number"
@@ -107,6 +109,7 @@ const PaymentFormACH = ({
107
109
  showErrors={showErrors}
108
110
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
109
111
  isNum
112
+ isRequired={true}
110
113
  />
111
114
  <FormInput
112
115
  labelTextWhenNoError="Account number"
@@ -128,6 +131,7 @@ const PaymentFormACH = ({
128
131
  />
129
132
  )}
130
133
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
134
+ isRequired={true}
131
135
  />
132
136
  <FormInput
133
137
  labelTextWhenNoError="Confirm account number"
@@ -137,6 +141,7 @@ const PaymentFormACH = ({
137
141
  fieldActions={actions.fields.confirmAccountNumber}
138
142
  showErrors={showErrors}
139
143
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
144
+ isRequired={true}
140
145
  isNum
141
146
  />
142
147
  {allowBankAccountType && (
@@ -152,6 +157,7 @@ const PaymentFormACH = ({
152
157
  showErrors={showErrors}
153
158
  errorMessages={accountTypeErrors}
154
159
  field={fields.accountType}
160
+ isRequired={true}
155
161
  />
156
162
  )}
157
163
  {!hideDefaultPayment && (
@@ -121,6 +121,7 @@ const PaymentFormCard = ({
121
121
  showErrors={showErrors}
122
122
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
123
123
  autocompleteValue="cc-name"
124
+ isRequired={true}
124
125
  />
125
126
  <FormInput
126
127
  labelTextWhenNoError="Credit card number"
@@ -133,6 +134,7 @@ const PaymentFormCard = ({
133
134
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
134
135
  isNum
135
136
  autocompleteValue="cc-number"
137
+ isRequired={true}
136
138
  />
137
139
  <FormInputRow
138
140
  breakpoint={isMobile ? "1000rem" : "21rem"}
@@ -150,6 +152,7 @@ const PaymentFormCard = ({
150
152
  isNum
151
153
  removeFromValue={/\//} // removes "/" from browser autofill
152
154
  autocompleteValue="cc-exp"
155
+ isRequired={true}
153
156
  />
154
157
  <FormInput
155
158
  labelTextWhenNoError="CVV"
@@ -166,6 +169,7 @@ const PaymentFormCard = ({
166
169
  }
167
170
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
168
171
  autocompleteValue="cc-csc"
172
+ isRequired={true}
169
173
  />
170
174
  </FormInputRow>
171
175
  {!hideZipCode && (
@@ -184,6 +188,7 @@ const PaymentFormCard = ({
184
188
  showErrors={showErrors}
185
189
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
186
190
  autocompleteValue="billing postal-code"
191
+ isRequired={true}
187
192
  />
188
193
  </Box>
189
194
  )}