@crystaldesign/widget-image-carousel 25.10.0-rc.2 → 25.10.0-rc.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.
@@ -47,7 +47,8 @@ function useImageCarousel(_ref) {
47
47
  useCss(settings);
48
48
  var _useProductData = useProductData({
49
49
  productIds: productIds,
50
- widgetType: 'IMAGECAROUSEL'
50
+ widgetType: 'IMAGECAROUSEL',
51
+ standaloneWidget: settings.type === 'SIMPLE_PRODUCT_LIST'
51
52
  }),
52
53
  getProductsByDivaNrs = _useProductData.getProductsByDivaNrs,
53
54
  getProductByDivaNrAndVariantId = _useProductData.getProductByDivaNrAndVariantId,
@@ -88,11 +89,11 @@ function useImageCarousel(_ref) {
88
89
  case 0:
89
90
  _context.prev = 0;
90
91
  setLoading(true);
91
- if (!selectedProduct) {
92
- _context.next = 26;
92
+ mediaFunctionType = (_settings$mediaFuncti = settings.mediaFunctionType) !== null && _settings$mediaFuncti !== void 0 ? _settings$mediaFuncti : 'SHO';
93
+ if (!(selectedProduct && settings.type !== 'SIMPLE_PRODUCT_LIST')) {
94
+ _context.next = 21;
93
95
  break;
94
96
  }
95
- mediaFunctionType = (_settings$mediaFuncti = settings.mediaFunctionType) !== null && _settings$mediaFuncti !== void 0 ? _settings$mediaFuncti : 'SHO';
96
97
  if (!(settings.type === 'WALL_MOCKUPS')) {
97
98
  _context.next = 11;
98
99
  break;
@@ -104,7 +105,7 @@ function useImageCarousel(_ref) {
104
105
  if (foundMedia) {
105
106
  setMedia(foundMedia);
106
107
  }
107
- _context.next = 26;
108
+ _context.next = 19;
108
109
  break;
109
110
  case 11:
110
111
  if (!(settings.type === 'SIMILAR_PRODUCTS')) {
@@ -118,47 +119,52 @@ function useImageCarousel(_ref) {
118
119
  if (_foundMedia) {
119
120
  setMedia(_foundMedia);
120
121
  }
121
- _context.next = 26;
122
+ _context.next = 19;
122
123
  break;
123
124
  case 18:
124
- if (!(settings.type === 'SIMPLE_PRODUCT_LIST' && productIds)) {
125
- _context.next = 25;
125
+ throw new Error('Invalid type or invalid data');
126
+ case 19:
127
+ _context.next = 29;
128
+ break;
129
+ case 21:
130
+ if (!(productIds !== null && productIds !== void 0 && productIds.length && settings.type === 'SIMPLE_PRODUCT_LIST')) {
131
+ _context.next = 28;
126
132
  break;
127
133
  }
128
- _context.next = 21;
134
+ _context.next = 24;
129
135
  return getSimpleProductList(productIds, mediaFunctionType, settings.description);
130
- case 21:
136
+ case 24:
131
137
  _foundMedia2 = _context.sent;
132
138
  if (_foundMedia2) {
133
139
  setMedia(_foundMedia2);
134
140
  }
135
- _context.next = 26;
141
+ _context.next = 29;
136
142
  break;
137
- case 25:
143
+ case 28:
138
144
  throw new Error('Invalid type or invalid data');
139
- case 26:
140
- _context.next = 32;
145
+ case 29:
146
+ _context.next = 35;
141
147
  break;
142
- case 28:
143
- _context.prev = 28;
148
+ case 31:
149
+ _context.prev = 31;
144
150
  _context.t0 = _context["catch"](0);
145
151
  console.error(_context.t0);
146
152
  setError(_context.t0);
147
- case 32:
148
- _context.prev = 32;
149
- setLoading(false);
150
- return _context.finish(32);
151
153
  case 35:
154
+ _context.prev = 35;
155
+ setLoading(false);
156
+ return _context.finish(35);
157
+ case 38:
152
158
  case "end":
153
159
  return _context.stop();
154
160
  }
155
- }, _callee, null, [[0, 28, 32, 35]]);
161
+ }, _callee, null, [[0, 31, 35, 38]]);
156
162
  }));
157
163
  return function loadMockups() {
158
164
  return _ref2.apply(this, arguments);
159
165
  };
160
166
  }();
161
- if (selectedProduct && productIds !== null && productIds !== void 0 && productIds.length) {
167
+ if (selectedProduct || productIds !== null && productIds !== void 0 && productIds.length && settings.type === 'SIMPLE_PRODUCT_LIST') {
162
168
  loadMockups();
163
169
  }
164
170
  }, [selectedProduct, productIds]);
@@ -498,6 +504,7 @@ var OpenConfiguratorButton = function OpenConfiguratorButton(_ref) {
498
504
  function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
499
505
  function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
500
506
  var SwiperComponent = function SwiperComponent(_ref) {
507
+ var _settings$sliderProp;
501
508
  var media = _ref.media,
502
509
  settings = _ref.settings,
503
510
  onClickProduct = _ref.onClickProduct,
@@ -509,6 +516,7 @@ var SwiperComponent = function SwiperComponent(_ref) {
509
516
  navigation: true,
510
517
  className: classNames(['diva-widget-image-carousel-swiper'])
511
518
  }, settings.sliderProp), {}, {
519
+ loop: ((_settings$sliderProp = settings.sliderProp) === null || _settings$sliderProp === void 0 ? void 0 : _settings$sliderProp.loop) && media.length > 1,
512
520
  children: media.map(function (m, i) {
513
521
  var _settings$openConfigu, _settings$openConfigu2, _settings$openConfigu3, _settings$openConfigu4;
514
522
  return /*#__PURE__*/jsx(SwiperSlide, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Swiper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,YAAY,CAAC;AACpB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4CAA4C,CAAC;AAGlF,UAAU,oBAAoB;IAC5B,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,QAAQ,EAAE,aAAa,CAAC;IACxB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAiD1D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Swiper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,YAAY,CAAC;AACpB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4CAA4C,CAAC;AAGlF,UAAU,oBAAoB;IAC5B,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,QAAQ,EAAE,aAAa,CAAC;IACxB,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAuD1D,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { WithDivaMock } from '@crystaldesign/diva-core';
3
+ import { ImageCarouselProps } from '../../types';
4
+ declare const meta: Meta<WithDivaMock<ImageCarouselProps>>;
5
+ export default meta;
6
+ type Story = StoryObj<WithDivaMock<ImageCarouselProps>>;
7
+ export declare const ImageCarousel: Story;
8
+ //# sourceMappingURL=kirchner-test.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kirchner-test.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/stories/SimpleProductList/kirchner-test.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAqB,MAAM,0BAA0B,CAAC;AAG3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAIjD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAmBhD,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC;AA8CxD,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useImageCarousel.d.ts","sourceRoot":"","sources":["../../../../src/useImageCarousel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKpD,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,kBAAkB;;;;gCAiB7D,MAAM;EA2LrB"}
1
+ {"version":3,"file":"useImageCarousel.d.ts","sourceRoot":"","sources":["../../../../src/useImageCarousel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKpD,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,kBAAkB;;;;gCAkB7D,MAAM;EA6LrB"}