Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-md/tooltip

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-md/tooltip - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0

12

CHANGELOG.md

@@ -6,2 +6,14 @@ # Change Log

# [3.1.0](https://github.com/mlaursen/react-md/compare/v3.0.1...v3.1.0) (2021-09-10)
### Other Internal Changes
* ran `yarn format` to include new files ([48d3d7f](https://github.com/mlaursen/react-md/commit/48d3d7fddb0435edf7dec9d0ba38cf3f0f251709))
## [3.0.1](https://github.com/mlaursen/react-md/compare/v3.0.0...v3.0.1) (2021-08-15)

@@ -8,0 +20,0 @@

6

lib/Tooltip.js

@@ -54,3 +54,3 @@ "use strict";

var constants_1 = require("./constants");
var block = utils_1.bem("rmd-tooltip");
var block = (0, utils_1.bem)("rmd-tooltip");
/**

@@ -84,3 +84,3 @@ * This is the base tooltip component that can only be used to render a tooltip

*/
exports.Tooltip = react_1.forwardRef(function Tooltip(_a, ref) {
exports.Tooltip = (0, react_1.forwardRef)(function Tooltip(_a, ref) {
var _b;

@@ -90,3 +90,3 @@ var className = _a.className, _c = _a.classNames, classNames = _c === void 0 ? constants_1.DEFAULT_TOOLTIP_CLASSNAMES : _c, visible = _a.visible, _d = _a.timeout, timeout = _d === void 0 ? constants_1.DEFAULT_TOOLTIP_TIMEOUT : _d, _e = _a.dense, dense = _e === void 0 ? false : _e, _f = _a.lineWrap, lineWrap = _f === void 0 ? true : _f, _g = _a.position, position = _g === void 0 ? constants_1.DEFAULT_TOOLTIP_POSITION : _g, children = _a.children, onEnter = _a.onEnter, onEntering = _a.onEntering, onEntered = _a.onEntered, onExit = _a.onExit, onExiting = _a.onExiting, onExited = _a.onExited, _h = _a.portal, portal = _h === void 0 ? true : _h, portalInto = _a.portalInto, portalIntoId = _a.portalIntoId, _j = _a.mountOnEnter, mountOnEnter = _j === void 0 ? true : _j, _k = _a.unmountOnExit, unmountOnExit = _k === void 0 ? true : _k, props = __rest(_a, ["className", "classNames", "visible", "timeout", "dense", "lineWrap", "position", "children", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "portal", "portalInto", "portalIntoId", "mountOnEnter", "unmountOnExit"]);

react_1.default.createElement(CSSTransition_1.default, { classNames: classNames, in: visible, timeout: timeout, onEnter: onEnter, onEntering: onEntering, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited, mountOnEnter: mountOnEnter, unmountOnExit: unmountOnExit },
react_1.default.createElement("span", __assign({}, props, { ref: ref, role: "tooltip", className: classnames_1.default(block((_b = {
react_1.default.createElement("span", __assign({}, props, { ref: ref, role: "tooltip", className: (0, classnames_1.default)(block((_b = {
dense: dense,

@@ -93,0 +93,0 @@ "line-wrap": lineWrap,

@@ -70,3 +70,3 @@ "use strict";

var id = _a.id, style = _a.style, children = _a.children, tooltipChildren = _a.tooltip, _b = _a.dense, dense = _b === void 0 ? false : _b, _c = _a.vhMargin, vhMargin = _c === void 0 ? constants_1.DEFAULT_TOOLTIP_MARGIN : _c, _d = _a.vwMargin, vwMargin = _d === void 0 ? constants_1.DEFAULT_TOOLTIP_MARGIN : _d, _e = _a.spacing, spacing = _e === void 0 ? constants_1.DEFAULT_TOOLTIP_SPACING : _e, _f = _a.denseSpacing, denseSpacing = _f === void 0 ? constants_1.DEFAULT_TOOLTIP_DENSE_SPACING : _f, propPosition = _a.position, _g = _a.threshold, threshold = _g === void 0 ? constants_1.DEFAULT_TOOLTIP_THRESHOLD : _g, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onTouchStart = _a.onTouchStart, onContextMenu = _a.onContextMenu, onBlur = _a.onBlur, onFocus = _a.onFocus, onKeyDown = _a.onKeyDown, describedBy = _a["aria-describedby"], _h = _a.defaultPosition, defaultPosition = _h === void 0 ? constants_1.DEFAULT_TOOLTIP_POSITION : _h, _j = _a.mountOnEnter, mountOnEnter = _j === void 0 ? true : _j, _k = _a.unmountOnExit, unmountOnExit = _k === void 0 ? true : _k, disableSwapping = _a.disableSwapping, disableHoverMode = _a.disableHoverMode, _l = _a.disableAutoSpacing, disableAutoSpacing = _l === void 0 ? process.env.NODE_ENV === "test" : _l, props = __rest(_a, ["id", "style", "children", "tooltip", "dense", "vhMargin", "vwMargin", "spacing", "denseSpacing", "position", "threshold", "onClick", "onMouseEnter", "onMouseLeave", "onTouchStart", "onContextMenu", "onBlur", "onFocus", "onKeyDown", "aria-describedby", "defaultPosition", "mountOnEnter", "unmountOnExit", "disableSwapping", "disableHoverMode", "disableAutoSpacing"]);
var _m = useTooltip_1.useTooltip({
var _m = (0, useTooltip_1.useTooltip)({
baseId: id,

@@ -99,3 +99,3 @@ style: style,

var child_1 = react_1.Children.only(children);
return react_1.cloneElement(child_1, { id: id, "aria-describedby": describedBy });
return (0, react_1.cloneElement)(child_1, { id: id, "aria-describedby": describedBy });
}

@@ -130,3 +130,3 @@ var tooltip = (react_1.default.createElement(Tooltip_1.Tooltip, __assign({}, tooltipProps, props, { mountOnEnter: mountOnEnter, unmountOnExit: unmountOnExit }), tooltipChildren));

return (react_1.default.createElement(react_1.default.Fragment, null,
react_1.cloneElement(child, merged),
(0, react_1.cloneElement)(child, merged),
tooltip));

@@ -133,0 +133,0 @@ }

@@ -82,4 +82,4 @@ "use strict";

var baseId = _a.baseId, style = _a.style, describedBy = _a.describedBy, _b = _a.dense, dense = _b === void 0 ? false : _b, _c = _a.spacing, spacing = _c === void 0 ? constants_1.DEFAULT_TOOLTIP_SPACING : _c, _d = _a.denseSpacing, denseSpacing = _d === void 0 ? constants_1.DEFAULT_TOOLTIP_DENSE_SPACING : _d, determinedPosition = _a.position, _e = _a.defaultPosition, defaultPosition = _e === void 0 ? constants_1.DEFAULT_TOOLTIP_POSITION : _e, _f = _a.vwMargin, vwMargin = _f === void 0 ? constants_1.DEFAULT_TOOLTIP_MARGIN : _f, _g = _a.vhMargin, vhMargin = _g === void 0 ? constants_1.DEFAULT_TOOLTIP_MARGIN : _g, _h = _a.threshold, threshold = _h === void 0 ? constants_1.DEFAULT_TOOLTIP_THRESHOLD : _h, _j = _a.touchTime, touchTime = _j === void 0 ? constants_1.DEFAULT_TOOLTIP_DELAY : _j, _k = _a.focusTime, focusTime = _k === void 0 ? constants_1.DEFAULT_TOOLTIP_DELAY : _k, propOnFocus = _a.onFocus, propOnBlur = _a.onBlur, propOnKeyDown = _a.onKeyDown, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, propOnTouchStart = _a.onTouchStart, propOnContextMenu = _a.onContextMenu, onEnter = _a.onEnter, onEntering = _a.onEntering, onEntered = _a.onEntered, onExited = _a.onExited, disableSwapping = _a.disableSwapping, disabled = _a.disableHoverMode, _l = _a.disableAutoSpacing, disableAutoSpacing = _l === void 0 ? process.env.NODE_ENV === "test" : _l;
var containerRef = react_1.useRef(null);
var _m = useTooltipPosition_1.useTooltipPosition({
var containerRef = (0, react_1.useRef)(null);
var _m = (0, useTooltipPosition_1.useTooltipPosition)({
position: determinedPosition,

@@ -89,7 +89,7 @@ defaultPosition: defaultPosition,

}), position = _m[0], updatePosition = _m[1];
var mode = utils_1.useUserInteractionMode();
var _o = react_1.useState(null), initiatedBy = _o[0], setInitiatedBy = _o[1];
var windowFocusEvent = react_1.useRef(false);
var timeout = react_1.useRef(undefined);
var _p = utils_1.useHoverMode({
var mode = (0, utils_1.useUserInteractionMode)();
var _o = (0, react_1.useState)(null), initiatedBy = _o[0], setInitiatedBy = _o[1];
var windowFocusEvent = (0, react_1.useRef)(false);
var timeout = (0, react_1.useRef)(undefined);
var _p = (0, utils_1.useHoverMode)({
disabled: disabled,

@@ -123,3 +123,3 @@ onClick: function (event) {

}), visible = _p.visible, setVisible = _p.setVisible, mouseHandlers = _p.handlers, disableHoverMode = _p.disableHoverMode, others = __rest(_p, ["visible", "setVisible", "handlers", "disableHoverMode"]);
var hide = react_1.useCallback(function () {
var hide = (0, react_1.useCallback)(function () {
window.clearTimeout(timeout.current);

@@ -192,3 +192,3 @@ setVisible(false);

};
react_1.useEffect(function () {
(0, react_1.useEffect)(function () {
if (mode !== "keyboard") {

@@ -210,3 +210,3 @@ windowFocusEvent.current = false;

}, [hide, mode]);
react_1.useEffect(function () {
(0, react_1.useEffect)(function () {
if (initiatedBy !== "touch") {

@@ -222,6 +222,6 @@ return;

}, [hide, initiatedBy, setVisible]);
utils_1.useOnUnmount(function () {
(0, utils_1.useOnUnmount)(function () {
window.clearTimeout(timeout.current);
});
var _q = transition_1.useFixedPositioning({
var _q = (0, transition_1.useFixedPositioning)({
style: style,

@@ -239,3 +239,3 @@ anchor: getAnchor(position),

}
var currentSpacing = utils_1.unitToNumber(tooltipSpacing);
var currentSpacing = (0, utils_1.unitToNumber)(tooltipSpacing);
return {

@@ -257,3 +257,3 @@ vwMargin: vwMargin,

var tooltipId = baseId + "-tooltip";
var elementProps = __assign({ id: baseId, "aria-describedby": classnames_1.default(visible && tooltipId, describedBy) || undefined }, tooltipHandlers);
var elementProps = __assign({ id: baseId, "aria-describedby": (0, classnames_1.default)(visible && tooltipId, describedBy) || undefined }, tooltipHandlers);
var tooltipProps = __assign({ id: tooltipId, dense: dense, visible: visible, position: position }, positionProps);

@@ -260,0 +260,0 @@ return __assign(__assign({}, others), { visible: visible, setVisible: setVisible, handlers: tooltipHandlers, elementProps: elementProps, tooltipProps: tooltipProps, disableHoverMode: disableHoverMode });

@@ -20,7 +20,7 @@ "use strict";

var determinedPosition = _a.position, _b = _a.defaultPosition, defaultPosition = _b === void 0 ? "below" : _b, _c = _a.threshold, threshold = _c === void 0 ? constants_1.DEFAULT_TOOLTIP_THRESHOLD : _c;
var _d = react_1.useState(defaultPosition), position = _d[0], setPosition = _d[1];
var updatePosition = react_1.useCallback(function (container) {
var _d = (0, react_1.useState)(defaultPosition), position = _d[0], setPosition = _d[1];
var updatePosition = (0, react_1.useCallback)(function (container) {
var _a = container.getBoundingClientRect(), top = _a.top, left = _a.left;
var vh = utils_1.getViewportSize("height");
var vw = utils_1.getViewportSize("width");
var vh = (0, utils_1.getViewportSize)("height");
var vw = (0, utils_1.getViewportSize)("width");
var nextPosition = defaultPosition;

@@ -27,0 +27,0 @@ if (defaultPosition === "above" && top < vh * threshold) {

{
"name": "@react-md/tooltip",
"version": "3.0.1",
"version": "3.1.0",
"description": "Create accessible tooltips within react-md based on the material design specifications.",

@@ -34,7 +34,7 @@ "main": "./lib/index.js",

"dependencies": {
"@react-md/portal": "^3.0.0",
"@react-md/theme": "^3.0.0",
"@react-md/transition": "^3.0.1",
"@react-md/typography": "^3.0.0",
"@react-md/utils": "^3.0.0",
"@react-md/portal": "^3.1.0",
"@react-md/theme": "^3.1.0",
"@react-md/transition": "^3.1.0",
"@react-md/typography": "^3.1.0",
"@react-md/utils": "^3.1.0",
"classnames": "^2.3.1",

@@ -57,3 +57,3 @@ "react-transition-group": "^4.4.2"

},
"gitHead": "68149668ebc79c4bbcbb2875d65b9ac243e12c77"
"gitHead": "5891a3255f12fb34d2cc82d81d10f85f712a21e8"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc