datastake-daf 0.6.209 → 0.6.211
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/components/index.js +83 -54
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/components/CustomArrowButton/index.js +56 -40
- package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/index.jsx +20 -6
- package/src/@daf/core/components/Dashboard/Widget/ImageCarousel/style.js +7 -4
package/dist/components/index.js
CHANGED
|
@@ -21259,16 +21259,14 @@ function CustomArrowButton({
|
|
|
21259
21259
|
}) {
|
|
21260
21260
|
const [isHovered, setIsHovered] = React.useState(false);
|
|
21261
21261
|
|
|
21262
|
-
//
|
|
21263
|
-
const styledIcon = icon &&
|
|
21264
|
-
|
|
21265
|
-
|
|
21266
|
-
|
|
21267
|
-
|
|
21268
|
-
color: isHovered ? hoverIconColor : iconColor
|
|
21269
|
-
}
|
|
21262
|
+
// Properly clone the icon and override color on hover
|
|
21263
|
+
const styledIcon = icon && /*#__PURE__*/React__default["default"].isValidElement(icon) ? /*#__PURE__*/React__default["default"].cloneElement(icon, {
|
|
21264
|
+
style: {
|
|
21265
|
+
...(icon.props.style || {}),
|
|
21266
|
+
color: isHovered ? hoverIconColor : iconColor,
|
|
21267
|
+
transition: "color 0.3s ease"
|
|
21270
21268
|
}
|
|
21271
|
-
} : icon;
|
|
21269
|
+
}) : icon;
|
|
21272
21270
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
21273
21271
|
type: "default",
|
|
21274
21272
|
shape: "circle",
|
|
@@ -21277,7 +21275,7 @@ function CustomArrowButton({
|
|
|
21277
21275
|
style: {
|
|
21278
21276
|
position: "absolute",
|
|
21279
21277
|
right: !isLeft ? "40px" : "auto",
|
|
21280
|
-
left:
|
|
21278
|
+
left: isLeft ? "40px" : "auto",
|
|
21281
21279
|
top: "58%",
|
|
21282
21280
|
transform: "translateY(-50%)",
|
|
21283
21281
|
zIndex: 10,
|
|
@@ -21300,19 +21298,29 @@ function CustomArrowButton({
|
|
|
21300
21298
|
}
|
|
21301
21299
|
});
|
|
21302
21300
|
}
|
|
21301
|
+
CustomArrowButton.propTypes = {
|
|
21302
|
+
icon: PropTypes__default["default"].node.isRequired,
|
|
21303
|
+
onClick: PropTypes__default["default"].func,
|
|
21304
|
+
isLeft: PropTypes__default["default"].bool,
|
|
21305
|
+
iconColor: PropTypes__default["default"].string,
|
|
21306
|
+
hoverIconColor: PropTypes__default["default"].string
|
|
21307
|
+
};
|
|
21303
21308
|
|
|
21304
|
-
dt.div`
|
|
21309
|
+
const StyledCarouselWrapper = dt.div`
|
|
21305
21310
|
position: relative;
|
|
21306
21311
|
|
|
21307
21312
|
.ant-carousel .slick-dots li button {
|
|
21308
|
-
background: ${props => props.inactiveDotColor} !important;
|
|
21309
|
-
opacity: 1 !important;
|
|
21313
|
+
background: ${props => props.inactiveDotColor} !important;
|
|
21310
21314
|
}
|
|
21311
|
-
|
|
21315
|
+
|
|
21312
21316
|
.ant-carousel .slick-dots li.slick-active button {
|
|
21317
|
+
background: ${props => props.activeDotColor} !important;
|
|
21318
|
+
}
|
|
21319
|
+
|
|
21320
|
+
.ant-carousel .slick-dots li.slick-active::after {
|
|
21313
21321
|
background: ${props => props.activeDotColor} !important;
|
|
21314
|
-
opacity: 1 !important;
|
|
21315
21322
|
}
|
|
21323
|
+
|
|
21316
21324
|
`;
|
|
21317
21325
|
|
|
21318
21326
|
const _excluded$d = ["title", "images", "height", "fallback", "activeDotColor", "inactiveDotColor", "arrowIconColor", "arrowHoverIconColor", "customArrows"];
|
|
@@ -21344,46 +21352,56 @@ function ImageCarousel(_ref) {
|
|
|
21344
21352
|
(_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 || _carouselRef$current2.next();
|
|
21345
21353
|
};
|
|
21346
21354
|
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
21347
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
|
|
21351
|
-
|
|
21352
|
-
|
|
21353
|
-
|
|
21354
|
-
|
|
21355
|
-
|
|
21356
|
-
|
|
21357
|
-
|
|
21358
|
-
|
|
21359
|
-
|
|
21360
|
-
|
|
21361
|
-
|
|
21362
|
-
|
|
21363
|
-
|
|
21364
|
-
|
|
21365
|
-
|
|
21366
|
-
|
|
21367
|
-
|
|
21368
|
-
|
|
21369
|
-
|
|
21370
|
-
|
|
21371
|
-
|
|
21355
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(StyledCarouselWrapper, {
|
|
21356
|
+
activeDotColor: activeDotColor,
|
|
21357
|
+
inactiveDotColor: inactiveDotColor,
|
|
21358
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(CarouselWidget, {
|
|
21359
|
+
title: title,
|
|
21360
|
+
arrows: false,
|
|
21361
|
+
ref: carouselRef,
|
|
21362
|
+
afterChange: handleCarouselChange,
|
|
21363
|
+
infinite: true,
|
|
21364
|
+
dots: false,
|
|
21365
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Carousel, _objectSpread2(_objectSpread2({
|
|
21366
|
+
ref: carouselRef,
|
|
21367
|
+
afterChange: handleCarouselChange
|
|
21368
|
+
}, rest), {}, {
|
|
21369
|
+
infinite: true,
|
|
21370
|
+
children: images.map((image, index) => {
|
|
21371
|
+
const imageSrc = typeof image === "string" ? image : image.src;
|
|
21372
|
+
const imageAlt = typeof image === "string" ? "".concat(title, " - Image ").concat(index + 1) : image.alt;
|
|
21373
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21374
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Image, {
|
|
21375
|
+
src: imageSrc,
|
|
21376
|
+
alt: imageAlt,
|
|
21377
|
+
height: height,
|
|
21378
|
+
width: "100%",
|
|
21379
|
+
fallback: fallback,
|
|
21380
|
+
loading: "lazy",
|
|
21381
|
+
preview: {
|
|
21382
|
+
visible: false
|
|
21383
|
+
},
|
|
21384
|
+
onClick: () => {
|
|
21385
|
+
setCurrent(index);
|
|
21386
|
+
setPreviewVisible(true);
|
|
21387
|
+
}
|
|
21388
|
+
})
|
|
21389
|
+
}, imageSrc);
|
|
21372
21390
|
})
|
|
21373
|
-
}
|
|
21374
|
-
})
|
|
21375
|
-
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
|
|
21381
|
-
|
|
21382
|
-
|
|
21383
|
-
|
|
21384
|
-
|
|
21385
|
-
|
|
21386
|
-
|
|
21391
|
+
}))
|
|
21392
|
+
}), customArrows && images && images.length > 1 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
21393
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(CustomArrowButton, {
|
|
21394
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(Icons.LeftOutlined, {}),
|
|
21395
|
+
onClick: goToPrevious,
|
|
21396
|
+
isLeft: true,
|
|
21397
|
+
iconColor: arrowIconColor,
|
|
21398
|
+
hoverIconColor: arrowHoverIconColor
|
|
21399
|
+
}), /*#__PURE__*/jsxRuntime.jsx(CustomArrowButton, {
|
|
21400
|
+
icon: /*#__PURE__*/jsxRuntime.jsx(Icons.RightOutlined, {}),
|
|
21401
|
+
onClick: goToNext,
|
|
21402
|
+
iconColor: arrowIconColor,
|
|
21403
|
+
hoverIconColor: arrowHoverIconColor
|
|
21404
|
+
})]
|
|
21387
21405
|
})]
|
|
21388
21406
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
21389
21407
|
style: {
|
|
@@ -21412,6 +21430,17 @@ function ImageCarousel(_ref) {
|
|
|
21412
21430
|
})]
|
|
21413
21431
|
});
|
|
21414
21432
|
}
|
|
21433
|
+
ImageCarousel.propTypes = {
|
|
21434
|
+
title: PropTypes__default["default"].string.isRequired,
|
|
21435
|
+
images: PropTypes__default["default"].array.isRequired,
|
|
21436
|
+
height: PropTypes__default["default"].number,
|
|
21437
|
+
fallback: PropTypes__default["default"].string,
|
|
21438
|
+
activeDotColor: PropTypes__default["default"].string,
|
|
21439
|
+
inactiveDotColor: PropTypes__default["default"].string,
|
|
21440
|
+
arrowIconColor: PropTypes__default["default"].string,
|
|
21441
|
+
arrowHoverIconColor: PropTypes__default["default"].string,
|
|
21442
|
+
customArrows: PropTypes__default["default"].bool
|
|
21443
|
+
};
|
|
21415
21444
|
|
|
21416
21445
|
var Style$w = dt.div`
|
|
21417
21446
|
border: 1px solid var(--base-gray-40);
|
package/package.json
CHANGED
|
@@ -1,52 +1,68 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
1
2
|
import { Button } from "antd";
|
|
2
|
-
import
|
|
3
|
+
import PropTypes from "prop-types";
|
|
3
4
|
|
|
4
5
|
function CustomArrowButton({
|
|
5
|
-
icon,
|
|
6
|
-
onClick = () => {},
|
|
7
|
-
isLeft = false,
|
|
8
|
-
iconColor = "#666",
|
|
9
|
-
hoverIconColor = "#1890ff"
|
|
6
|
+
icon,
|
|
7
|
+
onClick = () => {},
|
|
8
|
+
isLeft = false,
|
|
9
|
+
iconColor = "#666",
|
|
10
|
+
hoverIconColor = "#1890ff",
|
|
10
11
|
}) {
|
|
11
12
|
const [isHovered, setIsHovered] = useState(false);
|
|
12
13
|
|
|
13
|
-
//
|
|
14
|
-
const styledIcon =
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
// Properly clone the icon and override color on hover
|
|
15
|
+
const styledIcon =
|
|
16
|
+
icon && React.isValidElement(icon)
|
|
17
|
+
? React.cloneElement(icon, {
|
|
18
|
+
style: {
|
|
19
|
+
...(icon.props.style || {}),
|
|
20
|
+
color: isHovered ? hoverIconColor : iconColor,
|
|
21
|
+
transition: "color 0.3s ease",
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
: icon;
|
|
17
25
|
|
|
18
26
|
return (
|
|
19
27
|
<Button
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
28
|
+
type="default"
|
|
29
|
+
shape="circle"
|
|
30
|
+
icon={styledIcon}
|
|
31
|
+
onClick={onClick}
|
|
32
|
+
style={{
|
|
33
|
+
position: "absolute",
|
|
34
|
+
right: !isLeft ? "40px" : "auto",
|
|
35
|
+
left: isLeft ? "40px" : "auto",
|
|
36
|
+
top: "58%",
|
|
37
|
+
transform: "translateY(-50%)",
|
|
38
|
+
zIndex: 10,
|
|
39
|
+
backgroundColor: "rgba(255, 255, 255, 0.4)",
|
|
40
|
+
border: "1px solid rgba(0, 0, 0, 0.1)",
|
|
41
|
+
boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
|
|
42
|
+
width: "40px",
|
|
43
|
+
height: "40px",
|
|
44
|
+
display: "flex",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
justifyContent: "center",
|
|
47
|
+
}}
|
|
48
|
+
onMouseEnter={(e) => {
|
|
49
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
|
|
50
|
+
setIsHovered(true);
|
|
51
|
+
}}
|
|
52
|
+
onMouseLeave={(e) => {
|
|
53
|
+
e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.4)";
|
|
54
|
+
setIsHovered(false);
|
|
55
|
+
}}
|
|
48
56
|
/>
|
|
49
|
-
)
|
|
57
|
+
);
|
|
50
58
|
}
|
|
51
59
|
|
|
52
|
-
|
|
60
|
+
CustomArrowButton.propTypes = {
|
|
61
|
+
icon: PropTypes.node.isRequired,
|
|
62
|
+
onClick: PropTypes.func,
|
|
63
|
+
isLeft: PropTypes.bool,
|
|
64
|
+
iconColor: PropTypes.string,
|
|
65
|
+
hoverIconColor: PropTypes.string,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default CustomArrowButton;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React, { useState, useRef } from "react";
|
|
2
|
-
import styled from "styled-components";
|
|
3
2
|
import CarouselWidget from "../CarouselWidget/index.jsx";
|
|
4
|
-
import { Image, Carousel
|
|
3
|
+
import { Image, Carousel } from "antd";
|
|
5
4
|
import { LeftOutlined, RightOutlined } from "@ant-design/icons";
|
|
6
5
|
import CustomArrowButton from "./components/CustomArrowButton/index.js";
|
|
7
6
|
import { StyledCarouselWrapper } from "./style.js";
|
|
7
|
+
import PropTypes from "prop-types";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @typedef {Object} ImageObject
|
|
@@ -95,18 +95,19 @@ function ImageCarousel({
|
|
|
95
95
|
|
|
96
96
|
return (
|
|
97
97
|
<>
|
|
98
|
-
|
|
98
|
+
<StyledCarouselWrapper
|
|
99
99
|
activeDotColor={activeDotColor}
|
|
100
100
|
inactiveDotColor={inactiveDotColor}
|
|
101
|
-
>
|
|
101
|
+
>
|
|
102
102
|
<CarouselWidget
|
|
103
103
|
title={title}
|
|
104
|
-
{...rest}
|
|
105
104
|
arrows={false}
|
|
106
105
|
ref={carouselRef}
|
|
107
106
|
afterChange={handleCarouselChange}
|
|
108
107
|
infinite
|
|
108
|
+
dots={false}
|
|
109
109
|
>
|
|
110
|
+
<Carousel ref={carouselRef} afterChange={handleCarouselChange} {...rest} infinite>
|
|
110
111
|
{images.map((image, index) => {
|
|
111
112
|
const imageSrc = typeof image === "string" ? image : image.src;
|
|
112
113
|
const imageAlt =
|
|
@@ -134,6 +135,7 @@ function ImageCarousel({
|
|
|
134
135
|
</div>
|
|
135
136
|
);
|
|
136
137
|
})}
|
|
138
|
+
</Carousel>
|
|
137
139
|
</CarouselWidget>
|
|
138
140
|
|
|
139
141
|
{customArrows && images && images.length > 1 && (
|
|
@@ -153,7 +155,7 @@ function ImageCarousel({
|
|
|
153
155
|
/>
|
|
154
156
|
</>
|
|
155
157
|
)}
|
|
156
|
-
|
|
158
|
+
</StyledCarouselWrapper>
|
|
157
159
|
|
|
158
160
|
<div style={{ display: "none" }}>
|
|
159
161
|
<Image.PreviewGroup
|
|
@@ -182,4 +184,16 @@ function ImageCarousel({
|
|
|
182
184
|
);
|
|
183
185
|
}
|
|
184
186
|
|
|
187
|
+
ImageCarousel.propTypes = {
|
|
188
|
+
title: PropTypes.string.isRequired,
|
|
189
|
+
images: PropTypes.array.isRequired,
|
|
190
|
+
height: PropTypes.number,
|
|
191
|
+
fallback: PropTypes.string,
|
|
192
|
+
activeDotColor: PropTypes.string,
|
|
193
|
+
inactiveDotColor: PropTypes.string,
|
|
194
|
+
arrowIconColor: PropTypes.string,
|
|
195
|
+
arrowHoverIconColor: PropTypes.string,
|
|
196
|
+
customArrows: PropTypes.bool,
|
|
197
|
+
};
|
|
198
|
+
|
|
185
199
|
export default ImageCarousel;
|
|
@@ -4,12 +4,15 @@ export const StyledCarouselWrapper = styled.div`
|
|
|
4
4
|
position: relative;
|
|
5
5
|
|
|
6
6
|
.ant-carousel .slick-dots li button {
|
|
7
|
-
background: ${props => props.inactiveDotColor} !important;
|
|
8
|
-
opacity: 1 !important;
|
|
7
|
+
background: ${props => props.inactiveDotColor} !important;
|
|
9
8
|
}
|
|
10
|
-
|
|
9
|
+
|
|
11
10
|
.ant-carousel .slick-dots li.slick-active button {
|
|
11
|
+
background: ${props => props.activeDotColor} !important;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ant-carousel .slick-dots li.slick-active::after {
|
|
12
15
|
background: ${props => props.activeDotColor} !important;
|
|
13
|
-
opacity: 1 !important;
|
|
14
16
|
}
|
|
17
|
+
|
|
15
18
|
`;
|