hplx-react-elements-dev 1.0.60 → 1.0.62
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ButtonGroupsProps } from "../types";
|
|
3
|
-
declare const ButtonGroups: ({ options, disabled, value, onChange, ...ButtonGroupsProps }: ButtonGroupsProps) => JSX.Element;
|
|
3
|
+
declare const ButtonGroups: ({ options, disabled, value, onChange, className, style, ...ButtonGroupsProps }: ButtonGroupsProps) => JSX.Element;
|
|
4
4
|
export default ButtonGroups;
|
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
|
}, {
|
|
@@ -2893,11 +2893,14 @@ var ButtonGroups = function ButtonGroups(_a) {
|
|
|
2893
2893
|
disabled = _b === void 0 ? false : _b,
|
|
2894
2894
|
value = _a.value,
|
|
2895
2895
|
onChange = _a.onChange,
|
|
2896
|
-
|
|
2896
|
+
_c = _a.className,
|
|
2897
|
+
className = _c === void 0 ? '' : _c,
|
|
2898
|
+
style = _a.style,
|
|
2899
|
+
ButtonGroupsProps = __rest(_a, ["options", "disabled", "value", "onChange", "className", "style"]);
|
|
2897
2900
|
|
|
2898
|
-
var
|
|
2899
|
-
hovered =
|
|
2900
|
-
setHovered =
|
|
2901
|
+
var _d = useState(-1),
|
|
2902
|
+
hovered = _d[0],
|
|
2903
|
+
setHovered = _d[1]; // const touch = touched && touched[name];
|
|
2901
2904
|
// const error = errors && errors[name];
|
|
2902
2905
|
// const errorMsg = touch && error ? error : undefined;
|
|
2903
2906
|
|
|
@@ -2919,7 +2922,8 @@ var ButtonGroups = function ButtonGroups(_a) {
|
|
|
2919
2922
|
};
|
|
2920
2923
|
|
|
2921
2924
|
return jsxRuntime.exports.jsx("div", __assign({
|
|
2922
|
-
className: "hplxt-border-1 hplxt-border-Gray-300 hplxt-rounded-lg hplxt-flex hplxt-overflow-hidden"
|
|
2925
|
+
className: "hplxt-border-1 hplxt-border-Gray-300 hplxt-rounded-lg hplxt-flex hplxt-overflow-hidden ".concat(className),
|
|
2926
|
+
style: style
|
|
2923
2927
|
}, {
|
|
2924
2928
|
children: !!options && options.constructor === Array && options.map(function (option, index) {
|
|
2925
2929
|
var _a = option || {},
|
|
@@ -17625,7 +17629,7 @@ var InputTag = function InputTag(_a) {
|
|
|
17625
17629
|
var wrapperRef = useRef(null);
|
|
17626
17630
|
var inputRef = useRef(null);
|
|
17627
17631
|
|
|
17628
|
-
var _q = useState(),
|
|
17632
|
+
var _q = useState([]),
|
|
17629
17633
|
dropdownArr = _q[0],
|
|
17630
17634
|
setDropdownArr = _q[1];
|
|
17631
17635
|
|
|
@@ -17641,6 +17645,10 @@ var InputTag = function InputTag(_a) {
|
|
|
17641
17645
|
setTags = _s[1]; // tag array
|
|
17642
17646
|
|
|
17643
17647
|
|
|
17648
|
+
var _t = useState(-1),
|
|
17649
|
+
focusIndex = _t[0],
|
|
17650
|
+
setFocusIndex = _t[1];
|
|
17651
|
+
|
|
17644
17652
|
var handleValueChange = function handleValueChange(e) {
|
|
17645
17653
|
var sug = [];
|
|
17646
17654
|
setShowDropdown(true);
|
|
@@ -17660,6 +17668,7 @@ var InputTag = function InputTag(_a) {
|
|
|
17660
17668
|
|
|
17661
17669
|
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
17662
17670
|
setShowDropdown(false);
|
|
17671
|
+
setFocusIndex(-1);
|
|
17663
17672
|
}
|
|
17664
17673
|
};
|
|
17665
17674
|
|
|
@@ -17674,6 +17683,7 @@ var InputTag = function InputTag(_a) {
|
|
|
17674
17683
|
onDropdownClick && onDropdownClick(selectedItem);
|
|
17675
17684
|
handleValChange && handleValChange(value);
|
|
17676
17685
|
setShowDropdown(false);
|
|
17686
|
+
setFocusIndex(-1);
|
|
17677
17687
|
};
|
|
17678
17688
|
|
|
17679
17689
|
useEffect(function () {
|
|
@@ -17703,6 +17713,7 @@ var InputTag = function InputTag(_a) {
|
|
|
17703
17713
|
}
|
|
17704
17714
|
|
|
17705
17715
|
setShowDropdown(false);
|
|
17716
|
+
setFocusIndex(-1);
|
|
17706
17717
|
setActive(false);
|
|
17707
17718
|
onBlur && onBlur(event);
|
|
17708
17719
|
};
|
|
@@ -17712,9 +17723,51 @@ var InputTag = function InputTag(_a) {
|
|
|
17712
17723
|
setTags(__spreadArray(__spreadArray([], tags, true), [tagInputValue], false));
|
|
17713
17724
|
setValue(tags.filter(Boolean).join(", "));
|
|
17714
17725
|
setTagInputValue("");
|
|
17715
|
-
|
|
17726
|
+
setFocusIndex(-1);
|
|
17727
|
+
handleValChange && handleValChange(value);
|
|
17728
|
+
} // on key down
|
|
17716
17729
|
|
|
17717
|
-
|
|
17730
|
+
|
|
17731
|
+
if (e.keyCode === 40) {
|
|
17732
|
+
if (focusIndex < dropdownArr.length - 1) {
|
|
17733
|
+
var focusI = focusIndex + 1;
|
|
17734
|
+
|
|
17735
|
+
if (wrapperRef && wrapperRef.current) {
|
|
17736
|
+
wrapperRef.current.scrollBy(0, 18);
|
|
17737
|
+
}
|
|
17738
|
+
|
|
17739
|
+
setFocusIndex(focusI); // setTagInputValue(dropdownArr[focusI].value);
|
|
17740
|
+
}
|
|
17741
|
+
} // on key up
|
|
17742
|
+
|
|
17743
|
+
|
|
17744
|
+
if (e.keyCode === 38) {
|
|
17745
|
+
if (focusIndex !== 0) {
|
|
17746
|
+
var focusI = focusIndex - 1;
|
|
17747
|
+
|
|
17748
|
+
if (wrapperRef && wrapperRef.current) {
|
|
17749
|
+
wrapperRef.current.scrollBy(0, -18);
|
|
17750
|
+
}
|
|
17751
|
+
|
|
17752
|
+
setFocusIndex(focusI); // setTagInputValue(dropdownArr[focusI].value);
|
|
17753
|
+
}
|
|
17754
|
+
} // on key left
|
|
17755
|
+
|
|
17756
|
+
|
|
17757
|
+
if (e.keyCode === 37) {
|
|
17758
|
+
if (focusIndex >= 0) {
|
|
17759
|
+
setFocusIndex(focusIndex);
|
|
17760
|
+
setTagInputValue(dropdownArr[focusIndex].value);
|
|
17761
|
+
}
|
|
17762
|
+
} // on key right
|
|
17763
|
+
|
|
17764
|
+
|
|
17765
|
+
if (e.keyCode === 39) {
|
|
17766
|
+
if (focusIndex !== 0) {
|
|
17767
|
+
setFocusIndex(focusIndex);
|
|
17768
|
+
setTagInputValue(dropdownArr[focusIndex].value);
|
|
17769
|
+
}
|
|
17770
|
+
}
|
|
17718
17771
|
};
|
|
17719
17772
|
|
|
17720
17773
|
var deleteTag = function deleteTag(_, del_index) {
|
|
@@ -17780,11 +17833,11 @@ var InputTag = function InputTag(_a) {
|
|
|
17780
17833
|
}
|
|
17781
17834
|
}, {
|
|
17782
17835
|
children: dropdownArr && dropdownArr.length > 0 && jsxRuntime.exports.jsx("div", {
|
|
17783
|
-
children: dropdownArr.map(function (option) {
|
|
17836
|
+
children: dropdownArr.map(function (option, index) {
|
|
17784
17837
|
var restOptions = __rest(option || {}, []);
|
|
17785
17838
|
|
|
17786
17839
|
return jsxRuntime.exports.jsx(DropdownItems, __assign({
|
|
17787
|
-
className: "hplxt-text-Primary-700"
|
|
17840
|
+
className: "hplxt-text-Primary-700 ".concat(index === focusIndex ? "hplxt-bg-Blue_gray-100 hplxt-font-inter-1" : "")
|
|
17788
17841
|
}, restOptions, {
|
|
17789
17842
|
onSelect: function onSelect() {
|
|
17790
17843
|
return handleDropdownClick(restOptions);
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -184,6 +184,8 @@ export interface ButtonGroupsProps {
|
|
|
184
184
|
onChange?: (value: string) => void;
|
|
185
185
|
options: Array<ButtonGroupOptionType>;
|
|
186
186
|
disabled: boolean;
|
|
187
|
+
className?: string;
|
|
188
|
+
style?: {};
|
|
187
189
|
}
|
|
188
190
|
type tooltipPosition = "Top" | "Top end" | "Top start" | "Bottom" | "Left" | "Right";
|
|
189
191
|
type toolTipTheme = "dark" | "light";
|