@thecb/components 8.4.11-beta.9 → 8.4.11

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.9",
3
+ "version": "8.4.11",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "typings": "dist/index.d.ts",
@@ -92,7 +92,6 @@ const Alert = ({
92
92
  borderSize={noBorder ? "0px" : "1px"}
93
93
  boxShadow={enableBoxShadow ? generateShadows()?.inset?.base : ""}
94
94
  extraStyles={extraStyles}
95
- role="alert"
96
95
  >
97
96
  {maxContentWidth ? (
98
97
  <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={name}
129
+ aria-describedby={error ? `${name}-error-message` : ""}
130
130
  />
131
131
  <StyledCheckbox
132
132
  error={error}
@@ -9,8 +9,7 @@ const CountryDropdown = ({
9
9
  field,
10
10
  fieldActions,
11
11
  showErrors,
12
- onChange,
13
- ...rest
12
+ onChange
14
13
  }) => (
15
14
  <FormSelect
16
15
  options={options}
@@ -21,7 +20,6 @@ const CountryDropdown = ({
21
20
  showErrors={showErrors}
22
21
  onChange={onChange}
23
22
  autocompleteValue="country-name"
24
- {...rest}
25
23
  />
26
24
  );
27
25
  export default CountryDropdown;
@@ -26,8 +26,6 @@ const story = page({
26
26
  const CountryFormWrapper = ({ fields, actions }) => (
27
27
  <Box minHeight="300px">
28
28
  <CountryDropdown
29
- aria-label="Country"
30
- labelTextWhenNoError="Country"
31
29
  errorMessages={errorMessages}
32
30
  options={options}
33
31
  field={fields.country}
@@ -288,13 +288,14 @@ const Dropdown = ({
288
288
  as="input"
289
289
  aria-multiline="false"
290
290
  aria-autocomplete="list"
291
- // aria-activedescendant="focused_option"
292
- // aria-owns={`${ariaLabelledby}_listbox`}
293
- // aria-controls={`${ariaLabelledby}_listbox`}
291
+ aria-controls={`${ariaLabelledby}_listbox`}
292
+ aria-activedescendant="focused_option"
293
+ aria-owns={`${ariaLabelledby}_listbox`}
294
294
  aria-haspopup="listbox"
295
295
  aria-labelledby={ariaLabelledby}
296
296
  aria-describedby={ariaDescribedby}
297
- autoComplete={autocompleteValue}
297
+ aria-expanded={isOpen}
298
+ autocomplete={autocompleteValue}
298
299
  background={isOpen ? themeValues.hoverColor : WHITE}
299
300
  borderRadius="2px"
300
301
  borderSize="1px"
@@ -315,7 +316,6 @@ const Dropdown = ({
315
316
  minHeight="48px"
316
317
  minWidth="100%"
317
318
  name={autocompleteValue}
318
- // aria-expanded={isOpen}
319
319
  onChange={e => {
320
320
  // support autofill and copy/paste
321
321
  if (e.target.value !== inputValue) {
@@ -325,6 +325,7 @@ const Dropdown = ({
325
325
  }}
326
326
  padding="12px"
327
327
  placeholder={getSelection()}
328
+ role="combobox"
328
329
  themeValues={themeValues}
329
330
  title={hasTitles ? getSelection() : null}
330
331
  type="text"
@@ -390,14 +391,14 @@ const Dropdown = ({
390
391
  : MINESHAFT_GREY
391
392
  }
392
393
  extraStyles={`padding-left: 16px;
393
- cursor: ${
394
- disabledValues.includes(choice.value)
395
- ? "default"
396
- : "pointer"
397
- };
398
- white-space: nowrap;
399
- overflow: hidden;
400
- text-overflow: ellipsis;`}
394
+ cursor: ${
395
+ disabledValues.includes(choice.value)
396
+ ? "default"
397
+ : "pointer"
398
+ };
399
+ white-space: nowrap;
400
+ overflow: hidden;
401
+ text-overflow: ellipsis;`}
401
402
  >
402
403
  {choice.text}
403
404
  </Text>
@@ -127,7 +127,7 @@ const FormInput = ({
127
127
  };
128
128
 
129
129
  return (
130
- <Stack childGap="0.25rem" aria-live="assertive">
130
+ <Stack childGap="0.25rem">
131
131
  <Box padding="0">
132
132
  {helperModal ? (
133
133
  <Cluster justify="space-between" align="center">
@@ -194,11 +194,14 @@ const FormInput = ({
194
194
  </Box>
195
195
  )}
196
196
  </Box>
197
- <Box padding="0" aria-live="assertive">
197
+ <Box padding="0">
198
198
  {formatter ? (
199
199
  <FormattedInputField
200
200
  aria-labelledby={createIdFromString(labelTextWhenNoError)}
201
- aria-describedby={createIdFromString(labelTextWhenNoError)}
201
+ aria-describedby={createIdFromString(
202
+ labelTextWhenNoError,
203
+ "error message"
204
+ )}
202
205
  aria-invalid={
203
206
  (field.dirty && field.hasErrors) ||
204
207
  (field.hasErrors && showErrors)
@@ -215,13 +218,16 @@ const FormInput = ({
215
218
  themeValues={themeValues}
216
219
  $customHeight={customHeight}
217
220
  $extraStyles={extraStyles}
218
- autocomplete={autocomplete}
221
+ autoComplete={autocomplete}
219
222
  {...props}
220
223
  />
221
224
  ) : (
222
225
  <InputField
223
226
  aria-labelledby={createIdFromString(labelTextWhenNoError)}
224
- aria-describedby={createIdFromString(labelTextWhenNoError)}
227
+ aria-describedby={createIdFromString(
228
+ labelTextWhenNoError,
229
+ "error message"
230
+ )}
225
231
  aria-invalid={
226
232
  (field.dirty && field.hasErrors) ||
227
233
  (field.hasErrors && showErrors)
@@ -238,12 +244,12 @@ const FormInput = ({
238
244
  background={background}
239
245
  $customHeight={customHeight}
240
246
  $extraStyles={extraStyles}
241
- autocomplete={autocomplete}
247
+ autoComplete={autocomplete}
242
248
  {...props}
243
249
  />
244
250
  )}
245
251
  </Box>
246
- <Stack direction="row" justify="space-between" role="alert">
252
+ <Stack direction="row" justify="space-between" aria-live="polite">
247
253
  {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
248
254
  <Text
249
255
  color={ERROR_COLOR}
@@ -62,7 +62,10 @@ const FormSelect = ({
62
62
  </Box>
63
63
  <Dropdown
64
64
  ariaLabelledby={createIdFromString(labelTextWhenNoError)}
65
- ariaDescribedby={createIdFromString(labelTextWhenNoError)}
65
+ ariaDescribedby={createIdFromString(
66
+ labelTextWhenNoError,
67
+ "error message"
68
+ )}
66
69
  maxHeight={dropdownMaxHeight}
67
70
  hasTitles={hasTitles}
68
71
  placeholder={options[0] ? options[0].text : ""}
@@ -80,24 +83,25 @@ const FormSelect = ({
80
83
  disabled={disabled}
81
84
  autocompleteValue={autocompleteValue}
82
85
  smoothScroll={smoothScroll}
83
- required={options.required}
84
86
  />
85
- <Stack direction="row" justify="space-between" role="alert">
86
- <Text
87
- color={ERROR_COLOR}
88
- variant="pXS"
89
- weight={themeValues.fontWeight}
90
- extraStyles={`word-break: break-word;
91
- font-family: Public Sans;
92
- &::first-letter {
93
- text-transform: uppercase;
94
- }`}
95
- id={createIdFromString(labelTextWhenNoError, "error message")}
96
- >
97
- {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors)
98
- ? errorMessages[field.errors[0]]
99
- : ""}
100
- </Text>
87
+ <Stack direction="row" justify="space-between" aria-live="polite">
88
+ {(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
89
+ <Text
90
+ color={ERROR_COLOR}
91
+ variant="pXS"
92
+ weight={themeValues.fontWeight}
93
+ extraStyles={`word-break: break-word;
94
+ font-family: Public Sans;
95
+ &::first-letter {
96
+ text-transform: uppercase;
97
+ }`}
98
+ id={createIdFromString(labelTextWhenNoError, "error message")}
99
+ >
100
+ {errorMessages[field.errors[0]]}
101
+ </Text>
102
+ ) : (
103
+ <Text extraStyles={`height: ${themeValues.lineHeight};`} />
104
+ )}
101
105
  </Stack>
102
106
  </SelectContainer>
103
107
  );
@@ -64,18 +64,15 @@ const AddressForm = ({
64
64
  }
65
65
  }}
66
66
  showErrors={showErrors}
67
- aria-label="Country"
68
67
  />
69
68
  <FormInput
70
69
  labelTextWhenNoError="Address"
71
70
  errorMessages={street1ErrorMessages}
72
- required={true}
73
71
  field={fields.street1}
74
72
  fieldActions={actions.fields.street1}
75
73
  showErrors={showErrors}
76
74
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
77
75
  autocomplete="address-line1"
78
- aria-label="Address Line 1"
79
76
  />
80
77
  <FormInput
81
78
  labelTextWhenNoError="Apt, Suite, Unit, Floor, etc. (Optional)"
@@ -84,18 +81,15 @@ const AddressForm = ({
84
81
  showErrors={showErrors}
85
82
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
86
83
  autocomplete="address-line2"
87
- aria-label="Address Line 2"
88
84
  />
89
85
  <FormInput
90
86
  labelTextWhenNoError="City"
91
- required={true}
92
87
  errorMessages={cityErrorMessages}
93
88
  field={fields.city}
94
89
  fieldActions={actions.fields.city}
95
90
  showErrors={showErrors}
96
91
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
97
- autocomplete="city"
98
- aria-label="City"
92
+ autocomplete="address-level2"
99
93
  />
100
94
  <StateProvinceDropdown
101
95
  labelTextWhenNoError={isUS ? "State" : "State or Province"}
@@ -105,8 +99,7 @@ const AddressForm = ({
105
99
  fieldActions={actions.fields.stateProvince}
106
100
  showErrors={showErrors}
107
101
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
108
- aria-label={isUS ? "State" : "State or Province"}
109
- required={true}
102
+ autocomplete="address-level1"
110
103
  />
111
104
  <FormInput
112
105
  isNum={isUS}
@@ -117,14 +110,12 @@ const AddressForm = ({
117
110
  fieldActions={actions.fields.zip}
118
111
  showErrors={showErrors}
119
112
  onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
120
- aria-label="zip code"
121
113
  autocomplete="postal-code"
122
- required={true}
123
114
  />
124
115
  {showWalletCheckbox && (
125
116
  <Checkbox
126
117
  name="address checkbox"
127
- title="Save address to Wallet"
118
+ title="Save address to wallet"
128
119
  checked={walletCheckboxMarked}
129
120
  onChange={saveToWallet}
130
121
  />
@@ -13,6 +13,7 @@ import { displayCurrency } from "../../../util/general";
13
13
  import { themeComponent } from "../../../util/themeUtils";
14
14
  import CollapsibleSection from "../collapsible-section";
15
15
 
16
+ import LoadingLine from "../../atoms/loading-line";
16
17
  import LabeledAmount from "../../atoms/labeled-amount";
17
18
  import LineItem from "../../atoms/line-item";
18
19
  import Title from "../../atoms/title";
@@ -120,22 +121,41 @@ const PaymentDetailsContent = ({
120
121
  );
121
122
 
122
123
  const LoadingDetails = () => (
123
- <Box
124
- padding="0"
125
- background={GRECIAN_GREY}
126
- borderRadius="4px"
127
- minHeight="196px"
128
- >
129
- <Cover minHeight="196px" singleChild fillCenter>
130
- <Center intrinsic>
131
- <Box
132
- padding="0"
133
- extraStyles={`flex-grow: 1; display: flex; justify-content: center; align-items: center;`}
134
- >
135
- <Spinner size="100" centerSpinner />
136
- </Box>
137
- </Center>
138
- </Cover>
124
+ <Box padding="0" minHeight="196px">
125
+ <Box
126
+ padding="0"
127
+ extraStyles={`position: absolute;
128
+ height: 200px;
129
+ width: 100%;
130
+ display: flex;
131
+ justify-content: center;
132
+ align-items: center;`}
133
+ >
134
+ <Spinner size="100" centerSpinner />
135
+ </Box>
136
+ <Stack childGap="16px">
137
+ <Cluster nowrap justify="space-between" align="start">
138
+ <LoadingLine exactWidth="110" height="27px" />
139
+ <LoadingLine exactWidth="60" height="27px" />
140
+ </Cluster>
141
+ <SolidDivider />
142
+ <Box padding="0.5rem 0">
143
+ <Cluster justify="space-between" align="start">
144
+ <LoadingLine exactWidth="80" height="27px" />
145
+ <LoadingLine exactWidth="60" height="27px" />
146
+ </Cluster>
147
+ <Box padding="4px 0" />
148
+ <Cluster justify="space-between" align="start">
149
+ <LoadingLine exactWidth="100" height="27px" />
150
+ <LoadingLine exactWidth="50" height="27px" />
151
+ </Cluster>
152
+ </Box>
153
+ <SolidDivider />
154
+ <Stack justify="space-between" direction="row">
155
+ <LoadingLine exactWidth="55" height="30px" />
156
+ <LoadingLine exactWidth="70" height="30px" />
157
+ </Stack>
158
+ </Stack>
139
159
  </Box>
140
160
  );
141
161