{"version":3,"file":"Tooltip.2eE2--Fb.mjs","names":["useRef","useId","useState","X","Tooltip"],"sources":["https:/framerusercontent.com/modules/SQG5YG17s9dAV81RDDC7/mUkLGfLAv1OpHNOaSslX/Tooltip.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsOnFramerCanvas}from\"framer\";import{Tooltip}from\"antd\";import{X}from\"lucide-react\";import{useState,useEffect,useId,useRef}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function TooltipWrapper(props){const{children,content=\"这是一个提示\",placement=\"top\",trigger=\"hover\",showArrow=true,styleSection={},showCloseButton=false,enablePersistence=false,persistenceId=\"\",persistenceMode=\"forever\",persistenceDays=7,autoShow=false,containerMode=\"body\",customContainerSelector=\"\",zIndex=1070}=props;const{bgColor=\"rgba(0, 0, 0, 0.85)\",textColor=\"#ffffff\",fontSize=14,maxWidth=250,borderRadius=6}=styleSection;const isOnCanvas=useIsOnFramerCanvas();const containerRef=useRef(null);const fallbackId=useId();const storageKey=`tooltip_dismissed_${persistenceId||fallbackId}`;const[open,setOpen]=useState(undefined);const[shouldRender,setShouldRender]=useState(true);useEffect(()=>{if(isOnCanvas){setOpen(undefined);return;}if(!enablePersistence){if(autoShow){setOpen(true);}return;}const dismissedData=localStorage.getItem(storageKey);if(dismissedData){if(persistenceMode===\"forever\"){setShouldRender(false);setOpen(false);}else if(persistenceMode===\"days\"){const dismissedTime=parseInt(dismissedData,10);const now=Date.now();const daysPassed=(now-dismissedTime)/(1e3*60*60*24);if(daysPassed<persistenceDays){setShouldRender(false);setOpen(false);}else{localStorage.removeItem(storageKey);if(autoShow){setOpen(true);}}}}else{if(autoShow){setOpen(true);}}},[isOnCanvas,enablePersistence,storageKey,persistenceMode,persistenceDays,autoShow]);const handleClose=e=>{e.stopPropagation();e.preventDefault();setOpen(false);if(enablePersistence&&persistenceId){if(persistenceMode===\"forever\"){localStorage.setItem(storageKey,\"true\");}else if(persistenceMode===\"days\"){localStorage.setItem(storageKey,Date.now().toString());}setShouldRender(false);}};const handleOpenChange=visible=>{if(enablePersistence&&!shouldRender){return;}setOpen(visible);};const getContainer=()=>{switch(containerMode){case\"parent\":return containerRef.current||document.body;case\"custom\":if(customContainerSelector){const customEl=document.querySelector(customContainerSelector);if(customEl instanceof HTMLElement){return customEl;}}return document.body;case\"body\":default:return document.body;}};const tooltipContent=/*#__PURE__*/_jsxs(\"div\",{style:{display:\"flex\",alignItems:\"flex-start\",gap:showCloseButton?12:0,maxWidth:maxWidth-24,padding:\"3px 0px\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{flex:1,fontSize,lineHeight:1,color:textColor,wordBreak:\"break-word\"},children:content}),showCloseButton&&/*#__PURE__*/_jsx(X,{size:14,onClick:handleClose,style:{cursor:\"pointer\",opacity:.7,flexShrink:0,color:textColor},onMouseEnter:e=>{e.currentTarget.style.opacity=\"1\";},onMouseLeave:e=>{e.currentTarget.style.opacity=\"0.7\";}})]});if(!children){return /*#__PURE__*/_jsx(\"div\",{style:{padding:\"20px 40px\",background:\"#f5f5f5\",borderRadius:8,color:\"#999\",fontSize:14,border:\"2px dashed #ddd\",textAlign:\"center\"},children:\"← 拖入触发元素\"});}const actualTrigger=isOnCanvas?trigger:autoShow&&showCloseButton?[]:trigger;const actualOpen=isOnCanvas?undefined:open;return /*#__PURE__*/_jsx(\"div\",{ref:containerRef,style:{display:\"inline-block\",position:containerMode===\"parent\"?\"relative\":undefined},children:/*#__PURE__*/_jsx(Tooltip,{title:tooltipContent,placement:placement,trigger:actualTrigger,open:actualOpen,onOpenChange:handleOpenChange,arrow:showArrow,getPopupContainer:getContainer,zIndex:zIndex,overlayStyle:{maxWidth},overlayInnerStyle:{backgroundColor:bgColor,borderRadius,padding:\"8px 12px\"},color:bgColor,children:/*#__PURE__*/_jsx(\"div\",{style:{display:\"inline-block\"},children:children})})});}addPropertyControls(TooltipWrapper,{children:{type:ControlType.ComponentInstance,title:\"触发元素\"},content:{type:ControlType.String,title:\"提示文字\",defaultValue:\"这是一个提示\",displayTextArea:true},placement:{type:ControlType.Enum,title:\"弹出位置\",options:[\"top\",\"topLeft\",\"topRight\",\"bottom\",\"bottomLeft\",\"bottomRight\",\"left\",\"leftTop\",\"leftBottom\",\"right\",\"rightTop\",\"rightBottom\"],optionTitles:[\"上\",\"左上\",\"右上\",\"下\",\"左下\",\"右下\",\"左\",\"左上\",\"左下\",\"右\",\"右上\",\"右下\"],defaultValue:\"top\"},trigger:{type:ControlType.SegmentedEnum,title:\"触发方式\",options:[\"hover\",\"click\",\"focus\"],optionTitles:[\"悬停\",\"点击\",\"聚焦\"],defaultValue:\"hover\",hidden:props=>props.autoShow&&props.showCloseButton},showArrow:{type:ControlType.Boolean,title:\"显示箭头\",defaultValue:true,enabledTitle:\"显示\",disabledTitle:\"隐藏\"},containerMode:{type:ControlType.Enum,title:\"挂载容器\",options:[\"body\",\"parent\",\"custom\"],optionTitles:[\"Body\",\"父元素\",\"自定义\"],defaultValue:\"body\",description:\"Tooltip 弹出层挂载的容器\"},customContainerSelector:{type:ControlType.String,title:\"CSS 选择器\",defaultValue:\"\",placeholder:\"#my-container\",hidden:props=>props.containerMode!==\"custom\",description:\"自定义容器的 CSS 选择器\"},zIndex:{type:ControlType.Number,title:\"层级\",defaultValue:1070,min:1,max:9999,step:1,displayStepper:true},styleSection:{type:ControlType.Object,title:\"样式\",controls:{bgColor:{type:ControlType.Color,title:\"背景色\",defaultValue:\"rgba(0, 0, 0, 0.85)\"},textColor:{type:ControlType.Color,title:\"文字色\",defaultValue:\"#ffffff\"},fontSize:{type:ControlType.Number,title:\"字号\",defaultValue:14,min:12,max:24,step:1,unit:\"px\",displayStepper:true},maxWidth:{type:ControlType.Number,title:\"最大宽度\",defaultValue:250,min:100,max:500,step:10,unit:\"px\"},borderRadius:{type:ControlType.Number,title:\"圆角\",defaultValue:6,min:0,max:20,step:1,unit:\"px\",displayStepper:true}}},autoShow:{type:ControlType.Boolean,title:\"自动显示\",defaultValue:false,enabledTitle:\"开启\",disabledTitle:\"关闭\",description:\"预览/发布时自动显示，画布中不生效\"},showCloseButton:{type:ControlType.Boolean,title:\"关闭按钮\",defaultValue:false,enabledTitle:\"显示\",disabledTitle:\"隐藏\"},enablePersistence:{type:ControlType.Boolean,title:\"记住关闭\",defaultValue:false,enabledTitle:\"开启\",disabledTitle:\"关闭\"},persistenceId:{type:ControlType.String,title:\"唯一 ID\",defaultValue:\"\",placeholder:\"tooltip_v1\",hidden:props=>!props.enablePersistence},persistenceMode:{type:ControlType.SegmentedEnum,title:\"关闭模式\",options:[\"forever\",\"days\"],optionTitles:[\"永久\",\"定时\"],defaultValue:\"forever\",hidden:props=>!props.enablePersistence},persistenceDays:{type:ControlType.Number,title:\"重显天数\",defaultValue:7,min:1,max:365,step:1,unit:\"天\",displayStepper:true,hidden:props=>!props.enablePersistence||props.persistenceMode!==\"days\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TooltipWrapper\",\"slots\":[\"children\"],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Tooltip.map"],"mappings":"0TAGG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,WAAS,UAAQ,SAAS,YAAU,MAAM,UAAQ,QAAQ,YAAU,GAAK,eAAa,EAAE,CAAC,kBAAgB,GAAM,oBAAkB,GAAM,gBAAc,GAAG,kBAAgB,UAAU,kBAAgB,EAAE,WAAS,GAAM,gBAAc,OAAO,0BAAwB,GAAG,SAAO,MAAM,EAAW,CAAC,UAAQ,sBAAsB,YAAU,UAAU,WAAS,GAAG,WAAS,IAAI,eAAa,GAAG,EAAmB,EAAW,GAAqB,CAAO,EAAaA,EAAO,KAAK,CAAO,EAAWC,GAAO,CAAO,EAAW,qBAAqB,GA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