<html><head></head><body>{"version":3,"file":"FacetAccordion-DQ2x_-_t.js","sources":["../../src/scripts/modules/react-modules/Listings/Facets/FacetAccordion.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\r\nimport {\r\n Accordion,\r\n AccordionContent,\r\n AccordionItem,\r\n AccordionTrigger\r\n} from '../../../../components/react-components/Accordion';\r\nimport { Checkbox } from '../../../../components/react-components/Checkbox';\r\nimport { FacetProps } from '../types';\r\n\r\ntype FacetDataItem = {\r\n name: string;\r\n count: number;\r\n};\r\n\r\nexport type FacetData = {\r\n [key: string]: {\r\n Categories: {\r\n IdTitle: FacetDataItem[];\r\n };\r\n };\r\n};\r\n\r\ntype OwnProps = {\r\n facets: FacetProps[];\r\n onSelectionChangeHandler: (selectedFacetID: string, value: string | null) => void;\r\n facetsData: FacetData | null;\r\n};\r\n\r\nconst FacetAccordion = ({ facets, facetsData, onSelectionChangeHandler }: OwnProps) => {\r\n const [value, setValue] = useState('');\r\n const [updatedFacets, setUpdatedFacets] = useState(facets);\r\n\r\n useEffect(() => {\r\n if (facets.length > 0) {\r\n setValue(facets[0].id);\r\n }\r\n }, [facets]);\r\n\r\n useEffect(() => {\r\n if (facetsData) {\r\n const newUpdatedFacets = facets.map(facet => {\r\n const updatedItems = facet.items.map(item => {\r\n const matchingFacet = facetsData[facet.id]?.Categories.IdTitle;\r\n const matchingItem = matchingFacet?.find(f => f.name.split('|')[1] === item.value);\r\n return {\r\n ...item,\r\n count: matchingItem ? matchingItem.count : 0 // Set count to 0 if no match\r\n };\r\n });\r\n\r\n return {\r\n ...facet,\r\n items: updatedItems\r\n };\r\n });\r\n\r\n setUpdatedFacets(newUpdatedFacets);\r\n }\r\n }, [facetsData, facets]);\r\n\r\n return (\r\n <div accordion\"="" classname='\"listing__facet' listing__facet--accordion="">\r\n <accordion collapsible="" onvaluechange="{setValue}" type='\"single\"' value="{value}">\r\n {updatedFacets.map((facet, index) => {\r\n const { id, title, items: facetItems } = facet;\r\n\r\n if (!facetItems || facetItems.length === 0) {\r\n return null;\r\n }\r\n\r\n return (\r\n <accordionitem key="{index}" value="{id}">\r\n <accordiontrigger>{title}</accordiontrigger>\r\n <accordioncontent classname="{'listing__facet-accordion-content'}">\r\n {facetItems &&\r\n facetItems.map((item, index) => {\r\n const isChecked =\r\n facet.value && (facet.value as string[]).includes(item.id) ? true : false;\r\n\r\n return (\r\n <div classname="{`checkbox__container`}" key="{index}">\r\n <checkbox\r\n =="" id="{item.id}\r\n" oncheckedchange="{()"> {\r\n onSelectionChangeHandler(id, item.id);\r\n }}\r\n aria-label={item.value}\r\n checked={isChecked}\r\n />\r\n <div classname='\"checkbox__label-wrapper\"'>\r\n <label classname='\"checkbox__label\"' htmlfor="{item.id}">\r\n {item.value}\r\n </label>\r\n\r\n <span classname='\"checkbox__label-number\"'>({item.count})</span>\r\n </div>\r\n </checkbox\r\n></div>\r\n );\r\n })}\r\n </accordioncontent>\r\n </accordionitem>\r\n );\r\n })}\r\n </accordion>\r\n </div>\r\n );\r\n};\r\n\r\nexport default FacetAccordion;\r\n"],"names":["FacetAccordion","facets","facetsData","onSelectionChangeHandler","value","setValue","useState","updatedFacets","setUpdatedFacets","useEffect","newUpdatedFacets","facet","updatedItems","item","matchingFacet","_a","matchingItem","f","React","Accordion","index","id","title","facetItems","AccordionItem","AccordionTrigger","AccordionContent","isChecked","Checkbox"],"mappings":"+GA6BA,MAAMA,EAAiB,CAAC,CAAE,OAAAC,EAAQ,WAAAC,EAAY,yBAAAC,KAAyC,CACrF,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAC/B,CAACC,EAAeC,CAAgB,EAAIF,EAAAA,SAASL,CAAM,EAEzDQ,OAAAA,EAAAA,UAAU,IAAM,CACVR,EAAO,OAAS,GACTI,EAAAJ,EAAO,CAAC,EAAE,EAAE,CACvB,EACC,CAACA,CAAM,CAAC,EAEXQ,EAAAA,UAAU,IAAM,CACd,GAAIP,EAAY,CACR,MAAAQ,EAAmBT,EAAO,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AK,KACR,EAECK,EAAA,cAAA,OAAA,CAAK,UAAU,wBAAA,EAAyB,IAAEL,EAAK,MAAM,GAAC,CACzD,CACF,CAEH,CAAA,CACL,CACF,CAEH,CAAA,CACH,CACF,CAEJ"}<style> .hidden { display: none; } </style> <a href="http://www.joker47.net" class="hidden">Sands-Macao-feedback@joker47.net</a> <a href="http://web-sitemap.use-iphone.com" class="hidden">魅力庐江论坛</a> <a href="http://www.iconfuture.net" class="hidden">Sun-City-app-careers@iconfuture.net</a> <a href="http://www.m-y-c.net" class="hidden">Euro-betting-admin@m-y-c.net</a> <a href="http://web-sitemap.maoqijie.com" class="hidden">合肥论坛</a> <a href="http://www.xingtaiyichuang.com" class="hidden">Buy-ball-app-contactus@xingtaiyichuang.com</a> <a href="http://www.c178.net" class="hidden">Online-betting-website-support@c178.net</a> <a href="http://www.lyhymh.net" class="hidden">Sports-betting-media@lyhymh.net</a> <a href="http://www.jyycl.com" class="hidden">皇冠博彩</a> <a href="http://www.drsarabar.com" class="hidden">Galaxy-Macau-feedback@drsarabar.com</a> <a href="http://rkppmv.dunmoore.net" class="hidden">一米工作</a> <a href="http://www.letaoyizs.com" class="hidden">Crown-Sports-sales@letaoyizs.com</a> <a href="http://dvjivq.tureckihaus.net" class="hidden">魔怀网</a> <a href="http://www.berxwedan.net" class="hidden">Crown-Sports-support@berxwedan.net</a> <a href="http://www.zlmmc8.com" class="hidden">皇冠体育</a> <a href="http://yghlya.35jiajiao.com" class="hidden">呼伦贝尔火网人才频道</a> <a href="http://www.iconfuture.net" class="hidden">Sun-City-official-website-service@iconfuture.net</a> <a href="http://www.symmjg.com" class="hidden">Sports-betting-contact@symmjg.com</a> <a href="http://web-sitemap.cishan51.net" class="hidden">成都人事考试网</a> <a href="http://vkcrjb.coolqw.com" class="hidden">天津海事局</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️网址:la666.net✔️网投网站信誉排行榜(中国)有限公司.jvw" class="hidden">石家庄热线</a> <a href="https://stock.adobe.com/search?k=✔️网址:ad11.net✔️澳门金沙棋牌真钱-维基百科" class="hidden">林江股份</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️最新网址:ad22.net✔️科普一下IM体育app官方入口·官方app下载的百科.hml" class="hidden">嘉兴学院教务处</a> <a href="https://www.deep6gear.com/catalogsearch/result/?q=✔️网址:la66.net✔️(关于k8彩乐园官网下载的简介)k8彩乐园官网下载" class="hidden">37秦美人</a> <a href="https://tw.dictionary.yahoo.com/dictionary?p=✔️网址:ad11.net✔️365bet官网平台介绍" class="hidden">旅视网</a> <a href="https://stock.adobe.com/search/images?k=✔️网址:la666.net✔️靠谱的电子游艺平台-维基百科.fmr" class="hidden">百校国际</a> <a href="https://stock.adobe.com/search/images?k=✔️最新网址:ad22.net✔️ued西甲赫塔菲(中国)有限公司.squ" class="hidden">环球网校论坛</a> <a href="https://es-la.facebook.com/public/✔️网址:la666.net✔️电子游艺靠谱排行-维基百科✔️网址:la666.net✔️电子游艺靠谱排行-维基百科.ysw" class="hidden">进包网 </a> <a href="https://stock.adobe.com/search/images?k=科普一下十大电子游戏下载的百科✔️网址:la666.net✔️科普一下十大电子游戏下载的百科✔️网址:la666.net✔️.gny" class="hidden">围棋TV</a> <a href="https://es-la.facebook.com/public/✔️官方网址:la777.net✔️bbin平台大全" class="hidden">滨州人才网</a> <a href="/cn/htsjfq-663438.html" class="hidden">意风家具</a> <a href="/html/coixvb-285823.html" class="hidden">国家标准查询网</a> <a href="/sitemap.xml" class="hidden">站点地图</a> <a href="/sttcs/hot-news/hyperprism.html" class="hidden">大连公交网</a> <a href="/sttcs/hot-news/angeldom.html" class="hidden">太原师范学院教务处</a> </body></html>