@treely/strapi-slices 5.3.2 → 5.4.0

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.
@@ -4,6 +4,7 @@ export interface FullScreenImageProps {
4
4
  images: StrapiImage[];
5
5
  isOpen: boolean;
6
6
  onClose: () => void;
7
- openIndex?: number;
7
+ currentIndex?: number;
8
+ setCurrentIndex?: (callback: (c: number) => number) => void;
8
9
  }
9
- export declare const FullScreenImage: ({ images, isOpen, onClose, openIndex, }: FullScreenImageProps) => React.JSX.Element;
10
+ export declare const FullScreenImage: ({ images, isOpen, onClose, currentIndex, setCurrentIndex, }: FullScreenImageProps) => React.JSX.Element;
@@ -8,6 +8,7 @@ declare const messagesDe: {
8
8
  'features.projectInfo.properties.projectDeveloper': string;
9
9
  'features.projectInfo.properties.verificationStandard.label': string;
10
10
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
11
+ 'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
11
12
  'features.projectInfo.properties.forecastedAmountYear.label': string;
12
13
  'features.projectInfo.properties.riskBuffer': string;
13
14
  'features.projectInfo.properties.year': string;
@@ -8,6 +8,7 @@ declare const messagesEn: {
8
8
  'features.projectInfo.properties.projectDeveloper': string;
9
9
  'features.projectInfo.properties.verificationStandard.label': string;
10
10
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
11
+ 'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
11
12
  'features.projectInfo.properties.forecastedAmountYear.label': string;
12
13
  'features.projectInfo.properties.riskBuffer': string;
13
14
  'features.projectInfo.properties.year': string;
@@ -50,6 +50,7 @@ declare const rootMessagesDe: {
50
50
  'features.projectInfo.properties.projectDeveloper': string;
51
51
  'features.projectInfo.properties.verificationStandard.label': string;
52
52
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
53
+ 'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
53
54
  'features.projectInfo.properties.forecastedAmountYear.label': string;
54
55
  'features.projectInfo.properties.riskBuffer': string;
55
56
  'features.projectInfo.properties.year': string;
@@ -50,6 +50,7 @@ declare const rootMessagesEn: {
50
50
  'features.projectInfo.properties.projectDeveloper': string;
51
51
  'features.projectInfo.properties.verificationStandard.label': string;
52
52
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': string;
53
+ 'features.projectInfo.properties.verificationStandard.value.MfKWCH': string;
53
54
  'features.projectInfo.properties.forecastedAmountYear.label': string;
54
55
  'features.projectInfo.properties.riskBuffer': string;
55
56
  'features.projectInfo.properties.year': string;
@@ -734,45 +734,50 @@ var FullScreenImage = function FullScreenImage(_ref) {
734
734
  var images = _ref.images,
735
735
  isOpen = _ref.isOpen,
736
736
  onClose = _ref.onClose,
737
- openIndex = _ref.openIndex;
738
- var _useState = React.useState(0),
739
- imageIndex = _useState[0],
740
- setImageIndex = _useState[1];
737
+ _ref$currentIndex = _ref.currentIndex,
738
+ currentIndex = _ref$currentIndex === void 0 ? 0 : _ref$currentIndex,
739
+ setCurrentIndex = _ref.setCurrentIndex;
741
740
  var containerRef = React.useRef(null);
742
741
  reactUse.useLockBodyScroll(isOpen);
743
- var canMoveRight = imageIndex < images.length - 1;
744
- var canMoveLeft = imageIndex !== 0;
745
- var onRight = function onRight() {
746
- return setImageIndex(function (p) {
747
- return canMoveRight ? p + 1 : p;
742
+ var canMoveRight = React.useMemo(function () {
743
+ return currentIndex < images.length - 1;
744
+ }, [currentIndex, images.length]);
745
+ var canMoveLeft = React.useMemo(function () {
746
+ return currentIndex !== 0;
747
+ }, [currentIndex]);
748
+ var onRight = React.useCallback(function () {
749
+ return canMoveRight && setCurrentIndex && setCurrentIndex(function (c) {
750
+ return c + 1;
748
751
  });
749
- };
750
- var onLeft = function onLeft() {
751
- return setImageIndex(function (p) {
752
- return canMoveLeft ? p - 1 : p;
752
+ }, [canMoveRight]);
753
+ var onLeft = React.useCallback(function () {
754
+ return canMoveLeft && setCurrentIndex && setCurrentIndex(function (c) {
755
+ return c - 1;
753
756
  });
754
- };
757
+ }, [canMoveLeft]);
755
758
  reactUse.useKey('ArrowRight', onRight, {}, [onRight]);
756
759
  reactUse.useKey('ArrowLeft', onLeft, {}, [onLeft]);
757
760
  React.useEffect(function () {
758
- if (openIndex !== undefined) {
759
- setImageIndex(openIndex);
761
+ if (!!isOpen) {
762
+ setTimeout(function () {
763
+ var _containerRef$current;
764
+ containerRef == null || (_containerRef$current = containerRef.current) == null || _containerRef$current.scrollTo({
765
+ left: currentIndex * containerRef.current.clientWidth,
766
+ behavior: 'instant'
767
+ });
768
+ }, 10);
760
769
  }
761
- }, [openIndex]);
770
+ }, [isOpen]);
762
771
  React.useEffect(function () {
763
772
  if (containerRef.current) {
764
773
  containerRef.current.scrollTo({
765
- left: imageIndex * containerRef.current.clientWidth,
774
+ left: currentIndex * containerRef.current.clientWidth,
766
775
  behavior: 'smooth'
767
776
  });
768
777
  }
769
- }, [imageIndex, containerRef]);
770
- var onCloseLocal = function onCloseLocal() {
771
- setImageIndex(0);
772
- onClose();
773
- };
778
+ }, [currentIndex, containerRef]);
774
779
  return React__default.default.createElement(boemly.BoemlyModal, {
775
- onClose: onCloseLocal,
780
+ onClose: onClose,
776
781
  isOpen: isOpen,
777
782
  title: "",
778
783
  trigger: "",
@@ -2051,6 +2056,7 @@ var messagesDe$6 = {
2051
2056
  'features.projectInfo.properties.projectDeveloper': 'Projekt Entwickler',
2052
2057
  'features.projectInfo.properties.verificationStandard.label': 'Verifizierungsstandard',
2053
2058
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
2059
+ 'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
2054
2060
  'features.projectInfo.properties.forecastedAmountYear.label': 'Projektvolumen',
2055
2061
  'features.projectInfo.properties.riskBuffer': 'Anteil Risikopuffer',
2056
2062
  'features.projectInfo.properties.year': '{years} {years, plural, one {Jahr} other {Jahre} }'
@@ -2165,6 +2171,7 @@ var messagesEn$4 = {
2165
2171
  'features.projectInfo.properties.projectDeveloper': 'Project Developer',
2166
2172
  'features.projectInfo.properties.verificationStandard.label': 'Verification Standard',
2167
2173
  'features.projectInfo.properties.verificationStandard.value.SilvaconsultFCSISO14': 'SILVACONSULT® Forest Carbon Standard, ISO 14064-2',
2174
+ 'features.projectInfo.properties.verificationStandard.value.MfKWCH': 'Methodik für Klimaschutzprojekte im Wald für die Schweiz',
2168
2175
  'features.projectInfo.properties.forecastedAmountYear.label': 'Project Volume',
2169
2176
  'features.projectInfo.properties.riskBuffer': 'Risk Buffer Share',
2170
2177
  'features.projectInfo.properties.year': '{years} {years, plural, one {year} other {years} }'
@@ -3339,7 +3346,8 @@ var FullWidthImageSlider = function FullWidthImageSlider(_ref) {
3339
3346
  images: slice.images.map(function (image) {
3340
3347
  return image.img;
3341
3348
  }),
3342
- openIndex: sliderIndex,
3349
+ currentIndex: sliderIndex,
3350
+ setCurrentIndex: setSliderIndex,
3343
3351
  isOpen: isOpen,
3344
3352
  onClose: function onClose() {
3345
3353
  return setIsOpen(false);