hplx-react-elements-dev 1.0.66 → 1.0.68

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 +48 -40
  2. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -17689,7 +17689,7 @@ 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);
@@ -17718,8 +17718,8 @@ var InputTag = function InputTag(_a) {
17718
17718
  };
17719
17719
 
17720
17720
  var handleBlur = function handleBlur(event) {
17721
- if (tagInputValue) {
17722
- setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue], false));
17721
+ if (tagInputValue.trim()) {
17722
+ setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue.trim()], false));
17723
17723
  setValue(tags.filter(Boolean).join(", "));
17724
17724
  setTagInputValue("");
17725
17725
  } //setShowDropdown(false);
@@ -17731,35 +17731,41 @@ var InputTag = function InputTag(_a) {
17731
17731
  };
17732
17732
 
17733
17733
  var addEditTags = function addEditTags(e) {
17734
- if (e.keyCode === 13 && editInputValue) {
17734
+ if (e.keyCode === 13 && editInputValue.trim()) {
17735
17735
  var newArr = __spreadArray([], tags, true);
17736
17736
 
17737
- newArr[editIndex] = editInputValue;
17737
+ newArr[editIndex] = editInputValue.trim();
17738
17738
  setTags(newArr);
17739
17739
  setValue(tags.filter(Boolean).join(", "));
17740
17740
  setEditIndex(-1);
17741
17741
  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
- // }
17742
+ } //on backspace
17753
17743
 
17744
+
17745
+ if (e.keyCode === 8 && !editInputValue) {
17746
+ deleteTag("", editIndex);
17747
+ setEditInputValue(tags[editIndex - 1] + " ");
17748
+ setEditIndex(function (prev) {
17749
+ return prev - 1;
17750
+ }); // setEditInputValue(tags[])
17751
+ }
17754
17752
  };
17755
17753
 
17756
17754
  var addTags = function addTags(e) {
17757
- if (e.keyCode === 13 && tagInputValue) {
17758
- setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue], false));
17755
+ if (e.keyCode === 13 && tagInputValue.trim()) {
17756
+ setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue.trim()], false));
17759
17757
  setValue(tags.filter(Boolean).join(", "));
17760
17758
  setTagInputValue("");
17761
17759
  setFocusIndex(-1);
17762
17760
  handleValChange && handleValChange(value);
17761
+ } //on backspace
17762
+
17763
+
17764
+ if (e.keyCode === 8 && !tagInputValue) {
17765
+ // deleteTag("", editIndex);
17766
+ setShowDropdown(false);
17767
+ setEditInputValue(tags[tags.length - 1] + " ");
17768
+ setEditIndex(tags.length - 1); // setEditInputValue(tags[])
17763
17769
  } // on key down
17764
17770
 
17765
17771
 
@@ -17830,44 +17836,46 @@ var InputTag = function InputTag(_a) {
17830
17836
  type: "text",
17831
17837
  value: editInputValue,
17832
17838
  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",
17839
+ 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
17840
  onChange: function onChange(e) {
17835
17841
  setEditInputValue(e.target.value);
17836
-
17837
- if ((editInputValue === null || editInputValue === void 0 ? void 0 : editInputValue.length) === 0) {
17838
- deleteTag("", editIndex);
17839
- }
17840
17842
  },
17841
17843
  onKeyDown: addEditTags,
17842
17844
  onBlur: function onBlur() {
17843
- var newArr = __spreadArray([], tags, true);
17845
+ if (editInputValue.trim()) {
17846
+ var newArr = __spreadArray([], tags, true);
17847
+
17848
+ newArr[index] = editInputValue.trim();
17849
+ setTags(newArr);
17850
+ setValue(tags.filter(Boolean).join(", "));
17851
+ } else deleteTag("", editIndex);
17844
17852
 
17845
- newArr[index] = editInputValue;
17846
- setTags(newArr);
17847
- setValue(tags.filter(Boolean).join(", "));
17848
17853
  setEditIndex(-1);
17849
17854
  setEditInputValue("");
17850
17855
  }
17851
- }) : jsxRuntime.exports.jsxs("button", __assign({
17852
- className: "hplxt-flex hplxt-items-center hplxt-bg-Primary-50 hplxt-border-1 hplxt-rounded hplxt-border-Primary-100 hplxt-py-1 hplxt-px-2",
17853
- onClick: function onClick() {
17854
- setEditIndex(index);
17855
- setEditInputValue(item);
17856
- }
17856
+ }) : jsxRuntime.exports.jsxs("div", __assign({
17857
+ className: "hplxt-flex hplxt-items-center hplxt-bg-Primary-50 hplxt-border-1 hplxt-rounded hplxt-border-Primary-100 hplxt-py-1 hplxt-px-2"
17857
17858
  }, {
17858
- children: [jsxRuntime.exports.jsx(Typography, __assign({
17859
- variant: "Semibold",
17860
- type: "Text sm",
17861
- className: "hplxt-text-Gray-600"
17859
+ children: [jsxRuntime.exports.jsx("button", __assign({
17860
+ onClick: function onClick() {
17861
+ setEditIndex(index);
17862
+ setEditInputValue(item);
17863
+ }
17862
17864
  }, {
17863
- children: item
17864
- })), jsxRuntime.exports.jsx("div", {
17865
+ children: jsxRuntime.exports.jsx(Typography, __assign({
17866
+ variant: "Semibold",
17867
+ type: "Text sm",
17868
+ className: "hplxt-text-Gray-600"
17869
+ }, {
17870
+ children: item
17871
+ }))
17872
+ }), index), jsxRuntime.exports.jsx("i", {
17865
17873
  className: "hx_close hplxt-text-[75%] hplxt-text-Primary-700",
17866
17874
  onClick: function onClick() {
17867
17875
  return deleteTag(item, index);
17868
17876
  }
17869
17877
  })]
17870
- }), index);
17878
+ }));
17871
17879
  }), jsxRuntime.exports.jsx("input", __assign({
17872
17880
  type: "text",
17873
17881
  value: tagInputValue,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.66",
12
+ "version": "1.0.68",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",