@thecb/components 8.4.11-beta.1 → 8.4.11-beta.10

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": "8.4.11-beta.1",
3
+ "version": "8.4.11-beta.10",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -92,6 +92,7 @@ const Alert = ({
92
92
  borderSize={noBorder ? "0px" : "1px"}
93
93
  boxShadow={enableBoxShadow ? generateShadows()?.inset?.base : ""}
94
94
  extraStyles={extraStyles}
95
+ role="alert"
95
96
  >
96
97
  {maxContentWidth ? (
97
98
  <Center maxWidth={maxContentWidth}>{content}</Center>
@@ -126,7 +126,7 @@ const Checkbox = ({
126
126
  onChange={onChange}
127
127
  tabIndex="-1"
128
128
  aria-invalid={error}
129
- aria-describedby={error ? `${name}-error-message` : ""}
129
+ aria-describedby={name}
130
130
  />
131
131
  <StyledCheckbox
132
132
  error={error}
@@ -21,7 +21,6 @@ const CountryDropdown = ({
21
21
  showErrors={showErrors}
22
22
  onChange={onChange}
23
23
  autocompleteValue="country-name"
24
- autoComplete="country-name"
25
24
  {...rest}
26
25
  />
27
26
  );
@@ -26,6 +26,8 @@ const story = page({
26
26
  const CountryFormWrapper = ({ fields, actions }) => (
27
27
  <Box minHeight="300px">
28
28
  <CountryDropdown
29
+ aria-label="Country"
30
+ labelTextWhenNoError="Country"
29
31
  errorMessages={errorMessages}
30
32
  options={options}
31
33
  field={fields.country}
@@ -288,16 +288,12 @@ const Dropdown = ({
288
288
  as="input"
289
289
  aria-multiline="false"
290
290
  aria-autocomplete="list"
291
- aria-controls={`${ariaLabelledby}_listbox`}
292
- aria-activedescendant="focused_option"
293
- aria-owns={`${ariaLabelledby}_listbox`}
291
+ // aria-activedescendant="focused_option"
292
+ // aria-owns={`${ariaLabelledby}_listbox`}
293
+ // aria-controls={`${ariaLabelledby}_listbox`}
294
294
  aria-haspopup="listbox"
295
295
  aria-labelledby={ariaLabelledby}
296
296
  aria-describedby={ariaDescribedby}
297
- aria-expanded={isOpen}
298
- aria-live="assertive"
299
- role="combobox"
300
- disabled={disabled}
301
297
  autoComplete={autocompleteValue}
302
298
  background={isOpen ? themeValues.hoverColor : WHITE}
303
299
  borderRadius="2px"
@@ -319,6 +315,7 @@ const Dropdown = ({
319
315
  minHeight="48px"
320
316
  minWidth="100%"
321
317
  name={autocompleteValue}
318
+ // aria-expanded={isOpen}
322
319
  onChange={e => {
323
320
  // support autofill and copy/paste
324
321
  if (e.target.value !== inputValue) {
@@ -367,7 +364,7 @@ const Dropdown = ({
367
364
  }
368
365
  key={choice.value}
369
366
  ref={optionRefs.current[i]}
370
- tabIndex={0}
367
+ tabIndex={-1}
371
368
  onClick={e => handleItemSelection(e, choice, i)}
372
369
  onKeyDown={e => {
373
370
  if (e.keyCode === 13) {
@@ -393,14 +390,14 @@ const Dropdown = ({
393
390
  : MINESHAFT_GREY
394
391
  }
395
392
  extraStyles={`padding-left: 16px;
396
- cursor: ${
397
- disabledValues.includes(choice.value)
398
- ? "default"
399
- : "pointer"
400
- };
401
- white-space: nowrap;
402
- overflow: hidden;
403
- text-overflow: ellipsis;`}
393
+ cursor: ${
394
+ disabledValues.includes(choice.value)
395
+ ? "default"
396
+ : "pointer"
397
+ };
398
+ white-space: nowrap;
399
+ overflow: hidden;
400
+ text-overflow: ellipsis;`}
404
401
  >
405
402
  {choice.text}
406
403
  </Text>
@@ -198,10 +198,7 @@ const FormInput = ({
198
198
  {formatter ? (
199
199
  <FormattedInputField
200
200
  aria-labelledby={createIdFromString(labelTextWhenNoError)}
201
- aria-describedby={createIdFromString(
202
- labelTextWhenNoError,
203
- "error message"
204
- )}
201
+ aria-describedby={createIdFromString(labelTextWhenNoError)}
205
202
  aria-invalid={
206
203
  (field.dirty && field.hasErrors) ||
207
204
  (field.hasErrors && showErrors)
@@ -218,16 +215,13 @@ const FormInput = ({
218
215
  themeValues={themeValues}
219
216
  $customHeight={customHeight}
220
217
  $extraStyles={extraStyles}
221
- autoComplete={autocomplete}
218
+ autocomplete={autocomplete}
222
219
  {...props}
223
220
  />
224
221
  ) : (
225
222
  <InputField
226
223
  aria-labelledby={createIdFromString(labelTextWhenNoError)}
227
- aria-describedby={createIdFromString(
228
- labelTextWhenNoError,
229
- "error message"
230
- )}
224
+ aria-describedby={createIdFromString(labelTextWhenNoError)}
231
225
  aria-invalid={
232
226
  (field.dirty && field.hasErrors) ||
233
227
  (field.hasErrors && showErrors)
@@ -244,7 +238,7 @@ const FormInput = ({
244
238
  background={background}
245
239
  $customHeight={customHeight}
246
240
  $extraStyles={extraStyles}
247
- autoComplete={autocomplete}
241
+ autocomplete={autocomplete}
248
242
  {...props}
249
243
  />
250
244
  )}
@@ -22,8 +22,7 @@ const FormSelect = ({
22
22
  themeValues,
23
23
  hasTitles = false,
24
24
  autocompleteValue, // browser autofill value, like country-name or address-level1 for state
25
- smoothScroll = true, // whether the browser should animate scroll to selected item on first open
26
- ...rest
25
+ smoothScroll = true // whether the browser should animate scroll to selected item on first open
27
26
  }) => {
28
27
  const [open, setOpen] = useState(false);
29
28
  const dropdownRef = useRef(null);
@@ -42,7 +41,7 @@ const FormSelect = ({
42
41
  });
43
42
 
44
43
  return (
45
- <SelectContainer ref={dropdownRef} disabled={disabled} {...rest}>
44
+ <SelectContainer ref={dropdownRef} disabled={disabled}>
46
45
  <Box padding="0" minWidth="100%">
47
46
  <Cluster justify="space-between" align="center">
48
47
  <Text
@@ -62,11 +61,8 @@ const FormSelect = ({
62
61
  </Cluster>
63
62
  </Box>
64
63
  <Dropdown
65
- aria-labelledBy={createIdFromString(labelTextWhenNoError)}
66
- aria-describedBy={createIdFromString(
67
- labelTextWhenNoError,
68
- "error message"
69
- )}
64
+ ariaLabelledby={createIdFromString(labelTextWhenNoError)}
65
+ ariaDescribedby={createIdFromString(labelTextWhenNoError)}
70
66
  maxHeight={dropdownMaxHeight}
71
67
  hasTitles={hasTitles}
72
68
  placeholder={options[0] ? options[0].text : ""}
@@ -81,12 +77,12 @@ const FormSelect = ({
81
77
  onChange ? value => onChange(value) : value => fieldActions.set(value)
82
78
  }
83
79
  onClick={() => setOpen(!open)}
84
- aria-disabled={disabled}
80
+ disabled={disabled}
85
81
  autocompleteValue={autocompleteValue}
86
82
  smoothScroll={smoothScroll}
87
83
  required={options.required}
88
84
  />
89
- <Stack direction="row" justify="space-between" aria-live="assertive">
85
+ <Stack direction="row" justify="space-between" role="alert">
90
86
  <Text
91
87
  color={ERROR_COLOR}
92
88
  variant="pXS"
@@ -97,7 +93,6 @@ const FormSelect = ({
97
93
  text-transform: uppercase;
98
94
  }`}
99
95
  id={createIdFromString(labelTextWhenNoError, "error message")}
100
- aria-live="assertive"
101
96
  >
102
97
  {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors)
103
98
  ? errorMessages[field.errors[0]]
@@ -51,7 +51,6 @@ const AddressForm = ({
51
51
  <CountryDropdown
52
52
  labelTextWhenNoError="Country"
53
53
  errorMessages={countryErrorMessages}
54
- aria-label="country"
55
54
  field={fields.country}
56
55
  onChange={value => {
57
56
  actions.fields.country.set(value);
@@ -65,17 +64,18 @@ const AddressForm = ({
65
64
  }
66
65
  }}
67
66
  showErrors={showErrors}
67
+ aria-label="Country"
68
68
  />
69
69
  <FormInput
70
70
  labelTextWhenNoError="Address"
71
71
  errorMessages={street1ErrorMessages}
72
72
  required={true}
73
- aria-label="address line 1"
74
73
  field={fields.street1}
75
74
  fieldActions={actions.fields.street1}
76
75
  showErrors={showErrors}
77
76
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
78
- autoComplete="address-line1"
77
+ autocomplete="address-line1"
78
+ aria-label="Address Line 1"
79
79
  />
80
80
  <FormInput
81
81
  labelTextWhenNoError="Apt, Suite, Unit, Floor, etc. (Optional)"
@@ -83,18 +83,19 @@ const AddressForm = ({
83
83
  fieldActions={actions.fields.street2}
84
84
  showErrors={showErrors}
85
85
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
86
- autoComplete="address-line2"
86
+ autocomplete="address-line2"
87
+ aria-label="Address Line 2"
87
88
  />
88
89
  <FormInput
89
90
  labelTextWhenNoError="City"
90
- aria-label="city"
91
91
  required={true}
92
92
  errorMessages={cityErrorMessages}
93
93
  field={fields.city}
94
94
  fieldActions={actions.fields.city}
95
95
  showErrors={showErrors}
96
96
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
97
- autoComplete="address-level2"
97
+ autocomplete="city"
98
+ aria-label="City"
98
99
  />
99
100
  <StateProvinceDropdown
100
101
  labelTextWhenNoError={isUS ? "State" : "State or Province"}
@@ -104,7 +105,6 @@ const AddressForm = ({
104
105
  fieldActions={actions.fields.stateProvince}
105
106
  showErrors={showErrors}
106
107
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
107
- autoComplete="address-level1"
108
108
  aria-label={isUS ? "State" : "State or Province"}
109
109
  required={true}
110
110
  />
@@ -117,12 +117,14 @@ const AddressForm = ({
117
117
  fieldActions={actions.fields.zip}
118
118
  showErrors={showErrors}
119
119
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
120
- autoComplete="postal-code"
120
+ aria-label="zip code"
121
+ autocomplete="postal-code"
122
+ required={true}
121
123
  />
122
124
  {showWalletCheckbox && (
123
125
  <Checkbox
124
126
  name="address checkbox"
125
- title="Save address to wallet"
127
+ title="Save address to Wallet"
126
128
  checked={walletCheckboxMarked}
127
129
  onChange={saveToWallet}
128
130
  />