{"version":3,"file":"FirstLineIndentText.DSlLAhY1.mjs","names":["useState","useMemo"],"sources":["https:/framerusercontent.com/modules/5LGxJvjXtjvnUeah2Rns/gwNhkX4tJc6WZc7RARi2/FirstLineIndentText.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useMemo,useEffect,useState,startTransition}from\"react\";/**\n * FirstLineIndentText\n *\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function FirstLineIndentText(props){const{text,indentValue,indentUnit,color,font,htmlTag,style,overflow,hyphenate=true,language=\"en\",phoneMaxWidth,tabletMaxWidth,phoneFontScale,tabletFontScale,desktopFontScale}=props;const[viewportWidth,setViewportWidth]=useState(null);useEffect(()=>{if(typeof window===\"undefined\")return;const checkWidth=()=>{const width=window.innerWidth;startTransition(()=>setViewportWidth(width));};checkWidth();window.addEventListener(\"resize\",checkWidth);return()=>window.removeEventListener(\"resize\",checkWidth);},[]);const isPhone=viewportWidth!==null?viewportWidth<phoneMaxWidth:false;const isTablet=viewportWidth!==null?viewportWidth>=phoneMaxWidth&&viewportWidth<tabletMaxWidth:false;const enableHyphenation=hyphenate&&isPhone;const indent=useMemo(()=>`${indentValue}${indentUnit}`,[indentValue,indentUnit]);const Tag=htmlTag;const hyphenationStyles=enableHyphenation?{hyphens:\"auto\",WebkitHyphens:\"auto\",msHyphens:\"auto\",wordBreak:\"normal\",overflowWrap:\"normal\"}:{hyphens:\"none\",WebkitHyphens:\"none\",msHyphens:\"none\",wordBreak:\"break-word\",overflowWrap:\"break-word\"};const responsiveFontSize=useMemo(()=>{if(!font?.fontSize)return font?.fontSize;const size=parseFloat(font.fontSize);if(!Number.isFinite(size))return font?.fontSize;const unit=font.fontSize.toString().replace(/[0-9.]/g,\"\");const scale=isPhone?phoneFontScale:isTablet?tabletFontScale:desktopFontScale;return`${size*scale}${unit||\"px\"}`;},[font?.fontSize,isPhone,isTablet,phoneFontScale,tabletFontScale,desktopFontScale]);return /*#__PURE__*/_jsx(Tag,{lang:language,style:{all:\"unset\",display:\"block\",boxSizing:\"border-box\",margin:0,padding:0,color,...font,fontSize:responsiveFontSize,width:style?.width||\"100%\",minWidth:0,whiteSpace:\"pre-wrap\",textAlign:font?.textAlign||\"left\",textIndent:indent,overflow,...hyphenationStyles,...style},children:text});}addPropertyControls(FirstLineIndentText,{text:{type:ControlType.String,title:\"Text\",defaultValue:\"This text will automatically use hyphenation when the viewport width is under 390px.\",displayTextArea:true},indentValue:{type:ControlType.Number,title:\"Indent\",defaultValue:32,min:0,max:200,step:1},indentUnit:{type:ControlType.Enum,title:\"Unit\",options:[\"px\",\"%\"],optionTitles:[\"px\",\"%\"],defaultValue:\"px\",displaySegmentedControl:true},htmlTag:{type:ControlType.Enum,title:\"HTML Tag\",options:[\"p\",\"span\",\"div\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],optionTitles:[\"p\",\"span\",\"div\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],defaultValue:\"p\"},color:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},overflow:{type:ControlType.Enum,title:\"Overflow\",options:[\"visible\",\"hidden\",\"scroll\",\"auto\"],optionTitles:[\"Visible\",\"Hidden\",\"Scroll\",\"Auto\"],defaultValue:\"hidden\"},hyphenate:{type:ControlType.Boolean,title:\"Hyphenate\",defaultValue:true},language:{type:ControlType.String,title:\"Lang\",defaultValue:\"en\",placeholder:\"en, de, fr, es\"},phoneMaxWidth:{type:ControlType.Number,title:\"Phone ≤\",defaultValue:390,min:200,max:800,step:1,unit:\"px\"},tabletMaxWidth:{type:ControlType.Number,title:\"Tablet ≤\",defaultValue:1024,min:400,max:1600,step:1,unit:\"px\"},phoneFontScale:{type:ControlType.Number,title:\"Phone Size\",defaultValue:.85,min:.5,max:2,step:.01},tabletFontScale:{type:ControlType.Number,title:\"Tablet Size\",defaultValue:1,min:.5,max:2,step:.01},desktopFontScale:{type:ControlType.Number,title:\"Desktop Size\",defaultValue:1,min:.5,max:2,step:.01}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FirstLineIndentText\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FirstLineIndentText.map"],"mappings":"6MAKG,SAAwB,EAAoB,EAAM,CAAC,GAAK,CAAC,OAAK,cAAY,aAAW,QAAM,OAAK,UAAQ,QAAM,WAAS,YAAU,GAAK,WAAS,KAAK,gBAAc,iBAAe,iBAAe,kBAAgB,oBAAkB,EAAW,CAAC,EAAc,GAAkBA,EAAS,KAAK,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,MAAe,CAAC,IAAM,EAAM,EAAO,WAAW,MAAoB,EAAiB,EAAM,CAAC,EAA6D,OAA1D,GAAY,CAAC,EAAO,iBAAiB,SAAS,EAAW,KAAW,EAAO,oBAAoB,SAAS,EAAW,EAAG,EAAE,CAAC,CAAC,IAAM,EAAQ,IAAgB,KAAiC,GAA5B,EAAc,EAA0B,EAAS,IAAgB,KAAgE,GAA3D,GAAe,GAAe,EAAc,EAA2B,EAAkB,GAAW,EAAc,EAAOC,MAAY,GAAG,IAAc,IAAa,CAAC,EAAY,EAAW,CAAC,CAAO,EAAI,EAAc,EAAkB,EAAkB,CAAC,QAAQ,OAAO,cAAc,OAAO,UAAU,OAAO,UAAU,SAAS,aAAa,SAAS,CAAC,CAAC,QAAQ,OAAO,cAAc,OAAO,UAAU,OAAO,UAAU,aAAa,aAAa,aAAa,CAAO,EAAmBA,MAAY,CAAC,GAA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