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

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.esm.js CHANGED
@@ -19438,32 +19438,31 @@ var DropdownItemWrapper = styled.div.withConfig({
19438
19438
  var SearchInput = styled.input.withConfig({
19439
19439
  displayName: "Dropdown__SearchInput",
19440
19440
  componentId: "sc-pn6m0h-3"
19441
- })(["border:none;background-color:", ";font-size:16px;height:24px;"], function (_ref8) {
19442
- var themeValues = _ref8.themeValues;
19443
- return themeValues.hoverColor && themeValues.hoverColor;
19444
- });
19445
-
19446
- var Dropdown = function Dropdown(_ref9) {
19447
- var placeholder = _ref9.placeholder,
19448
- options = _ref9.options,
19449
- value = _ref9.value,
19450
- isOpen = _ref9.isOpen,
19451
- isError = _ref9.isError,
19452
- onSelect = _ref9.onSelect,
19453
- _ref9$disabledValues = _ref9.disabledValues,
19454
- disabledValues = _ref9$disabledValues === void 0 ? [] : _ref9$disabledValues,
19455
- _ref9$onClick = _ref9.onClick,
19456
- onClick = _ref9$onClick === void 0 ? noop : _ref9$onClick,
19457
- themeValues = _ref9.themeValues,
19458
- maxHeight = _ref9.maxHeight,
19459
- _ref9$widthFitOptions = _ref9.widthFitOptions,
19460
- widthFitOptions = _ref9$widthFitOptions === void 0 ? false : _ref9$widthFitOptions,
19461
- disabled = _ref9.disabled,
19462
- _ref9$hasTitles = _ref9.hasTitles,
19463
- hasTitles = _ref9$hasTitles === void 0 ? false : _ref9$hasTitles,
19464
- _ref9$autoEraseTypeAh = _ref9.autoEraseTypeAhead,
19465
- autoEraseTypeAhead = _ref9$autoEraseTypeAh === void 0 ? true : _ref9$autoEraseTypeAh,
19466
- ariaLabelledby = _ref9.ariaLabelledby;
19441
+ })(["border:none;background-color:transparent;font-size:16px;height:24px;min-width:80%;"]);
19442
+
19443
+ var Dropdown = function Dropdown(_ref8) {
19444
+ var placeholder = _ref8.placeholder,
19445
+ options = _ref8.options,
19446
+ value = _ref8.value,
19447
+ isOpen = _ref8.isOpen,
19448
+ isError = _ref8.isError,
19449
+ onSelect = _ref8.onSelect,
19450
+ _ref8$disabledValues = _ref8.disabledValues,
19451
+ disabledValues = _ref8$disabledValues === void 0 ? [] : _ref8$disabledValues,
19452
+ _ref8$onClick = _ref8.onClick,
19453
+ onClick = _ref8$onClick === void 0 ? noop : _ref8$onClick,
19454
+ themeValues = _ref8.themeValues,
19455
+ maxHeight = _ref8.maxHeight,
19456
+ _ref8$widthFitOptions = _ref8.widthFitOptions,
19457
+ widthFitOptions = _ref8$widthFitOptions === void 0 ? false : _ref8$widthFitOptions,
19458
+ disabled = _ref8.disabled,
19459
+ _ref8$hasTitles = _ref8.hasTitles,
19460
+ hasTitles = _ref8$hasTitles === void 0 ? false : _ref8$hasTitles,
19461
+ _ref8$autoEraseTypeAh = _ref8.autoEraseTypeAhead,
19462
+ autoEraseTypeAhead = _ref8$autoEraseTypeAh === void 0 ? true : _ref8$autoEraseTypeAh,
19463
+ ariaLabelledby = _ref8.ariaLabelledby,
19464
+ _ref8$autocompleteVal = _ref8.autocompleteValue,
19465
+ autocompleteValue = _ref8$autocompleteVal === void 0 ? "" : _ref8$autocompleteVal;
19467
19466
 
19468
19467
  var _useState = useState(""),
19469
19468
  _useState2 = _slicedToArray(_useState, 2),
@@ -19615,7 +19614,7 @@ var Dropdown = function Dropdown(_ref9) {
19615
19614
  clearTimeout(timer);
19616
19615
  setTimer(setTimeout(function () {
19617
19616
  return setInputValue("");
19618
- }, 2000));
19617
+ }, 5000));
19619
19618
  }
19620
19619
 
19621
19620
  setFilteredOptions(options.filter(function (option) {
@@ -19624,6 +19623,8 @@ var Dropdown = function Dropdown(_ref9) {
19624
19623
  }, [inputValue]);
19625
19624
  useEffect$1(function () {
19626
19625
  if (!isOpen && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
19626
+ console.log("filtered options are", filteredOptions);
19627
+ console.log("option refs are", optionRefs);
19627
19628
  onSelect(filteredOptions[0].value);
19628
19629
  }
19629
19630
 
@@ -19655,11 +19656,13 @@ var Dropdown = function Dropdown(_ref9) {
19655
19656
  borderSize: "1px",
19656
19657
  borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
19657
19658
  borderRadius: "2px",
19659
+ tabIndex: 0,
19658
19660
  dataQa: placeholder,
19659
19661
  extraStyles: "height: 48px;\n ".concat(disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;", "\n ")
19660
19662
  }, /*#__PURE__*/React.createElement(Stack, {
19661
19663
  direction: "row",
19662
- bottomItem: 2
19664
+ bottomItem: 2,
19665
+ extraStyles: "position: relative;"
19663
19666
  }, /*#__PURE__*/React.createElement(SearchInput, {
19664
19667
  "aria-label": getSelection(),
19665
19668
  placeholder: getSelection(),
@@ -19672,7 +19675,10 @@ var Dropdown = function Dropdown(_ref9) {
19672
19675
  "aria-autocomplete": "list",
19673
19676
  "aria-controls": "".concat(ariaLabelledby, "_listbox"),
19674
19677
  "aria-activedescendant": "selected_option",
19675
- tabIndex: 0
19678
+ isOpen: isOpen,
19679
+ tabIndex: -1,
19680
+ name: autocompleteValue,
19681
+ autocomplete: autocompleteValue
19676
19682
  }), /*#__PURE__*/React.createElement(IconWrapper, {
19677
19683
  open: isOpen
19678
19684
  }, /*#__PURE__*/React.createElement(DropdownIcon, null)))), isOpen ? /*#__PURE__*/React.createElement(DropdownContentWrapper, {
@@ -19686,7 +19692,7 @@ var Dropdown = function Dropdown(_ref9) {
19686
19692
  }, /*#__PURE__*/React.createElement(Stack, {
19687
19693
  childGap: "0"
19688
19694
  }, filteredOptions.map(function (choice, i) {
19689
- if (selectedRef === undefined && choice.value === value) {
19695
+ if (choice.value === value && selectedRef !== optionRefs.current[i]) {
19690
19696
  setSelectedRef(optionRefs.current[i]);
19691
19697
  }
19692
19698
 
@@ -19699,7 +19705,8 @@ var Dropdown = function Dropdown(_ref9) {
19699
19705
  onClick: disabledValues.includes(choice.value) ? function (evt) {
19700
19706
  return evt.preventDefault();
19701
19707
  } : function () {
19702
- return onSelect(choice.value);
19708
+ setSelectedRef(optionRefs.current[i]);
19709
+ onSelect(choice.value);
19703
19710
  },
19704
19711
  selected: choice.value === value,
19705
19712
  "aria-selected": choice.value === value,
@@ -19814,7 +19821,8 @@ var FormSelect = function FormSelect(_ref) {
19814
19821
  disabled = _ref.disabled,
19815
19822
  themeValues = _ref.themeValues,
19816
19823
  _ref$hasTitles = _ref.hasTitles,
19817
- hasTitles = _ref$hasTitles === void 0 ? false : _ref$hasTitles;
19824
+ hasTitles = _ref$hasTitles === void 0 ? false : _ref$hasTitles,
19825
+ autocompleteValue = _ref.autocompleteValue;
19818
19826
 
19819
19827
  var _useState = useState(false),
19820
19828
  _useState2 = _slicedToArray(_useState, 2),
@@ -19869,7 +19877,8 @@ var FormSelect = function FormSelect(_ref) {
19869
19877
  onClick: function onClick() {
19870
19878
  return setOpen(!open);
19871
19879
  },
19872
- disabled: disabled
19880
+ disabled: disabled,
19881
+ autocompleteValue: autocompleteValue
19873
19882
  }), /*#__PURE__*/React.createElement(Stack, {
19874
19883
  direction: "row",
19875
19884
  justify: "space-between"
@@ -20642,7 +20651,8 @@ var CountryDropdown = function CountryDropdown(_ref) {
20642
20651
  labelTextWhenNoError: labelTextWhenNoError,
20643
20652
  errorMessages: errorMessages,
20644
20653
  showErrors: showErrors,
20645
- onChange: onChange
20654
+ onChange: onChange,
20655
+ autocompleteValue: "country-name"
20646
20656
  });
20647
20657
  };
20648
20658
 
@@ -33058,7 +33068,8 @@ var FormStateDropdown = function FormStateDropdown(_ref) {
33058
33068
  fieldActions: fieldActions,
33059
33069
  labelTextWhenNoError: labelTextWhenNoError,
33060
33070
  errorMessages: errorMessages,
33061
- showErrors: showErrors
33071
+ showErrors: showErrors,
33072
+ autocompleteValue: "address-level1"
33062
33073
  });
33063
33074
  };
33064
33075