{"version":3,"file":"TextLists.BjS7m-Iu.mjs","names":["useMemo"],"sources":["https:/framerusercontent.com/modules/0GgVEvgiKyqMqFi6hWSA/Zw4PWVCCd3WwXwVcFfWC/TextLists.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useMemo}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @copyright ©framersnippets.com\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n * @framerDisableUnlink\n **/export default function TextLists(props){const{content,lists,font}=props;const baseStyles=useMemo(()=>({fontFamily:font.fontFamily,fontSize:font.fontSize,fontWeight:font.fontWeight,lineHeight:font.lineHeight,letterSpacing:font.letterSpacing,margin:0,padding:0}),[font]);const parsedLists=useMemo(()=>{// Replace literal \"\\n\" with actual newline characters\nconst processedContent=content.replace(/\\\\n/g,\"\\n\");const lines=processedContent.split(\"\\n\");// Rest of your parsing logic remains the same\nconst result=[];let currentList=[];let currentIndent=-1;lines.forEach(line=>{const indent=line.search(/\\S/);if(indent===-1)return;if(indent!==currentIndent){if(currentList.length>0){result.push(currentList);}currentList=[];currentIndent=indent;}currentList.push({content:line.trim(),indent});});if(currentList.length>0){result.push(currentList);}return result;},[content]);const renderListItem=useMemo(()=>(item,itemIndex,listStyle)=>{const isCustomMarker=listStyle.listStyleType===\"image\"||listStyle.listStyleType===\"content\";return /*#__PURE__*/_jsxs(\"li\",{style:{margin:listStyle.margin,display:isCustomMarker?\"flex\":\"list-item\",alignItems:listStyle.align===\"middle\"?\"center\":listStyle.align===\"bottom\"?\"flex-end\":\"flex-start\"},children:[listStyle.listStyleType===\"image\"&&listStyle.image&&/*#__PURE__*/_jsx(\"img\",{src:listStyle.image,alt:\"List marker\",style:{width:listStyle.imageSize,height:listStyle.imageSize,marginRight:listStyle.imageGap,flexShrink:0}}),listStyle.listStyleType===\"content\"&&listStyle.content&&/*#__PURE__*/_jsx(\"span\",{style:{marginRight:listStyle.imageGap,flexShrink:0,color:listStyle.markerColor||\"inherit\"},children:listStyle.content}),/*#__PURE__*/_jsx(\"span\",{style:isCustomMarker?{flex:1}:undefined,children:item.content})]},itemIndex);},[]);return /*#__PURE__*/_jsx(\"div\",{children:parsedLists.map((list,listIndex)=>{const listStyle=lists[listIndex]||{};const markerColor=listStyle.markerColor||listStyle.color||\"inherit\";return /*#__PURE__*/_jsxs(\"ul\",{style:{...baseStyles,...listStyle,[\"--marker-color\"]:markerColor,paddingLeft:`${list[0].indent*(listStyle.indent||10)}px`,paddingBottom:listStyle.gap,listStyleType:listStyle.listStyleType||\"none\",listStylePosition:\"inside\",color:listStyle.color||\"inherit\",\"--marker-color\":markerColor},children:[/*#__PURE__*/_jsx(\"style\",{children:`\n                            ul[style*=\"--marker-color\"] > li::marker {\n                                color: var(--marker-color);\n                            }\n                        `}),list.map((item,itemIndex)=>renderListItem(item,itemIndex,listStyle))]},listIndex);})});}addPropertyControls(TextLists,{content:{type:ControlType.String,title:\"Content\",defaultValue:\"Item\\n  Sub-item\\n    Sub-sub-item\",placeholder:\"Type something…\",displayTextArea:true,description:\"How to:\\n Type items, one per line\\n Use spaces to nest\\n Each space = new list style\\n Add items to style each lists\\n\\n CMS: [Tutorial](https://www.framersnippets.com/articles/styling-lists-in-framer-a-comprehensive-solution-for-nested-lists-and-cms-connected-lists)\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",displayTextAlignment:false,defaultFontType:\"sans-serif\",defaultValue:{fontSize:15,lineHeight:1.4,letterSpacing:0}},lists:{type:ControlType.Array,title:\"Lists\",description:`\nImportant: Update the component in Framer (Assets > Components > Click purple update button) to prevent crashes.\n`,control:{type:ControlType.Object,controls:{listStyleType:{type:ControlType.Enum,title:\"Style\",options:[\"none\",\"image\",\"content\",\"disc\",\"circle\",\"square\",\"decimal\",\"decimal-leading-zero\",\"lower-alpha\",\"upper-alpha\",\"lower-roman\",\"upper-roman\",\"lower-greek\",\"upper-greek\",\"armenian\",\"georgian\",\"cjk-decimal\",\"hebrew\",\"hiragana\",\"hiragana-iroha\",\"katakana\",\"katakana-iroha\"],defaultValue:\"disc\"},image:{type:ControlType.Image,title:\"Image\",hidden:props=>props.listStyleType!==\"image\"},content:{type:ControlType.String,title:\"Content\",placeholder:\"Enter content (e.g., emoji)\",hidden:props=>props.listStyleType!==\"content\"},align:{type:ControlType.Enum,title:\"‎\",options:[\"top\",\"middle\",\"bottom\"],optionIcons:[\"text-align-top\",\"text-align-middle\",\"text-align-bottom\"],defaultValue:\"middle\",displaySegmentedControl:true,hidden:props=>props.listStyleType!==\"image\"&&props.listStyleType!==\"content\"},imageSize:{type:ControlType.Number,title:\"Size\",defaultValue:14,min:0,max:100,displayStepper:true,hidden:props=>props.listStyleType!==\"image\"},imageGap:{type:ControlType.Number,title:\"Spacing\",defaultValue:10,min:0,max:50,displayStepper:true,hidden:props=>props.listStyleType!==\"image\"&&props.listStyleType!==\"content\"},color:{type:ControlType.Color,title:\"Text\",defaultValue:\"#000000\"},markerColor:{type:ControlType.Color,title:\"Marker\"},indent:{type:ControlType.Number,title:\"Indent\",defaultValue:10,min:0,max:100,displayStepper:true},gap:{type:ControlType.Number,title:\"Gap\",defaultValue:0,min:0,max:100,displayStepper:true},margin:{type:ControlType.Padding,title:\"Item Margin\",defaultValue:\"0\"}}},defaultValue:[]}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TextLists\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\",\"framerSupportedLayoutHeight\":\"any\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TextLists.map"],"mappings":"iLAKI,SAAwB,EAAU,EAAM,CAAC,GAAK,CAAC,UAAQ,QAAM,QAAM,EAAY,EAAWA,OAAa,CAAC,WAAW,EAAK,WAAW,SAAS,EAAK,SAAS,WAAW,EAAK,WAAW,WAAW,EAAK,WAAW,cAAc,EAAK,cAAc,OAA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