hplx-react-elements-dev 1.1.3 → 1.1.4

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.
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { CarouselProps } from "../types";
3
+ import "../carousel/imageCarousel.css";
4
+ declare const ImageCarousel: ({ imageList, isNextPrev, caroselLeftIcon, caroselRightIcon, timeInterval, autoPlay, carouselIndicator }: CarouselProps) => JSX.Element;
5
+ export default ImageCarousel;
@@ -1540,3 +1540,81 @@
1540
1540
  color: #849095;
1541
1541
  padding: 0.833em;
1542
1542
  }
1543
+
1544
+ .slider {
1545
+ position: relative;
1546
+ }
1547
+
1548
+ .image {
1549
+ width: 100%;
1550
+ }
1551
+
1552
+ .right-arrow {
1553
+ position: absolute;
1554
+ top: 50%;
1555
+ right: 32px;
1556
+ font-size: 2rem;
1557
+ color: #fff;
1558
+ z-index: 10;
1559
+ cursor: pointer;
1560
+ -webkit-user-select: none;
1561
+ user-select: none;
1562
+ background: rgba(0, 0, 0, 0.2);
1563
+ opacity: 0.2;
1564
+ border-radius: 50%;
1565
+ width: 50px;
1566
+ height: 50px;
1567
+ text-align: center;
1568
+ }
1569
+
1570
+ .left-arrow {
1571
+ position: absolute;
1572
+ top: 50%;
1573
+ left: 32px;
1574
+ font-size: 2rem;
1575
+ color: #fff;
1576
+ z-index: 10;
1577
+ cursor: pointer;
1578
+ -webkit-user-select: none;
1579
+ user-select: none;
1580
+ background: rgba(0, 0, 0, 0.2);
1581
+ border-radius: 50%;
1582
+ width: 50px;
1583
+ height: 50px;
1584
+ text-align: center;
1585
+ }
1586
+ .left-arrow:hover,
1587
+ .right-arrow:hover {
1588
+ background: rgba(0, 0, 0, 0.8);
1589
+ }
1590
+
1591
+ .slide {
1592
+ opacity: 0;
1593
+ transition-duration: 2s;
1594
+ transition-timing-function: ease;
1595
+ }
1596
+
1597
+ .slide.active {
1598
+ opacity: 1;
1599
+ transition-duration: 1s;
1600
+ transform: scale(1);
1601
+ }
1602
+ .carousel-indicators li {
1603
+ width: 10px;
1604
+ height: 10px;
1605
+ border-radius: 100%;
1606
+ float: left;
1607
+ background: rgba(255, 255, 255, 0.5);
1608
+ border: 1px solid rgba(255, 255, 255, 0.5);
1609
+ margin: 0px 5px;
1610
+ cursor: pointer;
1611
+ }
1612
+ .carousel-indicators li.active {
1613
+ background: #fff;
1614
+ border: 1px solid #fff;
1615
+ }
1616
+ .carousel-indicators {
1617
+ position: absolute;
1618
+ left: 50%;
1619
+ bottom: 5%;
1620
+ }
@@ -30,3 +30,4 @@ export { default as InputTag } from "./inputTag/InputTag";
30
30
  export { default as InputTagDropdownItem } from "./inputTag/InputTagDropdownItem";
31
31
  export { default as CalendarView } from "./calendarView/CalendarView";
32
32
  export { default as PopUpModal } from "./popUpModal/PopUpModal";
33
+ export { default as ImageCarousel } from "./carousel/imageCarousel";
package/dist/esm/index.js CHANGED
@@ -20511,4 +20511,98 @@ var PopUpModal = function PopUpModal(_a) {
20511
20511
  }));
20512
20512
  };
20513
20513
 
20514
- export { AddSuggestion, Avatar, Badge, BadgeGroup, Button, ButtonGroups, CalendarView, Card, Checkbox, CheckboxGroup, CheckboxGroupItem, CollapsibleCard, DatePicker, DoubleInput, DropdownField, DropdownItems as DropdownItem, InputField, InputFieldSplit, InputTag, InputTagDropdownItem, MessageToast, NestedDropdown, OtpField, PopUpModal, ProgressBar, ProgressCircle, RadioBtn, Slider, TextAreaField, ToggleSwitch, Tooltip, Typography };
20514
+ var ImageCarousel = function ImageCarousel(_a) {
20515
+ var imageList = _a.imageList,
20516
+ _b = _a.isNextPrev,
20517
+ isNextPrev = _b === void 0 ? true : _b,
20518
+ _c = _a.caroselLeftIcon,
20519
+ caroselLeftIcon = _c === void 0 ? 'hx_left' : _c,
20520
+ _d = _a.caroselRightIcon,
20521
+ caroselRightIcon = _d === void 0 ? 'hx_right' : _d,
20522
+ _e = _a.timeInterval,
20523
+ timeInterval = _e === void 0 ? 5000 : _e,
20524
+ _f = _a.autoPlay,
20525
+ autoPlay = _f === void 0 ? true : _f,
20526
+ _g = _a.carouselIndicator,
20527
+ carouselIndicator = _g === void 0 ? true : _g;
20528
+
20529
+ var _h = useState(0),
20530
+ current = _h[0],
20531
+ setCurrent = _h[1];
20532
+
20533
+ var length = imageList.length;
20534
+
20535
+ var nextSlide = function nextSlide() {
20536
+ setCurrent(current === length - 1 ? 0 : current + 1);
20537
+ };
20538
+
20539
+ var prevSlide = function prevSlide() {
20540
+ setCurrent(current === 0 ? length - 1 : current - 1);
20541
+ };
20542
+
20543
+ var goToSlide = function goToSlide(slideNumber) {
20544
+ setCurrent(slideNumber);
20545
+ };
20546
+
20547
+ if (!Array.isArray(imageList) || imageList.length <= 0) {
20548
+ return jsxRuntime.exports.jsx("p", {
20549
+ children: "Image list data is not available !"
20550
+ });
20551
+ } //Single image exist then display image and disable all the functions of carousel
20552
+
20553
+
20554
+ if (imageList.length === 1) {
20555
+ carouselIndicator = false;
20556
+ isNextPrev = false;
20557
+ autoPlay = false;
20558
+ }
20559
+
20560
+ if (timeInterval > 0 && autoPlay) {
20561
+ setTimeout(function () {
20562
+ nextSlide();
20563
+ }, timeInterval);
20564
+ }
20565
+
20566
+ var carouselIndicatorDoms = [];
20567
+ return jsxRuntime.exports.jsxs("div", __assign({
20568
+ className: "slider"
20569
+ }, {
20570
+ children: [Boolean(caroselLeftIcon) && isNextPrev && jsxRuntime.exports.jsx("div", __assign({
20571
+ className: "left-arrow"
20572
+ }, {
20573
+ children: jsxRuntime.exports.jsx("span", {
20574
+ className: caroselLeftIcon,
20575
+ onClick: prevSlide
20576
+ })
20577
+ })), Boolean(caroselRightIcon) && isNextPrev && jsxRuntime.exports.jsx("div", __assign({
20578
+ className: "right-arrow "
20579
+ }, {
20580
+ children: jsxRuntime.exports.jsx("span", {
20581
+ className: caroselRightIcon,
20582
+ onClick: nextSlide
20583
+ })
20584
+ })), imageList.map(function (d, index) {
20585
+ carouselIndicatorDoms.push(jsxRuntime.exports.jsx("li", {
20586
+ className: index === current ? 'active' : '',
20587
+ onClick: function onClick() {
20588
+ goToSlide(index);
20589
+ }
20590
+ }));
20591
+ return jsxRuntime.exports.jsx("div", __assign({
20592
+ className: index === current ? 'slide active ' : 'slide'
20593
+ }, {
20594
+ children: index === current && jsxRuntime.exports.jsx("img", {
20595
+ src: d,
20596
+ alt: d,
20597
+ className: 'image'
20598
+ })
20599
+ }), index);
20600
+ }), carouselIndicator && jsxRuntime.exports.jsx("ul", __assign({
20601
+ className: "carousel-indicators"
20602
+ }, {
20603
+ children: carouselIndicatorDoms
20604
+ }))]
20605
+ }));
20606
+ };
20607
+
20608
+ 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 };
@@ -454,4 +454,13 @@ export interface InputTagProps {
454
454
  allowDuplicates?: boolean;
455
455
  getInputValue?: (value: string) => void;
456
456
  }
457
+ export interface CarouselProps {
458
+ imageList: Array<string>;
459
+ isNextPrev?: boolean;
460
+ caroselLeftIcon?: string;
461
+ caroselRightIcon?: string;
462
+ timeInterval?: number;
463
+ carouselIndicator?: boolean;
464
+ autoPlay?: boolean;
465
+ }
457
466
  export {};
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "frontend",
10
10
  "healthplix"
11
11
  ],
12
- "version": "1.1.3",
12
+ "version": "1.1.4",
13
13
  "main": "dist/esm/index.js",
14
14
  "module": "dist/esm/index.js",
15
15
  "types": "dist/esm/index.d.ts",