{"version":3,"sources":["webpack:///./Scripts/UniGraphics/Actions/LightboxImages.action.js","webpack:///./Scripts/UniGraphics/Components/LightboxImages.js"],"names":["show","visible","type","LIGHTBOX_IMAGES_SHOW","payload","customStyles","content","background","padding","border","overlay","zIndex","LightboxSettings","showStatus","showIndicators","useKeyboardArrows","thumbWidth","autoPlay","autoFocus","renderThumbnails","children","map","item","index","props","imageElement","find","ele","src","key","style","backgroundImage","className","dispatch","useDispatch","useSelector","state","lightboxImages","onClose","useCallback","onClickThumbnail","LIGHTBOX_IMAGES_SET_CURRENT_IMAGE","setCurrentIndex","images","length","Fragment","data-src","itemProp","onClick","thumbnails","image","ariaHideApp","preventScroll","isOpen","onRequestClose","shouldCloseOnOverlayClick","selectedItem","renderThumbs","value"],"mappings":"0LAKO,MAOMA,EAAQC,IAAD,CAChBC,KAAMC,KACNC,QAAS,CACLH,a,+MCRR,MAAMI,EAAe,CACjBC,QAAS,CACLC,WAAY,OACZC,QAAS,EACTC,OAAQ,QAEZC,QAAS,CACLH,WAAY,qBACZI,OAAQ,OAGVC,EAAmB,CACrBC,YAAY,EACZC,gBAAgB,EAChBC,mBAAmB,EACnBC,WAAY,GACZC,UAAU,EACVC,WAAW,GAGTC,EAAoBC,GACPA,EAASC,KAAI,CAACC,EAAMC,KAC/B,IAAKD,IAASA,EAAKE,QAAUF,EAAKE,MAAMJ,SACpC,OAIJ,MAAMK,EAAeH,EAAKE,MAAMJ,SAASM,MACpCC,GAAqB,QAAbA,EAAIzB,OAEjB,OAAKuB,GAAiBA,EAAaD,OAAUC,EAAaD,MAAMI,IAK5D,uBACIC,IAAKN,EACLO,MAAO,CACHC,gBAAiB,OAASN,EAAaD,MAAMI,IAAM,KAEvDI,UAAU,0BAVlB,KAiHR,EA/FwBR,IACpB,MAAMS,GAAWC,WACX,QAAEjC,EAAF,MAAWsB,IAAUY,SAAaC,GAAUA,EAAMC,iBAClDC,GAAUC,kBAAY,IAAMN,EAASjC,GAAK,KAAS,CAACiC,IACpDO,EAAoBjB,IACtBU,EAASjC,GAAK,IACdiC,EDxDwBV,KAAD,CAC3BrB,KAAMuC,KACNrC,QAAS,CACLmB,WCqDSmB,CAAgBnB,KAG7B,OAAQC,EAAMmB,QAAUnB,EAAMmB,OAAOC,OAAS,EAC1C,gBAAC,EAAAC,SAAD,MAEA,gBAAC,EAAAA,SAAD,KACI,uBAAKb,UAAU,sBACX,uBAAKA,UAAU,0CACX,0BAAQA,UAAU,gEACd,qBACIc,WAAUtB,EAAMmB,OAAO,GAAGf,IAC1BmB,SAAS,MACTC,QAAS,IAAMR,EAAiB,GAChCR,UAAU,iBAEV,uBACIA,UAAU,8BACVe,SAAS,QACTnB,IAAKJ,EAAMyB,WAAW,GAAGrB,SAKzC,uBAAKI,UAAU,mDACX,uBAAKA,UAAU,OACVR,EAAMmB,OAAOtB,KACV,CAAC6B,EAAO3B,IACJA,EAAQ,GACJ,uBACIS,UAAU,kCACVH,IAAKN,GAEL,qBACIuB,WAAUI,EAAMtB,IAChBmB,SAAS,MACTC,QAAS,IACLR,EAAiBjB,GAErBS,UAAU,iBAEV,uBACIA,UAAU,+BACVe,SAAS,QACTnB,IACIJ,EAAMyB,WAAW1B,GAAOK,aAUhE,gBAAC,IAAD,CACIuB,aAAa,EACbC,eAAe,EACfC,OAAQpD,EACRqD,eAAgBhB,EAChBR,MAAOzB,EACPkD,2BAA2B,GAE3B,gBAAC,KAAD,KACQ3C,EADR,CAEI4C,aAAcjC,EACdS,UAAU,YACVyB,aAActC,IAEbK,EAAMmB,OAAOtB,KAAI,CAACqC,EAAOnC,IACtB,uBACIM,IAAM,SAAQN,IACdS,UAAU,wBAEV,0BACIgB,QAASV,EACTN,UAAU,wBAFd,KAMA,uBAAKJ,IAAK8B,EAAM9B,IAAKI,UAAU","file":"200.aff0e77dc92ea325f7b4.js","sourcesContent":["import {\r\n    LIGHTBOX_IMAGES_SET_CURRENT_IMAGE,\r\n    LIGHTBOX_IMAGES_SHOW,\r\n} from '../constants';\r\n\r\nexport const setCurrentIndex = (index) => ({\r\n    type: LIGHTBOX_IMAGES_SET_CURRENT_IMAGE,\r\n    payload: {\r\n        index,\r\n    },\r\n});\r\n\r\nexport const show = (visible) => ({\r\n    type: LIGHTBOX_IMAGES_SHOW,\r\n    payload: {\r\n        visible,\r\n    },\r\n});","import React, { Fragment, useCallback } from 'react';\r\nimport Modal from 'react-modal';\r\nimport 'react-responsive-carousel/lib/styles/carousel.min.css';\r\nimport { Carousel as Lightbox } from 'react-responsive-carousel';\r\nimport { useSelector, useDispatch } from 'react-redux';\r\nimport { show, setCurrentIndex } from '../Actions/LightboxImages.action';\r\n\r\nconst customStyles = {\r\n    content: {\r\n        background: 'none',\r\n        padding: 0,\r\n        border: 'none',\r\n    },\r\n    overlay: {\r\n        background: 'rgba(0, 0, 0, 0.8)',\r\n        zIndex: 2003,\r\n    },\r\n};\r\nconst LightboxSettings = {\r\n    showStatus: false,\r\n    showIndicators: false,\r\n    useKeyboardArrows: true,\r\n    thumbWidth: 50,\r\n    autoPlay: false,\r\n    autoFocus: true,\r\n};\r\n\r\nconst renderThumbnails = (children) => {\r\n    const images = children.map((item, index) => {\r\n        if (!item || !item.props || !item.props.children) {\r\n            return undefined;\r\n        }\r\n\r\n        // find img to get source\r\n        const imageElement = item.props.children.find(\r\n            (ele) => ele.type === 'img'\r\n        );\r\n        if (!imageElement || !imageElement.props || !imageElement.props.src) {\r\n            return undefined;\r\n        }\r\n\r\n        return (\r\n            <div\r\n                key={index}\r\n                style={{\r\n                    backgroundImage: 'url(' + imageElement.props.src + ')',\r\n                }}\r\n                className=\"thumbnail__image\"\r\n            />\r\n        );\r\n    });\r\n\r\n    return images;\r\n};\r\n\r\nconst LightboxImages = (props) => {\r\n    const dispatch = useDispatch();\r\n    const { visible, index } = useSelector((state) => state.lightboxImages);\r\n    const onClose = useCallback(() => dispatch(show(false)), [dispatch]);\r\n    const onClickThumbnail = (index) => {\r\n        dispatch(show(true));\r\n        dispatch(setCurrentIndex(index));\r\n    };\r\n\r\n    return !props.images || props.images.length < 1 ? (\r\n        <Fragment />\r\n    ) : (\r\n        <Fragment>\r\n            <div className=\"row product-images\">\r\n                <div className=\"small-12 large-9 columns large-order-1\">\r\n                    <figure className=\"product-detail__image-figure product-detail__image-container\">\r\n                        <a\r\n                            data-src={props.images[0].src}\r\n                            itemProp=\"url\"\r\n                            onClick={() => onClickThumbnail(0)}\r\n                            className=\"product-image\"\r\n                        >\r\n                            <img\r\n                                className=\"product-detail__image--main\"\r\n                                itemProp=\"image\"\r\n                                src={props.thumbnails[0].src}\r\n                            />\r\n                        </a>\r\n                    </figure>\r\n                </div>\r\n                <div className=\"small-12 large-2 columns medium-flex-dir-column\">\r\n                    <div className=\"row\">\r\n                        {props.images.map(\r\n                            (image, index) =>\r\n                                index > 0 && (\r\n                                    <div\r\n                                        className=\"product-detail__image-container\"\r\n                                        key={index}\r\n                                    >\r\n                                        <a\r\n                                            data-src={image.src}\r\n                                            itemProp=\"url\"\r\n                                            onClick={() =>\r\n                                                onClickThumbnail(index)\r\n                                            }\r\n                                            className=\"product-image\"\r\n                                        >\r\n                                            <img\r\n                                                className=\"product-detail__image--alter\"\r\n                                                itemProp=\"image\"\r\n                                                src={\r\n                                                    props.thumbnails[index].src\r\n                                                }\r\n                                            />\r\n                                        </a>\r\n                                    </div>\r\n                                )\r\n                        )}\r\n                    </div>\r\n                </div>\r\n            </div>\r\n            <Modal\r\n                ariaHideApp={false}\r\n                preventScroll={true}\r\n                isOpen={visible}\r\n                onRequestClose={onClose}\r\n                style={customStyles}\r\n                shouldCloseOnOverlayClick={false}\r\n            >\r\n                <Lightbox\r\n                    {...LightboxSettings}\r\n                    selectedItem={index}\r\n                    className=\"light-box\"\r\n                    renderThumbs={renderThumbnails}\r\n                >\r\n                    {props.images.map((value, index) => (\r\n                        <div\r\n                            key={`figure${index}`}\r\n                            className=\"light-box__container\"\r\n                        >\r\n                            <button\r\n                                onClick={onClose}\r\n                                className=\"light-box__close-btn\"\r\n                            >\r\n                                &times;\r\n                            </button>\r\n                            <img src={value.src} className=\"light-box__image\" />\r\n                        </div>\r\n                    ))}\r\n                </Lightbox>\r\n            </Modal>\r\n        </Fragment>\r\n    );\r\n};\r\n\r\nexport default LightboxImages;\r\n"],"sourceRoot":""}