{"version":3,"sources":["webpack:///./src/js/components/react/Dropdown.js","webpack:///./src/js/modules/tabFacetedListing/components/Card.js","webpack:///./src/js/modules/tabFacetedListing/index.js"],"names":["Dropdown","label","placeholder","selectedOption","options","onChange","disabled","compareAttr","style","useState","open","toggle","cursor","setCursor","guid","useRef","uuidv4","listboxGuid","nativeEl","dropdownEl","triggerEl","listingEl","useEffect","handleClickOutside","e","container","current","target","contains","document","addEventListener","removeEventListener","focus","index","findIndex","option","getDisplayLabel","className","htmlFor","isDevice","ref","id","find","value","Value","tabIndex","aria-label","map","i","key","role","type","aria-haspopup","aria-expanded","aria-controls","onClick","aria-activedescendant","onKeyDown","keyCode","preventDefault","length","aria-selected","handleOptionClick","propTypes","PropTypes","string","shape","oneOfType","number","bool","arrayOf","object","func","isRequired","Card","url","imageUrl","imageAlt","title","description","cardContent","srcSet","src","alt","loading","parse","class","viewBox","xlinkHref","href","TabFacetedListing","endpoint","language","facetLabel","allMobileLabel","setLoading","facets","setFacets","selectedFacet","setSelectedFacet","results","setResults","Axios","method","params","data","resultListing","console","log","fetchData","name","getSelectedFacet","innerLabel","filter","result","category","some"],"mappings":"i6CAKA,IAAMA,EAAW,SAAC,GASZ,IARJC,EAQI,EARJA,MACAC,EAOI,EAPJA,YACAC,EAMI,EANJA,eAMI,IALJC,eAKI,MALM,GAKN,EAJJC,EAII,EAJJA,SAII,IAHJC,gBAGI,aAFJC,mBAEI,MAFU,QAEV,EADJC,EACI,EADJA,MACI,IACmBC,oBAAS,GAD5B,GACGC,EADH,KACSC,EADT,SAEwBF,mBAAS,MAFjC,GAEGG,EAFH,KAEWC,EAFX,KAGEC,EAAOC,iBAAOC,eACdC,EAAcF,iBAAOC,eACrBE,EAAWH,iBAAO,MAClBI,EAAaJ,iBAAO,MACpBK,EAAYL,iBAAO,MACnBM,EAAYN,iBAAO,MAEzBO,qBAAU,WACR,IAAMC,EAAqB,SAAAC,GACzB,IAAMC,EAAYN,EAAWO,QAEzBD,IACEA,IAAcD,EAA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, useMemo } from 'react';\r\nimport PropTypes from 'prop-types';\r\nimport { isDevice } from '../../helpers';\r\nimport { v4 as uuidv4 } from 'uuid';\r\n\r\nconst Dropdown = ({\r\n label,\r\n placeholder,\r\n selectedOption,\r\n options = [],\r\n onChange,\r\n disabled = false,\r\n compareAttr = 'value',\r\n style\r\n}) => {\r\n const [open, toggle] = useState(false);\r\n const [cursor, setCursor] = useState(null);\r\n const guid = useRef(uuidv4());\r\n const listboxGuid = useRef(uuidv4());\r\n const nativeEl = useRef(null);\r\n const dropdownEl = useRef(null);\r\n const triggerEl = useRef(null);\r\n const listingEl = useRef(null);\r\n\r\n useEffect(() => {\r\n const handleClickOutside = e => {\r\n const container = dropdownEl.current;\r\n\r\n if (container) {\r\n if (container !== e.target && !container.contains(e.target)) {\r\n toggle(false);\r\n }\r\n }\r\n };\r\n\r\n document.addEventListener('click', handleClickOutside);\r\n\r\n return () => {\r\n document.removeEventListener('click', handleClickOutside);\r\n };\r\n }, []);\r\n\r\n useEffect(() => {\r\n if (open) {\r\n listingEl.current.focus();\r\n }\r\n }, [open]);\r\n\r\n useEffect(() => {\r\n if (selectedOption) {\r\n const index = options.findIndex(\r\n option => option[compareAttr] === selectedOption[compareAttr]\r\n );\r\n setCursor(index);\r\n } else {\r\n setCursor(null);\r\n }\r\n }, [compareAttr, options, selectedOption]);\r\n\r\n const handleTriggerClick = e => {\r\n if (isDevice()) {\r\n return;\r\n }\r\n\r\n toggle(!open);\r\n };\r\n\r\n const handleOptionClick = option => {\r\n onChange(option);\r\n toggle(false);\r\n };\r\n\r\n const handleOptionChange = e => {\r\n const option = options.find(option => option.value === e.target.value);\r\n onChange(option);\r\n toggle(false);\r\n };\r\n\r\n const handleKeyDown = e => {\r\n /* eslint-disable indent */\r\n switch (e.keyCode) {\r\n case 38: // up\r\n e.preventDefault();\r\n if (cursor) {\r\n setCursor(cursor - 1);\r\n } else {\r\n setCursor(options.length - 1);\r\n }\r\n break;\r\n case 40: // down\r\n e.preventDefault();\r\n if (cursor !== null && cursor < options.length - 1) {\r\n setCursor(cursor + 1);\r\n } else {\r\n setCursor(0);\r\n }\r\n break;\r\n case 27: // esc\r\n e.preventDefault();\r\n toggle(false);\r\n triggerEl.current.focus();\r\n break;\r\n case 13: // enter\r\n e.preventDefault();\r\n if (cursor !== null) {\r\n onChange(options[cursor]);\r\n }\r\n toggle(false);\r\n triggerEl.current.focus();\r\n break;\r\n case 9: // tab\r\n toggle(false);\r\n break;\r\n }\r\n /* eslint-enable indent */\r\n };\r\n\r\n const getDisplayLabel = () => {\r\n if (selectedOption) {\r\n return `${selectedOption.label}`;\r\n }\r\n return placeholder || null;\r\n };\r\n\r\n return (\r\n
{parse(title)}
\r\n {!!description && (\r\n{facets.name}
\r\n