{"version":3,"file":"GSInputText.B1EdYuVj.mjs","names":["useMemo","useState","useRef","useId","useCallback"],"sources":["https:/framerusercontent.com/modules/06RAk13XDkgQUebE1Iif/TGWp9m91NXcORK0i6hnU/GSInputText.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useCallback,useEffect,useMemo,useRef,useState,useId}from\"react\";import{addPropertyControls,ControlType}from\"framer\";import{useStore,inputFieldKeys,inputFieldTitles}from\"https://framerusercontent.com/modules/coQ7sWY5qKwbci5MWUR2/aP8fdT9GF7nKRCIImbeJ/GuidedSellingStore.js\";import{BASE,PLACEHOLDER,BORDER_DEFAULT,BORDER_FOCUS,BORDER_INVALID,ERROR,FILL,INPUT_MIN_HEIGHT,PADDING,BORDER_RADIUS_FALLBACK,FONT_LABEL,FONT_INPUT,FONT_SIZE,DEFAULT_INPUT_ASTERISK_MARGIN_LEFT_PX,fontStackOrFallback,cssFontSize,cssLetterSpacing,cssLineHeight}from\"https://framerusercontent.com/modules/xLLZXEXaEBlPyFlEiPAk/8MP9gw1UQ24Z3D2RvBzL/GSInputHelpers.js\";// ─── Helpers ──────────────────────────────────────────────────────────────────\nfunction useOptionalRegex(pattern){return useMemo(()=>{const t=pattern?.trim();if(!t)return null;try{return new RegExp(t);}catch{return null;}},[pattern]);}GSInputText.defaultProps={fieldKey:inputFieldKeys[0],label:\"\",required:false,maxLength:255,validationRegex:\"\",padding:`${PADDING}px`,asteriskColor:ERROR,asteriskMarginLeft:DEFAULT_INPUT_ASTERISK_MARGIN_LEFT_PX,colorLabel:BASE,colorInput:BASE,colorPlaceholder:PLACEHOLDER};addPropertyControls(GSInputText,{fieldKey:{type:ControlType.Enum,title:\"Field key\",options:[...inputFieldKeys],optionTitles:inputFieldKeys.map(k=>inputFieldTitles[k])},label:{type:ControlType.String,title:\"Label\",defaultValue:\"\",placeholder:\"Leave empty to use field title\"},placeholder:{type:ControlType.String,title:\"Placeholder\",defaultValue:\"\"},required:{type:ControlType.Boolean,title:\"Required\",defaultValue:false},asteriskColor:{type:ControlType.Color,title:\"Asterisk color\",defaultValue:ERROR},asteriskFont:{type:ControlType.Font,title:\"Asterisk font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:FONT_SIZE,letterSpacing:0,lineHeight:1,textAlign:\"left\"}},asteriskMarginLeft:{type:ControlType.Number,title:\"Asterisk margin left\",min:0,step:1,displayStepper:true,defaultValue:DEFAULT_INPUT_ASTERISK_MARGIN_LEFT_PX},validationRegex:{type:ControlType.String,title:\"Validation regex (optional)\",defaultValue:\"\",placeholder:String.raw`e.g. ^\\d{5}(-\\d{4})?$`},maxLength:{type:ControlType.Number,title:\"Max length\",min:0,step:1,displayStepper:true,defaultValue:255},labelFont:{type:ControlType.Font,title:\"Label font\",controls:\"extended\",defaultFontType:\"serif\",defaultValue:{fontSize:FONT_SIZE,letterSpacing:0,lineHeight:1.2,textAlign:\"left\"}},inputFont:{type:ControlType.Font,title:\"Input font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:FONT_SIZE,letterSpacing:0,lineHeight:1.2,textAlign:\"left\"}},colorLabel:{type:ControlType.Color,title:\"Label color\",defaultValue:BASE},colorInput:{type:ControlType.Color,title:\"Input color\",defaultValue:BASE},colorPlaceholder:{type:ControlType.Color,title:\"Placeholder color\",defaultValue:PLACEHOLDER},borderDefault:{type:ControlType.Border,title:\"Border (default)\",defaultValue:{borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_DEFAULT}},borderFocus:{type:ControlType.Border,title:\"Border (focus)\",defaultValue:{borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_FOCUS}},borderInvalid:{type:ControlType.Border,title:\"Border (invalid)\",defaultValue:{borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_INVALID}},borderRadius:{type:ControlType.BorderRadius,title:\"Radius\",defaultValue:\"10px\"},padding:{type:ControlType.Padding,title:\"Padding\",defaultValue:`${PADDING}px`}});/**\n * Single-line text input bound to GuidedSellingStore.\n * Required asterisk appears in the label. Input is a plain full-width element.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight any\n */export default function GSInputText(props){const{fieldKey,label:labelProp,placeholder,required,validationRegex=\"\",style,labelFont,inputFont,borderDefault,borderFocus,borderInvalid,borderRadius,maxLength=255,padding=`${PADDING}px`,asteriskColor=ERROR,asteriskFont,asteriskMarginLeft=DEFAULT_INPUT_ASTERISK_MARGIN_LEFT_PX,colorLabel=BASE,colorInput=BASE,colorPlaceholder=PLACEHOLDER}=props;const[store,setStore]=useStore();const regex=useOptionalRegex(validationRegex);useEffect(()=>{setStore(s=>{const next={...s.inputRequiredByField};if(required)next[fieldKey]=true;else delete next[fieldKey];return{inputRequiredByField:next};});return()=>{setStore(s=>{const next={...s.inputRequiredByField};delete next[fieldKey];return{inputRequiredByField:next};});};},[fieldKey,required]);const[touched,setTouched]=useState(false);const[focused,setFocused]=useState(false);const inputRef=useRef(null);const inputId=useId().replace(/:/g,\"_\");const placeholderClass=useId().replace(/:/g,\"_\");const errorId=useId().replace(/:/g,\"_\");const raw=store[fieldKey];const value=raw==null?\"\":String(raw);const trimmed=value.trim();const requiredInvalid=required&&trimmed===\"\";const regexInvalid=Boolean(regex&&trimmed!==\"\"&&!regex.test(trimmed));const showInvalid=touched&&(requiredInvalid||regexInvalid);const errorMessage=requiredInvalid?\"This field is required.\":regexInvalid?\"Please check this field's format.\":\"\";const BORDER_FB_DEFAULT={borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_DEFAULT};const BORDER_FB_FOCUS={borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_FOCUS};const BORDER_FB_INVALID={borderWidth:2,borderStyle:\"solid\",borderColor:BORDER_INVALID};const activeBorder=showInvalid?{...BORDER_FB_INVALID,...borderInvalid}:focused?{...BORDER_FB_FOCUS,...borderFocus}:{...BORDER_FB_DEFAULT,...borderDefault};const displayPlaceholder=placeholder||inputFieldTitles[fieldKey]||\"\";const labelText=typeof labelProp===\"string\"&&labelProp.trim()!==\"\"?labelProp.trim():inputFieldTitles[fieldKey]||\"\";const maxLen=maxLength>0?maxLength:undefined;// Label is a flex row so the asterisk sits baseline-aligned right after the text.\nconst labelStyle={...labelFont,display:\"flex\",alignItems:\"baseline\",marginBottom:8,fontFamily:fontStackOrFallback(labelFont,FONT_LABEL),fontSize:cssFontSize(labelFont?.fontSize,FONT_SIZE),lineHeight:cssLineHeight(labelFont?.lineHeight,1.2),letterSpacing:cssLetterSpacing(labelFont?.letterSpacing),color:colorLabel};const asteriskStyle={color:asteriskColor,marginLeft:asteriskMarginLeft,flexShrink:0,fontFamily:fontStackOrFallback(asteriskFont,FONT_INPUT),fontSize:cssFontSize(asteriskFont?.fontSize,FONT_SIZE),fontWeight:asteriskFont?.fontWeight??600,letterSpacing:cssLetterSpacing(asteriskFont?.letterSpacing),lineHeight:cssLineHeight(asteriskFont?.lineHeight,1)};const shellStyle={display:\"flex\",alignItems:\"center\",width:\"100%\",flex:1,minHeight:INPUT_MIN_HEIGHT,boxSizing:\"border-box\",padding,backgroundColor:FILL,borderRadius:borderRadius??BORDER_RADIUS_FALLBACK,cursor:\"text\",transition:\"border 0.15s ease\",...activeBorder};// Plain full-width input — no sizing tricks, no flex gymnastics.\nconst inputStyle={...inputFont,flex:1,minWidth:0,width:\"100%\",margin:0,padding:0,border:\"none\",outline:\"none\",background:\"transparent\",boxShadow:\"none\",WebkitAppearance:\"none\",appearance:\"none\",fontFamily:fontStackOrFallback(inputFont,FONT_INPUT),fontSize:cssFontSize(inputFont?.fontSize,FONT_SIZE),lineHeight:cssLineHeight(inputFont?.lineHeight,1.2),letterSpacing:cssLetterSpacing(inputFont?.letterSpacing),color:value?colorInput:colorPlaceholder};const handleInputChange=e=>{let v=e.target.value;if(maxLength>0)v=v.slice(0,maxLength);setStore({[fieldKey]:v});};const handleShellMouseDown=useCallback(e=>{if(e.button!==0)return;const input=inputRef.current;if(!input)return;if(e.target===input)return;e.preventDefault();input.focus();},[]);return /*#__PURE__*/_jsxs(\"div\",{style:{position:\"relative\",width:\"100%\",height:\"100%\",boxSizing:\"border-box\",display:\"flex\",flexDirection:\"column\",minHeight:0,...style},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .${placeholderClass}::placeholder {\n                    font-family: ${fontStackOrFallback(inputFont,FONT_INPUT)};\n                    font-weight: ${inputFont?.fontWeight??400};\n                    font-size: ${cssFontSize(inputFont?.fontSize,FONT_SIZE)};\n                    letter-spacing: ${cssLetterSpacing(inputFont?.letterSpacing)};\n                    color: ${colorPlaceholder};\n                    opacity: 1;\n                }\n                .${placeholderClass}::-webkit-contacts-auto-fill-button,\n                .${placeholderClass}::-webkit-credentials-auto-fill-button {\n                    display: none !important;\n                    visibility: hidden !important;\n                    pointer-events: none;\n                }\n            `}),labelText?/*#__PURE__*/_jsxs(\"label\",{htmlFor:inputId,style:labelStyle,children:[labelText,required&&/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":true,style:asteriskStyle,children:\"*\"})]}):null,/*#__PURE__*/_jsx(\"div\",{style:shellStyle,onMouseDown:handleShellMouseDown,children:/*#__PURE__*/_jsx(\"input\",{ref:inputRef,id:inputId,type:\"text\",className:placeholderClass,value:value,placeholder:displayPlaceholder,maxLength:maxLen,\"aria-invalid\":showInvalid,\"aria-required\":required,\"aria-describedby\":showInvalid?errorId:undefined,onChange:handleInputChange,onFocus:()=>setFocused(true),onBlur:()=>{setFocused(false);setTouched(true);},style:inputStyle})}),showInvalid&&/*#__PURE__*/_jsx(\"div\",{id:errorId,role:\"alert\",style:{color:ERROR,fontSize:12,marginTop:6,fontFamily:fontStackOrFallback(inputFont,FONT_INPUT)},children:errorMessage})]});}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"GSInputText\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}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