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

@mui-treasury/layout

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mui-treasury/layout - npm Package Compare versions

Comparing version 5.0.0-alpha.9 to 5.0.0-alpha.10

26

esm/Content/Content.js

@@ -1,3 +0,1 @@

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

@@ -17,7 +15,7 @@

slot: "Root",
overridesResolver: function overridesResolver(props, styles) {
return styles.root;
}
})(function (_ref) {
var styleProps = _ref.styleProps;
overridesResolver: (props, styles) => styles.root
})((_ref) => {
var {
styleProps
} = _ref;
return _extends({

@@ -31,5 +29,7 @@ transition: CSS_TRANSITION

});
export var Content = function Content(_ref2) {
var children = _ref2.children,
inProps = _objectWithoutProperties(_ref2, ["children"]);
export var Content = (_ref2) => {
var {
children
} = _ref2,
inProps = _objectWithoutPropertiesLoose(_ref2, ["children"]);

@@ -41,3 +41,5 @@ var props = useThemeProps({

var ctx = useLayoutCtx();
var builder = ctx.builder;
var {
builder
} = ctx;
var sxProps = getContentSxProps(builder, CONTENT_ID);

@@ -53,5 +55,5 @@ var isFullscreen = useFullscreenCtx();

styleProps: {
isFullscreen: isFullscreen
isFullscreen
}
}), typeof children === "function" ? children(ctx) : children);
};

@@ -1,7 +0,1 @@

function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import { createWidthInterface } from "../Width/WidthModel";

@@ -11,3 +5,3 @@ import { combineBreakpoints } from "../utils/combineBreakpoints";

import { toValidCssValue } from "../utils/toValidCssValue";
export var getContentSxProps = function getContentSxProps(modules, id) {
export var getContentSxProps = (modules, id) => {
var _leftEdgeSidebar$getO, _rightEdgeSidebar$get;

@@ -20,4 +14,6 @@

};
var leftEdgeSidebar = modules.leftEdgeSidebar,
rightEdgeSidebar = modules.rightEdgeSidebar;
var {
leftEdgeSidebar,
rightEdgeSidebar
} = modules;
var leftOccupiedSpace = (_leftEdgeSidebar$getO = leftEdgeSidebar === null || leftEdgeSidebar === void 0 ? void 0 : leftEdgeSidebar.getOccupiedSpace()) !== null && _leftEdgeSidebar$getO !== void 0 ? _leftEdgeSidebar$getO : {};

@@ -27,37 +23,27 @@ var rightOccupiedSpace = (_rightEdgeSidebar$get = rightEdgeSidebar === null || rightEdgeSidebar === void 0 ? void 0 : rightEdgeSidebar.getOccupiedSpace()) !== null && _rightEdgeSidebar$get !== void 0 ? _rightEdgeSidebar$get : {};

var _iterator = _createForOfIteratorHelper(breakpoints),
_step;
for (var key of breakpoints) {
var bp = key;
var effectLeft = createWidthInterface(0);
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var key = _step.value;
var bp = key;
var effectLeft = createWidthInterface(0);
if (leftEdgeSidebar) {
effectLeft = createWidthInterface(leftEdgeSidebar.isFlexiblePersistent(bp, id) ? 0 : pickNearestBreakpoint(leftOccupiedSpace, bp));
var occupiedSpace = leftOccupiedSpace[bp];
if (leftEdgeSidebar) {
effectLeft = createWidthInterface(leftEdgeSidebar.isFlexiblePersistent(bp, id) ? 0 : pickNearestBreakpoint(leftOccupiedSpace, bp));
var occupiedSpace = leftOccupiedSpace[bp];
if (occupiedSpace) {
result.marginLeft[bp] = toValidCssValue(occupiedSpace);
}
if (occupiedSpace) {
result.marginLeft[bp] = toValidCssValue(occupiedSpace);
}
}
var effectRight = createWidthInterface(0);
var effectRight = createWidthInterface(0);
if (rightEdgeSidebar) {
effectRight = createWidthInterface(rightEdgeSidebar.isFlexiblePersistent(bp, id) ? 0 : pickNearestBreakpoint(rightOccupiedSpace, bp));
var _occupiedSpace = rightOccupiedSpace[bp];
if (rightEdgeSidebar) {
effectRight = createWidthInterface(rightEdgeSidebar.isFlexiblePersistent(bp, id) ? 0 : pickNearestBreakpoint(rightOccupiedSpace, bp));
var _occupiedSpace = rightOccupiedSpace[bp];
if (_occupiedSpace) {
result.marginRight[bp] = toValidCssValue(_occupiedSpace);
}
if (_occupiedSpace) {
result.marginRight[bp] = toValidCssValue(_occupiedSpace);
}
}
result.width[bp] = effectLeft.combine(effectRight).getStyle().width;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
result.width[bp] = effectLeft.combine(effectRight).getStyle().width;
}

@@ -64,0 +50,0 @@

@@ -6,5 +6,3 @@ import React from "react";

slot: "Root",
overridesResolver: function overridesResolver(props, styles) {
return styles.root;
}
overridesResolver: (props, styles) => styles.root
})({

@@ -17,4 +15,4 @@ minHeight: 0,

});
export var SidebarContent = function SidebarContent(props) {
export var SidebarContent = props => {
return /*#__PURE__*/React.createElement(SidebarContentRoot, props);
};

@@ -16,8 +16,9 @@ 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); }

})({});
export var EdgeOffset = function EdgeOffset(_ref) {
var sidebarId = _ref.sidebarId;
var _useLayoutCtx = useLayoutCtx(),
builder = _useLayoutCtx.builder;
export var EdgeOffset = (_ref) => {
var {
sidebarId
} = _ref;
var {
builder
} = useLayoutCtx();
var theme = useTheme();

@@ -30,8 +31,7 @@ var screen = useScreen();

var scrollY = useScrollY(!headerMagnetEnabled);
var {
totalHeight,
diffHeight
} = HeadersCompiler([builder.header, builder.topHeader, builder.subheader]).getClippedHeight(sidebarId); // header magnet geature
var _HeadersCompiler$getC = HeadersCompiler([builder.header, builder.topHeader, builder.subheader]).getClippedHeight(sidebarId),
totalHeight = _HeadersCompiler$getC.totalHeight,
diffHeight = _HeadersCompiler$getC.diffHeight; // header magnet geature
var style = {};

@@ -51,3 +51,3 @@

easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration["short"]
duration: theme.transitions.duration.short
})

@@ -54,0 +54,0 @@ }),

@@ -1,19 +0,3 @@

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
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); }

@@ -32,3 +16,3 @@

export var SidebarContext = /*#__PURE__*/React.createContext(undefined);
export var useSidebarCtx = function useSidebarCtx() {
export var useSidebarCtx = () => {
var ctx = useContext(SidebarContext);

@@ -42,7 +26,7 @@

};
export var useLooseSidebarCtx = function useLooseSidebarCtx() {
export var useLooseSidebarCtx = () => {
return useContext(SidebarContext);
};
var hasAutoExpanded = function hasAutoExpanded(config) {
var hasAutoExpanded = config => {
return !!config && (typeof config.autoExpanded === "boolean" || typeof config.uncollapsedOnHover === "boolean");

@@ -54,17 +38,21 @@ };

slot: "Root",
overridesResolver: function overridesResolver(props, styles) {
return styles.root;
}
})(function (_ref) {
var styleProps = _ref.styleProps;
return _extends({}, (styleProps.entered || styleProps.variant === "permanent" || styleProps.variant === "persistent") && _defineProperty({}, "& .".concat(drawerClasses.paper), {
transition: "".concat(CSS_TRANSITION, " !important"),
transitionProperty: "all !important"
}));
overridesResolver: (props, styles) => styles.root
})((_ref) => {
var {
styleProps
} = _ref;
return _extends({}, (styleProps.entered || styleProps.variant === "permanent" || styleProps.variant === "persistent") && {
["& .".concat(drawerClasses.paper)]: {
transition: "".concat(CSS_TRANSITION, " !important"),
transitionProperty: "all !important"
}
});
});
export var EdgeSidebar = function EdgeSidebar(_ref3) {
export var EdgeSidebar = (_ref2) => {
var _layoutState$sidebarI, _iDocument$body, _props$ModalProps, _props$PaperProps3, _props$PaperProps4, _builder$sidebarId;
var children = _ref3.children,
inProps = _objectWithoutProperties(_ref3, ["children"]);
var {
children
} = _ref2,
inProps = _objectWithoutPropertiesLoose(_ref2, ["children"]);

@@ -75,6 +63,7 @@ var _useThemeProps = useThemeProps({

}),
theme = _useThemeProps.theme,
props = _objectWithoutProperties(_useThemeProps, ["theme"]);
props = _objectWithoutPropertiesLoose(_useThemeProps, ["theme"]);
var anchor = props.anchor;
var {
anchor
} = props;

@@ -86,10 +75,11 @@ if (!anchor) {

var screen = useScreen();
var _useWindowCtx = useWindowCtx(),
iDocument = _useWindowCtx.iDocument;
var {
iDocument
} = useWindowCtx();
var ctx = useLayoutCtx();
var builder = ctx.builder,
layoutState = ctx.state,
setOpen = ctx.setOpen;
var {
builder,
state: layoutState,
setOpen
} = ctx;
var sidebarId = "".concat(anchor, "EdgeSidebar");

@@ -101,16 +91,8 @@ var edgeSidebar = builder[sidebarId];

var _React$useState = React.useState(false),
_React$useState2 = _slicedToArray(_React$useState, 2),
entered = _React$useState2[0],
setEntered = _React$useState2[1];
var _React$useState3 = React.useState(false),
_React$useState4 = _slicedToArray(_React$useState3, 2),
expanded = _React$useState4[0],
setExpanded = _React$useState4[1];
var [entered, setEntered] = React.useState(false);
var [expanded, setExpanded] = React.useState(false);
var isMouseOverSidebar = React.useRef(false);
var isAutoExpanded = hasAutoExpanded(config) && (config.autoExpanded || config.uncollapsedOnHover);
var onMouseEnter = function onMouseEnter(event) {
var onMouseEnter = event => {
var _props$PaperProps, _props$PaperProps$onM;

@@ -122,3 +104,3 @@

isMouseOverSidebar.current = true;
setTimeout(function () {
setTimeout(() => {
if (isMouseOverSidebar.current) {

@@ -131,3 +113,3 @@ setExpanded(true);

var onMouseLeave = function onMouseLeave(event) {
var onMouseLeave = event => {
var _props$PaperProps2, _props$PaperProps2$on;

@@ -148,3 +130,3 @@

// @ts-ignore
(_props$SlideProps = props.SlideProps) === null || _props$SlideProps === void 0 ? void 0 : (_props$SlideProps$onE = _props$SlideProps.onEntered) === null || _props$SlideProps$onE === void 0 ? void 0 : _props$SlideProps$onE.call.apply(_props$SlideProps$onE, [_props$SlideProps].concat(args));
(_props$SlideProps = props.SlideProps) === null || _props$SlideProps === void 0 ? void 0 : (_props$SlideProps$onE = _props$SlideProps.onEntered) === null || _props$SlideProps$onE === void 0 ? void 0 : _props$SlideProps$onE.call(_props$SlideProps, ...args);
setEntered(true);

@@ -161,7 +143,7 @@ };

// @ts-ignore
(_props$SlideProps2 = props.SlideProps) === null || _props$SlideProps2 === void 0 ? void 0 : (_props$SlideProps2$on = _props$SlideProps2.onExit) === null || _props$SlideProps2$on === void 0 ? void 0 : _props$SlideProps2$on.call.apply(_props$SlideProps2$on, [_props$SlideProps2].concat(args));
(_props$SlideProps2 = props.SlideProps) === null || _props$SlideProps2 === void 0 ? void 0 : (_props$SlideProps2$on = _props$SlideProps2.onExit) === null || _props$SlideProps2$on === void 0 ? void 0 : _props$SlideProps2$on.call(_props$SlideProps2, ...args);
setEntered(false);
};
React.useEffect(function () {
React.useEffect(() => {
if (!(sidebarState !== null && sidebarState !== void 0 && sidebarState.collapsed)) {

@@ -171,10 +153,8 @@ setExpanded(false);

}, [sidebarState === null || sidebarState === void 0 ? void 0 : sidebarState.collapsed]);
var sidebarValue = React.useMemo(function () {
return {
id: sidebarId,
anchor: anchor,
expanded: expanded,
setExpanded: setExpanded
};
}, [sidebarId, anchor, expanded, setExpanded]);
var sidebarValue = React.useMemo(() => ({
id: sidebarId,
anchor,
expanded,
setExpanded
}), [sidebarId, anchor, expanded, setExpanded]);
if (!screen) return null;

@@ -187,4 +167,4 @@ if (!edgeSidebar || !edgeSidebar.id) return null;

var styleProps = _extends({}, props, {
entered: entered,
variant: variant
entered,
variant
});

@@ -206,8 +186,8 @@

(_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call.apply(_props$onClose, [props].concat(args));
(_props$onClose = props.onClose) === null || _props$onClose === void 0 ? void 0 : _props$onClose.call(props, ...args);
setOpen(sidebarId, false);
},
SlideProps: _extends({}, props.SlideProps, {
onEntered: onEntered,
onExit: onExit
onEntered,
onExit
}),

@@ -221,4 +201,4 @@ ModalProps: _extends({}, props.ModalProps, {

}),
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
onMouseEnter,
onMouseLeave,
sx: _extends({}, (_props$PaperProps4 = props.PaperProps) === null || _props$PaperProps4 === void 0 ? void 0 : _props$PaperProps4.sx, (_builder$sidebarId = builder[sidebarId]) === null || _builder$sidebarId === void 0 ? void 0 : _builder$sidebarId.getSxProps())

@@ -225,0 +205,0 @@ })

@@ -1,31 +0,3 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
import { ResponsiveBuilder } from "../shared/ResponsiveBuilder";

@@ -35,190 +7,155 @@ import { combineBreakpoints } from "../utils/combineBreakpoints";

import { pickNearestBreakpoint } from "../utils/pickNearestBreakpoint";
export var EdgeSidebarBuilder = /*#__PURE__*/function (_ResponsiveBuilder) {
_inherits(EdgeSidebarBuilder, _ResponsiveBuilder);
export class EdgeSidebarBuilder extends ResponsiveBuilder {
constructor(params) {
super(params);
this.id = void 0;
this.autoCollapse = void 0;
this.state = void 0;
this.effectedBy = {};
var _super = _createSuper(EdgeSidebarBuilder);
function EdgeSidebarBuilder(params) {
var _this;
_classCallCheck(this, EdgeSidebarBuilder);
_this = _super.call(this, params);
_this.id = void 0;
_this.autoCollapse = void 0;
_this.state = void 0;
_this.effectedBy = {};
_this.getFinalWidth = function (config) {
this.getFinalWidth = config => {
var _this$state, _config$collapsedWidt;
return config !== null && config !== void 0 && config.collapsible && (_this$state = _this.state) !== null && _this$state !== void 0 && _this$state.collapsed ? (_config$collapsedWidt = config.collapsedWidth) !== null && _config$collapsedWidt !== void 0 ? _config$collapsedWidt : config.width : config === null || config === void 0 ? void 0 : config.width;
return config !== null && config !== void 0 && config.collapsible && (_this$state = this.state) !== null && _this$state !== void 0 && _this$state.collapsed ? (_config$collapsedWidt = config.collapsedWidth) !== null && _config$collapsedWidt !== void 0 ? _config$collapsedWidt : config.width : config === null || config === void 0 ? void 0 : config.width;
};
_this.autoCollapse = params.autoCollapse;
return _this;
this.autoCollapse = params.autoCollapse;
}
_createClass(EdgeSidebarBuilder, [{
key: "setState",
value: function setState(state) {
this.state = state;
}
}, {
key: "isFlexiblePersistent",
value: function isFlexiblePersistent(breakpoint, id) {
var config = pickNearestBreakpoint(this.config, breakpoint);
return EdgeSidebarBuilder.isFlexiblePersistentConfig(config, id);
}
}, {
key: "getOccupiedSpace",
value: function getOccupiedSpace(id) {
var _this2 = this;
setState(state) {
this.state = state;
}
return this.generateSxWithHidden({
hiddenValue: 0,
assignValue: function assignValue(breakpointConfig, _, lastResultVal) {
if (EdgeSidebarBuilder.isTemporaryConfig(breakpointConfig)) {
if (lastResultVal !== undefined) {
return 0;
}
isFlexiblePersistent(breakpoint, id) {
var config = pickNearestBreakpoint(this.config, breakpoint);
return EdgeSidebarBuilder.isFlexiblePersistentConfig(config, id);
}
return undefined; // do nothing for xs because temporary variant will be modal
getOccupiedSpace(id) {
return this.generateSxWithHidden({
hiddenValue: 0,
assignValue: (breakpointConfig, _, lastResultVal) => {
if (EdgeSidebarBuilder.isTemporaryConfig(breakpointConfig)) {
if (lastResultVal !== undefined) {
return 0;
}
if (EdgeSidebarBuilder.isPersistentConfig(breakpointConfig)) {
var _this2$state;
return undefined; // do nothing for xs because temporary variant will be modal
}
if ((_this2$state = _this2.state) !== null && _this2$state !== void 0 && _this2$state.open && !EdgeSidebarBuilder.isNonePersistentConfig(breakpointConfig, id)) {
return _this2.getFinalWidth(breakpointConfig);
} else {
return 0;
}
}
if (EdgeSidebarBuilder.isPersistentConfig(breakpointConfig)) {
var _this$state2;
if (EdgeSidebarBuilder.isPermanentConfig(breakpointConfig)) {
return _this2.getFinalWidth(breakpointConfig);
if ((_this$state2 = this.state) !== null && _this$state2 !== void 0 && _this$state2.open && !EdgeSidebarBuilder.isNonePersistentConfig(breakpointConfig, id)) {
return this.getFinalWidth(breakpointConfig);
} else {
return 0;
}
}
});
}
}, {
key: "getZIndex",
value: function getZIndex() {
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THEME;
var result = {};
if (!this.effectedBy.header) return {};
var breakpoints = combineBreakpoints(this.effectedBy.header.config, this.config);
var _iterator = _createForOfIteratorHelper(breakpoints),
_step;
if (EdgeSidebarBuilder.isPermanentConfig(breakpointConfig)) {
return this.getFinalWidth(breakpointConfig);
}
}
});
}
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var key = _step.value;
var bp = key;
getZIndex() {
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THEME;
var result = {};
if (!this.effectedBy.header) return {};
var breakpoints = combineBreakpoints(this.effectedBy.header.config, this.config);
if (this.id) {
var isClipped = this.effectedBy.header.isClipped(this.id, bp);
var isAboveSomeEdgeSidebar = this.effectedBy.header.isAboveSomeEdgeSidebar(bp);
result[bp] = theme.zIndex.drawer + (isAboveSomeEdgeSidebar && !isClipped ? 20 : 0);
} else {
console.warn("Cannot find EdgeSidebar id. This might be an internal bug, please open an issue in github.");
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
for (var key of breakpoints) {
var bp = key;
if (this.id) {
var isClipped = this.effectedBy.header.isClipped(this.id, bp);
var isAboveSomeEdgeSidebar = this.effectedBy.header.isAboveSomeEdgeSidebar(bp);
result[bp] = theme.zIndex.drawer + (isAboveSomeEdgeSidebar && !isClipped ? 20 : 0);
} else {
console.warn("Cannot find EdgeSidebar id. This might be an internal bug, please open an issue in github.");
}
return result;
}
}, {
key: "getWidth",
value: function getWidth() {
var _this3 = this;
return this.generateSx(function (breakpointConfig, bp) {
var _this3$config$bp;
return result;
}
return EdgeSidebarBuilder.isTemporaryConfig(breakpointConfig) ? (_this3$config$bp = _this3.config[bp]) === null || _this3$config$bp === void 0 ? void 0 : _this3$config$bp.width : _this3.getFinalWidth(breakpointConfig);
});
}
}, {
key: "getDrawerVariant",
value: function getDrawerVariant() {
return this.generateSx(function (config) {
return config.variant;
});
}
}, {
key: "getSxProps",
value: function getSxProps() {
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THEME;
var sxDisplay = this.getSxDisplay("flex");
var displayKeys = Object.keys(sxDisplay);
var shouldAttachDisplay = displayKeys.length > 1 || displayKeys.length === 1 && displayKeys[0] !== "xs";
return _extends({
width: this.getWidth(),
zIndex: this.getZIndex(theme)
}, shouldAttachDisplay && {
display: sxDisplay
});
}
}, {
key: "getEdgeTriggerSxDisplay",
value: function getEdgeTriggerSxDisplay(options) {
var field = options.field,
_options$display = options.display,
display = _options$display === void 0 ? "inline-flex" : _options$display;
return this.generateSxWithHidden({
strict: true,
hiddenValue: "none",
assignValue: function assignValue(config) {
if (field === "open") {
if (EdgeSidebarBuilder.isPermanentConfig(config)) {
return "none";
} else {
return display;
}
getWidth() {
return this.generateSx((breakpointConfig, bp) => {
var _this$config$bp;
return EdgeSidebarBuilder.isTemporaryConfig(breakpointConfig) ? (_this$config$bp = this.config[bp]) === null || _this$config$bp === void 0 ? void 0 : _this$config$bp.width : this.getFinalWidth(breakpointConfig);
});
}
getDrawerVariant() {
return this.generateSx(config => config.variant);
}
getSxProps() {
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THEME;
var sxDisplay = this.getSxDisplay("flex");
var displayKeys = Object.keys(sxDisplay);
var shouldAttachDisplay = displayKeys.length > 1 || displayKeys.length === 1 && displayKeys[0] !== "xs";
return _extends({
width: this.getWidth(),
zIndex: this.getZIndex(theme)
}, shouldAttachDisplay && {
display: sxDisplay
});
}
getEdgeTriggerSxDisplay(options) {
var {
field,
display = "inline-flex"
} = options;
return this.generateSxWithHidden({
strict: true,
hiddenValue: "none",
assignValue: config => {
if (field === "open") {
if (EdgeSidebarBuilder.isPermanentConfig(config)) {
return "none";
} else {
return display;
}
}
if (field === "collapsed") {
if (EdgeSidebarBuilder.isCollapsibleConfig(config)) {
return display;
} else {
return "none";
}
if (field === "collapsed") {
if (EdgeSidebarBuilder.isCollapsibleConfig(config)) {
return display;
} else {
return "none";
}
}
});
}
}]);
}
});
}
return EdgeSidebarBuilder;
}(ResponsiveBuilder);
}
EdgeSidebarBuilder.isPersistentConfig = function (config) {
EdgeSidebarBuilder.isPersistentConfig = config => {
return (config === null || config === void 0 ? void 0 : config.variant) === "persistent";
};
EdgeSidebarBuilder.isNonePersistentConfig = function (config, id) {
return !!config && !!EdgeSidebarBuilder.isPersistentConfig(config) && (typeof config.persistentBehavior === "string" && config.persistentBehavior === "none" || _typeof(config.persistentBehavior) === "object" && !!id && config.persistentBehavior[id] === "none");
EdgeSidebarBuilder.isNonePersistentConfig = (config, id) => {
return !!config && !!EdgeSidebarBuilder.isPersistentConfig(config) && (typeof config.persistentBehavior === "string" && config.persistentBehavior === "none" || typeof config.persistentBehavior === "object" && !!id && config.persistentBehavior[id] === "none");
};
EdgeSidebarBuilder.isFlexiblePersistentConfig = function (config, id) {
return !!config && !!EdgeSidebarBuilder.isPersistentConfig(config) && (typeof config.persistentBehavior === "string" && config.persistentBehavior === "flexible" || _typeof(config.persistentBehavior) === "object" && !!id && config.persistentBehavior[id] === "flexible");
EdgeSidebarBuilder.isFlexiblePersistentConfig = (config, id) => {
return !!config && !!EdgeSidebarBuilder.isPersistentConfig(config) && (typeof config.persistentBehavior === "string" && config.persistentBehavior === "flexible" || typeof config.persistentBehavior === "object" && !!id && config.persistentBehavior[id] === "flexible");
};
EdgeSidebarBuilder.isCollapsibleConfig = function (config) {
EdgeSidebarBuilder.isCollapsibleConfig = config => {
return (EdgeSidebarBuilder.isPermanentConfig(config) || EdgeSidebarBuilder.isPersistentConfig(config)) && !!(config !== null && config !== void 0 && config.collapsible);
};
EdgeSidebarBuilder.isPermanentConfig = function (config) {
EdgeSidebarBuilder.isPermanentConfig = config => {
return (config === null || config === void 0 ? void 0 : config.variant) === "permanent";
};
EdgeSidebarBuilder.isTemporaryConfig = function (config) {
EdgeSidebarBuilder.isTemporaryConfig = config => {
return (config === null || config === void 0 ? void 0 : config.variant) === "temporary";
};
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); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

@@ -13,38 +11,39 @@

})({});
export var EdgeTrigger = function EdgeTrigger(_ref) {
export var EdgeTrigger = (_ref) => {
var _state$field;
var target = _ref.target,
_ref$display = _ref.display,
display = _ref$display === void 0 ? "inline-flex" : _ref$display,
children = _ref.children,
props = _objectWithoutProperties(_ref, ["target", "display", "children"]);
var {
target,
display = "inline-flex",
children
} = _ref,
props = _objectWithoutPropertiesLoose(_ref, ["target", "display", "children"]);
var anchor = target.anchor,
field = target.field;
var {
anchor,
field
} = target;
var _useEdgeSidebar = useEdgeSidebar({
anchor: anchor
anchor
}),
sidebarId = _useEdgeSidebar.sidebarId,
edgeSidebar = _useEdgeSidebar.edgeSidebar,
state = _objectWithoutProperties(_useEdgeSidebar, ["sidebarId", "edgeSidebar"]);
{
sidebarId,
edgeSidebar
} = _useEdgeSidebar,
state = _objectWithoutPropertiesLoose(_useEdgeSidebar, ["sidebarId", "edgeSidebar"]);
var sxDisplay = edgeSidebar === null || edgeSidebar === void 0 ? void 0 : edgeSidebar.getEdgeTriggerSxDisplay({
display: display,
field: field
display,
field
});
var setState = function setState(val) {};
var setState = val => {};
if (field === "collapsed") {
setState = function setState(val) {
return state.setCollapsed(sidebarId, val);
};
setState = val => state.setCollapsed(sidebarId, val);
}
if (field === "open") {
setState = function setState(val) {
return state.setOpen(sidebarId, val);
};
setState = val => state.setOpen(sidebarId, val);
}

@@ -51,0 +50,0 @@

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); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import { combineBreakpoints } from "../utils/combineBreakpoints";
import { pickNearestBreakpoint } from "../utils/pickNearestBreakpoint";
export var getEdgeOffsetSxProps = function getEdgeOffsetSxProps(edgeSidebar, sxClippedHeight) {
export var getEdgeOffsetSxProps = (edgeSidebar, sxClippedHeight) => {
var result = {};

@@ -17,17 +11,7 @@

var _iterator = _createForOfIteratorHelper(breakpoints),
_step;
for (var key of breakpoints) {
var _pickNearestBreakpoin;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _pickNearestBreakpoin;
var key = _step.value;
var bp = key;
result[bp] = (_pickNearestBreakpoin = pickNearestBreakpoint(sxClippedHeight, bp)) !== null && _pickNearestBreakpoin !== void 0 ? _pickNearestBreakpoin : 0;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
var bp = key;
result[bp] = (_pickNearestBreakpoin = pickNearestBreakpoint(sxClippedHeight, bp)) !== null && _pickNearestBreakpoin !== void 0 ? _pickNearestBreakpoin : 0;
}

@@ -34,0 +18,0 @@ }

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); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

@@ -9,14 +7,16 @@

import { useLooseSidebarCtx } from "./EdgeSidebar";
export var useEdgeSidebar = function useEdgeSidebar(options) {
export var useEdgeSidebar = options => {
var _sidebar$anchor;
var _ref = options !== null && options !== void 0 ? options : {},
anchor = _ref.anchor;
var {
anchor
} = options !== null && options !== void 0 ? options : {};
var sidebar = useLooseSidebarCtx();
var _useLayoutCtx = useLayoutCtx(),
state = _useLayoutCtx.state,
builder = _useLayoutCtx.builder,
triggers = _objectWithoutProperties(_useLayoutCtx, ["state", "builder"]);
{
state,
builder
} = _useLayoutCtx,
triggers = _objectWithoutPropertiesLoose(_useLayoutCtx, ["state", "builder"]);

@@ -31,3 +31,3 @@ if (!sidebar && !anchor) {

return _extends({
sidebarId: sidebarId
sidebarId
}, sidebarState, triggers, {

@@ -34,0 +34,0 @@ edgeSidebar: builder[sidebarId]

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); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

@@ -15,14 +13,16 @@

slot: "Root",
overridesResolver: function overridesResolver(props, styles) {
return styles.root;
}
overridesResolver: (props, styles) => styles.root
})({
transition: CSS_TRANSITION
});
export var Footer = function Footer(_ref) {
var children = _ref.children,
props = _objectWithoutProperties(_ref, ["children"]);
export var Footer = (_ref) => {
var {
children
} = _ref,
props = _objectWithoutPropertiesLoose(_ref, ["children"]);
var ctx = useLayoutCtx();
var builder = ctx.builder;
var {
builder
} = ctx;
var sxProps = getContentSxProps(builder, FOOTER_ID);

@@ -29,0 +29,0 @@ return /*#__PURE__*/React.createElement(FooterRoot, _extends({}, props, {

@@ -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); }

});
export var Fullscreen = function Fullscreen(props) {
export var Fullscreen = props => {
return /*#__PURE__*/React.createElement(FullscreenContext.Provider, {

@@ -19,0 +19,0 @@ value: true

import React from "react";
var Context = /*#__PURE__*/React.createContext(false);
Context.displayName = "FullscreenCtx";
export var useFullscreenCtx = function useFullscreenCtx() {
return React.useContext(Context);
};
export var useFullscreenCtx = () => React.useContext(Context);
export default Context;
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); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

@@ -16,10 +14,11 @@

var Offset = function Offset(_ref) {
var Offset = (_ref) => {
var _builder$element;
var element = _ref.element;
var _useLayoutCtx = useLayoutCtx(),
builder = _useLayoutCtx.builder;
var {
element
} = _ref;
var {
builder
} = useLayoutCtx();
return /*#__PURE__*/React.createElement(OffsetRoot, {

@@ -36,5 +35,3 @@ className: "HeaderOffset",

slot: "Root",
overridesResolver: function overridesResolver(props, styles) {
return styles.root;
}
overridesResolver: (props, styles) => styles.root
})({

@@ -44,7 +41,9 @@ zIndex: 1,

});
export var TopHeader = function TopHeader(_ref2) {
export var TopHeader = (_ref2) => {
var _builder$topHeader;
var children = _ref2.children,
inProps = _objectWithoutProperties(_ref2, ["children"]);
var {
children
} = _ref2,
inProps = _objectWithoutPropertiesLoose(_ref2, ["children"]);

@@ -56,3 +55,5 @@ var props = useThemeProps({

var ctx = useLayoutCtx();
var builder = ctx.builder;
var {
builder
} = ctx;
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TopHeaderRoot, _extends({}, props, {

@@ -67,5 +68,3 @@ sx: _extends({}, props.sx, (_builder$topHeader = builder.topHeader) === null || _builder$topHeader === void 0 ? void 0 : _builder$topHeader.getSxProps())

slot: "Root",
overridesResolver: function overridesResolver(props, styles) {
return styles.root;
}
overridesResolver: (props, styles) => styles.root
})({

@@ -75,7 +74,9 @@ zIndex: 1,

});
export var Subheader = function Subheader(_ref3) {
export var Subheader = (_ref3) => {
var _builder$subheader;
var children = _ref3.children,
inProps = _objectWithoutProperties(_ref3, ["children"]);
var {
children
} = _ref3,
inProps = _objectWithoutPropertiesLoose(_ref3, ["children"]);

@@ -87,3 +88,5 @@ var props = useThemeProps({

var ctx = useLayoutCtx();
var builder = ctx.builder;
var {
builder
} = ctx;
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SubheaderRoot, _extends({}, props, {

@@ -98,13 +101,13 @@ sx: _extends({}, props.sx, (_builder$subheader = builder.subheader) === null || _builder$subheader === void 0 ? void 0 : _builder$subheader.getSxProps())

slot: "Root",
overridesResolver: function overridesResolver(props, styles) {
return styles.root;
}
overridesResolver: (props, styles) => styles.root
})({
transition: CSS_TRANSITION
});
export var Header = function Header(_ref4) {
export var Header = (_ref4) => {
var _builder$header;
var children = _ref4.children,
inProps = _objectWithoutProperties(_ref4, ["children"]);
var {
children
} = _ref4,
inProps = _objectWithoutPropertiesLoose(_ref4, ["children"]);

@@ -116,3 +119,5 @@ var props = useThemeProps({

var ctx = useLayoutCtx();
var builder = ctx.builder;
var {
builder
} = ctx;
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HeaderRoot, _extends({

@@ -119,0 +124,0 @@ color: "default",

@@ -1,31 +0,3 @@

function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
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); }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
import { DEFAULT_THEME, LEFT_EDGE_SIDEBAR_ID, RIGHT_EDGE_SIDEBAR_ID } from "../utils/constant";

@@ -37,209 +9,153 @@ import { pickNearestBreakpoint } from "../utils/pickNearestBreakpoint";

import { ResponsiveBuilder } from "../shared/ResponsiveBuilder";
export var HeaderBuilder = /*#__PURE__*/function (_ResponsiveBuilder) {
_inherits(HeaderBuilder, _ResponsiveBuilder);
export class HeaderBuilder extends ResponsiveBuilder {
constructor(params) {
super(params);
this.effectedBy = {};
}
var _super = _createSuper(HeaderBuilder);
isClipped(clippableId, breakpoint) {
var headerBreakpointConfig = pickNearestBreakpoint(this.config, breakpoint);
function HeaderBuilder(params) {
var _this;
if (typeof (headerBreakpointConfig === null || headerBreakpointConfig === void 0 ? void 0 : headerBreakpointConfig.clipped) === "boolean" && headerBreakpointConfig.clipped) {
return true;
}
_classCallCheck(this, HeaderBuilder);
_this = _super.call(this, params);
_this.effectedBy = {};
return _this;
return typeof (headerBreakpointConfig === null || headerBreakpointConfig === void 0 ? void 0 : headerBreakpointConfig.clipped) === "object" && (headerBreakpointConfig === null || headerBreakpointConfig === void 0 ? void 0 : headerBreakpointConfig.clipped[clippableId]);
}
_createClass(HeaderBuilder, [{
key: "isClipped",
value: function isClipped(clippableId, breakpoint) {
var headerBreakpointConfig = pickNearestBreakpoint(this.config, breakpoint);
isAboveSomeEdgeSidebar(breakpoint) {
var headerBreakpointConfig = pickNearestBreakpoint(this.config, breakpoint);
if (!headerBreakpointConfig) return false;
var {
clipped
} = headerBreakpointConfig;
if (typeof (headerBreakpointConfig === null || headerBreakpointConfig === void 0 ? void 0 : headerBreakpointConfig.clipped) === "boolean" && headerBreakpointConfig.clipped) {
return true;
}
return _typeof(headerBreakpointConfig === null || headerBreakpointConfig === void 0 ? void 0 : headerBreakpointConfig.clipped) === "object" && (headerBreakpointConfig === null || headerBreakpointConfig === void 0 ? void 0 : headerBreakpointConfig.clipped[clippableId]);
if (typeof clipped === "boolean") {
return clipped;
}
}, {
key: "isAboveSomeEdgeSidebar",
value: function isAboveSomeEdgeSidebar(breakpoint) {
var headerBreakpointConfig = pickNearestBreakpoint(this.config, breakpoint);
if (!headerBreakpointConfig) return false;
var clipped = headerBreakpointConfig.clipped;
if (typeof clipped === "boolean") {
return clipped;
}
return !!(clipped !== null && clipped !== void 0 && clipped.leftEdgeSidebar) || !!(clipped !== null && clipped !== void 0 && clipped.rightEdgeSidebar);
}
return !!(clipped !== null && clipped !== void 0 && clipped.leftEdgeSidebar) || !!(clipped !== null && clipped !== void 0 && clipped.rightEdgeSidebar);
}
}, {
key: "getOffsetHeight",
value: function getOffsetHeight() {
return this.generateSxWithHidden({
// https://github.com/mui-org/material-ui/blob/next/packages/material-ui-system/src/sizing.js#L5
hiddenValue: "0px",
// don't use 0 as number because it will become 0%
assignValue: function assignValue(breakpointConfig) {
return breakpointConfig.position === "fixed" ? breakpointConfig.height : "0px";
}
});
}
}, {
key: "getSxHeight",
value: function getSxHeight() {
var result = this.generateSxWithHidden({
assignValue: function assignValue(breakpointConfig) {
return breakpointConfig.height;
},
// https://github.com/mui-org/material-ui/blob/next/packages/material-ui-system/src/sizing.js#L5
hiddenValue: "0px" // don't use 0 as number because it will become 0%
getOffsetHeight() {
return this.generateSxWithHidden({
// https://github.com/mui-org/material-ui/blob/next/packages/material-ui-system/src/sizing.js#L5
hiddenValue: "0px",
// don't use 0 as number because it will become 0%
assignValue: breakpointConfig => breakpointConfig.position === "fixed" ? breakpointConfig.height : "0px"
});
}
});
return _extends({}, Object.keys(result).length && {
height: result
});
}
}, {
key: "getSxMarginHorizontal",
value: function getSxMarginHorizontal() {
var marginLeft = {};
var _this$effectedBy = this.effectedBy,
leftEdgeSidebar = _this$effectedBy.leftEdgeSidebar,
rightEdgeSidebar = _this$effectedBy.rightEdgeSidebar;
getSxHeight() {
var result = this.generateSxWithHidden({
assignValue: breakpointConfig => breakpointConfig.height,
// https://github.com/mui-org/material-ui/blob/next/packages/material-ui-system/src/sizing.js#L5
hiddenValue: "0px" // don't use 0 as number because it will become 0%
if (leftEdgeSidebar) {
var occupiedSpace = leftEdgeSidebar === null || leftEdgeSidebar === void 0 ? void 0 : leftEdgeSidebar.getOccupiedSpace();
var breakpoints = this.mergeBreakpoints(occupiedSpace);
});
return _extends({}, Object.keys(result).length && {
height: result
});
}
var _iterator = _createForOfIteratorHelper(breakpoints),
_step;
getSxMarginHorizontal() {
var marginLeft = {};
var {
leftEdgeSidebar,
rightEdgeSidebar
} = this.effectedBy;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var bp = _step.value;
marginLeft[bp] = this.isClipped(LEFT_EDGE_SIDEBAR_ID, bp) ? "0px" : toValidCssValue(pickNearestBreakpoint(occupiedSpace, bp));
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
if (leftEdgeSidebar) {
var occupiedSpace = leftEdgeSidebar === null || leftEdgeSidebar === void 0 ? void 0 : leftEdgeSidebar.getOccupiedSpace();
var breakpoints = this.mergeBreakpoints(occupiedSpace);
for (var bp of breakpoints) {
marginLeft[bp] = this.isClipped(LEFT_EDGE_SIDEBAR_ID, bp) ? "0px" : toValidCssValue(pickNearestBreakpoint(occupiedSpace, bp));
}
}
var marginRight = {};
var marginRight = {};
if (rightEdgeSidebar) {
var _occupiedSpace = rightEdgeSidebar === null || rightEdgeSidebar === void 0 ? void 0 : rightEdgeSidebar.getOccupiedSpace();
if (rightEdgeSidebar) {
var _occupiedSpace = rightEdgeSidebar === null || rightEdgeSidebar === void 0 ? void 0 : rightEdgeSidebar.getOccupiedSpace();
var _breakpoints = this.mergeBreakpoints(_occupiedSpace);
var _breakpoints = this.mergeBreakpoints(_occupiedSpace);
var _iterator2 = _createForOfIteratorHelper(_breakpoints),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var _bp = _step2.value;
marginRight[_bp] = this.isClipped(RIGHT_EDGE_SIDEBAR_ID, _bp) ? "0px" : toValidCssValue(pickNearestBreakpoint(_occupiedSpace, _bp));
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
for (var _bp of _breakpoints) {
marginRight[_bp] = this.isClipped(RIGHT_EDGE_SIDEBAR_ID, _bp) ? "0px" : toValidCssValue(pickNearestBreakpoint(_occupiedSpace, _bp));
}
return _extends({}, Object.keys(marginLeft).length && {
marginLeft: marginLeft
}, Object.keys(marginRight).length && {
marginRight: marginRight
});
}
}, {
key: "getSxWidth",
value: function getSxWidth() {
var _leftEdgeSidebar$getO, _rightEdgeSidebar$get;
var result = {};
var _this$effectedBy2 = this.effectedBy,
leftEdgeSidebar = _this$effectedBy2.leftEdgeSidebar,
rightEdgeSidebar = _this$effectedBy2.rightEdgeSidebar;
var leftOccupiedSpace = (_leftEdgeSidebar$getO = leftEdgeSidebar === null || leftEdgeSidebar === void 0 ? void 0 : leftEdgeSidebar.getOccupiedSpace()) !== null && _leftEdgeSidebar$getO !== void 0 ? _leftEdgeSidebar$getO : {};
var rightOccupiedSpace = (_rightEdgeSidebar$get = rightEdgeSidebar === null || rightEdgeSidebar === void 0 ? void 0 : rightEdgeSidebar.getOccupiedSpace()) !== null && _rightEdgeSidebar$get !== void 0 ? _rightEdgeSidebar$get : {};
var breakpoints = this.mergeBreakpoints(combineBreakpoints(leftOccupiedSpace, rightOccupiedSpace));
return _extends({}, Object.keys(marginLeft).length && {
marginLeft
}, Object.keys(marginRight).length && {
marginRight
});
}
var _iterator3 = _createForOfIteratorHelper(breakpoints),
_step3;
getSxWidth() {
var _leftEdgeSidebar$getO, _rightEdgeSidebar$get;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var key = _step3.value;
var bp = key;
var effectLeft = createWidthInterface(0);
var result = {};
var {
leftEdgeSidebar,
rightEdgeSidebar
} = this.effectedBy;
var leftOccupiedSpace = (_leftEdgeSidebar$getO = leftEdgeSidebar === null || leftEdgeSidebar === void 0 ? void 0 : leftEdgeSidebar.getOccupiedSpace()) !== null && _leftEdgeSidebar$getO !== void 0 ? _leftEdgeSidebar$getO : {};
var rightOccupiedSpace = (_rightEdgeSidebar$get = rightEdgeSidebar === null || rightEdgeSidebar === void 0 ? void 0 : rightEdgeSidebar.getOccupiedSpace()) !== null && _rightEdgeSidebar$get !== void 0 ? _rightEdgeSidebar$get : {};
var breakpoints = this.mergeBreakpoints(combineBreakpoints(leftOccupiedSpace, rightOccupiedSpace));
if (leftEdgeSidebar) {
if (!this.isClipped(LEFT_EDGE_SIDEBAR_ID, bp)) {
effectLeft = createWidthInterface(leftEdgeSidebar.isFlexiblePersistent(bp, "header") ? 0 : pickNearestBreakpoint(leftOccupiedSpace, bp));
}
}
for (var key of breakpoints) {
var bp = key;
var effectLeft = createWidthInterface(0);
var effectRight = createWidthInterface(0);
if (leftEdgeSidebar) {
if (!this.isClipped(LEFT_EDGE_SIDEBAR_ID, bp)) {
effectLeft = createWidthInterface(leftEdgeSidebar.isFlexiblePersistent(bp, "header") ? 0 : pickNearestBreakpoint(leftOccupiedSpace, bp));
}
}
if (rightEdgeSidebar) {
if (!this.isClipped(RIGHT_EDGE_SIDEBAR_ID, bp)) {
effectRight = createWidthInterface(rightEdgeSidebar.isFlexiblePersistent(bp, "header") ? 0 : pickNearestBreakpoint(rightOccupiedSpace, bp));
}
}
var effectRight = createWidthInterface(0);
result[bp] = effectLeft.combine(effectRight).getStyle().width;
if (rightEdgeSidebar) {
if (!this.isClipped(RIGHT_EDGE_SIDEBAR_ID, bp)) {
effectRight = createWidthInterface(rightEdgeSidebar.isFlexiblePersistent(bp, "header") ? 0 : pickNearestBreakpoint(rightOccupiedSpace, bp));
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
return _extends({}, Object.keys(result).length && {
width: result
});
result[bp] = effectLeft.combine(effectRight).getStyle().width;
}
}, {
key: "getSxZIndex",
value: function getSxZIndex() {
var _this2 = this;
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THEME;
var result = this.generateSx(function (config, bp) {
var _config$layer;
return _extends({}, Object.keys(result).length && {
width: result
});
}
return _this2.isAboveSomeEdgeSidebar(bp) ? theme.zIndex.drawer + 10 + ((_config$layer = config.layer) !== null && _config$layer !== void 0 ? _config$layer : 0) : theme.zIndex.appBar;
}, theme.zIndex.appBar);
return _extends({}, Object.keys(result).length && {
zIndex: result
});
}
}, {
key: "getSxProps",
value: function getSxProps() {
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THEME;
var sxTop = this.generateSx(function (config) {
return config.top;
}, 0);
var sxDisplay = this.getSxDisplay("flex");
var displayKeys = Object.keys(sxDisplay);
var shouldAttachDisplay = displayKeys.length > 1 || displayKeys.length === 1 && displayKeys[0] !== "xs";
return _extends({
position: this.generateSx(function (config) {
return config.position;
})
}, Object.keys(sxTop).length && {
top: sxTop
}, shouldAttachDisplay && {
display: sxDisplay
}, this.getSxHeight(), this.getSxWidth(), this.getSxMarginHorizontal(), this.getSxZIndex(theme));
}
}]);
getSxZIndex() {
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THEME;
var result = this.generateSx((config, bp) => {
var _config$layer;
return HeaderBuilder;
}(ResponsiveBuilder);
return this.isAboveSomeEdgeSidebar(bp) ? theme.zIndex.drawer + 10 + ((_config$layer = config.layer) !== null && _config$layer !== void 0 ? _config$layer : 0) : theme.zIndex.appBar;
}, theme.zIndex.appBar);
return _extends({}, Object.keys(result).length && {
zIndex: result
});
}
getSxProps() {
var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_THEME;
var sxTop = this.generateSx(config => config.top, 0);
var sxDisplay = this.getSxDisplay("flex");
var displayKeys = Object.keys(sxDisplay);
var shouldAttachDisplay = displayKeys.length > 1 || displayKeys.length === 1 && displayKeys[0] !== "xs";
return _extends({
position: this.generateSx(config => config.position)
}, Object.keys(sxTop).length && {
top: sxTop
}, shouldAttachDisplay && {
display: sxDisplay
}, this.getSxHeight(), this.getSxWidth(), this.getSxMarginHorizontal(), this.getSxZIndex(theme));
}
}

@@ -7,7 +7,7 @@ import { useScreen } from "./useScreen";

export var useInsetHeaderMagnet = function useInsetHeaderMagnet(disabled) {
export var useInsetHeaderMagnet = disabled => {
// this hook will run only for <InsetSidebar position="fixed" />
var _useLayoutCtx = useLayoutCtx(),
builder = _useLayoutCtx.builder;
var {
builder
} = useLayoutCtx();
var screen = useScreen(); // dont't calculate scrollY if not magnet for performance

@@ -14,0 +14,0 @@

@@ -1,15 +0,1 @@

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import React from "react";

@@ -22,28 +8,23 @@ import { debounce } from "@material-ui/core/utils";

function getWindowWidth(w) {
return _typeof(w) === "object" ? w.innerWidth : undefined;
return typeof w === "object" ? w.innerWidth : undefined;
}
export var useScreen = function useScreen() {
var _useTheme = useTheme(),
breakpoints = _useTheme.breakpoints;
export var useScreen = () => {
var {
breakpoints
} = useTheme();
var {
iWindow
} = useWindowCtx();
var _useWindowCtx = useWindowCtx(),
iWindow = _useWindowCtx.iWindow;
var getScreen = () => mapWidthToScreen(getWindowWidth(iWindow), breakpoints);
var getScreen = function getScreen() {
return mapWidthToScreen(getWindowWidth(iWindow), breakpoints);
};
var _React$useState = React.useState(getScreen()),
_React$useState2 = _slicedToArray(_React$useState, 2),
screen = _React$useState2[0],
setScreen = _React$useState2[1];
var updater = React.useRef(debounce(function () {
var [screen, setScreen] = React.useState(getScreen());
var updater = React.useRef(debounce(() => {
setScreen(getScreen());
}, 200));
React.useEffect(function () {
React.useEffect(() => {
if (iWindow !== undefined) {
iWindow.addEventListener("resize", updater.current);
return function () {
return () => {
iWindow.removeEventListener("resize", updater.current);

@@ -50,0 +31,0 @@ };

@@ -1,15 +0,1 @@

function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import { useEffect, useRef, useState } from "react";

@@ -20,21 +6,17 @@ import { debounce } from "@material-ui/core/utils";

function getScrollY(obj) {
return _typeof(obj) === "object" ? obj.scrollY : undefined;
return typeof obj === "object" ? obj.scrollY : undefined;
}
export var useScrollY = function useScrollY(disabled) {
var _useWindowCtx = useWindowCtx(),
iWindow = _useWindowCtx.iWindow;
var _useState = useState(getScrollY(iWindow)),
_useState2 = _slicedToArray(_useState, 2),
scrollY = _useState2[0],
setScrollY = _useState2[1];
var debounceScrollListener = useRef(debounce(function () {
export var useScrollY = disabled => {
var {
iWindow
} = useWindowCtx();
var [scrollY, setScrollY] = useState(getScrollY(iWindow));
var debounceScrollListener = useRef(debounce(() => {
setScrollY(getScrollY(iWindow));
}, 300));
useEffect(function () {
useEffect(() => {
if (!disabled && iWindow !== undefined) {
iWindow.addEventListener("scroll", debounceScrollListener.current);
return function () {
return () => {
iWindow.removeEventListener("scroll", debounceScrollListener.current);

@@ -41,0 +23,0 @@ };

@@ -5,13 +5,13 @@ import { useEffect, useRef } from "react";

import { BREAKPOINT_KEYS } from "../utils/muiBreakpoints";
export var useSidebarAutoCollapse = function useSidebarAutoCollapse(sidebarId) {
export var useSidebarAutoCollapse = sidebarId => {
var _builder$sidebarId;
var _useLayoutCtx = useLayoutCtx(),
builder = _useLayoutCtx.builder,
setCollapsed = _useLayoutCtx.setCollapsed;
var {
builder,
setCollapsed
} = useLayoutCtx();
var screen = useScreen();
var prevScreen = useRef(screen);
var collapsedBp = sidebarId ? (_builder$sidebarId = builder[sidebarId]) === null || _builder$sidebarId === void 0 ? void 0 : _builder$sidebarId.autoCollapse : undefined;
useEffect(function () {
useEffect(() => {
if (sidebarId && collapsedBp && screen && prevScreen.current) {

@@ -18,0 +18,0 @@ if (screen === prevScreen.current && BREAKPOINT_KEYS.indexOf(screen) <= BREAKPOINT_KEYS.indexOf(collapsedBp)) {

@@ -12,6 +12,6 @@ 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); }

});
export var InsetAvoidingView = function InsetAvoidingView(props) {
var _useLayoutCtx = useLayoutCtx(),
builder = _useLayoutCtx.builder;
export var InsetAvoidingView = props => {
var {
builder
} = useLayoutCtx();
var sxProps = {

@@ -18,0 +18,0 @@ marginLeft: "",

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); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

@@ -15,10 +13,11 @@

});
export var InsetContainer = function InsetContainer(_ref) {
var children = _ref.children,
leftSidebar = _ref.leftSidebar,
rightSidebar = _ref.rightSidebar,
_ref$FullscreenWrappe = _ref.FullscreenWrapper,
FullscreenWrapper = _ref$FullscreenWrappe === void 0 ? FullscreenWrapperRoot : _ref$FullscreenWrappe,
FullscreenWrapperProps = _ref.FullscreenWrapperProps,
props = _objectWithoutProperties(_ref, ["children", "leftSidebar", "rightSidebar", "FullscreenWrapper", "FullscreenWrapperProps"]);
export var InsetContainer = (_ref) => {
var {
children,
leftSidebar,
rightSidebar,
FullscreenWrapper = FullscreenWrapperRoot,
FullscreenWrapperProps
} = _ref,
props = _objectWithoutPropertiesLoose(_ref, ["children", "leftSidebar", "rightSidebar", "FullscreenWrapper", "FullscreenWrapperProps"]);

@@ -25,0 +24,0 @@ var isFullscreen = useFullscreenCtx();

@@ -11,31 +11,33 @@ import React from "react";

slot: "Root"
})(function (_ref) {
var theme = _ref.theme;
})((_ref) => {
var {
theme
} = _ref;
return {
transition: theme.transitions.create(["all"], {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration["short"]
duration: theme.transitions.duration.short
})
};
});
export var InsetOffset = function InsetOffset(_ref2) {
var sidebar = _ref2.sidebar;
var _useLayoutCtx = useLayoutCtx(),
builder = _useLayoutCtx.builder;
export var InsetOffset = (_ref2) => {
var {
sidebar
} = _ref2;
var {
builder
} = useLayoutCtx();
var screen = useScreen();
var insetConfig = pickNearestBreakpoint(sidebar === null || sidebar === void 0 ? void 0 : sidebar.config, screen); // @ts-ignore
var _ref3 = insetConfig !== null && insetConfig !== void 0 ? insetConfig : {},
headerMagnetEnabled = _ref3.headerMagnetEnabled; // dont't calculate scrollY if not magnet for performance
var {
headerMagnetEnabled
} = insetConfig !== null && insetConfig !== void 0 ? insetConfig : {}; // dont't calculate scrollY if not magnet for performance
var scrollY = useScrollY(!headerMagnetEnabled);
var {
totalHeight,
diffHeight
} = HeadersCompiler([builder.header, builder.topHeader, builder.subheader]).getAllHeight(); // header magnet feature
var _HeadersCompiler$getA = HeadersCompiler([builder.header, builder.topHeader, builder.subheader]).getAllHeight(),
totalHeight = _HeadersCompiler$getA.totalHeight,
diffHeight = _HeadersCompiler$getA.diffHeight; // header magnet feature
var style = {};

@@ -42,0 +44,0 @@

@@ -1,3 +0,1 @@

function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

@@ -15,5 +13,3 @@

slot: "Root",
overridesResolver: function overridesResolver(props, styles) {
return styles.root;
}
overridesResolver: (props, styles) => styles.root
})({

@@ -26,8 +22,8 @@ position: "relative",

slot: "Body",
overridesResolver: function overridesResolver(props, styles) {
return styles.body;
}
})(function (_ref) {
var theme = _ref.theme,
styleProps = _ref.styleProps;
overridesResolver: (props, styles) => styles.body
})((_ref) => {
var {
theme,
styleProps
} = _ref;
return _extends({

@@ -45,12 +41,16 @@ display: "flex",

});
export var InsetSidebar = function InsetSidebar(_ref2) {
var anchor = _ref2.anchor,
children = _ref2.children,
classes = _ref2.classes,
RootProps = _ref2.RootProps,
rootSx = _ref2.rootSx,
props = _objectWithoutProperties(_ref2, ["anchor", "children", "classes", "RootProps", "rootSx"]);
export var InsetSidebar = (_ref2) => {
var {
anchor,
children,
classes,
RootProps,
rootSx
} = _ref2,
props = _objectWithoutPropertiesLoose(_ref2, ["anchor", "children", "classes", "RootProps", "rootSx"]);
var ctx = useLayoutCtx();
var builder = ctx.builder; // anchor should be injected via InsetContainer
var {
builder
} = ctx; // anchor should be injected via InsetContainer

@@ -64,3 +64,3 @@ var sidebar = builder["".concat(anchor, "InsetSidebar")];

styleProps: {
anchor: anchor
anchor
},

@@ -67,0 +67,0 @@ sx: _extends({}, sidebar === null || sidebar === void 0 ? void 0 : sidebar.getSxBody(), props === null || props === void 0 ? void 0 : props.sx)

@@ -1,31 +0,3 @@

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
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); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
import { subtractCalc } from "../utils/calc";

@@ -36,96 +8,65 @@ import { pickNearestBreakpoint } from "../utils/pickNearestBreakpoint";

import { toValidCssValue } from "../utils/toValidCssValue";
export var InsetSidebarBuilder = /*#__PURE__*/function (_ResponsiveBuilder) {
_inherits(InsetSidebarBuilder, _ResponsiveBuilder);
export class InsetSidebarBuilder extends ResponsiveBuilder {
constructor(params) {
super(params);
this.anchor = void 0;
this.effectedBy = {};
}
var _super = _createSuper(InsetSidebarBuilder);
function InsetSidebarBuilder(params) {
var _this;
_classCallCheck(this, InsetSidebarBuilder);
_this = _super.call(this, params);
_this.anchor = void 0;
_this.effectedBy = {};
return _this;
getFixedArea() {
var modifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
return flattenLoose(this.generateSx((config, bp) => config.position === "fixed" ? "".concat(modifier * 9999, "px") : bp === "xs" ? undefined : "initial"));
}
_createClass(InsetSidebarBuilder, [{
key: "getFixedArea",
value: function getFixedArea() {
var modifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
return flattenLoose(this.generateSx(function (config, bp) {
return config.position === "fixed" ? "".concat(modifier * 9999, "px") : bp === "xs" ? undefined : "initial";
}));
}
}, {
key: "getSxBody",
value: function getSxBody() {
var anchor = this.anchor;
var height = {};
var header = this.effectedBy.header;
getSxBody() {
var anchor = this.anchor;
var height = {};
var {
header
} = this.effectedBy;
if (header) {
var _header$getSxHeight = header.getSxHeight(),
responsiveHeight = _header$getSxHeight.height;
if (header) {
var {
height: responsiveHeight
} = header.getSxHeight();
var breakpoints = this.mergeBreakpoints(responsiveHeight !== null && responsiveHeight !== void 0 ? responsiveHeight : []);
var breakpoints = this.mergeBreakpoints(responsiveHeight !== null && responsiveHeight !== void 0 ? responsiveHeight : []);
for (var bp of breakpoints) {
var insetConfig = pickNearestBreakpoint(this.config, bp);
var _iterator = _createForOfIteratorHelper(breakpoints),
_step;
if ((insetConfig === null || insetConfig === void 0 ? void 0 : insetConfig.position) === "absolute") {
var headerHeight = pickNearestBreakpoint(responsiveHeight, bp);
height[bp] = headerHeight === 0 || headerHeight === "0px" ? "100vh" : subtractCalc("100vh", headerHeight);
}
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var bp = _step.value;
var insetConfig = pickNearestBreakpoint(this.config, bp);
if ((insetConfig === null || insetConfig === void 0 ? void 0 : insetConfig.position) === "fixed") height[bp] = "100%";
if ((insetConfig === null || insetConfig === void 0 ? void 0 : insetConfig.position) === "sticky") height[bp] = "initial";
}
}
if ((insetConfig === null || insetConfig === void 0 ? void 0 : insetConfig.position) === "absolute") {
var headerHeight = pickNearestBreakpoint(responsiveHeight, bp);
height[bp] = headerHeight === 0 || headerHeight === "0px" ? "100vh" : subtractCalc("100vh", headerHeight);
}
return _extends({
height: flattenLoose(height),
width: flattenLoose(this.generateSx(config => config.position === "fixed" ? "initial" : "100%")),
position: flattenLoose(this.generateSx(config => config.position)),
top: flattenLoose(this.generateSx(config => {
var _config$top;
if ((insetConfig === null || insetConfig === void 0 ? void 0 : insetConfig.position) === "fixed") height[bp] = "100%";
if ((insetConfig === null || insetConfig === void 0 ? void 0 : insetConfig.position) === "sticky") height[bp] = "initial";
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
return (_config$top = config.top) !== null && _config$top !== void 0 ? _config$top : 0;
}))
}, anchor === "left" && {
marginLeft: this.getFixedArea(-1),
paddingLeft: this.getFixedArea()
}, anchor === "right" && {
marginRight: this.getFixedArea(-1),
paddingRight: this.getFixedArea()
});
}
return _extends({
height: flattenLoose(height),
width: flattenLoose(this.generateSx(function (config) {
return config.position === "fixed" ? "initial" : "100%";
})),
position: flattenLoose(this.generateSx(function (config) {
return config.position;
})),
top: flattenLoose(this.generateSx(function (config) {
var _config$top;
getSxRoot() {
return {
display: flattenStrict(this.getSxDisplay("block")),
width: flattenLoose(this.generateSx(config => toValidCssValue(config.width)))
};
}
return (_config$top = config.top) !== null && _config$top !== void 0 ? _config$top : 0;
}))
}, anchor === "left" && {
marginLeft: this.getFixedArea(-1),
paddingLeft: this.getFixedArea()
}, anchor === "right" && {
marginRight: this.getFixedArea(-1),
paddingRight: this.getFixedArea()
});
}
}, {
key: "getSxRoot",
value: function getSxRoot() {
return {
display: flattenStrict(this.getSxDisplay("block")),
width: flattenLoose(this.generateSx(function (config) {
return toValidCssValue(config.width);
}))
};
}
}]);
return InsetSidebarBuilder;
}(ResponsiveBuilder);
}

@@ -5,3 +5,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 { toValidCssValue } from "../utils/toValidCssValue";
export var getCssMargin = function getCssMargin(m) {
export var getCssMargin = m => {
if (typeof m === "string") {

@@ -15,5 +15,3 @@ return "calc(".concat(m, ")");

var transformMargin = function transformMargin(m) {
var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (val) {
return val;
};
var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : val => val;
return _extends({}, !isNil(m.marginLeft) && {

@@ -26,3 +24,3 @@ marginLeft: fn(m.marginLeft)

var getCssValue = function getCssValue(v1, v2) {
var getCssValue = (v1, v2) => {
if (isNil(v1)) return v2;

@@ -33,3 +31,3 @@ if (isNil(v2)) return v1;

export var combineMargin = function combineMargin(m1, m2) {
export var combineMargin = (m1, m2) => {
if (!m1 && m2) return m2;

@@ -40,16 +38,12 @@ if (m1 && !m2) return m1;

return transformMargin({
marginLeft: marginLeft,
marginRight: marginRight
marginLeft,
marginRight
});
};
export var createMarginInterface = function createMarginInterface(value) {
export var createMarginInterface = value => {
return {
value: value,
combine: function combine(m) {
return createMarginInterface(combineMargin(value, m.value));
},
getStyle: function getStyle() {
return transformMargin(value, getCssMargin);
}
value,
combine: m => createMarginInterface(combineMargin(value, m.value)),
getStyle: () => transformMargin(value, getCssMargin)
};
};
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); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import { BREAKPOINT_KEYS } from "../utils/muiBreakpoints";
import { pickNearestBreakpoint } from "../utils/pickNearestBreakpoint";
import { StackedHeaders } from "./StackedHeaders";
export var HeadersCompiler = function HeadersCompiler(headers) {
var validHeaders = headers.filter(function (h) {
return !!h;
});
export var HeadersCompiler = headers => {
var validHeaders = headers.filter(h => !!h);

@@ -24,65 +16,54 @@ function getResult(modifyConfigAtBreakpoint) {

var _iterator = _createForOfIteratorHelper(BREAKPOINT_KEYS),
_step;
var _loop = function _loop(_bp) {
var configs = [];
var shouldCalculate = false;
shouldCalculate = prevHidden.some(bool => !!bool);
validHeaders.forEach(builder => {
if (builder.config[_bp]) {
shouldCalculate = true;
}
});
try {
var _loop = function _loop() {
var bp = _step.value;
var configs = [];
var shouldCalculate = false;
shouldCalculate = prevHidden.some(function (bool) {
return !!bool;
});
validHeaders.forEach(function (builder) {
if (builder.config[bp]) {
shouldCalculate = true;
}
});
if (shouldCalculate) {
validHeaders.forEach((builder, index) => {
var breakpointConfig = pickNearestBreakpoint(builder.config, _bp);
if (shouldCalculate) {
validHeaders.forEach(function (builder, index) {
var breakpointConfig = pickNearestBreakpoint(builder.config, bp);
if (builder.isHidden(_bp)) {
prevHidden[index] = true;
if (builder.isHidden(bp)) {
prevHidden[index] = true;
if (breakpointConfig) {
configs.push(_extends({}, breakpointConfig, {
height: 0
}));
}
} else {
if (prevHidden[index]) {
prevHidden[index] = false;
}
if (breakpointConfig) {
configs.push(_extends({}, breakpointConfig, {
height: 0
}));
}
} else {
if (prevHidden[index]) {
prevHidden[index] = false;
}
if (breakpointConfig) {
configs.push(modifyConfigAtBreakpoint ? modifyConfigAtBreakpoint(bp, builder, breakpointConfig) : breakpointConfig);
}
if (breakpointConfig) {
configs.push(modifyConfigAtBreakpoint ? modifyConfigAtBreakpoint(_bp, builder, breakpointConfig) : breakpointConfig);
}
});
}
}
});
}
if (configs.length) {
var _StackedHeaders = StackedHeaders(configs),
totalHeight = _StackedHeaders.totalHeight,
diffHeight = _StackedHeaders.diffHeight;
if (configs.length) {
var {
totalHeight,
diffHeight
} = StackedHeaders(configs);
if (pickNearestBreakpoint(result.totalHeight, bp) !== totalHeight) {
result.totalHeight[bp] = totalHeight;
}
if (pickNearestBreakpoint(result.totalHeight, _bp) !== totalHeight) {
result.totalHeight[_bp] = totalHeight;
}
if (pickNearestBreakpoint(result.diffHeight, bp) !== diffHeight) {
result.diffHeight[bp] = diffHeight;
}
if (pickNearestBreakpoint(result.diffHeight, _bp) !== diffHeight) {
result.diffHeight[_bp] = diffHeight;
}
};
}
};
for (_iterator.s(); !(_step = _iterator.n()).done;) {
_loop();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
for (var _bp of BREAKPOINT_KEYS) {
_loop(_bp);
}

@@ -94,5 +75,5 @@

return {
getClippedHeight: function getClippedHeight(sidebarId) {
getClippedHeight(sidebarId) {
// for EdgeSidebarOffset
return getResult(function (bp, builder, config) {
return getResult((bp, builder, config) => {
return _extends({}, config, !builder.isClipped(sidebarId, bp) && {

@@ -103,7 +84,9 @@ height: 0

},
getAllHeight: function getAllHeight() {
getAllHeight() {
// for InsetSidebarOffset
return getResult();
}
};
};

@@ -1,13 +0,1 @@

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import { plusCalc, subtractCalc } from "../utils/calc";

@@ -18,5 +6,3 @@

if (configs.length === 1) return plusCalc(configs[0].height, configs[0].top);
return "max(".concat(configs.map(function (c) {
return plusCalc(c.height, c.top);
}).join(", "), ")");
return "max(".concat(configs.map(c => plusCalc(c.height, c.top)).join(", "), ")");
}

@@ -26,10 +12,8 @@

if (!configs.length) return 0;
return plusCalc.apply(void 0, _toConsumableArray(configs.map(function (c) {
return c.height;
})));
return plusCalc(...configs.map(c => c.height));
}
export var StackedHeaders = function StackedHeaders(configs) {
export var StackedHeaders = configs => {
var nonRelativeConfigs = [];
configs.forEach(function (c) {
configs.forEach(c => {
if (!!c && c.position !== "relative") {

@@ -40,5 +24,3 @@ nonRelativeConfigs.push(c);

var maxNonRelativeHeight = getMaxFloatHeight(nonRelativeConfigs);
var totalHeight = sumHeight(configs.filter(function (c) {
return !!c;
})); // for offset height
var totalHeight = sumHeight(configs.filter(c => !!c)); // for offset height

@@ -48,5 +30,5 @@ var diffHeight = subtractCalc(totalHeight, maxNonRelativeHeight); // for -marginTop

return {
totalHeight: totalHeight,
diffHeight: diffHeight
totalHeight,
diffHeight
};
};

@@ -1,29 +0,27 @@

export var getContentBasedScheme = function getContentBasedScheme() {
return {
header: {
config: {
xs: {
position: "relative",
height: 56
},
md: {
position: "relative",
height: 64
}
export var getContentBasedScheme = () => ({
header: {
config: {
xs: {
position: "relative",
height: 56
},
md: {
position: "relative",
height: 64
}
},
leftEdgeSidebar: {
config: {
xs: {
variant: "temporary",
width: 256
},
sm: {
variant: "persistent",
width: 256,
persistentBehavior: "flexible"
}
}
},
leftEdgeSidebar: {
config: {
xs: {
variant: "temporary",
width: 256
},
sm: {
variant: "persistent",
width: 256,
persistentBehavior: "flexible"
}
}
};
};
}
});

@@ -1,40 +0,38 @@

export var getCozyScheme = function getCozyScheme() {
return {
header: {
config: {
xs: {
position: "fixed",
height: 56
},
sm: {
position: "fixed",
height: 64
},
md: {
position: "fixed",
height: 64,
clipped: true
}
export var getCozyScheme = () => ({
header: {
config: {
xs: {
position: "fixed",
height: 56
},
sm: {
position: "fixed",
height: 64
},
md: {
position: "fixed",
height: 64,
clipped: true
}
},
leftEdgeSidebar: {
autoCollapse: "md",
config: {
xs: {
variant: "temporary",
width: 256
},
sm: {
variant: "permanent",
width: 256
},
md: {
variant: "permanent",
width: 256,
collapsible: true,
collapsedWidth: 64
}
}
},
leftEdgeSidebar: {
autoCollapse: "md",
config: {
xs: {
variant: "temporary",
width: 256
},
sm: {
variant: "permanent",
width: 256
},
md: {
variant: "permanent",
width: 256,
collapsible: true,
collapsedWidth: 64
}
}
};
};
}
});

@@ -1,31 +0,29 @@

export var getFixedScheme = function getFixedScheme() {
return {
header: {
config: {
xs: {
position: "sticky",
height: 56
},
md: {
position: "relative",
height: 64
}
export var getFixedScheme = () => ({
header: {
config: {
xs: {
position: "sticky",
height: 56
},
md: {
position: "relative",
height: 64
}
},
leftEdgeSidebar: {
autoCollapse: "md",
config: {
xs: {
variant: "temporary",
width: 256
},
md: {
variant: "permanent",
width: 256,
collapsible: true,
collapsedWidth: 64
}
}
},
leftEdgeSidebar: {
autoCollapse: "md",
config: {
xs: {
variant: "temporary",
width: 256
},
md: {
variant: "permanent",
width: 256,
collapsible: true,
collapsedWidth: 64
}
}
};
};
}
});

@@ -1,33 +0,31 @@

export var getStandardScheme = function getStandardScheme() {
return {
header: {
config: {
xs: {
position: "sticky",
height: 56
},
md: {
position: "relative",
height: 64,
clipped: true
}
export var getStandardScheme = () => ({
header: {
config: {
xs: {
position: "sticky",
height: 56
},
md: {
position: "relative",
height: 64,
clipped: true
}
},
leftEdgeSidebar: {
autoCollapse: "sm",
config: {
xs: {
variant: "temporary",
width: 256
},
sm: {
variant: "permanent",
width: 256,
collapsible: true,
collapsedWidth: 64,
headerMagnetEnabled: true
}
}
},
leftEdgeSidebar: {
autoCollapse: "sm",
config: {
xs: {
variant: "temporary",
width: 256
},
sm: {
variant: "permanent",
width: 256,
collapsible: true,
collapsedWidth: 64,
headerMagnetEnabled: true
}
}
};
};
}
});
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); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React from "react";

@@ -22,3 +10,3 @@ import { EdgeSidebarBuilder } from "../EdgeSidebar/EdgeSidebarBuilder";

LayoutContext.displayName = "LayoutContext";
export var useLayoutCtx = function useLayoutCtx() {
export var useLayoutCtx = () => {
var ctx = React.useContext(LayoutContext);

@@ -38,3 +26,3 @@

var setUpEdgeSidebar = function setUpEdgeSidebar(builder) {
var setUpEdgeSidebar = builder => {
var autoGenInitialState = {

@@ -58,3 +46,3 @@ leftEdgeSidebar: {},

var injectStateToEdgeSidebar = function injectStateToEdgeSidebar(builder, state) {
var injectStateToEdgeSidebar = (builder, state) => {
if (builder.leftEdgeSidebar) {

@@ -73,6 +61,8 @@ var _state$leftEdgeSideba;

export var Root = function Root(_ref) {
var controlledInitialState = _ref.initialState,
scheme = _ref.scheme,
children = _ref.children;
export var Root = (_ref) => {
var {
initialState: controlledInitialState,
scheme,
children
} = _ref;

@@ -92,14 +82,6 @@ if (!scheme) {

var autoGenInitialState = setUpEdgeSidebar(builder);
var [leftState, setLeftState] = React.useState(_extends({}, autoGenInitialState.leftEdgeSidebar, controlledInitialState === null || controlledInitialState === void 0 ? void 0 : controlledInitialState.leftEdgeSidebar));
var [rightState, setRightState] = React.useState(_extends({}, autoGenInitialState.rightEdgeSidebar, controlledInitialState === null || controlledInitialState === void 0 ? void 0 : controlledInitialState.rightEdgeSidebar));
var _React$useState = React.useState(_extends({}, autoGenInitialState.leftEdgeSidebar, controlledInitialState === null || controlledInitialState === void 0 ? void 0 : controlledInitialState.leftEdgeSidebar)),
_React$useState2 = _slicedToArray(_React$useState, 2),
leftState = _React$useState2[0],
setLeftState = _React$useState2[1];
var _React$useState3 = React.useState(_extends({}, autoGenInitialState.rightEdgeSidebar, controlledInitialState === null || controlledInitialState === void 0 ? void 0 : controlledInitialState.rightEdgeSidebar)),
_React$useState4 = _slicedToArray(_React$useState3, 2),
rightState = _React$useState4[0],
setRightState = _React$useState4[1];
var setOpen = function setOpen(id, value) {
var setOpen = (id, value) => {
function setter(state) {

@@ -120,3 +102,3 @@ return state.open === value ? state : _extends({}, state, {

var setCollapsed = function setCollapsed(id, value) {
var setCollapsed = (id, value) => {
function setter(state) {

@@ -137,33 +119,17 @@ return state.collapsed === value ? state : _extends({}, state, {

var toggleLeftSidebarOpen = function toggleLeftSidebarOpen() {
return setLeftState(function (state) {
return _extends({}, state, {
open: !state.open
});
});
};
var toggleLeftSidebarOpen = () => setLeftState(state => _extends({}, state, {
open: !state.open
}));
var toggleLeftSidebarCollapsed = function toggleLeftSidebarCollapsed() {
return setLeftState(function (state) {
return _extends({}, state, {
collapsed: !state.collapsed
});
});
};
var toggleLeftSidebarCollapsed = () => setLeftState(state => _extends({}, state, {
collapsed: !state.collapsed
}));
var toggleRightSidebarOpen = function toggleRightSidebarOpen() {
return setRightState(function (state) {
return _extends({}, state, {
open: !state.open
});
});
};
var toggleRightSidebarOpen = () => setRightState(state => _extends({}, state, {
open: !state.open
}));
var toggleRightSidebarCollapsed = function toggleRightSidebarCollapsed() {
return setRightState(function (state) {
return _extends({}, state, {
collapsed: !state.collapsed
});
});
};
var toggleRightSidebarCollapsed = () => setRightState(state => _extends({}, state, {
collapsed: !state.collapsed
}));

@@ -215,9 +181,9 @@ injectStateToEdgeSidebar(builder, {

},
builder: builder,
setOpen: setOpen,
setCollapsed: setCollapsed,
toggleLeftSidebarOpen: toggleLeftSidebarOpen,
toggleLeftSidebarCollapsed: toggleLeftSidebarCollapsed,
toggleRightSidebarOpen: toggleRightSidebarOpen,
toggleRightSidebarCollapsed: toggleRightSidebarCollapsed
builder,
setOpen,
setCollapsed,
toggleLeftSidebarOpen,
toggleLeftSidebarCollapsed,
toggleRightSidebarOpen,
toggleRightSidebarCollapsed
};

@@ -224,0 +190,0 @@ return /*#__PURE__*/React.createElement(LayoutContext.Provider, {

@@ -1,13 +0,5 @@

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
import { createSxResult } from "../utils/createSxResult";
import { BREAKPOINT_KEYS } from "../utils/muiBreakpoints";
export var ResponsiveBuilder = /*#__PURE__*/function () {
function ResponsiveBuilder(params) {
_classCallCheck(this, ResponsiveBuilder);
export class ResponsiveBuilder {
constructor(params) {
this.config = void 0;

@@ -21,96 +13,84 @@ this.hidden = void 0;

_createClass(ResponsiveBuilder, [{
key: "isHidden",
value: function isHidden(breakpoint) {
if (!this.hidden) return false;
if (typeof this.hidden === "boolean" && this.hidden) return true;
return this.hidden.includes(breakpoint);
}
/**
* use target as base breakpoints, the result will start from the minimum of target
* xs | sm | md | lg | xl
* target | y | | y |
* this y | | y | |
* ===============================
* result | y | y | y |
*/
isHidden(breakpoint) {
if (!this.hidden) return false;
if (typeof this.hidden === "boolean" && this.hidden) return true;
return this.hidden.includes(breakpoint);
}
/**
* use target as base breakpoints, the result will start from the minimum of target
* xs | sm | md | lg | xl
* target | y | | y |
* this y | | y | |
* ===============================
* result | y | y | y |
*/
}, {
key: "mergeBreakpoints",
value: function mergeBreakpoints(target) {
var targetFound = false;
var result = [];
var targetKeys = Array.isArray(target) ? target : Object.keys(target);
var thisKeys = Object.keys(this.config);
BREAKPOINT_KEYS.forEach(function (key) {
if (targetKeys.includes(key)) {
targetFound = true;
mergeBreakpoints(target) {
var targetFound = false;
var result = [];
var targetKeys = Array.isArray(target) ? target : Object.keys(target);
var thisKeys = Object.keys(this.config);
BREAKPOINT_KEYS.forEach(key => {
if (targetKeys.includes(key)) {
targetFound = true;
result.push(key);
} else {
if (thisKeys.includes(key) && targetFound) {
result.push(key);
} else {
if (thisKeys.includes(key) && targetFound) {
result.push(key);
}
}
});
return result;
}
});
return result;
}
generateSxWithHidden(options) {
var {
config,
hidden
} = this;
var hiddenValue = options.hiddenValue;
if (hidden === true) {
return hiddenValue !== undefined ? {
xs: hiddenValue
} : {};
}
}, {
key: "generateSxWithHidden",
value: function generateSxWithHidden(options) {
var config = this.config,
hidden = this.hidden;
var hiddenValue = options.hiddenValue;
if (hidden === true) {
return hiddenValue !== undefined ? {
xs: hiddenValue
} : {};
}
var candidate;
return createSxResult((bp, lastResultVal) => {
var _config$bp;
var candidate;
return createSxResult(function (bp, lastResultVal) {
var _config$bp;
candidate = (_config$bp = config[bp]) !== null && _config$bp !== void 0 ? _config$bp : candidate;
candidate = (_config$bp = config[bp]) !== null && _config$bp !== void 0 ? _config$bp : candidate;
if (options.strict && lastResultVal === undefined && candidate === undefined) {
// cannot find valid config and no result yet
return hiddenValue;
}
if (options.strict && lastResultVal === undefined && candidate === undefined) {
// cannot find valid config and no result yet
return hiddenValue;
}
if (candidate !== undefined) {
var assignedValue = options.assignValue(candidate, bp, lastResultVal);
var isHidden = Array.isArray(hidden) && hidden.includes(bp);
return isHidden ? hiddenValue : assignedValue;
}
if (candidate !== undefined) {
var assignedValue = options.assignValue(candidate, bp, lastResultVal);
var isHidden = Array.isArray(hidden) && hidden.includes(bp);
return isHidden ? hiddenValue : assignedValue;
}
return undefined;
});
}
return undefined;
});
}
}, {
key: "generateSx",
value: function generateSx(getValue, initialValue) {
var _this = this;
generateSx(getValue, initialValue) {
return createSxResult(bp => getValue(this.config[bp], bp), {
breakpoints: this.breakpointKeys,
initialValue
});
}
return createSxResult(function (bp) {
return getValue(_this.config[bp], bp);
}, {
breakpoints: this.breakpointKeys,
initialValue: initialValue
});
}
}, {
key: "getSxDisplay",
value: function getSxDisplay(appearance) {
return this.generateSxWithHidden({
assignValue: function assignValue() {
return appearance;
},
hiddenValue: "none",
strict: true
});
}
}]);
getSxDisplay(appearance) {
return this.generateSxWithHidden({
assignValue: () => appearance,
hiddenValue: "none",
strict: true
});
}
return ResponsiveBuilder;
}();
}

@@ -7,9 +7,5 @@ import { toValidCssValue } from "./toValidCssValue";

var valid = args.filter(function (v) {
return !!v;
});
var valid = args.filter(v => !!v);
if (!valid.length) return "0px";
return valid.length === 1 ? toValidCssValue(valid[0]) : "calc(".concat(args.filter(function (item) {
return !!item;
}).map(toValidCssValue).join(" - "), ")");
return valid.length === 1 ? toValidCssValue(valid[0]) : "calc(".concat(args.filter(item => !!item).map(toValidCssValue).join(" - "), ")");
};

@@ -21,9 +17,5 @@ export var plusCalc = function plusCalc() {

var valid = args.filter(function (v) {
return !!v;
});
var valid = args.filter(v => !!v);
if (!valid.length) return "0px";
return valid.length === 1 ? toValidCssValue(valid[0]) : "calc(".concat(args.filter(function (item) {
return !!item;
}).map(toValidCssValue).join(" + "), ")");
return valid.length === 1 ? toValidCssValue(valid[0]) : "calc(".concat(args.filter(item => !!item).map(toValidCssValue).join(" + "), ")");
};
import { BREAKPOINT_KEYS } from "./muiBreakpoints";
export var sortBreakpoints = function sortBreakpoints(breakpoints) {
return breakpoints.sort(function (a, b) {
return BREAKPOINT_KEYS.indexOf(a) - BREAKPOINT_KEYS.indexOf(b);
});
};
export var sortBreakpoints = breakpoints => breakpoints.sort((a, b) => BREAKPOINT_KEYS.indexOf(a) - BREAKPOINT_KEYS.indexOf(b));
export var combineBreakpoints = function combineBreakpoints() {

@@ -14,5 +10,5 @@ var result = [];

args.forEach(function (item) {
args.forEach(item => {
var breakpoints = Array.isArray(item) ? item : Object.keys(item);
breakpoints.forEach(function (k) {
breakpoints.forEach(k => {
if (!result.includes(k)) {

@@ -19,0 +15,0 @@ result.push(k);

@@ -1,7 +0,1 @@

function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import { BREAKPOINT_KEYS } from "./muiBreakpoints";

@@ -18,43 +12,32 @@

*/
export var createSxResult = function createSxResult(getValue, options) {
var _ref = options !== null && options !== void 0 ? options : {},
_ref$breakpoints = _ref.breakpoints,
breakpoints = _ref$breakpoints === void 0 ? BREAKPOINT_KEYS : _ref$breakpoints,
initialValue = _ref.initialValue;
export var createSxResult = (getValue, options) => {
var {
breakpoints = BREAKPOINT_KEYS,
initialValue
} = options !== null && options !== void 0 ? options : {};
var result = {};
var lastValue = undefined;
var _iterator = _createForOfIteratorHelper(breakpoints),
_step;
for (var _bp of breakpoints) {
var value = getValue(_bp, lastValue);
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _bp = _step.value;
var value = getValue(_bp, lastValue);
if (value !== undefined) {
// only assign value if not undefined
if (lastValue === undefined) {
// 1st valid value
result[_bp] = value;
lastValue = value;
if (value !== undefined) {
// only assign value if not undefined
if (lastValue === undefined) {
// 1st valid value
if (initialValue !== undefined && initialValue === value) {
// if same as initial, deleted from object
delete result[_bp];
}
} else {
if (lastValue !== value) {
// next valid value that is not the same as lastValue and so on
result[_bp] = value;
lastValue = value;
if (initialValue !== undefined && initialValue === value) {
// if same as initial, deleted from object
delete result[_bp];
}
} else {
if (lastValue !== value) {
// next valid value that is not the same as lastValue and so on
result[_bp] = value;
lastValue = value;
}
}
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}

@@ -61,0 +44,0 @@

@@ -11,3 +11,3 @@ function uniqValues(value) {

export var flattenStrict = function flattenStrict(value) {
export var flattenStrict = value => {
var keys = Object.keys(value);

@@ -33,3 +33,3 @@

export var flattenLoose = function flattenLoose(value) {
export var flattenLoose = value => {
var keys = Object.keys(value);

@@ -36,0 +36,0 @@

@@ -1,3 +0,3 @@

export var isNil = function isNil(value) {
export var isNil = value => {
return value === null || value === undefined;
};
import { isNil } from "./isNil";
export var isNilOrEmpty = function isNilOrEmpty(value) {
export var isNilOrEmpty = value => {
return isNil(value) || value === "";
};
export var isNotNilOrEmpty = function isNotNilOrEmpty(value) {
return !isNilOrEmpty(value);
};
export var isNotNilOrEmpty = value => !isNilOrEmpty(value);

@@ -1,22 +0,8 @@

function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import { BREAKPOINT_KEYS } from "./muiBreakpoints";
export var mapWidthToScreen = function mapWidthToScreen(width, breakpoints) {
export var mapWidthToScreen = (width, breakpoints) => {
if (!width) return undefined;
var screen = "";
var found = false;
var newKeys = _toConsumableArray(BREAKPOINT_KEYS);
newKeys.reverse().forEach(function (breakpoint) {
var newKeys = [...BREAKPOINT_KEYS];
newKeys.reverse().forEach(breakpoint => {
if (width >= breakpoints.values[breakpoint] && !found) {

@@ -23,0 +9,0 @@ screen = breakpoint;

@@ -1,9 +0,3 @@

function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import { BREAKPOINT_KEYS } from "./muiBreakpoints";
export var pickNearestBreakpoint = function pickNearestBreakpoint(value, currentBreakpoint) {
export var pickNearestBreakpoint = (value, currentBreakpoint) => {
if (!value || !currentBreakpoint) return undefined;

@@ -21,15 +15,5 @@ var breakpointIndex = BREAKPOINT_KEYS.indexOf(currentBreakpoint);

var _iterator = _createForOfIteratorHelper(possibleBreakpoints),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var bp = _step.value;
if (result !== undefined) return result;
result = value[bp];
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
for (var bp of possibleBreakpoints) {
if (result !== undefined) return result;
result = value[bp];
}

@@ -36,0 +20,0 @@

@@ -1,2 +0,2 @@

export var toResponsiveCssValue = function toResponsiveCssValue(value) {
export var toResponsiveCssValue = value => {
var result = {};

@@ -11,5 +11,5 @@

};
export var toValidCssValue = function toValidCssValue(value) {
export var toValidCssValue = value => {
if (typeof value === "number") return "".concat(value, "px");
return value;
};
import { isNilOrEmpty } from "../utils/isNilOrEmpty";
import { toValidCssValue } from "../utils/toValidCssValue";
export var getCssWidth = function getCssWidth(externalGap) {
export var getCssWidth = externalGap => {
if (typeof externalGap === "string") {

@@ -15,3 +15,3 @@ return "calc(100% - (".concat(externalGap, "))");

};
export var sumExternalGap = function sumExternalGap(a, b) {
export var sumExternalGap = (a, b) => {
if (isNilOrEmpty(a) && isNilOrEmpty(b)) return undefined;

@@ -23,14 +23,10 @@ if (a === 0 && b === 0) return 0;

};
export var createWidthInterface = function createWidthInterface(externalGap) {
export var createWidthInterface = externalGap => {
return {
value: externalGap,
combine: function combine(w) {
return createWidthInterface(sumExternalGap(externalGap, w.value));
},
getStyle: function getStyle() {
return {
width: getCssWidth(externalGap)
};
}
combine: w => createWidthInterface(sumExternalGap(externalGap, w.value)),
getStyle: () => ({
width: getCssWidth(externalGap)
})
};
};

@@ -8,4 +8,2 @@ import React from "react";

export var WindowConsumer = WindowContext.Consumer;
export var useWindowCtx = function useWindowCtx() {
return React.useContext(WindowContext);
};
export var useWindowCtx = () => React.useContext(WindowContext);
{
"name": "@mui-treasury/layout",
"version": "5.0.0-alpha.9",
"version": "5.0.0-alpha.10",
"description": "mui-treasury | layout-core",

@@ -35,3 +35,3 @@ "author": "siriwatknp <siriwatkunaporn@gmail.com>",

},
"gitHead": "93b4158bdcd5e16270e31f90c8d216422c4a06dd"
"gitHead": "74e0e26860494b592319a6834432b61ceb35302c"
}
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