react-tooltip 5.0.0-beta.1 → 5.0.0-beta.2
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/.eslintrc.json +2 -1
- package/CODE_OF_CONDUCT.md +53 -0
- package/LICENSE +1 -2
- package/README.md +30 -152
- package/coverage/clover.xml +610 -0
- package/coverage/coverage-final.json +11 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/components/Tooltip/Tooltip.tsx.html +646 -0
- package/coverage/lcov-report/components/Tooltip/index.html +146 -0
- package/coverage/lcov-report/components/Tooltip/index.ts.html +88 -0
- package/coverage/lcov-report/components/Tooltip/styles.module.css.html +277 -0
- package/coverage/lcov-report/components/TooltipContent/TooltipContent.tsx.html +109 -0
- package/coverage/lcov-report/components/TooltipContent/index.html +131 -0
- package/coverage/lcov-report/components/TooltipContent/index.ts.html +88 -0
- package/coverage/lcov-report/components/TooltipController/TooltipController.tsx.html +664 -0
- package/coverage/lcov-report/components/TooltipController/constants.ts.html +118 -0
- package/coverage/lcov-report/components/TooltipController/index.html +146 -0
- package/coverage/lcov-report/components/TooltipController/index.ts.html +88 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +161 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/sum.js.html +97 -0
- package/coverage/lcov-report/sum.ts.html +100 -0
- package/coverage/lcov-report/test/index.html +116 -0
- package/coverage/lcov-report/test/sum.ts.html +100 -0
- package/coverage/lcov-report/utils/compute-positions.ts.html +277 -0
- package/coverage/lcov-report/utils/debounce.ts.html +181 -0
- package/coverage/lcov-report/utils/index.html +131 -0
- package/coverage/lcov.info +729 -0
- package/dist/react-tooltip.cjs.js +3 -6
- package/dist/react-tooltip.cjs.min.js +1 -1
- package/dist/react-tooltip.esm.js +3 -6
- package/dist/react-tooltip.esm.min.js +1 -1
- package/dist/react-tooltip.umd.js +3 -6
- package/dist/react-tooltip.umd.min.js +1 -1
- package/jest.config.ts +214 -0
- package/package.json +12 -4
- package/tsconfig.json +2 -2
- package/.github/FUNDING.yml +0 -13
- package/.github/workflows/lint.yaml +0 -35
- package/.github/workflows/pull-request.yaml +0 -11
- package/.github/workflows/release.yaml +0 -30
- package/.husky/pre-commit +0 -6
- package/.vscode/settings.json +0 -27
- package/build/dist/react-tooltip.cjs.js +0 -2909
- package/build/dist/react-tooltip.cjs.min.js +0 -6
- package/build/dist/react-tooltip.css +0 -73
- package/build/dist/react-tooltip.esm.js +0 -2901
- package/build/dist/react-tooltip.esm.min.js +0 -6
- package/build/dist/react-tooltip.min.css +0 -1
- package/build/dist/react-tooltip.umd.js +0 -2913
- package/build/dist/react-tooltip.umd.min.js +0 -6
- package/build/index.css +0 -79
- package/build/index.html +0 -19
- package/build/index.js +0 -36190
- package/docs/README.md +0 -50
- package/docs/babel.config.js +0 -3
- package/docs/docs/examples/_category_.json +0 -7
- package/docs/docs/examples/basic-examples.mdx +0 -68
- package/docs/docs/examples/children.mdx +0 -67
- package/docs/docs/examples/content.mdx +0 -80
- package/docs/docs/examples/delay.mdx +0 -84
- package/docs/docs/examples/events.mdx +0 -85
- package/docs/docs/examples/get-content.mdx +0 -58
- package/docs/docs/examples/html.mdx +0 -75
- package/docs/docs/examples/multiline.mdx +0 -91
- package/docs/docs/examples/offset.mdx +0 -69
- package/docs/docs/examples/place.mdx +0 -55
- package/docs/docs/examples/state.mdx +0 -331
- package/docs/docs/examples/styling.mdx +0 -388
- package/docs/docs/examples/variant.mdx +0 -100
- package/docs/docs/getting-started.mdx +0 -100
- package/docs/docs/options.mdx +0 -105
- package/docs/docs/upgrade-guide/_category_.json +0 -7
- package/docs/docs/upgrade-guide/basic-examples-v4-v5.mdx +0 -119
- package/docs/docs/upgrade-guide/changelog-v4-v5.md +0 -86
- package/docs/docusaurus.config.js +0 -135
- package/docs/package.json +0 -47
- package/docs/sidebars.js +0 -33
- package/docs/src/components/HomepageFeatures/index.tsx +0 -71
- package/docs/src/components/HomepageFeatures/styles.module.css +0 -11
- package/docs/src/css/custom.css +0 -74
- package/docs/src/pages/index.module.css +0 -35
- package/docs/src/pages/index.tsx +0 -45
- package/docs/src/pages/markdown-page.md +0 -7
- package/docs/static/.nojekyll +0 -0
- package/docs/static/img/Octocat.jpg +0 -0
- package/docs/static/img/Octocat.png +0 -0
- package/docs/static/img/Octocat.svg +0 -9
- package/docs/static/img/android-chrome-192x192.png +0 -0
- package/docs/static/img/android-chrome-512x512.png +0 -0
- package/docs/static/img/apple-touch-icon.png +0 -0
- package/docs/static/img/docusaurus.png +0 -0
- package/docs/static/img/favicon-16x16.png +0 -0
- package/docs/static/img/favicon-32x32.png +0 -0
- package/docs/static/img/favicon-old.ico +0 -0
- package/docs/static/img/favicon.ico +0 -0
- package/docs/static/img/github.svg +0 -1
- package/docs/static/img/happy-face-tooltip.png +0 -0
- package/docs/static/img/happy-face-tooltip.svg +0 -21
- package/docs/static/img/logo-dinossaur.svg +0 -1
- package/docs/static/img/logo.png +0 -0
- package/docs/static/img/logo.svg +0 -21
- package/docs/static/img/only-tooltip-top.png +0 -0
- package/docs/static/img/only-tooltip-top.svg +0 -4
- package/docs/static/img/only-tooltip.png +0 -0
- package/docs/static/img/only-tooltip.svg +0 -4
- package/docs/static/img/site.webmanifest +0 -1
- package/docs/static/img/undraw_docusaurus_mountain.svg +0 -171
- package/docs/static/img/undraw_docusaurus_react.svg +0 -170
- package/docs/static/img/undraw_docusaurus_tree.svg +0 -40
- package/docs/tsconfig.json +0 -7
- package/docs/yarn.lock +0 -7599
- package/example-v5/package.json +0 -21
- package/example-v5/public/index.html +0 -20
- package/example-v5/public/manifest.json +0 -8
- package/example-v5/src/App.jsx +0 -908
- package/example-v5/src/index.css +0 -238
- package/example-v5/src/index.js +0 -15
- package/example-v5/src/index.scss +0 -251
- package/public/index.html +0 -19
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import e,{createRef as t,useRef as n,useState as r,useEffect as o,useId as i}from"react";var a={exports:{}},l={};!function(){var t=e,n=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),h=Symbol.iterator;var g=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];b("error",e,n)}function b(e,t,n){var r=g.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(t+="%s",n=n.concat([r]));var o=n.map((function(e){return String(e)}));o.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,o)}var w;function x(e){return e.displayName||"Context"}function _(e){if(null==e)return null;if("number"==typeof e.tag&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case o:return"Fragment";case r:return"Portal";case a:return"Profiler";case i:return"StrictMode";case f:return"Suspense";case p:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return x(e)+".Consumer";case s:return x(e._context)+".Provider";case u:return function(e,t,n){var r=e.displayName;if(r)return r;var o=t.displayName||t.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case d:var t=e.displayName||null;return null!==t?t:_(e.type)||"Memo";case y:var n=e,l=n._payload,m=n._init;try{return _(m(l))}catch(e){return null}}return null}w=Symbol.for("react.module.reference");var S,R,k,T,j,O,E,P=Object.assign,A=0;function N(){}N.__reactDisabledLog=!0;var L,C=g.ReactCurrentDispatcher;function $(e,t,n){if(void 0===L)try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);L=r&&r[1]||""}return"\n"+L+e}var D,F=!1,W="function"==typeof WeakMap?WeakMap:Map;function I(e,t){if(!e||F)return"";var n,r=D.get(e);if(void 0!==r)return r;F=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=C.current,C.current=null,function(){if(0===A){S=console.log,R=console.info,k=console.warn,T=console.error,j=console.group,O=console.groupCollapsed,E=console.groupEnd;var e={configurable:!0,enumerable:!0,value:N,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}A++}();try{if(t){var a=function(){throw Error()};if(Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){n=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){n=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){n=e}e()}}catch(t){if(t&&n&&"string"==typeof t.stack){for(var l=t.stack.split("\n"),s=n.stack.split("\n"),c=l.length-1,u=s.length-1;c>=1&&u>=0&&l[c]!==s[u];)u--;for(;c>=1&&u>=0;c--,u--)if(l[c]!==s[u]){if(1!==c||1!==u)do{if(c--,--u<0||l[c]!==s[u]){var f="\n"+l[c].replace(" at new "," at ");return e.displayName&&f.includes("<anonymous>")&&(f=f.replace("<anonymous>",e.displayName)),"function"==typeof e&&D.set(e,f),f}}while(c>=1&&u>=0);break}}}finally{F=!1,C.current=o,function(){if(0==--A){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},e,{value:S}),info:P({},e,{value:R}),warn:P({},e,{value:k}),error:P({},e,{value:T}),group:P({},e,{value:j}),groupCollapsed:P({},e,{value:O}),groupEnd:P({},e,{value:E})})}A<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var p=e?e.displayName||e.name:"",d=p?$(p):"";return"function"==typeof e&&D.set(e,d),d}function H(e,t,n){if(null==e)return"";if("function"==typeof e)return I(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return $(e);switch(e){case f:return $("Suspense");case p:return $("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case u:return I(e.render,!1);case d:return H(e.type,t,n);case y:var o=e,i=o._payload,a=o._init;try{return H(a(i),t,n)}catch(e){}}return""}D=new W;var M=Object.prototype.hasOwnProperty,U={},B=g.ReactDebugCurrentFrame;function V(e){if(e){var t=e._owner,n=H(e.type,e._source,t?t.type:null);B.setExtraStackFrame(n)}else B.setExtraStackFrame(null)}var z=Array.isArray;function Y(e){return z(e)}function q(e){return""+e}function X(e){if(function(e){try{return q(e),!1}catch(e){return!0}}(e))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),q(e)}var J,K,Z,G=g.ReactCurrentOwner,Q={key:!0,ref:!0,__self:!0,__source:!0};Z={};function ee(e,t,r,o,i){var a,l={},s=null,c=null;for(a in void 0!==r&&(X(r),s=""+r),function(e){if(M.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(X(t.key),s=""+t.key),function(e){if(M.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e,t){if("string"==typeof e.ref&&G.current&&t&&G.current.stateNode!==t){var n=_(G.current.type);Z[n]||(v('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',_(G.current.type),e.ref),Z[n]=!0)}}(t,i)),t)M.call(t,a)&&!Q.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps){var u=e.defaultProps;for(a in u)void 0===l[a]&&(l[a]=u[a])}if(s||c){var f="function"==typeof e?e.displayName||e.name||"Unknown":e;s&&function(e,t){var n=function(){J||(J=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(l,f),c&&function(e,t){var n=function(){K||(K=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(l,f)}return function(e,t,r,o,i,a,l){var s={$$typeof:n,type:e,key:t,ref:r,props:l,_owner:a,_store:{}};return Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(s,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(s,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}(e,s,c,i,o,G.current,l)}var te,ne=g.ReactCurrentOwner,re=g.ReactDebugCurrentFrame;function oe(e){if(e){var t=e._owner,n=H(e.type,e._source,t?t.type:null);re.setExtraStackFrame(n)}else re.setExtraStackFrame(null)}function ie(e){return"object"==typeof e&&null!==e&&e.$$typeof===n}function ae(){if(ne.current){var e=_(ne.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}te=!1;var le={};function se(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=ae();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!le[n]){le[n]=!0;var r="";e&&e._owner&&e._owner!==ne.current&&(r=" It was passed a child from "+_(e._owner.type)+"."),oe(e),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),oe(null)}}}function ce(e,t){if("object"==typeof e)if(Y(e))for(var n=0;n<e.length;n++){var r=e[n];ie(r)&&se(r,t)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=h&&e[h]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,a=o.call(e);!(i=a.next()).done;)ie(i.value)&&se(i.value,t)}}function ue(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==u&&n.$$typeof!==d)return;t=n.propTypes}if(t){var r=_(n);!function(e,t,n,r,o){var i=Function.call.bind(M);for(var a in e)if(i(e,a)){var l=void 0;try{if("function"!=typeof e[a]){var s=Error((r||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw s.name="Invariant Violation",s}l=e[a](t,a,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){l=e}!l||l instanceof Error||(V(o),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,a,typeof l),V(null)),l instanceof Error&&!(l.message in U)&&(U[l.message]=!0,V(o),v("Failed %s type: %s",n,l.message),V(null))}}(t,e.props,"prop",r,e)}else if(void 0!==n.PropTypes&&!te){te=!0,v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",_(n)||"Unknown")}"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fe(e,t,r,l,h,g){var b=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===a||e===i||e===f||e===p||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===s||e.$$typeof===c||e.$$typeof===u||e.$$typeof===w||void 0!==e.getModuleId)}(e);if(!b){var x="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(x+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var S,R=function(e){return void 0!==e?"\n\nCheck your code at "+e.fileName.replace(/^.*[\\\/]/,"")+":"+e.lineNumber+".":""}(h);x+=R||ae(),null===e?S="null":Y(e)?S="array":void 0!==e&&e.$$typeof===n?(S="<"+(_(e.type)||"Unknown")+" />",x=" Did you accidentally export a JSX literal instead of a component?"):S=typeof e,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",S,x)}var k=ee(e,t,r,h,g);if(null==k)return k;if(b){var T=t.children;if(void 0!==T)if(l)if(Y(T)){for(var j=0;j<T.length;j++)ce(T[j],e);Object.freeze&&Object.freeze(T)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else ce(T,e)}return e===o?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){oe(e),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),oe(null);break}}null!==e.ref&&(oe(e),v("Invalid attribute `ref` supplied to `React.Fragment`."),oe(null))}(k):ue(k),k}var pe=function(e,t,n){return fe(e,t,n,!1)},de=function(e,t,n){return fe(e,t,n,!0)};l.Fragment=o,l.jsx=pe,l.jsxs=de}(),a.exports=l;var s,c={exports:{}};
|
|
2
|
-
/*!
|
|
3
|
-
Copyright (c) 2018 Jed Watson.
|
|
4
|
-
Licensed under the MIT License (MIT), see
|
|
5
|
-
http://jedwatson.github.io/classnames
|
|
6
|
-
*/s=c,function(){var e={}.hasOwnProperty;function t(){for(var n=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)n.push(o);else if(Array.isArray(o)){if(o.length){var a=t.apply(null,o);a&&n.push(a)}}else if("object"===i){if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]")){n.push(o.toString());continue}for(var l in o)e.call(o,l)&&o[l]&&n.push(l)}}}return n.join(" ")}s.exports?(t.default=t,s.exports=t):window.classNames=t}();var u=c.exports;const f=(e,t,n)=>{let r;return function(){const o=this,i=arguments,a=()=>{r=null,n||e.apply(o,i)},l=n&&!r;clearTimeout(r),r=setTimeout(a,t),l&&e.apply(o,i)}},p=({content:e})=>a.exports.jsx("span",{dangerouslySetInnerHTML:{__html:e}});function d(e){return e.split("-")[0]}function y(e){return e.split("-")[1]}function m(e){return["top","bottom"].includes(d(e))?"x":"y"}function h(e){return"y"===e?"height":"width"}function g(e,t,n){let{reference:r,floating:o}=e;const i=r.x+r.width/2-o.width/2,a=r.y+r.height/2-o.height/2,l=m(t),s=h(l),c=r[s]/2-o[s]/2,u="x"===l;let f;switch(d(t)){case"top":f={x:i,y:r.y-o.height};break;case"bottom":f={x:i,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:a};break;case"left":f={x:r.x-o.width,y:a};break;default:f={x:r.x,y:r.y}}switch(y(t)){case"start":f[l]-=c*(n&&u?-1:1);break;case"end":f[l]+=c*(n&&u?-1:1)}return f}function v(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function b(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}async function w(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:a,elements:l,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:p=!1,padding:d=0}=t,y=v(d),m=l[p?"floating"===f?"reference":"floating":f],h=b(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:s})),g=b(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({rect:"floating"===f?{...a.floating,x:r,y:o}:a.reference,offsetParent:await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),strategy:s}):a[f]);return{top:h.top-g.top+y.top,bottom:g.bottom-h.bottom+y.bottom,left:h.left-g.left+y.left,right:g.right-h.right+y.right}}const x=Math.min,_=Math.max;function S(e,t,n){return _(e,x(t,n))}const R={left:"right",right:"left",bottom:"top",top:"bottom"};function k(e){return e.replace(/left|right|bottom|top/g,(e=>R[e]))}const T={start:"end",end:"start"};function j(e){return e.replace(/start|end/g,(e=>T[e]))}const O=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:i,initialPlacement:a,platform:l,elements:s}=t,{mainAxis:c=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",flipAlignment:g=!0,...v}=e,b=d(r),x=f||(b===a||!g?[k(a)]:function(e){const t=k(e);return[j(e),t,j(t)]}(a)),_=[a,...x],S=await w(t,v),R=[];let T=(null==(n=o.flip)?void 0:n.overflows)||[];if(c&&R.push(S[b]),u){const{main:e,cross:t}=function(e,t,n){void 0===n&&(n=!1);const r=y(e),o=m(e),i=h(o);let a="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=k(a)),{main:a,cross:k(a)}}(r,i,await(null==l.isRTL?void 0:l.isRTL(s.floating)));R.push(S[e],S[t])}if(T=[...T,{placement:r,overflows:R}],!R.every((e=>e<=0))){var O,E;const e=(null!=(O=null==(E=o.flip)?void 0:E.index)?O:0)+1,t=_[e];if(t)return{data:{index:e,overflows:T},reset:{placement:t}};let n="bottom";switch(p){case"bestFit":{var P;const e=null==(P=T.map((e=>[e,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:P[0].placement;e&&(n=e);break}case"initialPlacement":n=a}if(r!==n)return{reset:{placement:n}}}return{}}}};const E=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),a=d(n),l=y(n),s="x"===m(n),c=["left","top"].includes(a)?-1:1,u=i&&s?-1:1,f="function"==typeof t?t(e):t;let{mainAxis:p,crossAxis:h,alignmentAxis:g}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return l&&"number"==typeof g&&(h="end"===l?-1*g:g),s?{x:h*u,y:p*c}:{x:p*c,y:h*u}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function P(e){return e&&e.document&&e.location&&e.alert&&e.setInterval}function A(e){if(null==e)return window;if(!P(e)){const t=e.ownerDocument;return t&&t.defaultView||window}return e}function N(e){return A(e).getComputedStyle(e)}function L(e){return P(e)?"":e?(e.nodeName||"").toLowerCase():""}function C(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>e.brand+"/"+e.version)).join(" "):navigator.userAgent}function $(e){return e instanceof A(e).HTMLElement}function D(e){return e instanceof A(e).Element}function F(e){if("undefined"==typeof ShadowRoot)return!1;return e instanceof A(e).ShadowRoot||e instanceof ShadowRoot}function W(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=N(e);return/auto|scroll|overlay|hidden/.test(t+r+n)&&!["inline","contents"].includes(o)}function I(e){return["table","td","th"].includes(L(e))}function H(e){const t=/firefox/i.test(C()),n=N(e),r=n.backdropFilter||n.WebkitBackdropFilter;return"none"!==n.transform||"none"!==n.perspective||!!r&&"none"!==r||t&&"filter"===n.willChange||t&&!!n.filter&&"none"!==n.filter||["transform","perspective"].some((e=>n.willChange.includes(e)))||["paint","layout","strict","content"].some((e=>{const t=n.contain;return null!=t&&t.includes(e)}))}function M(){return!/^((?!chrome|android).)*safari/i.test(C())}function U(e){return["html","body","#document"].includes(L(e))}const B=Math.min,V=Math.max,z=Math.round;function Y(e,t,n){var r,o,i,a;void 0===t&&(t=!1),void 0===n&&(n=!1);const l=e.getBoundingClientRect();let s=1,c=1;t&&$(e)&&(s=e.offsetWidth>0&&z(l.width)/e.offsetWidth||1,c=e.offsetHeight>0&&z(l.height)/e.offsetHeight||1);const u=D(e)?A(e):window,f=!M()&&n,p=(l.left+(f&&null!=(r=null==(o=u.visualViewport)?void 0:o.offsetLeft)?r:0))/s,d=(l.top+(f&&null!=(i=null==(a=u.visualViewport)?void 0:a.offsetTop)?i:0))/c,y=l.width/s,m=l.height/c;return{width:y,height:m,top:d,right:p+y,bottom:d+m,left:p,x:p,y:d}}function q(e){return(t=e,(t instanceof A(t).Node?e.ownerDocument:e.document)||window.document).documentElement;var t}function X(e){return D(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function J(e){return Y(q(e)).left+X(e).scrollLeft}function K(e,t,n){const r=$(t),o=q(t),i=Y(e,r&&function(e){const t=Y(e);return z(t.width)!==e.offsetWidth||z(t.height)!==e.offsetHeight}(t),"fixed"===n);let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if(r||!r&&"fixed"!==n)if(("body"!==L(t)||W(o))&&(a=X(t)),$(t)){const e=Y(t,!0);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}else o&&(l.x=J(o));return{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function Z(e){if("html"===L(e))return e;const t=e.assignedSlot||e.parentNode||(F(e)?e.host:null)||q(e);return F(t)?t.host:t}function G(e){return $(e)&&"fixed"!==N(e).position?e.offsetParent:null}function Q(e){const t=A(e);let n=G(e);for(;n&&I(n)&&"static"===N(n).position;)n=G(n);return n&&("html"===L(n)||"body"===L(n)&&"static"===N(n).position&&!H(n))?t:n||function(e){let t=Z(e);for(;$(t)&&!U(t);){if(H(t))return t;t=Z(t)}return null}(e)||t}function ee(e){if($(e))return{width:e.offsetWidth,height:e.offsetHeight};const t=Y(e);return{width:t.width,height:t.height}}function te(e){const t=Z(e);return U(t)?e.ownerDocument.body:$(t)&&W(t)?t:te(t)}function ne(e,t){var n;void 0===t&&(t=[]);const r=te(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=A(r),a=o?[i].concat(i.visualViewport||[],W(r)?r:[]):r,l=t.concat(a);return o?l:l.concat(ne(a))}function re(e,t,n){return"viewport"===t?b(function(e,t){const n=A(e),r=q(e),o=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,s=0;if(o){i=o.width,a=o.height;const e=M();(e||!e&&"fixed"===t)&&(l=o.offsetLeft,s=o.offsetTop)}return{width:i,height:a,x:l,y:s}}(e,n)):D(t)?function(e,t){const n=Y(e,!1,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft;return{top:r,left:o,x:o,y:r,right:o+e.clientWidth,bottom:r+e.clientHeight,width:e.clientWidth,height:e.clientHeight}}(t,n):b(function(e){var t;const n=q(e),r=X(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=V(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=V(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0);let l=-r.scrollLeft+J(e);const s=-r.scrollTop;return"rtl"===N(o||n).direction&&(l+=V(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:a,x:l,y:s}}(q(e)))}const oe={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i="clippingAncestors"===n?function(e){let t=ne(e).filter((e=>D(e)&&"body"!==L(e))),n=e,r=null;for(;D(n)&&!U(n);){const e=N(n);"static"===e.position&&r&&["absolute","fixed"].includes(r.position)&&!H(n)?t=t.filter((e=>e!==n)):r=e,n=Z(n)}return t}(t):[].concat(n),a=[...i,r],l=a[0],s=a.reduce(((e,n)=>{const r=re(t,n,o);return e.top=V(r.top,e.top),e.right=B(r.right,e.right),e.bottom=B(r.bottom,e.bottom),e.left=V(r.left,e.left),e}),re(t,l,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=$(n),i=q(n);if(n===i)return t;let a={scrollLeft:0,scrollTop:0};const l={x:0,y:0};if((o||!o&&"fixed"!==r)&&(("body"!==L(n)||W(i))&&(a=X(n)),$(n))){const e=Y(n,!0);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}return{...t,x:t.x-a.scrollLeft+l.x,y:t.y-a.scrollTop+l.y}},isElement:D,getDimensions:ee,getOffsetParent:Q,getDocumentElement:q,getElementRects:e=>{let{reference:t,floating:n,strategy:r}=e;return{reference:K(t,Q(n),r),floating:{...ee(n),x:0,y:0}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>"rtl"===N(e).direction},ie=(e,t,n)=>(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:a}=n,l=i.filter(Boolean),s=await(null==a.isRTL?void 0:a.isRTL(t));if(null==a&&console.error(["Floating UI: `platform` property was not passed to config. If you","want to use Floating UI on the web, install @floating-ui/dom","instead of the /core package. Otherwise, you can create your own","`platform`: https://floating-ui.com/docs/platform"].join(" ")),l.filter((e=>{let{name:t}=e;return"autoPlacement"===t||"flip"===t})).length>1)throw new Error(["Floating UI: duplicate `flip` and/or `autoPlacement` middleware","detected. This will lead to an infinite loop. Ensure only one of","either has been passed to the `middleware` array."].join(" "));e&&t||console.error(["Floating UI: The reference and/or floating element was not defined","when `computePosition()` was called. Ensure that both elements have","been created and can be measured."].join(" "));let c=await a.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:f}=g(c,r,s),p=r,d={},y=0;for(let n=0;n<l.length;n++){const{name:i,fn:m}=l[n],{x:h,y:v,data:b,reset:w}=await m({x:u,y:f,initialPlacement:r,placement:p,strategy:o,middlewareData:d,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=h?h:u,f=null!=v?v:f,d={...d,[i]:{...d[i],...b}},y>50&&console.warn(["Floating UI: The middleware lifecycle appears to be running in an","infinite loop. This is usually caused by a `reset` continually","being returned without a break condition."].join(" ")),w&&y<=50&&(y++,"object"==typeof w&&(w.placement&&(p=w.placement),w.rects&&(c=!0===w.rects?await a.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:u,y:f}=g(c,p,s))),n=-1)}return{x:u,y:f,placement:p,strategy:o,middlewareData:d}})(e,t,{platform:oe,...n}),ae=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10})=>{if(null===e)return console.error("The reference element for tooltip was not defined: ",e),{tooltipStyles:{},tooltipArrowStyles:{}};if(null===t)return{tooltipStyles:{},tooltipArrowStyles:{}};const i=[E(Number(o)),O(),(a={padding:5},void 0===a&&(a={}),{name:"shift",options:a,async fn(e){const{x:t,y:n,placement:r}=e,{mainAxis:o=!0,crossAxis:i=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=a,c={x:t,y:n},u=await w(e,s),f=m(d(r)),p="x"===f?"y":"x";let y=c[f],h=c[p];if(o){const e="y"===f?"bottom":"right";y=S(y+u["y"===f?"top":"left"],y,y-u[e])}if(i){const e="y"===p?"bottom":"right";h=S(h+u["y"===p?"top":"left"],h,h-u[e])}const g=l.fn({...e,[f]:y,[p]:h});return{...g,data:{x:g.x-t,y:g.y-n}}}})];var a;return n?(i.push((e=>({name:"arrow",options:e,async fn(t){const{element:n,padding:r=0}=null!=e?e:{},{x:o,y:i,placement:a,rects:l,platform:s}=t;if(null==n)return console.warn("Floating UI: No `element` was passed to the `arrow` middleware."),{};const c=v(r),u={x:o,y:i},f=m(a),p=y(a),d=h(f),g=await s.getDimensions(n),b="y"===f?"top":"left",w="y"===f?"bottom":"right",x=l.reference[d]+l.reference[f]-u[f]-l.floating[d],_=u[f]-l.reference[f],R=await(null==s.getOffsetParent?void 0:s.getOffsetParent(n));let k=R?"y"===f?R.clientHeight||0:R.clientWidth||0:0;0===k&&(k=l.floating[d]);const T=x/2-_/2,j=c[b],O=k-g[d]-c[w],E=k/2-g[d]/2+T,P=S(j,E,O),A=("start"===p?c[b]:c[w])>0&&E!==P&&l.reference[d]<=l.floating[d];return{[f]:u[f]-(A?E<j?j-E:O-E:0),data:{[f]:P,centerOffset:E-P}}}}))({element:n})),ie(e,t,{placement:r,middleware:i}).then((({x:e,y:t,placement:n,middlewareData:r})=>{const o={left:`${e}px`,top:`${t}px`},{x:i,y:a}=r.arrow;return{tooltipStyles:o,tooltipArrowStyles:{left:null!=i?`${i}px`:"",top:null!=a?`${a}px`:"",right:"",bottom:"",[{top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]]]:"-4px"}}}))):ie(e,t,{placement:"bottom",middleware:i}).then((({x:e,y:t})=>({tooltipStyles:{left:`${e}px`,top:`${t}px`},tooltipArrowStyles:{}})))};var le={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",show:"styles-module_show__2NboJ",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const se=({id:e=i(),className:l,classNameArrow:s,variant:c="dark",anchorId:d,place:y="top",offset:m=10,events:h=["hover"],wrapper:g="div",children:v=null,delayShow:b=0,delayHide:w=0,isHtmlContent:x=!1,content:_})=>{const S=t(),R=t(),k=n(),T=n(),[j,O]=r({}),[E,P]=r({}),[A,N]=r(!1),L=()=>{N((e=>!e))},C=f((()=>{b?(k.current&&clearTimeout(k.current),k.current=setTimeout((()=>{N(!0)}),b)):N(!0),T.current&&clearTimeout(T.current)}),50),$=f((()=>{w?(T.current&&clearTimeout(T.current),T.current=setTimeout((()=>{N(!1)}),w)):N(!1),A&&k.current?clearTimeout(k.current):!A&&k.current&&(T.current=setTimeout((()=>{N(!1)}),2*b))}),50);return o((()=>{const e=document.querySelector(`#${d}`);if(!e)return()=>{};const t=[];return h.find((e=>"click"===e))&&t.push({event:"click",listener:L}),h.find((e=>"hover"===e))&&t.push({event:"mouseenter",listener:C},{event:"mouseleave",listener:$},{event:"focus",listener:C},{event:"blur",listener:$}),t.forEach((({event:t,listener:n})=>{null==e||e.addEventListener(t,n)})),()=>{t.forEach((({event:t,listener:n})=>{null==e||e.removeEventListener(t,n)}))}}),[d,h,w,b]),o((()=>{const e=document.querySelector(`#${d}`);return ae({place:y,offset:m,elementReference:e,tooltipReference:S.current,tooltipArrowReference:R.current}).then((e=>{Object.keys(e.tooltipStyles).length&&O(e.tooltipStyles),Object.keys(e.tooltipArrowStyles).length&&P(e.tooltipArrowStyles)})),()=>{k.current=void 0,T.current=void 0}}),[A,d]),a.exports.jsxs(g,{id:e,role:"tooltip",className:u(le.tooltip,le[c],l,{[le.show]:A}),style:j,ref:S,children:[v||(x?a.exports.jsx(p,{content:_}):_),a.exports.jsx("div",{className:u(le.arrow,s),style:E,ref:R})]})},ce=["place","content","html","variant","offset","wrapper","events","delay-show","delay-hide"],ue=({anchorId:e,content:t,html:n,className:i,classNameArrow:l,variant:s="dark",place:c="top",offset:u=10,wrapper:f="div",children:p=null,events:d=["hover"],delayShow:y=0,delayHide:m=0,getContent:h})=>{const[g,v]=r(t||n),[b,w]=r(c),[x,_]=r(s),[S,R]=r(u),[k,T]=r(y),[j,O]=r(m),[E,P]=r(f),[A,N]=r(d),[L,C]=r(Boolean(n)),$=e=>{const t=Object.keys(e);let n=null;const r={place:e=>{w(e)},content:e=>{C(!0),v(h?h(e):e)},html:e=>{C(!0),v(h?h(e):e)},variant:e=>{_(e)},offset:e=>{R(e)},wrapper:e=>{P(e)},events:e=>{const t=e.split(" ");N(t)},"delay-show":e=>{T(Number(e))},"delay-hide":e=>{O(Number(e))}};t.forEach((t=>{n=t.replace("data-",""),ce.includes(n)&&r[n](e[t])}))};o((()=>{const t=document.querySelector(`#${e}`);if(!t)return()=>{};const n=new MutationObserver((e=>{e.forEach((e=>{if("attributes"===e.type){const n=(({element:e,attributeName:t})=>({[t]:e.getAttribute(t)}))({element:t,attributeName:e.attributeName});$(n)}}))}));n.observe(t,{attributes:!0,childList:!1,subtree:!1});const r=(e=>null==e?void 0:e.getAttributeNames().reduce(((t,n)=>(n.includes("data-")&&(t[n]=null==e?void 0:e.getAttribute(n)),t)),{}))(t);return $(r),()=>{n.disconnect()}}),[e]);const D={anchorId:e,className:i,classNameArrow:l,content:g,isHtmlContent:L,place:b,variant:x,offset:S,wrapper:E,events:A,delayShow:k,delayHide:j};return p?a.exports.jsx(se,{...D,children:p}):a.exports.jsx(se,{...D})};export{ue as Tooltip};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7}.styles-module_tooltip__mnnfp{border-radius:3px;font-size:90%;left:0;opacity:0;padding:8px 16px;pointer-events:none;position:absolute;top:0;transition:opacity .3s ease-out;visibility:hidden;width:max-content;will-change:opacity,visibility}.styles-module_arrow__K0L3T{background:var(--rt-color-dark);height:8px;position:absolute;transform:rotate(45deg);width:8px}.styles-module_show__2NboJ{opacity:.9;visibility:visible}.styles-module_dark__xNqje,.styles-module_dark__xNqje .styles-module_arrow__K0L3T{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X,.styles-module_light__Z6W-X .styles-module_arrow__K0L3T{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt,.styles-module_success__A2AKt .styles-module_arrow__K0L3T{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X,.styles-module_warning__SCK0X .styles-module_arrow__K0L3T{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD,.styles-module_error__JvumD .styles-module_arrow__K0L3T{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW,.styles-module_info__BWdHW .styles-module_arrow__K0L3T{background-color:var(--rt-color-info);color:var(--rt-color-white)}
|