datastake-daf 0.6.209 → 0.6.210

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.
@@ -21250,83 +21250,13 @@ const CarouselWidget = /*#__PURE__*/React.forwardRef((_ref, ref) => {
21250
21250
  });
21251
21251
  CarouselWidget.displayName = 'CarouselWidget';
21252
21252
 
21253
- function CustomArrowButton({
21254
- icon,
21255
- onClick = () => {},
21256
- isLeft = false,
21257
- iconColor = "#666",
21258
- hoverIconColor = "#1890ff"
21259
- }) {
21260
- const [isHovered, setIsHovered] = React.useState(false);
21261
-
21262
- // Clone the icon and add color styling
21263
- const styledIcon = icon && typeof icon === 'object' ? {
21264
- ...icon,
21265
- props: {
21266
- ...icon.props,
21267
- style: {
21268
- color: isHovered ? hoverIconColor : iconColor
21269
- }
21270
- }
21271
- } : icon;
21272
- return /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
21273
- type: "default",
21274
- shape: "circle",
21275
- icon: styledIcon,
21276
- onClick: onClick,
21277
- style: {
21278
- position: "absolute",
21279
- right: !isLeft ? "40px" : "auto",
21280
- left: !isLeft ? "auto" : "40px",
21281
- top: "58%",
21282
- transform: "translateY(-50%)",
21283
- zIndex: 10,
21284
- backgroundColor: "rgba(255, 255, 255, 0.4)",
21285
- border: "1px solid rgba(0, 0, 0, 0.1)",
21286
- boxShadow: "0 2px 8px rgba(0, 0, 0, 0.2)",
21287
- width: "40px",
21288
- height: "40px",
21289
- display: "flex",
21290
- alignItems: "center",
21291
- justifyContent: "center"
21292
- },
21293
- onMouseEnter: e => {
21294
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 1)";
21295
- setIsHovered(true);
21296
- },
21297
- onMouseLeave: e => {
21298
- e.currentTarget.style.backgroundColor = "rgba(255, 255, 255, 0.4)";
21299
- setIsHovered(false);
21300
- }
21301
- });
21302
- }
21303
-
21304
- dt.div`
21305
- position: relative;
21306
-
21307
- .ant-carousel .slick-dots li button {
21308
- background: ${props => props.inactiveDotColor} !important;
21309
- opacity: 1 !important;
21310
- }
21311
-
21312
- .ant-carousel .slick-dots li.slick-active button {
21313
- background: ${props => props.activeDotColor} !important;
21314
- opacity: 1 !important;
21315
- }
21316
- `;
21317
-
21318
- const _excluded$d = ["title", "images", "height", "fallback", "activeDotColor", "inactiveDotColor", "arrowIconColor", "arrowHoverIconColor", "customArrows"];
21253
+ const _excluded$d = ["title", "images", "height", "fallback"];
21319
21254
  function ImageCarousel(_ref) {
21320
21255
  let {
21321
21256
  title,
21322
21257
  images,
21323
21258
  height = 400,
21324
- fallback = "/assets/images/empty-box.svg",
21325
- activeDotColor = "#1890ff",
21326
- inactiveDotColor = "rgba(255, 255, 255, 0.3)",
21327
- arrowIconColor = "#666",
21328
- arrowHoverIconColor = "#1890ff",
21329
- customArrows = false
21259
+ fallback = "/assets/images/empty-box.svg"
21330
21260
  } = _ref,
21331
21261
  rest = _objectWithoutProperties(_ref, _excluded$d);
21332
21262
  const [previewVisible, setPreviewVisible] = React.useState(false);
@@ -21335,57 +21265,38 @@ function ImageCarousel(_ref) {
21335
21265
  const handleCarouselChange = index => {
21336
21266
  setCurrent(index);
21337
21267
  };
21338
- const goToPrevious = () => {
21339
- var _carouselRef$current;
21340
- (_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 || _carouselRef$current.prev();
21341
- };
21342
- const goToNext = () => {
21343
- var _carouselRef$current2;
21344
- (_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 || _carouselRef$current2.next();
21345
- };
21346
21268
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
21347
21269
  children: [/*#__PURE__*/jsxRuntime.jsx(CarouselWidget, _objectSpread2(_objectSpread2({
21348
21270
  title: title
21349
21271
  }, rest), {}, {
21350
- arrows: false,
21351
- ref: carouselRef,
21352
- afterChange: handleCarouselChange,
21353
- infinite: true,
21354
- children: images.map((image, index) => {
21355
- const imageSrc = typeof image === "string" ? image : image.src;
21356
- const imageAlt = typeof image === "string" ? "".concat(title, " - Image ").concat(index + 1) : image.alt;
21357
- return /*#__PURE__*/jsxRuntime.jsx("div", {
21358
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Image, {
21359
- src: imageSrc,
21360
- alt: imageAlt,
21361
- height: height,
21362
- width: "100%",
21363
- fallback: fallback,
21364
- loading: "lazy",
21365
- preview: {
21366
- visible: false
21367
- },
21368
- onClick: () => {
21369
- setCurrent(index);
21370
- setPreviewVisible(true);
21371
- }
21372
- })
21373
- }, imageSrc);
21272
+ dots: false,
21273
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Carousel, {
21274
+ ref: carouselRef,
21275
+ afterChange: handleCarouselChange,
21276
+ infinite: true,
21277
+ children: images.map((image, index) => {
21278
+ const imageSrc = typeof image === "string" ? image : image.src;
21279
+ const imageAlt = typeof image === "string" ? "".concat(title, " - Image ").concat(index + 1) : image.alt;
21280
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
21281
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Image, {
21282
+ src: imageSrc,
21283
+ alt: imageAlt,
21284
+ height: height,
21285
+ width: "100%",
21286
+ fallback: fallback,
21287
+ loading: "lazy",
21288
+ preview: {
21289
+ visible: false
21290
+ },
21291
+ onClick: () => {
21292
+ setCurrent(index);
21293
+ setPreviewVisible(true);
21294
+ }
21295
+ })
21296
+ }, imageSrc);
21297
+ })
21374
21298
  })
21375
- })), customArrows && images && images.length > 1 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
21376
- children: [/*#__PURE__*/jsxRuntime.jsx(CustomArrowButton, {
21377
- icon: /*#__PURE__*/jsxRuntime.jsx(Icons.LeftOutlined, {}),
21378
- onClick: goToPrevious,
21379
- isLeft: true,
21380
- iconColor: arrowIconColor,
21381
- hoverIconColor: arrowHoverIconColor
21382
- }), /*#__PURE__*/jsxRuntime.jsx(CustomArrowButton, {
21383
- icon: /*#__PURE__*/jsxRuntime.jsx(Icons.RightOutlined, {}),
21384
- onClick: goToNext,
21385
- iconColor: arrowIconColor,
21386
- hoverIconColor: arrowHoverIconColor
21387
- })]
21388
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
21299
+ })), /*#__PURE__*/jsxRuntime.jsx("div", {
21389
21300
  style: {
21390
21301
  display: "none"
21391
21302
  },
@@ -21395,9 +21306,9 @@ function ImageCarousel(_ref) {
21395
21306
  current,
21396
21307
  onVisibleChange: vis => setPreviewVisible(vis),
21397
21308
  onChange: idx => {
21398
- var _carouselRef$current3;
21309
+ var _carouselRef$current;
21399
21310
  setCurrent(idx);
21400
- (_carouselRef$current3 = carouselRef.current) === null || _carouselRef$current3 === void 0 || _carouselRef$current3.goTo(idx);
21311
+ (_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 || _carouselRef$current.goTo(idx);
21401
21312
  }
21402
21313
  },
21403
21314
  children: images.map((image, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.209",
3
+ "version": "0.6.210",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -0,0 +1,185 @@
1
+ import React, { useState, useRef } from "react";
2
+ import styled from "styled-components";
3
+ import CarouselWidget from "../CarouselWidget/index.jsx";
4
+ import { Image, Carousel, Button } from "antd";
5
+ import { LeftOutlined, RightOutlined } from "@ant-design/icons";
6
+ import CustomArrowButton from "./components/CustomArrowButton/index.js";
7
+ import { StyledCarouselWrapper } from "./style.js";
8
+
9
+ /**
10
+ * @typedef {Object} ImageObject
11
+ * @property {string} src - The source URL of the image
12
+ * @property {string} alt - Alternative text for the image
13
+ */
14
+
15
+ /**
16
+ * ImageCarousel Component - A responsive image carousel with preview functionality and keyboard navigation
17
+ *
18
+ * @component
19
+ * @example
20
+ * // Basic usage with string URLs
21
+ * <ImageCarousel
22
+ * title="My Gallery"
23
+ * images={["image1.jpg", "image2.jpg"]}
24
+ * />
25
+ *
26
+ * @example
27
+ * // Advanced usage with image objects and custom height
28
+ * <ImageCarousel
29
+ * title="Nature Gallery"
30
+ * images={[
31
+ * { src: "landscape.jpg", alt: "Beautiful mountain landscape" },
32
+ * { src: "forest.jpg", alt: "Dense forest path" }
33
+ * ]}
34
+ * height={300}
35
+ * fallback="/custom-fallback.svg"
36
+ * />
37
+ *
38
+ * @param {Object} props - Component props
39
+ * @param {string} props.title - The title displayed in the widget header
40
+ * @param {(string|ImageObject)[]} props.images - Array of image URLs (strings) or image objects with src and alt properties
41
+ * @param {number} [props.height=400] - Height of the carousel images in pixels
42
+ * @param {string} [props.fallback="/assets/images/empty-box.svg"] - Fallback image URL when original image fails to load
43
+ * @param {string} [props.activeDotColor="#1890ff"] - Color of the active dot
44
+ * @param {string} [props.inactiveDotColor="rgba(255, 255, 255, 0.3)"] - Color of inactive dots
45
+ * @param {string} [props.arrowIconColor="#666"] - Default color of arrow icons
46
+ * @param {string} [props.arrowHoverIconColor="#1890ff"] - Color of arrow icons on hover
47
+ * @param {boolean} [props.customArrows=false] - Whether to show custom navigation arrows
48
+ * @param {Object} [props.rest] - Additional props passed to the underlying CarouselWidget component
49
+ *
50
+ * @features
51
+ * - ✅ Responsive image display with lazy loading
52
+ * - ✅ Click-to-preview with full-screen image viewer
53
+ * - ✅ Keyboard navigation in preview mode (← → arrow keys)
54
+ * - ✅ Automatic fallback for broken images
55
+ * - ✅ Support for both string URLs and image objects with alt text
56
+ * - ✅ Synchronized carousel and preview navigation
57
+ * - ✅ Infinite scrolling in both carousel and preview modes
58
+ * - ✅ Placeholder image for empty image arrays (/assets/images/no-image.svg)
59
+ * - ✅ Customizable dot colors via props
60
+ *
61
+ * @accessibility
62
+ * - Proper alt text support for screen readers
63
+ * - Keyboard navigation support
64
+ * - Focus management in preview mode
65
+ *
66
+ */
67
+ function ImageCarousel({
68
+ title,
69
+ images,
70
+ height = 400,
71
+ fallback = "/assets/images/empty-box.svg",
72
+ activeDotColor = "#1890ff",
73
+ inactiveDotColor = "rgba(255, 255, 255, 0.3)",
74
+ arrowIconColor = "#666",
75
+ arrowHoverIconColor = "#1890ff",
76
+ customArrows = false,
77
+ ...rest
78
+ }) {
79
+ const [previewVisible, setPreviewVisible] = useState(false);
80
+ const [current, setCurrent] = useState(0);
81
+ const carouselRef = useRef(null);
82
+
83
+ const handleCarouselChange = (index) => {
84
+ setCurrent(index);
85
+ };
86
+
87
+ const goToPrevious = () => {
88
+ carouselRef.current?.prev();
89
+ };
90
+
91
+ const goToNext = () => {
92
+ carouselRef.current?.next();
93
+ };
94
+
95
+
96
+ return (
97
+ <>
98
+ {/* <StyledCarouselWrapper
99
+ activeDotColor={activeDotColor}
100
+ inactiveDotColor={inactiveDotColor}
101
+ > */}
102
+ <CarouselWidget
103
+ title={title}
104
+ {...rest}
105
+ arrows={false}
106
+ ref={carouselRef}
107
+ afterChange={handleCarouselChange}
108
+ infinite
109
+ >
110
+ {images.map((image, index) => {
111
+ const imageSrc = typeof image === "string" ? image : image.src;
112
+ const imageAlt =
113
+ typeof image === "string"
114
+ ? `${title} - Image ${index + 1}`
115
+ : image.alt;
116
+
117
+ return (
118
+ <div key={imageSrc}>
119
+ <Image
120
+ src={imageSrc}
121
+ alt={imageAlt}
122
+ height={height}
123
+ width="100%"
124
+ fallback={fallback}
125
+ loading="lazy"
126
+ preview={{
127
+ visible: false,
128
+ }}
129
+ onClick={() => {
130
+ setCurrent(index);
131
+ setPreviewVisible(true);
132
+ }}
133
+ />
134
+ </div>
135
+ );
136
+ })}
137
+ </CarouselWidget>
138
+
139
+ {customArrows && images && images.length > 1 && (
140
+ <>
141
+ <CustomArrowButton
142
+ icon={<LeftOutlined />}
143
+ onClick={goToPrevious}
144
+ isLeft={true}
145
+ iconColor={arrowIconColor}
146
+ hoverIconColor={arrowHoverIconColor}
147
+ />
148
+ <CustomArrowButton
149
+ icon={<RightOutlined />}
150
+ onClick={goToNext}
151
+ iconColor={arrowIconColor}
152
+ hoverIconColor={arrowHoverIconColor}
153
+ />
154
+ </>
155
+ )}
156
+ {/* </StyledCarouselWrapper> */}
157
+
158
+ <div style={{ display: "none" }}>
159
+ <Image.PreviewGroup
160
+ preview={{
161
+ visible: previewVisible,
162
+ current,
163
+ onVisibleChange: (vis) => setPreviewVisible(vis),
164
+ onChange: (idx) => {
165
+ setCurrent(idx);
166
+ carouselRef.current?.goTo(idx);
167
+ },
168
+ }}
169
+ >
170
+ {images.map((image, index) => {
171
+ const imageSrc = typeof image === "string" ? image : image.src;
172
+ const imageAlt =
173
+ typeof image === "string"
174
+ ? `${title} - Image ${index + 1}`
175
+ : image.alt;
176
+
177
+ return <Image key={imageSrc} src={imageSrc} alt={imageAlt} />;
178
+ })}
179
+ </Image.PreviewGroup>
180
+ </div>
181
+ </>
182
+ );
183
+ }
184
+
185
+ export default ImageCarousel;
@@ -1,10 +1,6 @@
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, Button } from "antd";
5
- import { LeftOutlined, RightOutlined } from "@ant-design/icons";
6
- import CustomArrowButton from "./components/CustomArrowButton/index.js";
7
- import { StyledCarouselWrapper } from "./style.js";
3
+ import { Image, Carousel } from "antd";
8
4
 
9
5
  /**
10
6
  * @typedef {Object} ImageObject
@@ -40,11 +36,6 @@ import { StyledCarouselWrapper } from "./style.js";
40
36
  * @param {(string|ImageObject)[]} props.images - Array of image URLs (strings) or image objects with src and alt properties
41
37
  * @param {number} [props.height=400] - Height of the carousel images in pixels
42
38
  * @param {string} [props.fallback="/assets/images/empty-box.svg"] - Fallback image URL when original image fails to load
43
- * @param {string} [props.activeDotColor="#1890ff"] - Color of the active dot
44
- * @param {string} [props.inactiveDotColor="rgba(255, 255, 255, 0.3)"] - Color of inactive dots
45
- * @param {string} [props.arrowIconColor="#666"] - Default color of arrow icons
46
- * @param {string} [props.arrowHoverIconColor="#1890ff"] - Color of arrow icons on hover
47
- * @param {boolean} [props.customArrows=false] - Whether to show custom navigation arrows
48
39
  * @param {Object} [props.rest] - Additional props passed to the underlying CarouselWidget component
49
40
  *
50
41
  * @features
@@ -55,8 +46,6 @@ import { StyledCarouselWrapper } from "./style.js";
55
46
  * - ✅ Support for both string URLs and image objects with alt text
56
47
  * - ✅ Synchronized carousel and preview navigation
57
48
  * - ✅ Infinite scrolling in both carousel and preview modes
58
- * - ✅ Placeholder image for empty image arrays (/assets/images/no-image.svg)
59
- * - ✅ Customizable dot colors via props
60
49
  *
61
50
  * @accessibility
62
51
  * - Proper alt text support for screen readers
@@ -69,11 +58,6 @@ function ImageCarousel({
69
58
  images,
70
59
  height = 400,
71
60
  fallback = "/assets/images/empty-box.svg",
72
- activeDotColor = "#1890ff",
73
- inactiveDotColor = "rgba(255, 255, 255, 0.3)",
74
- arrowIconColor = "#666",
75
- arrowHoverIconColor = "#1890ff",
76
- customArrows = false,
77
61
  ...rest
78
62
  }) {
79
63
  const [previewVisible, setPreviewVisible] = useState(false);
@@ -84,29 +68,10 @@ function ImageCarousel({
84
68
  setCurrent(index);
85
69
  };
86
70
 
87
- const goToPrevious = () => {
88
- carouselRef.current?.prev();
89
- };
90
-
91
- const goToNext = () => {
92
- carouselRef.current?.next();
93
- };
94
-
95
-
96
71
  return (
97
72
  <>
98
- {/* <StyledCarouselWrapper
99
- activeDotColor={activeDotColor}
100
- inactiveDotColor={inactiveDotColor}
101
- > */}
102
- <CarouselWidget
103
- title={title}
104
- {...rest}
105
- arrows={false}
106
- ref={carouselRef}
107
- afterChange={handleCarouselChange}
108
- infinite
109
- >
73
+ <CarouselWidget title={title} {...rest} dots={false}>
74
+ <Carousel ref={carouselRef} afterChange={handleCarouselChange} infinite>
110
75
  {images.map((image, index) => {
111
76
  const imageSrc = typeof image === "string" ? image : image.src;
112
77
  const imageAlt =
@@ -134,26 +99,8 @@ function ImageCarousel({
134
99
  </div>
135
100
  );
136
101
  })}
137
- </CarouselWidget>
138
-
139
- {customArrows && images && images.length > 1 && (
140
- <>
141
- <CustomArrowButton
142
- icon={<LeftOutlined />}
143
- onClick={goToPrevious}
144
- isLeft={true}
145
- iconColor={arrowIconColor}
146
- hoverIconColor={arrowHoverIconColor}
147
- />
148
- <CustomArrowButton
149
- icon={<RightOutlined />}
150
- onClick={goToNext}
151
- iconColor={arrowIconColor}
152
- hoverIconColor={arrowHoverIconColor}
153
- />
154
- </>
155
- )}
156
- {/* </StyledCarouselWrapper> */}
102
+ </Carousel>
103
+ </CarouselWidget>
157
104
 
158
105
  <div style={{ display: "none" }}>
159
106
  <Image.PreviewGroup
@@ -182,4 +129,4 @@ function ImageCarousel({
182
129
  );
183
130
  }
184
131
 
185
- export default ImageCarousel;
132
+ export default ImageCarousel;