@storybook/components 7.0.0-alpha.4 → 7.0.0-alpha.7
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/{Color-IIYOK4US.mjs → Color-2PZ2QJCX.mjs} +1 -1
- package/dist/WithTooltip-BYJPBEBI.mjs +9 -0
- package/dist/chunk-CLJWDVHQ.mjs +149 -0
- package/dist/chunk-D3CRJ2DH.mjs +1 -0
- package/dist/{chunk-XFBIFQ3K.mjs → chunk-ZYYK3G2J.mjs} +2 -2
- package/dist/html.js +1 -1
- package/dist/html.mjs +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +122 -122
- package/dist/index.mjs +1 -1
- package/package.json +4 -4
- package/dist/WithTooltip-F6U4FHOQ.mjs +0 -9
- package/dist/chunk-AZCVBZVA.mjs +0 -149
- package/dist/chunk-XZM6YCLI.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as ia,A as C,Aa as Ja,B as F,Ba as Ka,C as G,Ca as La,D as H,Da as Ma,E as I,Ea as Na,F as J,Fa as Oa,G as O,Ga as Pa,H as Q,Ha as Qa,I as R,Ia as Ra,J as S,K as T,L as U,M as V,N as W,O as X,P as Y,Q as Z,R as _,S as $,T as aa,U as ba,V as ca,W as da,X as ea,Y as fa,Z as ga,_ as ha,a,aa as ja,b,ba as ka,c,ca as la,d as f,da as ma,e as g,ea as na,f as h,fa as oa,g as i,ga as pa,h as j,ha as qa,i as k,ia as ra,j as l,ja as sa,k as m,ka as ta,l as n,la as ua,m as o,ma as va,n as p,na as wa,o as q,oa as xa,p as r,pa as ya,q as s,qa as za,r as t,ra as Aa,s as u,sa as Ba,t as v,ta as Ca,u as w,ua as Da,v as x,va as Ea,w as y,wa as Fa,x as z,xa as Ga,y as A,ya as Ha,z as B,za as Ia}from"./chunk-
|
|
1
|
+
import{$ as ia,A as C,Aa as Ja,B as F,Ba as Ka,C as G,Ca as La,D as H,Da as Ma,E as I,Ea as Na,F as J,Fa as Oa,G as O,Ga as Pa,H as Q,Ha as Qa,I as R,Ia as Ra,J as S,K as T,L as U,M as V,N as W,O as X,P as Y,Q as Z,R as _,S as $,T as aa,U as ba,V as ca,W as da,X as ea,Y as fa,Z as ga,_ as ha,a,aa as ja,b,ba as ka,c,ca as la,d as f,da as ma,e as g,ea as na,f as h,fa as oa,g as i,ga as pa,h as j,ha as qa,i as k,ia as ra,j as l,ja as sa,k as m,ka as ta,l as n,la as ua,m as o,ma as va,n as p,na as wa,o as q,oa as xa,p as r,pa as ya,q as s,qa as za,r as t,ra as Aa,s as u,sa as Ba,t as v,ta as Ca,u as w,ua as Da,v as x,va as Ea,w as y,wa as Fa,x as z,xa as Ga,y as A,ya as Ha,z as B,za as Ia}from"./chunk-ZYYK3G2J.mjs";import{a as d,b as e}from"./chunk-EBKGXALM.mjs";import"./chunk-DF422II4.mjs";import"./chunk-WYLOY4EF.mjs";import"./chunk-7IK3EOFL.mjs";import{f as D,g as E,h as K,i as L,j as M,k as N,l as P}from"./chunk-CLJWDVHQ.mjs";import"./chunk-D3CRJ2DH.mjs";import"./chunk-PJYBQ6PQ.mjs";export{b as A,d as ActionBar,$ as AddonPanel,Ia as ArgsTable,Ga as ArgsTableError,C as Badge,R as Bar,c as Blockquote,qa as BooleanControl,K as Button,j as Code,Ea as ColorControl,Ma as ColorItem,Na as ColorPalette,l as DL,va as DateControl,ca as Description,k as Div,fa as DocsContent,ha as DocsPageWrapper,ga as DocsWrapper,G as DocumentWrapper,Da as FilesControl,S as FlexBar,L as Form,m as H1,n as H2,o as H3,p as H4,q as H5,r as H6,s as HR,ja as IFrame,U as IconButton,Pa as IconGallery,Oa as IconItem,D as Icons,t as Img,u as LI,F as Link,ka as Loader,Ka as NoControlsWarning,ya as NumberControl,v as OL,Aa as ObjectControl,za as OptionsControl,w as P,I as Placeholder,x as Pre,oa as Preview,pa as PreviewSkeleton,Ba as RangeControl,e as ScrollArea,Z as Separator,i as Source,h as SourceError,H as Spaced,y as Span,ma as Story,la as StoryError,na as StorySkeleton,ba as StorybookIcon,aa as StorybookLogo,g as StyledSyntaxHighlighter,ea as Subtitle,E as Symbols,f as SyntaxHighlighter,A as TT,V as TabBar,T as TabButton,W as TabWrapper,Ja as TabbedArgsTable,z as Table,Fa as TableWrapper,X as Tabs,Y as TabsState,Ca as TextControl,da as Title,Q as TooltipLinkList,O as TooltipMessage,P as TooltipNote,La as Typeset,B as UL,M as WithTooltip,N as WithTooltipPure,J as Zoom,Ha as argsTableLoadingData,Qa as components,xa as format,ta as formatDate,ua as formatTime,ia as getStoryHref,_ as interleaveSeparators,a as nameSpaceClassNames,wa as parse,ra as parseDate,sa as parseTime,Ra as resetComponents};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/components",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.7",
|
|
4
4
|
"description": "Core Storybook Components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"prepare": "esrun ../../scripts/prepare/bundle.ts"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@storybook/client-logger": "7.0.0-alpha.
|
|
53
|
+
"@storybook/client-logger": "7.0.0-alpha.7",
|
|
54
54
|
"@storybook/csf": "0.0.2--canary.4566f4d.1",
|
|
55
|
-
"@storybook/theming": "7.0.0-alpha.
|
|
55
|
+
"@storybook/theming": "7.0.0-alpha.7",
|
|
56
56
|
"core-js": "^3.8.2",
|
|
57
57
|
"memoizerific": "^1.11.3",
|
|
58
58
|
"qs": "^6.10.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"./src/index.ts",
|
|
93
93
|
"./src/html.tsx"
|
|
94
94
|
],
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "d334cabd251cd0ed8b845a87707dc84f007d4074"
|
|
96
96
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{b as ge}from"./chunk-WYLOY4EF.mjs";import{a as $e}from"./chunk-7IK3EOFL.mjs";import{a as O,c as Q,d as de}from"./chunk-XZM6YCLI.mjs";import{c as s,d as W,e as fe,f as K,h as d}from"./chunk-PJYBQ6PQ.mjs";var he=fe((ct,me)=>{d();var Fe=typeof Element<"u",Ye=typeof Map=="function",je=typeof Set=="function",Ve=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function V(t,r){if(t===r)return!0;if(t&&r&&typeof t=="object"&&typeof r=="object"){if(t.constructor!==r.constructor)return!1;var o,e,i;if(Array.isArray(t)){if(o=t.length,o!=r.length)return!1;for(e=o;e--!==0;)if(!V(t[e],r[e]))return!1;return!0}var a;if(Ye&&t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(a=t.entries();!(e=a.next()).done;)if(!r.has(e.value[0]))return!1;for(a=t.entries();!(e=a.next()).done;)if(!V(e.value[1],r.get(e.value[0])))return!1;return!0}if(je&&t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(a=t.entries();!(e=a.next()).done;)if(!r.has(e.value[0]))return!1;return!0}if(Ve&&ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if(o=t.length,o!=r.length)return!1;for(e=o;e--!==0;)if(t[e]!==r[e])return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if(i=Object.keys(t),o=i.length,o!==Object.keys(r).length)return!1;for(e=o;e--!==0;)if(!Object.prototype.hasOwnProperty.call(r,i[e]))return!1;if(Fe&&t instanceof Element)return!1;for(e=o;e--!==0;)if(!((i[e]==="_owner"||i[e]==="__v"||i[e]==="__o")&&t.$$typeof)&&!V(t[i[e]],r[i[e]]))return!1;return!0}return t!==t&&r!==r}s(V,"equal");me.exports=s(function(r,o){try{return V(r,o)}catch(e){if((e.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw e}},"isEqual")});var Ce=fe((Rt,Oe)=>{"use strict";d();var Je=process.env.NODE_ENV!=="production",Te=s(function(){},"warning");Je&&(ye=s(function(r,o){var e=arguments.length;o=new Array(e>1?e-1:0);for(var i=1;i<e;i++)o[i-1]=arguments[i];var a=0,u="Warning: "+r.replace(/%s/g,function(){return o[a++]});typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}},"printWarning"),Te=s(function(t,r,o){var e=arguments.length;o=new Array(e>2?e-2:0);for(var i=2;i<e;i++)o[i-2]=arguments[i];if(r===void 0)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");t||ye.apply(null,[r].concat(o))},"warning"));var ye;Oe.exports=Te});d();var Le=K($e());import z,{useCallback as ot,useState as nt,useEffect as it}from"react";import{styled as Be}from"@storybook/theming";d();import B,{Component as Se}from"react";import{createPortal as Ke}from"react-dom";d();d();import*as E from"react";d();import*as v from"react";var Z=v.createContext(),_=v.createContext();function ee(t){var r=t.children,o=v.useState(null),e=o[0],i=o[1],a=v.useRef(!1);v.useEffect(function(){return function(){a.current=!0}},[]);var u=v.useCallback(function(n){a.current||i(n)},[]);return v.createElement(Z.Provider,{value:e},v.createElement(_.Provider,{value:u},r))}s(ee,"Manager");d();import*as Y from"react";var j=s(function(r){return Array.isArray(r)?r[0]:r},"unwrapArray"),te=s(function(r){if(typeof r=="function"){for(var o=arguments.length,e=new Array(o>1?o-1:0),i=1;i<o;i++)e[i-1]=arguments[i];return r.apply(void 0,e)}},"safeInvoke"),D=s(function(r,o){if(typeof r=="function")return te(r,o);r!=null&&(r.current=o)},"setRef"),re=s(function(r){return r.reduce(function(o,e){var i=e[0],a=e[1];return o[i]=a,o},{})},"fromEntries"),oe=typeof window<"u"&&window.document&&window.document.createElement?Y.useLayoutEffect:Y.useEffect;d();import*as P from"react";import*as ve from"react-dom";var Re=K(he());var Xe=[],we=s(function(r,o,e){e===void 0&&(e={});var i=P.useRef(null),a={onFirstUpdate:e.onFirstUpdate,placement:e.placement||"bottom",strategy:e.strategy||"absolute",modifiers:e.modifiers||Xe},u=P.useState({styles:{popper:{position:a.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),n=u[0],l=u[1],c=P.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:s(function(h){var w=h.state,y=Object.keys(w.elements);ve.flushSync(function(){l({styles:re(y.map(function(R){return[R,w.styles[R]||{}]})),attributes:re(y.map(function(R){return[R,w.attributes[R]]}))})})},"fn"),requires:["computeStyles"]}},[]),p=P.useMemo(function(){var g={onFirstUpdate:a.onFirstUpdate,placement:a.placement,strategy:a.strategy,modifiers:[].concat(a.modifiers,[c,{name:"applyStyles",enabled:!1}])};return(0,Re.default)(i.current,g)?i.current||g:(i.current=g,g)},[a.onFirstUpdate,a.placement,a.strategy,a.modifiers,c]),f=P.useRef();return oe(function(){f.current&&f.current.setOptions(p)},[p]),oe(function(){if(!(r==null||o==null)){var g=e.createPopper||ge,h=g(r,o,p);return f.current=h,function(){h.destroy(),f.current=null}}},[r,o,e.createPopper]),{state:f.current?f.current.state:null,styles:n.styles,attributes:n.attributes,update:f.current?f.current.update:null,forceUpdate:f.current?f.current.forceUpdate:null}},"usePopper");var ze=s(function(){},"NOOP"),qe=s(function(){return Promise.resolve(null)},"NOOP_PROMISE"),Ge=[];function ne(t){var r=t.placement,o=r===void 0?"bottom":r,e=t.strategy,i=e===void 0?"absolute":e,a=t.modifiers,u=a===void 0?Ge:a,n=t.referenceElement,l=t.onFirstUpdate,c=t.innerRef,p=t.children,f=E.useContext(Z),g=E.useState(null),h=g[0],w=g[1],y=E.useState(null),R=y[0],H=y[1];E.useEffect(function(){D(c,h)},[c,h]);var L=E.useMemo(function(){return{placement:o,strategy:i,onFirstUpdate:l,modifiers:[].concat(u,[{name:"arrow",enabled:R!=null,options:{element:R}}])}},[o,i,l,u,R]),k=we(n||f,h,L),m=k.state,x=k.styles,U=k.forceUpdate,F=k.update,q=E.useMemo(function(){return{ref:w,style:x.popper,placement:m?m.placement:o,hasPopperEscaped:m&&m.modifiersData.hide?m.modifiersData.hide.hasPopperEscaped:null,isReferenceHidden:m&&m.modifiersData.hide?m.modifiersData.hide.isReferenceHidden:null,arrowProps:{style:x.arrow,ref:H},forceUpdate:U||ze,update:F||qe}},[w,H,o,m,x,F,U]);return j(p)(q)}s(ne,"Popper");d();var be=K(Ce());import*as A from"react";function ie(t){var r=t.children,o=t.innerRef,e=A.useContext(_),i=A.useCallback(function(a){D(o,a),te(e,a)},[o,e]);return A.useEffect(function(){return function(){return D(o,null)}},[]),A.useEffect(function(){(0,be.default)(Boolean(e),"`Reference` should not be used outside of a `Manager` component.")},[e]),j(r)({ref:i})}s(ie,"Reference");var xe=B.createContext({}),S=s(function(){for(var r=arguments.length,o=new Array(r),e=0;e<r;e++)o[e]=arguments[e];return function(){for(var i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return o.forEach(function(n){return n&&n.apply(void 0,a)})}},"callAll"),Qe=s(function(){},"noop"),Ee=s(function(){return!!(typeof window<"u"&&window.document&&window.document.createElement)},"canUseDOM"),Ze=s(function(r,o){if(typeof r=="function")return r(o);r!=null&&(r.current=o)},"setRef"),Pe=function(t){Q(r,t);function r(){for(var e,i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return e=t.call.apply(t,[this].concat(a))||this,e.observer=void 0,e.tooltipRef=void 0,e.handleOutsideClick=function(n){if(e.tooltipRef&&!e.tooltipRef.contains(n.target)){var l=e.context.parentOutsideClickHandler,c=e.props,p=c.hideTooltip,f=c.clearScheduled;f(),p(),l&&l(n)}},e.handleOutsideRightClick=function(n){if(e.tooltipRef&&!e.tooltipRef.contains(n.target)){var l=e.context.parentOutsideRightClickHandler,c=e.props,p=c.hideTooltip,f=c.clearScheduled;f(),p(),l&&l(n)}},e.addOutsideClickHandler=function(){document.body.addEventListener("touchend",e.handleOutsideClick),document.body.addEventListener("click",e.handleOutsideClick)},e.removeOutsideClickHandler=function(){document.body.removeEventListener("touchend",e.handleOutsideClick),document.body.removeEventListener("click",e.handleOutsideClick)},e.addOutsideRightClickHandler=function(){return document.body.addEventListener("contextmenu",e.handleOutsideRightClick)},e.removeOutsideRightClickHandler=function(){return document.body.removeEventListener("contextmenu",e.handleOutsideRightClick)},e.getTooltipRef=function(n){e.tooltipRef=n,Ze(e.props.innerRef,n)},e.getArrowProps=function(n){return n===void 0&&(n={}),O({},n,{style:O({},n.style,e.props.arrowProps.style)})},e.getTooltipProps=function(n){return n===void 0&&(n={}),O({},n,e.isTriggeredBy("hover")&&{onMouseEnter:S(e.props.clearScheduled,n.onMouseEnter),onMouseLeave:S(e.props.hideTooltip,n.onMouseLeave)},{style:O({},n.style,e.props.style)})},e.contextValue={isParentNoneTriggered:e.props.trigger==="none",addParentOutsideClickHandler:e.addOutsideClickHandler,addParentOutsideRightClickHandler:e.addOutsideRightClickHandler,parentOutsideClickHandler:e.handleOutsideClick,parentOutsideRightClickHandler:e.handleOutsideRightClick,removeParentOutsideClickHandler:e.removeOutsideClickHandler,removeParentOutsideRightClickHandler:e.removeOutsideRightClickHandler},e}s(r,"Tooltip1");var o=r.prototype;return o.componentDidMount=s(function(){var i=this,a=this.observer=new MutationObserver(function(){i.props.update()});if(a.observe(this.tooltipRef,this.props.mutationObserverOptions),this.isTriggeredBy("hover")||this.isTriggeredBy("click")||this.isTriggeredBy("right-click")){var u=this.context,n=u.removeParentOutsideClickHandler,l=u.removeParentOutsideRightClickHandler;this.addOutsideClickHandler(),this.addOutsideRightClickHandler(),n&&n(),l&&l()}},"componentDidMount"),o.componentDidUpdate=s(function(){this.props.closeOnReferenceHidden&&this.props.isReferenceHidden&&this.props.hideTooltip()},"componentDidUpdate"),o.componentWillUnmount=s(function(){if(this.observer&&this.observer.disconnect(),this.isTriggeredBy("hover")||this.isTriggeredBy("click")||this.isTriggeredBy("right-click")){var i=this.context,a=i.isParentNoneTriggered,u=i.addParentOutsideClickHandler,n=i.addParentOutsideRightClickHandler;this.removeOutsideClickHandler(),this.removeOutsideRightClickHandler(),this.handleOutsideClick=void 0,this.handleOutsideRightClick=void 0,!a&&u&&u(),!a&&n&&n()}},"componentWillUnmount"),o.render=s(function(){var i=this.props,a=i.arrowProps,u=i.placement,n=i.tooltip;return B.createElement(xe.Provider,{value:this.contextValue},n({arrowRef:a.ref,getArrowProps:this.getArrowProps,getTooltipProps:this.getTooltipProps,placement:u,tooltipRef:this.getTooltipRef}))},"render"),o.isTriggeredBy=s(function(i){var a=this.props.trigger;return a===i||Array.isArray(a)&&a.includes(i)},"isTriggeredBy"),r}(Se);Pe.contextType=xe;var _e={childList:!0,subtree:!0},Me=function(t){Q(r,t);function r(){for(var e,i=arguments.length,a=new Array(i),u=0;u<i;u++)a[u]=arguments[u];return e=t.call.apply(t,[this].concat(a))||this,e.state={tooltipShown:e.props.defaultTooltipShown},e.hideTimeout=void 0,e.showTimeout=void 0,e.popperOffset=void 0,e.setTooltipState=function(n){var l=s(function(){return e.props.onVisibilityChange(n.tooltipShown)},"cb");e.isControlled()?l():e.setState(n,l)},e.clearScheduled=function(){clearTimeout(e.hideTimeout),clearTimeout(e.showTimeout)},e.showTooltip=function(n){var l=n.pageX,c=n.pageY;e.clearScheduled();var p={tooltipShown:!0};e.props.followCursor&&(p=O({},p,{pageX:l,pageY:c})),e.showTimeout=window.setTimeout(function(){return e.setTooltipState(p)},e.props.delayShow)},e.hideTooltip=function(){e.clearScheduled(),e.hideTimeout=window.setTimeout(function(){return e.setTooltipState({tooltipShown:!1})},e.props.delayHide)},e.toggleTooltip=function(n){var l=n.pageX,c=n.pageY,p=e.getState()?"hideTooltip":"showTooltip";e[p]({pageX:l,pageY:c})},e.clickToggle=function(n){n.preventDefault();var l=n.pageX,c=n.pageY,p=e.props.followCursor?"showTooltip":"toggleTooltip";e[p]({pageX:l,pageY:c})},e.contextMenuToggle=function(n){n.preventDefault();var l=n.pageX,c=n.pageY,p=e.props.followCursor?"showTooltip":"toggleTooltip";e[p]({pageX:l,pageY:c})},e.getTriggerProps=function(n){return n===void 0&&(n={}),O({},n,e.isTriggeredBy("click")&&{onClick:S(e.clickToggle,n.onClick),onTouchEnd:S(e.clickToggle,n.onTouchEnd)},e.isTriggeredBy("right-click")&&{onContextMenu:S(e.contextMenuToggle,n.onContextMenu)},e.isTriggeredBy("hover")&&O({onMouseEnter:S(e.showTooltip,n.onMouseEnter),onMouseLeave:S(e.hideTooltip,n.onMouseLeave)},e.props.followCursor&&{onMouseMove:S(e.showTooltip,n.onMouseMove)}),e.isTriggeredBy("focus")&&{onFocus:S(e.showTooltip,n.onFocus),onBlur:S(e.hideTooltip,n.onBlur)})},e}s(r,"TooltipTrigger1");var o=r.prototype;return o.componentWillUnmount=s(function(){this.clearScheduled()},"componentWillUnmount"),o.render=s(function(){var i=this,a=this.props,u=a.children,n=a.tooltip,l=a.placement,c=a.trigger,p=a.getTriggerRef,f=a.modifiers,g=a.closeOnReferenceHidden,h=a.usePortal,w=a.portalContainer,y=a.followCursor,R=a.getTooltipRef,H=a.mutationObserverOptions,L=de(a,["children","tooltip","placement","trigger","getTriggerRef","modifiers","closeOnReferenceHidden","usePortal","portalContainer","followCursor","getTooltipRef","mutationObserverOptions"]),k=B.createElement(ne,O({innerRef:R,placement:l,modifiers:[{name:"followCursor",enabled:y,phase:"main",fn:s(function(x){i.popperOffset=x.state.rects.popper},"fn")}].concat(f)},L),function(m){var x=m.ref,U=m.style,F=m.placement,q=m.arrowProps,We=m.isReferenceHidden,De=m.update;if(y&&i.popperOffset){var ue=i.state,G=ue.pageX,J=ue.pageY,le=i.popperOffset,ce=le.width,pe=le.height,Ne=G+ce>window.pageXOffset+document.body.offsetWidth?G-ce:G,Ie=J+pe>window.pageYOffset+document.body.offsetHeight?J-pe:J;U.transform="translate3d("+Ne+"px, "+Ie+"px, 0"}return B.createElement(Pe,O({arrowProps:q,closeOnReferenceHidden:g,isReferenceHidden:We,placement:F,update:De,style:U,tooltip:n,trigger:c,mutationObserverOptions:H},{clearScheduled:i.clearScheduled,hideTooltip:i.hideTooltip,innerRef:x}))});return B.createElement(ee,null,B.createElement(ie,{innerRef:p},function(m){var x=m.ref;return u({getTriggerProps:i.getTriggerProps,triggerRef:x})}),this.getState()&&(h?Ke(k,w):k))},"render"),o.isControlled=s(function(){return this.props.tooltipShown!==void 0},"isControlled"),o.getState=s(function(){return this.isControlled()?this.props.tooltipShown:this.state.tooltipShown},"getState"),o.isTriggeredBy=s(function(i){var a=this.props.trigger;return a===i||Array.isArray(a)&&a.includes(i)},"isTriggeredBy"),r}(Se);Me.defaultProps={closeOnReferenceHidden:!0,defaultTooltipShown:!1,delayHide:0,delayShow:0,followCursor:!1,onVisibilityChange:Qe,placement:"right",portalContainer:Ee()?document.body:null,trigger:"hover",usePortal:Ee(),mutationObserverOptions:_e,modifiers:[]};var ke=Me;d();import Ae from"react";import et from"memoizerific";import{styled as He,lighten as N,darken as I}from"@storybook/theming";function X(){return X=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])}return t},X.apply(this,arguments)}s(X,"_extends");var T=et(1e3)((t,r,o,e=0)=>r.split("-")[0]===t?o:e),M=8,tt=He.div({position:"absolute",borderStyle:"solid"},({placement:t})=>{let r=0,o=0;switch(!0){case(t.startsWith("left")||t.startsWith("right")):{o=8;break}case(t.startsWith("top")||t.startsWith("bottom")):{r=8;break}default:}return{transform:`translate3d(${r}px, ${o}px, 0px)`}},({theme:t,color:r,placement:o})=>({bottom:`${T("top",o,M*-1,"auto")}px`,top:`${T("bottom",o,M*-1,"auto")}px`,right:`${T("left",o,M*-1,"auto")}px`,left:`${T("right",o,M*-1,"auto")}px`,borderBottomWidth:`${T("top",o,"0",M)}px`,borderTopWidth:`${T("bottom",o,"0",M)}px`,borderRightWidth:`${T("left",o,"0",M)}px`,borderLeftWidth:`${T("right",o,"0",M)}px`,borderTopColor:T("top",o,t.color[r]||r||t.base==="light"?N(t.background.app):I(t.background.app),"transparent"),borderBottomColor:T("bottom",o,t.color[r]||r||t.base==="light"?N(t.background.app):I(t.background.app),"transparent"),borderLeftColor:T("left",o,t.color[r]||r||t.base==="light"?N(t.background.app):I(t.background.app),"transparent"),borderRightColor:T("right",o,t.color[r]||r||t.base==="light"?N(t.background.app):I(t.background.app),"transparent")})),rt=He.div(({hidden:t})=>({display:t?"none":"inline-block",zIndex:2147483647}),({theme:t,color:r,hasChrome:o})=>o?{background:t.color[r]||r||t.base==="light"?N(t.background.app):I(t.background.app),filter:`
|
|
2
|
-
drop-shadow(0px 5px 5px rgba(0,0,0,0.05))
|
|
3
|
-
drop-shadow(0 1px 3px rgba(0,0,0,0.1))
|
|
4
|
-
`,borderRadius:t.appBorderRadius*2,fontSize:t.typography.size.s1}:{}),ae=s(l=>{var c=l,{placement:t,hasChrome:r,children:o,arrowProps:e,tooltipRef:i,arrowRef:a,color:u}=c,n=W(c,["placement","hasChrome","children","arrowProps","tooltipRef","arrowRef","color"]);return Ae.createElement(rt,X({hasChrome:r,placement:t,ref:i},n,{color:u}),r&&Ae.createElement(tt,X({placement:t,ref:a},e,{color:u})),o)},"Tooltip");ae.defaultProps={color:void 0,arrowRef:void 0,tooltipRef:void 0,hasChrome:!0,placement:"top",arrowProps:{}};function $(){return $=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var e in o)Object.prototype.hasOwnProperty.call(o,e)&&(t[e]=o[e])}return t},$.apply(this,arguments)}s($,"_extends");var{document:se}=Le.default,at=Be.div`
|
|
5
|
-
display: inline-block;
|
|
6
|
-
cursor: ${t=>t.mode==="hover"?"default":"pointer"};
|
|
7
|
-
`,st=Be.g`
|
|
8
|
-
cursor: ${t=>t.mode==="hover"?"default":"pointer"};
|
|
9
|
-
`,Ue=s(f=>{var g=f,{svg:t,trigger:r,closeOnClick:o,placement:e,modifiers:i,hasChrome:a,tooltip:u,children:n,tooltipShown:l,onVisibilityChange:c}=g,p=W(g,["svg","trigger","closeOnClick","placement","modifiers","hasChrome","tooltip","children","tooltipShown","onVisibilityChange"]);let h=t?st:at;return z.createElement(ke,{placement:e,trigger:r,modifiers:i,tooltipShown:l,onVisibilityChange:c,tooltip:({getTooltipProps:w,getArrowProps:y,tooltipRef:R,arrowRef:H,placement:L})=>z.createElement(ae,$({hasChrome:a,placement:L,tooltipRef:R,arrowRef:H,arrowProps:y()},w()),typeof u=="function"?u({onHide:()=>c(!1)}):u)},({getTriggerProps:w,triggerRef:y})=>z.createElement(h,$({ref:y},w(),p),n))},"WithTooltipPure");Ue.defaultProps={svg:!1,trigger:"hover",closeOnClick:!1,placement:"top",modifiers:[{name:"preventOverflow",options:{padding:8}},{name:"offset",options:{offset:[8,8]}},{name:"arrow",options:{padding:8}}],hasChrome:!0,tooltipShown:!1};var Ft=s(e=>{var i=e,{startOpen:t,onVisibilityChange:r}=i,o=W(i,["startOpen","onVisibilityChange"]);let[a,u]=nt(t||!1),n=ot(l=>{r&&r(l)===!1||u(l)},[r]);return it(()=>{let l=s(()=>n(!1),"hide");se.addEventListener("keydown",l,!1);let c=Array.from(se.getElementsByTagName("iframe")),p=[];return c.forEach(f=>{let g=s(()=>{try{f.contentWindow.document&&(f.contentWindow.document.addEventListener("click",l),p.push(()=>{try{f.contentWindow.document.removeEventListener("click",l)}catch{}}))}catch{}},"bind");g(),f.addEventListener("load",g),p.push(()=>{f.removeEventListener("load",g)})}),()=>{se.removeEventListener("keydown",l),p.forEach(f=>{f()})}}),z.createElement(Ue,$({},o,{tooltipShown:a,onVisibilityChange:n}))},"WithToolTipState");export{Ft as WithToolTipState,Ft as WithTooltip,Ue as WithTooltipPure};
|