{"version":3,"file":"Office_Apps_Viewer_Component.DX3MDEmL.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/N2fxtjR2pXPoD4sTT33R/NRjmjiT0DhsxI7AnBtYM/Office_Apps_Viewer_Component.js"],"sourcesContent":["// Welcome to Code in Framer\n// Get Started: https://www.framer.com/developers/\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{motion,AnimatePresence}from\"framer-motion\";/**\n * These annotations control how your component sizes\n * Learn more: https://www.framer.com/developers/#code-components-auto-sizing\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function Office_Apps_Viewer_Component(props){const{viewerType,fileChoose,fileUpload,fileURL,buttonText,buttonStyles,linkOpener,modalStyles}=props;const[fileSrc,setFileSrc]=useState(null);const[modalOpen,setModalOpen]=useState(false);const selectedFile=fileChoose===\"Upload\"?fileUpload:fileURL;const officeAppViewerURL=\"https://view.officeapps.live.com/op/embed.aspx?src=\"+selectedFile;const googleDocViewerURL=\"https://docs.google.com/viewer?url=\"+selectedFile+\"&embedded=\";useEffect(()=>{const body=document.getElementsByTagName(\"body\")[0];if(selectedFile&&modalOpen){body.style.overflow=\"hidden\";body.style.height=\"100%\";const updatedLink=viewerType===\"office-apps\"?officeAppViewerURL:googleDocViewerURL+\"true\";setFileSrc(updatedLink);}else{body.style.overflow=\"auto\";body.style.height=\"auto\";}},[fileChoose,fileUpload,viewerType,selectedFile,fileURL,modalOpen]);const openLink=()=>{const updatedLink=viewerType===\"office-apps\"?officeAppViewerURL:googleDocViewerURL+\"false\";window?.open(updatedLink,\"_blank\").focus();};const close=()=>setModalOpen(false);const open=()=>setModalOpen(true);return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\"},children:[/*#__PURE__*/_jsxs(motion.button,{whileTap:{scale:.9},onClick:()=>linkOpener===\"link\"?openLink():modalOpen?close():open(),style:{width:\"100%\",...buttonStyles.fontStyle,padding:buttonStyles.padding,backgroundColor:buttonStyles.background,borderRadius:buttonStyles.borderRadius,borderStyle:buttonStyles.border?.borderStyle,borderColor:buttonStyles.border?.borderColor,borderTopWidth:buttonStyles.border?.borderTopWidth,borderLeftWidth:buttonStyles.border?.borderLeftWidth,borderBottomWidth:buttonStyles.border?.borderBottomWidth,borderRightWidth:buttonStyles.border?.borderRightWidth,textDecoration:buttonStyles.textDecoration,color:buttonStyles.color,boxShadow:buttonStyles.shadow,cursor:\"pointer\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:\"5px\",overflow:\"hidden\"},\"aria-label\":\"Button\",children:[buttonStyles.buttonIcon&&/*#__PURE__*/_jsx(motion.div,{style:{width:buttonStyles.iconStyles?.size+\"px\",height:buttonStyles.iconStyles?.size+\"px\",color:buttonStyles.iconStyles?.color,display:\"flex\",overflow:\"hidden\"},dangerouslySetInnerHTML:{__html:buttonStyles.iconStyles.icon}}),buttonText]}),/*#__PURE__*/_jsx(AnimatePresence,{initial:false,mode:\"wait\",children:modalOpen&&fileSrc&&linkOpener===\"modal\"&&/*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",justifyContent:\"center\",alignItems:\"center\",position:\"fixed\",inset:0,zIndex:11},children:/*#__PURE__*/_jsxs(motion.div,{onClick:close,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},style:{position:\"absolute\",top:0,left:0,height:\"100%\",width:\"100%\",backgroundColor:modalStyles.backgroundColor,display:\"flex\",alignItems:\"center\",justifyContent:\"center\"},children:[/*#__PURE__*/_jsx(motion.div,{onClick:e=>e.stopPropagation(),initial:{opacity:0},animate:{opacity:1,transition:{duration:1,type:\"spring\",damping:25,stiffness:500}},exit:{opacity:0},style:{width:modalStyles.modalInnerWidth+\"%\",height:modalStyles.modalInnerHeight+\"%\",margin:\"auto\",display:\"flex\",flexDirection:\"column\",alignItems:\"start\",overflow:\"overlay\",zIndex:1},children:/*#__PURE__*/_jsx(\"iframe\",{src:fileSrc,frameBorder:\"0\",height:\"100%\",width:\"100%\",loading:\"lazy\"})}),/*#__PURE__*/_jsx(motion.div,{style:{position:\"absolute\",top:\"10px\",left:\"10px\",right:\"10px\",display:\"flex\",justifyContent:\"right\"},children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:\"10px\",zIndex:2},children:/*#__PURE__*/_jsx(\"div\",{onClick:close,children:/*#__PURE__*/_jsx(\"div\",{role:\"button\",\"aria-label\":\"close\",style:{padding:modalStyles.closebtn.padding,backgroundColor:modalStyles.closebtn.backgroundColor,borderRadius:modalStyles.closebtn.borderRadius,width:modalStyles.closebtn.size+\"px\",height:modalStyles.closebtn.size+\"px\",display:\"flex\",color:modalStyles.closebtn.color,cursor:\"pointer\"},dangerouslySetInnerHTML:{__html:modalStyles.closebtn.closeIcon}})})})})]})})})]});}Office_Apps_Viewer_Component.displayName=\"Docs Viewer\";addPropertyControls(Office_Apps_Viewer_Component,{viewerType:{type:ControlType.Enum,title:\"Viewer\",options:[\"google-docs\",\"office-apps\"],optionTitles:[\"Google Docs\",\"Microsoft Office Apps\"],defaultValue:\"google-docs\"},fileChoose:{type:ControlType.Enum,title:\"Choose\",options:[\"Upload\",\"URL\"],defaultValue:\"Upload\",displaySegmentedControl:true},fileUpload:{type:ControlType.File,allowedFileTypes:[\"doc\",\"docx\",\"xls\",\"xlsx\",\"ppt\",\"pdf\",\"txt\"],title:\"File\",hidden:props=>props.fileChoose!==\"Upload\"},fileURL:{type:ControlType.String,defaultValue:\"\",title:\"URL\",hidden:props=>props.fileChoose!==\"URL\"},buttonText:{title:\"Button Text\",type:ControlType.String,defaultValue:\"View File\"},buttonStyles:{type:ControlType.Object,title:\"Button Styles\",controls:{color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},background:{type:ControlType.Color,title:\"Button color\",defaultValue:\"#ffffff\"},fontStyle:{title:\"Font Style\",type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\"},border:{type:ControlType.Border,title:\"Border\",defaultValue:{borderBottomWidth:0,borderColor:\"black\",borderLeftWidth:0,borderRightWidth:0,borderStyle:\"solid\",borderTopWidth:0}},borderRadius:{type:ControlType.BorderRadius,title:\"Border Radius\",defaultValue:\"25px\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"10px 20px 10px 20px\"},shadow:{type:ControlType.BoxShadow,title:\"Shadow\",defaultValue:\"0px 0px 0px 0px rgba(0, 0, 0, 0)\"},textDecoration:{type:ControlType.Enum,title:\"Text Decoration\",options:[\"none\",\"underline\",\"overline\",\"line-through\"],optionTitles:[\"None\",\"Underline\",\"Overline\",\"Line Through\"],defaultValue:\"none\"},buttonIcon:{type:ControlType.Boolean,title:\"Button Icon\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},iconStyles:{type:ControlType.Object,title:\"Icon Styles\",controls:{icon:{type:ControlType.String,title:\"Icon\",defaultValue:`<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"currentColor\"><path d=\"M320-240h320v-80H320v80Zm0-160h320v-80H320v80ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z\" /></svg>`},size:{type:ControlType.Number,title:\"Size\",defaultValue:24},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"}},hidden(props){return props.buttonIcon===false;}}}},linkOpener:{type:ControlType.Enum,title:\"Opener\",options:[\"modal\",\"link\"],optionTitles:[\"Viewer\",\"Link\"],defaultValue:\"modal\"},modalStyles:{type:ControlType.Object,title:\"Viewer Styles\",controls:{modalInnerWidth:{type:ControlType.Number,title:\"Inner Width\",defaultValue:80,unit:\"%\"},modalInnerHeight:{type:ControlType.Number,title:\"Inner Height\",defaultValue:80,unit:\"%\"},closebtn:{type:ControlType.Object,title:\"Close Styles\",controls:{closeIcon:{type:ControlType.String,title:\"Close Icon\",defaultValue:`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" fill=\"currentColor\" viewBox=\"0 0 256 256\"><path d=\"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z\"></path></svg>`},size:{type:ControlType.Number,title:\"Icon Size\",defaultValue:40},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"5px 10px 5px 10px\"},borderRadius:{type:ControlType.BorderRadius,title:\"Border Radius\",defaultValue:\"5px\"},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"rgba(0,0,0,0.3)\"},color:{type:ControlType.Color,title:\"Icon Color\",defaultValue:\"#ffffff\"}}},backgroundColor:{type:ControlType.Color,title:\"Background Color\",defaultValue:\"rgba(0,0,0,0.7)\"}},hidden:props=>props.linkOpener!==\"modal\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Office_Apps_Viewer_Component\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Office_Apps_Viewer_Component.map"],"mappings":"8PAQG,SAAwB,EAA6B,EAAM,CAAC,GAAK,CAAC,aAAW,aAAW,aAAW,UAAQ,aAAW,eAAa,aAAW,eAAa,EAAW,CAAC,EAAQ,GAAYA,EAAS,KAAK,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAa,IAAa,SAAS,EAAW,EAAc,EAAmB,sDAAsD,EAAmB,EAAmB,sCAAsC,EAAa,aAAa,MAAc,CAAC,IAAM,EAAK,SAAS,qBAAqB,OAAO,CAAC,GAAM,GAA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