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EAAYK,cACzBC,MAAO1B,EAAWa,SAEjBM,EAAKQ,UACJjB,EAAAA,EAAAA,KAACkB,EAAAA,EAAQ,CACP7B,UAAU,uBACV8B,MAAO,CAAEC,MAAO,QAChBC,WAAW,KAGbjB,EAAAA,EAAAA,MAAAkB,EAAAA,SAAA,CAAAnB,SAAA,CACGM,EAAKc,OACJvB,EAAAA,EAAAA,KAAA,OACEX,WAAWY,EAAAA,EAAAA,GAAG,CACZ,yBACA,CAAE,kCAAmChB,KACpCkB,SAEFM,EAAKc,QAGVvB,EAAAA,EAAAA,KAAA,QACEX,UAAW,2BACTD,EAAW,sCAAwC,MAEnDL,IAAe0B,EAAKG,KAAO3B,EAAgB,SAAW,KACrDkB,SAEFM,EAAKK,QAEP3B,GAAa,OAAJsB,QAAI,IAAJA,GAAAA,EAAMtB,OACda,EAAAA,EAAAA,KAAA,QAAMX,UAAU,yBAAwBc,SAAEM,EAAKtB,QAE/C,OA3CDsB,EAAKG,KAAOH,EAAKK,MA+ClB,QAGN,G","sources":["components/UI/CustomMenu/index.tsx"],"sourcesContent":["import {\n CSSProperties,\n memo,\n ReactElement,\n RefObject,\n Suspense,\n useRef\n} from 'react';\nimport cc from 'classcat';\nimport SpringConfigs from 'utils/constants/swarm/spring-configs';\nimport { lazy } from 'utils/generic/lazy';\nimport { isMobile } from 'utils/is-mobile';\nimport type { ICustomMenuItem } from 'interfaces/generic';\nimport { Skeleton } from 'newcomponents/UI/Skeleton';\nimport { useUpdateEffect } from 'newhooks/generic/useUpdateEffect';\nimport './index.less';\n\n//TODO as CustomMenu is UI component, need to remove Homework logic from here @todo-ignore\n//attention: this should be fixed when we have partner with homework functionality\nconst { Homework } = lazy(\n () =>\n import(/* webpackChunkName: \"homework\" */ 'newelements/Generics/homework')\n);\n\nexport type TCustomMenuProps = {\n items: ICustomMenuItem[];\n setActiveItem: Function;\n activeItem: number | string;\n fullWidth?: boolean;\n inverseColors?: boolean;\n disabled?: boolean;\n count?: boolean;\n homework?: boolean;\n className?: string;\n itemStyles?: CSSProperties;\n};\n\nexport const CustomMenu = memo(\n ({\n items,\n fullWidth,\n activeItem,\n setActiveItem,\n inverseColors,\n disabled,\n count,\n homework,\n className,\n itemStyles\n }: TCustomMenuProps): ReactElement => {\n const tabRef: RefObject<HTMLDivElement> = useRef(null);\n\n useUpdateEffect(() => {\n tabRef.current?.scrollIntoView({\n behavior: 'smooth',\n inline: 'nearest',\n block: 'nearest'\n });\n }, [activeItem]);\n\n return (\n <div\n className={cc([\n `customMenu__wrapper ${className || ''}`,\n {\n 'customMenu__wrapper--mobile': isMobile(),\n 'customMenu__wrapper--desktop': !isMobile(),\n 'customMenu__wrapper--fullWidth': fullWidth,\n 'customMenu__wrapper--inverse': inverseColors,\n 'customMenu__wrapper--disabled': disabled\n }\n ])}\n >\n <div className=\"customMenu\">\n {homework && SpringConfigs.HOMEWORK_ENABLED ? (\n <Suspense>\n <Homework />\n </Suspense>\n ) : null}\n\n {items.map(item => (\n <div\n ref={isMobile() && activeItem === item.key ? tabRef : null}\n key={item.key || item.value}\n className={cc([\n 'customMenu__item',\n {\n 'customMenu__item--mobile': isMobile(),\n 'customMenu__item--inverse': inverseColors,\n 'customMenu__item--active': activeItem === item.key\n }\n ])}\n onClick={() => setActiveItem(item.key)}\n data-testid={item.value?.toLowerCase()}\n style={itemStyles}\n >\n {item.skeleton ? (\n <Skeleton\n className=\"customMenu__skeleton\"\n title={{ width: '50px' }}\n paragraph={false}\n />\n ) : (\n <>\n {item.icon && (\n <div\n className={cc([\n 'customMenu__item__icon',\n { 'customMenu__item__icon--inverse': inverseColors }\n ])}\n >\n {item.icon}\n </div>\n )}\n <span\n className={`customMenu__item--label ${\n homework ? 'customMenu__item--label--sports-bar' : ''\n } ${\n activeItem === item.key && inverseColors ? 'active' : ''\n }`}\n >\n {item.value}\n </span>\n {count && item?.count ? (\n <span className=\"customMenu__item-count\">{item.count}</span>\n ) : (\n ''\n )}\n </>\n )}\n </div>\n ))}\n </div>\n </div>\n );\n }\n);\n"],"names":["Homework","lazy","CustomMenu","memo","_ref","items","fullWidth","activeItem","setActiveItem","inverseColors","disabled","count","homework","className","itemStyles","tabRef","useRef","useUpdateEffect","_tabRef$current","current","scrollIntoView","behavior","inline","block","_jsx","cc","isMobile","children","_jsxs","SpringConfigs","HOMEWORK_ENABLED","Suspense","map","item","_item$value","ref","key","onClick","value","toLowerCase","style","skeleton","Skeleton","title","width","paragraph","_Fragment","icon"],"sourceRoot":""}