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features/Partials/CarouselItem/CarouselItem.module.css?a518","webpack://Kristiania.Web/./Features/Partials/CarouselItem/CarouselItemType.csharp.ts","webpack://Kristiania.Web/./Features/Partials/CarouselItem/CarouselItem.tsx","webpack://Kristiania.Web/./Features/Blocks/CarouselBlock/CarouselBlock.module.css?4e99","webpack://Kristiania.Web/./Features/Blocks/CarouselBlock/CarouselBlock.tsx","webpack://Kristiania.Web/./node_modules/string-convert/camel2hyphen.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"CarouselItem\":\"nF9ohcYejNPVufo35ONa\",\"Video\":\"nYyqoYy1hLgN13F3qeV9\",\"Figure\":\"LXPaenV06RfhMG_YHEFG\",\"Img\":\"EVmyG_6SDFnlk8uw_e0T\",\"Img--vertical\":\"jnPfuI9CYveE7JAWrBvH\",\"Img--horizontal\":\"JiQbTLmzdChn9ufEHi90\",\"Vimeo\":\"_EIj1dcc6MFq2l1dejku\",\"Youtube\":\"ORQ9Z5wb5RhwIQ14dOgl\"};","// This code was generated by a Reinforced.Typings tool.\n// Changes to this file may cause incorrect behavior and will be lost if\n// the code is regenerated.\n\nexport enum CarouselItemType {\n\tImage = \"image\",\n\tYouTubeVideo = \"youTubeVideo\",\n\tVimeoVideo = \"vimeoVideo\"\n}\n","import classNames from 'classnames';\nimport * as React from 'react';\nimport YouTube from 'react-youtube';\nimport { Picture } from '../Picture/Picture';\nimport { Vimeo } from '../Vimeo/Vimeo';\nimport styles from './CarouselItem.module.css';\nimport { CarouselItemType } from './CarouselItemType.csharp';\nimport type { ICarouselItemViewModel } from './ICarouselItemViewModel.csharp';\nimport type { ImageCarouselItemViewModel } from './ImageCarouselItemViewModel.csharp';\nimport type { VimeoVideoCarouselItemViewModel } from './VimeoVideoCarouselItemViewModel.csharp';\nimport type { YouTubeVideoCarouselItemViewModel } from './YouTubeVideoCarouselItemViewModel.csharp';\n\nconst isImage = (input: ICarouselItemViewModel): input is ImageCarouselItemViewModel =>\n input.type === CarouselItemType.Image;\n\nconst isYoutubeVideo = (input: ICarouselItemViewModel): input is YouTubeVideoCarouselItemViewModel =>\n input.type === CarouselItemType.YouTubeVideo;\n\nconst isVimeoVideo = (input: ICarouselItemViewModel): input is VimeoVideoCarouselItemViewModel =>\n input.type === CarouselItemType.VimeoVideo;\n\nexport class CarouselItem extends React.PureComponent<ICarouselItemViewModel & { isActive: boolean }> {\n render() {\n const { isActive, ...otherProps } = this.props;\n\n const renderImage = (imageProps: ImageCarouselItemViewModel) => {\n const { picture, orientation } = imageProps;\n\n return (\n <figure className={styles.Figure}>\n <Picture {...picture} className={classNames(styles.Img, styles[`Img--${orientation}`])} />\n </figure>\n );\n };\n\n const renderYouTubeVideo = (videoProps: YouTubeVideoCarouselItemViewModel) => {\n const { youTubeVideoId } = videoProps;\n\n return <YouTube iframeClassName={styles.Youtube} videoId={youTubeVideoId} />;\n };\n\n const renderVimeoVideo = (videoProps: VimeoVideoCarouselItemViewModel) => {\n const { vimeoVideoId } = videoProps;\n\n return <Vimeo className={styles.Vimeo} videoId={vimeoVideoId} title=\"\" />;\n };\n\n return (\n <div className={classNames(styles.CarouselItem, isImage(otherProps) === false && styles.Video)}>\n {isImage(otherProps) && renderImage(otherProps)}\n {isActive && isYoutubeVideo(otherProps) && renderYouTubeVideo(otherProps)}\n {isActive && isVimeoVideo(otherProps) && renderVimeoVideo(otherProps)}\n </div>\n );\n }\n}\n","// extracted by mini-css-extract-plugin\nexport default {\"CarouselBlock\":\"JMP1Xcvnhj7hKkMjAv6m\",\"Arrow\":\"CZjTkllQnf9iXi1xxGsU\",\"PrevArrow\":\"YYKC4YYN7DvrHM4AG9ln\",\"NextArrow\":\"djLgW5QOpositjMXnQpj\"};","import 'slick-carousel/slick/slick-theme.css';\nimport 'slick-carousel/slick/slick.css';\nimport classNames from 'classnames';\nimport uniqueId from 'lodash/uniqueId';\nimport * as React from 'react';\nimport type { Settings, CustomArrowProps } from 'react-slick';\nimport Slider from 'react-slick';\nimport { CarouselItem } from '~/Partials/CarouselItem/CarouselItem';\nimport { SvgIcon } from '~/Partials/SvgIcon/SvgIcon';\nimport styles from './CarouselBlock.module.css';\nimport type { CarouselBlockViewModel } from './CarouselBlockViewModel.csharp';\n\nconst PrevArrow: React.FC<React.PropsWithChildren<CustomArrowProps>> = ({ onClick }) => (\n <div className={classNames(styles.Arrow, styles.PrevArrow)} role=\"none\" onClick={onClick}>\n <SvgIcon iconName=\"arrow\" />\n </div>\n);\n\nconst NextArrow: React.FC<React.PropsWithChildren<CustomArrowProps>> = ({ onClick }) => (\n <div className={classNames(styles.Arrow, styles.NextArrow)} role=\"none\" onClick={onClick}>\n <SvgIcon iconName=\"arrow\" />\n </div>\n);\n\ninterface CarouselBlockState {\n activeItemIndex: number;\n}\n\nexport class CarouselBlock extends React.Component<CarouselBlockViewModel, CarouselBlockState> {\n private readonly sliderSettings = {\n dots: true,\n infinite: true,\n slidesToShow: 1,\n slidesToScroll: 1,\n adaptiveHeight: false,\n prevArrow: <PrevArrow />,\n nextArrow: <NextArrow />,\n lazyLoad: 'ondemand',\n afterChange: current => this.updateActiveItemIndex(current),\n } as Settings;\n\n constructor(props: CarouselBlockViewModel) {\n super(props);\n\n this.state = {\n activeItemIndex: 0,\n };\n }\n\n private updateActiveItemIndex(current: number): void {\n return this.setState({ activeItemIndex: current });\n }\n\n render() {\n const { items } = this.props;\n const { activeItemIndex } = this.state;\n\n return (\n <section className={styles.CarouselBlock}>\n <Slider {...this.sliderSettings}>\n {items.map((item, index) => (\n <CarouselItem key={uniqueId('CarouselItem__')} {...item} isActive={index === activeItemIndex} />\n ))}\n </Slider>\n </section>\n );\n }\n}\n","var camel2hyphen = function (str) {\n return str\n .replace(/[A-Z]/g, function (match) {\n return '-' + match.toLowerCase();\n })\n .toLowerCase();\n};\n\nmodule.exports = camel2hyphen;"],"names":["CarouselItemType","isImage","input","type","Image","CarouselItem","React","render","_this$props","this","props","isActive","otherProps","_objectWithoutProperties","_excluded","className","classNames","styles","Video","imageProps","picture","orientation","Figure","Picture","_extends","Img","concat","renderImage","YouTubeVideo","videoProps","youTubeVideoId","YouTube","iframeClassName","Youtube","videoId","renderYouTubeVideo","VimeoVideo","vimeoVideoId","Vimeo","title","renderVimeoVideo","PrevArrow","_ref","onClick","role","SvgIcon","iconName","NextArrow","_ref2","CarouselBlock","constructor","super","sliderSettings","dots","infinite","slidesToShow","slidesToScroll","adaptiveHeight","prevArrow","nextArrow","lazyLoad","afterChange","current","updateActiveItemIndex","state","activeItemIndex","setState","items","Slider","map","item","index","key","uniqueId","module","exports","str","replace","match","toLowerCase"],"sourceRoot":""}