{"version":3,"file":"CircularDial.DIccUrDu.mjs","names":["React.useRef","React.useMemo"],"sources":["https:/framerusercontent.com/modules/fVjtUfRlVSh773isazD2/QBRyOPZf40Frc1w2EphY/CircularDial.js"],"sourcesContent":["// Instructions: Create a Framer component that follows the Framer component rules and achieves the user's goal.\n// Goal: make me a circular dial with a stroke outline and then also \"tick marks\" inside the larger circle. Let me define how many tick marks and style/color and stroke width. I want it to animate slowly turning in one direction then back\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight any-prefer-fixed\n */export default function CircularDial(props){const{showOutline,outlineColor,outlineColor2,outlineWidth,outlineOpacity,showTicks,tickCount,tickColor,tickColor2,tickWidth,tickOpacity,tickLength,tickInset,tickCap,animate,animateColors,direction,maxAngle,duration,delay,ease,style}=props;const isStatic=useIsStaticRenderer();const ref=React.useRef(null);const isInView=useInView(ref,{amount:.2});const dir=direction===\"clockwise\"?1:-1;const angle=dir*maxAngle;const vb=100;const cx=50;const cy=50;const safeOutlineWidth=Math.max(0,outlineWidth);const safeTickWidth=Math.max(0,tickWidth);const safeTickCount=Math.max(0,Math.floor(tickCount));const r=React.useMemo(()=>{const maxStroke=Math.max(safeOutlineWidth,safeTickWidth);return Math.max(.001,50-maxStroke/2);},[safeOutlineWidth,safeTickWidth]);const ticks=React.useMemo(()=>{if(!showTicks)return[];if(safeTickCount<=0)return[];const len=Math.max(0,tickLength);const inset=Math.max(0,tickInset);const rOuter=Math.max(.001,r-inset);const rInner=Math.max(.001,rOuter-len);const res=[];for(let i=0;i<safeTickCount;i++){const a=i/safeTickCount*Math.PI*2-Math.PI/2;const cos=Math.cos(a);const sin=Math.sin(a);const x1=cx+rInner*cos;const y1=cy+rInner*sin;const x2=cx+rOuter*cos;const y2=cy+rOuter*sin;res.push({x1,y1,x2,y2,key:`t-${i}`});}return res;},[showTicks,safeTickCount,tickLength,tickInset,r]);const shouldAnimate=!isStatic&&animate&&isInView&&duration>0&&maxAngle!==0;const transitionEase=React.useMemo(()=>{// Use cubic-bezier tuples to match Framer Motion's Easing type\nreturn ease===\"linear\"?[0,0,1,1]:[.42,0,.58,1];},[ease]);const baseTransition=React.useMemo(()=>{return shouldAnimate?{duration,delay,ease:transitionEase,repeat:Infinity,repeatType:\"mirror\"}:undefined;},[shouldAnimate,duration,delay,transitionEase]);const shouldAnimateColors=animateColors&&shouldAnimate;return /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{position:\"relative\",width:\"100%\",height:\"100%\",overflow:\"visible\",...style},\"aria-label\":\"Circular dial\",role:\"img\",children:/*#__PURE__*/_jsx(motion.div,{style:{position:\"relative\",width:\"100%\",height:\"100%\",transformOrigin:\"50% 50%\",willChange:shouldAnimate?\"transform\":undefined},initial:{rotate:0},animate:shouldAnimate?{rotate:angle}:{rotate:0},transition:baseTransition,children:/*#__PURE__*/_jsxs(\"svg\",{width:\"100%\",height:\"100%\",viewBox:`0 0 ${vb} ${vb}`,preserveAspectRatio:\"xMidYMid meet\",style:{display:\"block\"},children:[showOutline&&safeOutlineWidth>0&&/*#__PURE__*/_jsx(motion.circle,{cx:cx,cy:cy,r:r,fill:\"none\",strokeOpacity:Math.max(0,Math.min(1,outlineOpacity)),strokeWidth:safeOutlineWidth,initial:shouldAnimateColors?{stroke:outlineColor}:undefined,animate:shouldAnimateColors?{stroke:outlineColor2}:{stroke:outlineColor},transition:shouldAnimateColors?baseTransition:undefined}),showTicks&&ticks.map(t=>/*#__PURE__*/_jsx(motion.line,{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,strokeOpacity:Math.max(0,Math.min(1,tickOpacity)),strokeWidth:safeTickWidth,strokeLinecap:tickCap,initial:shouldAnimateColors?{stroke:tickColor}:undefined,animate:shouldAnimateColors?{stroke:tickColor2}:{stroke:tickColor},transition:shouldAnimateColors?baseTransition:undefined},t.key))]})})});}addPropertyControls(CircularDial,{showOutline:{type:ControlType.Boolean,title:\"Outline\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},outlineColor:{type:ControlType.Color,title:\"Outline Color\",defaultValue:\"#000000\",hidden:({showOutline})=>!showOutline},outlineColor2:{type:ControlType.Color,title:\"Outline Color 2\",defaultValue:\"#CCCCCC\",hidden:({showOutline})=>!showOutline},outlineWidth:{type:ControlType.Number,title:\"Outline Width\",defaultValue:4,min:0,max:40,step:.5,unit:\"px\",hidden:({showOutline})=>!showOutline},outlineOpacity:{type:ControlType.Number,title:\"Outline Opacity\",defaultValue:1,min:0,max:1,step:.05,hidden:({showOutline})=>!showOutline},showTicks:{type:ControlType.Boolean,title:\"Ticks\",defaultValue:true,enabledTitle:\"Show\",disabledTitle:\"Hide\"},tickCount:{type:ControlType.Number,title:\"Tick Count\",defaultValue:12,min:0,max:240,step:1,hidden:({showTicks})=>!showTicks},tickColor:{type:ControlType.Color,title:\"Tick Color\",defaultValue:\"#000000\",hidden:({showTicks})=>!showTicks},tickColor2:{type:ControlType.Color,title:\"Tick Color 2\",defaultValue:\"#CCCCCC\",hidden:({showTicks})=>!showTicks},tickWidth:{type:ControlType.Number,title:\"Tick Width\",defaultValue:2,min:0,max:30,step:.5,unit:\"px\",hidden:({showTicks})=>!showTicks},tickOpacity:{type:ControlType.Number,title:\"Tick Opacity\",defaultValue:.7,min:0,max:1,step:.05,hidden:({showTicks})=>!showTicks},tickLength:{type:ControlType.Number,title:\"Tick Length\",defaultValue:10,min:0,max:40,step:.5,unit:\"px\",hidden:({showTicks})=>!showTicks},tickInset:{type:ControlType.Number,title:\"Tick Inset\",defaultValue:6,min:0,max:40,step:.5,unit:\"px\",hidden:({showTicks})=>!showTicks},tickCap:{type:ControlType.Enum,title:\"Tick Cap\",options:[\"round\",\"butt\",\"square\"],optionTitles:[\"Round\",\"Butt\",\"Square\"],defaultValue:\"round\",displaySegmentedControl:true,hidden:({showTicks})=>!showTicks},animate:{type:ControlType.Boolean,title:\"Animate\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},animateColors:{type:ControlType.Boolean,title:\"Animate Colors\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\",hidden:({animate})=>!animate},direction:{type:ControlType.Enum,title:\"Direction\",options:[\"clockwise\",\"counterclockwise\"],optionTitles:[\"CW\",\"CCW\"],defaultValue:\"clockwise\",displaySegmentedControl:true,hidden:({animate})=>!animate},maxAngle:{type:ControlType.Number,title:\"Max Angle\",defaultValue:18,min:0,max:180,step:1,unit:\"deg\",hidden:({animate})=>!animate},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:6,min:.2,max:60,step:.1,unit:\"s\",hidden:({animate})=>!animate},delay:{type:ControlType.Number,title:\"Delay\",defaultValue:0,min:0,max:10,step:.1,unit:\"s\",hidden:({animate})=>!animate},ease:{type:ControlType.Enum,title:\"Ease\",options:[\"easeInOut\",\"linear\"],optionTitles:[\"Ease In-Out\",\"Linear\"],defaultValue:\"easeInOut\",displaySegmentedControl:true,hidden:({animate})=>!animate}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CircularDial\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerSupportedLayoutHeight\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CircularDial.map"],"mappings":"wPAKG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,cAAY,eAAa,gBAAc,eAAa,iBAAe,YAAU,YAAU,YAAU,aAAW,YAAU,cAAY,aAAW,YAAU,UAAQ,UAAQ,gBAAc,YAAU,WAAS,WAAS,QAAM,OAAK,SAAO,EAAY,EAAS,GAAqB,CAAO,EAAIA,EAAa,KAAK,CAAO,EAAS,EAAU,EAAI,CAAC,OAAO,GAAG,CAAC,CAA8C,GAAnC,IAAY,YAA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