datastake-daf 0.6.207 → 0.6.209

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.
@@ -21301,7 +21301,7 @@ function CustomArrowButton({
21301
21301
  });
21302
21302
  }
21303
21303
 
21304
- const StyledCarouselWrapper = dt.div`
21304
+ dt.div`
21305
21305
  position: relative;
21306
21306
 
21307
21307
  .ant-carousel .slick-dots li button {
@@ -21315,7 +21315,7 @@ const StyledCarouselWrapper = dt.div`
21315
21315
  }
21316
21316
  `;
21317
21317
 
21318
- const _excluded$d = ["title", "images", "height", "fallback", "activeDotColor", "inactiveDotColor", "arrowIconColor", "arrowHoverIconColor"];
21318
+ const _excluded$d = ["title", "images", "height", "fallback", "activeDotColor", "inactiveDotColor", "arrowIconColor", "arrowHoverIconColor", "customArrows"];
21319
21319
  function ImageCarousel(_ref) {
21320
21320
  let {
21321
21321
  title,
@@ -21325,7 +21325,8 @@ function ImageCarousel(_ref) {
21325
21325
  activeDotColor = "#1890ff",
21326
21326
  inactiveDotColor = "rgba(255, 255, 255, 0.3)",
21327
21327
  arrowIconColor = "#666",
21328
- arrowHoverIconColor = "#1890ff"
21328
+ arrowHoverIconColor = "#1890ff",
21329
+ customArrows = false
21329
21330
  } = _ref,
21330
21331
  rest = _objectWithoutProperties(_ref, _excluded$d);
21331
21332
  const [previewVisible, setPreviewVisible] = React.useState(false);
@@ -21342,72 +21343,49 @@ function ImageCarousel(_ref) {
21342
21343
  var _carouselRef$current2;
21343
21344
  (_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 || _carouselRef$current2.next();
21344
21345
  };
21345
-
21346
- // Check if images array is empty or invalid
21347
- const hasImages = images && images.length > 0;
21348
21346
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
21349
- children: [/*#__PURE__*/jsxRuntime.jsxs(StyledCarouselWrapper, {
21350
- activeDotColor: activeDotColor,
21351
- inactiveDotColor: inactiveDotColor,
21352
- children: [/*#__PURE__*/jsxRuntime.jsx(CarouselWidget, _objectSpread2(_objectSpread2({
21353
- title: title
21354
- }, rest), {}, {
21355
- arrows: false,
21356
- ref: carouselRef,
21357
- afterChange: handleCarouselChange,
21358
- infinite: hasImages,
21359
- dots: hasImages,
21360
- children: hasImages ? images.map((image, index) => {
21361
- const imageSrc = typeof image === "string" ? image : image.src;
21362
- const imageAlt = typeof image === "string" ? "".concat(title, " - Image ").concat(index + 1) : image.alt;
21363
- return /*#__PURE__*/jsxRuntime.jsx("div", {
21364
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Image, {
21365
- src: imageSrc,
21366
- alt: imageAlt,
21367
- height: height,
21368
- width: "100%",
21369
- fallback: fallback,
21370
- loading: "lazy",
21371
- preview: {
21372
- visible: false
21373
- },
21374
- onClick: () => {
21375
- setCurrent(index);
21376
- setPreviewVisible(true);
21377
- }
21378
- })
21379
- }, imageSrc);
21380
- }) :
21381
- /*#__PURE__*/
21382
- // No images - show placeholder
21383
- jsxRuntime.jsx("div", {
21347
+ children: [/*#__PURE__*/jsxRuntime.jsx(CarouselWidget, _objectSpread2(_objectSpread2({
21348
+ title: title
21349
+ }, 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", {
21384
21358
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Image, {
21385
- src: "/assets/images/no-image.svg",
21386
- alt: "No images available",
21359
+ src: imageSrc,
21360
+ alt: imageAlt,
21387
21361
  height: height,
21388
21362
  width: "100%",
21389
21363
  fallback: fallback,
21390
- preview: false,
21391
- style: {
21392
- objectFit: "contain"
21364
+ loading: "lazy",
21365
+ preview: {
21366
+ visible: false
21367
+ },
21368
+ onClick: () => {
21369
+ setCurrent(index);
21370
+ setPreviewVisible(true);
21393
21371
  }
21394
21372
  })
21395
- })
21396
- })), hasImages && images.length > 1 && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
21397
- children: [/*#__PURE__*/jsxRuntime.jsx(CustomArrowButton, {
21398
- icon: /*#__PURE__*/jsxRuntime.jsx(Icons.LeftOutlined, {}),
21399
- onClick: goToPrevious,
21400
- isLeft: true,
21401
- iconColor: arrowIconColor,
21402
- hoverIconColor: arrowHoverIconColor
21403
- }), /*#__PURE__*/jsxRuntime.jsx(CustomArrowButton, {
21404
- icon: /*#__PURE__*/jsxRuntime.jsx(Icons.RightOutlined, {}),
21405
- onClick: goToNext,
21406
- iconColor: arrowIconColor,
21407
- hoverIconColor: arrowHoverIconColor
21408
- })]
21373
+ }, imageSrc);
21374
+ })
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
21409
21387
  })]
21410
- }), hasImages && /*#__PURE__*/jsxRuntime.jsx("div", {
21388
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
21411
21389
  style: {
21412
21390
  display: "none"
21413
21391
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.207",
3
+ "version": "0.6.209",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -94,7 +94,7 @@ export const Primary = {
94
94
  args: {
95
95
  title: "Nature Gallery",
96
96
  height: 400,
97
- arrows: true
97
+ customArrows: true
98
98
  },
99
99
  };
100
100
 
@@ -44,6 +44,7 @@ import { StyledCarouselWrapper } from "./style.js";
44
44
  * @param {string} [props.inactiveDotColor="rgba(255, 255, 255, 0.3)"] - Color of inactive dots
45
45
  * @param {string} [props.arrowIconColor="#666"] - Default color of arrow icons
46
46
  * @param {string} [props.arrowHoverIconColor="#1890ff"] - Color of arrow icons on hover
47
+ * @param {boolean} [props.customArrows=false] - Whether to show custom navigation arrows
47
48
  * @param {Object} [props.rest] - Additional props passed to the underlying CarouselWidget component
48
49
  *
49
50
  * @features
@@ -72,6 +73,7 @@ function ImageCarousel({
72
73
  inactiveDotColor = "rgba(255, 255, 255, 0.3)",
73
74
  arrowIconColor = "#666",
74
75
  arrowHoverIconColor = "#1890ff",
76
+ customArrows = false,
75
77
  ...rest
76
78
  }) {
77
79
  const [previewVisible, setPreviewVisible] = useState(false);
@@ -90,25 +92,22 @@ function ImageCarousel({
90
92
  carouselRef.current?.next();
91
93
  };
92
94
 
93
- // Check if images array is empty or invalid
94
- const hasImages = images && images.length > 0;
95
95
 
96
96
  return (
97
97
  <>
98
- <StyledCarouselWrapper
98
+ {/* <StyledCarouselWrapper
99
99
  activeDotColor={activeDotColor}
100
100
  inactiveDotColor={inactiveDotColor}
101
- >
101
+ > */}
102
102
  <CarouselWidget
103
103
  title={title}
104
104
  {...rest}
105
105
  arrows={false}
106
106
  ref={carouselRef}
107
107
  afterChange={handleCarouselChange}
108
- infinite={hasImages}
109
- dots={hasImages}
108
+ infinite
110
109
  >
111
- {hasImages ? images.map((image, index) => {
110
+ {images.map((image, index) => {
112
111
  const imageSrc = typeof image === "string" ? image : image.src;
113
112
  const imageAlt =
114
113
  typeof image === "string"
@@ -134,25 +133,10 @@ function ImageCarousel({
134
133
  />
135
134
  </div>
136
135
  );
137
- }) : (
138
- // No images - show placeholder
139
- <div>
140
- <Image
141
- src="/assets/images/no-image.svg"
142
- alt="No images available"
143
- height={height}
144
- width="100%"
145
- fallback={fallback}
146
- preview={false}
147
- style={{
148
- objectFit: "contain",
149
- }}
150
- />
151
- </div>
152
- )}
136
+ })}
153
137
  </CarouselWidget>
154
138
 
155
- {hasImages && images.length > 1 && (
139
+ {customArrows && images && images.length > 1 && (
156
140
  <>
157
141
  <CustomArrowButton
158
142
  icon={<LeftOutlined />}
@@ -169,23 +153,21 @@ function ImageCarousel({
169
153
  />
170
154
  </>
171
155
  )}
172
- </StyledCarouselWrapper>
156
+ {/* </StyledCarouselWrapper> */}
173
157
 
174
- {/* Preview functionality - only show if there are images */}
175
- {hasImages && (
176
- <div style={{ display: "none" }}>
177
- <Image.PreviewGroup
178
- preview={{
179
- visible: previewVisible,
180
- current,
181
- onVisibleChange: (vis) => setPreviewVisible(vis),
182
- onChange: (idx) => {
183
- setCurrent(idx);
184
- carouselRef.current?.goTo(idx);
185
- },
186
- }}
187
- >
188
- {images.map((image, index) => {
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) => {
189
171
  const imageSrc = typeof image === "string" ? image : image.src;
190
172
  const imageAlt =
191
173
  typeof image === "string"
@@ -193,10 +175,9 @@ function ImageCarousel({
193
175
  : image.alt;
194
176
 
195
177
  return <Image key={imageSrc} src={imageSrc} alt={imageAlt} />;
196
- })}
197
- </Image.PreviewGroup>
198
- </div>
199
- )}
178
+ })}
179
+ </Image.PreviewGroup>
180
+ </div>
200
181
  </>
201
182
  );
202
183
  }