{"version":3,"file":"WeekStrip.BdYIbtPI.mjs","names":["React.useState"],"sources":["https:/framerusercontent.com/modules/8ymBaiNsQ8MYyv0zL0DM/eFDnJXVWCcp3vGTrCWBV/WeekStrip.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import*as React from\"react\";import{parseWeekStrip}from\"https://framerusercontent.com/modules/bcyNtnYYo6FJbJRLWJUB/nxDcRHMz59Q1u0vhxqee/Lib.js\";const EASE=\"cubic-bezier(0.44, 0, 0.56, 1)\";const FONT=\"Satoshi, ui-sans-serif, system-ui, sans-serif\";const FALLBACK_WEEK=\"Lower \\xb7 Upper \\xb7 Rest \\xb7 Lower \\xb7 Upper \\xb7 Rest \\xb7 Rest\";const DAY_NAMES=[\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\",\"Sunday\"];const DAY_LETTERS=[\"M\",\"T\",\"W\",\"T\",\"F\",\"S\",\"S\"];const REST_WORDS=[\"rest\",\"off\",\"rest day\",\"day off\",\"—\",\"–\",\"-\"];/** The gap ladder is fixed, so the control snaps rather than free-runs. */const GAP_LADDER=[8,12,16,24,32,64];const SR_ONLY={position:\"absolute\",width:1,height:1,margin:-1,padding:0,overflow:\"hidden\",clipPath:\"inset(50%)\",whiteSpace:\"nowrap\"};/**\n * An empty CMS number binding arrives as null or \"\", and Number() turns both into 0.\n * Left alone that would clamp Active to Monday on every unset field, so anything\n * that is not a real number falls back rather than reading as zero.\n */function toNumber(value){if(value===null||value===undefined||value===\"\")return NaN;const parsed=Number(value);return Number.isFinite(parsed)?parsed:NaN;}function clampNumber(value,low,high,fallback){const parsed=toNumber(value);if(Number.isNaN(parsed))return fallback;return Math.min(high,Math.max(low,Math.round(parsed)));}function snapGap(value){const parsed=toNumber(value);if(Number.isNaN(parsed))return 24;let best=GAP_LADDER[0];for(const step of GAP_LADDER){// <= so a tie resolves upward: nudging past 16 lands on 24, not back on 16.\nif(Math.abs(step-parsed)<=Math.abs(best-parsed))best=step;}return best;}/**\n * Seven labels, always. Lib pads short input and trims long input, but it returns\n * an empty array for text with no fields at all, so the shape is re-checked here\n * and every slot is guaranteed a non-empty string before it reaches the day names.\n */function toSevenDays(text){let parsed=[];try{const result=parseWeekStrip(text);if(Array.isArray(result))parsed=result;}catch(error){parsed=[];}const days=[];for(let index=0;index<7;index+=1){const value=String(parsed[index]==null?\"\":parsed[index]).trim();days.push(value||\"Rest\");}return days;}/** Rest days are typographically quieter in the label only — never in the chip. */function isRestLabel(label){const value=String(label||\"\").trim().toLowerCase();return value===\"\"||REST_WORDS.indexOf(value)!==-1;}/** \"0 · 1\" (also \"0,1\" or \"0 1\") -> { 0: true, 1: true } */function parseCompleted(text){const found=String(text||\"\").match(/\\d+/g)||[];const map={};for(const token of found){const index=Number(token);if(index>=0&&index<=6)map[index]=true;}return map;}/**\n * Setpoint — WeekStrip.\n *\n * The seven-chip weekday row. One sample week on a programme page, this week on\n * /train, one row per week on /train/program.\n *\n * The device reads premium because every chip is identical: same raised fill, same\n * 1px hairline ring, no numbers, no badges, and the chip of a rest day is built\n * exactly like the chip of a training day — only its label sits in muted ink. Two\n * things ever change: the active day’s ring turns accent, and a completed day gets\n * one small accent dot under its label.\n *\n * Purely presentational — every piece of state arrives as a prop. The one effect\n * reads the reduced-motion preference and changes durations only, so the node\n * count is identical before and after hydration.\n *\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight auto\n */export default function WeekStrip(props){const{weekStrip=FALLBACK_WEEK,activeDay=-1,showDayLetters=true,chipSize=40,chipGap=24,labelMode=\"under\",completedDays=\"\",page=\"#0A0A0A\",raised=\"#0D0D0D\",hairline=\"rgba(255,255,255,0.1)\",ink=\"#F5F5F8\",inkMuted=\"#ABABAB\",accent=\"rgb(146, 232, 42)\",style}=props;const[reduceMotion,setReduceMotion]=React.useState(false);React.useEffect(()=>{if(typeof window===\"undefined\"||!window.matchMedia)return;const query=window.matchMedia(\"(prefers-reduced-motion: reduce)\");const apply=()=>setReduceMotion(query.matches);apply();if(query.addEventListener){query.addEventListener(\"change\",apply);return()=>query.removeEventListener(\"change\",apply);}query.addListener(apply);return()=>query.removeListener(apply);},[]);const raw=String(weekStrip==null?\"\":weekStrip);const source=raw.trim()?raw:FALLBACK_WEEK;const days=toSevenDays(source);const completed=parseCompleted(completedDays);const activeIndex=clampNumber(activeDay,-1,6,-1);const size=clampNumber(chipSize,24,96,40);const gap=snapGap(chipGap);const mode=labelMode===\"inside\"||labelMode===\"none\"?labelMode:\"under\";const under=mode===\"under\";const motion=reduceMotion?\"0.01s\":\"0.3s\";// Flexbox decides a line break on the base size, so the base is the chip itself and\n// the row only wraps when seven chips genuinely cannot fit. Cells then grow to fill\n// the width and stop at cellMax, so a wide container stays a strip, not a scatter.\n// On a Phone breakpoint, tighten Chip and Gap to keep the week on one line.\nconst cellMax=under?Math.max(size,128):size;const cellBase=under?{flex:`1 1 ${size}px`,minWidth:size,maxWidth:cellMax}:mode===\"inside\"?{flex:\"0 0 auto\",width:\"auto\"}:{flex:\"0 0 auto\",width:size};// The item is the positioning context for its own screen-reader text.\nconst cellStyle={...cellBase,position:\"relative\"};const columnStyle={display:\"flex\",flexDirection:\"column\",alignItems:\"center\",gap:8,width:\"100%\"};const labelStyle={display:\"block\",width:\"100%\",textAlign:\"center\",fontFamily:FONT,fontWeight:500,fontSize:10,lineHeight:1.4,letterSpacing:\"-0.02em\",whiteSpace:\"nowrap\",overflow:\"hidden\",textOverflow:\"ellipsis\"};const letterStyle={fontFamily:FONT,fontWeight:500,fontSize:12,lineHeight:1,letterSpacing:\"-0.02em\",color:ink};return /*#__PURE__*/_jsx(\"ul\",{role:\"list\",\"aria-label\":\"Training week\",style:{listStyle:\"none\",margin:0,padding:16,boxSizing:\"border-box\",width:\"100%\",display:\"flex\",flexWrap:\"wrap\",alignItems:\"flex-start\",justifyContent:\"center\",columnGap:gap,rowGap:16,background:page,borderRadius:12,fontFamily:FONT,fontWeight:500,fontVariantNumeric:\"tabular-nums\",...style},children:days.map((label,index)=>{const rest=isRestLabel(label);const done=Boolean(completed[index]);const isActive=index===activeIndex;const name=`${DAY_NAMES[index]}, ${label}${done?\", completed\":\"\"}`;const chipStyle=mode===\"inside\"?{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:8,height:size,minWidth:size,padding:`0 ${Math.round(size*.45)}px`,boxSizing:\"border-box\",borderRadius:999,background:raised,boxShadow:`0 0 0 1px ${isActive?accent:hairline}`,transition:`box-shadow ${motion} ${EASE}`}:{display:\"flex\",alignItems:\"center\",justifyContent:\"center\",flex:\"0 0 auto\",width:size,height:size,boxSizing:\"border-box\",borderRadius:999,background:raised,boxShadow:`0 0 0 1px ${isActive?accent:hairline}`,transition:`box-shadow ${motion} ${EASE}`};return /*#__PURE__*/_jsxs(\"li\",{\"aria-current\":isActive?\"date\":undefined,style:cellStyle,children:[/*#__PURE__*/_jsx(\"span\",{style:SR_ONLY,children:name}),/*#__PURE__*/_jsxs(\"div\",{\"aria-hidden\":\"true\",style:columnStyle,children:[/*#__PURE__*/_jsxs(\"div\",{style:chipStyle,children:[showDayLetters?/*#__PURE__*/_jsx(\"span\",{style:letterStyle,children:DAY_LETTERS[index]}):null,mode===\"inside\"?/*#__PURE__*/_jsx(\"span\",{style:{...labelStyle,width:\"auto\",maxWidth:96,color:rest?inkMuted:ink},children:label}):null]}),under?/*#__PURE__*/_jsx(\"span\",{style:{...labelStyle,color:rest?inkMuted:ink},children:label}):null,/*#__PURE__*/_jsx(\"span\",{style:{width:4,height:4,borderRadius:999,background:accent,opacity:done?1:0,transition:`opacity ${motion} ${EASE}`}})]})]},`${index}-${label}`);})});}addPropertyControls(WeekStrip,{weekStrip:{type:ControlType.String,title:\"Week\",defaultValue:FALLBACK_WEEK,placeholder:FALLBACK_WEEK,description:\"Seven session labels separated by a middle dot. Bind to the program’s Week Strip field.\"},activeDay:{type:ControlType.Number,title:\"Active\",defaultValue:-1,min:-1,max:6,step:1,displayStepper:true,description:\"0 is Monday, 6 is Sunday. Use −1 for a sample week with no active day.\"},completedDays:{type:ControlType.String,title:\"Completed\",defaultValue:\"\",placeholder:\"0 \\xb7 1\",description:\"Day numbers already logged, separated by a middle dot.\"},showDayLetters:{type:ControlType.Boolean,title:\"Letters\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},labelMode:{type:ControlType.Enum,title:\"Labels\",defaultValue:\"under\",options:[\"under\",\"inside\",\"none\"],optionTitles:[\"Under\",\"Inside\",\"None\"],displaySegmentedControl:true},chipSize:{type:ControlType.Number,title:\"Chip\",defaultValue:40,min:24,max:96,step:2,displayStepper:true},chipGap:{type:ControlType.Number,title:\"Gap\",defaultValue:24,min:8,max:64,step:4,displayStepper:true,description:\"Snaps to the 8 \\xb7 12 \\xb7 16 \\xb7 24 \\xb7 32 \\xb7 64 ladder.\"},page:{type:ControlType.Color,title:\"Page\",defaultValue:\"#0A0A0A\",description:\"Strip background. Set the alpha to zero to sit bare on a card.\"},raised:{type:ControlType.Color,title:\"Raised\",defaultValue:\"#0D0D0D\"},hairline:{type:ControlType.Color,title:\"Hairline\",defaultValue:\"rgba(255,255,255,0.1)\"},ink:{type:ControlType.Color,title:\"Ink\",defaultValue:\"#F5F5F8\"},inkMuted:{type:ControlType.Color,title:\"Ink Muted\",defaultValue:\"#ABABAB\"},accent:{type:ControlType.Color,title:\"Accent\",defaultValue:\"rgb(146, 232, 42)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WeekStrip\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WeekStrip.map"],"mappings":"oPAIG,SAAS,EAAS,EAAM,CAAC,GAAG,GAAQ,MAAyB,IAAQ,GAAG,MAAO,KAAI,IAAM,EAAO,OAAO,CAAK,EAAE,OA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