{"version":3,"file":"PasswordProtector.DLZpwefs.mjs","names":["useState","startTransition"],"sources":["https:/framerusercontent.com/modules/3WZiu1Abl1gpERu1GYoQ/0Ktnj51uU9FJ1eAzBbIP/PasswordProtector.js"],"sourcesContent":["// Password protection component with customizable password, title, button styling, and redirect on success\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function PasswordProtector(props){const{title,titleFont,titleColor,password,buttonLabel,buttonFont,buttonColor,buttonTextColor,buttonRadius,redirectUrl,backgroundColor,inputBackgroundColor,inputTextColor,inputBorderColor,errorColor,errorFont,cardRadius,inputRadius,cardShadow,style}=props;const[inputValue,setInputValue]=useState(\"\");const[showError,setShowError]=useState(false);const[isHovered,setIsHovered]=useState(false);const handleSubmit=e=>{e.preventDefault();if(inputValue===password){if(typeof window!==\"undefined\"){window.location.href=redirectUrl;}}else{startTransition(()=>{setShowError(true);setInputValue(\"\");});setTimeout(()=>{startTransition(()=>setShowError(false));},3e3);}};const isFixedWidth=style?.width===\"100%\";const isFixedHeight=style?.height===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"center\",backgroundColor,padding:\"40px 32px\",borderRadius:cardRadius,boxShadow:cardShadow,...isFixedWidth?{}:{minWidth:\"max-content\"},...isFixedHeight?{}:{minHeight:\"max-content\"}},children:[/*#__PURE__*/_jsx(\"h1\",{style:{margin:0,marginBottom:32,color:titleColor,textAlign:\"center\",...titleFont,width:\"100%\"},children:title}),/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"column\",gap:16,width:\"100%\",maxWidth:400},children:[/*#__PURE__*/_jsx(\"input\",{type:\"password\",value:inputValue,onChange:e=>{startTransition(()=>{setInputValue(e.target.value);setShowError(false);});},placeholder:\"Enter password\",style:{padding:\"12px 16px\",height:40,backgroundColor:inputBackgroundColor,color:inputTextColor,border:`1px solid ${inputBorderColor}`,borderRadius:inputRadius,fontSize:15,outline:\"none\",transition:\"border-color 0.2s ease\"},onFocus:e=>{e.target.style.borderColor=buttonColor;},onBlur:e=>{e.target.style.borderColor=inputBorderColor;}}),showError&&/*#__PURE__*/_jsx(\"div\",{style:{color:errorColor,textAlign:\"center\",...errorFont},children:\"Incorrect password. Please try again.\"}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",onMouseEnter:()=>startTransition(()=>setIsHovered(true)),onMouseLeave:()=>startTransition(()=>setIsHovered(false)),style:{padding:\"12px 24px\",height:40,backgroundColor:buttonColor,color:buttonTextColor,border:\"none\",borderRadius:buttonRadius,cursor:\"pointer\",transition:\"opacity 0.2s ease, transform 0.1s ease\",opacity:isHovered?.9:1,transform:isHovered?\"scale(0.98)\":\"scale(1)\",...buttonFont},children:buttonLabel})]})]});}addPropertyControls(PasswordProtector,{title:{type:ControlType.String,title:\"Title\",defaultValue:\"Enter password to view case study\"},titleFont:{type:ControlType.Font,title:\"Title Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Semibold\",letterSpacing:\"-0.03em\",lineHeight:\"1em\"}},titleColor:{type:ControlType.Color,title:\"Title Color\",defaultValue:\"#000000\"},password:{type:ControlType.String,title:\"Password\",defaultValue:\"secret123\",obscured:true},buttonLabel:{type:ControlType.String,title:\"Button Label\",defaultValue:\"Unlock case study\"},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Semibold\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},buttonColor:{type:ControlType.Color,title:\"Button Color\",defaultValue:\"#000000\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text Color\",defaultValue:\"#FFFFFF\"},buttonRadius:{type:ControlType.Number,title:\"Button Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},cardRadius:{type:ControlType.Number,title:\"Card Radius\",defaultValue:16,min:0,max:50,step:1,unit:\"px\"},inputRadius:{type:ControlType.Number,title:\"Input Radius\",defaultValue:8,min:0,max:50,step:1,unit:\"px\"},cardShadow:{type:ControlType.BoxShadow,title:\"Card Shadow\"},redirectUrl:{type:ControlType.Link,title:\"Redirect URL\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},inputBackgroundColor:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#F5F5F5\"},inputTextColor:{type:ControlType.Color,title:\"Input Text\",defaultValue:\"#000000\"},inputBorderColor:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"#EEEEEE\"},errorColor:{type:ControlType.Color,title:\"Error Color\",defaultValue:\"#FF5588\"},errorFont:{type:ControlType.Font,title:\"Error Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PasswordProtector\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PasswordProtector.map"],"mappings":"sMAIG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,QAAM,YAAU,aAAW,WAAS,cAAY,aAAW,cAAY,kBAAgB,eAAa,cAAY,kBAAgB,uBAAqB,iBAAe,mBAAiB,aAAW,YAAU,aAAW,cAAY,aAAW,SAAO,EAAW,CAAC,EAAW,GAAeA,EAAS,GAAG,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAa,GAAG,C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