@mui-treasury/layout
Advanced tools
Comparing version 4.2.0 to 4.2.1
@@ -59,11 +59,3 @@ "use strict"; | ||
_react["default"].useEffect(function () { | ||
if (!sidebarState.collapsed) { | ||
setState(function (prevState) { | ||
return _extends(_extends({}, prevState), {}, { | ||
expanded: false | ||
}); | ||
}); | ||
} | ||
}, [sidebarState.collapsed]); | ||
var isMouseOverSidebar = _react["default"].useRef(false); | ||
@@ -93,3 +85,8 @@ var setEntered = _react["default"].useCallback(function (payload) { | ||
if (sidebarState.collapsed) { | ||
setExpanded(true); | ||
isMouseOverSidebar.current = true; | ||
setTimeout(function () { | ||
if (isMouseOverSidebar.current) { | ||
setExpanded(true); | ||
} | ||
}, _utils.EDGE_SIDEBAR_EXPAND_DELAY); | ||
} | ||
@@ -105,2 +102,3 @@ }; | ||
isMouseOverSidebar.current = false; | ||
setExpanded(false); | ||
@@ -124,2 +122,12 @@ }; | ||
_react["default"].useEffect(function () { | ||
if (!sidebarState.collapsed) { | ||
setState(function (prevState) { | ||
return _extends(_extends({}, prevState), {}, { | ||
expanded: false | ||
}); | ||
}); | ||
} | ||
}, [sidebarState.collapsed]); | ||
return /*#__PURE__*/_react["default"].createElement(Context.Provider, { | ||
@@ -126,0 +134,0 @@ value: _extends(_extends({ |
@@ -16,3 +16,3 @@ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
import React from 'react'; | ||
import { get } from '../utils'; | ||
import { get, EDGE_SIDEBAR_EXPAND_DELAY } from '../utils'; | ||
var Context = React.createContext({ | ||
@@ -44,11 +44,3 @@ id: undefined, | ||
React.useEffect(function () { | ||
if (!sidebarState.collapsed) { | ||
setState(function (prevState) { | ||
return _extends(_extends({}, prevState), {}, { | ||
expanded: false | ||
}); | ||
}); | ||
} | ||
}, [sidebarState.collapsed]); | ||
var isMouseOverSidebar = React.useRef(false); | ||
var setEntered = React.useCallback(function (payload) { | ||
@@ -75,3 +67,8 @@ return setState(function (prevState) { | ||
if (sidebarState.collapsed) { | ||
setExpanded(true); | ||
isMouseOverSidebar.current = true; | ||
setTimeout(function () { | ||
if (isMouseOverSidebar.current) { | ||
setExpanded(true); | ||
} | ||
}, EDGE_SIDEBAR_EXPAND_DELAY); | ||
} | ||
@@ -86,2 +83,3 @@ }; | ||
isMouseOverSidebar.current = false; | ||
setExpanded(false); | ||
@@ -102,2 +100,11 @@ }; | ||
}, [setEntered]); | ||
React.useEffect(function () { | ||
if (!sidebarState.collapsed) { | ||
setState(function (prevState) { | ||
return _extends(_extends({}, prevState), {}, { | ||
expanded: false | ||
}); | ||
}); | ||
} | ||
}, [sidebarState.collapsed]); | ||
return /*#__PURE__*/React.createElement(Context.Provider, { | ||
@@ -104,0 +111,0 @@ value: _extends(_extends({ |
@@ -7,2 +7,3 @@ export var DEFAULT_HEADER_ID = 'header'; | ||
sm: 64 | ||
}; | ||
}; | ||
export var EDGE_SIDEBAR_EXPAND_DELAY = 350; |
{ | ||
"name": "@mui-treasury/layout", | ||
"module": "./esm/index.js", | ||
"version": "4.2.0", | ||
"version": "4.2.1", | ||
"author": "siriwatknp <siriwatkunaporn@gmail.com>", | ||
@@ -6,0 +6,0 @@ "description": "Supercharge your site with instant-layout, 100% compatible with material-ui", |
@@ -8,1 +8,2 @@ export declare const DEFAULT_HEADER_ID = "header"; | ||
}; | ||
export declare const EDGE_SIDEBAR_EXPAND_DELAY = 350; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.INITIAL_HEADER_HEIGHT = exports.DEFAULT_FOOTER_ID = exports.DEFAULT_CONTENT_ID = exports.DEFAULT_HEADER_ID = void 0; | ||
exports.EDGE_SIDEBAR_EXPAND_DELAY = exports.INITIAL_HEADER_HEIGHT = exports.DEFAULT_FOOTER_ID = exports.DEFAULT_CONTENT_ID = exports.DEFAULT_HEADER_ID = void 0; | ||
var DEFAULT_HEADER_ID = 'header'; | ||
@@ -18,2 +18,4 @@ exports.DEFAULT_HEADER_ID = DEFAULT_HEADER_ID; | ||
}; | ||
exports.INITIAL_HEADER_HEIGHT = INITIAL_HEADER_HEIGHT; | ||
exports.INITIAL_HEADER_HEIGHT = INITIAL_HEADER_HEIGHT; | ||
var EDGE_SIDEBAR_EXPAND_DELAY = 350; | ||
exports.EDGE_SIDEBAR_EXPAND_DELAY = EDGE_SIDEBAR_EXPAND_DELAY; |
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
475291
9155