@thecb/components 6.0.0-beta.16 → 6.0.0-beta.19
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 +32 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +32 -11
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +28 -12
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
|
-
})(["position:absolute;display:flex;flex-direction:column;justify-content:center;transition:transform 0.3s ease;", "
|
|
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,7 +19529,7 @@ 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("current input value", inputValue);
|
|
19532
|
+
console.log("current input value top of keyDown", inputValue);
|
|
19533
19533
|
var key = e.key,
|
|
19534
19534
|
keyCode = e.keyCode;
|
|
19535
19535
|
var focus = document.activeElement;
|
|
@@ -19607,10 +19607,24 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19607
19607
|
|
|
19608
19608
|
if (keyCode > 64 && keyCode < 91 || keyCode == 32 || keyCode == 189) {
|
|
19609
19609
|
e.preventDefault();
|
|
19610
|
+
console.log("current input value inside keydown if", inputValue);
|
|
19610
19611
|
setInputValue(inputValue + key);
|
|
19611
19612
|
}
|
|
19612
19613
|
};
|
|
19613
19614
|
|
|
19615
|
+
var handleItemSelection = function handleItemSelection(evt, choice, i) {
|
|
19616
|
+
if (disabledValues.includes(choice.value)) {
|
|
19617
|
+
evt.preventDefault();
|
|
19618
|
+
} else {
|
|
19619
|
+
setSelectedRef(optionRefs.current[i]);
|
|
19620
|
+
onSelect(choice.value);
|
|
19621
|
+
|
|
19622
|
+
if (isOpen) {
|
|
19623
|
+
_onClick();
|
|
19624
|
+
}
|
|
19625
|
+
}
|
|
19626
|
+
};
|
|
19627
|
+
|
|
19614
19628
|
React.useEffect(function () {
|
|
19615
19629
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
19616
19630
|
// WAI-ARIA requires the selected option to receive focus
|
|
@@ -19680,15 +19694,20 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19680
19694
|
minWidth: "100%",
|
|
19681
19695
|
name: autocompleteValue,
|
|
19682
19696
|
onFocus: function onFocus() {
|
|
19697
|
+
/*
|
|
19683
19698
|
if (!isOpen) {
|
|
19684
|
-
|
|
19699
|
+
onClick();
|
|
19685
19700
|
}
|
|
19701
|
+
*/
|
|
19686
19702
|
},
|
|
19687
19703
|
onChange: function onChange(e) {
|
|
19688
|
-
console.log("current input value", inputValue);
|
|
19704
|
+
console.log("current input value onChange", inputValue);
|
|
19689
19705
|
console.log("input change event", e.target);
|
|
19690
|
-
console.log("input change event value", e.target.value);
|
|
19691
|
-
|
|
19706
|
+
console.log("input change event value", e.target.value); // support autofill and copy/paste
|
|
19707
|
+
|
|
19708
|
+
if (e.tarvet.value !== inputValue) {
|
|
19709
|
+
setInputValue(e.target.value);
|
|
19710
|
+
}
|
|
19692
19711
|
},
|
|
19693
19712
|
padding: "12px",
|
|
19694
19713
|
placeholder: getSelection(),
|
|
@@ -19724,11 +19743,13 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19724
19743
|
key: choice.value,
|
|
19725
19744
|
ref: optionRefs.current[i],
|
|
19726
19745
|
tabIndex: -1,
|
|
19727
|
-
onClick:
|
|
19728
|
-
return
|
|
19729
|
-
}
|
|
19730
|
-
|
|
19731
|
-
|
|
19746
|
+
onClick: function onClick(e) {
|
|
19747
|
+
return handleItemSelection(e, choice, i);
|
|
19748
|
+
},
|
|
19749
|
+
onKeyDown: function onKeyDown(e) {
|
|
19750
|
+
if (e.keyCode === 13) {
|
|
19751
|
+
handleItemSelection(e, choice, i);
|
|
19752
|
+
}
|
|
19732
19753
|
},
|
|
19733
19754
|
selected: choice.value === value,
|
|
19734
19755
|
"aria-selected": choice.value === value,
|