{"version":3,"file":"TradeChips.DbPReeAF.mjs","names":["useState"],"sources":["https:/framerusercontent.com/modules/kmRE2w7KDzcLukv1sIBs/q5cFl6fh16fmA7ApPCZx/TradeChips.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{startTransition,useState}from\"react\";const FONT_STACK='Inter, \"Inter Placeholder\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif';const DEFAULT_CHIPS=[{label:\"Electrician\",line:\"Built for one-person sparky outfits — quote the job before you’re out of the loft.\"},{label:\"Plumber\",line:\"Boiler swap or full bathroom — price it at the kitchen table, send it before the kettle’s boiled.\"},{label:\"Builder\",line:\"Extensions, garden walls, snag lists — one app for the quote, the booking and the invoice.\"},{label:\"HVAC\",line:\"Service, install or call-out — quote it on the doorstep and book the return visit there and then.\"},{label:\"Landscaper\",line:\"Price the patio from the garden, invoice from the van, book the next job before the mower’s loaded.\"},{label:\"Other trade\",line:\"Whatever the trade, the job’s the same — quote it, book it, invoice it, get paid.\"}];function normaliseDefaultSelected(value){if(typeof value!==\"number\"||!Number.isFinite(value))return null;const index=Math.floor(value);return index>=0?index:null;}/**\n * TradeChips — trade self-selection pill chips for the /lp pages.\n *\n * Tapping a chip highlights it amber and swaps one personalised line below.\n * Pure client-side state; no forms, no data capture. Server-side render shows\n * the unselected state with a neutral line, unless `defaultSelectedIndex` is\n * set to 0 or higher — then that chip starts selected and its line is shown.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function TradeChips(props){const{chips=DEFAULT_CHIPS,neutralLine=\"Whatever your trade — quotes, invoices and bookings in one app.\",alignment=\"center\",accentColor=\"#F59E0B\",chipTextColor=\"#CFE0EC\",chipBgColor=\"rgba(255, 255, 255, 0.06)\",chipBorderColor=\"rgba(255, 255, 255, 0.18)\",lineColor=\"#AEBAC4\",defaultSelectedIndex=-1,style}=props;const initialSelected=normaliseDefaultSelected(defaultSelectedIndex);const[selected,setSelected]=useState(initialSelected);const[lastDefault,setLastDefault]=useState(defaultSelectedIndex);// Re-sync when the property control changes on the canvas.\nif(lastDefault!==defaultSelectedIndex){setLastDefault(defaultSelectedIndex);setSelected(initialSelected);}const handleSelect=index=>{startTransition(()=>{setSelected(current=>current===index?null:index);});};const justify=alignment===\"start\"?\"flex-start\":\"center\";const activeLine=selected!==null&&chips[selected]?chips[selected].line:neutralLine;return /*#__PURE__*/_jsxs(\"div\",{style:{...style,position:\"relative\",display:\"flex\",flexDirection:\"column\",alignItems:alignment===\"start\"?\"flex-start\":\"center\",gap:12,width:\"100%\",fontFamily:FONT_STACK},children:[/*#__PURE__*/_jsx(\"div\",{role:\"group\",\"aria-label\":\"Pick your trade\",style:{display:\"flex\",flexWrap:\"wrap\",justifyContent:justify,gap:8,width:\"100%\"},children:chips.map((chip,index)=>{const isSelected=selected===index;return /*#__PURE__*/_jsx(\"button\",{type:\"button\",\"aria-pressed\":isSelected,onClick:()=>handleSelect(index),style:{appearance:\"none\",margin:0,padding:\"8px 16px\",borderRadius:9999,border:isSelected?`1px solid ${accentColor}`:`1px solid ${chipBorderColor}`,background:isSelected?accentColor:chipBgColor,color:isSelected?\"#081E2B\":chipTextColor,fontFamily:FONT_STACK,fontSize:14,fontWeight:600,lineHeight:\"20px\",cursor:\"pointer\",transition:\"background 0.18s ease, color 0.18s ease, border-color 0.18s ease\",whiteSpace:\"nowrap\"},children:chip.label},`${chip.label}-${index}`);})}),/*#__PURE__*/_jsx(\"p\",{\"aria-live\":\"polite\",style:{margin:0,fontSize:15,lineHeight:\"22px\",fontWeight:400,color:lineColor,textAlign:alignment===\"start\"?\"left\":\"center\",maxWidth:560,minHeight:44},children:activeLine})]});}addPropertyControls(TradeChips,{chips:{type:ControlType.Array,title:\"Chips\",maxCount:8,control:{type:ControlType.Object,controls:{label:{type:ControlType.String,defaultValue:\"Electrician\"},line:{type:ControlType.String,displayTextArea:true,defaultValue:\"Built for one-person sparky outfits — quote the job before you’re out of the loft.\"}}},defaultValue:DEFAULT_CHIPS},neutralLine:{type:ControlType.String,title:\"Neutral Line\",displayTextArea:true,defaultValue:\"Whatever your trade — quotes, invoices and bookings in one app.\"},alignment:{type:ControlType.Enum,title:\"Alignment\",options:[\"center\",\"start\"],optionTitles:[\"Center\",\"Start\"],defaultValue:\"center\",displaySegmentedControl:true},accentColor:{type:ControlType.Color,title:\"Accent\",defaultValue:\"#F59E0B\"},chipTextColor:{type:ControlType.Color,title:\"Chip Text\",defaultValue:\"#CFE0EC\"},chipBgColor:{type:ControlType.Color,title:\"Chip BG\",defaultValue:\"rgba(255, 255, 255, 0.06)\"},chipBorderColor:{type:ControlType.Color,title:\"Chip Border\",defaultValue:\"rgba(255, 255, 255, 0.18)\"},lineColor:{type:ControlType.Color,title:\"Line Text\",defaultValue:\"#AEBAC4\"},defaultSelectedIndex:{type:ControlType.Number,title:\"Preselect\",description:\"Index of the chip to start selected. -1 = nothing selected (default).\",min:-1,max:7,step:1,displayStepper:true,defaultValue:-1}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TradeChips\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TradeChips.map"],"mappings":"wLAA89B,SAAS,EAAyB,EAAM,CAAC,GAAG,OAAO,GAAQ,UAAU,CAAC,OAAO,SAAS,CAAK,EAAE,OAAO,KAAK,IAAM,EAAM,KAAK,MAAM,CAAK,EAAE,OAAO,GAAO,EAAE,EAAM,IAAK,CAU7nC,SAAwB,EAAW,EAAM,CAAC,GAAK,CAAC,QAAM,EAAc,cAAY,kEAAkE,YAAU,SAAS,cAAY,UAAU,gBAAc,UAAU,cAAY,4BAA4B,kBAAgB,4BAA4B,YAAU,UAAU,uBAAqB,GAAG,SAAO,EAAY,EAAgB,EAAyB,CA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