@thecb/components 6.0.0-beta.23 → 6.0.0-beta.26

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.23",
3
+ "version": "6.0.0-beta.26",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -121,6 +121,7 @@ const Dropdown = ({
121
121
  const [timer, setTimer] = useState(null);
122
122
  const optionRefs = useRef([...Array(options.length)].map(() => createRef()));
123
123
  const dropdownRef = useRef(null);
124
+ const inputRef = useRef(null);
124
125
 
125
126
  const getSelection = () =>
126
127
  value ? options.find(option => option.value === value)?.text : placeholder;
@@ -208,9 +209,11 @@ const Dropdown = ({
208
209
  if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
209
210
  // WAI-ARIA requires the selected option to receive focus
210
211
  selectedRef.current.focus();
212
+ console.log("input box ref", inputRef, inputRef.current);
211
213
  } else if (isOpen && optionRefs.current[0].current) {
212
214
  // If no selected option, first option receives focus
213
215
  optionRefs.current[0].current.focus();
216
+ console.log("input box ref", inputRef, inputRef.current);
214
217
  }
215
218
  clearTimeout(timer);
216
219
  setInputValue("");
@@ -245,7 +248,7 @@ const Dropdown = ({
245
248
  setInputChangedByAutofill(false);
246
249
  onSelect(filteredOptions[0].value);
247
250
  if (isOpen) {
248
- onClick();
251
+ setTimeout(() => onClick(), 2000);
249
252
  }
250
253
  }
251
254
  if (optionRefs.current[0].current) {
@@ -313,6 +316,7 @@ const Dropdown = ({
313
316
  }}
314
317
  padding="12px"
315
318
  placeholder={getSelection()}
319
+ ref={inputRef}
316
320
  role="combobox"
317
321
  themeValues={themeValues}
318
322
  title={hasTitles ? getSelection() : null}