@thecb/components 6.0.0-beta.14 → 6.0.0-beta.17

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
@@ -19400,7 +19400,7 @@ var fallbackValues$e = {
19400
19400
  var IconWrapper = styled.div.withConfig({
19401
19401
  displayName: "Dropdown__IconWrapper",
19402
19402
  componentId: "sc-pn6m0h-0"
19403
- })(["display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", ""], function (_ref) {
19403
+ })(["position:absolute;display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", ";top:20px;right:12px;"], function (_ref) {
19404
19404
  var open = _ref.open;
19405
19405
  return open ? "transform: rotate(-180deg)" : "";
19406
19406
  });
@@ -19521,23 +19521,23 @@ var Dropdown = function Dropdown(_ref8) {
19521
19521
  var onKeyDown = function onKeyDown(e) {
19522
19522
  var _optionRefs$current$l, _optionRefs$current;
19523
19523
 
19524
- console.log("key down event is", e.target);
19525
- console.log("key down event value is", e.target.value);
19524
+ console.log("current input value top of keyDown", inputValue);
19526
19525
  var key = e.key,
19527
19526
  keyCode = e.keyCode;
19528
19527
  var focus = document.activeElement;
19529
19528
  console.log("dropdown value is", value);
19530
- console.log("focus is", focus);
19531
- console.log("option refs are", optionRefs.current);
19532
19529
  var optionEl = optionRefs.current.find(function (ref) {
19533
19530
  return ref.current === focus;
19534
19531
  });
19535
- console.log("option el is", optionEl);
19536
19532
 
19537
19533
  switch (key) {
19538
19534
  case "ArrowDown":
19539
19535
  e.preventDefault();
19540
19536
 
19537
+ if (!isOpen) {
19538
+ _onClick();
19539
+ }
19540
+
19541
19541
  if (optionEl) {
19542
19542
  if (optionEl.current.nextElementSibling) {
19543
19543
  optionEl.current.nextElementSibling.focus();
@@ -19596,14 +19596,15 @@ var Dropdown = function Dropdown(_ref8) {
19596
19596
 
19597
19597
  break;
19598
19598
  }
19599
+
19600
+ if (keyCode > 64 && keyCode < 91 || keyCode == 32 || keyCode == 189) {
19601
+ e.preventDefault();
19602
+ console.log("current input value inside keydown if", inputValue);
19603
+ setInputValue(inputValue + key);
19604
+ }
19599
19605
  };
19600
19606
 
19601
19607
  useEffect$1(function () {
19602
- console.log("option refs in isopen useffect", optionRefs);
19603
- console.log("option ref current in isopen useffect", optionRefs.current[0].current);
19604
- console.log("selected refs in isopen useffect", selectedRef);
19605
- console.log("value in isopen useffect", value);
19606
-
19607
19608
  if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
19608
19609
  // WAI-ARIA requires the selected option to receive focus
19609
19610
  selectedRef.current.focus();
@@ -19629,8 +19630,6 @@ var Dropdown = function Dropdown(_ref8) {
19629
19630
  }, [inputValue]);
19630
19631
  useEffect$1(function () {
19631
19632
  if (!isOpen && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
19632
- console.log("filtered options are", filteredOptions);
19633
- console.log("option refs are", optionRefs);
19634
19633
  onSelect(filteredOptions[0].value);
19635
19634
  }
19636
19635
 
@@ -19643,10 +19642,6 @@ var Dropdown = function Dropdown(_ref8) {
19643
19642
  return /*#__PURE__*/React.createElement(Box, {
19644
19643
  padding: "0",
19645
19644
  background: isOpen ? themeValues.hoverColor : WHITE,
19646
- borderSize: "1px",
19647
- borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
19648
- borderRadius: "2px",
19649
- borderWidthOverride: "0px 1px 0px 0px",
19650
19645
  extraStyles: "position: relative;",
19651
19646
  minWidth: "100%",
19652
19647
  onClick: function onClick() {
@@ -19654,10 +19649,8 @@ var Dropdown = function Dropdown(_ref8) {
19654
19649
  _onClick();
19655
19650
  }
19656
19651
  },
19652
+ onKeyDown: onKeyDown,
19657
19653
  width: "100%"
19658
- }, /*#__PURE__*/React.createElement(Stack, {
19659
- direction: "row",
19660
- bottomItem: 2
19661
19654
  }, /*#__PURE__*/React.createElement(Box, {
19662
19655
  as: "input",
19663
19656
  "aria-multiline": "false",
@@ -19673,20 +19666,19 @@ var Dropdown = function Dropdown(_ref8) {
19673
19666
  borderRadius: "2px",
19674
19667
  borderSize: "1px",
19675
19668
  borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
19676
- borderWidthOverride: "1px 0px 1px 1px",
19677
19669
  extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
19678
19670
  hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
19679
19671
  isOpen: isOpen,
19680
19672
  minHeight: "48px",
19681
- minWidth: "85%",
19673
+ minWidth: "100%",
19682
19674
  name: autocompleteValue,
19683
- onKeyDown: onKeyDown,
19684
19675
  onFocus: function onFocus() {
19685
19676
  if (!isOpen) {
19686
19677
  _onClick();
19687
19678
  }
19688
19679
  },
19689
19680
  onChange: function onChange(e) {
19681
+ console.log("current input value onChange", inputValue);
19690
19682
  console.log("input change event", e.target);
19691
19683
  console.log("input change event value", e.target.value);
19692
19684
  setInputValue(e.target.value);
@@ -19699,11 +19691,12 @@ var Dropdown = function Dropdown(_ref8) {
19699
19691
  type: "text",
19700
19692
  tabIndex: 0,
19701
19693
  value: inputValue,
19702
- width: "85%",
19694
+ width: "100%",
19703
19695
  dataQa: placeholder
19704
19696
  }), /*#__PURE__*/React.createElement(IconWrapper, {
19705
- open: isOpen
19706
- }, /*#__PURE__*/React.createElement(DropdownIcon, null))), /*#__PURE__*/React.createElement(Fragment, null, isOpen ? /*#__PURE__*/React.createElement(DropdownContentWrapper, {
19697
+ open: isOpen,
19698
+ onClick: _onClick
19699
+ }, /*#__PURE__*/React.createElement(DropdownIcon, null)), /*#__PURE__*/React.createElement(Fragment, null, isOpen ? /*#__PURE__*/React.createElement(DropdownContentWrapper, {
19707
19700
  maxHeight: maxHeight,
19708
19701
  open: isOpen,
19709
19702
  ref: dropdownRef,
@@ -19729,6 +19722,10 @@ var Dropdown = function Dropdown(_ref8) {
19729
19722
  } : function () {
19730
19723
  setSelectedRef(optionRefs.current[i]);
19731
19724
  onSelect(choice.value);
19725
+
19726
+ if (isOpen) {
19727
+ _onClick();
19728
+ }
19732
19729
  },
19733
19730
  selected: choice.value === value,
19734
19731
  "aria-selected": choice.value === value,