{"version":3,"file":"CMSItemCountLabel.BMSJ2lCb.mjs","names":["__esmMin","init_jsx_runtime","p","useQueryData","RenderTarget","init_framer_BisrWwwE","ControlType","addPropertyControls","superfieldsId","init_SuperfieldsShared","getCollectionData","useSuperfieldsStore","init_CMSLibrary","init_Store","CMSItemCountLabel","props","isCanvas","collectionList","totalItems","state","items","query","prefix","suffix","transform","formatNumber","numberString","value","commas","init_CMSItemCountLabel"],"sources":["https:/framerusercontent.com/modules/j3C7bfLtfNLDSTKe4iIP/LY8V3HsCegRjmP9GkBlL/CMSItemCountLabel.js"],"sourcesContent":["import{jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget,// @ts-ignore\nuseQueryData}from\"framer\";import{superfieldsId}from\"https://framerusercontent.com/modules/FZjYlw33eNo8pxLbSFLX/e0vXaSjcEY6WLZBJ4574/SuperfieldsShared.js\";import{getCollectionData}from\"https://framer.com/m/CMSLibrary-09eo.js\";import useSuperfieldsStore from\"https://framerusercontent.com/modules/OoGHZMzWDzm2mNN7bmeR/quqdohq6i4dLZg5wuqIc/Store.js\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n */export default function CMSItemCountLabel(props){var _props_collectionList,_props_style;const{superfieldsId,transform}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;const collectionList=(_props_collectionList=props.collectionList)===null||_props_collectionList===void 0?void 0:_props_collectionList[0];const{query}=getCollectionData(collectionList);const totalItems=useSuperfieldsStore(superfieldsId,state=>state.totalItems);let items=0;// Only display number of CMS items in the preview and live website.\nif(!isCanvas){if(props.type===\"cms\"){if(query){items=useQueryData(query).length;}}else{items=totalItems;}}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.color,userSelect:props.selectable?\"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]});}CMSItemCountLabel.displayName=\"CMS Item Count Label\";addPropertyControls(CMSItemCountLabel,{type:{type:ControlType.Enum,defaultValue:\"cms\",options:[\"cms\",\"superfields\"],optionTitles:[\"CMS Collection List\",\"Superfields\"],displaySegmentedControl:true,segmentedControlDirection:\"vertical\"},collectionList:{type:ControlType.ComponentInstance,hidden:props=>props.type!==\"cms\"},...superfieldsId({hidden:props=>props.type!==\"superfields\"}),font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1}},color:{type:ControlType.Color,defaultValue:\"#000\"},commas:{type:ControlType.Boolean,defaultValue:true},transform:{type:ControlType.Object,optional:true,controls:{plural:{type:ControlType.Boolean,defaultValue:false},prefix:{type:ControlType.String,hidden:props=>props.plural},suffix:{type:ControlType.String,hidden:props=>props.plural},singularPrefix:{type:ControlType.String,placeholder:\"Singular Prefix\",hidden:props=>!props.plural},singularSuffix:{type:ControlType.String,placeholder:\"Singular Suffix\",hidden:props=>!props.plural},pluralPrefix:{type:ControlType.String,placeholder:\"Plural Prefix\",hidden:props=>!props.plural},pluralSuffix:{type:ControlType.String,placeholder:\"Plural Suffix\",hidden:props=>!props.plural}}},selectable:{type:ControlType.Boolean,defaultValue:true,title:\"Text Select\"}});function formatNumber(value,commas){let numberString=value.toFixed(0);if(commas){numberString=numberString.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");}return numberString;}\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CMSItemCountLabel\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"any\",\"framerSupportedLayoutWidth\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}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