@ebay/ui-core-react
Version:
Skin components build off React
2 lines (1 loc) • 1.97 kB
JavaScript
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("../tslib.es6-C4EgNkz1.js"),e=require("react"),a=require("../utils-C9NL3q0j.js"),n=require("../use-tooltip-CNTlgBVF.js"),R=require("classnames");require("../icon-CR8ApQBy.js");require("../array.polyfill.flat-5BAolFdk.js");const y=()=>null,h=()=>null,m=({index:t,children:r})=>e.createElement(e.Fragment,null,t!==void 0&&e.createElement("span",{className:"tourtip__index"},t),r),f=t=>{var{as:r,children:s,className:i}=t,o=p.__rest(t,["as","children","className"]);const l=r||"h2";return e.createElement(l,Object.assign({},o,{className:R("tourtip__heading",i)}),s)},j=t=>{var{a11yCloseText:r,"aria-label":s,className:i,children:o,onCollapse:l,onExpand:C,overlayStyle:g,pointer:_}=t,q=p.__rest(t,["a11yCloseText","aria-label","className","children","onCollapse","onExpand","overlayStyle","pointer"]);const c=e.useRef(null),{isExpanded:u,collapseTooltip:x}=n.useTooltip({onExpand:C,onCollapse:l,initialExpanded:!0,hostRef:c}),H=e.useRef(null),d=a.findComponent(o,y);if(!d)throw new Error("EbayTourtip: Please use a EbayTourtipContent that defines the content of the tourtip");const E=d.props,{children:N}=E,v=p.__rest(E,["children"]),T=a.findComponent(o,h);if(!T)throw new Error("EbayTourtip: Please use a EbayTourtipHost that defines the host of the tourtip");const w=a.findComponent(o,f),b=a.findComponent(o,m);return e.createElement(n.Tooltip,Object.assign({},q,{className:i,type:"tourtip",isExpanded:u,ref:H}),e.createElement(n.TooltipHost,Object.assign({},T.props,{forwardedRef:c,"aria-label":s,"aria-expanded":u})),e.createElement(n.TooltipContent,Object.assign({},v,{a11yCloseText:r,onClose:x,pointer:_,showCloseButton:!0,style:g,type:"tourtip"}),w,N,b&&e.createElement(n.TooltipFooter,{type:"tourtip"},b)))};exports.Tooltip=n.Tooltip;exports.EbayTourtip=j;exports.EbayTourtipContent=y;exports.EbayTourtipFooter=m;exports.EbayTourtipHeading=f;exports.EbayTourtipHost=h;
;