@thecb/components 6.0.0-beta.4 → 6.0.0-beta.5

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": "6.0.0-beta.4",
3
+ "version": "6.0.0-beta.5",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -74,10 +74,11 @@ const DropdownItemWrapper = styled.div`
74
74
 
75
75
  const SearchInput = styled.input`
76
76
  border: none;
77
- background-color: ${({ themeValues }) =>
78
- themeValues.hoverColor && themeValues.hoverColor};
77
+ background-color: ${({ themeValues, isOpen }) =>
78
+ isOpen ? themeValues.hoverColor && themeValues.hoverColor : "WHITE"};
79
79
  font-size: 16px;
80
80
  height: 24px;
81
+ min-width: 75%;
81
82
  `;
82
83
 
83
84
  const Dropdown = ({
@@ -264,6 +265,7 @@ const Dropdown = ({
264
265
  : GREY_CHATEAU
265
266
  }
266
267
  borderRadius="2px"
268
+ tabIndex={0}
267
269
  dataQa={placeholder}
268
270
  extraStyles={`height: 48px;
269
271
  ${disabled &&
@@ -285,7 +287,7 @@ const Dropdown = ({
285
287
  aria-autocomplete="list"
286
288
  aria-controls={`${ariaLabelledby}_listbox`}
287
289
  aria-activedescendant="selected_option"
288
- tabIndex={0}
290
+ isOpen={isOpen}
289
291
  />
290
292
  <IconWrapper open={isOpen}>
291
293
  <DropdownIcon />
@@ -304,7 +306,10 @@ const Dropdown = ({
304
306
  >
305
307
  <Stack childGap="0">
306
308
  {filteredOptions.map((choice, i) => {
307
- if (selectedRef === undefined && choice.value === value) {
309
+ if (
310
+ choice.value === value &&
311
+ selectedRef !== optionRefs.current[i]
312
+ ) {
308
313
  setSelectedRef(optionRefs.current[i]);
309
314
  }
310
315
  return (
@@ -317,7 +322,10 @@ const Dropdown = ({
317
322
  onClick={
318
323
  disabledValues.includes(choice.value)
319
324
  ? evt => evt.preventDefault()
320
- : () => onSelect(choice.value)
325
+ : () => {
326
+ setSelectedRef(optionRefs.current[i]);
327
+ onSelect(choice.value);
328
+ }
321
329
  }
322
330
  selected={choice.value === value}
323
331
  aria-selected={choice.value === value}