{"version":3,"file":"TrackSearch.DfRayeBu.mjs","names":["React.useState","React.useRef","React.useId","__esmMin","window","init_npm_react_18_3_1","init_ssg_sandbox_shims","de","ie","init_jsx_runtime","p","ce","_e","addPropertyControls","init_framer_D1IzEvwH","ControlType","RenderTarget","readRef","PackageIcon","size","color","TrackSearch","props","isCanvas","value","setValue","error","setError","focus","setFocus","inputRef","formRef","narrow","setNarrow","inline","buttonPlacement","el","ro","id","prefill","r","onPop","submit","ref","base","trackPage","target","TRACK_EVENT","btnPad","fontSize","style","background","radius","borderColor","buttonColor","fontName","placeholderColor","buttonText","iconColor","textColor","buttonLabel","errorText","init_TrackSearch"],"sources":["https:/framerusercontent.com/modules/tj2jZU9rVshzDue6p8Ul/JvtJM88iVHPG74Vvmara/TrackSearch.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";/**\n * Track Search\n * A tracking-number field with a Track button. On submit it opens the tracking\n * page with the number in the address (e.g. /track?ref=MRD-7K2M9QXD).\n * On the tracking page itself it updates the result without reloading.\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export const TRACK_EVENT=\"meridian:track\";function readRef(){if(typeof window===\"undefined\")return\"\";try{const p=new URLSearchParams(window.location.search);return(p.get(\"ref\")||p.get(\"tracking\")||p.get(\"id\")||\"\").trim();}catch{return\"\";}}function PackageIcon({color,size}){return /*#__PURE__*/_jsxs(\"svg\",{width:size,height:size,viewBox:\"0 0 24 24\",fill:\"none\",stroke:color,strokeWidth:\"1.8\",strokeLinecap:\"round\",strokeLinejoin:\"round\",\"aria-hidden\":\"true\",children:[/*#__PURE__*/_jsx(\"path\",{d:\"M16.5 9.4 7.5 4.2\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4a2 2 0 0 0 1-1.7z\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M3.3 7 12 12l8.7-5\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M12 22V12\"})]});}export default function TrackSearch(props){const{placeholder,buttonLabel,buttonPlacement,trackPage,background,textColor,placeholderColor,iconColor,buttonColor,buttonText,borderColor,radius,fontSize,prefill,errorText,fontName,style}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[value,setValue]=React.useState(\"\");const[error,setError]=React.useState(false);const[focus,setFocus]=React.useState(false);const inputRef=React.useRef(null);const formRef=React.useRef(null);const[narrow,setNarrow]=React.useState(false);const inline=buttonPlacement===\"beside\"||!narrow;React.useEffect(()=>{const el=formRef.current;if(!el||typeof ResizeObserver===\"undefined\")return;const ro=new ResizeObserver(()=>setNarrow(el.getBoundingClientRect().width<520));ro.observe(el);return()=>ro.disconnect();},[]);const id=React.useId();React.useEffect(()=>{if(!prefill||isCanvas)return;const r=readRef();if(r)setValue(r.toUpperCase());const onPop=()=>setValue(readRef().toUpperCase());window.addEventListener(\"popstate\",onPop);return()=>window.removeEventListener(\"popstate\",onPop);},[prefill,isCanvas]);const submit=e=>{e?.preventDefault();const ref=value.trim().toUpperCase().replace(/\\s+/g,\"\");if(!ref){setError(true);inputRef.current?.focus();return;}setError(false);if(isCanvas||typeof window===\"undefined\")return;const base=String(trackPage||\"/track\").split(\"?\")[0]||\"/track\";const target=new URL(base,window.location.href);target.searchParams.set(\"ref\",ref);const samePage=target.pathname.replace(/\\/$/,\"\")===window.location.pathname.replace(/\\/$/,\"\");if(samePage){window.history.pushState({},\"\",target.pathname+target.search);window.dispatchEvent(new CustomEvent(TRACK_EVENT,{detail:ref}));}else{window.location.href=target.pathname+target.search;}};const rowH=57;const btnPad=Math.round((fontSize||16)*1.25);return /*#__PURE__*/_jsxs(\"form\",{ref:formRef,onSubmit:submit,role:\"search\",style:{...style,position:\"relative\",width:\"100%\",minHeight:rowH,display:\"flex\",flexDirection:inline?\"row\":\"column\",gap:inline?0:12,alignItems:\"stretch\",background:inline?background:\"transparent\",borderRadius:radius,overflow:\"visible\",boxShadow:inline?borderColor?`inset 0 0 0 1px ${error?\"#E5484D\":focus?buttonColor:borderColor}`:error?\"inset 0 0 0 1px #E5484D\":undefined:undefined,transition:\"box-shadow .2s ease\",boxSizing:\"border-box\",fontFamily:fontName?`\"${fontName}\", sans-serif`:\"inherit\"},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                .ts-input::placeholder { color: ${placeholderColor}; opacity: 1; }\n                .ts-btn:hover .ts-sq { transform: rotate(90deg); }\n                .ts-btn:focus-visible { outline: 2px solid ${buttonText}; outline-offset: -5px; }\n                @keyframes ts-shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-4px) } 75% { transform: translateX(4px) } }\n            `}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"stretch\",flex:1,minWidth:0,minHeight:rowH,background:inline?\"transparent\":background,borderRadius:inline?0:radius,boxShadow:!inline&&borderColor?`inset 0 0 0 1px ${error?\"#E5484D\":focus?buttonColor:borderColor}`:!inline&&error?\"inset 0 0 0 1px #E5484D\":undefined},children:[/*#__PURE__*/_jsxs(\"label\",{htmlFor:id,style:{display:\"flex\",alignItems:\"center\",paddingLeft:20,paddingRight:12,cursor:\"text\"},children:[/*#__PURE__*/_jsx(PackageIcon,{color:iconColor,size:20}),/*#__PURE__*/_jsx(\"span\",{style:{position:\"absolute\",width:1,height:1,overflow:\"hidden\",clip:\"rect(0 0 0 0)\"},children:\"Tracking number\"})]}),/*#__PURE__*/_jsx(\"input\",{ref:inputRef,id:id,className:\"ts-input\",type:\"text\",inputMode:\"text\",autoComplete:\"off\",autoCapitalize:\"characters\",spellCheck:false,value:value,placeholder:placeholder,\"aria-invalid\":error,onFocus:()=>setFocus(true),onBlur:()=>setFocus(false),onChange:e=>{setValue(e.target.value);if(error)setError(false);},style:{flex:1,minWidth:0,border:\"none\",outline:\"none\",background:\"transparent\",color:textColor,fontSize,fontFamily:\"inherit\",letterSpacing:value?\"0.04em\":0,padding:0,animation:error?\"ts-shake .3s ease\":undefined}})]}),/*#__PURE__*/_jsxs(\"button\",{type:\"submit\",className:\"ts-btn\",style:{flex:\"0 0 auto\",display:\"flex\",alignItems:\"center\",justifyContent:inline?undefined:\"center\",width:inline?undefined:\"100%\",minHeight:rowH,gap:12,padding:`0 ${btnPad}px`,border:\"none\",background:buttonColor,color:buttonText,fontSize,fontFamily:\"inherit\",cursor:\"pointer\",borderTopRightRadius:inline?radius:radius,borderBottomRightRadius:inline?radius:radius,...inline?null:{borderTopLeftRadius:radius,borderBottomLeftRadius:radius}},children:[buttonLabel,/*#__PURE__*/_jsx(\"span\",{className:\"ts-sq\",\"aria-hidden\":\"true\",style:{width:11,height:11,background:buttonText,transition:\"transform .3s ease\",display:\"block\"}})]}),error&&errorText?/*#__PURE__*/_jsx(\"span\",{role:\"alert\",style:{position:\"absolute\",left:0,top:\"calc(100% + 8px)\",fontSize:13,color:\"#FF8A8A\",whiteSpace:\"nowrap\"},children:errorText}):null]});}TrackSearch.defaultProps={placeholder:\"Enter tracking number, e.g. MRD-7K2M9QXD\",buttonLabel:\"Track\",buttonPlacement:\"responsive\",trackPage:\"/track\",background:\"#FFFFFF\",textColor:\"#111111\",placeholderColor:\"#6B6B6B\",iconColor:\"#111111\",buttonColor:\"#000000\",buttonText:\"#FFFFFF\",radius:0,fontSize:16,prefill:true,errorText:\"Enter your tracking number first.\",fontName:\"Geist\",width:560,height:57};addPropertyControls(TrackSearch,{placeholder:{type:ControlType.String,title:\"Placeholder\"},buttonPlacement:{type:ControlType.Enum,title:\"Button Placement\",options:[\"responsive\",\"beside\"],optionTitles:[\"Responsive (current)\",\"Beside input\"]},buttonLabel:{type:ControlType.String,title:\"Button\"},errorText:{type:ControlType.String,title:\"Empty Error\"},trackPage:{type:ControlType.Link,title:\"Tracking Page\"},prefill:{type:ControlType.Boolean,title:\"Fill From URL\",description:\"Shows the number from the address bar. Turn on for the tracking page.\"},fontSize:{type:ControlType.Number,title:\"Font Size\",min:12,max:24,step:1},fontName:{type:ControlType.String,title:\"Font Name\",placeholder:\"Geist\"},radius:{type:ControlType.Number,title:\"Radius\",min:0,max:40},background:{type:ControlType.Color,title:\"Background\"},textColor:{type:ControlType.Color,title:\"Text\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder Color\"},iconColor:{type:ControlType.Color,title:\"Icon\"},borderColor:{type:ControlType.Color,title:\"Border\",optional:true},buttonColor:{type:ControlType.Color,title:\"Button Fill\"},buttonText:{type:ControlType.Color,title:\"Button Text\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"TRACK_EVENT\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"TrackSearch\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TrackSearch.map"],"mappings":"A,uNAQ6C,SAASiB,GAAS,CAAC,GAAUb,IAAS,OAAY,MAAM,GAAG,GAAG,CAAC,IAAMM,EAAE,IAAI,gBAAgBN,EAAO,SAAS,MAAM,EAAE,OAAOM,EAAE,IAAI,KAAK,GAAGA,EAAE,IAAI,UAAU,GAAGA,EAAE,IAAI,IAAI,GAAG,GAAA,CAAI,KAAK,CAAE,MAAM,CAAC,MAAM,EAAG,CAAC,CAAC,SAASQ,EAAY,CAAC,QAAM,QAAM,CAAC,MAAoB,gBAAM,MAAM,CAAC,MAAMC,EAAK,OAAOA,EAAK,QAAQ,YAAY,KAAK,OAAO,OAAOC,EAAM,YAAY,MAAM,cAAc,QAAQ,eAAe,QAAQ,cAAc,OAAO,SAAS,CAAc,gBAAK,OAAO,CAAC,EAAE,mBAAmB,CAAC,EAAe,gBAAK,OAAO,CAAC,EAA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