hplx-react-elements-dev 1.0.75 → 1.0.76

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 +51 -23
  2. package/package.json +1 -1
package/dist/esm/index.js CHANGED
@@ -17722,6 +17722,7 @@ var InputTag = function InputTag(_a) {
17722
17722
  var inputRef = useRef(null);
17723
17723
  var ddRef = useRef(null);
17724
17724
  var editRef = useRef(null);
17725
+ var spanRef = useRef(null);
17725
17726
 
17726
17727
  var _o = useState([]),
17727
17728
  dropdownArr = _o[0],
@@ -17757,6 +17758,14 @@ var InputTag = function InputTag(_a) {
17757
17758
 
17758
17759
  var dropdownClickedRef = useRef(false);
17759
17760
 
17761
+ var _v = useState(""),
17762
+ content = _v[0],
17763
+ setContent = _v[1];
17764
+
17765
+ var _w = useState(0),
17766
+ width = _w[0],
17767
+ setWidth = _w[1];
17768
+
17760
17769
  var handleValueChange = function handleValueChange(e) {
17761
17770
  var sug = [];
17762
17771
  setShowDropdown(true);
@@ -17806,6 +17815,11 @@ var InputTag = function InputTag(_a) {
17806
17815
  document.removeEventListener("mousedown", handleClickOutside);
17807
17816
  };
17808
17817
  });
17818
+ useEffect(function () {
17819
+ var _a;
17820
+
17821
+ setWidth(((_a = spanRef === null || spanRef === void 0 ? void 0 : spanRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 0);
17822
+ }, [content]);
17809
17823
 
17810
17824
  var handleFocus = function handleFocus(event) {
17811
17825
  var _a;
@@ -17946,34 +17960,48 @@ var InputTag = function InputTag(_a) {
17946
17960
  className: "inputTag hplxt-w-auto hplxt-h-auto hplxt-gap-1 hplxt-p-1.5 hplxt-flex hplxt-flex-wrap hplxt-border-1 hplxt-rounded-lg hplxt-border-Blue_gray-100 hover:hplxt-border-Primary-300 hover:hplxt-shadow-xs-primary ".concat(active ? "hplxt-border-Primary-300 hplxt-shadow-xs-primary" : "", " ").concat(disabled ? "hplxt-bg-Gray-50" : "", " ").concat(className)
17947
17961
  }, {
17948
17962
  children: [tags.map(function (item, index) {
17949
- return index === editIndex ? jsxRuntime.exports.jsx("input", {
17950
- type: "text",
17951
- value: editInputValue,
17952
- ref: editRef,
17953
- 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",
17954
- onChange: function onChange(e) {
17955
- setEditInputValue(e.target.value);
17956
- },
17957
- onKeyDown: addEditTags,
17958
- onBlur: function onBlur() {
17959
- if (editInputValue.trim()) {
17960
- var newArr = __spreadArray([], tags, true);
17961
-
17962
- newArr[index] = editInputValue.trim();
17963
- setTags(newArr);
17964
- setValue(tags.filter(Boolean).join(", "));
17965
- } else deleteTag("", editIndex);
17966
-
17967
- setEditIndex(-1);
17968
- setEditInputValue("");
17969
- }
17970
- }) : jsxRuntime.exports.jsxs("div", __assign({
17963
+ return index === editIndex ? jsxRuntime.exports.jsxs("div", {
17964
+ children: [jsxRuntime.exports.jsx("input", {
17965
+ type: "text",
17966
+ value: editInputValue,
17967
+ ref: editRef,
17968
+ className: " 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",
17969
+ onChange: function onChange(e) {
17970
+ setEditInputValue(e.target.value);
17971
+ setContent(e.target.value);
17972
+ },
17973
+ style: {
17974
+ width: width + 30
17975
+ },
17976
+ onKeyDown: addEditTags,
17977
+ onBlur: function onBlur() {
17978
+ if (editInputValue.trim()) {
17979
+ var newArr = __spreadArray([], tags, true);
17980
+
17981
+ newArr[index] = editInputValue.trim();
17982
+ setTags(newArr);
17983
+ setValue(tags.filter(Boolean).join(", "));
17984
+ } else deleteTag("", editIndex);
17985
+
17986
+ setEditIndex(-1);
17987
+ setEditInputValue("");
17988
+ setContent("");
17989
+ }
17990
+ }), jsxRuntime.exports.jsx("span", __assign({
17991
+ id: "hide",
17992
+ ref: spanRef,
17993
+ className: "hplxt-opacity-0 hplxt-absolute"
17994
+ }, {
17995
+ children: content
17996
+ }))]
17997
+ }, item) : jsxRuntime.exports.jsxs("div", __assign({
17971
17998
  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"
17972
17999
  }, {
17973
18000
  children: [jsxRuntime.exports.jsx("button", __assign({
17974
18001
  onClick: function onClick() {
17975
18002
  setEditIndex(index);
17976
18003
  setEditInputValue(item);
18004
+ setContent(item);
17977
18005
  }
17978
18006
  }, {
17979
18007
  children: jsxRuntime.exports.jsx(Typography, __assign({
@@ -17989,7 +18017,7 @@ var InputTag = function InputTag(_a) {
17989
18017
  return deleteTag(item, index);
17990
18018
  }
17991
18019
  })]
17992
- }));
18020
+ }), item);
17993
18021
  }), jsxRuntime.exports.jsx("input", __assign({
17994
18022
  type: "text",
17995
18023
  value: tagInputValue,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.75",
12
+ "version": "1.0.76",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",