{"version":3,"file":"ExampleComponent.4pdgyzVC.mjs","names":["React"],"sources":["https:/framerusercontent.com/modules/3y3LKcYyCxjxdLVaaKFu/mi4IDeymgCNaGXASX9IF/ExampleComponent.js"],"sourcesContent":["// Komponent przykładowy z kontrolami właściwości Framer\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import React,{startTransition}from\"react\";/**\n * Pole email z walidacją firmowego adresu\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function EmailValidator(props){const{placeholder,errorText,background,textColor,borderColor,errorBorderColor,font,style,padding=\"12px\",excludedDomains,borderRadius=10,shadows,errorFontSize=12,errorColor=\"#FF0000\",required=true,errorDefaultColor=\"#999999\",showErrorMessage=false,errorGap=4,inputType=\"email\",inputName=\"Email\"}=props;const[value,setValue]=React.useState(\"\");const[touched,setTouched]=React.useState(false);const[hasFocus,setHasFocus]=React.useState(false);const[submitted,setSubmitted]=React.useState(false);const genericDomains=React.useMemo(()=>(excludedDomains&&excludedDomains.length>0?excludedDomains:[\"gmail.com\",\"yahoo.com\",\"hotmail.com\",\"outlook.com\",\"aol.com\",\"icloud.com\",\"protonmail.com\",\"mail.com\",\"o2.pl\",\"wp.pl\",\"onet.pl\",\"interia.pl\"]).map(d=>d.toLowerCase().trim()).filter(Boolean),[excludedDomains]);const validate=React.useCallback(email=>{if(!email)return!required;const basicEmailRegex=/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;if(!basicEmailRegex.test(email))return false;const domain=email.split(\"@\")[1]?.toLowerCase()||\"\";if(!domain)return false;if(genericDomains.includes(domain))return false;return true;},[genericDomains,required]);const isValid=validate(value);const hasError=!isValid;const showError=hasError&&(touched||submitted);const shouldShowMessage=showErrorMessage||showError;const handleChange=event=>{const nextValue=event.target.value;startTransition(()=>{setValue(nextValue);});};const handleBlur=()=>{startTransition(()=>{setTouched(true);setHasFocus(false);});};const handleFocus=()=>{startTransition(()=>{setHasFocus(true);});};const handleInvalid=event=>{event.preventDefault();startTransition(()=>{setTouched(true);setSubmitted(true);setHasFocus(true);});};const currentBorderColor=showError?errorBorderColor:hasFocus?textColor:borderColor;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",justifyContent:\"center\",gap:6,color:textColor,position:\"relative\",boxSizing:\"border-box\",...font},children:[/*#__PURE__*/_jsx(\"input\",{type:inputType,name:inputName,autoComplete:\"email\",placeholder:placeholder,value:value,onChange:handleChange,onBlur:handleBlur,onFocus:handleFocus,onInvalid:handleInvalid,required:required,style:{width:\"100%\",padding,borderRadius,border:`1px solid ${currentBorderColor}`,outline:\"none\",color:textColor,boxSizing:\"border-box\",background,fontSize:font?.fontSize,lineHeight:font?.lineHeight,letterSpacing:font?.letterSpacing,fontWeight:font?.fontWeight,fontFamily:font?.fontFamily,boxShadow:shadows},\"aria-invalid\":showError,\"aria-describedby\":shouldShowMessage?\"work-email-error\":undefined}),shouldShowMessage&&/*#__PURE__*/_jsx(\"div\",{style:{marginTop:errorGap,fontSize:errorFontSize,lineHeight:\"1.3em\",color:showError?errorColor:errorDefaultColor},id:\"work-email-error\",children:errorText})]});}addPropertyControls(EmailValidator,{inputType:{type:ControlType.Enum,title:\"Input Type\",options:[\"email\",\"text\"],optionTitles:[\"Email\",\"Text\"],defaultValue:\"email\"},inputName:{type:ControlType.String,title:\"Name\",defaultValue:\"Email\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.2em\"}},excludedDomains:{type:ControlType.Array,title:\"Excluded Domains\",control:{type:ControlType.String},defaultValue:[\"gmail.com\",\"yahoo.com\",\"hotmail.com\",\"outlook.com\",\"aol.com\",\"icloud.com\",\"protonmail.com\",\"mail.com\",\"o2.pl\",\"wp.pl\",\"onet.pl\",\"interia.pl\"]},required:{type:ControlType.Boolean,title:\"Required\",defaultValue:true,enabledTitle:\"Yes\",disabledTitle:\"No\"},showErrorMessage:{type:ControlType.Boolean,title:\"Error message\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"name@yourcompany.com\"},errorText:{type:ControlType.String,title:\"Error\",defaultValue:\"Please enter a valid work email.\",displayTextArea:false},errorFontSize:{type:ControlType.Number,title:\"Error Size\",defaultValue:12,min:8,max:32,step:1},errorDefaultColor:{type:ControlType.Color,title:\"Error\",defaultValue:\"#999999\"},errorColor:{type:ControlType.Color,title:\"Error Color\",defaultValue:\"#FF0000\"},errorGap:{type:ControlType.Number,title:\"Error Gap\",defaultValue:4,min:0,max:48,step:1},background:{type:ControlType.Color,title:\"Fill\",defaultValue:\"rgba(187, 187, 187, 0.15)\"},textColor:{type:ControlType.Color,title:\"Color\",defaultValue:\"#999999\"},borderColor:{type:ControlType.Color,title:\"Border\",defaultValue:\"#CCCCCC\"},errorBorderColor:{type:ControlType.Color,title:\"Focus\",defaultValue:\"#FF0000\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:10,min:0,max:100,step:1},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:\"12px\"},shadows:{type:ControlType.BoxShadow,title:\"Shadows\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"EmailValidator\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ExampleComponent.map"],"mappings":"yLAMG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,cAAY,YAAU,aAAW,YAAU,cAAY,mBAAiB,OAAK,QAAM,UAAQ,OAAO,kBAAgB,eAAa,GAAG,UAAQ,gBAAc,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