{"version":3,"file":"PasswordProtected.DgMhzs7s.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/jZTsvq6uqaiVACl7zI7v/XyLGGondzBJt9likIO8x/PasswordProtected.js"],"sourcesContent":["// Password protected element with customizable styling\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 PasswordProtected(props){const{password,title,description,placeholder,buttonText,errorMessage,backgroundColor,textColor,inputBackground,inputBorder,buttonBackground,buttonTextColor,errorColor,borderRadius,titleFont,bodyFont,buttonFont,children,redirectUrl}=props;const[inputValue,setInputValue]=useState(\"\");const[isUnlocked,setIsUnlocked]=useState(false);const[showError,setShowError]=useState(false);const handleSubmit=e=>{e.preventDefault();if(inputValue===password){if(redirectUrl&&typeof window!==\"undefined\"){window.location.href=redirectUrl;}else{startTransition(()=>{setIsUnlocked(true);setShowError(false);});}}else{startTransition(()=>{setShowError(true);});}};const handleInputChange=e=>{setInputValue(e.target.value);if(showError){startTransition(()=>setShowError(false));}};if(isUnlocked){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",position:\"relative\"},children:children});}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",backgroundColor,position:\"relative\",padding:20},children:/*#__PURE__*/_jsxs(\"div\",{style:{maxWidth:400,width:\"100%\",display:\"flex\",flexDirection:\"column\",gap:20},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",flexDirection:\"column\",gap:8},children:[/*#__PURE__*/_jsx(\"h2\",{style:{margin:0,color:textColor,...titleFont},children:title}),/*#__PURE__*/_jsx(\"p\",{style:{margin:0,color:textColor,opacity:.7,...bodyFont},children:description})]}),/*#__PURE__*/_jsxs(\"form\",{onSubmit:handleSubmit,style:{display:\"flex\",flexDirection:\"column\",gap:12},children:[/*#__PURE__*/_jsx(\"input\",{type:\"password\",value:inputValue,onChange:handleInputChange,placeholder:placeholder,style:{width:\"100%\",padding:\"12px 16px\",backgroundColor:inputBackground,border:`1px solid ${inputBorder}`,borderRadius,color:textColor,outline:\"none\",boxSizing:\"border-box\",...bodyFont},\"aria-label\":\"Password input\"}),showError&&/*#__PURE__*/_jsx(\"p\",{style:{margin:0,color:errorColor,...bodyFont},children:errorMessage}),/*#__PURE__*/_jsx(\"button\",{type:\"submit\",style:{width:\"100%\",padding:\"12px 16px\",backgroundColor:buttonBackground,color:buttonTextColor,border:\"none\",borderRadius,cursor:\"pointer\",...buttonFont},\"aria-label\":\"Submit password\",children:buttonText})]})]})});}addPropertyControls(PasswordProtected,{password:{type:ControlType.String,title:\"Password\",defaultValue:\"secret123\"},redirectUrl:{type:ControlType.Link,title:\"Redirect URL\"},title:{type:ControlType.String,title:\"Title\",defaultValue:\"Protected Content\"},description:{type:ControlType.String,title:\"Description\",defaultValue:\"Enter password to view this content\",displayTextArea:true},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"Enter password\"},buttonText:{type:ControlType.String,title:\"Button Text\",defaultValue:\"Unlock\"},errorMessage:{type:ControlType.String,title:\"Error Message\",defaultValue:\"Incorrect password. Please try again.\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},inputBackground:{type:ControlType.Color,title:\"Input Background\",defaultValue:\"#F5F5F5\"},inputBorder:{type:ControlType.Color,title:\"Input Border\",defaultValue:\"#EEEEEE\"},buttonBackground:{type:ControlType.Color,title:\"Button Background\",defaultValue:\"#000000\"},buttonTextColor:{type:ControlType.Color,title:\"Button Text\",defaultValue:\"#FFFFFF\"},errorColor:{type:ControlType.Color,title:\"Error Color\",defaultValue:\"#FF5588\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:8,min:0,max:32,step:1,unit:\"px\"},titleFont:{type:ControlType.Font,title:\"Title Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"32px\",variant:\"Semibold\",letterSpacing:\"-0.03em\",lineHeight:\"1em\"}},bodyFont:{type:ControlType.Font,title:\"Body Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},buttonFont:{type:ControlType.Font,title:\"Button Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{variant:\"Semibold\",fontSize:\"14px\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},children:{type:ControlType.ComponentInstance,title:\"Protected Content\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"PasswordProtected\",\"slots\":[\"children\"],\"annotations\":{\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PasswordProtected.map"],"mappings":"sMAIG,SAAwB,EAAkB,EAAM,CAAC,GAAK,CAAC,WAAS,QAAM,cAAY,cAAY,aAAW,eAAa,kBAAgB,YAAU,kBAAgB,cAAY,mBAAiB,kBAAgB,aAAW,eAAa,YAAU,WAAS,aAAW,WAAS,eAAa,EAAW,CAAC,EAAW,GAAeA,EAAS,GAAG,CAAM,CAAC,EAAW,GAAeA,EAAS,GAAM,CAAM,CAAC,EAAU,GAAcA,EAAS,GAAM,CAAO,EAAa,GAAG,CAAC,EAAE,gBAAgB,CAAI,IAAa,EAAa,GAAoB,IAAS,OAAa,EAAO,SAAS,KAAK,EAAkB,MAAoB,CAAC,EAAc,GAAK,CAAC,EAAa,GAAM,EAAG,CAAQ,MAAoB,CAAC,EAAa,GAAK,EAAG,EAAU,EAAkB,GAAG,CAAC,EAAc,EAAE,OAAO,MA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