@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.cjs.js +23 -26
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +23 -26
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +71 -82
package/dist/index.cjs.js
CHANGED
|
@@ -19408,7 +19408,7 @@ var fallbackValues$e = {
|
|
|
19408
19408
|
var IconWrapper = styled__default.div.withConfig({
|
|
19409
19409
|
displayName: "Dropdown__IconWrapper",
|
|
19410
19410
|
componentId: "sc-pn6m0h-0"
|
|
19411
|
-
})(["display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", ""], function (_ref) {
|
|
19411
|
+
})(["position:absolute;display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", ";top:20px;right:12px;"], function (_ref) {
|
|
19412
19412
|
var open = _ref.open;
|
|
19413
19413
|
return open ? "transform: rotate(-180deg)" : "";
|
|
19414
19414
|
});
|
|
@@ -19529,23 +19529,23 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19529
19529
|
var onKeyDown = function onKeyDown(e) {
|
|
19530
19530
|
var _optionRefs$current$l, _optionRefs$current;
|
|
19531
19531
|
|
|
19532
|
-
console.log("
|
|
19533
|
-
console.log("key down event value is", e.target.value);
|
|
19532
|
+
console.log("current input value top of keyDown", inputValue);
|
|
19534
19533
|
var key = e.key,
|
|
19535
19534
|
keyCode = e.keyCode;
|
|
19536
19535
|
var focus = document.activeElement;
|
|
19537
19536
|
console.log("dropdown value is", value);
|
|
19538
|
-
console.log("focus is", focus);
|
|
19539
|
-
console.log("option refs are", optionRefs.current);
|
|
19540
19537
|
var optionEl = optionRefs.current.find(function (ref) {
|
|
19541
19538
|
return ref.current === focus;
|
|
19542
19539
|
});
|
|
19543
|
-
console.log("option el is", optionEl);
|
|
19544
19540
|
|
|
19545
19541
|
switch (key) {
|
|
19546
19542
|
case "ArrowDown":
|
|
19547
19543
|
e.preventDefault();
|
|
19548
19544
|
|
|
19545
|
+
if (!isOpen) {
|
|
19546
|
+
_onClick();
|
|
19547
|
+
}
|
|
19548
|
+
|
|
19549
19549
|
if (optionEl) {
|
|
19550
19550
|
if (optionEl.current.nextElementSibling) {
|
|
19551
19551
|
optionEl.current.nextElementSibling.focus();
|
|
@@ -19604,14 +19604,15 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19604
19604
|
|
|
19605
19605
|
break;
|
|
19606
19606
|
}
|
|
19607
|
+
|
|
19608
|
+
if (keyCode > 64 && keyCode < 91 || keyCode == 32 || keyCode == 189) {
|
|
19609
|
+
e.preventDefault();
|
|
19610
|
+
console.log("current input value inside keydown if", inputValue);
|
|
19611
|
+
setInputValue(inputValue + key);
|
|
19612
|
+
}
|
|
19607
19613
|
};
|
|
19608
19614
|
|
|
19609
19615
|
React.useEffect(function () {
|
|
19610
|
-
console.log("option refs in isopen useffect", optionRefs);
|
|
19611
|
-
console.log("option ref current in isopen useffect", optionRefs.current[0].current);
|
|
19612
|
-
console.log("selected refs in isopen useffect", selectedRef);
|
|
19613
|
-
console.log("value in isopen useffect", value);
|
|
19614
|
-
|
|
19615
19616
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
19616
19617
|
// WAI-ARIA requires the selected option to receive focus
|
|
19617
19618
|
selectedRef.current.focus();
|
|
@@ -19637,8 +19638,6 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19637
19638
|
}, [inputValue]);
|
|
19638
19639
|
React.useEffect(function () {
|
|
19639
19640
|
if (!isOpen && filteredOptions[0] && !disabledValues.includes(filteredOptions[0].value) && filteredOptions[0].text != placeholder) {
|
|
19640
|
-
console.log("filtered options are", filteredOptions);
|
|
19641
|
-
console.log("option refs are", optionRefs);
|
|
19642
19641
|
onSelect(filteredOptions[0].value);
|
|
19643
19642
|
}
|
|
19644
19643
|
|
|
@@ -19651,10 +19650,6 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19651
19650
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
19652
19651
|
padding: "0",
|
|
19653
19652
|
background: isOpen ? themeValues.hoverColor : WHITE,
|
|
19654
|
-
borderSize: "1px",
|
|
19655
|
-
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
|
|
19656
|
-
borderRadius: "2px",
|
|
19657
|
-
borderWidthOverride: "0px 1px 0px 0px",
|
|
19658
19653
|
extraStyles: "position: relative;",
|
|
19659
19654
|
minWidth: "100%",
|
|
19660
19655
|
onClick: function onClick() {
|
|
@@ -19662,10 +19657,8 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19662
19657
|
_onClick();
|
|
19663
19658
|
}
|
|
19664
19659
|
},
|
|
19660
|
+
onKeyDown: onKeyDown,
|
|
19665
19661
|
width: "100%"
|
|
19666
|
-
}, /*#__PURE__*/React__default.createElement(Stack, {
|
|
19667
|
-
direction: "row",
|
|
19668
|
-
bottomItem: 2
|
|
19669
19662
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
19670
19663
|
as: "input",
|
|
19671
19664
|
"aria-multiline": "false",
|
|
@@ -19681,20 +19674,19 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19681
19674
|
borderRadius: "2px",
|
|
19682
19675
|
borderSize: "1px",
|
|
19683
19676
|
borderColor: isError ? ERROR_COLOR : isOpen ? themeValues.selectedColor : GREY_CHATEAU,
|
|
19684
|
-
borderWidthOverride: "1px 0px 1px 1px",
|
|
19685
19677
|
extraStyles: disabled && "color: #6e727e;\n background-color: #f7f7f7;\n pointer-events: none;",
|
|
19686
19678
|
hoverStyles: "background-color: ".concat(themeValues.hoverColor, ";"),
|
|
19687
19679
|
isOpen: isOpen,
|
|
19688
19680
|
minHeight: "48px",
|
|
19689
|
-
minWidth: "
|
|
19681
|
+
minWidth: "100%",
|
|
19690
19682
|
name: autocompleteValue,
|
|
19691
|
-
onKeyDown: onKeyDown,
|
|
19692
19683
|
onFocus: function onFocus() {
|
|
19693
19684
|
if (!isOpen) {
|
|
19694
19685
|
_onClick();
|
|
19695
19686
|
}
|
|
19696
19687
|
},
|
|
19697
19688
|
onChange: function onChange(e) {
|
|
19689
|
+
console.log("current input value onChange", inputValue);
|
|
19698
19690
|
console.log("input change event", e.target);
|
|
19699
19691
|
console.log("input change event value", e.target.value);
|
|
19700
19692
|
setInputValue(e.target.value);
|
|
@@ -19707,11 +19699,12 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19707
19699
|
type: "text",
|
|
19708
19700
|
tabIndex: 0,
|
|
19709
19701
|
value: inputValue,
|
|
19710
|
-
width: "
|
|
19702
|
+
width: "100%",
|
|
19711
19703
|
dataQa: placeholder
|
|
19712
19704
|
}), /*#__PURE__*/React__default.createElement(IconWrapper, {
|
|
19713
|
-
open: isOpen
|
|
19714
|
-
|
|
19705
|
+
open: isOpen,
|
|
19706
|
+
onClick: _onClick
|
|
19707
|
+
}, /*#__PURE__*/React__default.createElement(DropdownIcon, null)), /*#__PURE__*/React__default.createElement(React.Fragment, null, isOpen ? /*#__PURE__*/React__default.createElement(DropdownContentWrapper, {
|
|
19715
19708
|
maxHeight: maxHeight,
|
|
19716
19709
|
open: isOpen,
|
|
19717
19710
|
ref: dropdownRef,
|
|
@@ -19737,6 +19730,10 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19737
19730
|
} : function () {
|
|
19738
19731
|
setSelectedRef(optionRefs.current[i]);
|
|
19739
19732
|
onSelect(choice.value);
|
|
19733
|
+
|
|
19734
|
+
if (isOpen) {
|
|
19735
|
+
_onClick();
|
|
19736
|
+
}
|
|
19740
19737
|
},
|
|
19741
19738
|
selected: choice.value === value,
|
|
19742
19739
|
"aria-selected": choice.value === value,
|