{"version":3,"file":"Keystroke_Press.D7OCbCL3.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/7QEIR0cW5rJ59FQn6zjc/hpsTDVsCq0TTx46E6PVQ/Keystroke_Press.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,forwardRef}from\"react\";import Mousetrap from\"mousetrap\";const TEXT_LAYER_TYPES=[\"p\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"span\"];export function KeyboardShortcut(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const{onTap}=props;var _props_dataframername;const name=(_props_dataframername=props[\"data-framer-name\"])!==null&&_props_dataframername!==void 0?_props_dataframername:props.name;const isCodeComponent=false;const shortcutRef=useRef(null);useEffect(()=>{if(name){const keys=name.toLowerCase().replace(\"ctrl\",\"mod\").replace(\"cmd\",\"mod\").replace(\"command\",\"mod\").replace(\"delete\",\"del\").replace(\"insert\",\"ins\");Mousetrap.bind(keys,event=>{if(!shortcutRef.current){return;}if(props.hasOwnProperty(\"backdropOptions\")&&props.hasOwnProperty(\"inputOptions\")&&props.hasOwnProperty(\"modalOptions\")&&props.hasOwnProperty(\"iconColor\")){var // Search component\n_shortcutRef_current_firstElementChild_firstElementChild,_shortcutRef_current_firstElementChild;(_shortcutRef_current_firstElementChild=shortcutRef.current.firstElementChild)===null||_shortcutRef_current_firstElementChild===void 0?void 0:(_shortcutRef_current_firstElementChild_firstElementChild=_shortcutRef_current_firstElementChild.firstElementChild)===null||_shortcutRef_current_firstElementChild_firstElementChild===void 0?void 0:_shortcutRef_current_firstElementChild_firstElementChild.click();}else{var _shortcutRef_current_firstElementChild_firstElementChild1,_shortcutRef_current_firstElementChild1,_props_children_props_children,_props_children_props,_props_children;// Other component or layer\nif(((_shortcutRef_current_firstElementChild1=shortcutRef.current.firstElementChild)===null||_shortcutRef_current_firstElementChild1===void 0?void 0:(_shortcutRef_current_firstElementChild_firstElementChild1=_shortcutRef_current_firstElementChild1.firstElementChild)===null||_shortcutRef_current_firstElementChild_firstElementChild1===void 0?void 0:_shortcutRef_current_firstElementChild_firstElementChild1.getAttribute(\"name\"))==name){var _shortcutRef_current_firstElementChild_firstElementChild2,_shortcutRef_current_firstElementChild2;(_shortcutRef_current_firstElementChild2=shortcutRef.current.firstElementChild)===null||_shortcutRef_current_firstElementChild2===void 0?void 0:(_shortcutRef_current_firstElementChild_firstElementChild2=_shortcutRef_current_firstElementChild2.firstElementChild)===null||_shortcutRef_current_firstElementChild_firstElementChild2===void 0?void 0:_shortcutRef_current_firstElementChild_firstElementChild2.click();}else if(TEXT_LAYER_TYPES.includes((_props_children=props.children)===null||_props_children===void 0?void 0:(_props_children_props=_props_children.props)===null||_props_children_props===void 0?void 0:(_props_children_props_children=_props_children_props.children)===null||_props_children_props_children===void 0?void 0:_props_children_props_children.type)){var // It is a text layer, so click the text link if it has one.\n_shortcutRef_current_querySelector;(_shortcutRef_current_querySelector=shortcutRef.current.querySelector(\"a\"))===null||_shortcutRef_current_querySelector===void 0?void 0:_shortcutRef_current_querySelector.click();}else{var _shortcutRef_current_firstElementChild3;(_shortcutRef_current_firstElementChild3=shortcutRef.current.firstElementChild)===null||_shortcutRef_current_firstElementChild3===void 0?void 0:_shortcutRef_current_firstElementChild3.click();}}// The onTap function switches variants inside components and opens overlays.\nif(typeof onTap==\"function\"){onTap();}event.preventDefault();});return()=>{Mousetrap.unbind(keys);};}},[onTap]);// The element is wrapped in an empty div so that the ref can be added properly in all cases.\n// Code components do not have ref forwarding, which causes the ref to be unset.\nreturn /*#__PURE__*/_jsx(\"div\",{ref:shortcutRef,style:{display:\"contents\"},children:/*#__PURE__*/_jsx(Component,{...props,ref:ref})});});}\nexport const __FramerMetadata__ = {\"exports\":{\"KeyboardShortcut\":{\"type\":\"reactHoc\",\"name\":\"KeyboardShortcut\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Keystroke_Press.map"],"mappings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