{"version":3,"file":"SingleSelectionQuiz.C-RbxpcQ.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/qAdtsGiXGKUXYZqWnpqR/x5r2Pwx7QJPrkSh9XHaY/SingleSelectionQuiz.js"],"sourcesContent":["// Single selection quiz component with configurable text alignment and number of options\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useState,startTransition,useMemo}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * Single Selection Quiz Component\n *\n * @framerIntrinsicWidth 600\n * @framerIntrinsicHeight 400\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function SingleSelectionQuiz(props){const{a1Label,a1Score,a1Link,a2Label,a2Score,a2Link,a3Label,a3Score,a3Link,a4Label,a4Score,a4Link,a5Label,a5Score,a5Link,a6Label,a6Score,a6Link,a7Label,a7Score,a7Link,a8Label,a8Score,a8Link,textAlign=\"left\",backgroundColor=\"#FFFFFF\",selectedColor=\"#F0F0F0\",textColor=\"#000000\",font,borderRadius=24,gap=16,useSingleLink=false,singleLink=\"\",onSelectionChange}=props;const[selectedIndex,setSelectedIndex]=useState(null);const[isAnimating,setIsAnimating]=useState(false);const[flashingIndex,setFlashingIndex]=useState(null);// Build options array from CMS fields\nconst options=useMemo(()=>{const cmsOptions=[{label:a1Label,scoreValue:a1Score,link:a1Link},{label:a2Label,scoreValue:a2Score,link:a2Link},{label:a3Label,scoreValue:a3Score,link:a3Link},{label:a4Label,scoreValue:a4Score,link:a4Link},{label:a5Label,scoreValue:a5Score,link:a5Link},{label:a6Label,scoreValue:a6Score,link:a6Link},{label:a7Label,scoreValue:a7Score,link:a7Link},{label:a8Label,scoreValue:a8Score,link:a8Link}];return cmsOptions.filter(option=>option&&option.label&&option.label.trim()!==\"\");},[a1Label,a1Score,a1Link,a2Label,a2Score,a2Link,a3Label,a3Score,a3Link,a4Label,a4Score,a4Link,a5Label,a5Score,a5Link,a6Label,a6Score,a6Link,a7Label,a7Score,a7Link,a8Label,a8Score,a8Link]);const handleSelect=index=>{startTransition(()=>{setSelectedIndex(index);setFlashingIndex(index);setIsAnimating(true);if(onSelectionChange){onSelectionChange(index);}// Navigate after flash animation\nsetTimeout(()=>{if(typeof window!==\"undefined\"){const selectedOption=options[index];// Navigate to link with updated score parameter\nconst linkToUse=useSingleLink?singleLink:selectedOption?.link;if(linkToUse){// Add score to the link URL\nif(selectedOption?.scoreValue!==undefined){const currentUrl=new URL(window.location.href);const currentScore=parseInt(currentUrl.searchParams.get(\"score\")||\"0\",10);const newScore=currentScore+selectedOption.scoreValue;const targetUrl=new URL(linkToUse,window.location.origin);targetUrl.searchParams.set(\"score\",newScore.toString());window.open(targetUrl.toString(),\"_self\");}else{window.open(linkToUse,\"_self\");}}else if(selectedOption?.scoreValue!==undefined){// No link, just update current URL\nconst url=new URL(window.location.href);const currentScore=parseInt(url.searchParams.get(\"score\")||\"0\",10);const newScore=currentScore+selectedOption.scoreValue;url.searchParams.set(\"score\",newScore.toString());window.history.replaceState({},\"\",url.toString());}}},600)// Wait for flash animation to complete\n;});};return /*#__PURE__*/_jsxs(\"div\",{style:{width:\"100%\",height:\"100%\",display:\"flex\",flexDirection:\"column\",gap:`${gap}px`,padding:\"20px\",boxSizing:\"border-box\"},children:[options.map((option,index)=>{const isSelected=selectedIndex===index;const isFlashing=flashingIndex===index;return /*#__PURE__*/_jsx(\"button\",{onClick:()=>!isAnimating&&handleSelect(index),style:{width:\"100%\",backgroundColor:isSelected?selectedColor:backgroundColor,border:\"none\",borderRadius:`${borderRadius}px`,padding:\"24px 32px\",display:\"flex\",alignItems:\"center\",justifyContent:textAlign===\"center\"?\"center\":textAlign===\"right\"?\"flex-end\":\"flex-start\",cursor:isAnimating?\"default\":\"pointer\",transition:\"all 0.2s ease\",boxShadow:isSelected?\"0 4px 12px rgba(0, 0, 0, 0.08)\":\"0 2px 8px rgba(0, 0, 0, 0.04)\",position:\"relative\",opacity:isFlashing?.5:1,transform:isFlashing?\"scale(0.98)\":\"scale(1)\",animation:isFlashing?\"flash 0.6s ease-in-out\":\"none\"},onMouseEnter:e=>{if(!isSelected&&!isAnimating){e.currentTarget.style.backgroundColor=\"#FAFAFA\";}},onMouseLeave:e=>{if(!isSelected&&!isAnimating){e.currentTarget.style.backgroundColor=backgroundColor;}},children:/*#__PURE__*/_jsx(\"span\",{style:{color:textColor,...font,margin:0},children:option.label})},index);}),/*#__PURE__*/_jsx(\"style\",{children:`\n                @keyframes flash {\n                    0%, 100% { opacity: 1; transform: scale(1); }\n                    50% { opacity: 0.6; transform: scale(0.98); }\n                }\n            `})]});}addPropertyControls(SingleSelectionQuiz,{a1Label:{type:ControlType.String,title:\"Option 1 Label\",defaultValue:\"Lose weight\"},a1Score:{type:ControlType.Number,title:\"Option 1 Score\",defaultValue:1,step:1},a1Link:{type:ControlType.Link,title:\"Option 1 Link\"},a2Label:{type:ControlType.String,title:\"Option 2 Label\",defaultValue:\"Maintain weight\"},a2Score:{type:ControlType.Number,title:\"Option 2 Score\",defaultValue:2,step:1},a2Link:{type:ControlType.Link,title:\"Option 2 Link\"},a3Label:{type:ControlType.String,title:\"Option 3 Label\",defaultValue:\"Gain weight\"},a3Score:{type:ControlType.Number,title:\"Option 3 Score\",defaultValue:3,step:1},a3Link:{type:ControlType.Link,title:\"Option 3 Link\"},a4Label:{type:ControlType.String,title:\"Option 4 Label\",defaultValue:\"\"},a4Score:{type:ControlType.Number,title:\"Option 4 Score\",defaultValue:4,step:1},a4Link:{type:ControlType.Link,title:\"Option 4 Link\"},a5Label:{type:ControlType.String,title:\"Option 5 Label\",defaultValue:\"\"},a5Score:{type:ControlType.Number,title:\"Option 5 Score\",defaultValue:5,step:1},a5Link:{type:ControlType.Link,title:\"Option 5 Link\"},a6Label:{type:ControlType.String,title:\"Option 6 Label\",defaultValue:\"\"},a6Score:{type:ControlType.Number,title:\"Option 6 Score\",defaultValue:6,step:1},a6Link:{type:ControlType.Link,title:\"Option 6 Link\"},a7Label:{type:ControlType.String,title:\"Option 7 Label\",defaultValue:\"\"},a7Score:{type:ControlType.Number,title:\"Option 7 Score\",defaultValue:7,step:1},a7Link:{type:ControlType.Link,title:\"Option 7 Link\"},a8Label:{type:ControlType.String,title:\"Option 8 Label\",defaultValue:\"\"},a8Score:{type:ControlType.Number,title:\"Option 8 Score\",defaultValue:8,step:1},a8Link:{type:ControlType.Link,title:\"Option 8 Link\"},useSingleLink:{type:ControlType.Boolean,title:\"Link Mode\",defaultValue:false,enabledTitle:\"Single\",disabledTitle:\"Individual\"},singleLink:{type:ControlType.Link,title:\"Single Link\",hidden:props=>!props.useSingleLink},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#FFFFFF\"},selectedColor:{type:ControlType.Color,title:\"Selected\",defaultValue:\"#F0F0F0\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"24px\",variant:\"Semibold\",letterSpacing:\"-0.02em\",lineHeight:\"1.2em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},borderRadius:{type:ControlType.Number,title:\"Radius\",defaultValue:24,min:0,max:50,step:1,unit:\"px\"},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:16,min:0,max:50,step:1,unit:\"px\"},onSelectionChange:{type:ControlType.EventHandler}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SingleSelectionQuiz\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"400\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerIntrinsicWidth\":\"600\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL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