@crystaldesign/widget-image-carousel 25.9.0-beta.37 → 25.9.0-beta.38

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.
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import { useState, useEffect } from 'react';
2
+ import { useState, useCallback, useEffect } from 'react';
3
3
  import { useCss, useProductData, useConfiguration } from '@crystaldesign/widget-library';
4
4
  import { Swiper, SwiperSlide } from 'swiper/react';
5
5
  import { Navigation } from 'swiper/modules';
@@ -51,6 +51,15 @@ function useImageCarousel(_ref) {
51
51
  setSelectedProductId = _useProductData.setSelectedProductId,
52
52
  selectedProduct = _useProductData.selectedProduct,
53
53
  setProductCache = _useProductData.setProductCache;
54
+ var onClickProduct = useCallback(function (productId) {
55
+ setSelectedProductId(productId);
56
+ if (!settings.disableScrollToTop) {
57
+ window.scrollTo({
58
+ top: 0,
59
+ behavior: 'smooth'
60
+ });
61
+ }
62
+ }, [setSelectedProductId]);
54
63
  useEffect(function () {
55
64
  var loadMockups = /*#__PURE__*/function () {
56
65
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
@@ -124,7 +133,7 @@ function useImageCarousel(_ref) {
124
133
  media: media,
125
134
  error: error,
126
135
  loading: loading,
127
- setSelectedProductId: setSelectedProductId
136
+ setSelectedProductId: onClickProduct
128
137
  };
129
138
  function getWallMockups(_x, _x2) {
130
139
  return _getWallMockups.apply(this, arguments);
@@ -9,5 +9,6 @@ export interface Configuration extends BaseConfiguration {
9
9
  mediaFunctionType?: string;
10
10
  description?: string;
11
11
  sliderProp?: SwiperProps;
12
+ disableScrollToTop?: boolean;
12
13
  }
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,aAAa,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAC1C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,WAAW,CAAC;CAC1B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,aAAa,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,iBAAiB;IACtD,IAAI,EAAE,cAAc,GAAG,kBAAkB,CAAC;IAC1C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B"}
@@ -8,7 +8,7 @@ export declare function useImageCarousel({ productId, settings }: ImageCarouselP
8
8
  media: Media[];
9
9
  error: Error | undefined;
10
10
  loading: boolean;
11
- setSelectedProductId: (productId: string) => Promise<void>;
11
+ setSelectedProductId: (productId: string) => void;
12
12
  };
13
13
  export {};
14
14
  //# sourceMappingURL=useImageCarousel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useImageCarousel.d.ts","sourceRoot":"","sources":["../../../../src/useImageCarousel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAM7C,UAAU,KAAK;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB;;;;;EAgK3E"}
1
+ {"version":3,"file":"useImageCarousel.d.ts","sourceRoot":"","sources":["../../../../src/useImageCarousel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAM7C,UAAU,KAAK;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,kBAAkB;;;;sCAa5D,MAAM;EA6JrB"}