{"version":3,"file":"ChildCounter.COD-CEWs.mjs","names":["useMemo","useState"],"sources":["https:/framerusercontent.com/modules/qHu0jumJZSJiFSjopxvz/H8rIL4JnRXgsvsGg6QFR/ChildCounter.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useState,useMemo}from\"react\";import{addPropertyControls,ControlType,RenderTarget,// @ts-expect-error – Internal\nuseQueryData}from\"framer\";import{fontControls}from\"https://framer.com/m/framer/default-utils.js@^0.45.0\";function DragHandleCounter({dataSource}){const isEditingMode=RenderTarget.current()===RenderTarget.canvas;const count=useMemo(()=>{var _dataSource__props_children,_dataSource_;if(isEditingMode||!(dataSource===null||dataSource===void 0?void 0:(_dataSource_=dataSource[0])===null||_dataSource_===void 0?void 0:(_dataSource__props_children=_dataSource_.props.children)===null||_dataSource__props_children===void 0?void 0:_dataSource__props_children.props.query)){return 0// Will show in the editor\n;}return useQueryData(dataSource[0].props.children.props.query).length;},[dataSource,isEditingMode]);return count;}/**\n * @framerDisableUnlink\n */export default function ChildCounter(props){const[childCount,setChildCount]=useState(0);useEffect(()=>{if(props.filterType!==\"dragHandle\"){let element;if(props.filterType===\"sectionId\"){element=document.getElementById(props.sectionId);}else if(props.filterType===\"ariaLabel\"){element=document.querySelector(`[aria-label=\"${props.ariaLabel}\"]`);}if(element){setChildCount(element.children.length);}else{setChildCount(0);}}},[props.sectionId,props.ariaLabel,props.filterType]);const textStyle={...props.font,color:props.fontColor};return /*#__PURE__*/_jsx(\"div\",{style:textStyle,children:props.filterType===\"dragHandle\"?/*#__PURE__*/_jsx(DragHandleCounter,{dataSource:props.dataSource}):childCount});}ChildCounter.defaultProps={sectionId:\"\",ariaLabel:\"\",filterType:\"sectionId\",fontColor:\"#000000\",font:fontControls.defaultProps,dataSource:null};addPropertyControls(ChildCounter,{filterType:{type:ControlType.Enum,title:\"Filter By\",options:[\"sectionId\",\"ariaLabel\"],optionTitles:[\"Section ID\",\"Aria Label\",\"Drag Handle\"]},sectionId:{type:ControlType.String,title:\"Section ID\",hidden:props=>props.filterType!==\"sectionId\",description:\"Add a section ID to the CMS collection from the right hand panel. Note: The collection item needs to be rendered to see the results in action.\"},ariaLabel:{type:ControlType.String,title:\"Aria Label\",hidden:props=>props.filterType!==\"ariaLabel\",description:\"Add an aria label from the accessibility section on the right hand side to the CMS collection. Note: The collection item needs to be rendered to see the results in action.\"},dataSource:{type:ControlType.ComponentInstance,title:\"Source\",hidden:props=>props.filterType!==\"dragHandle\",description:\"Connect to a CMS collection outside the canvas.\"},fontColor:{type:ControlType.Color,title:\"Font Color\"},font:{type:ControlType.Font,controls:\"extended\",description:\"[via SegmentUI](https://www.segmentUI.com)\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ChildCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ChildCounter.map"],"mappings":"6cACyG,SAAS,EAAkB,CAAC,cAAY,CAAC,IAAM,EAAc,EAAa,SAAS,GAAG,EAAa,OACvG,OAD0HA,MAAY,CAAC,IAAgC,EAC1Q,OAD0R,GAAe,EAAE,KAAa,OAAkC,EAAa,EAAW,KAAM,OAAgE,EAAa,MAAM,UAA0F,MAAM,OAAe,EACnjB,EAAa,EAAW,GAAG,MAAM,SAAS,MAAM,MAAM,CAAC,QAAS,CAAC,EAAW,EAAc,CAAC,CAEjG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,EAAW,GAAeC,EAAS,EAAE,CAAC,MAAc,CAAC,GAAG,EAAM,aAAa,aAAa,CAAC,IAAI,EAAW,EAAM,aAAa,YAAa,EAAQ,SAAS,eAAe,EAAM,UAAU,CAAU,EAAM,aAAa,cAAa,EAAQ,SAAS,cAAc,gBAAgB,EAAM,UAAU,IAAI,EAAc,EAAT,EAAuB,EAAQ,SAAS,OAA4B,EAAE,GAAK,CAAC,EAAM,UAAU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