@atlaskit/page-layout 1.3.7 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/common/constants.js +8 -4
- package/dist/cjs/common/hooks/index.js +0 -3
- package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +3 -12
- package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +3 -12
- package/dist/cjs/common/safe-local-storage.js +2 -13
- package/dist/cjs/common/utils.js +0 -35
- package/dist/cjs/components/index.js +0 -13
- package/dist/cjs/components/resize-control/grab-area.js +8 -17
- package/dist/cjs/components/resize-control/index.js +33 -84
- package/dist/cjs/components/resize-control/resize-button.js +9 -24
- package/dist/cjs/components/resize-control/shadow.js +3 -7
- package/dist/cjs/components/skip-links/index.js +0 -2
- package/dist/cjs/components/skip-links/skip-link-components.js +18 -48
- package/dist/cjs/components/skip-links/use-custom-skip-link.js +3 -8
- package/dist/cjs/components/slots/banner-slot.js +10 -21
- package/dist/cjs/components/slots/content.js +3 -6
- package/dist/cjs/components/slots/internal/left-sidebar-inner.js +9 -14
- package/dist/cjs/components/slots/internal/left-sidebar-outer.js +10 -22
- package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +10 -15
- package/dist/cjs/components/slots/internal/slot-focus-ring.js +5 -8
- package/dist/cjs/components/slots/left-panel.js +9 -20
- package/dist/cjs/components/slots/left-sidebar-without-resize.js +6 -18
- package/dist/cjs/components/slots/left-sidebar.js +39 -75
- package/dist/cjs/components/slots/main.js +9 -23
- package/dist/cjs/components/slots/page-layout.js +7 -16
- package/dist/cjs/components/slots/right-panel.js +9 -20
- package/dist/cjs/components/slots/right-sidebar.js +9 -21
- package/dist/cjs/components/slots/slot-dimensions.js +1 -5
- package/dist/cjs/components/slots/top-navigation.js +10 -21
- package/dist/cjs/controllers/index.js +0 -6
- package/dist/cjs/controllers/sidebar-resize-context.js +6 -21
- package/dist/cjs/controllers/sidebar-resize-controller.js +34 -50
- package/dist/cjs/controllers/skip-link-context.js +2 -12
- package/dist/cjs/controllers/skip-link-controller.js +6 -22
- package/dist/cjs/controllers/use-page-layout-grid.js +6 -12
- package/dist/cjs/controllers/use-update-css-vars.js +0 -3
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/constants.js +8 -4
- package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +0 -4
- package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +0 -4
- package/dist/es2019/common/safe-local-storage.js +2 -12
- package/dist/es2019/common/utils.js +4 -20
- package/dist/es2019/components/resize-control/grab-area.js +7 -8
- package/dist/es2019/components/resize-control/index.js +26 -43
- package/dist/es2019/components/resize-control/resize-button.js +7 -11
- package/dist/es2019/components/resize-control/shadow.js +3 -3
- package/dist/es2019/components/skip-links/skip-link-components.js +16 -31
- package/dist/es2019/components/slots/banner-slot.js +1 -3
- package/dist/es2019/components/slots/content.js +2 -2
- package/dist/es2019/components/slots/internal/left-sidebar-inner.js +5 -5
- package/dist/es2019/components/slots/internal/left-sidebar-outer.js +1 -4
- package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +4 -4
- package/dist/es2019/components/slots/internal/slot-focus-ring.js +3 -3
- package/dist/es2019/components/slots/left-panel.js +1 -3
- package/dist/es2019/components/slots/left-sidebar-without-resize.js +1 -2
- package/dist/es2019/components/slots/left-sidebar.js +25 -40
- package/dist/es2019/components/slots/main.js +4 -5
- package/dist/es2019/components/slots/page-layout.js +1 -3
- package/dist/es2019/components/slots/right-panel.js +1 -3
- package/dist/es2019/components/slots/right-sidebar.js +3 -5
- package/dist/es2019/components/slots/top-navigation.js +1 -3
- package/dist/es2019/controllers/sidebar-resize-context.js +7 -5
- package/dist/es2019/controllers/sidebar-resize-controller.js +14 -16
- package/dist/es2019/controllers/skip-link-context.js +0 -1
- package/dist/es2019/controllers/skip-link-controller.js +3 -7
- package/dist/es2019/controllers/use-page-layout-grid.js +4 -5
- package/dist/es2019/controllers/use-update-css-vars.js +0 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/constants.js +8 -4
- package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +3 -8
- package/dist/esm/common/hooks/use-is-sidebar-dragging.js +3 -8
- package/dist/esm/common/safe-local-storage.js +2 -12
- package/dist/esm/common/utils.js +0 -22
- package/dist/esm/components/resize-control/grab-area.js +9 -14
- package/dist/esm/components/resize-control/index.js +33 -72
- package/dist/esm/components/resize-control/resize-button.js +10 -15
- package/dist/esm/components/resize-control/shadow.js +3 -3
- package/dist/esm/components/skip-links/skip-link-components.js +19 -39
- package/dist/esm/components/skip-links/use-custom-skip-link.js +2 -4
- package/dist/esm/components/slots/banner-slot.js +9 -11
- package/dist/esm/components/slots/content.js +3 -3
- package/dist/esm/components/slots/internal/left-sidebar-inner.js +9 -9
- package/dist/esm/components/slots/internal/left-sidebar-outer.js +9 -12
- package/dist/esm/components/slots/internal/resizable-children-wrapper.js +10 -10
- package/dist/esm/components/slots/internal/slot-focus-ring.js +5 -5
- package/dist/esm/components/slots/left-panel.js +8 -10
- package/dist/esm/components/slots/left-sidebar-without-resize.js +7 -9
- package/dist/esm/components/slots/left-sidebar.js +40 -65
- package/dist/esm/components/slots/main.js +10 -13
- package/dist/esm/components/slots/page-layout.js +6 -10
- package/dist/esm/components/slots/right-panel.js +8 -10
- package/dist/esm/components/slots/right-sidebar.js +10 -12
- package/dist/esm/components/slots/slot-dimensions.js +1 -1
- package/dist/esm/components/slots/top-navigation.js +9 -11
- package/dist/esm/controllers/sidebar-resize-context.js +6 -11
- package/dist/esm/controllers/sidebar-resize-controller.js +34 -38
- package/dist/esm/controllers/skip-link-context.js +2 -4
- package/dist/esm/controllers/skip-link-controller.js +6 -12
- package/dist/esm/controllers/use-page-layout-grid.js +6 -8
- package/dist/esm/controllers/use-update-css-vars.js +0 -2
- package/dist/esm/version.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/page-layout
|
|
2
2
|
|
|
3
|
+
## 1.3.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 1.3.8
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`4ee60bafc6d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4ee60bafc6d) - ED-16603: Remove tooltips from VR tests and make them opt in. To opt-in, add `allowedSideEffects` when loading the page.
|
|
14
|
+
|
|
3
15
|
## 1.3.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -19,8 +19,9 @@ var VAR_BANNER_HEIGHT = 'bannerHeight';
|
|
|
19
19
|
exports.VAR_BANNER_HEIGHT = VAR_BANNER_HEIGHT;
|
|
20
20
|
var VAR_LEFT_SIDEBAR_FLYOUT = 'leftSidebarFlyoutWidth';
|
|
21
21
|
exports.VAR_LEFT_SIDEBAR_FLYOUT = VAR_LEFT_SIDEBAR_FLYOUT;
|
|
22
|
-
var DIMENSIONS = [VAR_LEFT_PANEL_WIDTH, VAR_RIGHT_PANEL_WIDTH, VAR_BANNER_HEIGHT, VAR_TOP_NAVIGATION_HEIGHT, VAR_LEFT_SIDEBAR_WIDTH, VAR_RIGHT_SIDEBAR_WIDTH];
|
|
22
|
+
var DIMENSIONS = [VAR_LEFT_PANEL_WIDTH, VAR_RIGHT_PANEL_WIDTH, VAR_BANNER_HEIGHT, VAR_TOP_NAVIGATION_HEIGHT, VAR_LEFT_SIDEBAR_WIDTH, VAR_RIGHT_SIDEBAR_WIDTH];
|
|
23
23
|
|
|
24
|
+
// Grid area names
|
|
24
25
|
exports.DIMENSIONS = DIMENSIONS;
|
|
25
26
|
var LEFT_PANEL = 'left-panel';
|
|
26
27
|
exports.LEFT_PANEL = LEFT_PANEL;
|
|
@@ -36,8 +37,9 @@ var MAIN = 'main';
|
|
|
36
37
|
exports.MAIN = MAIN;
|
|
37
38
|
var LEFT_SIDEBAR = 'left-sidebar';
|
|
38
39
|
exports.LEFT_SIDEBAR = LEFT_SIDEBAR;
|
|
39
|
-
var RIGHT_SIDEBAR = 'right-sidebar';
|
|
40
|
+
var RIGHT_SIDEBAR = 'right-sidebar';
|
|
40
41
|
|
|
42
|
+
// Default slot dimension values
|
|
41
43
|
exports.RIGHT_SIDEBAR = RIGHT_SIDEBAR;
|
|
42
44
|
var DEFAULT_BANNER_HEIGHT = 56;
|
|
43
45
|
exports.DEFAULT_BANNER_HEIGHT = DEFAULT_BANNER_HEIGHT;
|
|
@@ -49,8 +51,9 @@ var DEFAULT_RIGHT_SIDEBAR_WIDTH = 280;
|
|
|
49
51
|
exports.DEFAULT_RIGHT_SIDEBAR_WIDTH = DEFAULT_RIGHT_SIDEBAR_WIDTH;
|
|
50
52
|
var DEFAULT_RIGHT_PANEL_WIDTH = 368;
|
|
51
53
|
exports.DEFAULT_RIGHT_PANEL_WIDTH = DEFAULT_RIGHT_PANEL_WIDTH;
|
|
52
|
-
var DEFAULT_LEFT_PANEL_WIDTH = 368;
|
|
54
|
+
var DEFAULT_LEFT_PANEL_WIDTH = 368;
|
|
53
55
|
|
|
56
|
+
// Other constants
|
|
54
57
|
exports.DEFAULT_LEFT_PANEL_WIDTH = DEFAULT_LEFT_PANEL_WIDTH;
|
|
55
58
|
var COLLAPSED_LEFT_SIDEBAR_WIDTH = 20;
|
|
56
59
|
exports.COLLAPSED_LEFT_SIDEBAR_WIDTH = COLLAPSED_LEFT_SIDEBAR_WIDTH;
|
|
@@ -66,8 +69,9 @@ var FLYOUT_DELAY = 200;
|
|
|
66
69
|
exports.FLYOUT_DELAY = FLYOUT_DELAY;
|
|
67
70
|
var LEFT_SIDEBAR_EXPANDED_WIDTH = 'expandedLeftSidebarWidth';
|
|
68
71
|
exports.LEFT_SIDEBAR_EXPANDED_WIDTH = LEFT_SIDEBAR_EXPANDED_WIDTH;
|
|
69
|
-
var PAGE_LAYOUT_LS_KEY = 'DS_PAGE_LAYOUT_UI_STATE';
|
|
72
|
+
var PAGE_LAYOUT_LS_KEY = 'DS_PAGE_LAYOUT_UI_STATE';
|
|
70
73
|
|
|
74
|
+
// Data attributes
|
|
71
75
|
exports.PAGE_LAYOUT_LS_KEY = PAGE_LAYOUT_LS_KEY;
|
|
72
76
|
var IS_SIDEBAR_DRAGGING = 'data-is-sidebar-dragging';
|
|
73
77
|
exports.IS_SIDEBAR_DRAGGING = IS_SIDEBAR_DRAGGING;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -17,7 +16,5 @@ Object.defineProperty(exports, "useIsSidebarDragging", {
|
|
|
17
16
|
return _useIsSidebarDragging.default;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
|
-
|
|
21
19
|
var _useIsSidebarCollapsing = _interopRequireDefault(require("./use-is-sidebar-collapsing"));
|
|
22
|
-
|
|
23
20
|
var _useIsSidebarDragging = _interopRequireDefault(require("./use-is-sidebar-dragging"));
|
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
var _constants = require("../constants");
|
|
15
|
-
|
|
16
11
|
var getIsCollapsing = function getIsCollapsing() {
|
|
17
12
|
// SSR bail-out because document is undefined on the server
|
|
18
13
|
if (typeof document === 'undefined') {
|
|
19
14
|
return false;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
return document.documentElement.getAttribute(_constants.IS_SIDEBAR_COLLAPSING) === 'true';
|
|
23
17
|
};
|
|
24
|
-
|
|
25
18
|
var useIsSidebarCollapsing = function useIsSidebarCollapsing() {
|
|
26
19
|
var _useState = (0, _react.useState)(getIsCollapsing),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
21
|
+
isCollapsing = _useState2[0],
|
|
22
|
+
setIsCollapsing = _useState2[1];
|
|
31
23
|
(0, _react.useEffect)(function () {
|
|
32
24
|
var observer = new MutationObserver(function () {
|
|
33
25
|
setIsCollapsing(getIsCollapsing);
|
|
@@ -41,6 +33,5 @@ var useIsSidebarCollapsing = function useIsSidebarCollapsing() {
|
|
|
41
33
|
}, []);
|
|
42
34
|
return isCollapsing;
|
|
43
35
|
};
|
|
44
|
-
|
|
45
36
|
var _default = useIsSidebarCollapsing;
|
|
46
37
|
exports.default = _default;
|
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
-
|
|
12
9
|
var _react = require("react");
|
|
13
|
-
|
|
14
10
|
var _constants = require("../constants");
|
|
15
|
-
|
|
16
11
|
var getIsDragging = function getIsDragging() {
|
|
17
12
|
// SSR bail-out because document is undefined on the server
|
|
18
13
|
if (typeof document === 'undefined') {
|
|
19
14
|
return false;
|
|
20
15
|
}
|
|
21
|
-
|
|
22
16
|
return document.documentElement.getAttribute(_constants.IS_SIDEBAR_DRAGGING) === 'true';
|
|
23
17
|
};
|
|
24
|
-
|
|
25
18
|
var useIsSidebarDragging = function useIsSidebarDragging() {
|
|
26
19
|
var _useState = (0, _react.useState)(getIsDragging),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
21
|
+
isDragging = _useState2[0],
|
|
22
|
+
setIsDragging = _useState2[1];
|
|
31
23
|
(0, _react.useEffect)(function () {
|
|
32
24
|
var observer = new MutationObserver(function () {
|
|
33
25
|
setIsDragging(getIsDragging);
|
|
@@ -41,6 +33,5 @@ var useIsSidebarDragging = function useIsSidebarDragging() {
|
|
|
41
33
|
}, []);
|
|
42
34
|
return isDragging;
|
|
43
35
|
};
|
|
44
|
-
|
|
45
36
|
var _default = useIsSidebarDragging;
|
|
46
37
|
exports.default = _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
// Reliably test against conditions like
|
|
9
8
|
// localStorage being full or private mode in Safari being a .
|
|
10
9
|
// https://gist.github.com/paulirish/5558557
|
|
@@ -20,13 +19,12 @@ var isLocalStorageSupported = function isLocalStorageSupported() {
|
|
|
20
19
|
return false;
|
|
21
20
|
}
|
|
22
21
|
};
|
|
23
|
-
|
|
24
22
|
var safeLocalStorage = function safeLocalStorage() {
|
|
25
23
|
if (isLocalStorageSupported()) {
|
|
26
24
|
return localStorage;
|
|
27
|
-
}
|
|
28
|
-
|
|
25
|
+
}
|
|
29
26
|
|
|
27
|
+
// Returning a mock object here in the case that this is run in SSR mode
|
|
30
28
|
if (typeof window === 'undefined') {
|
|
31
29
|
return {
|
|
32
30
|
getItem: function getItem(_key) {
|
|
@@ -44,24 +42,19 @@ var safeLocalStorage = function safeLocalStorage() {
|
|
|
44
42
|
key: function key(_index) {
|
|
45
43
|
return null;
|
|
46
44
|
},
|
|
47
|
-
|
|
48
45
|
get length() {
|
|
49
46
|
return 0;
|
|
50
47
|
}
|
|
51
|
-
|
|
52
48
|
};
|
|
53
49
|
}
|
|
54
|
-
|
|
55
50
|
if (window.__localStorageFallback && Object.keys(window.__localStorageFallback).length !== 0) {
|
|
56
51
|
return window.__localStorageFallback;
|
|
57
52
|
}
|
|
58
|
-
|
|
59
53
|
var storageAPI = {
|
|
60
54
|
getItem: function getItem(key) {
|
|
61
55
|
if (window.__localStorageFallback.hasOwnProperty(key)) {
|
|
62
56
|
return window.__localStorageFallback[key];
|
|
63
57
|
}
|
|
64
|
-
|
|
65
58
|
return null;
|
|
66
59
|
},
|
|
67
60
|
setItem: function setItem(key, value) {
|
|
@@ -77,19 +70,15 @@ var safeLocalStorage = function safeLocalStorage() {
|
|
|
77
70
|
}
|
|
78
71
|
}
|
|
79
72
|
},
|
|
80
|
-
|
|
81
73
|
get length() {
|
|
82
74
|
if (!window.__localStorageFallback) {
|
|
83
75
|
return 0;
|
|
84
76
|
}
|
|
85
|
-
|
|
86
77
|
return Object.keys(window.__localStorageFallback).length;
|
|
87
78
|
}
|
|
88
|
-
|
|
89
79
|
};
|
|
90
80
|
window.__localStorageFallback = Object.create(storageAPI);
|
|
91
81
|
return window.__localStorageFallback;
|
|
92
82
|
};
|
|
93
|
-
|
|
94
83
|
var _default = safeLocalStorage;
|
|
95
84
|
exports.default = _default;
|
package/dist/cjs/common/utils.js
CHANGED
|
@@ -1,113 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.resolveDimension = exports.removeFromGridStateInStorage = exports.mergeGridStateIntoStorage = exports.getPageLayoutSlotSelector = exports.getPageLayoutSlotCSSSelector = exports.getLeftSidebarPercentage = exports.getLeftPanelWidth = exports.getGridStateFromStorage = exports.emptyGridState = void 0;
|
|
9
|
-
|
|
10
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
-
|
|
12
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
10
|
var _constants = require("./constants");
|
|
15
|
-
|
|
16
11
|
var _safeLocalStorage = _interopRequireDefault(require("./safe-local-storage"));
|
|
17
|
-
|
|
18
12
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
-
|
|
20
13
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
|
-
|
|
22
14
|
var emptyGridState = _constants.DIMENSIONS.reduce(function (acc, currentValue) {
|
|
23
15
|
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, currentValue, 0));
|
|
24
16
|
}, {});
|
|
25
|
-
|
|
26
17
|
exports.emptyGridState = emptyGridState;
|
|
27
|
-
|
|
28
18
|
var mergeGridStateIntoStorage = function mergeGridStateIntoStorage(key, value) {
|
|
29
19
|
var storageValue = JSON.parse((0, _safeLocalStorage.default)().getItem(_constants.PAGE_LAYOUT_LS_KEY) || '{}');
|
|
30
|
-
|
|
31
20
|
if (value !== null && (0, _typeof2.default)(value) === 'object') {
|
|
32
21
|
storageValue[key] = _objectSpread(_objectSpread({}, storageValue[key]), value);
|
|
33
22
|
} else {
|
|
34
23
|
storageValue[key] = value;
|
|
35
24
|
}
|
|
36
|
-
|
|
37
25
|
(0, _safeLocalStorage.default)().setItem(_constants.PAGE_LAYOUT_LS_KEY, JSON.stringify(storageValue));
|
|
38
26
|
};
|
|
39
|
-
|
|
40
27
|
exports.mergeGridStateIntoStorage = mergeGridStateIntoStorage;
|
|
41
|
-
|
|
42
28
|
var getGridStateFromStorage = function getGridStateFromStorage(key) {
|
|
43
29
|
var storageValue = JSON.parse((0, _safeLocalStorage.default)().getItem(_constants.PAGE_LAYOUT_LS_KEY) || '{}');
|
|
44
30
|
return storageValue[key];
|
|
45
31
|
};
|
|
46
|
-
|
|
47
32
|
exports.getGridStateFromStorage = getGridStateFromStorage;
|
|
48
|
-
|
|
49
33
|
var removeFromGridStateInStorage = function removeFromGridStateInStorage(key, secondKey) {
|
|
50
34
|
var storageValue = JSON.parse((0, _safeLocalStorage.default)().getItem(_constants.PAGE_LAYOUT_LS_KEY) || '{}');
|
|
51
|
-
|
|
52
35
|
if (secondKey && storageValue[key]) {
|
|
53
36
|
delete storageValue[key][secondKey];
|
|
54
37
|
} else {
|
|
55
38
|
delete storageValue[key];
|
|
56
39
|
}
|
|
57
|
-
|
|
58
40
|
(0, _safeLocalStorage.default)().setItem(_constants.PAGE_LAYOUT_LS_KEY, JSON.stringify(storageValue));
|
|
59
41
|
};
|
|
60
|
-
|
|
61
42
|
exports.removeFromGridStateInStorage = removeFromGridStateInStorage;
|
|
62
|
-
|
|
63
43
|
var resolveDimension = function resolveDimension(key) {
|
|
64
44
|
var dimension = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
65
45
|
var shouldPersist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
66
|
-
|
|
67
46
|
if (shouldPersist) {
|
|
68
47
|
var cachedGridState = getGridStateFromStorage('gridState');
|
|
69
48
|
return cachedGridState && Object.keys(cachedGridState).length > 0 && cachedGridState[key] ? cachedGridState[key] : dimension;
|
|
70
49
|
}
|
|
71
|
-
|
|
72
50
|
return dimension;
|
|
73
51
|
};
|
|
74
|
-
|
|
75
52
|
exports.resolveDimension = resolveDimension;
|
|
76
|
-
|
|
77
53
|
var getLeftPanelWidth = function getLeftPanelWidth() {
|
|
78
54
|
if (typeof window === 'undefined') {
|
|
79
55
|
return 0;
|
|
80
56
|
}
|
|
81
|
-
|
|
82
57
|
return parseInt(window.getComputedStyle(document.documentElement).getPropertyValue("--".concat(_constants.LEFT_PANEL_WIDTH)), 10) || 0;
|
|
83
58
|
};
|
|
84
|
-
|
|
85
59
|
exports.getLeftPanelWidth = getLeftPanelWidth;
|
|
86
|
-
|
|
87
60
|
var getLeftSidebarPercentage = function getLeftSidebarPercentage(currentWidth, maxWidth) {
|
|
88
61
|
var total = (currentWidth - _constants.DEFAULT_LEFT_SIDEBAR_WIDTH) / (maxWidth - _constants.DEFAULT_LEFT_SIDEBAR_WIDTH);
|
|
89
|
-
|
|
90
62
|
if (total < 0) {
|
|
91
63
|
return 0;
|
|
92
64
|
}
|
|
93
|
-
|
|
94
65
|
if (total > 1) {
|
|
95
66
|
return 100;
|
|
96
67
|
}
|
|
97
|
-
|
|
98
68
|
return Math.floor(total * 100);
|
|
99
69
|
};
|
|
100
|
-
|
|
101
70
|
exports.getLeftSidebarPercentage = getLeftSidebarPercentage;
|
|
102
|
-
|
|
103
71
|
var getPageLayoutSlotSelector = function getPageLayoutSlotSelector(slotName) {
|
|
104
72
|
return (0, _defineProperty2.default)({}, _constants.PAGE_LAYOUT_SLOT_SELECTOR, slotName);
|
|
105
73
|
};
|
|
106
|
-
|
|
107
74
|
exports.getPageLayoutSlotSelector = getPageLayoutSlotSelector;
|
|
108
|
-
|
|
109
75
|
var getPageLayoutSlotCSSSelector = function getPageLayoutSlotCSSSelector(slotName) {
|
|
110
76
|
return "[".concat(_constants.PAGE_LAYOUT_SLOT_SELECTOR, "='").concat(slotName, "']");
|
|
111
77
|
};
|
|
112
|
-
|
|
113
78
|
exports.getPageLayoutSlotCSSSelector = getPageLayoutSlotCSSSelector;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -77,27 +76,15 @@ Object.defineProperty(exports, "useCustomSkipLink", {
|
|
|
77
76
|
return _skipLinks.useCustomSkipLink;
|
|
78
77
|
}
|
|
79
78
|
});
|
|
80
|
-
|
|
81
79
|
var _pageLayout = _interopRequireDefault(require("./slots/page-layout"));
|
|
82
|
-
|
|
83
80
|
var _main = _interopRequireDefault(require("./slots/main"));
|
|
84
|
-
|
|
85
81
|
var _rightPanel = _interopRequireDefault(require("./slots/right-panel"));
|
|
86
|
-
|
|
87
82
|
var _leftPanel = _interopRequireDefault(require("./slots/left-panel"));
|
|
88
|
-
|
|
89
83
|
var _rightSidebar = _interopRequireDefault(require("./slots/right-sidebar"));
|
|
90
|
-
|
|
91
84
|
var _leftSidebar = _interopRequireDefault(require("./slots/left-sidebar"));
|
|
92
|
-
|
|
93
85
|
var _leftSidebarWithoutResize = _interopRequireDefault(require("./slots/left-sidebar-without-resize"));
|
|
94
|
-
|
|
95
86
|
var _bannerSlot = _interopRequireDefault(require("./slots/banner-slot"));
|
|
96
|
-
|
|
97
87
|
var _topNavigation = _interopRequireDefault(require("./slots/top-navigation"));
|
|
98
|
-
|
|
99
88
|
var _content = _interopRequireDefault(require("./slots/content"));
|
|
100
|
-
|
|
101
89
|
var _resizeControl = _interopRequireDefault(require("./resize-control"));
|
|
102
|
-
|
|
103
90
|
var _skipLinks = require("./skip-links");
|
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
9
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
11
|
var _react = require("@emotion/react");
|
|
17
|
-
|
|
18
12
|
var _colors = require("@atlaskit/theme/colors");
|
|
19
|
-
|
|
20
13
|
var _constants = require("../../common/constants");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["testId", "isLeftSidebarCollapsed"];
|
|
23
|
-
|
|
24
15
|
/**
|
|
25
16
|
* Determines the color of the grab line.
|
|
26
17
|
*
|
|
@@ -59,22 +50,22 @@ var lineStyles = (0, _react.css)({
|
|
|
59
50
|
transition: 'background-color 200ms'
|
|
60
51
|
});
|
|
61
52
|
var grabAreaLineSelector = (0, _defineProperty2.default)({}, _constants.GRAB_AREA_LINE_SELECTOR, true);
|
|
62
|
-
var grabAreaSelector = (0, _defineProperty2.default)({}, _constants.GRAB_AREA_SELECTOR, true);
|
|
63
|
-
|
|
53
|
+
var grabAreaSelector = (0, _defineProperty2.default)({}, _constants.GRAB_AREA_SELECTOR, true);
|
|
54
|
+
// TODO: Consider allowing this to be controlled using arrow keys
|
|
64
55
|
var GrabArea = function GrabArea(_ref) {
|
|
65
56
|
var testId = _ref.testId,
|
|
66
|
-
|
|
67
|
-
|
|
57
|
+
isLeftSidebarCollapsed = _ref.isLeftSidebarCollapsed,
|
|
58
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
68
59
|
return (0, _react.jsx)("button", (0, _extends2.default)({}, grabAreaSelector, {
|
|
69
60
|
"data-testid": testId,
|
|
70
61
|
type: "button",
|
|
71
|
-
css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles]
|
|
72
|
-
|
|
62
|
+
css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles]
|
|
63
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
73
64
|
}, rest), (0, _react.jsx)("span", (0, _extends2.default)({
|
|
74
65
|
css: lineStyles
|
|
75
66
|
}, grabAreaLineSelector)));
|
|
76
|
-
};
|
|
77
|
-
|
|
67
|
+
};
|
|
78
68
|
|
|
69
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
79
70
|
var _default = GrabArea;
|
|
80
71
|
exports.default = _default;
|