hplx-react-elements-dev 1.0.67 → 1.0.69

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 +34 -24
  2. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -2138,7 +2138,7 @@ var DropdownItems = function DropdownItems(_a) {
2138
2138
  };
2139
2139
 
2140
2140
  return jsxRuntime.exports.jsxs("div", __assign({
2141
- onMouseDown: function onMouseDown(e) {
2141
+ onMouseUp: function onMouseUp(e) {
2142
2142
  !disabled && handleOnSelect(e);
2143
2143
  },
2144
2144
  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),
@@ -17689,13 +17689,14 @@ var InputTag = function InputTag(_a) {
17689
17689
  return __spreadArray(__spreadArray([], prev, true), [selectedItem.value], false);
17690
17690
  });
17691
17691
  setValue(function (prev) {
17692
- return prev + ", " + selectedItem.value;
17692
+ return prev.trim() + ", " + selectedItem.value;
17693
17693
  });
17694
17694
  setTagInputValue("");
17695
17695
  onDropdownClick && onDropdownClick(selectedItem);
17696
17696
  handleValChange && handleValChange(value); // setShowDropdown(false);
17697
17697
 
17698
17698
  setFocusIndex(-1);
17699
+ setDropdownArr(options);
17699
17700
  };
17700
17701
 
17701
17702
  useEffect(function () {
@@ -17718,8 +17719,8 @@ var InputTag = function InputTag(_a) {
17718
17719
  };
17719
17720
 
17720
17721
  var handleBlur = function handleBlur(event) {
17721
- if (tagInputValue) {
17722
- setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue], false));
17722
+ if (tagInputValue.trim()) {
17723
+ setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue.trim()], false));
17723
17724
  setValue(tags.filter(Boolean).join(", "));
17724
17725
  setTagInputValue("");
17725
17726
  } //setShowDropdown(false);
@@ -17731,35 +17732,41 @@ var InputTag = function InputTag(_a) {
17731
17732
  };
17732
17733
 
17733
17734
  var addEditTags = function addEditTags(e) {
17734
- if (e.keyCode === 13 && editInputValue) {
17735
+ if (e.keyCode === 13 && editInputValue.trim()) {
17735
17736
  var newArr = __spreadArray([], tags, true);
17736
17737
 
17737
- newArr[editIndex] = editInputValue;
17738
+ newArr[editIndex] = editInputValue.trim();
17738
17739
  setTags(newArr);
17739
17740
  setValue(tags.filter(Boolean).join(", "));
17740
17741
  setEditIndex(-1);
17741
17742
  setEditInputValue("");
17742
- } // if (Boolean(!tagInputValue) && e.keyCode === 8) {
17743
- // setEditIndex(tags.length - 1);
17744
- // setEditInputValue(tags[tags.length - 1]);
17745
- // editRef.current && editRef.current.focus();
17746
- // if (Boolean(!editInputValue) && e.keyCode === 8) {
17747
- // deleteTag("", editIndex);
17748
- // setEditIndex((prev) => prev - 1);
17749
- // setEditInputValue(tags[editIndex]);
17750
- // editRef.current && editRef.current.focus();
17751
- // }
17752
- // }
17743
+ } //on backspace
17744
+
17753
17745
 
17746
+ if (e.keyCode === 8 && !editInputValue) {
17747
+ deleteTag("", editIndex);
17748
+ setEditInputValue(tags[editIndex - 1] + " ");
17749
+ setEditIndex(function (prev) {
17750
+ return prev - 1;
17751
+ }); // setEditInputValue(tags[])
17752
+ }
17754
17753
  };
17755
17754
 
17756
17755
  var addTags = function addTags(e) {
17757
- if (e.keyCode === 13 && tagInputValue) {
17758
- setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue], false));
17756
+ if (e.keyCode === 13 && tagInputValue.trim()) {
17757
+ setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue.trim()], false));
17759
17758
  setValue(tags.filter(Boolean).join(", "));
17760
17759
  setTagInputValue("");
17761
17760
  setFocusIndex(-1);
17762
17761
  handleValChange && handleValChange(value);
17762
+ } //on backspace
17763
+
17764
+
17765
+ if (e.keyCode === 8 && !tagInputValue) {
17766
+ // deleteTag("", editIndex);
17767
+ setShowDropdown(false);
17768
+ setEditInputValue(tags[tags.length - 1] + " ");
17769
+ setEditIndex(tags.length - 1); // setEditInputValue(tags[])
17763
17770
  } // on key down
17764
17771
 
17765
17772
 
@@ -17830,17 +17837,20 @@ var InputTag = function InputTag(_a) {
17830
17837
  type: "text",
17831
17838
  value: editInputValue,
17832
17839
  ref: editRef,
17833
- className: " placeholder:hplxt-text-Gray-500 focus-visible:hplxt-outline-0 hplxt-border-0 hplxt-rounded hplxt-py-1 hplxt-px-2 hplxt-bg-Primary-50 focus:hplxt-border-0",
17840
+ className: "hplxt-flex hplxt-flex-1 placeholder:hplxt-text-Gray-500 focus-visible:hplxt-outline-0 hplxt-border-0 hplxt-rounded hplxt-py-1 hplxt-px-2 hplxt-bg-Primary-50 focus:hplxt-border-0",
17834
17841
  onChange: function onChange(e) {
17835
17842
  setEditInputValue(e.target.value);
17836
17843
  },
17837
17844
  onKeyDown: addEditTags,
17838
17845
  onBlur: function onBlur() {
17839
- var newArr = __spreadArray([], tags, true);
17846
+ if (editInputValue.trim()) {
17847
+ var newArr = __spreadArray([], tags, true);
17848
+
17849
+ newArr[index] = editInputValue.trim();
17850
+ setTags(newArr);
17851
+ setValue(tags.filter(Boolean).join(", "));
17852
+ } else deleteTag("", editIndex);
17840
17853
 
17841
- newArr[index] = editInputValue;
17842
- setTags(newArr);
17843
- setValue(tags.filter(Boolean).join(", "));
17844
17854
  setEditIndex(-1);
17845
17855
  setEditInputValue("");
17846
17856
  }
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.67",
12
+ "version": "1.0.69",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",