{"version":3,"file":"GalleryAccessButton.ClUT5DNY.mjs","names":["React.useRef","React.useState","React.useId","React.useCallback","React.startTransition"],"sources":["https:/framerusercontent.com/modules/EfStNqHLQOSXZKxPffj5/27YACyFWvw4VHZ8jmIqx/GalleryAccessButton.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{createPortal}from\"react-dom\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function GalleryAccessButton(props){const{passwordMode=false,label=\"View Gallery\",heading=\"Gallery access\",intro=\"Enter your access code to view this gallery.\",buttonBackground=\"#B7472E\",buttonTextColor=\"#F3F0E8\",scrimColor=\"rgba(0,0,0,0.7)\",modalBackground=\"#111713\",modalTextColor=\"#F3F0E8\",buttonFont,headingFont,bodyFont,style}=props;const triggerRef=React.useRef(null);const dialogRef=React.useRef(null);const[open,setOpen]=React.useState(false);const[accessCode,setAccessCode]=React.useState(\"\");const[submitted,setSubmitted]=React.useState(false);const inputId=React.useId();const canUseDOM=typeof window!==\"undefined\"&&typeof document!==\"undefined\";const closeModal=React.useCallback(()=>{React.startTransition(()=>setOpen(false));if(triggerRef.current)triggerRef.current.focus();},[]);React.useEffect(()=>{if(!open)return;React.startTransition(()=>{setAccessCode(\"\");setSubmitted(false);});},[open]);React.useEffect(()=>{if(!open||!canUseDOM)return;if(!dialogRef.current)return;dialogRef.current.focus();},[open,canUseDOM]);const onDialogKeyDown=React.useCallback(event=>{if(event.key===\"Escape\"){event.preventDefault();closeModal();return;}if(event.key!==\"Tab\")return;const root=dialogRef.current;if(!root)return;const focusable=Array.from(root.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])')).filter(el=>!el.hasAttribute(\"disabled\"));if(focusable.length===0)return;const first=focusable[0];const last=focusable[focusable.length-1];const active=canUseDOM?document.activeElement:null;if(event.shiftKey&&active===first){event.preventDefault();last.focus();}else if(!event.shiftKey&&active===last){event.preventDefault();first.focus();}},[closeModal,canUseDOM]);const modalNode=open&&canUseDOM?/*#__PURE__*/createPortal(/*#__PURE__*/_jsx(\"div\",{role:\"presentation\",onMouseDown:event=>{if(event.target===event.currentTarget)closeModal();},style:{position:\"fixed\",inset:0,background:scrimColor,zIndex:99999,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding:16,boxSizing:\"border-box\"},children:/*#__PURE__*/_jsxs(\"div\",{ref:dialogRef,role:\"dialog\",\"aria-modal\":\"true\",\"aria-label\":heading,tabIndex:-1,onKeyDown:onDialogKeyDown,style:{width:\"calc(100% - 32px)\",maxWidth:440,background:modalBackground,color:modalTextColor,padding:32,boxSizing:\"border-box\",outline:\"none\"},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",justifyContent:\"space-between\",alignItems:\"start\",gap:12,marginBottom:12},children:[/*#__PURE__*/_jsx(\"div\",{style:{...headingFont,fontFamily:\"Anton, sans-serif\",fontSize:headingFont?.fontSize??32,lineHeight:headingFont?.lineHeight??\"1em\"},children:heading}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-label\":\"Close dialog\",onClick:closeModal,style:{background:\"transparent\",color:modalTextColor,border:\"1px solid rgba(243,240,232,0.4)\",padding:\"6px 10px\",cursor:\"pointer\"},children:\"Close\"})]}),/*#__PURE__*/_jsx(\"div\",{style:{...bodyFont,fontFamily:\"Lora, serif\",marginBottom:16},children:intro}),/*#__PURE__*/_jsx(\"label\",{htmlFor:inputId,style:{...bodyFont,fontFamily:\"Oswald, sans-serif\",textTransform:\"uppercase\",letterSpacing:\"1px\",display:\"block\",marginBottom:8},children:passwordMode?\"Password\":\"Access code\"}),/*#__PURE__*/_jsx(\"input\",{id:inputId,type:passwordMode?\"password\":\"text\",required:true,value:accessCode,onChange:event=>React.startTransition(()=>setAccessCode(event.target.value)),style:{width:\"100%\",boxSizing:\"border-box\",padding:12,marginBottom:12,fontFamily:\"Lora, serif\",fontSize:16}}),/*#__PURE__*/_jsx(\"button\",{type:\"button\",onClick:()=>{if(!accessCode.trim())return;React.startTransition(()=>setSubmitted(true));},style:{...buttonFont,fontFamily:\"Oswald, sans-serif\",textTransform:\"uppercase\",letterSpacing:\"1px\",fontWeight:600,fontSize:buttonFont?.fontSize??13,padding:\"12px 16px\",border:\"none\",background:buttonBackground,color:buttonTextColor,cursor:\"pointer\"},children:passwordMode?\"Submit password\":\"Submit code\"}),submitted?/*#__PURE__*/_jsx(\"div\",{\"aria-live\":\"polite\",style:{...bodyFont,fontFamily:\"Lora, serif\",marginTop:16},children:\"access denied\"}):null]})}),document.body):null;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",width:\"100%\",height:\"auto\"},children:[/*#__PURE__*/_jsx(\"button\",{ref:triggerRef,type:\"button\",onClick:()=>React.startTransition(()=>setOpen(true)),style:{...buttonFont,background:buttonBackground,color:buttonTextColor,border:\"none\",padding:\"16px 24px\",fontFamily:\"Oswald, sans-serif\",fontWeight:600,fontSize:buttonFont?.fontSize??13,letterSpacing:\"1px\",textTransform:\"uppercase\",cursor:\"pointer\"},children:label}),modalNode]});}addPropertyControls(GalleryAccessButton,{passwordMode:{type:ControlType.Boolean,title:\"Password\",defaultValue:false},label:{type:ControlType.String,defaultValue:\"View Gallery\"},eventName:{type:ControlType.String,defaultValue:\"\"},heading:{type:ControlType.String,defaultValue:\"Gallery access\"},intro:{type:ControlType.String,defaultValue:\"Enter your access code to view this gallery.\"},requestMessage:{type:ControlType.String,defaultValue:\"access denied\",displayTextArea:true},email:{type:ControlType.String,defaultValue:\"greg@noe-eyes-photography.com\"},buttonBackground:{type:ControlType.Color,defaultValue:\"#B7472E\"},buttonTextColor:{type:ControlType.Color,defaultValue:\"#F3F0E8\"},scrimColor:{type:ControlType.Color,defaultValue:\"rgba(0,0,0,0.7)\"},modalBackground:{type:ControlType.Color,defaultValue:\"#111713\"},modalTextColor:{type:ControlType.Color,defaultValue:\"#F3F0E8\"},linkColor:{type:ControlType.Color,defaultValue:\"#F3F0E8\"},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"13px\",variant:\"Semibold\",letterSpacing:\"1px\",lineHeight:\"1em\"}},headingFont:{type:ControlType.Font,title:\"Heading Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Regular\",lineHeight:\"1em\",letterSpacing:\"-0.02em\"}},bodyFont:{type:ControlType.Font,title:\"Body Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"16px\",variant:\"Regular\",lineHeight:\"1.4em\",letterSpacing:\"0em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GalleryAccessButton\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GalleryAccessButton.map"],"mappings":"gPAGG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,eAAa,GAAM,QAAM,eAAe,UAAQ,iBAAiB,QAAM,+CAA+C,mBAAiB,UAAU,kBAAgB,UAAU,aAAW,kBAAkB,kBAAgB,UAAU,iBAAe,UAAU,aAAW,cAAY,WAAS,SAAO,EAAY,EAAWA,EAAa,IAAI,EAAQ,EAAUA,EAAa,IAAI,EAAO,CAAC,EAAK,GAASC,EAAe,EAAK,EAAO,CAAC,EAAW,GAAeA,EAAe,EAAE,EAAO,CAAC,EAAU,GAAcA,EAAe,EAAK,EAAQ,EAAQC,EAAY,EAAQ,EAAiB,IAAS,QAAa,OAAO,SAAW,IAAkB,EAAWC,MAAsB,CAAC,MAA0B,EAAQ,EAAK,CAAC,EAAK,EAAW,SAAQ,EAAW,QAAQ,MAAM,CAAE,EAAE,CAAC,CAAC,EAAE,MAAoB,CAAK,GAAY,MAA0B,CA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