{"version":3,"file":"GridText.DGPp5LcC.mjs","names":[],"sources":["https:/framerusercontent.com/modules/Ljw426S6n7C1dYNUjoOQ/3CDJ8DxNFvVacoWF5B7E/GridText.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function Text(props){const{text,groupByLetter}=props// 接收 groupByLetter 控制\n;const[isMobile,setIsMobile]=useState(false);const[fontSize,setFontSize]=useState(\"18px\");useEffect(()=>{const handleResize=()=>{const isMobileScreen=window.innerWidth<=600;setIsMobile(isMobileScreen);setFontSize(isMobileScreen?\"16px\":\"18px\");};window.addEventListener(\"resize\",handleResize);handleResize()// Initial check\n;return()=>window.removeEventListener(\"resize\",handleResize);},[]);// Function to group countries by the first letter\nconst groupByFirstLetter=countries=>{const groups={};countries.forEach(country=>{const firstLetter=country.charAt(0).toUpperCase();if(!groups[firstLetter]){groups[firstLetter]=[];}groups[firstLetter].push(country);});return groups;};// Split text by commas and remove extra spaces\nconst countries=text.split(\",\").map(phrase=>phrase.trim()).filter(t=>t.length>0);// If the user wants to group countries by letter, apply the grouping\nconst groupedCountries=groupByLetter?groupByFirstLetter(countries):null;return /*#__PURE__*/_jsx(\"div\",{style:gridContainerStyle(isMobile),children:groupByLetter&&groupedCountries?Object.keys(groupedCountries).map(letter=>/*#__PURE__*/_jsxs(\"div\",{style:groupStyle,children:[/*#__PURE__*/_jsx(\"h3\",{style:headerStyle,children:letter}),groupedCountries[letter].map((country,index)=>/*#__PURE__*/_jsx(\"div\",{style:{...tagStyle,fontSize},children:country},index))]},letter)):countries.map((country,index)=>/*#__PURE__*/_jsx(\"div\",{style:{...tagStyle,fontSize},children:country},index))});}addPropertyControls(Text,{text:{title:\"Text\",type:ControlType.String,defaultValue:\"Argentina, Australia, Austria, Belarus, Belgium, Bolivia, Brazil, Bulgaria, Cameroon, Canada, Chile, China, Colombia, C\\xf4te d’Ivoire, Croatia, Cyprus, Czech Republic, Democratic Republic of the Congo, Denmark, Dominican Republic, Egypt, Estonia, Ethiopia, Finland, France, Germany, Ghana, Greece, Guadeloupe, Hong Kong, Hungary, Iceland, India, Indonesia, Ireland, Isle of Man, Israel, Italy, Japan, Jordan, Kenya, Latvia, Liechtenstein, Lithuania, Luxembourg, Malaysia, Mali, Martinique, Mexico, Moldova, Monaco, Morocco, Netherlands, New Zealand, Nicaragua, Norway, Palestine, Peru, Philippines, Poland, Portugal, R\\xe9union, Romania, Russia, Rwanda, Serbia, Sierra Leone, Singapore, Slovakia, Slovenia, Spain, Sweden, Switzerland, Syria, Taiwan, Thailand, Tunisia, Turkey, Uganda, Ukraine, United Arab Emirates, United Kingdom, United States, Vatican, Vietnam, Zambia, Zimbabwe\"},groupByLetter:{title:\"Group by Letter\",type:ControlType.Boolean,defaultValue:true}});const gridContainerStyle=isMobile=>({display:\"grid\",gridTemplateColumns:isMobile?\"repeat(2, 1fr)\":\"repeat(4, 1fr)\",gap:\"24px\",width:\"100%\"});const groupStyle={marginBottom:\"16px\"};const headerStyle={fontWeight:\"bold\",fontSize:\"20px\",marginBottom:\"12px\"};const tagStyle={padding:\"8px 0px\",color:\"#333333\",textAlign:\"left\",wordBreak:\"break-word\"};\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"Text\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./GridText.map"],"mappings":"yTAGG,SAAwB,EAAK,EAAM,CAAC,GAAK,CAAC,OAAK,gBAAc,CAAC,EAC3D,CAAC,EAAS,EAAY,CAAC,GAAS,EAAM,CAAM,CAAC,EAAS,EAAY,CAAC,EAAS,OAAO,CAAC,EAAU,IAAI,CAAC,IAAM,EAAa,IAAI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