{"version":3,"names":["isActuallyActivated","event","type","code","charCode","keyCode","whenActuallyActivated","callback","options","preventDefault","stopPropagation"],"sources":["../src/utils/accessibility.ts"],"sourcesContent":["/**\n * Checks the given event object whether the event actually contains conditions to allow for item activation\n * \te.g. a valid click event or a keypress event through the enter (13) or space (32) key\n *\n * @param event activation event\n */\nexport function isActuallyActivated(event): boolean {\n\tif (event.type === 'click') {\n\t\treturn true;\n\t}\n\n\tif (event.type === 'keypress' || event.type === 'keydown') {\n\t\tconst code = event.charCode || event.keyCode;\n\n\t\treturn code === 13 || code === 32;\n\t}\n\n\treturn false;\n}\n\ninterface WhenActuallyActivatedOptions {\n\tpreventDefault?: boolean;\n\tstopPropagation?: boolean;\n}\n\nexport function whenActuallyActivated(\n\tevent: Event,\n\tcallback: (event: Event) => void,\n\toptions: WhenActuallyActivatedOptions = {},\n): void {\n\tif (!isActuallyActivated(event)) return;\n\n\tconst { preventDefault = true, stopPropagation = true } = options;\n\n\tif (preventDefault) {\n\t\tevent.preventDefault();\n\t}\n\tif (stopPropagation) {\n\t\tevent.stopPropagation();\n\t}\n\n\tcallback(event);\n}\n"],"mappings":"SAMgBA,EAAoBC,GACnC,GAAIA,EAAMC,OAAS,QAAS,CAC3B,OAAO,I,CAGR,GAAID,EAAMC,OAAS,YAAcD,EAAMC,OAAS,UAAW,CAC1D,MAAMC,EAAOF,EAAMG,UAAYH,EAAMI,QAErC,OAAOF,IAAS,IAAMA,IAAS,E,CAGhC,OAAO,KACR,C,SAOgBG,EACfL,EACAM,EACAC,EAAwC,IAExC,IAAKR,EAAoBC,GAAQ,OAEjC,MAAMQ,eAAEA,EAAiB,KAAIC,gBAAEA,EAAkB,MAASF,EAE1D,GAAIC,EAAgB,CACnBR,EAAMQ,gB,CAEP,GAAIC,EAAiB,CACpBT,EAAMS,iB,CAGPH,EAASN,EACV,Q"}