@festo-ui/react 5.0.0-dev.149 → 5.0.0-dev.151

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.
Files changed (32) hide show
  1. package/index.css +1 -1
  2. package/index.d.ts +1 -0
  3. package/index.js +1 -0
  4. package/lib/components/modals/Modal.d.ts +4 -6
  5. package/lib/components/modals/Modal.js +28 -61
  6. package/lib/components/modals/ModalBase.d.ts +9 -0
  7. package/lib/components/modals/ModalBase.js +59 -0
  8. package/lib/components/modals/imageGallery/BaseGallery.d.ts +18 -0
  9. package/lib/components/modals/imageGallery/BaseGallery.js +77 -0
  10. package/lib/components/modals/imageGallery/ImageGallery.d.ts +15 -0
  11. package/lib/components/modals/imageGallery/ImageGallery.helper.d.ts +3 -0
  12. package/lib/components/modals/imageGallery/ImageGallery.helper.js +11 -0
  13. package/lib/components/modals/imageGallery/ImageGallery.js +77 -0
  14. package/lib/components/modals/imageGallery/ImageGallery.stories.helper.d.ts +3 -0
  15. package/lib/components/modals/imageGallery/ImageGallery.stories.helper.js +108 -0
  16. package/lib/components/modals/imageGallery/ImageGalleryContent.d.ts +10 -0
  17. package/lib/components/modals/imageGallery/ImageGalleryContent.js +16 -0
  18. package/lib/components/modals/imageGallery/ImageGalleryPagination.d.ts +8 -0
  19. package/lib/components/modals/imageGallery/ImageGalleryPagination.js +30 -0
  20. package/lib/components/modals/imageGallery/useClasses.d.ts +0 -0
  21. package/lib/components/modals/imageGallery/useClasses.js +0 -0
  22. package/node/index.js +7 -0
  23. package/node/lib/components/modals/Modal.js +27 -59
  24. package/node/lib/components/modals/ModalBase.js +65 -0
  25. package/node/lib/components/modals/imageGallery/BaseGallery.js +83 -0
  26. package/node/lib/components/modals/imageGallery/ImageGallery.helper.js +19 -0
  27. package/node/lib/components/modals/imageGallery/ImageGallery.js +83 -0
  28. package/node/lib/components/modals/imageGallery/ImageGallery.stories.helper.js +124 -0
  29. package/node/lib/components/modals/imageGallery/ImageGalleryContent.js +20 -0
  30. package/node/lib/components/modals/imageGallery/ImageGalleryPagination.js +34 -0
  31. package/node/lib/components/modals/imageGallery/useClasses.js +1 -0
  32. package/package.json +2 -2
@@ -0,0 +1,108 @@
1
+ /* eslint-disable import/no-relative-packages */
2
+ // @ts-ignore
3
+ import Asset1 from '../../../../../../web-essentials/stories/assets/gallery-01.webp';
4
+ // @ts-ignore
5
+ import Asset2 from '../../../../../../web-essentials/stories/assets/gallery-02.webp';
6
+ // @ts-ignore
7
+ import Asset3 from '../../../../../../web-essentials/stories/assets/gallery-03.webp';
8
+ // @ts-ignore
9
+ import Asset4 from '../../../../../../web-essentials/stories/assets/gallery-04.webp';
10
+ // @ts-ignore
11
+ import Asset5 from '../../../../../../web-essentials/stories/assets/gallery-05.webp';
12
+ // @ts-ignore
13
+ import Asset6 from '../../../../../../web-essentials/stories/assets/gallery-06.webp';
14
+ // @ts-ignore
15
+ import Asset7 from '../../../../../../web-essentials/stories/assets/gallery-07.webp';
16
+ // @ts-ignore
17
+ import Asset8 from '../../../../../../web-essentials/stories/assets/gallery-08.webp';
18
+ // @ts-ignore
19
+ import Asset9 from '../../../../../../web-essentials/stories/assets/gallery-09.webp';
20
+ // @ts-ignore
21
+ import AssetTen from '../../../../../../web-essentials/stories/assets/gallery-10.webp';
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ import { jsxs as _jsxs } from "react/jsx-runtime";
24
+ import { Fragment as _Fragment } from "react/jsx-runtime";
25
+ const images = [{
26
+ src: Asset1,
27
+ alt: 'Asset1',
28
+ content: {
29
+ title: 'Asset 1',
30
+ body: 'Asset 1 description'
31
+ }
32
+ }, {
33
+ src: Asset2,
34
+ alt: 'Asset2',
35
+ containMode: true,
36
+ content: {
37
+ title: 'Asset 2',
38
+ body: /*#__PURE__*/_jsxs(_Fragment, {
39
+ children: [/*#__PURE__*/_jsx("p", {
40
+ children: "Asset 2 description with some html inside."
41
+ }), /*#__PURE__*/_jsxs("ul", {
42
+ children: [/*#__PURE__*/_jsx("li", {
43
+ children: "bullet point 1"
44
+ }), /*#__PURE__*/_jsx("li", {
45
+ children: "bullet point 2"
46
+ })]
47
+ })]
48
+ })
49
+ }
50
+ }, {
51
+ src: Asset3,
52
+ alt: 'Asset3',
53
+ containMode: true,
54
+ content: {
55
+ title: 'Asset 3',
56
+ body: 'Asset 3 description'
57
+ }
58
+ }, {
59
+ src: Asset4,
60
+ alt: 'Asset4',
61
+ content: {
62
+ title: 'Asset 4',
63
+ body: 'Asset 4 description'
64
+ }
65
+ }, {
66
+ src: Asset5,
67
+ alt: 'Asset5',
68
+ content: {
69
+ title: 'Asset 5',
70
+ body: 'Asset 5 description'
71
+ }
72
+ }, {
73
+ src: Asset6,
74
+ alt: 'Asset6',
75
+ content: {
76
+ title: 'Asset 6',
77
+ body: 'Asset 6 description'
78
+ }
79
+ }, {
80
+ src: Asset7,
81
+ alt: 'Asset7',
82
+ content: {
83
+ title: 'Asset 7',
84
+ body: 'Asset 7 description'
85
+ }
86
+ }, {
87
+ src: Asset8,
88
+ alt: 'Asset8',
89
+ content: {
90
+ title: 'Asset 8',
91
+ body: 'Asset 8 description'
92
+ }
93
+ }, {
94
+ src: Asset9,
95
+ alt: 'Asset9',
96
+ content: {
97
+ title: 'Asset 9',
98
+ body: 'Asset 9 description'
99
+ }
100
+ }, {
101
+ src: AssetTen,
102
+ alt: 'Asset10',
103
+ content: {
104
+ title: 'Asset 10',
105
+ body: 'Asset 1ß description'
106
+ }
107
+ }];
108
+ export default images;
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ export interface ImageDescriptiveContent {
3
+ title: string;
4
+ body: React.ReactNode;
5
+ }
6
+ interface ImageGalleryContentProps {
7
+ imageContent?: ImageDescriptiveContent;
8
+ }
9
+ export default function ImageGalleryContent({ imageContent }: ImageGalleryContentProps): JSX.Element;
10
+ export {};
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Fragment as _Fragment } from "react/jsx-runtime";
4
+ export default function ImageGalleryContent(_ref) {
5
+ let {
6
+ imageContent
7
+ } = _ref;
8
+ return /*#__PURE__*/_jsx(_Fragment, {
9
+ children: imageContent && /*#__PURE__*/_jsxs("div", {
10
+ className: "fwe-image-gallery-content",
11
+ children: [/*#__PURE__*/_jsx("h3", {
12
+ children: imageContent.title
13
+ }), imageContent.body]
14
+ })
15
+ });
16
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ interface ImageGalleryPaginationProps {
3
+ pagination?: boolean;
4
+ currentIndex: number;
5
+ length: number;
6
+ }
7
+ export default function ImageGalleryPagination({ pagination, currentIndex, length, }: ImageGalleryPaginationProps): JSX.Element;
8
+ export {};
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Fragment as _Fragment } from "react/jsx-runtime";
4
+ export default function ImageGalleryPagination(_ref) {
5
+ let {
6
+ pagination,
7
+ currentIndex,
8
+ length
9
+ } = _ref;
10
+ return /*#__PURE__*/_jsx(_Fragment, {
11
+ children: pagination && /*#__PURE__*/_jsxs("div", {
12
+ className: "fwe-pagination fwe-pagination--on-dark-bg",
13
+ children: [/*#__PURE__*/_jsx("button", {
14
+ "aria-label": "previous",
15
+ type: "button",
16
+ className: "fwe-navigate-btn-down"
17
+ }), /*#__PURE__*/_jsx("span", {
18
+ className: "fwe-page-current",
19
+ children: currentIndex
20
+ }), /*#__PURE__*/_jsx("span", {
21
+ className: "fwe-page-max",
22
+ children: length
23
+ }), /*#__PURE__*/_jsx("button", {
24
+ "aria-label": "next",
25
+ type: "button",
26
+ className: "fwe-navigate-btn-up"
27
+ })]
28
+ })
29
+ });
30
+ }
package/node/index.js CHANGED
@@ -129,6 +129,12 @@ Object.defineProperty(exports, "DateRangePicker", {
129
129
  return _DateRangePicker.default;
130
130
  }
131
131
  });
132
+ Object.defineProperty(exports, "ImageGallery", {
133
+ enumerable: true,
134
+ get: function () {
135
+ return _ImageGallery.default;
136
+ }
137
+ });
132
138
  Object.defineProperty(exports, "LinkButton", {
133
139
  enumerable: true,
134
140
  get: function () {
@@ -353,6 +359,7 @@ var _MobileFlyoutItem = _interopRequireDefault(require("./lib/components/mobile-
353
359
  var _MobileFlyoutPage = _interopRequireDefault(require("./lib/components/mobile-flyout/mobile-flyout-page/MobileFlyoutPage"));
354
360
  var _AlertModal = _interopRequireDefault(require("./lib/components/modals/AlertModal"));
355
361
  var _ConfirmModal = _interopRequireDefault(require("./lib/components/modals/ConfirmModal"));
362
+ var _ImageGallery = _interopRequireDefault(require("./lib/components/modals/imageGallery/ImageGallery"));
356
363
  var _Prompt = _interopRequireDefault(require("./lib/components/modals/Prompt"));
357
364
  var _Pagination = _interopRequireDefault(require("./lib/components/pagination/Pagination"));
358
365
  var _PopoverMenu = _interopRequireDefault(require("./lib/components/popovers/popover-menu/PopoverMenu"));
@@ -5,10 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
- var _classnames = _interopRequireDefault(require("classnames"));
9
- var _reactTransitionGroup = require("react-transition-group");
10
- var _reactOutsideClickHandler = _interopRequireDefault(require("react-outside-click-handler"));
11
- var _useForkRef = _interopRequireDefault(require("../../helper/useForkRef"));
8
+ var _ModalBase = _interopRequireDefault(require("./ModalBase"));
12
9
  var _jsxRuntime = require("react/jsx-runtime");
13
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -22,62 +19,33 @@ const Modal = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
22
19
  className,
23
20
  children
24
21
  } = _ref;
25
- const backdropRef = (0, _react.useRef)(null);
26
- const modalRef = (0, _react.useRef)(null);
27
- const combinedRef = (0, _useForkRef.default)(ref, modalRef);
28
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
29
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
30
- nodeRef: backdropRef,
31
- unmountOnExit: true,
32
- timeout: {
33
- exit: 600
34
- },
35
- in: isOpen,
36
- classNames: "fr-modal-backdrop",
37
- appear: true,
38
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
39
- ref: backdropRef,
40
- className: "fr-modal-backdrop fwe-modal-backdrop"
22
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ModalBase.default, {
23
+ isOpen: isOpen,
24
+ className: className,
25
+ ref: ref,
26
+ onClose: onClose,
27
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
28
+ className: "fwe-modal-close",
29
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
30
+ type: "button",
31
+ "aria-label": "Close",
32
+ className: "fwe-btn fwe-btn-link fwe-dark",
33
+ onClick: onClose,
34
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
35
+ "aria-hidden": "true",
36
+ className: "fwe-icon fwe-icon-close-small"
37
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
38
+ className: "fwe-sr-only",
39
+ children: "Close"
40
+ })]
41
41
  })
42
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactOutsideClickHandler.default, {
43
- onOutsideClick: () => onClose ? onClose() : undefined,
44
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
45
- ref: modalRef,
46
- unmountOnExit: true,
47
- classNames: "fr-modal",
48
- appear: true,
49
- in: isOpen,
50
- timeout: {
51
- exit: 600
52
- },
53
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
54
- ref: combinedRef,
55
- className: (0, _classnames.default)('fr-modal fwe-modal', className),
56
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
57
- className: "fwe-modal-close",
58
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
59
- type: "button",
60
- "aria-label": "Close",
61
- className: "fwe-btn fwe-btn-link fwe-dark",
62
- onClick: onClose,
63
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
64
- "aria-hidden": "true",
65
- className: "fwe-icon fwe-icon-close-small"
66
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
67
- className: "fwe-sr-only",
68
- children: "Close"
69
- })]
70
- })
71
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
72
- className: "fwe-modal-header",
73
- children: head
74
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
75
- className: "fwe-modal-body",
76
- children: body
77
- }), children]
78
- })
79
- })
80
- })]
42
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
43
+ className: "fwe-modal-header",
44
+ children: head
45
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
46
+ className: "fwe-modal-body",
47
+ children: body
48
+ }), children]
81
49
  });
82
50
  });
83
51
  var _default = Modal;
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _classnames = _interopRequireDefault(require("classnames"));
8
+ var _react = require("react");
9
+ var _reactDom = _interopRequireDefault(require("react-dom"));
10
+ var _reactTransitionGroup = require("react-transition-group");
11
+ var _useForkRef = _interopRequireDefault(require("../../helper/useForkRef"));
12
+ var _useOnClickOutside = _interopRequireDefault(require("../../helper/useOnClickOutside"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ const ModalBase = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
16
+ let {
17
+ isOpen,
18
+ onClose,
19
+ className,
20
+ children
21
+ } = _ref;
22
+ const backdropRef = (0, _react.useRef)(null);
23
+ const modalRef = (0, _react.useRef)(null);
24
+ const divRef = (0, _react.useRef)(null);
25
+ const combinedRef = (0, _useForkRef.default)(ref, modalRef);
26
+ const allRefs = (0, _useForkRef.default)(combinedRef, divRef);
27
+ const container = divRef?.current?.ownerDocument || document;
28
+ (0, _useOnClickOutside.default)(divRef, () => onClose?.());
29
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
30
+ children: /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
31
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
32
+ nodeRef: backdropRef,
33
+ unmountOnExit: true,
34
+ timeout: {
35
+ exit: 600
36
+ },
37
+ in: isOpen,
38
+ classNames: "fr-modal-backdrop",
39
+ appear: true,
40
+ component: null,
41
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
42
+ ref: backdropRef,
43
+ className: "fr-modal-backdrop fwe-modal-backdrop"
44
+ })
45
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.CSSTransition, {
46
+ ref: modalRef,
47
+ unmountOnExit: true,
48
+ classNames: "fr-modal",
49
+ appear: true,
50
+ in: isOpen,
51
+ timeout: {
52
+ exit: 600
53
+ },
54
+ component: null,
55
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
56
+ ref: allRefs,
57
+ className: (0, _classnames.default)('fr-modal fwe-modal', className),
58
+ children: children
59
+ })
60
+ })]
61
+ }), container.body)
62
+ });
63
+ });
64
+ var _default = ModalBase;
65
+ exports.default = _default;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = BaseGallery;
7
+ require("swiper/css");
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _react = require("react");
10
+ var _swiper = require("swiper");
11
+ var _react2 = require("swiper/react");
12
+ var _jsxRuntime = require("react/jsx-runtime");
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function BaseGallery(_ref) {
15
+ let {
16
+ images,
17
+ thumbnailImages,
18
+ onSlideChanged,
19
+ startIndex
20
+ } = _ref;
21
+ const [thumbsSwiper, setThumbsSwiper] = (0, _react.useState)(null);
22
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
23
+ className: "fwe-image-gallery-wrapper",
24
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Swiper, {
25
+ initialSlide: startIndex,
26
+ thumbs: {
27
+ swiper: thumbsSwiper
28
+ },
29
+ modules: [_swiper.Thumbs, _swiper.Navigation],
30
+ navigation: {
31
+ nextEl: '.fwe-navigate-btn-up',
32
+ prevEl: '.fwe-navigate-btn-down'
33
+ },
34
+ zoom: true,
35
+ className: "gallery-swiper fwe-image-gallery",
36
+ spaceBetween: 0,
37
+ onSlideChange: slider => onSlideChanged?.(slider.activeIndex),
38
+ children: images.map(_ref2 => {
39
+ let {
40
+ containMode,
41
+ alt,
42
+ content,
43
+ ...image
44
+ } = _ref2;
45
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.SwiperSlide, {
46
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
47
+ className: "swiper-zoom-container",
48
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
49
+ ...image,
50
+ className: (0, _classnames.default)({
51
+ 'fwe-object-fit-contain fwe-p-m': containMode
52
+ }, image.className),
53
+ alt: alt
54
+ })
55
+ })
56
+ }, image.src);
57
+ })
58
+ }), thumbnailImages && /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Swiper, {
59
+ freeMode: true,
60
+ slidesPerView: "auto",
61
+ className: "thumbs-swiper fwe-image-gallery-thumbs",
62
+ modules: [_swiper.Thumbs],
63
+ watchSlidesProgress: true,
64
+ onSwiper: setThumbsSwiper,
65
+ children: thumbnailImages.map(_ref3 => {
66
+ let {
67
+ containMode,
68
+ alt,
69
+ ...image
70
+ } = _ref3;
71
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.SwiperSlide, {
72
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
73
+ ...image,
74
+ className: (0, _classnames.default)({
75
+ 'fwe-object-fit-contain fwe-p-xxxs': containMode
76
+ }, image.className),
77
+ alt: alt
78
+ })
79
+ }, image.src);
80
+ })
81
+ })]
82
+ });
83
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _classnames = _interopRequireDefault(require("classnames"));
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ const getClasses = (thumbnailImages, descriptiveContent, className) => {
10
+ const base = 'fwe-modal-image-gallery';
11
+ const thumbnail = `${base}--with-thumbnails`;
12
+ const container = `${base}--with-container`;
13
+ return (0, _classnames.default)(base, {
14
+ [thumbnail]: [thumbnailImages],
15
+ [container]: descriptiveContent
16
+ }, className);
17
+ };
18
+ var _default = getClasses;
19
+ exports.default = _default;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = require("react");
8
+ var _ModalBase = _interopRequireDefault(require("../ModalBase"));
9
+ var _BaseGallery = _interopRequireDefault(require("./BaseGallery"));
10
+ var _ImageGalleryContent = _interopRequireDefault(require("./ImageGalleryContent"));
11
+ var _ImageGalleryPagination = _interopRequireDefault(require("./ImageGalleryPagination"));
12
+ var _ImageGallery = _interopRequireDefault(require("./ImageGallery.helper"));
13
+ var _jsxRuntime = require("react/jsx-runtime");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ const ImageGallery = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
16
+ let {
17
+ isOpen,
18
+ startIndex,
19
+ images,
20
+ thumbnailImages,
21
+ descriptiveContent,
22
+ children,
23
+ className,
24
+ pagination,
25
+ onClose,
26
+ onSlideChanged,
27
+ ...props
28
+ } = _ref;
29
+ const [currentIndex, setCurrentIndex] = (0, _react.useState)(startIndex + 1);
30
+ function handleChange(index) {
31
+ setCurrentIndex(index + 1);
32
+ onSlideChanged?.(index);
33
+ }
34
+ function handleClose() {
35
+ setCurrentIndex(startIndex + 1);
36
+ onClose?.();
37
+ }
38
+ const classes = (0, _ImageGallery.default)(thumbnailImages, descriptiveContent, className);
39
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalBase.default, {
40
+ onClose: handleClose,
41
+ className: classes,
42
+ ...props,
43
+ isOpen: isOpen,
44
+ ref: ref,
45
+ children: isOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
46
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
47
+ className: "fwe-image-gallery-header",
48
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageGalleryPagination.default, {
49
+ currentIndex: currentIndex,
50
+ length: images.length,
51
+ pagination: pagination
52
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
53
+ "aria-label": "close",
54
+ type: "button",
55
+ className: "fwe-btn fwe-btn-link fwe-ml-auto",
56
+ onClick: handleClose,
57
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
58
+ className: "fwe-icon fwe-icon-lg fwe-color-white fwe-icon-menu-close fwe-modal-image-gallery-close"
59
+ })
60
+ })]
61
+ }), descriptiveContent ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
62
+ className: "fwe-image-gallery-container",
63
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseGallery.default, {
64
+ startIndex: startIndex,
65
+ images: images,
66
+ thumbnailImages: thumbnailImages,
67
+ onSlideChanged: handleChange,
68
+ children: children
69
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageGalleryContent.default, {
70
+ imageContent: images[currentIndex - 1]?.content
71
+ })]
72
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_BaseGallery.default, {
73
+ startIndex: startIndex,
74
+ images: images,
75
+ thumbnailImages: thumbnailImages,
76
+ onSlideChanged: handleChange,
77
+ children: children
78
+ })]
79
+ })
80
+ });
81
+ });
82
+ var _default = ImageGallery;
83
+ exports.default = _default;