{"version":3,"file":"StudioPrompt._KqpB5I3.mjs","names":["useState","useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/oN0LW5r7FuPNMbXiwuon/KCYqj2quGB3xkccjv2C0/StudioPrompt.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useMemo,useRef,useState}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function StudioPrompt(props){const{studioUrl,placeholders,cardColor,fieldColor,textColor,placeholderColor,buttonColor,buttonIconColor,radius,fieldRadius,padding,font,typeSpeed,holdTime}=props;const[value,setValue]=useState(\"\");const[typed,setTyped]=useState(\"\");const inputRef=useRef(null);const promptFont=useMemo(()=>({fontSize:font?.fontSize??\"19px\",lineHeight:font?.lineHeight??1.3,letterSpacing:font?.letterSpacing,fontFamily:font?.fontFamily,fontWeight:font?.fontWeight,fontStyle:font?.fontStyle,textAlign:font?.textAlign}),[font]);// Type the placeholder out and back again, the way the studio itself does,\n// instead of hard-swapping one full sentence for the next. Pauses while the\n// visitor is typing, and stays still for anyone who asked for less motion.\nuseEffect(()=>{const list=(placeholders||[]).filter(Boolean);if(!list.length)return setTyped(\"\");if(value)return;const still=typeof window!==\"undefined\"&&window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;if(still)return setTyped(list[0]);const type=Math.max(10,typeSpeed??45);const erase=Math.max(8,Math.round(type*.55));const hold=Math.max(300,holdTime??1600);let phrase=0;let chars=0;let erasing=false;let timer;function step(){const target=list[phrase%list.length];if(!erasing){chars++;setTyped(target.slice(0,chars));if(chars>=target.length){erasing=true;timer=setTimeout(step,hold);return;}timer=setTimeout(step,type);return;}chars--;setTyped(target.slice(0,Math.max(0,chars)));if(chars<=0){erasing=false;phrase++;timer=setTimeout(step,420);return;}timer=setTimeout(step,erase);}timer=setTimeout(step,600);return()=>clearTimeout(timer);},[placeholders,value,typeSpeed,holdTime]);function submit(){const q=value.trim();if(!q){inputRef.current?.focus();return;}const base=(studioUrl||\"/shop/studio-home\").replace(/\\?.*$/,\"\");window.location.href=`${base}?q=${encodeURIComponent(q.slice(0,200))}`;}return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",background:cardColor,borderRadius:radius,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",padding,boxSizing:\"border-box\",...font},children:/*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",background:fieldColor,borderRadius:fieldRadius,padding:20,boxSizing:\"border-box\",display:\"flex\",flexDirection:\"column\",gap:22},children:[/*#__PURE__*/_jsx(\"input\",{ref:inputRef,value:value,onChange:e=>setValue(e.target.value),onKeyDown:e=>{if(e.key===\"Enter\")submit();},placeholder:typed,\"aria-label\":\"What are we making today?\",style:{border:0,outline:\"none\",background:\"transparent\",color:textColor,width:\"100%\",padding:0,...promptFont}}),/*#__PURE__*/_jsx(\"style\",{children:`.mm-studio-prompt input::placeholder{color:${placeholderColor}}`}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",justifyContent:\"space-between\"},children:[/*#__PURE__*/_jsx(Round,{bg:buttonColor,onClick:()=>inputRef.current?.focus(),label:\"Add artwork\",children:/*#__PURE__*/_jsx(Plus,{color:buttonIconColor})}),/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"center\",gap:14},children:[/*#__PURE__*/_jsx(Mic,{color:buttonIconColor}),/*#__PURE__*/_jsx(Round,{bg:value.trim()?\"#fff\":buttonColor,onClick:submit,label:\"Open Design Studio\",children:/*#__PURE__*/_jsx(Arrow,{color:value.trim()?\"#111\":buttonIconColor})})]})]})]})});}function Round({children,bg,onClick,label}){return /*#__PURE__*/_jsx(\"button\",{onClick:onClick,\"aria-label\":label,style:{width:46,height:46,borderRadius:999,border:0,background:bg,display:\"flex\",alignItems:\"center\",justifyContent:\"center\",cursor:\"pointer\",padding:0},children:children});}const Plus=({color})=>/*#__PURE__*/_jsx(\"svg\",{width:\"18\",height:\"18\",viewBox:\"0 0 18 18\",fill:\"none\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M9 3.5v11M3.5 9h11\",stroke:color,strokeWidth:\"1.6\",strokeLinecap:\"round\"})});const Arrow=({color})=>/*#__PURE__*/_jsx(\"svg\",{width:\"18\",height:\"18\",viewBox:\"0 0 18 18\",fill:\"none\",children:/*#__PURE__*/_jsx(\"path\",{d:\"M9 14.5V3.5M4 8.5 9 3.5l5 5\",stroke:color,strokeWidth:\"1.6\",strokeLinecap:\"round\",strokeLinejoin:\"round\"})});const Mic=({color})=>/*#__PURE__*/_jsxs(\"svg\",{width:\"18\",height:\"18\",viewBox:\"0 0 18 18\",fill:\"none\",children:[/*#__PURE__*/_jsx(\"rect\",{x:\"6.6\",y:\"2.2\",width:\"4.8\",height:\"8.2\",rx:\"2.4\",stroke:color,strokeWidth:\"1.5\"}),/*#__PURE__*/_jsx(\"path\",{d:\"M4 8.6a5 5 0 0 0 10 0M9 13.6V16\",stroke:color,strokeWidth:\"1.5\",strokeLinecap:\"round\"})]});addPropertyControls(StudioPrompt,{studioUrl:{type:ControlType.String,title:\"Studio URL\",defaultValue:\"/shop/studio-home\",description:\"Where the typed text is handed off. The text is added as ?q=\"},placeholders:{type:ControlType.Array,title:\"Placeholders\",control:{type:ControlType.String},defaultValue:[\"Hoodies for the dev team\",\"Laptop stickers for the hackathon\",\"Welcome cards for the new cohort\",\"Swag for the conference booth\",\"Caps for the offsite\"]},cardColor:{type:ControlType.Color,title:\"Card\",defaultValue:\"#000000\"},fieldColor:{type:ControlType.Color,title:\"Field\",defaultValue:\"#1F1F1F\"},textColor:{type:ControlType.Color,title:\"Text\",defaultValue:\"#FFFFFF\"},placeholderColor:{type:ControlType.Color,title:\"Placeholder\",defaultValue:\"#8A8A8A\"},typeSpeed:{type:ControlType.Number,title:\"Type speed\",description:\"Milliseconds per character.\",defaultValue:45,min:10,max:160,step:5},holdTime:{type:ControlType.Number,title:\"Hold\",description:\"Milliseconds the finished sentence stays before it is erased.\",defaultValue:1600,min:300,max:6e3,step:100},buttonColor:{type:ControlType.Color,title:\"Button\",defaultValue:\"#2E2E2E\"},buttonIconColor:{type:ControlType.Color,title:\"Button icon\",defaultValue:\"#FFFFFF\"},radius:{type:ControlType.Number,title:\"Card radius\",defaultValue:20,min:0,max:80},fieldRadius:{type:ControlType.Number,title:\"Field radius\",defaultValue:22,min:0,max:80},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:28,min:0,max:120},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"19px\",variant:\"Regular\",letterSpacing:\"0em\",lineHeight:\"1.3em\",textAlign:\"left\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"StudioPrompt\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./StudioPrompt.map"],"mappings":"gNAAkK,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,YAAU,eAAa,YAAU,aAAW,YAAU,mBAAiB,cAAY,kBAAgB,SAAO,cAAY,UAAQ,OAAK,YAAU,YAAU,EAAW,CAAC,EAAM,GAAUA,EAAS,EAAE,EAAO,CAAC,EAAM,GAAUA,EAAS,EAAE,EAAQ,EAASC,EAAO,IAAI,EAAQ,EAAWC,OAAa,CAAC,SAAS,GAAM,UAAU,OAAO,WAAW,GAAM,YAAY,IAAI,cAAc,GAAM,cAAc,WAAW,GAAM,WAAW,WAAW,GAAM,WAAW,UAAU,GAAM,UAAU,UAAU,GAAM,SAAS,GAAG,CAAC,CAAI,CAAC,EAGzsB,MAAc,CAAC,IAAM,GAAM,GAAc,CAAC,EAAA,CAAG,OAAO,OAAO,EAAE,GAAG,CAAC,EAAK,OAAO,OAAO,EAAS,EAAE,EAAE,GAAG,EAAM,OAAgH,GAAtF,IAAS,QAAa,EAAO,aAAa,kCAAkC,CAAC,CAAC,QAAiB,OAAO,EAAS,EAAK,EAAE,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