@thecb/components 6.0.0-beta.14 → 6.0.0-beta.15
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
|
@@ -21,6 +21,9 @@ const IconWrapper = styled.div`
|
|
|
21
21
|
justify-content: center;
|
|
22
22
|
transition: transform 0.3s ease;
|
|
23
23
|
${({ open }) => (open ? "transform: rotate(-180deg)" : "")}
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 20px;
|
|
26
|
+
right: 12px;
|
|
24
27
|
`;
|
|
25
28
|
|
|
26
29
|
const DropdownContentWrapper = styled.div`
|
|
@@ -120,15 +123,11 @@ const Dropdown = ({
|
|
|
120
123
|
value ? options.find(option => option.value === value)?.text : placeholder;
|
|
121
124
|
|
|
122
125
|
const onKeyDown = e => {
|
|
123
|
-
console.log("
|
|
124
|
-
console.log("key down event value is", e.target.value);
|
|
126
|
+
console.log("current input value", inputValue);
|
|
125
127
|
const { key, keyCode } = e;
|
|
126
128
|
const focus = document.activeElement;
|
|
127
129
|
console.log("dropdown value is", value);
|
|
128
|
-
console.log("focus is", focus);
|
|
129
|
-
console.log("option refs are", optionRefs.current);
|
|
130
130
|
const optionEl = optionRefs.current.find(ref => ref.current === focus);
|
|
131
|
-
console.log("option el is", optionEl);
|
|
132
131
|
switch (key) {
|
|
133
132
|
case "ArrowDown":
|
|
134
133
|
e.preventDefault();
|
|
@@ -184,13 +183,6 @@ const Dropdown = ({
|
|
|
184
183
|
};
|
|
185
184
|
|
|
186
185
|
useEffect(() => {
|
|
187
|
-
console.log("option refs in isopen useffect", optionRefs);
|
|
188
|
-
console.log(
|
|
189
|
-
"option ref current in isopen useffect",
|
|
190
|
-
optionRefs.current[0].current
|
|
191
|
-
);
|
|
192
|
-
console.log("selected refs in isopen useffect", selectedRef);
|
|
193
|
-
console.log("value in isopen useffect", value);
|
|
194
186
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
195
187
|
// WAI-ARIA requires the selected option to receive focus
|
|
196
188
|
selectedRef.current.focus();
|
|
@@ -223,8 +215,6 @@ const Dropdown = ({
|
|
|
223
215
|
!disabledValues.includes(filteredOptions[0].value) &&
|
|
224
216
|
filteredOptions[0].text != placeholder
|
|
225
217
|
) {
|
|
226
|
-
console.log("filtered options are", filteredOptions);
|
|
227
|
-
console.log("option refs are", optionRefs);
|
|
228
218
|
onSelect(filteredOptions[0].value);
|
|
229
219
|
}
|
|
230
220
|
if (optionRefs.current[0].current) {
|
|
@@ -238,23 +228,12 @@ const Dropdown = ({
|
|
|
238
228
|
<Box
|
|
239
229
|
padding="0"
|
|
240
230
|
background={isOpen ? themeValues.hoverColor : WHITE}
|
|
241
|
-
borderSize="1px"
|
|
242
|
-
borderColor={
|
|
243
|
-
isError
|
|
244
|
-
? ERROR_COLOR
|
|
245
|
-
: isOpen
|
|
246
|
-
? themeValues.selectedColor
|
|
247
|
-
: GREY_CHATEAU
|
|
248
|
-
}
|
|
249
|
-
borderRadius="2px"
|
|
250
|
-
borderWidthOverride="0px 1px 0px 0px"
|
|
251
231
|
extraStyles={`position: relative;`}
|
|
252
232
|
minWidth="100%"
|
|
253
233
|
onClick={() => {
|
|
254
|
-
|
|
255
|
-
onClick();
|
|
256
|
-
}
|
|
234
|
+
onClick();
|
|
257
235
|
}}
|
|
236
|
+
onKeyDown={onKeyDown}
|
|
258
237
|
width="100%"
|
|
259
238
|
>
|
|
260
239
|
<Stack direction="row" bottomItem={2}>
|
|
@@ -289,15 +268,15 @@ const Dropdown = ({
|
|
|
289
268
|
hoverStyles={`background-color: ${themeValues.hoverColor};`}
|
|
290
269
|
isOpen={isOpen}
|
|
291
270
|
minHeight="48px"
|
|
292
|
-
minWidth="
|
|
271
|
+
minWidth="100%"
|
|
293
272
|
name={autocompleteValue}
|
|
294
|
-
onKeyDown={onKeyDown}
|
|
295
273
|
onFocus={() => {
|
|
296
274
|
if (!isOpen) {
|
|
297
275
|
onClick();
|
|
298
276
|
}
|
|
299
277
|
}}
|
|
300
278
|
onChange={e => {
|
|
279
|
+
console.log("current input value", inputValue);
|
|
301
280
|
console.log("input change event", e.target);
|
|
302
281
|
console.log("input change event value", e.target.value);
|
|
303
282
|
setInputValue(e.target.value);
|
|
@@ -310,7 +289,7 @@ const Dropdown = ({
|
|
|
310
289
|
type="text"
|
|
311
290
|
tabIndex={0}
|
|
312
291
|
value={inputValue}
|
|
313
|
-
width="
|
|
292
|
+
width="100%"
|
|
314
293
|
dataQa={placeholder}
|
|
315
294
|
/>
|
|
316
295
|
<IconWrapper open={isOpen}>
|