chordia-ui 3.6.4 → 3.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/TourGuideTooltip.cjs.js +1 -1
- package/dist/TourGuideTooltip.cjs.js.map +1 -1
- package/dist/TourGuideTooltip.es.js +174 -104
- package/dist/TourGuideTooltip.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/common/TourGuideTooltip.jsx +150 -19
- package/src/fonts/.DS_Store +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),l=require("react"),et=require("react-dom"),B=230,$=141,x="var(--Grey-Hover, #F3F7F7)",b="var(--Grey-absent, #D9D9D9)",ot={top:{left:"50%",bottom:"100%",transform:"translateX(-50%)"},bottom:{left:"50%",top:"100%",transform:"translateX(-50%)"},left:{top:"50%",right:"100%",transform:"translateY(-50%)"},right:{top:"50%",left:"100%",transform:"translateY(-50%)"}};function rt(e,n,r){return n==="left"?{position:"fixed",left:e.left,top:e.centerY,transform:`translate(calc(-100% - ${r}px), -50%)`}:n==="right"?{position:"fixed",left:e.right,top:e.centerY,transform:`translate(${r}px, -50%)`}:n==="top"?{position:"fixed",left:e.centerX,top:e.top,transform:`translate(-50%, calc(-100% - ${r}px))`}:{position:"fixed",left:e.centerX,top:e.bottom,transform:`translate(-50%, ${r}px)`}}function nt(e){return e==="left"?"right":e==="right"?"left":e==="top"?"bottom":"top"}function st(e,n,r,a){const c=window.innerWidth,v=window.innerHeight,d={left:e.left>=B+r+a,right:c-e.right>=B+r+a,top:e.top>=$+r+a,bottom:v-e.bottom>=$+r+a};if(d[n])return n;const i=nt(n);return d[i]?i:d.right?"right":d.left?"left":d.bottom?"bottom":d.top?"top":n}const it={position:"relative",borderRadius:12,boxShadow:"0 2px 2px rgba(0, 0, 0, 0.25)",overflow:"visible",fontFamily:"Varta, var(--font-sans, sans-serif)"},lt={display:"flex",flexDirection:"column",padding:"18px 20px 14px 20px"},at={margin:0,fontSize:14,lineHeight:"16px",fontWeight:600,color:"var(--text-ink, #2e3236)"},dt={margin:"12px 0 0 0",fontSize:13,lineHeight:1.45,fontWeight:400,color:"var(--text-muted, #808183)",wordBreak:"break-word"},ft={marginTop:12,height:28,display:"flex",alignItems:"center",justifyContent:"space-between"},pt={fontSize:12,lineHeight:"14px",fontWeight:300,color:"var(--text-ink, #2e3236)"},ct={display:"flex",alignItems:"center",gap:4},ut={height:28,border:"none",borderRadius:10,fontSize:13,cursor:"pointer",background:"transparent",color:"var(--text-ink, #2e3236)",fontWeight:400,padding:"0 10px"},xt={height:28,border:"none",borderRadius:10,fontSize:13,cursor:"pointer",background:"#00a66e",color:"#ffffff",fontWeight:700,padding:"0 16px"},bt={left:{top:"50%",right:-11,transform:"translateY(-50%)",borderTop:"10px solid transparent",borderBottom:"10px solid transparent",borderLeft:`11px solid ${b}`},right:{top:"50%",left:-11,transform:"translateY(-50%)",borderTop:"10px solid transparent",borderBottom:"10px solid transparent",borderRight:`11px solid ${b}`},top:{left:"50%",bottom:-11,transform:"translateX(-50%)",borderLeft:"10px solid transparent",borderRight:"10px solid transparent",borderTop:`11px solid ${b}`},bottom:{left:"50%",top:-11,transform:"translateX(-50%)",borderLeft:"10px solid transparent",borderRight:"10px solid transparent",borderBottom:`11px solid ${b}`}},mt={left:{top:"50%",right:-10,transform:"translateY(-50%)",borderTop:"9px solid transparent",borderBottom:"9px solid transparent",borderLeft:`10px solid ${x}`},right:{top:"50%",left:-10,transform:"translateY(-50%)",borderTop:"9px solid transparent",borderBottom:"9px solid transparent",borderRight:`10px solid ${x}`},top:{left:"50%",bottom:-10,transform:"translateX(-50%)",borderLeft:"9px solid transparent",borderRight:"9px solid transparent",borderTop:`10px solid ${x}`},bottom:{left:"50%",top:-10,transform:"translateX(-50%)",borderLeft:"9px solid transparent",borderRight:"9px solid transparent",borderBottom:`10px solid ${x}`}},yt=l.forwardRef(function({title:n,description:r,step:a,total:c,onNext:v,onSkip:d,position:i="left",className:D="",style:F,showArrow:H=!0,anchorId:f,gap:w=8,showBackdrop:I=!1,backdropBlur:m=0,backdropOpacity:G=.2,backdropClassName:A="",backdropStyle:N,usePortal:_=!1,portalContainer:P,zIndex:y=1100,backdropZIndex:j,highlightAnchor:k=!1,highlightPadding:T=6,autoFlip:R=!1,viewportPadding:E=12,nextLabel:q="Next",skipLabel:M="Skip"},p){const L=l.useId(),C=l.useId(),[O,W]=l.useState(null),[V,X]=l.useState(i);l.useEffect(()=>{X(i)},[i]),l.useEffect(()=>{if(!f)return;const t=()=>{const g=document.getElementById(f);if(!g){W(null);return}const s=g.getBoundingClientRect(),u={left:s.left,right:s.right,top:s.top,bottom:s.bottom,centerX:s.left+s.width/2,centerY:s.top+s.height/2};W(u),R&&X(st(u,i,w,E))};t(),window.addEventListener("resize",t),window.addEventListener("scroll",t,!0);const S=window.setInterval(t,120);return()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t,!0),window.clearInterval(S)}},[f,R,w,i,E]),l.useEffect(()=>{if(!f||!k)return;const t=document.getElementById(f);if(!t)return;const S=t.style.outline,g=t.style.outlineOffset,s=t.style.borderRadius,u=t.style.position,U=t.style.zIndex,tt=window.getComputedStyle(t).borderRadius;return t.style.outline=`${Math.max(T,0)}px solid rgba(0, 166, 110, 0.35)`,t.style.outlineOffset="0px",t.style.borderRadius=tt,u||(t.style.position="relative"),t.style.zIndex=String(y+1),()=>{t.style.outline=S,t.style.outlineOffset=g,t.style.borderRadius=s,t.style.position=u,t.style.zIndex=U}},[f,k,T,y]);const Z=l.useCallback(t=>{typeof p=="function"?p(t):p&&typeof p=="object"&&(p.current=t)},[p]),J=typeof j=="number"?j:y-1,h=R?V:i,Y=P||(typeof document<"u"?document.body:null),K=o.jsx("div",{ref:Z,role:"dialog","aria-modal":"false","aria-labelledby":L,"aria-describedby":C,className:D,style:{zIndex:y,...f&&O?rt(O,h,w):{position:"absolute",...ot[h]},...F},children:o.jsxs("div",{style:{...it,width:B,minHeight:$,background:x,border:`0.5px solid ${b}`},children:[H&&o.jsxs(o.Fragment,{children:[o.jsx("span",{style:{position:"absolute",width:0,height:0,...bt[h]}}),o.jsx("span",{style:{position:"absolute",width:0,height:0,...mt[h]}})]}),o.jsxs("div",{style:lt,children:[o.jsx("h3",{id:L,style:at,children:n}),o.jsx("p",{id:C,style:dt,children:r}),o.jsxs("div",{style:ft,children:[o.jsxs("span",{"aria-label":`Step ${a} of ${c}`,style:pt,children:[a," of ",c]}),o.jsxs("div",{style:ct,children:[o.jsx("button",{type:"button",onClick:d,"aria-label":"Skip tour",style:ut,children:M}),o.jsx("button",{type:"button",onClick:v,"aria-label":`Go to next step (${a+1} of ${c})`,style:xt,children:q})]})]})]})]})}),Q=I?o.jsx("div",{className:A,"aria-hidden":"true",style:{position:"fixed",inset:0,zIndex:J,background:`rgba(0, 0, 0, ${G})`,backdropFilter:m?`blur(${m}px)`:void 0,WebkitBackdropFilter:m?`blur(${m}px)`:void 0,...N}}):null,z=o.jsxs(o.Fragment,{children:[Q,K]});return _&&Y?et.createPortal(z,Y):z});exports.TourGuideTooltip=yt;
|
|
2
2
|
//# sourceMappingURL=TourGuideTooltip.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourGuideTooltip.cjs.js","sources":["../src/components/common/TourGuideTooltip.jsx"],"sourcesContent":["import React, { forwardRef, useId } from \"react\";\n\nconst CARD_W = 230;\nconst CARD_MIN_H = 141;\nconst BASE_BG = \"var(--Grey-Hover, #F3F7F7)\";\nconst BASE_BORDER = \"var(--Grey-absent, #D9D9D9)\";\n\nconst wrapperStyleByPosition = {\n top: { left: \"50%\", bottom: \"100%\", transform: \"translateX(-50%)\" },\n bottom: { left: \"50%\", top: \"100%\", transform: \"translateX(-50%)\" },\n left: { top: \"50%\", right: \"100%\", transform: \"translateY(-50%)\" },\n right: { top: \"50%\", left: \"100%\", transform: \"translateY(-50%)\" },\n};\n\nfunction getFixedPositionStyle(rect, position, gap) {\n if (position === \"left\") {\n return {\n position: \"fixed\",\n left: rect.left,\n top: rect.centerY,\n transform: `translate(calc(-100% - ${gap}px), -50%)`,\n };\n }\n\n if (position === \"right\") {\n return {\n position: \"fixed\",\n left: rect.right,\n top: rect.centerY,\n transform: `translate(${gap}px, -50%)`,\n };\n }\n\n if (position === \"top\") {\n return {\n position: \"fixed\",\n left: rect.centerX,\n top: rect.top,\n transform: `translate(-50%, calc(-100% - ${gap}px))`,\n };\n }\n\n return {\n position: \"fixed\",\n left: rect.centerX,\n top: rect.bottom,\n transform: `translate(-50%, ${gap}px)`,\n };\n}\n\nconst cardStyle = {\n position: \"relative\",\n borderRadius: 12,\n boxShadow: \"0 2px 2px rgba(0, 0, 0, 0.25)\",\n overflow: \"visible\",\n fontFamily: \"Varta, var(--font-sans, sans-serif)\",\n};\n\nconst contentStyle = {\n display: \"flex\",\n flexDirection: \"column\",\n padding: \"18px 20px 14px 20px\",\n};\n\nconst titleStyle = {\n margin: 0,\n fontSize: 14,\n lineHeight: \"16px\",\n fontWeight: 600,\n color: \"var(--text-ink, #2e3236)\",\n};\n\nconst descriptionStyle = {\n margin: \"12px 0 0 0\",\n fontSize: 13,\n lineHeight: 1.45,\n fontWeight: 400,\n color: \"var(--text-muted, #808183)\",\n wordBreak: \"break-word\",\n};\n\nconst footerStyle = {\n marginTop: 12,\n height: 28,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n};\n\nconst stepStyle = {\n fontSize: 12,\n lineHeight: \"14px\",\n fontWeight: 300,\n color: \"var(--text-ink, #2e3236)\",\n};\n\nconst actionsStyle = {\n display: \"flex\",\n alignItems: \"center\",\n gap: 4,\n};\n\nconst skipButtonStyle = {\n height: 28,\n border: \"none\",\n borderRadius: 10,\n fontSize: 13,\n cursor: \"pointer\",\n background: \"transparent\",\n color: \"var(--text-ink, #2e3236)\",\n fontWeight: 400,\n padding: \"0 10px\",\n};\n\nconst nextButtonStyle = {\n height: 28,\n border: \"none\",\n borderRadius: 10,\n fontSize: 13,\n cursor: \"pointer\",\n background: \"#00a66e\",\n color: \"#ffffff\",\n fontWeight: 700,\n padding: \"0 16px\",\n};\n\nconst arrowOuterByPosition = {\n left: {\n top: \"50%\",\n right: -11,\n transform: \"translateY(-50%)\",\n borderTop: \"10px solid transparent\",\n borderBottom: \"10px solid transparent\",\n borderLeft: `11px solid ${BASE_BORDER}`,\n },\n right: {\n top: \"50%\",\n left: -11,\n transform: \"translateY(-50%)\",\n borderTop: \"10px solid transparent\",\n borderBottom: \"10px solid transparent\",\n borderRight: `11px solid ${BASE_BORDER}`,\n },\n top: {\n left: \"50%\",\n bottom: -11,\n transform: \"translateX(-50%)\",\n borderLeft: \"10px solid transparent\",\n borderRight: \"10px solid transparent\",\n borderTop: `11px solid ${BASE_BORDER}`,\n },\n bottom: {\n left: \"50%\",\n top: -11,\n transform: \"translateX(-50%)\",\n borderLeft: \"10px solid transparent\",\n borderRight: \"10px solid transparent\",\n borderBottom: `11px solid ${BASE_BORDER}`,\n },\n};\n\nconst arrowInnerByPosition = {\n left: {\n top: \"50%\",\n right: -10,\n transform: \"translateY(-50%)\",\n borderTop: \"9px solid transparent\",\n borderBottom: \"9px solid transparent\",\n borderLeft: `10px solid ${BASE_BG}`,\n },\n right: {\n top: \"50%\",\n left: -10,\n transform: \"translateY(-50%)\",\n borderTop: \"9px solid transparent\",\n borderBottom: \"9px solid transparent\",\n borderRight: `10px solid ${BASE_BG}`,\n },\n top: {\n left: \"50%\",\n bottom: -10,\n transform: \"translateX(-50%)\",\n borderLeft: \"9px solid transparent\",\n borderRight: \"9px solid transparent\",\n borderTop: `10px solid ${BASE_BG}`,\n },\n bottom: {\n left: \"50%\",\n top: -10,\n transform: \"translateX(-50%)\",\n borderLeft: \"9px solid transparent\",\n borderRight: \"9px solid transparent\",\n borderBottom: `10px solid ${BASE_BG}`,\n },\n};\n\nconst TourGuideTooltip = forwardRef(function TourGuideTooltip(\n {\n title,\n description,\n step,\n total,\n onNext,\n onSkip,\n position = \"left\",\n className = \"\",\n style,\n showArrow = true,\n anchorId,\n gap = 8,\n },\n ref\n) {\n const titleId = useId();\n const descriptionId = useId();\n const [anchorRect, setAnchorRect] = React.useState(null);\n\n React.useEffect(() => {\n if (!anchorId) return undefined;\n\n const updateRect = () => {\n const target = document.getElementById(anchorId);\n if (!target) {\n setAnchorRect(null);\n return;\n }\n const rect = target.getBoundingClientRect();\n setAnchorRect({\n left: rect.left,\n right: rect.right,\n top: rect.top,\n bottom: rect.bottom,\n centerX: rect.left + rect.width / 2,\n centerY: rect.top + rect.height / 2,\n });\n };\n\n updateRect();\n window.addEventListener(\"resize\", updateRect);\n window.addEventListener(\"scroll\", updateRect, true);\n const timer = window.setInterval(updateRect, 120);\n\n return () => {\n window.removeEventListener(\"resize\", updateRect);\n window.removeEventListener(\"scroll\", updateRect, true);\n window.clearInterval(timer);\n };\n }, [anchorId]);\n\n return (\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"false\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n className={className}\n style={{\n zIndex: 1100,\n ...(anchorId && anchorRect\n ? getFixedPositionStyle(anchorRect, position, gap)\n : { position: \"absolute\", ...wrapperStyleByPosition[position] }),\n ...style,\n }}\n >\n <div\n style={{\n ...cardStyle,\n width: CARD_W,\n minHeight: CARD_MIN_H,\n background: BASE_BG,\n border: `0.5px solid ${BASE_BORDER}`,\n }}\n >\n {showArrow && (\n <>\n <span\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n ...arrowOuterByPosition[position],\n }}\n />\n <span\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n ...arrowInnerByPosition[position],\n }}\n />\n </>\n )}\n\n <div style={contentStyle}>\n <h3 id={titleId} style={titleStyle}>\n {title}\n </h3>\n\n <p id={descriptionId} style={descriptionStyle}>\n {description}\n </p>\n\n <div style={footerStyle}>\n <span aria-label={`Step ${step} of ${total}`} style={stepStyle}>\n {step} of {total}\n </span>\n\n <div style={actionsStyle}>\n <button\n type=\"button\"\n onClick={onSkip}\n aria-label=\"Skip tour\"\n style={skipButtonStyle}\n >\n Skip\n </button>\n\n <button\n type=\"button\"\n onClick={onNext}\n aria-label={`Go to next step (${step + 1} of ${total})`}\n style={nextButtonStyle}\n >\n Next\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n});\n\nexport default TourGuideTooltip;\n\n"],"names":["CARD_W","CARD_MIN_H","BASE_BG","BASE_BORDER","wrapperStyleByPosition","getFixedPositionStyle","rect","position","gap","cardStyle","contentStyle","titleStyle","descriptionStyle","footerStyle","stepStyle","actionsStyle","skipButtonStyle","nextButtonStyle","arrowOuterByPosition","arrowInnerByPosition","TourGuideTooltip","forwardRef","title","description","step","total","onNext","onSkip","className","style","showArrow","anchorId","ref","titleId","useId","descriptionId","anchorRect","setAnchorRect","React","updateRect","target","timer","jsx","jsxs","Fragment"],"mappings":"qEAEMA,EAAS,IACTC,EAAa,IACbC,EAAU,6BACVC,EAAc,8BAEdC,EAAyB,CAC7B,IAAK,CAAE,KAAM,MAAO,OAAQ,OAAQ,UAAW,kBAAmB,EAClE,OAAQ,CAAE,KAAM,MAAO,IAAK,OAAQ,UAAW,kBAAmB,EAClE,KAAM,CAAE,IAAK,MAAO,MAAO,OAAQ,UAAW,kBAAmB,EACjE,MAAO,CAAE,IAAK,MAAO,KAAM,OAAQ,UAAW,kBAAmB,CACnE,EAEA,SAASC,EAAsBC,EAAMC,EAAUC,EAAK,CAClD,OAAID,IAAa,OACR,CACL,SAAU,QACV,KAAMD,EAAK,KACX,IAAKA,EAAK,QACV,UAAW,0BAA0BE,CAAG,YAAA,EAIxCD,IAAa,QACR,CACL,SAAU,QACV,KAAMD,EAAK,MACX,IAAKA,EAAK,QACV,UAAW,aAAaE,CAAG,WAAA,EAI3BD,IAAa,MACR,CACL,SAAU,QACV,KAAMD,EAAK,QACX,IAAKA,EAAK,IACV,UAAW,gCAAgCE,CAAG,MAAA,EAI3C,CACL,SAAU,QACV,KAAMF,EA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AkB,EAAAA,KAAC,MAAI,CAAA,MAAO5B,EACV,SAAA,CAAA2B,EAAA,IAAC,SAAA,CACC,KAAK,SACL,QAASf,EACT,aAAW,YACX,MAAOX,EACR,SAAA,MAAA,CAED,EAEE0B,EAAA,IAAC,SAAA,CACC,KAAK,SACL,QAAShB,EACT,aAAY,oBAAoBF,EAAO,CAAC,OAAOC,CAAK,IACpD,MAAOR,EACR,SAAA,MAAA,CAED,CAAA,EACJ,CAAA,EACF,CAAA,EACF,CAAA,CAAA,CACF,CAAA,CAAA,CAGN,CAAC"}
|
|
1
|
+
{"version":3,"file":"TourGuideTooltip.cjs.js","sources":["../src/components/common/TourGuideTooltip.jsx"],"sourcesContent":["import React, { forwardRef, useId } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nconst CARD_W = 230;\nconst CARD_MIN_H = 141;\nconst BASE_BG = \"var(--Grey-Hover, #F3F7F7)\";\nconst BASE_BORDER = \"var(--Grey-absent, #D9D9D9)\";\n\nconst wrapperStyleByPosition = {\n top: { left: \"50%\", bottom: \"100%\", transform: \"translateX(-50%)\" },\n bottom: { left: \"50%\", top: \"100%\", transform: \"translateX(-50%)\" },\n left: { top: \"50%\", right: \"100%\", transform: \"translateY(-50%)\" },\n right: { top: \"50%\", left: \"100%\", transform: \"translateY(-50%)\" },\n};\n\nfunction getFixedPositionStyle(rect, position, gap) {\n if (position === \"left\") {\n return {\n position: \"fixed\",\n left: rect.left,\n top: rect.centerY,\n transform: `translate(calc(-100% - ${gap}px), -50%)`,\n };\n }\n\n if (position === \"right\") {\n return {\n position: \"fixed\",\n left: rect.right,\n top: rect.centerY,\n transform: `translate(${gap}px, -50%)`,\n };\n }\n\n if (position === \"top\") {\n return {\n position: \"fixed\",\n left: rect.centerX,\n top: rect.top,\n transform: `translate(-50%, calc(-100% - ${gap}px))`,\n };\n }\n\n return {\n position: \"fixed\",\n left: rect.centerX,\n top: rect.bottom,\n transform: `translate(-50%, ${gap}px)`,\n };\n}\n\nfunction getFallbackPosition(position) {\n if (position === \"left\") return \"right\";\n if (position === \"right\") return \"left\";\n if (position === \"top\") return \"bottom\";\n return \"top\";\n}\n\nfunction getBestPosition(rect, preferredPosition, gap, viewportPadding) {\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n const fits = {\n left: rect.left >= CARD_W + gap + viewportPadding,\n right: viewportWidth - rect.right >= CARD_W + gap + viewportPadding,\n top: rect.top >= CARD_MIN_H + gap + viewportPadding,\n bottom: viewportHeight - rect.bottom >= CARD_MIN_H + gap + viewportPadding,\n };\n\n if (fits[preferredPosition]) return preferredPosition;\n const opposite = getFallbackPosition(preferredPosition);\n if (fits[opposite]) return opposite;\n if (fits.right) return \"right\";\n if (fits.left) return \"left\";\n if (fits.bottom) return \"bottom\";\n if (fits.top) return \"top\";\n return preferredPosition;\n}\n\nconst cardStyle = {\n position: \"relative\",\n borderRadius: 12,\n boxShadow: \"0 2px 2px rgba(0, 0, 0, 0.25)\",\n overflow: \"visible\",\n fontFamily: \"Varta, var(--font-sans, sans-serif)\",\n};\n\nconst contentStyle = {\n display: \"flex\",\n flexDirection: \"column\",\n padding: \"18px 20px 14px 20px\",\n};\n\nconst titleStyle = {\n margin: 0,\n fontSize: 14,\n lineHeight: \"16px\",\n fontWeight: 600,\n color: \"var(--text-ink, #2e3236)\",\n};\n\nconst descriptionStyle = {\n margin: \"12px 0 0 0\",\n fontSize: 13,\n lineHeight: 1.45,\n fontWeight: 400,\n color: \"var(--text-muted, #808183)\",\n wordBreak: \"break-word\",\n};\n\nconst footerStyle = {\n marginTop: 12,\n height: 28,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n};\n\nconst stepStyle = {\n fontSize: 12,\n lineHeight: \"14px\",\n fontWeight: 300,\n color: \"var(--text-ink, #2e3236)\",\n};\n\nconst actionsStyle = {\n display: \"flex\",\n alignItems: \"center\",\n gap: 4,\n};\n\nconst skipButtonStyle = {\n height: 28,\n border: \"none\",\n borderRadius: 10,\n fontSize: 13,\n cursor: \"pointer\",\n background: \"transparent\",\n color: \"var(--text-ink, #2e3236)\",\n fontWeight: 400,\n padding: \"0 10px\",\n};\n\nconst nextButtonStyle = {\n height: 28,\n border: \"none\",\n borderRadius: 10,\n fontSize: 13,\n cursor: \"pointer\",\n background: \"#00a66e\",\n color: \"#ffffff\",\n fontWeight: 700,\n padding: \"0 16px\",\n};\n\nconst arrowOuterByPosition = {\n left: {\n top: \"50%\",\n right: -11,\n transform: \"translateY(-50%)\",\n borderTop: \"10px solid transparent\",\n borderBottom: \"10px solid transparent\",\n borderLeft: `11px solid ${BASE_BORDER}`,\n },\n right: {\n top: \"50%\",\n left: -11,\n transform: \"translateY(-50%)\",\n borderTop: \"10px solid transparent\",\n borderBottom: \"10px solid transparent\",\n borderRight: `11px solid ${BASE_BORDER}`,\n },\n top: {\n left: \"50%\",\n bottom: -11,\n transform: \"translateX(-50%)\",\n borderLeft: \"10px solid transparent\",\n borderRight: \"10px solid transparent\",\n borderTop: `11px solid ${BASE_BORDER}`,\n },\n bottom: {\n left: \"50%\",\n top: -11,\n transform: \"translateX(-50%)\",\n borderLeft: \"10px solid transparent\",\n borderRight: \"10px solid transparent\",\n borderBottom: `11px solid ${BASE_BORDER}`,\n },\n};\n\nconst arrowInnerByPosition = {\n left: {\n top: \"50%\",\n right: -10,\n transform: \"translateY(-50%)\",\n borderTop: \"9px solid transparent\",\n borderBottom: \"9px solid transparent\",\n borderLeft: `10px solid ${BASE_BG}`,\n },\n right: {\n top: \"50%\",\n left: -10,\n transform: \"translateY(-50%)\",\n borderTop: \"9px solid transparent\",\n borderBottom: \"9px solid transparent\",\n borderRight: `10px solid ${BASE_BG}`,\n },\n top: {\n left: \"50%\",\n bottom: -10,\n transform: \"translateX(-50%)\",\n borderLeft: \"9px solid transparent\",\n borderRight: \"9px solid transparent\",\n borderTop: `10px solid ${BASE_BG}`,\n },\n bottom: {\n left: \"50%\",\n top: -10,\n transform: \"translateX(-50%)\",\n borderLeft: \"9px solid transparent\",\n borderRight: \"9px solid transparent\",\n borderBottom: `10px solid ${BASE_BG}`,\n },\n};\n\nconst TourGuideTooltip = forwardRef(function TourGuideTooltip(\n {\n title,\n description,\n step,\n total,\n onNext,\n onSkip,\n position = \"left\",\n className = \"\",\n style,\n showArrow = true,\n anchorId,\n gap = 8,\n showBackdrop = false,\n backdropBlur = 0,\n backdropOpacity = 0.2,\n backdropClassName = \"\",\n backdropStyle,\n usePortal = false,\n portalContainer,\n zIndex = 1100,\n backdropZIndex,\n highlightAnchor = false,\n highlightPadding = 6,\n autoFlip = false,\n viewportPadding = 12,\n nextLabel = \"Next\",\n skipLabel = \"Skip\",\n },\n ref\n) {\n const titleId = useId();\n const descriptionId = useId();\n const [anchorRect, setAnchorRect] = React.useState(null);\n const [activePosition, setActivePosition] = React.useState(position);\n\n React.useEffect(() => {\n setActivePosition(position);\n }, [position]);\n\n React.useEffect(() => {\n if (!anchorId) return undefined;\n\n const updateRect = () => {\n const target = document.getElementById(anchorId);\n if (!target) {\n setAnchorRect(null);\n return;\n }\n const rect = target.getBoundingClientRect();\n const nextRect = {\n left: rect.left,\n right: rect.right,\n top: rect.top,\n bottom: rect.bottom,\n centerX: rect.left + rect.width / 2,\n centerY: rect.top + rect.height / 2,\n };\n setAnchorRect(nextRect);\n if (autoFlip) {\n setActivePosition(\n getBestPosition(nextRect, position, gap, viewportPadding)\n );\n }\n };\n\n updateRect();\n window.addEventListener(\"resize\", updateRect);\n window.addEventListener(\"scroll\", updateRect, true);\n const timer = window.setInterval(updateRect, 120);\n\n return () => {\n window.removeEventListener(\"resize\", updateRect);\n window.removeEventListener(\"scroll\", updateRect, true);\n window.clearInterval(timer);\n };\n }, [anchorId, autoFlip, gap, position, viewportPadding]);\n\n React.useEffect(() => {\n if (!anchorId || !highlightAnchor) return undefined;\n\n const target = document.getElementById(anchorId);\n if (!target) return undefined;\n\n const previousOutline = target.style.outline;\n const previousOutlineOffset = target.style.outlineOffset;\n const previousBorderRadius = target.style.borderRadius;\n const previousPosition = target.style.position;\n const previousZIndex = target.style.zIndex;\n const computedBorderRadius = window.getComputedStyle(target).borderRadius;\n\n target.style.outline = `${Math.max(highlightPadding, 0)}px solid rgba(0, 166, 110, 0.35)`;\n target.style.outlineOffset = \"0px\";\n target.style.borderRadius = computedBorderRadius;\n if (!previousPosition) target.style.position = \"relative\";\n target.style.zIndex = String(zIndex + 1);\n\n return () => {\n target.style.outline = previousOutline;\n target.style.outlineOffset = previousOutlineOffset;\n target.style.borderRadius = previousBorderRadius;\n target.style.position = previousPosition;\n target.style.zIndex = previousZIndex;\n };\n }, [anchorId, highlightAnchor, highlightPadding, zIndex]);\n\n const setRefs = React.useCallback(\n (node) => {\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref && typeof ref === \"object\") {\n ref.current = node;\n }\n },\n [ref]\n );\n\n const resolvedBackdropZIndex =\n typeof backdropZIndex === \"number\" ? backdropZIndex : zIndex - 1;\n const resolvedPosition = autoFlip ? activePosition : position;\n const resolvedPortalContainer =\n portalContainer ||\n (typeof document !== \"undefined\" ? document.body : null);\n\n const tooltipNode = (\n <div\n ref={setRefs}\n role=\"dialog\"\n aria-modal=\"false\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n className={className}\n style={{\n zIndex,\n ...(anchorId && anchorRect\n ? getFixedPositionStyle(anchorRect, resolvedPosition, gap)\n : { position: \"absolute\", ...wrapperStyleByPosition[resolvedPosition] }),\n ...style,\n }}\n >\n <div\n style={{\n ...cardStyle,\n width: CARD_W,\n minHeight: CARD_MIN_H,\n background: BASE_BG,\n border: `0.5px solid ${BASE_BORDER}`,\n }}\n >\n {showArrow && (\n <>\n <span\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n ...arrowOuterByPosition[resolvedPosition],\n }}\n />\n <span\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n ...arrowInnerByPosition[resolvedPosition],\n }}\n />\n </>\n )}\n\n <div style={contentStyle}>\n <h3 id={titleId} style={titleStyle}>\n {title}\n </h3>\n\n <p id={descriptionId} style={descriptionStyle}>\n {description}\n </p>\n\n <div style={footerStyle}>\n <span aria-label={`Step ${step} of ${total}`} style={stepStyle}>\n {step} of {total}\n </span>\n\n <div style={actionsStyle}>\n <button\n type=\"button\"\n onClick={onSkip}\n aria-label=\"Skip tour\"\n style={skipButtonStyle}\n >\n {skipLabel}\n </button>\n\n <button\n type=\"button\"\n onClick={onNext}\n aria-label={`Go to next step (${step + 1} of ${total})`}\n style={nextButtonStyle}\n >\n {nextLabel}\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n\n const backdropNode = showBackdrop ? (\n <div\n className={backdropClassName}\n aria-hidden=\"true\"\n style={{\n position: \"fixed\",\n inset: 0,\n zIndex: resolvedBackdropZIndex,\n background: `rgba(0, 0, 0, ${backdropOpacity})`,\n backdropFilter: backdropBlur ? `blur(${backdropBlur}px)` : undefined,\n WebkitBackdropFilter: backdropBlur\n ? `blur(${backdropBlur}px)`\n : undefined,\n ...backdropStyle,\n }}\n />\n ) : null;\n\n const content = (\n <>\n {backdropNode}\n {tooltipNode}\n </>\n );\n\n if (usePortal && resolvedPortalContainer) {\n return createPortal(content, resolvedPortalContainer);\n }\n\n return content;\n});\n\nexport default TourGuideTooltip;\n\n"],"names":["CARD_W","CARD_MIN_H","BASE_BG","BASE_BORDER","wrapperStyleByPosition","getFixedPositionStyle","rect","position","gap","getFallbackPosition","getBestPosition","preferredPosition","viewportPadding","viewportWidth","viewportHeight","fits","opposite","cardStyle","contentStyle","titleStyle","descriptionStyle","footerStyle","stepStyle","actionsStyle","skipButtonStyle","nextButtonStyle","arrowOuterByPosition","arrowInnerByPosition","TourGuideTooltip","forwardRef","title","description","step","total","onNext","onSkip","className","style","showArrow","anchorId","showBackdrop","backdropBlur","backdropOpacity","backdropClassName","backdropStyle","usePortal","portalContainer","zIndex","backdropZIndex","highlightAnchor","highlightPadding","autoFlip","nextLabel","skipLabel","ref","titleId","useId","descriptionId","anchorRect","setAnchorRect","React","activePosition","setActivePosition","updateRect","target","nextRect","timer","previousOutline","previousOutlineOffset","previousBorderRadius","previousPosition","previousZIndex","computedBorderRadius","setRefs","node","resolvedBackdropZIndex","resolvedPosition","resolvedPortalContainer","tooltipNode","jsx","jsxs","Fragment","backdropNode","content","createPortal"],"mappings":"6FAGMA,EAAS,IACTC,EAAa,IACbC,EAAU,6BACVC,EAAc,8BAEdC,GAAyB,CAC7B,IAAK,CAAE,KAAM,MAAO,OAAQ,OAAQ,UAAW,kBAAmB,EAClE,OAAQ,CAAE,KAAM,MAAO,IAAK,OAAQ,UAAW,kBAAmB,EAClE,KAAM,CAAE,IAAK,MAAO,MAAO,OAAQ,UAAW,kBAAmB,EACjE,MAAO,CAAE,IAAK,MAAO,KAAM,OAAQ,UAAW,kBAAmB,CACnE,EAEA,SAASC,GAAsBC,EAAMC,EAAUC,EAAK,CAClD,OAAID,IAAa,OACR,CACL,SAAU,QACV,KAAMD,EAAK,KACX,IAAKA,EAAK,QACV,UAAW,0BAA0BE,CAAG,YAAA,EAIxCD,IAAa,QACR,CACL,SAAU,QACV,KAAMD,EAAK,MACX,IAAKA,EAAK,QACV,UAAW,aAAaE,CAAG,WAAA,EAI3BD,IAAa,MACR,CACL,SAAU,QACV,KAAMD,EAAK,QACX,IAAKA,EAAK,IACV,UAAW,gCAAgCE,CAAG,MAAA,EAI3C,CACL,SAAU,QACV,KAAMF,EAAK,QACX,IAAKA,EAAK,OACV,UAAW,mBAAmBE,CAAG,KAAA,CAErC,CAEA,SAASC,GAAoBF,EAAU,CACrC,OAAIA,IAAa,OAAe,QAC5BA,IAAa,QAAgB,OAC7BA,IAAa,MAAc,SACxB,KACT,CAEA,SAASG,GAAgBJ,EAAMK,EAAmBH,EAAKI,EAAiB,CACtE,MAAMC,EAAgB,OAAO,WACvBC,EAAiB,OAAO,YACxBC,EAAO,CACX,KAAMT,EAAK,MAAQN,EAASQ,EAAMI,EAClC,MAAOC,EAAgBP,EAAK,OAASN,EAASQ,EAAMI,EACpD,IAAKN,EAA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A,SAAA,CAAAC,EACAJ,CACH,CAAA,CAAA,EAGF,OAAIjC,GAAagC,EACRO,GAAA,aAAaD,EAASN,CAAuB,EAG/CM,CACT,CAAC"}
|
|
@@ -1,73 +1,89 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { jsx as a, jsxs as f, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import c, { forwardRef as nt, useId as I } from "react";
|
|
3
|
+
import { createPortal as it } from "react-dom";
|
|
4
|
+
const $ = 230, k = 141, x = "var(--Grey-Hover, #F3F7F7)", m = "var(--Grey-absent, #D9D9D9)", st = {
|
|
4
5
|
top: { left: "50%", bottom: "100%", transform: "translateX(-50%)" },
|
|
5
6
|
bottom: { left: "50%", top: "100%", transform: "translateX(-50%)" },
|
|
6
7
|
left: { top: "50%", right: "100%", transform: "translateY(-50%)" },
|
|
7
8
|
right: { top: "50%", left: "100%", transform: "translateY(-50%)" }
|
|
8
9
|
};
|
|
9
|
-
function
|
|
10
|
-
return
|
|
10
|
+
function lt(e, r, o) {
|
|
11
|
+
return r === "left" ? {
|
|
11
12
|
position: "fixed",
|
|
12
|
-
left:
|
|
13
|
-
top:
|
|
13
|
+
left: e.left,
|
|
14
|
+
top: e.centerY,
|
|
14
15
|
transform: `translate(calc(-100% - ${o}px), -50%)`
|
|
15
|
-
} :
|
|
16
|
+
} : r === "right" ? {
|
|
16
17
|
position: "fixed",
|
|
17
|
-
left:
|
|
18
|
-
top:
|
|
18
|
+
left: e.right,
|
|
19
|
+
top: e.centerY,
|
|
19
20
|
transform: `translate(${o}px, -50%)`
|
|
20
|
-
} :
|
|
21
|
+
} : r === "top" ? {
|
|
21
22
|
position: "fixed",
|
|
22
|
-
left:
|
|
23
|
-
top:
|
|
23
|
+
left: e.centerX,
|
|
24
|
+
top: e.top,
|
|
24
25
|
transform: `translate(-50%, calc(-100% - ${o}px))`
|
|
25
26
|
} : {
|
|
26
27
|
position: "fixed",
|
|
27
|
-
left:
|
|
28
|
-
top:
|
|
28
|
+
left: e.centerX,
|
|
29
|
+
top: e.bottom,
|
|
29
30
|
transform: `translate(-50%, ${o}px)`
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
|
-
|
|
33
|
+
function at(e) {
|
|
34
|
+
return e === "left" ? "right" : e === "right" ? "left" : e === "top" ? "bottom" : "top";
|
|
35
|
+
}
|
|
36
|
+
function dt(e, r, o, s) {
|
|
37
|
+
const u = window.innerWidth, w = window.innerHeight, l = {
|
|
38
|
+
left: e.left >= $ + o + s,
|
|
39
|
+
right: u - e.right >= $ + o + s,
|
|
40
|
+
top: e.top >= k + o + s,
|
|
41
|
+
bottom: w - e.bottom >= k + o + s
|
|
42
|
+
};
|
|
43
|
+
if (l[r])
|
|
44
|
+
return r;
|
|
45
|
+
const i = at(r);
|
|
46
|
+
return l[i] ? i : l.right ? "right" : l.left ? "left" : l.bottom ? "bottom" : l.top ? "top" : r;
|
|
47
|
+
}
|
|
48
|
+
const ft = {
|
|
33
49
|
position: "relative",
|
|
34
50
|
borderRadius: 12,
|
|
35
51
|
boxShadow: "0 2px 2px rgba(0, 0, 0, 0.25)",
|
|
36
52
|
overflow: "visible",
|
|
37
53
|
fontFamily: "Varta, var(--font-sans, sans-serif)"
|
|
38
|
-
},
|
|
54
|
+
}, pt = {
|
|
39
55
|
display: "flex",
|
|
40
56
|
flexDirection: "column",
|
|
41
57
|
padding: "18px 20px 14px 20px"
|
|
42
|
-
},
|
|
58
|
+
}, ct = {
|
|
43
59
|
margin: 0,
|
|
44
60
|
fontSize: 14,
|
|
45
61
|
lineHeight: "16px",
|
|
46
62
|
fontWeight: 600,
|
|
47
63
|
color: "var(--text-ink, #2e3236)"
|
|
48
|
-
},
|
|
64
|
+
}, ut = {
|
|
49
65
|
margin: "12px 0 0 0",
|
|
50
66
|
fontSize: 13,
|
|
51
67
|
lineHeight: 1.45,
|
|
52
68
|
fontWeight: 400,
|
|
53
69
|
color: "var(--text-muted, #808183)",
|
|
54
70
|
wordBreak: "break-word"
|
|
55
|
-
},
|
|
71
|
+
}, bt = {
|
|
56
72
|
marginTop: 12,
|
|
57
73
|
height: 28,
|
|
58
74
|
display: "flex",
|
|
59
75
|
alignItems: "center",
|
|
60
76
|
justifyContent: "space-between"
|
|
61
|
-
},
|
|
77
|
+
}, xt = {
|
|
62
78
|
fontSize: 12,
|
|
63
79
|
lineHeight: "14px",
|
|
64
80
|
fontWeight: 300,
|
|
65
81
|
color: "var(--text-ink, #2e3236)"
|
|
66
|
-
},
|
|
82
|
+
}, mt = {
|
|
67
83
|
display: "flex",
|
|
68
84
|
alignItems: "center",
|
|
69
85
|
gap: 4
|
|
70
|
-
},
|
|
86
|
+
}, yt = {
|
|
71
87
|
height: 28,
|
|
72
88
|
border: "none",
|
|
73
89
|
borderRadius: 10,
|
|
@@ -77,7 +93,7 @@ const D = {
|
|
|
77
93
|
color: "var(--text-ink, #2e3236)",
|
|
78
94
|
fontWeight: 400,
|
|
79
95
|
padding: "0 10px"
|
|
80
|
-
},
|
|
96
|
+
}, ht = {
|
|
81
97
|
height: 28,
|
|
82
98
|
border: "none",
|
|
83
99
|
borderRadius: 10,
|
|
@@ -87,14 +103,14 @@ const D = {
|
|
|
87
103
|
color: "#ffffff",
|
|
88
104
|
fontWeight: 700,
|
|
89
105
|
padding: "0 16px"
|
|
90
|
-
},
|
|
106
|
+
}, gt = {
|
|
91
107
|
left: {
|
|
92
108
|
top: "50%",
|
|
93
109
|
right: -11,
|
|
94
110
|
transform: "translateY(-50%)",
|
|
95
111
|
borderTop: "10px solid transparent",
|
|
96
112
|
borderBottom: "10px solid transparent",
|
|
97
|
-
borderLeft: `11px solid ${
|
|
113
|
+
borderLeft: `11px solid ${m}`
|
|
98
114
|
},
|
|
99
115
|
right: {
|
|
100
116
|
top: "50%",
|
|
@@ -102,7 +118,7 @@ const D = {
|
|
|
102
118
|
transform: "translateY(-50%)",
|
|
103
119
|
borderTop: "10px solid transparent",
|
|
104
120
|
borderBottom: "10px solid transparent",
|
|
105
|
-
borderRight: `11px solid ${
|
|
121
|
+
borderRight: `11px solid ${m}`
|
|
106
122
|
},
|
|
107
123
|
top: {
|
|
108
124
|
left: "50%",
|
|
@@ -110,7 +126,7 @@ const D = {
|
|
|
110
126
|
transform: "translateX(-50%)",
|
|
111
127
|
borderLeft: "10px solid transparent",
|
|
112
128
|
borderRight: "10px solid transparent",
|
|
113
|
-
borderTop: `11px solid ${
|
|
129
|
+
borderTop: `11px solid ${m}`
|
|
114
130
|
},
|
|
115
131
|
bottom: {
|
|
116
132
|
left: "50%",
|
|
@@ -118,16 +134,16 @@ const D = {
|
|
|
118
134
|
transform: "translateX(-50%)",
|
|
119
135
|
borderLeft: "10px solid transparent",
|
|
120
136
|
borderRight: "10px solid transparent",
|
|
121
|
-
borderBottom: `11px solid ${
|
|
137
|
+
borderBottom: `11px solid ${m}`
|
|
122
138
|
}
|
|
123
|
-
},
|
|
139
|
+
}, vt = {
|
|
124
140
|
left: {
|
|
125
141
|
top: "50%",
|
|
126
142
|
right: -10,
|
|
127
143
|
transform: "translateY(-50%)",
|
|
128
144
|
borderTop: "9px solid transparent",
|
|
129
145
|
borderBottom: "9px solid transparent",
|
|
130
|
-
borderLeft: `10px solid ${
|
|
146
|
+
borderLeft: `10px solid ${x}`
|
|
131
147
|
},
|
|
132
148
|
right: {
|
|
133
149
|
top: "50%",
|
|
@@ -135,7 +151,7 @@ const D = {
|
|
|
135
151
|
transform: "translateY(-50%)",
|
|
136
152
|
borderTop: "9px solid transparent",
|
|
137
153
|
borderBottom: "9px solid transparent",
|
|
138
|
-
borderRight: `10px solid ${
|
|
154
|
+
borderRight: `10px solid ${x}`
|
|
139
155
|
},
|
|
140
156
|
top: {
|
|
141
157
|
left: "50%",
|
|
@@ -143,7 +159,7 @@ const D = {
|
|
|
143
159
|
transform: "translateX(-50%)",
|
|
144
160
|
borderLeft: "9px solid transparent",
|
|
145
161
|
borderRight: "9px solid transparent",
|
|
146
|
-
borderTop: `10px solid ${
|
|
162
|
+
borderTop: `10px solid ${x}`
|
|
147
163
|
},
|
|
148
164
|
bottom: {
|
|
149
165
|
left: "50%",
|
|
@@ -151,124 +167,159 @@ const D = {
|
|
|
151
167
|
transform: "translateX(-50%)",
|
|
152
168
|
borderLeft: "9px solid transparent",
|
|
153
169
|
borderRight: "9px solid transparent",
|
|
154
|
-
borderBottom: `10px solid ${
|
|
170
|
+
borderBottom: `10px solid ${x}`
|
|
155
171
|
}
|
|
156
|
-
},
|
|
157
|
-
title:
|
|
172
|
+
}, Bt = nt(function({
|
|
173
|
+
title: r,
|
|
158
174
|
description: o,
|
|
159
|
-
step:
|
|
160
|
-
total:
|
|
161
|
-
onNext:
|
|
162
|
-
onSkip:
|
|
163
|
-
position:
|
|
164
|
-
className:
|
|
165
|
-
style:
|
|
166
|
-
showArrow:
|
|
167
|
-
anchorId:
|
|
168
|
-
gap:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
step: s,
|
|
176
|
+
total: u,
|
|
177
|
+
onNext: w,
|
|
178
|
+
onSkip: l,
|
|
179
|
+
position: i = "left",
|
|
180
|
+
className: _ = "",
|
|
181
|
+
style: G,
|
|
182
|
+
showArrow: A = !0,
|
|
183
|
+
anchorId: d,
|
|
184
|
+
gap: R = 8,
|
|
185
|
+
showBackdrop: N = !1,
|
|
186
|
+
backdropBlur: y = 0,
|
|
187
|
+
backdropOpacity: j = 0.2,
|
|
188
|
+
backdropClassName: P = "",
|
|
189
|
+
backdropStyle: M,
|
|
190
|
+
usePortal: V = !1,
|
|
191
|
+
portalContainer: Z,
|
|
192
|
+
zIndex: h = 1100,
|
|
193
|
+
backdropZIndex: E,
|
|
194
|
+
highlightAnchor: T = !1,
|
|
195
|
+
highlightPadding: L = 6,
|
|
196
|
+
autoFlip: S = !1,
|
|
197
|
+
viewportPadding: C = 12,
|
|
198
|
+
nextLabel: q = "Next",
|
|
199
|
+
skipLabel: J = "Skip"
|
|
200
|
+
}, p) {
|
|
201
|
+
const W = I(), X = I(), [Y, z] = c.useState(null), [K, H] = c.useState(i);
|
|
202
|
+
c.useEffect(() => {
|
|
203
|
+
H(i);
|
|
204
|
+
}, [i]), c.useEffect(() => {
|
|
205
|
+
if (!d)
|
|
173
206
|
return;
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
if (!
|
|
177
|
-
|
|
207
|
+
const t = () => {
|
|
208
|
+
const v = document.getElementById(d);
|
|
209
|
+
if (!v) {
|
|
210
|
+
z(null);
|
|
178
211
|
return;
|
|
179
212
|
}
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
213
|
+
const n = v.getBoundingClientRect(), b = {
|
|
214
|
+
left: n.left,
|
|
215
|
+
right: n.right,
|
|
216
|
+
top: n.top,
|
|
217
|
+
bottom: n.bottom,
|
|
218
|
+
centerX: n.left + n.width / 2,
|
|
219
|
+
centerY: n.top + n.height / 2
|
|
220
|
+
};
|
|
221
|
+
z(b), S && H(
|
|
222
|
+
dt(b, i, R, C)
|
|
223
|
+
);
|
|
189
224
|
};
|
|
190
|
-
|
|
191
|
-
const
|
|
225
|
+
t(), window.addEventListener("resize", t), window.addEventListener("scroll", t, !0);
|
|
226
|
+
const B = window.setInterval(t, 120);
|
|
192
227
|
return () => {
|
|
193
|
-
window.removeEventListener("resize",
|
|
228
|
+
window.removeEventListener("resize", t), window.removeEventListener("scroll", t, !0), window.clearInterval(B);
|
|
194
229
|
};
|
|
195
|
-
}, [
|
|
230
|
+
}, [d, S, R, i, C]), c.useEffect(() => {
|
|
231
|
+
if (!d || !T)
|
|
232
|
+
return;
|
|
233
|
+
const t = document.getElementById(d);
|
|
234
|
+
if (!t)
|
|
235
|
+
return;
|
|
236
|
+
const B = t.style.outline, v = t.style.outlineOffset, n = t.style.borderRadius, b = t.style.position, ot = t.style.zIndex, rt = window.getComputedStyle(t).borderRadius;
|
|
237
|
+
return t.style.outline = `${Math.max(L, 0)}px solid rgba(0, 166, 110, 0.35)`, t.style.outlineOffset = "0px", t.style.borderRadius = rt, b || (t.style.position = "relative"), t.style.zIndex = String(h + 1), () => {
|
|
238
|
+
t.style.outline = B, t.style.outlineOffset = v, t.style.borderRadius = n, t.style.position = b, t.style.zIndex = ot;
|
|
239
|
+
};
|
|
240
|
+
}, [d, T, L, h]);
|
|
241
|
+
const Q = c.useCallback(
|
|
242
|
+
(t) => {
|
|
243
|
+
typeof p == "function" ? p(t) : p && typeof p == "object" && (p.current = t);
|
|
244
|
+
},
|
|
245
|
+
[p]
|
|
246
|
+
), U = typeof E == "number" ? E : h - 1, g = S ? K : i, O = Z || (typeof document < "u" ? document.body : null), tt = /* @__PURE__ */ a(
|
|
196
247
|
"div",
|
|
197
248
|
{
|
|
198
|
-
ref:
|
|
249
|
+
ref: Q,
|
|
199
250
|
role: "dialog",
|
|
200
251
|
"aria-modal": "false",
|
|
201
|
-
"aria-labelledby":
|
|
202
|
-
"aria-describedby":
|
|
203
|
-
className:
|
|
252
|
+
"aria-labelledby": W,
|
|
253
|
+
"aria-describedby": X,
|
|
254
|
+
className: _,
|
|
204
255
|
style: {
|
|
205
|
-
zIndex:
|
|
206
|
-
...
|
|
207
|
-
...
|
|
256
|
+
zIndex: h,
|
|
257
|
+
...d && Y ? lt(Y, g, R) : { position: "absolute", ...st[g] },
|
|
258
|
+
...G
|
|
208
259
|
},
|
|
209
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ f(
|
|
210
261
|
"div",
|
|
211
262
|
{
|
|
212
263
|
style: {
|
|
213
|
-
...
|
|
214
|
-
width:
|
|
215
|
-
minHeight:
|
|
216
|
-
background:
|
|
217
|
-
border: `0.5px solid ${
|
|
264
|
+
...ft,
|
|
265
|
+
width: $,
|
|
266
|
+
minHeight: k,
|
|
267
|
+
background: x,
|
|
268
|
+
border: `0.5px solid ${m}`
|
|
218
269
|
},
|
|
219
270
|
children: [
|
|
220
|
-
|
|
221
|
-
/* @__PURE__ */
|
|
271
|
+
A && /* @__PURE__ */ f(F, { children: [
|
|
272
|
+
/* @__PURE__ */ a(
|
|
222
273
|
"span",
|
|
223
274
|
{
|
|
224
275
|
style: {
|
|
225
276
|
position: "absolute",
|
|
226
277
|
width: 0,
|
|
227
278
|
height: 0,
|
|
228
|
-
...
|
|
279
|
+
...gt[g]
|
|
229
280
|
}
|
|
230
281
|
}
|
|
231
282
|
),
|
|
232
|
-
/* @__PURE__ */
|
|
283
|
+
/* @__PURE__ */ a(
|
|
233
284
|
"span",
|
|
234
285
|
{
|
|
235
286
|
style: {
|
|
236
287
|
position: "absolute",
|
|
237
288
|
width: 0,
|
|
238
289
|
height: 0,
|
|
239
|
-
...
|
|
290
|
+
...vt[g]
|
|
240
291
|
}
|
|
241
292
|
}
|
|
242
293
|
)
|
|
243
294
|
] }),
|
|
244
|
-
/* @__PURE__ */
|
|
245
|
-
/* @__PURE__ */
|
|
246
|
-
/* @__PURE__ */
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
|
|
295
|
+
/* @__PURE__ */ f("div", { style: pt, children: [
|
|
296
|
+
/* @__PURE__ */ a("h3", { id: W, style: ct, children: r }),
|
|
297
|
+
/* @__PURE__ */ a("p", { id: X, style: ut, children: o }),
|
|
298
|
+
/* @__PURE__ */ f("div", { style: bt, children: [
|
|
299
|
+
/* @__PURE__ */ f("span", { "aria-label": `Step ${s} of ${u}`, style: xt, children: [
|
|
300
|
+
s,
|
|
250
301
|
" of ",
|
|
251
|
-
|
|
302
|
+
u
|
|
252
303
|
] }),
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */
|
|
304
|
+
/* @__PURE__ */ f("div", { style: mt, children: [
|
|
305
|
+
/* @__PURE__ */ a(
|
|
255
306
|
"button",
|
|
256
307
|
{
|
|
257
308
|
type: "button",
|
|
258
|
-
onClick:
|
|
309
|
+
onClick: l,
|
|
259
310
|
"aria-label": "Skip tour",
|
|
260
|
-
style:
|
|
261
|
-
children:
|
|
311
|
+
style: yt,
|
|
312
|
+
children: J
|
|
262
313
|
}
|
|
263
314
|
),
|
|
264
|
-
/* @__PURE__ */
|
|
315
|
+
/* @__PURE__ */ a(
|
|
265
316
|
"button",
|
|
266
317
|
{
|
|
267
318
|
type: "button",
|
|
268
|
-
onClick:
|
|
269
|
-
"aria-label": `Go to next step (${
|
|
270
|
-
style:
|
|
271
|
-
children:
|
|
319
|
+
onClick: w,
|
|
320
|
+
"aria-label": `Go to next step (${s + 1} of ${u})`,
|
|
321
|
+
style: ht,
|
|
322
|
+
children: q
|
|
272
323
|
}
|
|
273
324
|
)
|
|
274
325
|
] })
|
|
@@ -278,9 +329,28 @@ const D = {
|
|
|
278
329
|
}
|
|
279
330
|
)
|
|
280
331
|
}
|
|
281
|
-
)
|
|
332
|
+
), et = N ? /* @__PURE__ */ a(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
className: P,
|
|
336
|
+
"aria-hidden": "true",
|
|
337
|
+
style: {
|
|
338
|
+
position: "fixed",
|
|
339
|
+
inset: 0,
|
|
340
|
+
zIndex: U,
|
|
341
|
+
background: `rgba(0, 0, 0, ${j})`,
|
|
342
|
+
backdropFilter: y ? `blur(${y}px)` : void 0,
|
|
343
|
+
WebkitBackdropFilter: y ? `blur(${y}px)` : void 0,
|
|
344
|
+
...M
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
) : null, D = /* @__PURE__ */ f(F, { children: [
|
|
348
|
+
et,
|
|
349
|
+
tt
|
|
350
|
+
] });
|
|
351
|
+
return V && O ? it(D, O) : D;
|
|
282
352
|
});
|
|
283
353
|
export {
|
|
284
|
-
|
|
354
|
+
Bt as T
|
|
285
355
|
};
|
|
286
356
|
//# sourceMappingURL=TourGuideTooltip.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourGuideTooltip.es.js","sources":["../src/components/common/TourGuideTooltip.jsx"],"sourcesContent":["import React, { forwardRef, useId } from \"react\";\n\nconst CARD_W = 230;\nconst CARD_MIN_H = 141;\nconst BASE_BG = \"var(--Grey-Hover, #F3F7F7)\";\nconst BASE_BORDER = \"var(--Grey-absent, #D9D9D9)\";\n\nconst wrapperStyleByPosition = {\n top: { left: \"50%\", bottom: \"100%\", transform: \"translateX(-50%)\" },\n bottom: { left: \"50%\", top: \"100%\", transform: \"translateX(-50%)\" },\n left: { top: \"50%\", right: \"100%\", transform: \"translateY(-50%)\" },\n right: { top: \"50%\", left: \"100%\", transform: \"translateY(-50%)\" },\n};\n\nfunction getFixedPositionStyle(rect, position, gap) {\n if (position === \"left\") {\n return {\n position: \"fixed\",\n left: rect.left,\n top: rect.centerY,\n transform: `translate(calc(-100% - ${gap}px), -50%)`,\n };\n }\n\n if (position === \"right\") {\n return {\n position: \"fixed\",\n left: rect.right,\n top: rect.centerY,\n transform: `translate(${gap}px, -50%)`,\n };\n }\n\n if (position === \"top\") {\n return {\n position: \"fixed\",\n left: rect.centerX,\n top: rect.top,\n transform: `translate(-50%, calc(-100% - ${gap}px))`,\n };\n }\n\n return {\n position: \"fixed\",\n left: rect.centerX,\n top: rect.bottom,\n transform: `translate(-50%, ${gap}px)`,\n };\n}\n\nconst cardStyle = {\n position: \"relative\",\n borderRadius: 12,\n boxShadow: \"0 2px 2px rgba(0, 0, 0, 0.25)\",\n overflow: \"visible\",\n fontFamily: \"Varta, var(--font-sans, sans-serif)\",\n};\n\nconst contentStyle = {\n display: \"flex\",\n flexDirection: \"column\",\n padding: \"18px 20px 14px 20px\",\n};\n\nconst titleStyle = {\n margin: 0,\n fontSize: 14,\n lineHeight: \"16px\",\n fontWeight: 600,\n color: \"var(--text-ink, #2e3236)\",\n};\n\nconst descriptionStyle = {\n margin: \"12px 0 0 0\",\n fontSize: 13,\n lineHeight: 1.45,\n fontWeight: 400,\n color: \"var(--text-muted, #808183)\",\n wordBreak: \"break-word\",\n};\n\nconst footerStyle = {\n marginTop: 12,\n height: 28,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n};\n\nconst stepStyle = {\n fontSize: 12,\n lineHeight: \"14px\",\n fontWeight: 300,\n color: \"var(--text-ink, #2e3236)\",\n};\n\nconst actionsStyle = {\n display: \"flex\",\n alignItems: \"center\",\n gap: 4,\n};\n\nconst skipButtonStyle = {\n height: 28,\n border: \"none\",\n borderRadius: 10,\n fontSize: 13,\n cursor: \"pointer\",\n background: \"transparent\",\n color: \"var(--text-ink, #2e3236)\",\n fontWeight: 400,\n padding: \"0 10px\",\n};\n\nconst nextButtonStyle = {\n height: 28,\n border: \"none\",\n borderRadius: 10,\n fontSize: 13,\n cursor: \"pointer\",\n background: \"#00a66e\",\n color: \"#ffffff\",\n fontWeight: 700,\n padding: \"0 16px\",\n};\n\nconst arrowOuterByPosition = {\n left: {\n top: \"50%\",\n right: -11,\n transform: \"translateY(-50%)\",\n borderTop: \"10px solid transparent\",\n borderBottom: \"10px solid transparent\",\n borderLeft: `11px solid ${BASE_BORDER}`,\n },\n right: {\n top: \"50%\",\n left: -11,\n transform: \"translateY(-50%)\",\n borderTop: \"10px solid transparent\",\n borderBottom: \"10px solid transparent\",\n borderRight: `11px solid ${BASE_BORDER}`,\n },\n top: {\n left: \"50%\",\n bottom: -11,\n transform: \"translateX(-50%)\",\n borderLeft: \"10px solid transparent\",\n borderRight: \"10px solid transparent\",\n borderTop: `11px solid ${BASE_BORDER}`,\n },\n bottom: {\n left: \"50%\",\n top: -11,\n transform: \"translateX(-50%)\",\n borderLeft: \"10px solid transparent\",\n borderRight: \"10px solid transparent\",\n borderBottom: `11px solid ${BASE_BORDER}`,\n },\n};\n\nconst arrowInnerByPosition = {\n left: {\n top: \"50%\",\n right: -10,\n transform: \"translateY(-50%)\",\n borderTop: \"9px solid transparent\",\n borderBottom: \"9px solid transparent\",\n borderLeft: `10px solid ${BASE_BG}`,\n },\n right: {\n top: \"50%\",\n left: -10,\n transform: \"translateY(-50%)\",\n borderTop: \"9px solid transparent\",\n borderBottom: \"9px solid transparent\",\n borderRight: `10px solid ${BASE_BG}`,\n },\n top: {\n left: \"50%\",\n bottom: -10,\n transform: \"translateX(-50%)\",\n borderLeft: \"9px solid transparent\",\n borderRight: \"9px solid transparent\",\n borderTop: `10px solid ${BASE_BG}`,\n },\n bottom: {\n left: \"50%\",\n top: -10,\n transform: \"translateX(-50%)\",\n borderLeft: \"9px solid transparent\",\n borderRight: \"9px solid transparent\",\n borderBottom: `10px solid ${BASE_BG}`,\n },\n};\n\nconst TourGuideTooltip = forwardRef(function TourGuideTooltip(\n {\n title,\n description,\n step,\n total,\n onNext,\n onSkip,\n position = \"left\",\n className = \"\",\n style,\n showArrow = true,\n anchorId,\n gap = 8,\n },\n ref\n) {\n const titleId = useId();\n const descriptionId = useId();\n const [anchorRect, setAnchorRect] = React.useState(null);\n\n React.useEffect(() => {\n if (!anchorId) return undefined;\n\n const updateRect = () => {\n const target = document.getElementById(anchorId);\n if (!target) {\n setAnchorRect(null);\n return;\n }\n const rect = target.getBoundingClientRect();\n setAnchorRect({\n left: rect.left,\n right: rect.right,\n top: rect.top,\n bottom: rect.bottom,\n centerX: rect.left + rect.width / 2,\n centerY: rect.top + rect.height / 2,\n });\n };\n\n updateRect();\n window.addEventListener(\"resize\", updateRect);\n window.addEventListener(\"scroll\", updateRect, true);\n const timer = window.setInterval(updateRect, 120);\n\n return () => {\n window.removeEventListener(\"resize\", updateRect);\n window.removeEventListener(\"scroll\", updateRect, true);\n window.clearInterval(timer);\n };\n }, [anchorId]);\n\n return (\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"false\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n className={className}\n style={{\n zIndex: 1100,\n ...(anchorId && anchorRect\n ? getFixedPositionStyle(anchorRect, position, gap)\n : { position: \"absolute\", ...wrapperStyleByPosition[position] }),\n ...style,\n }}\n >\n <div\n style={{\n ...cardStyle,\n width: CARD_W,\n minHeight: CARD_MIN_H,\n background: BASE_BG,\n border: `0.5px solid ${BASE_BORDER}`,\n }}\n >\n {showArrow && (\n <>\n <span\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n ...arrowOuterByPosition[position],\n }}\n />\n <span\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n ...arrowInnerByPosition[position],\n }}\n />\n </>\n )}\n\n <div style={contentStyle}>\n <h3 id={titleId} style={titleStyle}>\n {title}\n </h3>\n\n <p id={descriptionId} style={descriptionStyle}>\n {description}\n </p>\n\n <div style={footerStyle}>\n <span aria-label={`Step ${step} of ${total}`} style={stepStyle}>\n {step} of {total}\n </span>\n\n <div style={actionsStyle}>\n <button\n type=\"button\"\n onClick={onSkip}\n aria-label=\"Skip tour\"\n style={skipButtonStyle}\n >\n Skip\n </button>\n\n <button\n type=\"button\"\n onClick={onNext}\n aria-label={`Go to next step (${step + 1} of ${total})`}\n style={nextButtonStyle}\n >\n Next\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n});\n\nexport default TourGuideTooltip;\n\n"],"names":["CARD_W","CARD_MIN_H","BASE_BG","BASE_BORDER","wrapperStyleByPosition","getFixedPositionStyle","rect","position","gap","cardStyle","contentStyle","titleStyle","descriptionStyle","footerStyle","stepStyle","actionsStyle","skipButtonStyle","nextButtonStyle","arrowOuterByPosition","arrowInnerByPosition","TourGuideTooltip","forwardRef","title","description","step","total","onNext","onSkip","className","style","showArrow","anchorId","ref","titleId","useId","descriptionId","anchorRect","setAnchorRect","React","updateRect","target","timer","jsx","jsxs","Fragment"],"mappings":";;AAEA,MAAMA,IAAS,KACTC,IAAa,KACbC,IAAU,8BACVC,IAAc,+BAEdC,IAAyB;AAAA,EAC7B,KAAK,EAAE,MAAM,OAAO,QAAQ,QAAQ,WAAW,mBAAmB;AAAA,EAClE,QAAQ,EAAE,MAAM,OAAO,KAAK,QAAQ,WAAW,mBAAmB;AAAA,EAClE,MAAM,EAAE,KAAK,OAAO,OAAO,QAAQ,WAAW,mBAAmB;AAAA,EACjE,OA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AA,kBAClC;AAAA,gBAAA;AAAA,cACF;AAAA,YAAA,GACF;AAAA,YAGF,gBAAAoC,EAAC,OAAI,EAAA,OAAOjC,GACV,UAAA;AAAA,cAAA,gBAAAgC,EAAC,MAAG,EAAA,IAAIT,GAAS,OAAOtB,GACrB,UACHW,GAAA;AAAA,gCAEC,KAAE,EAAA,IAAIa,GAAe,OAAOvB,GAC1B,UACHW,GAAA;AAAA,cAEA,gBAAAoB,EAAC,OAAI,EAAA,OAAO9B,GACV,UAAA;AAAA,gBAAC,gBAAA8B,EAAA,QAAA,EAAK,cAAY,QAAQnB,CAAI,OAAOC,CAAK,IAAI,OAAOX,GAClD,UAAA;AAAA,kBAAAU;AAAA,kBAAK;AAAA,kBAAKC;AAAA,gBAAA,GACb;AAAA,gBAEA,gBAAAkB,EAAC,OAAI,EAAA,OAAO5B,GACV,UAAA;AAAA,kBAAA,gBAAA2B;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,MAAK;AAAA,sBACL,SAASf;AAAA,sBACT,cAAW;AAAA,sBACX,OAAOX;AAAA,sBACR,UAAA;AAAA,oBAAA;AAAA,kBAED;AAAA,kBAEE,gBAAA0B;AAAA,oBAAC;AAAA,oBAAA;AAAA,sBACC,MAAK;AAAA,sBACL,SAAShB;AAAA,sBACT,cAAY,oBAAoBF,IAAO,CAAC,OAAOC,CAAK;AAAA,sBACpD,OAAOR;AAAA,sBACR,UAAA;AAAA,oBAAA;AAAA,kBAED;AAAA,gBAAA,GACJ;AAAA,cAAA,GACF;AAAA,YAAA,GACF;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|
|
1
|
+
{"version":3,"file":"TourGuideTooltip.es.js","sources":["../src/components/common/TourGuideTooltip.jsx"],"sourcesContent":["import React, { forwardRef, useId } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nconst CARD_W = 230;\nconst CARD_MIN_H = 141;\nconst BASE_BG = \"var(--Grey-Hover, #F3F7F7)\";\nconst BASE_BORDER = \"var(--Grey-absent, #D9D9D9)\";\n\nconst wrapperStyleByPosition = {\n top: { left: \"50%\", bottom: \"100%\", transform: \"translateX(-50%)\" },\n bottom: { left: \"50%\", top: \"100%\", transform: \"translateX(-50%)\" },\n left: { top: \"50%\", right: \"100%\", transform: \"translateY(-50%)\" },\n right: { top: \"50%\", left: \"100%\", transform: \"translateY(-50%)\" },\n};\n\nfunction getFixedPositionStyle(rect, position, gap) {\n if (position === \"left\") {\n return {\n position: \"fixed\",\n left: rect.left,\n top: rect.centerY,\n transform: `translate(calc(-100% - ${gap}px), -50%)`,\n };\n }\n\n if (position === \"right\") {\n return {\n position: \"fixed\",\n left: rect.right,\n top: rect.centerY,\n transform: `translate(${gap}px, -50%)`,\n };\n }\n\n if (position === \"top\") {\n return {\n position: \"fixed\",\n left: rect.centerX,\n top: rect.top,\n transform: `translate(-50%, calc(-100% - ${gap}px))`,\n };\n }\n\n return {\n position: \"fixed\",\n left: rect.centerX,\n top: rect.bottom,\n transform: `translate(-50%, ${gap}px)`,\n };\n}\n\nfunction getFallbackPosition(position) {\n if (position === \"left\") return \"right\";\n if (position === \"right\") return \"left\";\n if (position === \"top\") return \"bottom\";\n return \"top\";\n}\n\nfunction getBestPosition(rect, preferredPosition, gap, viewportPadding) {\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n const fits = {\n left: rect.left >= CARD_W + gap + viewportPadding,\n right: viewportWidth - rect.right >= CARD_W + gap + viewportPadding,\n top: rect.top >= CARD_MIN_H + gap + viewportPadding,\n bottom: viewportHeight - rect.bottom >= CARD_MIN_H + gap + viewportPadding,\n };\n\n if (fits[preferredPosition]) return preferredPosition;\n const opposite = getFallbackPosition(preferredPosition);\n if (fits[opposite]) return opposite;\n if (fits.right) return \"right\";\n if (fits.left) return \"left\";\n if (fits.bottom) return \"bottom\";\n if (fits.top) return \"top\";\n return preferredPosition;\n}\n\nconst cardStyle = {\n position: \"relative\",\n borderRadius: 12,\n boxShadow: \"0 2px 2px rgba(0, 0, 0, 0.25)\",\n overflow: \"visible\",\n fontFamily: \"Varta, var(--font-sans, sans-serif)\",\n};\n\nconst contentStyle = {\n display: \"flex\",\n flexDirection: \"column\",\n padding: \"18px 20px 14px 20px\",\n};\n\nconst titleStyle = {\n margin: 0,\n fontSize: 14,\n lineHeight: \"16px\",\n fontWeight: 600,\n color: \"var(--text-ink, #2e3236)\",\n};\n\nconst descriptionStyle = {\n margin: \"12px 0 0 0\",\n fontSize: 13,\n lineHeight: 1.45,\n fontWeight: 400,\n color: \"var(--text-muted, #808183)\",\n wordBreak: \"break-word\",\n};\n\nconst footerStyle = {\n marginTop: 12,\n height: 28,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"space-between\",\n};\n\nconst stepStyle = {\n fontSize: 12,\n lineHeight: \"14px\",\n fontWeight: 300,\n color: \"var(--text-ink, #2e3236)\",\n};\n\nconst actionsStyle = {\n display: \"flex\",\n alignItems: \"center\",\n gap: 4,\n};\n\nconst skipButtonStyle = {\n height: 28,\n border: \"none\",\n borderRadius: 10,\n fontSize: 13,\n cursor: \"pointer\",\n background: \"transparent\",\n color: \"var(--text-ink, #2e3236)\",\n fontWeight: 400,\n padding: \"0 10px\",\n};\n\nconst nextButtonStyle = {\n height: 28,\n border: \"none\",\n borderRadius: 10,\n fontSize: 13,\n cursor: \"pointer\",\n background: \"#00a66e\",\n color: \"#ffffff\",\n fontWeight: 700,\n padding: \"0 16px\",\n};\n\nconst arrowOuterByPosition = {\n left: {\n top: \"50%\",\n right: -11,\n transform: \"translateY(-50%)\",\n borderTop: \"10px solid transparent\",\n borderBottom: \"10px solid transparent\",\n borderLeft: `11px solid ${BASE_BORDER}`,\n },\n right: {\n top: \"50%\",\n left: -11,\n transform: \"translateY(-50%)\",\n borderTop: \"10px solid transparent\",\n borderBottom: \"10px solid transparent\",\n borderRight: `11px solid ${BASE_BORDER}`,\n },\n top: {\n left: \"50%\",\n bottom: -11,\n transform: \"translateX(-50%)\",\n borderLeft: \"10px solid transparent\",\n borderRight: \"10px solid transparent\",\n borderTop: `11px solid ${BASE_BORDER}`,\n },\n bottom: {\n left: \"50%\",\n top: -11,\n transform: \"translateX(-50%)\",\n borderLeft: \"10px solid transparent\",\n borderRight: \"10px solid transparent\",\n borderBottom: `11px solid ${BASE_BORDER}`,\n },\n};\n\nconst arrowInnerByPosition = {\n left: {\n top: \"50%\",\n right: -10,\n transform: \"translateY(-50%)\",\n borderTop: \"9px solid transparent\",\n borderBottom: \"9px solid transparent\",\n borderLeft: `10px solid ${BASE_BG}`,\n },\n right: {\n top: \"50%\",\n left: -10,\n transform: \"translateY(-50%)\",\n borderTop: \"9px solid transparent\",\n borderBottom: \"9px solid transparent\",\n borderRight: `10px solid ${BASE_BG}`,\n },\n top: {\n left: \"50%\",\n bottom: -10,\n transform: \"translateX(-50%)\",\n borderLeft: \"9px solid transparent\",\n borderRight: \"9px solid transparent\",\n borderTop: `10px solid ${BASE_BG}`,\n },\n bottom: {\n left: \"50%\",\n top: -10,\n transform: \"translateX(-50%)\",\n borderLeft: \"9px solid transparent\",\n borderRight: \"9px solid transparent\",\n borderBottom: `10px solid ${BASE_BG}`,\n },\n};\n\nconst TourGuideTooltip = forwardRef(function TourGuideTooltip(\n {\n title,\n description,\n step,\n total,\n onNext,\n onSkip,\n position = \"left\",\n className = \"\",\n style,\n showArrow = true,\n anchorId,\n gap = 8,\n showBackdrop = false,\n backdropBlur = 0,\n backdropOpacity = 0.2,\n backdropClassName = \"\",\n backdropStyle,\n usePortal = false,\n portalContainer,\n zIndex = 1100,\n backdropZIndex,\n highlightAnchor = false,\n highlightPadding = 6,\n autoFlip = false,\n viewportPadding = 12,\n nextLabel = \"Next\",\n skipLabel = \"Skip\",\n },\n ref\n) {\n const titleId = useId();\n const descriptionId = useId();\n const [anchorRect, setAnchorRect] = React.useState(null);\n const [activePosition, setActivePosition] = React.useState(position);\n\n React.useEffect(() => {\n setActivePosition(position);\n }, [position]);\n\n React.useEffect(() => {\n if (!anchorId) return undefined;\n\n const updateRect = () => {\n const target = document.getElementById(anchorId);\n if (!target) {\n setAnchorRect(null);\n return;\n }\n const rect = target.getBoundingClientRect();\n const nextRect = {\n left: rect.left,\n right: rect.right,\n top: rect.top,\n bottom: rect.bottom,\n centerX: rect.left + rect.width / 2,\n centerY: rect.top + rect.height / 2,\n };\n setAnchorRect(nextRect);\n if (autoFlip) {\n setActivePosition(\n getBestPosition(nextRect, position, gap, viewportPadding)\n );\n }\n };\n\n updateRect();\n window.addEventListener(\"resize\", updateRect);\n window.addEventListener(\"scroll\", updateRect, true);\n const timer = window.setInterval(updateRect, 120);\n\n return () => {\n window.removeEventListener(\"resize\", updateRect);\n window.removeEventListener(\"scroll\", updateRect, true);\n window.clearInterval(timer);\n };\n }, [anchorId, autoFlip, gap, position, viewportPadding]);\n\n React.useEffect(() => {\n if (!anchorId || !highlightAnchor) return undefined;\n\n const target = document.getElementById(anchorId);\n if (!target) return undefined;\n\n const previousOutline = target.style.outline;\n const previousOutlineOffset = target.style.outlineOffset;\n const previousBorderRadius = target.style.borderRadius;\n const previousPosition = target.style.position;\n const previousZIndex = target.style.zIndex;\n const computedBorderRadius = window.getComputedStyle(target).borderRadius;\n\n target.style.outline = `${Math.max(highlightPadding, 0)}px solid rgba(0, 166, 110, 0.35)`;\n target.style.outlineOffset = \"0px\";\n target.style.borderRadius = computedBorderRadius;\n if (!previousPosition) target.style.position = \"relative\";\n target.style.zIndex = String(zIndex + 1);\n\n return () => {\n target.style.outline = previousOutline;\n target.style.outlineOffset = previousOutlineOffset;\n target.style.borderRadius = previousBorderRadius;\n target.style.position = previousPosition;\n target.style.zIndex = previousZIndex;\n };\n }, [anchorId, highlightAnchor, highlightPadding, zIndex]);\n\n const setRefs = React.useCallback(\n (node) => {\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref && typeof ref === \"object\") {\n ref.current = node;\n }\n },\n [ref]\n );\n\n const resolvedBackdropZIndex =\n typeof backdropZIndex === \"number\" ? backdropZIndex : zIndex - 1;\n const resolvedPosition = autoFlip ? activePosition : position;\n const resolvedPortalContainer =\n portalContainer ||\n (typeof document !== \"undefined\" ? document.body : null);\n\n const tooltipNode = (\n <div\n ref={setRefs}\n role=\"dialog\"\n aria-modal=\"false\"\n aria-labelledby={titleId}\n aria-describedby={descriptionId}\n className={className}\n style={{\n zIndex,\n ...(anchorId && anchorRect\n ? getFixedPositionStyle(anchorRect, resolvedPosition, gap)\n : { position: \"absolute\", ...wrapperStyleByPosition[resolvedPosition] }),\n ...style,\n }}\n >\n <div\n style={{\n ...cardStyle,\n width: CARD_W,\n minHeight: CARD_MIN_H,\n background: BASE_BG,\n border: `0.5px solid ${BASE_BORDER}`,\n }}\n >\n {showArrow && (\n <>\n <span\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n ...arrowOuterByPosition[resolvedPosition],\n }}\n />\n <span\n style={{\n position: \"absolute\",\n width: 0,\n height: 0,\n ...arrowInnerByPosition[resolvedPosition],\n }}\n />\n </>\n )}\n\n <div style={contentStyle}>\n <h3 id={titleId} style={titleStyle}>\n {title}\n </h3>\n\n <p id={descriptionId} style={descriptionStyle}>\n {description}\n </p>\n\n <div style={footerStyle}>\n <span aria-label={`Step ${step} of ${total}`} style={stepStyle}>\n {step} of {total}\n </span>\n\n <div style={actionsStyle}>\n <button\n type=\"button\"\n onClick={onSkip}\n aria-label=\"Skip tour\"\n style={skipButtonStyle}\n >\n {skipLabel}\n </button>\n\n <button\n type=\"button\"\n onClick={onNext}\n aria-label={`Go to next step (${step + 1} of ${total})`}\n style={nextButtonStyle}\n >\n {nextLabel}\n </button>\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n\n const backdropNode = showBackdrop ? (\n <div\n className={backdropClassName}\n aria-hidden=\"true\"\n style={{\n position: \"fixed\",\n inset: 0,\n zIndex: resolvedBackdropZIndex,\n background: `rgba(0, 0, 0, ${backdropOpacity})`,\n backdropFilter: backdropBlur ? `blur(${backdropBlur}px)` : undefined,\n WebkitBackdropFilter: backdropBlur\n ? `blur(${backdropBlur}px)`\n : undefined,\n ...backdropStyle,\n }}\n />\n ) : null;\n\n const content = (\n <>\n {backdropNode}\n {tooltipNode}\n </>\n );\n\n if (usePortal && resolvedPortalContainer) {\n return createPortal(content, resolvedPortalContainer);\n }\n\n return content;\n});\n\nexport default TourGuideTooltip;\n\n"],"names":["CARD_W","CARD_MIN_H","BASE_BG","BASE_BORDER","wrapperStyleByPosition","getFixedPositionStyle","rect","position","gap","getFallbackPosition","getBestPosition","preferredPosition","viewportPadding","viewportWidth","viewportHeight","fits","opposite","cardStyle","contentStyle","titleStyle","descriptionStyle","footerStyle","stepStyle","actionsStyle","skipButtonStyle","nextButtonStyle","arrowOuterByPosition","arrowInnerByPosition","TourGuideTooltip","forwardRef","title","description","step","total","onNext","onSkip","className","style","showArrow","anchorId","showBackdrop","backdropBlur","backdropOpacity","backdropClassName","backdropStyle","usePortal","portalContainer","zIndex","backdropZIndex","highlightAnchor","highlightPadding","autoFlip","nextLabel","skipLabel","ref","titleId","useId","descriptionId","anchorRect","setAnchorRect","React","activePosition","setActivePosition","updateRect","target","nextRect","timer","previousOutline","previousOutlineOffset","previousBorderRadius","previousPosition","previousZIndex","computedBorderRadius","setRefs","node","resolvedBackdropZIndex","resolvedPosition","resolvedPortalContainer","tooltipNode","jsx","jsxs","Fragment","backdropNode","content","createPortal"],"mappings":";;;AAGA,MAAMA,IAAS,KACTC,IAAa,KACbC,IAAU,8BACVC,IAAc,+BAEdC,KAAyB;AAAA,EAC7B,KAAK,EAAE,MAAM,OAAO,QAAQ,QAAQ,WAAW,mBAAmB;AAAA,EAClE,QAAQ,EAAE,MAAM,OAAO,KAAK,QAAQ,WAAW,mBAAmB;AAAA,EAClE,MAAM,EAAE,KAAK,OAAO,OAAO,QAAQ,WAAW,mBAAmB;AAAA,EACjE,OAAO,EAAE,KAAK,OAAO,MAAM,QAAQ,WAAW,mBAAmB;AACnE;AAEA,SAASC,GAAsBC,GAAMC,GAAUC,GAAK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IAED,gBAAAH,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAAC;AAAA,IACAJ;AAAA,EACH,EAAA,CAAA;AAGF,SAAIjC,KAAagC,IACRO,GAAaD,GAASN,CAAuB,IAG/CM;AACT,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { forwardRef, useId } from "react";
|
|
2
|
+
import { createPortal } from "react-dom";
|
|
2
3
|
|
|
3
4
|
const CARD_W = 230;
|
|
4
5
|
const CARD_MIN_H = 141;
|
|
@@ -48,6 +49,33 @@ function getFixedPositionStyle(rect, position, gap) {
|
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
function getFallbackPosition(position) {
|
|
53
|
+
if (position === "left") return "right";
|
|
54
|
+
if (position === "right") return "left";
|
|
55
|
+
if (position === "top") return "bottom";
|
|
56
|
+
return "top";
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function getBestPosition(rect, preferredPosition, gap, viewportPadding) {
|
|
60
|
+
const viewportWidth = window.innerWidth;
|
|
61
|
+
const viewportHeight = window.innerHeight;
|
|
62
|
+
const fits = {
|
|
63
|
+
left: rect.left >= CARD_W + gap + viewportPadding,
|
|
64
|
+
right: viewportWidth - rect.right >= CARD_W + gap + viewportPadding,
|
|
65
|
+
top: rect.top >= CARD_MIN_H + gap + viewportPadding,
|
|
66
|
+
bottom: viewportHeight - rect.bottom >= CARD_MIN_H + gap + viewportPadding,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
if (fits[preferredPosition]) return preferredPosition;
|
|
70
|
+
const opposite = getFallbackPosition(preferredPosition);
|
|
71
|
+
if (fits[opposite]) return opposite;
|
|
72
|
+
if (fits.right) return "right";
|
|
73
|
+
if (fits.left) return "left";
|
|
74
|
+
if (fits.bottom) return "bottom";
|
|
75
|
+
if (fits.top) return "top";
|
|
76
|
+
return preferredPosition;
|
|
77
|
+
}
|
|
78
|
+
|
|
51
79
|
const cardStyle = {
|
|
52
80
|
position: "relative",
|
|
53
81
|
borderRadius: 12,
|
|
@@ -208,12 +236,32 @@ const TourGuideTooltip = forwardRef(function TourGuideTooltip(
|
|
|
208
236
|
showArrow = true,
|
|
209
237
|
anchorId,
|
|
210
238
|
gap = 8,
|
|
239
|
+
showBackdrop = false,
|
|
240
|
+
backdropBlur = 0,
|
|
241
|
+
backdropOpacity = 0.2,
|
|
242
|
+
backdropClassName = "",
|
|
243
|
+
backdropStyle,
|
|
244
|
+
usePortal = false,
|
|
245
|
+
portalContainer,
|
|
246
|
+
zIndex = 1100,
|
|
247
|
+
backdropZIndex,
|
|
248
|
+
highlightAnchor = false,
|
|
249
|
+
highlightPadding = 6,
|
|
250
|
+
autoFlip = false,
|
|
251
|
+
viewportPadding = 12,
|
|
252
|
+
nextLabel = "Next",
|
|
253
|
+
skipLabel = "Skip",
|
|
211
254
|
},
|
|
212
255
|
ref
|
|
213
256
|
) {
|
|
214
257
|
const titleId = useId();
|
|
215
258
|
const descriptionId = useId();
|
|
216
259
|
const [anchorRect, setAnchorRect] = React.useState(null);
|
|
260
|
+
const [activePosition, setActivePosition] = React.useState(position);
|
|
261
|
+
|
|
262
|
+
React.useEffect(() => {
|
|
263
|
+
setActivePosition(position);
|
|
264
|
+
}, [position]);
|
|
217
265
|
|
|
218
266
|
React.useEffect(() => {
|
|
219
267
|
if (!anchorId) return undefined;
|
|
@@ -225,14 +273,20 @@ const TourGuideTooltip = forwardRef(function TourGuideTooltip(
|
|
|
225
273
|
return;
|
|
226
274
|
}
|
|
227
275
|
const rect = target.getBoundingClientRect();
|
|
228
|
-
|
|
276
|
+
const nextRect = {
|
|
229
277
|
left: rect.left,
|
|
230
278
|
right: rect.right,
|
|
231
279
|
top: rect.top,
|
|
232
280
|
bottom: rect.bottom,
|
|
233
281
|
centerX: rect.left + rect.width / 2,
|
|
234
282
|
centerY: rect.top + rect.height / 2,
|
|
235
|
-
}
|
|
283
|
+
};
|
|
284
|
+
setAnchorRect(nextRect);
|
|
285
|
+
if (autoFlip) {
|
|
286
|
+
setActivePosition(
|
|
287
|
+
getBestPosition(nextRect, position, gap, viewportPadding)
|
|
288
|
+
);
|
|
289
|
+
}
|
|
236
290
|
};
|
|
237
291
|
|
|
238
292
|
updateRect();
|
|
@@ -245,21 +299,67 @@ const TourGuideTooltip = forwardRef(function TourGuideTooltip(
|
|
|
245
299
|
window.removeEventListener("scroll", updateRect, true);
|
|
246
300
|
window.clearInterval(timer);
|
|
247
301
|
};
|
|
248
|
-
}, [anchorId]);
|
|
302
|
+
}, [anchorId, autoFlip, gap, position, viewportPadding]);
|
|
303
|
+
|
|
304
|
+
React.useEffect(() => {
|
|
305
|
+
if (!anchorId || !highlightAnchor) return undefined;
|
|
306
|
+
|
|
307
|
+
const target = document.getElementById(anchorId);
|
|
308
|
+
if (!target) return undefined;
|
|
309
|
+
|
|
310
|
+
const previousOutline = target.style.outline;
|
|
311
|
+
const previousOutlineOffset = target.style.outlineOffset;
|
|
312
|
+
const previousBorderRadius = target.style.borderRadius;
|
|
313
|
+
const previousPosition = target.style.position;
|
|
314
|
+
const previousZIndex = target.style.zIndex;
|
|
315
|
+
const computedBorderRadius = window.getComputedStyle(target).borderRadius;
|
|
316
|
+
|
|
317
|
+
target.style.outline = `${Math.max(highlightPadding, 0)}px solid rgba(0, 166, 110, 0.35)`;
|
|
318
|
+
target.style.outlineOffset = "0px";
|
|
319
|
+
target.style.borderRadius = computedBorderRadius;
|
|
320
|
+
if (!previousPosition) target.style.position = "relative";
|
|
321
|
+
target.style.zIndex = String(zIndex + 1);
|
|
322
|
+
|
|
323
|
+
return () => {
|
|
324
|
+
target.style.outline = previousOutline;
|
|
325
|
+
target.style.outlineOffset = previousOutlineOffset;
|
|
326
|
+
target.style.borderRadius = previousBorderRadius;
|
|
327
|
+
target.style.position = previousPosition;
|
|
328
|
+
target.style.zIndex = previousZIndex;
|
|
329
|
+
};
|
|
330
|
+
}, [anchorId, highlightAnchor, highlightPadding, zIndex]);
|
|
249
331
|
|
|
250
|
-
|
|
332
|
+
const setRefs = React.useCallback(
|
|
333
|
+
(node) => {
|
|
334
|
+
if (typeof ref === "function") {
|
|
335
|
+
ref(node);
|
|
336
|
+
} else if (ref && typeof ref === "object") {
|
|
337
|
+
ref.current = node;
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
[ref]
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
const resolvedBackdropZIndex =
|
|
344
|
+
typeof backdropZIndex === "number" ? backdropZIndex : zIndex - 1;
|
|
345
|
+
const resolvedPosition = autoFlip ? activePosition : position;
|
|
346
|
+
const resolvedPortalContainer =
|
|
347
|
+
portalContainer ||
|
|
348
|
+
(typeof document !== "undefined" ? document.body : null);
|
|
349
|
+
|
|
350
|
+
const tooltipNode = (
|
|
251
351
|
<div
|
|
252
|
-
ref={
|
|
352
|
+
ref={setRefs}
|
|
253
353
|
role="dialog"
|
|
254
354
|
aria-modal="false"
|
|
255
355
|
aria-labelledby={titleId}
|
|
256
356
|
aria-describedby={descriptionId}
|
|
257
357
|
className={className}
|
|
258
358
|
style={{
|
|
259
|
-
zIndex
|
|
359
|
+
zIndex,
|
|
260
360
|
...(anchorId && anchorRect
|
|
261
|
-
? getFixedPositionStyle(anchorRect,
|
|
262
|
-
: { position: "absolute", ...wrapperStyleByPosition[
|
|
361
|
+
? getFixedPositionStyle(anchorRect, resolvedPosition, gap)
|
|
362
|
+
: { position: "absolute", ...wrapperStyleByPosition[resolvedPosition] }),
|
|
263
363
|
...style,
|
|
264
364
|
}}
|
|
265
365
|
>
|
|
@@ -279,7 +379,7 @@ const TourGuideTooltip = forwardRef(function TourGuideTooltip(
|
|
|
279
379
|
position: "absolute",
|
|
280
380
|
width: 0,
|
|
281
381
|
height: 0,
|
|
282
|
-
...arrowOuterByPosition[
|
|
382
|
+
...arrowOuterByPosition[resolvedPosition],
|
|
283
383
|
}}
|
|
284
384
|
/>
|
|
285
385
|
<span
|
|
@@ -287,7 +387,7 @@ const TourGuideTooltip = forwardRef(function TourGuideTooltip(
|
|
|
287
387
|
position: "absolute",
|
|
288
388
|
width: 0,
|
|
289
389
|
height: 0,
|
|
290
|
-
...arrowInnerByPosition[
|
|
390
|
+
...arrowInnerByPosition[resolvedPosition],
|
|
291
391
|
}}
|
|
292
392
|
/>
|
|
293
393
|
</>
|
|
@@ -314,23 +414,54 @@ const TourGuideTooltip = forwardRef(function TourGuideTooltip(
|
|
|
314
414
|
aria-label="Skip tour"
|
|
315
415
|
style={skipButtonStyle}
|
|
316
416
|
>
|
|
317
|
-
|
|
417
|
+
{skipLabel}
|
|
318
418
|
</button>
|
|
319
419
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
420
|
+
<button
|
|
421
|
+
type="button"
|
|
422
|
+
onClick={onNext}
|
|
423
|
+
aria-label={`Go to next step (${step + 1} of ${total})`}
|
|
424
|
+
style={nextButtonStyle}
|
|
425
|
+
>
|
|
426
|
+
{nextLabel}
|
|
427
|
+
</button>
|
|
328
428
|
</div>
|
|
329
429
|
</div>
|
|
330
430
|
</div>
|
|
331
431
|
</div>
|
|
332
432
|
</div>
|
|
333
433
|
);
|
|
434
|
+
|
|
435
|
+
const backdropNode = showBackdrop ? (
|
|
436
|
+
<div
|
|
437
|
+
className={backdropClassName}
|
|
438
|
+
aria-hidden="true"
|
|
439
|
+
style={{
|
|
440
|
+
position: "fixed",
|
|
441
|
+
inset: 0,
|
|
442
|
+
zIndex: resolvedBackdropZIndex,
|
|
443
|
+
background: `rgba(0, 0, 0, ${backdropOpacity})`,
|
|
444
|
+
backdropFilter: backdropBlur ? `blur(${backdropBlur}px)` : undefined,
|
|
445
|
+
WebkitBackdropFilter: backdropBlur
|
|
446
|
+
? `blur(${backdropBlur}px)`
|
|
447
|
+
: undefined,
|
|
448
|
+
...backdropStyle,
|
|
449
|
+
}}
|
|
450
|
+
/>
|
|
451
|
+
) : null;
|
|
452
|
+
|
|
453
|
+
const content = (
|
|
454
|
+
<>
|
|
455
|
+
{backdropNode}
|
|
456
|
+
{tooltipNode}
|
|
457
|
+
</>
|
|
458
|
+
);
|
|
459
|
+
|
|
460
|
+
if (usePortal && resolvedPortalContainer) {
|
|
461
|
+
return createPortal(content, resolvedPortalContainer);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return content;
|
|
334
465
|
});
|
|
335
466
|
|
|
336
467
|
export default TourGuideTooltip;
|
package/src/fonts/.DS_Store
DELETED
|
Binary file
|