{"version":3,"file":"CMSCounter.BjqJS7fC.mjs","names":[],"sources":["https:/framerusercontent.com/modules/BBUAbGx22zVBT9dNUfhp/nNBnj2l6aPZCvTojbWmQ/CMSCounter.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget,// @ts-ignore\nuseQueryData}from\"framer\";function formatNumber(value,commas){let numberString=value.toFixed(0);if(commas){numberString=numberString.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");}return numberString;}/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function CMSCounter(props){var _props_collectionList,_collectionList_props,_collectionList_props_children_props,_collectionList_props_children,_collectionList_props1,_collectionList_props_children_props_children_props,_collectionList_props_children_props_children,_collectionList_props_children_props1,_collectionList_props_children1,_collectionList_props2,_props_style;const{transform}=props;const collectionList=(_props_collectionList=props.collectionList)===null||_props_collectionList===void 0?void 0:_props_collectionList[0];const isCanvas=RenderTarget.current()===RenderTarget.canvas;var _collectionList_props_query,_ref;const query=(_ref=(_collectionList_props_query=collectionList===null||collectionList===void 0?void 0:(_collectionList_props=collectionList.props)===null||_collectionList_props===void 0?void 0:_collectionList_props.query)!==null&&_collectionList_props_query!==void 0?_collectionList_props_query:collectionList===null||collectionList===void 0?void 0:(_collectionList_props1=collectionList.props)===null||_collectionList_props1===void 0?void 0:(_collectionList_props_children=_collectionList_props1.children)===null||_collectionList_props_children===void 0?void 0:(_collectionList_props_children_props=_collectionList_props_children.props)===null||_collectionList_props_children_props===void 0?void 0:_collectionList_props_children_props.query)!==null&&_ref!==void 0?_ref:collectionList===null||collectionList===void 0?void 0:(_collectionList_props2=collectionList.props)===null||_collectionList_props2===void 0?void 0:(_collectionList_props_children1=_collectionList_props2.children)===null||_collectionList_props_children1===void 0?void 0:(_collectionList_props_children_props1=_collectionList_props_children1.props)===null||_collectionList_props_children_props1===void 0?void 0:(_collectionList_props_children_props_children=_collectionList_props_children_props1.children)===null||_collectionList_props_children_props_children===void 0?void 0:(_collectionList_props_children_props_children_props=_collectionList_props_children_props_children.props)===null||_collectionList_props_children_props_children_props===void 0?void 0:_collectionList_props_children_props_children_props.query;let items=props.placeholder;// Only display number of CMS items in the preview and live website.\nif(query&&!isCanvas){items=useQueryData(query).length;}let prefix=\"\";let suffix=\"\";if(transform){if(transform.plural){prefix=items==1?transform.singularPrefix:transform.pluralPrefix;suffix=items==1?transform.singularSuffix:transform.pluralSuffix;}else{prefix=transform.prefix;suffix=transform.suffix;}}return /*#__PURE__*/_jsxs(\"div\",{style:{color:props.fontColor,userSelect:props.textSelect?\"auto\":\"none\",margin:0,whiteSpace:((_props_style=props.style)===null||_props_style===void 0?void 0:_props_style.width)?undefined:\"nowrap\",...props.font,...props.style},children:[prefix,formatNumber(items,props.commas),suffix]});}CMSCounter.displayName=\"CMS Item Counter\";addPropertyControls(CMSCounter,{collectionList:{type:ControlType.ComponentInstance},placeholder:{type:ControlType.Number,defaultValue:10,min:0,step:1,description:\"Placeholder number is shown in the editor.\"},commas:{type:ControlType.Boolean,defaultValue:true},fontColor:{type:ControlType.Color,defaultValue:\"#000\"},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1}},transform:{type:ControlType.Object,optional:true,controls:{plural:{type:ControlType.Boolean,defaultValue:false,enabledTitle:\"On\",disabledTitle:\"Off\"},prefix:{type:ControlType.String,hidden(props){return props.plural;}},suffix:{type:ControlType.String,hidden(props){return props.plural;}},singularPrefix:{type:ControlType.String,placeholder:\"Singular Prefix\",hidden(props){return!props.plural;}},singularSuffix:{type:ControlType.String,placeholder:\"Singular Suffix\",hidden(props){return!props.plural;}},pluralPrefix:{type:ControlType.String,placeholder:\"Plural Prefix\",hidden(props){return!props.plural;}},pluralSuffix:{type:ControlType.String,placeholder:\"Plural Suffix\",hidden(props){return!props.plural;}}}},textSelect:{type:ControlType.Boolean,defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMSCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CMSCounter.map"],"mappings":"qQAC0B,SAAS,EAAa,EAAM,EAAO,CAAC,IAAI,EAAa,EAAM,QAAQ,EAAE,CAA4E,OAAxE,IAAQ,EAAa,EAAa,QAAQ,wBAAwB,IAAI,EAAS,EAG/K,SAAwB,EAAW,EAAM,CAAC,IAAqF,EAA+B,EAA2E,EAA8C,EAAsC,EAAgC,EAAoC,GAAK,CAAC,aAAW,EAAY,EAAsC,EAAM,iBAAoF,GAAS,EAAS,EAAa,SAAS,GAAG,EAAa,OAAkD,EAAyC,GAA4F,OAA2E,QAAgF,GAAiB,OAAsC,EAAuB,EAAe,QAAS,OAA8C,EAA+B,EAAuB,WAAY,KAAvK,IAAK,GAA6P,EAA+B,OAAyG,SAAkC,GAAiB,OAAsC,EAAuB,EAAe,QAAS,OAA8C,EAAgC,EAAuB,WAAY,OAAuD,EAAsC,EAAgC,QAAS,OAA6D,EAA8C,EAAsC,WAAY,KAA3c,IAAK,GAA+jB,EAA8C,OAAuI,OAAU,EAAM,EAAM,YACjsE,GAAO,CAAC,IAAU,EAAM,EAAa,EAAM,CAAC,QAAQ,IAAI,EAAO,GAAO,EAAO,GAA8N,OAAxN,IAAc,EAAU,QAAQ,EAAO,GAAO,EAAE,EAAU,eAAe,EAAU,aAAa,EAAO,GAAO,EAAE,EAAU,eAAe,EAAU,eAAmB,EAAO,EAAU,OAAO,EAAO,EAAU,SAA6B,EAAM,MAAM,CAAC,MAAM,CAAC,MAAM,EAAM,UAAU,WAAW,EAAM,WAAW,OAAO,OAAO,OAAO,EAAE,WAA0B,EAAM,OAAyD,MAAO,IAAA,GAAU,SAAS,GAAG,EAAM,KAAK,GAAG,EAAM,MAAM,CAAC,SAAS,CAAC,EAAO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