{"version":3,"file":"PasswordProtected.DLlw7h4w.mjs","names":["useState","__esmMin","init_ssg_sandbox_shims","te","window","_e","p","init_npm_react_18_3_1","init_framer_BpuvUAiZ","ControlType","addPropertyControls","PasswordProtected","props","inputValue","setInputValue","isUnlocked","setIsUnlocked","showError","setShowError","handleSubmit","password","redirectUrl","handleInputChange","textColor","titleFont","title","bodyFont","description","inputBackground","inputBorder","errorColor","errorMessage","buttonBackground","buttonTextColor","buttonFont","buttonText","init_PasswordProtected","init_jsx_runtime"],"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":"A,4LAIG,SAAwBW,EAAkB,EAAM,CAAC,GAAK,CAAC,WAAS,QAAM,cAAY,cAAY,aAAW,eAAa,kBAAgB,YAAU,kBAAgB,cAAY,mBAAiB,kBAAgB,aAAW,eAAa,YAAU,WAAS,aAAW,WAAS,eAAaC,EAAW,CAACC,EAAWC,GAAed,EAAS,EAAE,EAAO,CAACe,EAAWC,GAAehB,EAAS,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