hplx-react-elements-dev 1.0.70 → 1.0.72

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.
@@ -27,3 +27,4 @@ export { default as NestedDropdown } from "./nestedDropdown/NestedDropdown";
27
27
  export { default as DatePicker } from "./datePicker/DatePicker";
28
28
  export { default as DoubleInput } from "./doubleInput/DoubleInput";
29
29
  export { default as InputTag } from "./inputTag/InputTag";
30
+ export { default as InputTagDropdownItem } from "./inputTag/InputTagDropdownItem";
package/dist/esm/index.js CHANGED
@@ -17587,37 +17587,127 @@ var DoubleInput = function DoubleInput(_a) {
17587
17587
  }));
17588
17588
  };
17589
17589
 
17590
+ var InputTagDropdownItem = function InputTagDropdownItem(_a) {
17591
+ var className = _a.className,
17592
+ label = _a.label,
17593
+ value = _a.value,
17594
+ disabled = _a.disabled,
17595
+ start_icon = _a.start_icon,
17596
+ _b = _a.active,
17597
+ active = _b === void 0 ? false : _b,
17598
+ end_icon = _a.end_icon,
17599
+ onSelect = _a.onSelect,
17600
+ ddRef = _a.ddRef,
17601
+ setChangeLeft = _a.setChangeLeft;
17602
+
17603
+ var _c = useState(false),
17604
+ hover = _c[0],
17605
+ setHover = _c[1];
17606
+
17607
+ useEffect(function () {
17608
+ if ((ddRef === null || ddRef === void 0 ? void 0 : ddRef.current.clientWidth) > 1300) setChangeLeft(false);
17609
+ }, []);
17610
+
17611
+ var onMouseEnterHandler = function onMouseEnterHandler() {
17612
+ setHover(true);
17613
+ };
17614
+
17615
+ var onMouseLeaveHandler = function onMouseLeaveHandler() {
17616
+ setHover(false);
17617
+ };
17618
+
17619
+ var ref = useRef(null);
17620
+
17621
+ var checkOverFlow = function checkOverFlow() {
17622
+ var element = ref.current;
17623
+
17624
+ if (element) {
17625
+ return element.scrollWidth > element.offsetWidth;
17626
+ }
17627
+
17628
+ return false;
17629
+ };
17630
+
17631
+ var handleOnSelect = function handleOnSelect(e) {
17632
+ e.stopPropagation();
17633
+ onSelect && onSelect(value);
17634
+ };
17635
+
17636
+ return jsxRuntime.exports.jsxs("div", __assign({
17637
+ onMouseUp: function onMouseUp(e) {
17638
+ !disabled && handleOnSelect(e);
17639
+ },
17640
+ 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),
17641
+ onMouseEnter: onMouseEnterHandler,
17642
+ onMouseLeave: onMouseLeaveHandler,
17643
+ style: {
17644
+ maxWidth: '93.5vw'
17645
+ },
17646
+ ref: ddRef
17647
+ }, {
17648
+ children: [Boolean(start_icon) && jsxRuntime.exports.jsx("div", __assign({
17649
+ className: "hplxt-mr-2 ".concat(disabled ? "hplxt-text-Gray-200" : hover ? "hplxt-text-Gray-700" : "hplxt-text-Gray-500")
17650
+ }, {
17651
+ children: jsxRuntime.exports.jsx("span", {
17652
+ className: start_icon
17653
+ })
17654
+ })), jsxRuntime.exports.jsx(Typography, __assign({
17655
+ variant: hover && !disabled ? "Medium" : "Regular",
17656
+ type: "Text md",
17657
+ className: "hplxt-w-64 hplxt-overflow-hidden"
17658
+ }, {
17659
+ children: jsxRuntime.exports.jsx("div", __assign({
17660
+ className: "hplxt-flex-1 hplxt-truncate hplxt-overflow-hidden hplxt-line-clamp-3 ".concat(disabled ? "hplxt-text-Gray-200" : "hplxt-text-Gray-700", " ").concat(className),
17661
+ title: checkOverFlow() ? label : undefined,
17662
+ ref: ref
17663
+ }, {
17664
+ children: label
17665
+ }))
17666
+ })), Boolean(end_icon) && jsxRuntime.exports.jsx("div", __assign({
17667
+ className: "hplxt-ml-2 ".concat(!disabled && (hover || active) ? "hplxt-text-Primary-700" : "hplxt-text-Gray-200")
17668
+ }, {
17669
+ children: jsxRuntime.exports.jsx("span", {
17670
+ className: end_icon
17671
+ })
17672
+ }))]
17673
+ }));
17674
+ };
17675
+
17590
17676
  var InputTag = function InputTag(_a) {
17591
- var _b, _c;
17677
+ var _b;
17592
17678
 
17593
17679
  var inputProps = _a.inputProps,
17594
17680
  className = _a.className,
17595
17681
  dropdownClassName = _a.dropdownClassName,
17596
- _d = _a.options,
17597
- options = _d === void 0 ? [] : _d,
17598
- _e = _a.tagList,
17599
- tagList = _e === void 0 ? [] : _e,
17600
- _f = _a.tagString,
17601
- tagString = _f === void 0 ? "" : _f,
17682
+ _c = _a.options,
17683
+ options = _c === void 0 ? [] : _c,
17684
+ _d = _a.tagList,
17685
+ tagList = _d === void 0 ? [] : _d,
17686
+ _e = _a.tagString,
17687
+ tagString = _e === void 0 ? "" : _e,
17602
17688
  // comma separated string which is created into separate tags
17603
- _g = _a.handleValChange,
17689
+ _f = _a.handleValChange,
17604
17690
  // comma separated string which is created into separate tags
17605
- handleValChange = _g === void 0 ? function (_) {} : _g,
17606
- _h = _a.onDropdownClick,
17607
- onDropdownClick = _h === void 0 ? function (_) {} : _h;
17691
+ handleValChange = _f === void 0 ? function (_) {} : _f,
17692
+ _g = _a.onDropdownClick,
17693
+ onDropdownClick = _g === void 0 ? function (_) {} : _g;
17694
+
17695
+ var _h = inputProps || {},
17696
+ disabled = _h.disabled,
17697
+ onFocus = _h.onFocus,
17698
+ onBlur = _h.onBlur;
17608
17699
 
17609
- var _j = inputProps || {},
17610
- disabled = _j.disabled,
17611
- onFocus = _j.onFocus,
17612
- onBlur = _j.onBlur;
17700
+ var _j = useState(false),
17701
+ active = _j[0],
17702
+ setActive = _j[1];
17613
17703
 
17614
17704
  var _k = useState(false),
17615
- active = _k[0],
17616
- setActive = _k[1];
17705
+ showDropdown = _k[0],
17706
+ setShowDropdown = _k[1];
17617
17707
 
17618
- var _l = useState(false),
17619
- showDropdown = _l[0],
17620
- setShowDropdown = _l[1];
17708
+ var _l = useState(''),
17709
+ dropdownOffset = _l[0],
17710
+ setdropdownOffset = _l[1];
17621
17711
 
17622
17712
  var _m = useState(""),
17623
17713
  value = _m[0],
@@ -17693,8 +17783,7 @@ var InputTag = function InputTag(_a) {
17693
17783
  });
17694
17784
  setTagInputValue("");
17695
17785
  onDropdownClick && onDropdownClick(selectedItem);
17696
- handleValChange && handleValChange(value); // setShowDropdown(false);
17697
-
17786
+ handleValChange && handleValChange(value);
17698
17787
  setFocusIndex(-1);
17699
17788
  setDropdownArr(options);
17700
17789
  };
@@ -17713,6 +17802,9 @@ var InputTag = function InputTag(_a) {
17713
17802
  });
17714
17803
 
17715
17804
  var handleFocus = function handleFocus(event) {
17805
+ var _a;
17806
+
17807
+ setdropdownOffset("".concat((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.offsetLeft, "px"));
17716
17808
  setShowDropdown(true);
17717
17809
  setActive(true);
17718
17810
  onFocus && onFocus(event);
@@ -17723,8 +17815,7 @@ var InputTag = function InputTag(_a) {
17723
17815
  setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue.trim()], false));
17724
17816
  setValue(tags.filter(Boolean).join(", "));
17725
17817
  setTagInputValue("");
17726
- } //setShowDropdown(false);
17727
-
17818
+ }
17728
17819
 
17729
17820
  setFocusIndex(-1);
17730
17821
  setActive(false);
@@ -17732,6 +17823,8 @@ var InputTag = function InputTag(_a) {
17732
17823
  };
17733
17824
 
17734
17825
  var addEditTags = function addEditTags(e) {
17826
+ var _a;
17827
+
17735
17828
  if (e.keyCode === 13 && editInputValue.trim()) {
17736
17829
  var newArr = __spreadArray([], tags, true);
17737
17830
 
@@ -17740,6 +17833,8 @@ var InputTag = function InputTag(_a) {
17740
17833
  setValue(tags.filter(Boolean).join(", "));
17741
17834
  setEditIndex(-1);
17742
17835
  setEditInputValue("");
17836
+ inputRef.current && inputRef.current.focus();
17837
+ setdropdownOffset("".concat((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.offsetLeft, "px"));
17743
17838
  } //on backspace
17744
17839
 
17745
17840
 
@@ -17748,7 +17843,7 @@ var InputTag = function InputTag(_a) {
17748
17843
  setEditInputValue(tags[editIndex - 1] + " ");
17749
17844
  setEditIndex(function (prev) {
17750
17845
  return prev - 1;
17751
- }); // setEditInputValue(tags[])
17846
+ });
17752
17847
  }
17753
17848
  };
17754
17849
 
@@ -17763,10 +17858,9 @@ var InputTag = function InputTag(_a) {
17763
17858
 
17764
17859
 
17765
17860
  if (e.keyCode === 8 && !tagInputValue) {
17766
- // deleteTag("", editIndex);
17767
17861
  setShowDropdown(false);
17768
17862
  setEditInputValue(tags[tags.length - 1] + " ");
17769
- setEditIndex(tags.length - 1); // setEditInputValue(tags[])
17863
+ setEditIndex(tags.length - 1);
17770
17864
  } // on key down
17771
17865
 
17772
17866
 
@@ -17778,7 +17872,7 @@ var InputTag = function InputTag(_a) {
17778
17872
  wrapperRef.current.scrollBy(0, 18);
17779
17873
  }
17780
17874
 
17781
- setFocusIndex(focusI); // setTagInputValue(dropdownArr[focusI].value);
17875
+ setFocusIndex(focusI);
17782
17876
  }
17783
17877
  } // on key up
17784
17878
 
@@ -17791,7 +17885,7 @@ var InputTag = function InputTag(_a) {
17791
17885
  wrapperRef.current.scrollBy(0, -18);
17792
17886
  }
17793
17887
 
17794
- setFocusIndex(focusI); // setTagInputValue(dropdownArr[focusI].value);
17888
+ setFocusIndex(focusI);
17795
17889
  }
17796
17890
  } // on key left
17797
17891
 
@@ -17825,9 +17919,13 @@ var InputTag = function InputTag(_a) {
17825
17919
  handleValChange && handleValChange(tags.filter(Boolean).join(", "));
17826
17920
  }, [tags]);
17827
17921
  useEffect(function () {
17922
+ var _a;
17923
+
17828
17924
  if (editIndex >= 0) {
17829
17925
  editRef.current && editRef.current.focus();
17830
17926
  }
17927
+
17928
+ setdropdownOffset("".concat((_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.offsetLeft, "px"));
17831
17929
  }, [editIndex]);
17832
17930
  return jsxRuntime.exports.jsxs("div", __assign({
17833
17931
  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)
@@ -17898,15 +17996,15 @@ var InputTag = function InputTag(_a) {
17898
17996
  ref: wrapperRef,
17899
17997
  className: "hplxt-absolute hplxt-border hplxt-border-Gray-300 hplxt-mt-1 hplxt-min-w-max hplxt-rounded-lg hplxt-bg-Indigo-25 hplxt-overflow-y-auto hplxt-shadow-md hplxt-z-10 hplxt-max-h-80 ".concat(dropdownClassName),
17900
17998
  style: {
17901
- left: changeLeft ? "".concat((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.offsetLeft, "px") : "",
17902
- top: "".concat((((_c = inputRef.current) === null || _c === void 0 ? void 0 : _c.offsetTop) || 0) + 30, "px")
17999
+ left: changeLeft ? dropdownOffset : "",
18000
+ top: "".concat((((_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.offsetTop) || 0) + 30, "px")
17903
18001
  }
17904
18002
  }, {
17905
18003
  children: dropdownArr && dropdownArr.length > 0 && jsxRuntime.exports.jsx("div", {
17906
18004
  children: dropdownArr.map(function (option, index) {
17907
18005
  var restOptions = __rest(option || {}, []);
17908
18006
 
17909
- return jsxRuntime.exports.jsx(DropdownItems, __assign({
18007
+ return jsxRuntime.exports.jsx(InputTagDropdownItem, __assign({
17910
18008
  className: "hplxt-text-Primary-700 ".concat(index === focusIndex ? "hplxt-bg-Blue_gray-100 hplxt-font-inter-1" : "")
17911
18009
  }, restOptions, {
17912
18010
  onSelect: function onSelect() {
@@ -17921,4 +18019,4 @@ var InputTag = function InputTag(_a) {
17921
18019
  }));
17922
18020
  };
17923
18021
 
17924
- export { AddSuggestion, Avatar, Badge, BadgeGroup, Button, ButtonGroups, Card, Checkbox, CheckboxGroup, CheckboxGroupItem, CollapsibleCard, DatePicker, DoubleInput, DropdownField, DropdownItems as DropdownItem, InputField, InputFieldSplit, InputTag, MessageToast, NestedDropdown, OtpField, ProgressBar, ProgressCircle, RadioBtn, Slider, TextAreaField, ToggleSwitch, Tooltip, Typography };
18022
+ export { AddSuggestion, Avatar, Badge, BadgeGroup, Button, ButtonGroups, Card, Checkbox, CheckboxGroup, CheckboxGroupItem, CollapsibleCard, DatePicker, DoubleInput, DropdownField, DropdownItems as DropdownItem, InputField, InputFieldSplit, InputTag, InputTagDropdownItem, MessageToast, NestedDropdown, OtpField, ProgressBar, ProgressCircle, RadioBtn, Slider, TextAreaField, ToggleSwitch, Tooltip, Typography };
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { DropdownItemsProps } from "../types";
3
+ declare const InputTagDropdownItem: ({ className, label, value, disabled, start_icon, active, end_icon, onSelect, ddRef, setChangeLeft }: DropdownItemsProps) => JSX.Element;
4
+ export default InputTagDropdownItem;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.0.70",
12
+ "version": "1.0.72",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",