hplx-react-elements-dev 1.0.60 → 1.0.61

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.
Files changed (2) hide show
  1. package/dist/esm/index.js +55 -6
  2. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -2135,7 +2135,7 @@ var DropdownItems = function DropdownItems(_a) {
2135
2135
  onMouseDown: function onMouseDown(e) {
2136
2136
  !disabled && handleOnSelect(e);
2137
2137
  },
2138
- className: "hplxt-h-10 hplxt-flex hplxt-items-center hplxt-px-2 ".concat(disabled ? "hplxt-cursor-not-allowed" : "hover:hplxt-bg-Blue_gray-100 hplxt-cursor-pointer"),
2138
+ className: "hplxt-h-10 hplxt-flex hplxt-items-center hplxt-px-2 ".concat(disabled ? "hplxt-cursor-not-allowed" : "hover:hplxt-bg-Blue_gray-100 hplxt-cursor-pointer", " ").concat(className),
2139
2139
  onMouseEnter: onMouseEnterHandler,
2140
2140
  onMouseLeave: onMouseLeaveHandler
2141
2141
  }, {
@@ -17625,7 +17625,7 @@ var InputTag = function InputTag(_a) {
17625
17625
  var wrapperRef = useRef(null);
17626
17626
  var inputRef = useRef(null);
17627
17627
 
17628
- var _q = useState(),
17628
+ var _q = useState([]),
17629
17629
  dropdownArr = _q[0],
17630
17630
  setDropdownArr = _q[1];
17631
17631
 
@@ -17641,6 +17641,10 @@ var InputTag = function InputTag(_a) {
17641
17641
  setTags = _s[1]; // tag array
17642
17642
 
17643
17643
 
17644
+ var _t = useState(-1),
17645
+ focusIndex = _t[0],
17646
+ setFocusIndex = _t[1];
17647
+
17644
17648
  var handleValueChange = function handleValueChange(e) {
17645
17649
  var sug = [];
17646
17650
  setShowDropdown(true);
@@ -17660,6 +17664,7 @@ var InputTag = function InputTag(_a) {
17660
17664
 
17661
17665
  if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
17662
17666
  setShowDropdown(false);
17667
+ setFocusIndex(-1);
17663
17668
  }
17664
17669
  };
17665
17670
 
@@ -17674,6 +17679,7 @@ var InputTag = function InputTag(_a) {
17674
17679
  onDropdownClick && onDropdownClick(selectedItem);
17675
17680
  handleValChange && handleValChange(value);
17676
17681
  setShowDropdown(false);
17682
+ setFocusIndex(-1);
17677
17683
  };
17678
17684
 
17679
17685
  useEffect(function () {
@@ -17703,6 +17709,7 @@ var InputTag = function InputTag(_a) {
17703
17709
  }
17704
17710
 
17705
17711
  setShowDropdown(false);
17712
+ setFocusIndex(-1);
17706
17713
  setActive(false);
17707
17714
  onBlur && onBlur(event);
17708
17715
  };
@@ -17712,9 +17719,51 @@ var InputTag = function InputTag(_a) {
17712
17719
  setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue], false));
17713
17720
  setValue(tags.filter(Boolean).join(", "));
17714
17721
  setTagInputValue("");
17715
- }
17722
+ setFocusIndex(-1);
17723
+ handleValChange && handleValChange(value);
17724
+ } // on key down
17716
17725
 
17717
- handleValChange && handleValChange(value);
17726
+
17727
+ if (e.keyCode === 40) {
17728
+ if (focusIndex < dropdownArr.length - 1) {
17729
+ var focusI = focusIndex + 1;
17730
+
17731
+ if (wrapperRef && wrapperRef.current) {
17732
+ wrapperRef.current.scrollBy(0, 18);
17733
+ }
17734
+
17735
+ setFocusIndex(focusI); // setTagInputValue(dropdownArr[focusI].value);
17736
+ }
17737
+ } // on key up
17738
+
17739
+
17740
+ if (e.keyCode === 38) {
17741
+ if (focusIndex !== 0) {
17742
+ var focusI = focusIndex - 1;
17743
+
17744
+ if (wrapperRef && wrapperRef.current) {
17745
+ wrapperRef.current.scrollBy(0, -18);
17746
+ }
17747
+
17748
+ setFocusIndex(focusI); // setTagInputValue(dropdownArr[focusI].value);
17749
+ }
17750
+ } // on key left
17751
+
17752
+
17753
+ if (e.keyCode === 37) {
17754
+ if (focusIndex >= 0) {
17755
+ setFocusIndex(focusIndex);
17756
+ setTagInputValue(dropdownArr[focusIndex].value);
17757
+ }
17758
+ } // on key right
17759
+
17760
+
17761
+ if (e.keyCode === 39) {
17762
+ if (focusIndex !== 0) {
17763
+ setFocusIndex(focusIndex);
17764
+ setTagInputValue(dropdownArr[focusIndex].value);
17765
+ }
17766
+ }
17718
17767
  };
17719
17768
 
17720
17769
  var deleteTag = function deleteTag(_, del_index) {
@@ -17780,11 +17829,11 @@ var InputTag = function InputTag(_a) {
17780
17829
  }
17781
17830
  }, {
17782
17831
  children: dropdownArr && dropdownArr.length > 0 && jsxRuntime.exports.jsx("div", {
17783
- children: dropdownArr.map(function (option) {
17832
+ children: dropdownArr.map(function (option, index) {
17784
17833
  var restOptions = __rest(option || {}, []);
17785
17834
 
17786
17835
  return jsxRuntime.exports.jsx(DropdownItems, __assign({
17787
- className: "hplxt-text-Primary-700"
17836
+ className: "hplxt-text-Primary-700 ".concat(index === focusIndex ? "hplxt-bg-Blue_gray-100 hplxt-font-inter-1" : "")
17788
17837
  }, restOptions, {
17789
17838
  onSelect: function onSelect() {
17790
17839
  return handleDropdownClick(restOptions);
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.60",
12
+ "version": "1.0.61",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",