hplx-react-elements-dev 1.1.6 → 1.1.8
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.
- package/dist/esm/carousel/imageCarousel.d.ts +1 -1
- package/dist/esm/index.js +126 -68
- package/dist/esm/types.d.ts +4 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CarouselProps } from "../types";
|
|
3
3
|
import "../carousel/imageCarousel.css";
|
|
4
|
-
declare const ImageCarousel: ({ imageList, isNextPrev, caroselLeftIcon, caroselRightIcon, timeInterval, autoPlay, carouselIndicator }: CarouselProps) => JSX.Element;
|
|
4
|
+
declare const ImageCarousel: ({ leftIconClassName, rightIconClassName, imageList, isNextPrev, caroselLeftIcon, caroselRightIcon, timeInterval, autoPlay, carouselIndicator }: CarouselProps) => JSX.Element;
|
|
5
5
|
export default ImageCarousel;
|
package/dist/esm/index.js
CHANGED
|
@@ -5625,9 +5625,10 @@ $$5({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
|
5625
5625
|
var AddSuggestion = function AddSuggestion(_a) {
|
|
5626
5626
|
var label = _a.label,
|
|
5627
5627
|
_b = _a.handleSuggestionValChange,
|
|
5628
|
-
handleSuggestionValChange = _b === void 0 ? function (_) {
|
|
5628
|
+
handleSuggestionValChange = _b === void 0 ? function (_, _fromEvent) {
|
|
5629
|
+
} : _b,
|
|
5629
5630
|
_c = _a.onSuggestionClick,
|
|
5630
|
-
onSuggestionClick = _c === void 0 ? function (_selectedValue) {} : _c,
|
|
5631
|
+
onSuggestionClick = _c === void 0 ? function (_selectedValue, _index, _searchString) {} : _c,
|
|
5631
5632
|
className = _a.className,
|
|
5632
5633
|
_d = _a.rows,
|
|
5633
5634
|
rows = _d === void 0 ? 2 : _d,
|
|
@@ -5650,7 +5651,7 @@ var AddSuggestion = function AddSuggestion(_a) {
|
|
|
5650
5651
|
|
|
5651
5652
|
var wrapperRef = useRef(null);
|
|
5652
5653
|
|
|
5653
|
-
var _k = useState(),
|
|
5654
|
+
var _k = useState([]),
|
|
5654
5655
|
suggestionArr = _k[0],
|
|
5655
5656
|
setSuggestionArr = _k[1];
|
|
5656
5657
|
|
|
@@ -5658,6 +5659,10 @@ var AddSuggestion = function AddSuggestion(_a) {
|
|
|
5658
5659
|
sugVal = _l[0],
|
|
5659
5660
|
setSugVal = _l[1];
|
|
5660
5661
|
|
|
5662
|
+
var _m = useState(-1),
|
|
5663
|
+
focusIndex = _m[0],
|
|
5664
|
+
setFocusIndex = _m[1];
|
|
5665
|
+
|
|
5661
5666
|
var suggestionText = function suggestionText(text) {
|
|
5662
5667
|
// Find the last occurrence of comma, period, or newline
|
|
5663
5668
|
var lastCommaIndex = text.lastIndexOf(",");
|
|
@@ -5705,6 +5710,8 @@ var AddSuggestion = function AddSuggestion(_a) {
|
|
|
5705
5710
|
if (wrapperRef.current && !wrapperRef.current.contains(e.target)) {
|
|
5706
5711
|
setShowDropdown(false);
|
|
5707
5712
|
}
|
|
5713
|
+
|
|
5714
|
+
setFocusIndex(-1);
|
|
5708
5715
|
}; // const checkComma = (val: string) => {
|
|
5709
5716
|
// const lastEle = val.trim().charAt(sugVal.length - 1);
|
|
5710
5717
|
// if (lastEle === "," || lastEle === "." || lastEle === "\n") {
|
|
@@ -5715,7 +5722,7 @@ var AddSuggestion = function AddSuggestion(_a) {
|
|
|
5715
5722
|
// };
|
|
5716
5723
|
|
|
5717
5724
|
|
|
5718
|
-
var handleSuggestionClick = function handleSuggestionClick(selectedItem) {
|
|
5725
|
+
var handleSuggestionClick = function handleSuggestionClick(selectedItem, index) {
|
|
5719
5726
|
var val = selectedItem.value + ", ";
|
|
5720
5727
|
var result = "";
|
|
5721
5728
|
|
|
@@ -5732,12 +5739,57 @@ var AddSuggestion = function AddSuggestion(_a) {
|
|
|
5732
5739
|
val = result + " " + selectedItem.value + ", ";
|
|
5733
5740
|
}
|
|
5734
5741
|
|
|
5735
|
-
handleSuggestionValChange && handleSuggestionValChange(val);
|
|
5736
|
-
onSuggestionClick(suggestionValue);
|
|
5742
|
+
handleSuggestionValChange && handleSuggestionValChange(val, "dropdown");
|
|
5743
|
+
onSuggestionClick(suggestionValue, index, suggestionText(suggestionValue)[1].trim());
|
|
5737
5744
|
setSugVal(val);
|
|
5738
5745
|
setShowDropdown(false);
|
|
5739
5746
|
};
|
|
5740
5747
|
|
|
5748
|
+
var handleOnKeyDown = function handleOnKeyDown(e) {
|
|
5749
|
+
var ITEM_HEIGHT = 40;
|
|
5750
|
+
|
|
5751
|
+
if (e.code === "Enter" || e.code === "Period" || e.code === "Comma") {
|
|
5752
|
+
setShowDropdown(true);
|
|
5753
|
+
}
|
|
5754
|
+
|
|
5755
|
+
if (e.keyCode === 40) {
|
|
5756
|
+
if (focusIndex < suggestionArr.length - 1) {
|
|
5757
|
+
var focusI = focusIndex + 1;
|
|
5758
|
+
|
|
5759
|
+
if (wrapperRef && wrapperRef.current && focusI > 1) {
|
|
5760
|
+
wrapperRef.current.scrollBy(0, ITEM_HEIGHT);
|
|
5761
|
+
}
|
|
5762
|
+
|
|
5763
|
+
setFocusIndex(focusI);
|
|
5764
|
+
}
|
|
5765
|
+
} // on key up
|
|
5766
|
+
|
|
5767
|
+
|
|
5768
|
+
if (e.keyCode === 38) {
|
|
5769
|
+
if (focusIndex > 0) {
|
|
5770
|
+
var focusI = focusIndex - 1;
|
|
5771
|
+
|
|
5772
|
+
if (wrapperRef && wrapperRef.current && focusI < suggestionArr.length - 2) {
|
|
5773
|
+
wrapperRef.current.scrollBy(0, -ITEM_HEIGHT);
|
|
5774
|
+
}
|
|
5775
|
+
|
|
5776
|
+
setFocusIndex(focusI);
|
|
5777
|
+
}
|
|
5778
|
+
}
|
|
5779
|
+
|
|
5780
|
+
if (e.keyCode === 13 || e.keyCode === 9) {
|
|
5781
|
+
e.preventDefault();
|
|
5782
|
+
|
|
5783
|
+
if (focusIndex >= 0) {
|
|
5784
|
+
// const res = [suggestionArr[focusIndex].value.trim()];
|
|
5785
|
+
// setValue(res.filter(Boolean).join(", "));
|
|
5786
|
+
// setTagInputValue("");
|
|
5787
|
+
setFocusIndex(-1);
|
|
5788
|
+
handleSuggestionClick(suggestionArr[focusIndex], focusIndex);
|
|
5789
|
+
}
|
|
5790
|
+
}
|
|
5791
|
+
};
|
|
5792
|
+
|
|
5741
5793
|
useEffect(function () {
|
|
5742
5794
|
setSugVal(suggestionValue);
|
|
5743
5795
|
}, [suggestionValue]); // Attaching the previous event with UseEffect hook
|
|
@@ -5763,12 +5815,12 @@ var AddSuggestion = function AddSuggestion(_a) {
|
|
|
5763
5815
|
isDynamicHeight: isDynamicHeight,
|
|
5764
5816
|
inputProps: __assign(__assign({}, inputProps), {
|
|
5765
5817
|
onChange: changeHandler,
|
|
5766
|
-
value: sugVal.replace(/<br \/>/g,
|
|
5818
|
+
value: sugVal.replace(/<br \/>/g, ""),
|
|
5767
5819
|
onFocus: function onFocus() {
|
|
5768
5820
|
return setShowDropdown(true);
|
|
5769
5821
|
},
|
|
5770
5822
|
onKeyDown: function onKeyDown(e) {
|
|
5771
|
-
|
|
5823
|
+
handleOnKeyDown(e);
|
|
5772
5824
|
}
|
|
5773
5825
|
})
|
|
5774
5826
|
}), showDropdown && jsxRuntime.exports.jsx("div", __assign({
|
|
@@ -5776,14 +5828,14 @@ var AddSuggestion = function AddSuggestion(_a) {
|
|
|
5776
5828
|
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 "
|
|
5777
5829
|
}, {
|
|
5778
5830
|
children: suggestionArr && suggestionArr.length > 0 && jsxRuntime.exports.jsx("div", {
|
|
5779
|
-
children: (suggestionArr === null || suggestionArr === void 0 ? void 0 : suggestionArr.constructor) === Array && suggestionArr.length ? suggestionArr.map(function (option) {
|
|
5831
|
+
children: (suggestionArr === null || suggestionArr === void 0 ? void 0 : suggestionArr.constructor) === Array && suggestionArr.length ? suggestionArr.map(function (option, index) {
|
|
5780
5832
|
var restOptions = __rest(option || {}, []);
|
|
5781
5833
|
|
|
5782
5834
|
return jsxRuntime.exports.jsx(DropdownItems, __assign({
|
|
5783
|
-
className: "hplxt-text-Primary-700"
|
|
5835
|
+
className: "hplxt-text-Primary-700 ".concat(index === focusIndex ? "hplxt-bg-Blue_gray-100 hplxt-font-inter-1" : "")
|
|
5784
5836
|
}, restOptions, {
|
|
5785
5837
|
onSelect: function onSelect() {
|
|
5786
|
-
return handleSuggestionClick(restOptions);
|
|
5838
|
+
return handleSuggestionClick(restOptions, index);
|
|
5787
5839
|
}
|
|
5788
5840
|
}));
|
|
5789
5841
|
}) : null
|
|
@@ -20515,27 +20567,31 @@ var PopUpModal = function PopUpModal(_a) {
|
|
|
20515
20567
|
};
|
|
20516
20568
|
|
|
20517
20569
|
var ImageCarousel = function ImageCarousel(_a) {
|
|
20518
|
-
var
|
|
20519
|
-
|
|
20520
|
-
|
|
20521
|
-
|
|
20522
|
-
|
|
20523
|
-
_d = _a.
|
|
20524
|
-
|
|
20525
|
-
_e = _a.
|
|
20526
|
-
|
|
20527
|
-
_f = _a.
|
|
20528
|
-
|
|
20529
|
-
_g = _a.
|
|
20530
|
-
|
|
20531
|
-
|
|
20532
|
-
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20536
|
-
var
|
|
20537
|
-
|
|
20538
|
-
|
|
20570
|
+
var _b = _a.leftIconClassName,
|
|
20571
|
+
leftIconClassName = _b === void 0 ? '' : _b,
|
|
20572
|
+
_c = _a.rightIconClassName,
|
|
20573
|
+
rightIconClassName = _c === void 0 ? '' : _c,
|
|
20574
|
+
imageList = _a.imageList,
|
|
20575
|
+
_d = _a.isNextPrev,
|
|
20576
|
+
isNextPrev = _d === void 0 ? true : _d,
|
|
20577
|
+
_e = _a.caroselLeftIcon,
|
|
20578
|
+
caroselLeftIcon = _e === void 0 ? 'hx_left' : _e,
|
|
20579
|
+
_f = _a.caroselRightIcon,
|
|
20580
|
+
caroselRightIcon = _f === void 0 ? 'hx_right' : _f,
|
|
20581
|
+
_g = _a.timeInterval,
|
|
20582
|
+
timeInterval = _g === void 0 ? 5000 : _g,
|
|
20583
|
+
_h = _a.autoPlay,
|
|
20584
|
+
autoPlay = _h === void 0 ? true : _h,
|
|
20585
|
+
_j = _a.carouselIndicator,
|
|
20586
|
+
carouselIndicator = _j === void 0 ? true : _j;
|
|
20587
|
+
|
|
20588
|
+
var _k = useState(0),
|
|
20589
|
+
current = _k[0],
|
|
20590
|
+
setCurrent = _k[1];
|
|
20591
|
+
|
|
20592
|
+
var _l = useState(autoPlay),
|
|
20593
|
+
isAutoPlay = _l[0],
|
|
20594
|
+
setIsAutoPlay = _l[1];
|
|
20539
20595
|
|
|
20540
20596
|
var length = imageList.length;
|
|
20541
20597
|
|
|
@@ -20583,45 +20639,47 @@ var ImageCarousel = function ImageCarousel(_a) {
|
|
|
20583
20639
|
}
|
|
20584
20640
|
|
|
20585
20641
|
var carouselIndicatorDoms = [];
|
|
20586
|
-
return
|
|
20587
|
-
|
|
20588
|
-
|
|
20589
|
-
children: [Boolean(caroselLeftIcon) && isNextPrev && jsxRuntime.exports.jsx("div", __assign({
|
|
20590
|
-
className: "left-arrow"
|
|
20591
|
-
}, {
|
|
20592
|
-
children: jsxRuntime.exports.jsx("span", {
|
|
20593
|
-
className: caroselLeftIcon,
|
|
20594
|
-
onClick: prevSlide
|
|
20595
|
-
})
|
|
20596
|
-
})), Boolean(caroselRightIcon) && isNextPrev && jsxRuntime.exports.jsx("div", __assign({
|
|
20597
|
-
className: "right-arrow "
|
|
20642
|
+
return (//
|
|
20643
|
+
jsxRuntime.exports.jsxs("div", __assign({
|
|
20644
|
+
className: "slider"
|
|
20598
20645
|
}, {
|
|
20599
|
-
children: jsxRuntime.exports.jsx("
|
|
20600
|
-
className:
|
|
20601
|
-
onClick: nextSlide
|
|
20602
|
-
})
|
|
20603
|
-
})), imageList.map(function (d, index) {
|
|
20604
|
-
carouselIndicatorDoms.push(jsxRuntime.exports.jsx("li", {
|
|
20605
|
-
className: index === current ? 'active' : '',
|
|
20606
|
-
onClick: function onClick() {
|
|
20607
|
-
goToSlide(index);
|
|
20608
|
-
}
|
|
20609
|
-
}));
|
|
20610
|
-
return jsxRuntime.exports.jsx("div", __assign({
|
|
20611
|
-
className: index === current ? 'slide active ' : 'slide'
|
|
20646
|
+
children: [Boolean(caroselLeftIcon) && isNextPrev && jsxRuntime.exports.jsx("div", __assign({
|
|
20647
|
+
className: "left-arrow hplxt-flex hplxt-items-center hplxt-justify-center ".concat(leftIconClassName)
|
|
20612
20648
|
}, {
|
|
20613
|
-
children:
|
|
20614
|
-
|
|
20615
|
-
|
|
20616
|
-
className: 'image'
|
|
20649
|
+
children: jsxRuntime.exports.jsx("span", {
|
|
20650
|
+
className: "".concat(caroselLeftIcon),
|
|
20651
|
+
onClick: prevSlide
|
|
20617
20652
|
})
|
|
20618
|
-
}),
|
|
20619
|
-
|
|
20620
|
-
|
|
20621
|
-
|
|
20622
|
-
|
|
20623
|
-
|
|
20624
|
-
|
|
20653
|
+
})), Boolean(caroselRightIcon) && isNextPrev && jsxRuntime.exports.jsx("div", __assign({
|
|
20654
|
+
className: "right-arrow hplxt-flex hplxt-items-center hplxt-justify-center ".concat(rightIconClassName)
|
|
20655
|
+
}, {
|
|
20656
|
+
children: jsxRuntime.exports.jsx("span", {
|
|
20657
|
+
className: "".concat(caroselRightIcon),
|
|
20658
|
+
onClick: nextSlide
|
|
20659
|
+
})
|
|
20660
|
+
})), imageList.map(function (d, index) {
|
|
20661
|
+
carouselIndicatorDoms.push(jsxRuntime.exports.jsx("li", {
|
|
20662
|
+
className: index === current ? 'active' : '',
|
|
20663
|
+
onClick: function onClick() {
|
|
20664
|
+
goToSlide(index);
|
|
20665
|
+
}
|
|
20666
|
+
}));
|
|
20667
|
+
return jsxRuntime.exports.jsx("div", __assign({
|
|
20668
|
+
className: index === current ? 'slide active ' : 'slide'
|
|
20669
|
+
}, {
|
|
20670
|
+
children: index === current && jsxRuntime.exports.jsx("img", {
|
|
20671
|
+
src: d,
|
|
20672
|
+
alt: d,
|
|
20673
|
+
className: 'image'
|
|
20674
|
+
})
|
|
20675
|
+
}), index);
|
|
20676
|
+
}), carouselIndicator && jsxRuntime.exports.jsx("ul", __assign({
|
|
20677
|
+
className: "carousel-indicators"
|
|
20678
|
+
}, {
|
|
20679
|
+
children: carouselIndicatorDoms
|
|
20680
|
+
}))]
|
|
20681
|
+
}))
|
|
20682
|
+
);
|
|
20625
20683
|
};
|
|
20626
20684
|
|
|
20627
20685
|
export { AddSuggestion, Avatar, Badge, BadgeGroup, Button, ButtonGroups, CalendarView, Card, Checkbox, CheckboxGroup, CheckboxGroupItem, CollapsibleCard, DatePicker, DoubleInput, DropdownField, DropdownItems as DropdownItem, ImageCarousel, InputField, InputFieldSplit, InputTag, InputTagDropdownItem, MessageToast, NestedDropdown, OtpField, PopUpModal, ProgressBar, ProgressCircle, RadioBtn, Slider, TextAreaField, ToggleSwitch, Tooltip, Typography };
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -407,10 +407,10 @@ export interface AddSuggestionProps {
|
|
|
407
407
|
inputFieldInputProps?: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
408
408
|
suffixInputProps?: React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
|
|
409
409
|
suffixClassName?: string;
|
|
410
|
-
onSuggestionClick?: (selectedValue: any) => void;
|
|
410
|
+
onSuggestionClick?: (selectedValue: any, index?: number, _searchString?: string) => void;
|
|
411
411
|
options?: Array<DropdownItemsProps>;
|
|
412
412
|
suggestionValue?: string;
|
|
413
|
-
handleSuggestionValChange?: (value: any) => void;
|
|
413
|
+
handleSuggestionValChange?: (value: any, fromEvent?: string) => void;
|
|
414
414
|
handleSuffixValChange?: (value: any) => void;
|
|
415
415
|
isborderRequired?: boolean;
|
|
416
416
|
getInputValue?: (value: string) => void;
|
|
@@ -456,6 +456,8 @@ export interface InputTagProps {
|
|
|
456
456
|
getInputValue?: (value: string) => void;
|
|
457
457
|
}
|
|
458
458
|
export interface CarouselProps {
|
|
459
|
+
leftIconClassName?: string;
|
|
460
|
+
rightIconClassName?: string;
|
|
459
461
|
imageList: Array<string>;
|
|
460
462
|
isNextPrev?: boolean;
|
|
461
463
|
caroselLeftIcon?: string;
|