{"version":3,"file":"TextInput.B9sMuksN.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/tN5l0aqIzWiUvVuvMcpG/i4WlRzRKYhVygVoAxyVR/TextInput.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useState}from\"react\";import{motion}from\"framer\";import{createBackground,Border,parsePadding,fillProp,borderProp,shadowsProp,createId}from\"https://framerusercontent.com/modules/DwWOdDzQZGCuvkNlbUjZ/y3zt4fv5F2ZtnBW8nZvn/FramerFormsShared.js\";/**\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any\n * @framerIntrinsicWidth 400\n * @framerDisableUnlink\n */export default function TextInput(props){const{type,textAreaHeight,shadows,border}=props;const id=props.id||createId();const Element=type==\"textArea\"?\"textarea\":\"input\";const[focused,setFocused]=useState(false);const[invalid,setInvalid]=useState(false);let attributes={};let styles={};if(type==\"textArea\"){const[pt,pr,pb,pl]=parsePadding(props.padding);const heightMode=textAreaHeight.mode;const autoHeightSupported=typeof CSS!==\"undefined\"?CSS.supports(\"field-sizing\",\"content\"):true;attributes.rows=heightMode==\"fixed\"?textAreaHeight.lines:1;styles={display:\"block\",minHeight:heightMode==\"auto\"&&!autoHeightSupported?`calc(${textAreaHeight.fallbackLines}lh + ${pt+pb}px)`:heightMode!==\"fixed\"?`calc(${textAreaHeight.minLines}lh + ${pt+pb}px)`:undefined,maxHeight:heightMode!==\"fixed\"?`calc(${textAreaHeight.maxLines}lh + ${pt+pb}px)`:undefined,fieldSizing:heightMode==\"auto\"&&autoHeightSupported?\"content\":undefined,resize:heightMode==\"resizable\"?\"vertical\":\"none\"};}const onFocus=()=>{var _props_focusEvent;setFocused(true);(_props_focusEvent=props.focusEvent)===null||_props_focusEvent===void 0?void 0:_props_focusEvent.call(props);if(invalid){setInvalid(false);}};const onBlur=()=>{var _props_blurEvent;setFocused(false);(_props_blurEvent=props.blurEvent)===null||_props_blurEvent===void 0?void 0:_props_blurEvent.call(props);};const onInvalid=event=>{var _props_invalidEvent;event.preventDefault();setInvalid(true);(_props_invalidEvent=props.invalidEvent)===null||_props_invalidEvent===void 0?void 0:_props_invalidEvent.call(props);};return /*#__PURE__*/_jsxs(motion.div,{\"data-framerforms\":true,id:id,onFocus:onFocus,onBlur:onBlur,animate:{...createBackground(props.fill,null,focused,invalid),boxShadow:invalid&&(shadows===null||shadows===void 0?void 0:shadows.invalid)||focused&&(shadows===null||shadows===void 0?void 0:shadows.focus)||(shadows===null||shadows===void 0?void 0:shadows.default),borderColor:invalid&&(border===null||border===void 0?void 0:border.colorInvalid)||focused&&(border===null||border===void 0?void 0:border.colorFocus)||(border===null||border===void 0?void 0:border.color)},style:{borderRadius:props.radius,overflow:type==\"textArea\"&&props.textAreaScrollbar==\"auto\"?\"hidden\":\"visible\",...props.style},initial:false,transition:props.transition,children:[/*#__PURE__*/_jsx(Element,{name:props.name,required:props.required,autoFocus:props.autoFocus,placeholder:props.placeholder,minLength:props.minLengthEnabled?props.minLength:undefined,maxLength:props.maxLengthEnabled?props.maxLength:undefined,defaultValue:props.value,onInvalid:onInvalid,style:{display:\"block\",padding:props.padding,color:props.color,background:\"none\",border:\"none\",textOverflow:\"ellipsis\",...styles,...props.font,...props.style},...attributes}),/*#__PURE__*/_jsx(Border,{...props.border,transition:props.transition}),/*#__PURE__*/_jsx(\"style\",{children:`#${id} ${Element}::placeholder {\n                    color: ${props.placeholderColor};\n                }\n                #${id} ${Element}:focus {\n                    appearance: none;\n                    outline: none;\n                    border: none;\n                    display: none;\n                }`}),type==\"textArea\"&&props.textAreaScrollbar==\"hidden\"&&/*#__PURE__*/_jsx(\"style\",{children:`#${id} textarea::-webkit-scrollbar {\n                        display: none; /* WebKit browsers (Chrome, Safari) */\n                    }\n                    #${id} textarea {\n                        -ms-overflow-style: none; /* IE and Edge */\n                        scrollbar-width: none; /* Firefox */\n                    }`})]});}TextInput.displayName=\"Text Input\";addPropertyControls(TextInput,{name:{type:ControlType.String,defaultValue:\"Text\",preventLocalization:true},required:{type:ControlType.Boolean,defaultValue:false},autoFocus:{type:ControlType.Boolean,defaultValue:false,title:\"Auto-Focus\"},minLengthEnabled:{type:ControlType.Boolean,defaultValue:false,title:\"Min Length\"},minLength:{type:ControlType.Number,defaultValue:100,min:0,step:1,displayStepper:true,title:\" \",hidden:props=>!props.minLengthEnabled},maxLengthEnabled:{type:ControlType.Boolean,defaultValue:false,title:\"Max Length\"},maxLength:{type:ControlType.Number,defaultValue:100,min:0,step:1,displayStepper:true,title:\" \",hidden:props=>!props.maxLengthEnabled},value:{type:ControlType.String,placeholder:\"Default Value\"},type:{type:ControlType.Enum,defaultValue:\"input\",options:[\"textArea\",\"input\"],optionTitles:[\"Yes\",\"No\"],displaySegmentedControl:true,title:\"Text Area\"},textAreaHeight:{type:ControlType.Object,title:\"Height\",controls:{mode:{type:ControlType.Enum,defaultValue:\"auto\",options:[\"auto\",\"resizable\",\"fixed\"],optionTitles:[\"Auto\",\"Resizable\",\"Fixed\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},minLines:{type:ControlType.Number,defaultValue:3,min:1,step:1,displayStepper:true,hidden:props=>props.mode===\"fixed\"},maxLines:{type:ControlType.Number,defaultValue:8,min:1,step:1,displayStepper:true,hidden:props=>props.mode===\"fixed\"},lines:{type:ControlType.Number,defaultValue:5,min:1,step:1,displayStepper:true,hidden:props=>props.mode!==\"fixed\"},fallbackLines:{type:ControlType.Number,defaultValue:5,min:1,step:1,title:\"Fallback\",description:\"Auto height is [not supported on all browsers](https://caniuse.com/mdn-css_properties_field-sizing_content). Fallback is used when auto height is not supported.\",hidden:props=>props.mode!==\"auto\"}},hidden:props=>props.type!=\"textArea\"},textAreaScrollbar:{type:ControlType.Enum,defaultValue:\"hidden\",options:[\"auto\",\"hidden\"],optionTitles:[\"Auto\",\"Hidden\"],displaySegmentedControl:true,title:\"Scrollbar\",hidden:props=>props.type!=\"textArea\"},placeholder:{type:ControlType.String,defaultValue:\"Write here...\"},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.2}},color:{type:ControlType.Color,defaultValue:\"#999999\"},placeholderColor:{type:ControlType.Color,defaultValue:\"#999999\",title:\"Placeholder\"},fill:fillProp(),radius:{type:ControlType.BorderRadius,defaultValue:\"10px\"},padding:{type:ControlType.Padding,defaultValue:\"12px\"},border:borderProp(),shadows:shadowsProp(),transition:{type:ControlType.Transition,defaultValue:{type:false}},focusEvent:{type:ControlType.EventHandler,title:\"Focus\"},blurEvent:{type:ControlType.EventHandler,title:\"Blur\"},invalidEvent:{type:ControlType.EventHandler,title:\"Invalid\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextInput\",\"slots\":[],\"annotations\":{\"framerIntrinsicWidth\":\"400\",\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextInput.map"],"mappings":"0TAKG,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,OAAK,iBAAe,UAAQ,UAAQ,EAAY,EAAG,EAAM,IAAI,EAAS,EAAQ,EAAQ,GAAM,WAAW,WAAW,QAAa,CAAC,EAAQ,GAAYA,EAAS,EAAK,EAAO,CAAC,EAAQ,GAAYA,EAAS,EAAK,EAAM,EAAW,CAAC,EAAM,EAAO,CAAC,EAAE,GAAG,GAAM,WAAW,CAAC,GAAK,CAAC,EAAG,EAAG,EAAG,GAAI,EAAa,EAAM,OAAO,EAAQ,EAAW,EAAe,KAAW,EAAoB,OAAO,IAAM,IAAY,IAAI,SAAS,eAAe,SAAS,EAAE,GAAK,EAAW,KAAK,GAAY,QAAQ,EAAe,MAAM,EAAE,EAAO,CAAC,QAAQ,QAAQ,UAAU,GAAY,QAAQ,CAAC,EAAoB,QAAQ,EAAe,c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