@thecb/components 6.0.0-beta.17 → 6.0.0-beta.18
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 +27 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +27 -11
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/dropdown/Dropdown.js +24 -12
package/dist/index.esm.js
CHANGED
|
@@ -19604,6 +19604,19 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19604
19604
|
}
|
|
19605
19605
|
};
|
|
19606
19606
|
|
|
19607
|
+
var handleItemSelection = function handleItemSelection(evt, choice, i) {
|
|
19608
|
+
disabledValues.includes(choice.value) ? function (evt) {
|
|
19609
|
+
return evt.preventDefault();
|
|
19610
|
+
} : function () {
|
|
19611
|
+
setSelectedRef(optionRefs.current[i]);
|
|
19612
|
+
onSelect(choice.value);
|
|
19613
|
+
|
|
19614
|
+
if (isOpen) {
|
|
19615
|
+
_onClick();
|
|
19616
|
+
}
|
|
19617
|
+
};
|
|
19618
|
+
};
|
|
19619
|
+
|
|
19607
19620
|
useEffect$1(function () {
|
|
19608
19621
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
19609
19622
|
// WAI-ARIA requires the selected option to receive focus
|
|
@@ -19673,15 +19686,20 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19673
19686
|
minWidth: "100%",
|
|
19674
19687
|
name: autocompleteValue,
|
|
19675
19688
|
onFocus: function onFocus() {
|
|
19689
|
+
/*
|
|
19676
19690
|
if (!isOpen) {
|
|
19677
|
-
|
|
19691
|
+
onClick();
|
|
19678
19692
|
}
|
|
19693
|
+
*/
|
|
19679
19694
|
},
|
|
19680
19695
|
onChange: function onChange(e) {
|
|
19681
19696
|
console.log("current input value onChange", inputValue);
|
|
19682
19697
|
console.log("input change event", e.target);
|
|
19683
|
-
console.log("input change event value", e.target.value);
|
|
19684
|
-
|
|
19698
|
+
console.log("input change event value", e.target.value); // support autofill and copy/paste
|
|
19699
|
+
|
|
19700
|
+
if (e.tarvet.value !== inputValue) {
|
|
19701
|
+
setInputValue(e.target.value);
|
|
19702
|
+
}
|
|
19685
19703
|
},
|
|
19686
19704
|
padding: "12px",
|
|
19687
19705
|
placeholder: getSelection(),
|
|
@@ -19717,14 +19735,12 @@ var Dropdown = function Dropdown(_ref8) {
|
|
|
19717
19735
|
key: choice.value,
|
|
19718
19736
|
ref: optionRefs.current[i],
|
|
19719
19737
|
tabIndex: -1,
|
|
19720
|
-
onClick:
|
|
19721
|
-
return
|
|
19722
|
-
}
|
|
19723
|
-
|
|
19724
|
-
|
|
19725
|
-
|
|
19726
|
-
if (isOpen) {
|
|
19727
|
-
_onClick();
|
|
19738
|
+
onClick: function onClick(e) {
|
|
19739
|
+
return handleItemSelection(e, choice, i);
|
|
19740
|
+
},
|
|
19741
|
+
onKeyDown: function onKeyDown(e) {
|
|
19742
|
+
if (e.keyCode === 13) {
|
|
19743
|
+
handleItemSelection(e, choice, i);
|
|
19728
19744
|
}
|
|
19729
19745
|
},
|
|
19730
19746
|
selected: choice.value === value,
|