@thecb/components 10.8.1 → 10.9.0-beta.0
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/dist/index.cjs.js +45 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.esm.js +45 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +3 -1
- package/src/components/atoms/form-layouts/FormInput.js +6 -0
- package/src/components/atoms/form-select/FormSelect.js +5 -1
- package/src/components/atoms/form-select/index.d.ts +2 -0
- package/src/components/atoms/layouts/Box.d.ts +1 -0
- package/src/components/atoms/layouts/Box.js +2 -0
- package/src/components/atoms/state-province-dropdown/StateProvinceDropdown.js +5 -1
- package/src/components/atoms/text/index.d.ts +2 -0
- package/src/components/molecules/address-form/AddressForm.js +11 -0
package/package.json
CHANGED
|
@@ -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,
|
|
@@ -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
|
);
|
|
@@ -81,6 +81,8 @@ const AddressForm = ({
|
|
|
81
81
|
showErrors={showErrors}
|
|
82
82
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
83
83
|
autocompleteValue="address-line1"
|
|
84
|
+
htmlFor="address-line1"
|
|
85
|
+
inputId="address-line1"
|
|
84
86
|
dataQa="Address"
|
|
85
87
|
isRequired={true}
|
|
86
88
|
/>
|
|
@@ -91,6 +93,8 @@ const AddressForm = ({
|
|
|
91
93
|
showErrors={showErrors}
|
|
92
94
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
93
95
|
autocompleteValue="address-line2"
|
|
96
|
+
htmlFor="address-line2"
|
|
97
|
+
inputId="address-line2"
|
|
94
98
|
dataQa="Address Line 2"
|
|
95
99
|
/>
|
|
96
100
|
<FormInput
|
|
@@ -101,6 +105,8 @@ const AddressForm = ({
|
|
|
101
105
|
showErrors={showErrors}
|
|
102
106
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
103
107
|
autocompleteValue="address-level2"
|
|
108
|
+
htmlFor="city"
|
|
109
|
+
inputId="city"
|
|
104
110
|
dataQa="City"
|
|
105
111
|
isRequired={true}
|
|
106
112
|
/>
|
|
@@ -112,6 +118,9 @@ const AddressForm = ({
|
|
|
112
118
|
fieldActions={actions.fields.stateProvince}
|
|
113
119
|
showErrors={showErrors}
|
|
114
120
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
121
|
+
autocompleteValue="address-level1"
|
|
122
|
+
htmlFor="stateOrProvince"
|
|
123
|
+
inputId="stateOrProvince"
|
|
115
124
|
dataQa="State or Province"
|
|
116
125
|
isRequired={true}
|
|
117
126
|
/>
|
|
@@ -125,6 +134,8 @@ const AddressForm = ({
|
|
|
125
134
|
showErrors={showErrors}
|
|
126
135
|
onKeyDown={e => e.key === "Enter" && handleSubmit(e)}
|
|
127
136
|
autocompleteValue="postal-code"
|
|
137
|
+
htmlFor="postal-code"
|
|
138
|
+
inputId="postal-code"
|
|
128
139
|
dataQa="Zip code"
|
|
129
140
|
isRequired={true}
|
|
130
141
|
/>
|