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from 'react'\r\nimport head from 'lodash/head'\r\nimport { domToReact } from 'html-react-parser'\r\nimport filter from 'tcweb-material-components/core/poly/filter'\r\nimport get from 'tcweb-material-components/core/poly/get'\r\nimport Grid from 'tcweb-material-components/core/grid'\r\nimport { makeStyles } from '@material-ui/styles'\r\nimport classnames from 'classnames'\r\n\r\nimport { cleanWPValue } from '../../utilities/wpOptions'\r\n\r\nconst SCROLL_BREAKPOINTS = {\r\n mobile: 'xs',\r\n tablet: 'sm',\r\n desktop: 'md'\r\n}\r\nconst GRID_VERTICAL_ALIGNMENTS = {\r\n 'are-vertically-aligned-center': 'center',\r\n 'are-vertically-aligned-top': 'flex-start',\r\n 'are-vertically-aligned-bottom': 'flex-end'\r\n}\r\n\r\nconst getGridVerticalAlignment = attribs => {\r\n const alignmentClass = head(get(attribs, 'class', '').match(/are-vertically-aligned-[a-z]+/gi))\r\n return GRID_VERTICAL_ALIGNMENTS[alignmentClass]\r\n}\r\n\r\nconst useClasses = makeStyles(theme => ({\r\n grid: ({ data, gridVerticalAlignment = 'initial', isWPColumn }) => ({\r\n columnGap: cleanWPValue(get(data, 'grid.mobile.gapCol')),\r\n rowGap: cleanWPValue(get(data, 'grid.mobile.gapRow')),\r\n [theme.breakpoints.up('sm')]: {\r\n columnGap: cleanWPValue(get(data, 'grid.tablet.gapCol')),\r\n rowGap: cleanWPValue(get(data, 'grid.tablet.gapRow')),\r\n },\r\n [theme.breakpoints.up('md')]: {\r\n columnGap: cleanWPValue(get(data, 'grid.desktop.gapCol')),\r\n rowGap: cleanWPValue(get(data, 'grid.desktop.gapRow')),\r\n },\r\n alignItems: gridVerticalAlignment,\r\n '& .wp-block-column': { margin: '0 !important' } // Overwrite .wp-block-column:not(:first-child) when in uniform grid\r\n }),\r\n item: {\r\n display: 'flex',\r\n flexDirection: 'column'\r\n }\r\n}))\r\n\r\nconst createDataObject = (cols) => {\r\n return {\r\n has: { mobile: {featured: false }},\r\n col: {\r\n mobile: { number: 1 },\r\n tablet: { number: cols },\r\n desktop: { number: cols }\r\n },\r\n grid: {\r\n mobile: { gapCol: '10px', gapRow: '10px' },\r\n tablet: { gapCol: '20px', gapRow: '20px' },\r\n desktop: { gapCol: '30px', gapRow: '30px' }\r\n }\r\n }\r\n}\r\n\r\nconst ColumnsSwap = ({ children, options, data, attribs, className }) => {\r\n const filteredChildren = filter(child => child.type !== 'text', children)\r\n const isUniformGrid = Object.keys(data).length !== 0\r\n const _data = isUniformGrid ? data : createDataObject(filteredChildren.length)\r\n const blockWidth = head(get(attribs, 'class', '').match(/alignfull|alignwide/g))\r\n const backgroundColor = head(get(attribs, 'class', '').match(/has-gears-[a-z]+-background-color/gi))\r\n const textColor = head(get(attribs, 'class', '').match(/has-gears-[a-z]+-color/gi))\r\n const _classes = useClasses({ data: _data, gridVerticalAlignment: getGridVerticalAlignment(attribs) })\r\n\r\n return (\r\n \r\n {filteredChildren.map((child, index) => (\r\n
\r\n {domToReact(child.children, options)}\r\n
\r\n )\r\n )}\r\n \r\n )\r\n}\r\n\r\nexport default ColumnsSwap\r\n"],"names":["SCROLL_BREAKPOINTS","mobile","tablet","desktop","GRID_VERTICAL_ALIGNMENTS","getGridVerticalAlignment","attribs","alignmentClass","head","get","match","useClasses","makeStyles","theme","grid","data","gridVerticalAlignment","isWPColumn","columnGap","cleanWPValue","rowGap","breakpoints","up","alignItems","margin","item","display","flexDirection","ColumnsSwap","children","options","className","filteredChildren","filter","child","type","_data","Object","keys","length","has","featured","col","number","cols","gapCol","gapRow","blockWidth","backgroundColor","textColor","_classes","React","Grid","scrollOn","xs","sm","md","reverse","featureFirst","classes","root","classnames","map","index","key","class","domToReact"],"sourceRoot":""}