All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.DropdownPanel-BoHoC5Zg.js.map Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
{"version":3,"file":"DropdownPanel-BoHoC5Zg.js","sources":["../../src/components/dropdown-panel/DropdownPanel.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { Icon } from \"@patternfly/react-core\";\nimport { CaretDownIcon } from \"@patternfly/react-icons\";\nimport { mediaQuery } from \"../../util\";\nimport \"./dropdown-panel.css\";\n\ntype DropdownPanelProps = {\n  buttonText: string;\n  children: React.ReactNode;\n  setSearchDropdownOpen: (open: boolean) => void;\n  searchDropdownOpen: boolean;\n  marginRight?: string;\n  width: string;\n};\n\nconst DropdownPanel: React.FC = ({\n  buttonText,\n  children,\n  setSearchDropdownOpen,\n  searchDropdownOpen,\n  marginRight,\n  width,\n}) => {\n  const dropdownRef = useRef(null);\n\n  useEffect(() => {\n    const handleClickOutside = (event: MouseEvent) => {\n      if (\n        dropdownRef.current &&\n        !dropdownRef.current.contains(event.target as Node)\n      ) {\n        setSearchDropdownOpen(false);\n      }\n    };\n\n    document.addEventListener(\"mousedown\", handleClickOutside);\n    return () => document.removeEventListener(\"mousedown\", handleClickOutside);\n  }, [setSearchDropdownOpen]);\n\n  useEffect(() => {\n    const handleVisibilityChange = () => {\n      if (document.visibilityState === \"hidden\") {\n        setSearchDropdownOpen(false);\n      }\n    };\n\n    document.addEventListener(\"visibilitychange\", handleVisibilityChange);\n    return () =>\n      document.removeEventListener(\"visibilitychange\", handleVisibilityChange);\n  }, [setSearchDropdownOpen]);\n\n  return (\n    \n       setSearchDropdownOpen(!searchDropdownOpen)}\n        aria-label={buttonText}\n        style={{ width, marginRight }}\n        data-testid=\"dropdown-panel-btn\"\n      >\n        {buttonText}\n        \n          \n        \n      \n      {searchDropdownOpen && (\n        \n          {children}\n        
\n )}\n \n );\n};\n\nexport default DropdownPanel;\n"],"names":["DropdownPanel","buttonText","children","setSearchDropdownOpen","searchDropdownOpen","marginRight","width","dropdownRef","useRef","useEffect","handleClickOutside","event","handleVisibilityChange","jsxs","Icon","jsx","CaretDownIcon","mediaQuery"],"mappings":"wJAeA,MAAMA,EAA8C,CAAC,CACnD,WAAAC,EACA,SAAAC,EACA,sBAAAC,EACA,mBAAAC,EACA,YAAAC,EACA,MAAAC,CACF,IAAM,CACE,MAAAC,EAAcC,EAAuB,IAAI,EAE/C,OAAAC,EAAU,IAAM,CACR,MAAAC,EAAsBC,GAAsB,CAE9CJ,EAAY,SACZ,CAACA,EAAY,QAAQ,SAASI,EAAM,MAAc,GAElDR,EAAsB,EAAK,CAC7B,EAGO,gBAAA,iBAAiB,YAAaO,CAAkB,EAClD,IAAM,SAAS,oBAAoB,YAAaA,CAAkB,CAAA,EACxE,CAACP,CAAqB,CAAC,EAE1BM,EAAU,IAAM,CACd,MAAMG,EAAyB,IAAM,CAC/B,SAAS,kBAAoB,UAC/BT,EAAsB,EAAK,CAC7B,EAGO,gBAAA,iBAAiB,mBAAoBS,CAAsB,EAC7D,IACL,SAAS,oBAAoB,mBAAoBA,CAAsB,CAAA,EACxE,CAACT,CAAqB,CAAC,EAGxBU,EAAC,OAAK,CAAA,IAAKN,EACT,SAAA,CAAAM,EAAC,SAAA,CACC,UAAU,oBACV,QAAS,IAAMV,EAAsB,CAACC,CAAkB,EACxD,aAAYH,EACZ,MAAO,CAAE,MAAAK,EAAO,YAAAD,CAAY,EAC5B,cAAY,qBAEX,SAAA,CAAAJ,IACAa,EAAK,CAAA,UAAU,yBACd,SAAAC,EAACC,GAAc,CAAA,EACjB,CAAA,CAAA,CACF,EACCZ,GACCW,EAAC,MAAA,CACC,UACEE,GAAY,QACR,sCACA,uCAGL,SAAAf,CAAA,CACH,CAEJ,CAAA,CAAA,CAEJ"}



© 2015 - 2025 Weber Informatics LLC | Privacy Policy