{"version":3,"file":"BarChart.BLPixCsP.mjs","names":["useRef","useMemo"],"sources":["https:/framerusercontent.com/modules/BwtubCgIiTwKne46r3zK/a14qmpKwxGbclmOvoTEd/BarChart.js"],"sourcesContent":["// Editable bar chart with animated bars, gradient colors, and mobile optimization\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{motion,useInView}from\"framer-motion\";import{useRef,useMemo}from\"react\";/**\n * Editable Bar Chart\n * \n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function BarChart(props){const{title=\"LTV BY COHORT (\\xa3)\",subtitle=\"SUBS \\xb7 3.9\\xd7 ONE-TIME\",bars=[{value:42,label:\"ONE-TIME\"},{value:71,label:\"REPEAT 2\\xd7\"},{value:94,label:\"REPEAT 3\\xd7\"},{value:128,label:\"SUB 3MO\"},{value:164,label:\"SUB 6MO\"},{value:218,label:\"SUB 12MO\"}],barColor=\"#4ADE80\",gradientStartColor=\"#4ADE80\",gradientEndColor=\"#22C55E\",backgroundColor=\"#0A0A0A\",textColor=\"#FFFFFF\",labelColor=\"#666666\",titleColor=\"#666666\",subtitleColor=\"#666666\",titleFont,subtitleFont,valueFont,labelFont,padding=40,borderRadius=16,animate=true,animationDuration=.8,animationDelay=.1,barGap=16,valueType=\"money\"}=props;const containerRef=useRef(null);const isInView=useInView(containerRef,{once:true,amount:.3});const shouldAnimate=animate&&isInView;// Calculate max value for scaling\nconst maxValue=useMemo(()=>Math.max(...bars.map(b=>b.value)),[bars]);// Format value based on type\nconst formatValue=value=>{if(valueType===\"percentage\"){return`${value}%`;}return`\\xa3${value}`;};// Generate gradient based on bar color\nconst gradient=useMemo(()=>{return`linear-gradient(180deg, ${gradientStartColor} 0%, ${gradientEndColor} 100%)`;},[gradientStartColor,gradientEndColor]);// Check if width is constrained (mobile optimization)\nconst isFixedWidth=props?.style&&props.style.width===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{...props.style,position:\"relative\",backgroundColor,borderRadius,padding,display:\"flex\",flexDirection:\"column\",gap:32,overflow:\"hidden\",minWidth:isFixedWidth?\"auto\":600},children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",justifyContent:\"space-between\",alignItems:\"flex-start\",flexWrap:\"wrap\",gap:16},children:[/*#__PURE__*/_jsx(\"span\",{style:{color:titleColor,textTransform:\"uppercase\",...titleFont},children:title}),/*#__PURE__*/_jsx(\"span\",{style:{color:subtitleColor,textTransform:\"uppercase\",...subtitleFont},children:subtitle})]}),/*#__PURE__*/_jsx(\"div\",{style:{display:\"flex\",alignItems:\"flex-end\",justifyContent:\"space-between\",gap:isFixedWidth?Math.max(4,barGap/2):barGap,flex:1,position:\"relative\"},children:bars.map((bar,index)=>{const heightPercentage=bar.value/maxValue*100;return /*#__PURE__*/_jsxs(\"div\",{style:{flex:1,display:\"flex\",flexDirection:\"column\",alignItems:\"center\",justifyContent:\"flex-end\",gap:12,minWidth:0,height:\"100%\"},children:[/*#__PURE__*/_jsx(motion.span,{initial:shouldAnimate?{opacity:0,y:-10}:false,animate:shouldAnimate?{opacity:1,y:0}:{},transition:{duration:animationDuration,delay:index*animationDelay},style:{color:textColor,whiteSpace:\"nowrap\",...valueFont},children:formatValue(bar.value)}),/*#__PURE__*/_jsx(motion.div,{initial:{height:0},animate:animate&&isInView?{height:`${heightPercentage}%`}:{height:`${heightPercentage}%`},transition:{duration:animationDuration,delay:index*animationDelay,ease:\"easeOut\"},style:{width:\"100%\",background:gradient,borderRadius:4,minHeight:animate&&!isInView?0:20}}),/*#__PURE__*/_jsx(\"span\",{style:{color:labelColor,textTransform:\"uppercase\",textAlign:\"center\",fontSize:isFixedWidth?\"10px\":undefined,wordBreak:\"break-word\",...labelFont},children:bar.label})]},index);})})]});}// Helper function to adjust color brightness\nfunction adjustColorBrightness(color,percent){// Handle hex colors\nif(color.startsWith(\"#\")){const num=parseInt(color.replace(\"#\",\"\"),16);const r=Math.max(0,Math.min(255,(num>>16)+percent));const g=Math.max(0,Math.min(255,(num>>8&255)+percent));const b=Math.max(0,Math.min(255,(num&255)+percent));return`#${(r<<16|g<<8|b).toString(16).padStart(6,\"0\")}`;}// Handle rgb/rgba colors\nif(color.startsWith(\"rgb\")){const matches=color.match(/\\d+/g);if(matches){const r=Math.max(0,Math.min(255,parseInt(matches[0])+percent));const g=Math.max(0,Math.min(255,parseInt(matches[1])+percent));const b=Math.max(0,Math.min(255,parseInt(matches[2])+percent));const a=matches[3]?parseFloat(matches[3]):1;return`rgba(${r}, ${g}, ${b}, ${a})`;}}return color;}addPropertyControls(BarChart,{title:{type:ControlType.String,title:\"Title\",defaultValue:\"LTV BY COHORT (\\xa3)\"},subtitle:{type:ControlType.String,title:\"Subtitle\",defaultValue:\"SUBS \\xb7 3.9\\xd7 ONE-TIME\"},valueType:{type:ControlType.Enum,title:\"Value Type\",options:[\"money\",\"percentage\"],optionTitles:[\"Money (\\xa3)\",\"Percentage (%)\"],defaultValue:\"money\",displaySegmentedControl:true},bars:{type:ControlType.Array,title:\"Bars\",control:{type:ControlType.Object,controls:{value:{type:ControlType.Number,title:\"Value\",defaultValue:100,min:0,step:.1},label:{type:ControlType.String,title:\"Label\",defaultValue:\"Label\"}}},defaultValue:[{value:42,label:\"ONE-TIME\"},{value:71,label:\"REPEAT 2\\xd7\"},{value:94,label:\"REPEAT 3\\xd7\"},{value:128,label:\"SUB 3MO\"},{value:164,label:\"SUB 6MO\"},{value:218,label:\"SUB 12MO\"}]},gradientStartColor:{type:ControlType.Color,title:\"Gradient Start\",defaultValue:\"#4ADE80\"},gradientEndColor:{type:ControlType.Color,title:\"Gradient End\",defaultValue:\"#22C55E\"},backgroundColor:{type:ControlType.Color,title:\"Background\",defaultValue:\"#0A0A0A\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#FFFFFF\"},labelColor:{type:ControlType.Color,title:\"Label Color\",defaultValue:\"#666666\"},titleColor:{type:ControlType.Color,title:\"Title Color\",defaultValue:\"#666666\"},subtitleColor:{type:ControlType.Color,title:\"Subtitle Color\",defaultValue:\"#666666\"},titleFont:{type:ControlType.Font,title:\"Title Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"12px\",variant:\"Regular\",letterSpacing:\"0.05em\",lineHeight:\"1.2em\"}},subtitleFont:{type:ControlType.Font,title:\"Subtitle Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"12px\",variant:\"Regular\",letterSpacing:\"0.05em\",lineHeight:\"1.2em\"}},valueFont:{type:ControlType.Font,title:\"Value Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"14px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1em\"}},labelFont:{type:ControlType.Font,title:\"Label Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"11px\",variant:\"Regular\",letterSpacing:\"0.02em\",lineHeight:\"1.2em\"}},padding:{type:ControlType.Number,title:\"Padding\",defaultValue:40,min:0,max:100,step:4,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"Border Radius\",defaultValue:16,min:0,max:50,step:1,unit:\"px\"},barGap:{type:ControlType.Number,title:\"Bar Gap\",defaultValue:16,min:0,max:50,step:2,unit:\"px\"},animate:{type:ControlType.Boolean,title:\"Animate\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},animationDuration:{type:ControlType.Number,title:\"Duration\",defaultValue:.8,min:.1,max:3,step:.1,unit:\"s\",hidden:({animate})=>!animate},animationDelay:{type:ControlType.Number,title:\"Stagger Delay\",defaultValue:.1,min:0,max:.5,step:.05,unit:\"s\",hidden:({animate})=>!animate}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"BarChart\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerSupportedLayoutWidth\":\"any-pref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