@entur/tooltip
Advanced tools
Comparing version 2.2.4 to 2.2.5
@@ -6,2 +6,6 @@ # Change Log | ||
## [2.2.5](https://bitbucket.org/enturas/design-system/compare/@entur/tooltip@2.2.4...@entur/tooltip@2.2.5) (2020-08-19) | ||
**Note:** Version bump only for package @entur/tooltip | ||
## [2.2.4](https://bitbucket.org/enturas/design-system/compare/@entur/tooltip@2.2.3...@entur/tooltip@2.2.4) (2020-08-11) | ||
@@ -8,0 +12,0 @@ |
@@ -157,3 +157,5 @@ 'use strict'; | ||
var PopoverContext = /*#__PURE__*/React.createContext(undefined); | ||
var PopoverContext = | ||
/*#__PURE__*/ | ||
React.createContext(undefined); | ||
@@ -269,5 +271,7 @@ var usePopoverContext = function usePopoverContext() { | ||
return React.cloneElement(children, _extends({}, closeButtonProps, rest)); | ||
return React.cloneElement(children, _extends({}, closeButtonProps, {}, rest)); | ||
}; | ||
var PopoverContent = /*#__PURE__*/React__default.forwardRef(function (_ref4, ref) { | ||
var PopoverContent = | ||
/*#__PURE__*/ | ||
React__default.forwardRef(function (_ref4, ref) { | ||
var children = _ref4.children; | ||
@@ -274,0 +278,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@entur/utils"),n=require("react"),r=e(n),o=require("react-popper"),u=e(require("classnames")),s=require("@entur/icons"),i=require("@entur/button"),a=require("@entur/layout");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)t.indexOf(n=u[r])>=0||(o[n]=e[n]);return o}var f=n.createContext(void 0),p=function(){var e=n.useContext(f);if(null==e)throw Error("usePopoverContext must be used within <Popover/>");return e},d=r.forwardRef((function(e,t){var n=e.children,o=p(),s=o.showPopover,i=o.attributes,c=o.styles,l=(0,o.popoverContentProps)({ref:t});return r.createElement(a.Contrast,Object.assign({className:u("eds-popover",{"eds-popover--hidden":!s},"eds-contrast"),style:c.popper,"aria-hidden":!s},i.styles,l),n)}));t.warnAboutMissingStyles("tooltip"),exports.Popover=function(e){var t=e.children,n=e.placement,u=void 0===n?"bottom-start":n,s=r.useState(!1),i=s[0],a=s[1],c=r.useRef(null),l=r.useRef(null),p=o.usePopper(c.current,l.current,{modifiers:[{name:"arrow",enabled:!1},{name:"offset",options:{offset:[0,8]}}],placement:u}),d=p.styles,v=p.attributes,m=p.forceUpdate;r.useEffect((function(){m&&m()}),[i,m]);var b,h,E,g=r.useCallback((function(){return{onClick:function(e){e.preventDefault(),a((function(e){return!e}))},"aria-haspopup":"dialog","aria-expanded":i,ref:c}}),[c,i]);r.useEffect((function(){var e=function(e){b.current&&!b.current.contains(e.target)&&h.current&&!h.current.contains(e.target)&&E()};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[b=l,h=c,E=function(){return a(!1)}]);var y={onClick:function(e){e.preventDefault(),a(!1)}},P=r.useCallback((function(){return{role:"dialog","aria-modal":"false",ref:l,onKeyDown:function(e){"Escape"===e.key&&i&&a(!1)}}}),[l,i]);return r.createElement(f.Provider,{value:{showPopover:i,triggerElement:c,contentElement:l,styles:d,attributes:v,popoverContentProps:P,closeButtonProps:y,triggerProps:g}},t)},exports.PopoverCloseButton=function(e){var t=e.children,r=l(e,["children"]),o=p();return n.cloneElement(t,c({},o.closeButtonProps,r))},exports.PopoverContent=d,exports.PopoverTrigger=function(e){var t=e.children,o=p().triggerProps,u=r.Children.only(t);return n.cloneElement(u,o())},exports.Tooltip=function(e){var a,f=e.placement,p=e.content,d=e.children,v=e.className,m=e.isOpen,b=void 0!==m&&m,h=e.disableHoverListener,E=void 0!==h&&h,g=e.disableFocusListener,y=void 0!==g&&g,P=e.showCloseButton,C=void 0===P||P,w=l(e,["placement","content","children","className","isOpen","disableHoverListener","disableFocusListener","showCloseButton"]),x=n.useState(b||!1),O=x[0],L=x[1];r.useEffect((function(){return function(){clearTimeout(a)}}));var j=t.useRandomId("eds-tooltip");r.useEffect((function(){L(b)}),[b]);var k=f;f.includes("-")&&(f.includes("right")&&(k=f.replace("right","end")),f.includes("left")&&(k=f.replace("left","start")));var q={};return q["aria-describedby"]=j,y||(q.onFocus=function(){return L(!0)},q.onBlur=function(){return L(!1)}),E||(q.onMouseLeave=function(){return L(!1)},q.onMouseEnter=function(e){return e.persist(),void(a=setTimeout((function(){L(!0)}),150))}),r.createElement(o.Manager,null,r.createElement(o.Reference,null,(function(e){return n.cloneElement(d,c({ref:e.ref},q))})),O&&r.createElement(o.Popper,{modifiers:[{name:"arrow",enabled:!1},{name:"offset",options:{offset:[0,10]}}],placement:k},(function(e){var t=e.ref,n=e.style,o=e.placement;return r.createElement("div",Object.assign({className:u("eds-tooltip",v,"eds-tooltip--"+o),ref:t,style:n,role:"tooltip",id:j,"data-placement":o},w),p,b&&C&&r.createElement(i.IconButton,{className:"eds-tooltip__close-button",onClick:function(){return L(!1)}},r.createElement(s.CloseIcon,null)))})))}; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=require("@entur/utils"),n=require("react"),r=e(n),o=require("react-popper"),u=e(require("classnames")),s=require("@entur/icons"),i=require("@entur/button"),a=require("@entur/layout");function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function l(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r<u.length;r++)t.indexOf(n=u[r])>=0||(o[n]=e[n]);return o}var f=n.createContext(void 0),p=function(){var e=n.useContext(f);if(null==e)throw Error("usePopoverContext must be used within <Popover/>");return e},d=r.forwardRef((function(e,t){var n=e.children,o=p(),s=o.showPopover,i=o.attributes,c=o.styles,l=(0,o.popoverContentProps)({ref:t});return r.createElement(a.Contrast,Object.assign({className:u("eds-popover",{"eds-popover--hidden":!s},"eds-contrast"),style:c.popper,"aria-hidden":!s},i.styles,l),n)}));t.warnAboutMissingStyles("tooltip"),exports.Popover=function(e){var t=e.children,n=e.placement,u=void 0===n?"bottom-start":n,s=r.useState(!1),i=s[0],a=s[1],c=r.useRef(null),l=r.useRef(null),p=o.usePopper(c.current,l.current,{modifiers:[{name:"arrow",enabled:!1},{name:"offset",options:{offset:[0,8]}}],placement:u}),d=p.styles,v=p.attributes,m=p.forceUpdate;r.useEffect((function(){m&&m()}),[i,m]);var b,h,E,g=r.useCallback((function(){return{onClick:function(e){e.preventDefault(),a((function(e){return!e}))},"aria-haspopup":"dialog","aria-expanded":i,ref:c}}),[c,i]);r.useEffect((function(){var e=function(e){b.current&&!b.current.contains(e.target)&&h.current&&!h.current.contains(e.target)&&E()};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),function(){document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e)}}),[b=l,h=c,E=function(){return a(!1)}]);var y={onClick:function(e){e.preventDefault(),a(!1)}},P=r.useCallback((function(){return{role:"dialog","aria-modal":"false",ref:l,onKeyDown:function(e){"Escape"===e.key&&i&&a(!1)}}}),[l,i]);return r.createElement(f.Provider,{value:{showPopover:i,triggerElement:c,contentElement:l,styles:d,attributes:v,popoverContentProps:P,closeButtonProps:y,triggerProps:g}},t)},exports.PopoverCloseButton=function(e){var t=e.children,r=l(e,["children"]),o=p();return n.cloneElement(t,c({},o.closeButtonProps,{},r))},exports.PopoverContent=d,exports.PopoverTrigger=function(e){var t=e.children,o=p().triggerProps,u=r.Children.only(t);return n.cloneElement(u,o())},exports.Tooltip=function(e){var a,f=e.placement,p=e.content,d=e.children,v=e.className,m=e.isOpen,b=void 0!==m&&m,h=e.disableHoverListener,E=void 0!==h&&h,g=e.disableFocusListener,y=void 0!==g&&g,P=e.showCloseButton,C=void 0===P||P,w=l(e,["placement","content","children","className","isOpen","disableHoverListener","disableFocusListener","showCloseButton"]),x=n.useState(b||!1),O=x[0],L=x[1];r.useEffect((function(){return function(){clearTimeout(a)}}));var j=t.useRandomId("eds-tooltip");r.useEffect((function(){L(b)}),[b]);var k=f;f.includes("-")&&(f.includes("right")&&(k=f.replace("right","end")),f.includes("left")&&(k=f.replace("left","start")));var q={};return q["aria-describedby"]=j,y||(q.onFocus=function(){return L(!0)},q.onBlur=function(){return L(!1)}),E||(q.onMouseLeave=function(){return L(!1)},q.onMouseEnter=function(e){return e.persist(),void(a=setTimeout((function(){L(!0)}),150))}),r.createElement(o.Manager,null,r.createElement(o.Reference,null,(function(e){return n.cloneElement(d,c({ref:e.ref},q))})),O&&r.createElement(o.Popper,{modifiers:[{name:"arrow",enabled:!1},{name:"offset",options:{offset:[0,10]}}],placement:k},(function(e){var t=e.ref,n=e.style,o=e.placement;return r.createElement("div",Object.assign({className:u("eds-tooltip",v,"eds-tooltip--"+o),ref:t,style:n,role:"tooltip",id:j,"data-placement":o},w),p,b&&C&&r.createElement(i.IconButton,{className:"eds-tooltip__close-button",onClick:function(){return L(!1)}},r.createElement(s.CloseIcon,null)))})))}; | ||
//# sourceMappingURL=tooltip.cjs.production.min.js.map |
@@ -150,3 +150,5 @@ import { useRandomId, warnAboutMissingStyles } from '@entur/utils'; | ||
var PopoverContext = /*#__PURE__*/createContext(undefined); | ||
var PopoverContext = | ||
/*#__PURE__*/ | ||
createContext(undefined); | ||
@@ -262,5 +264,7 @@ var usePopoverContext = function usePopoverContext() { | ||
return cloneElement(children, _extends({}, closeButtonProps, rest)); | ||
return cloneElement(children, _extends({}, closeButtonProps, {}, rest)); | ||
}; | ||
var PopoverContent = /*#__PURE__*/React.forwardRef(function (_ref4, ref) { | ||
var PopoverContent = | ||
/*#__PURE__*/ | ||
React.forwardRef(function (_ref4, ref) { | ||
var children = _ref4.children; | ||
@@ -267,0 +271,0 @@ |
{ | ||
"name": "@entur/tooltip", | ||
"version": "2.2.4", | ||
"version": "2.2.5", | ||
"license": "EUPL-1.2", | ||
@@ -34,4 +34,4 @@ "main": "dist/index.js", | ||
"@entur/button": "^2.3.2", | ||
"@entur/icons": "^1.10.0", | ||
"@entur/layout": "^1.7.2", | ||
"@entur/icons": "^1.11.0", | ||
"@entur/layout": "^1.7.3", | ||
"@entur/utils": "^0.2.9", | ||
@@ -41,3 +41,3 @@ "@popperjs/core": "2.4.4", | ||
}, | ||
"gitHead": "5011005edbc761cd58f3d735d096a376c98211a4" | ||
"gitHead": "0486654fb48b87c6254cb641ad15809393abec67" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106816
723
Updated@entur/icons@^1.11.0
Updated@entur/layout@^1.7.3