@atlaskit/page-layout 1.0.6 → 1.2.0
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 +30 -0
- package/README.md +3 -3
- package/__perf__/utils/perf-example.tsx +27 -18
- package/__perf__/utils/product-integration/Create.tsx +5 -1
- package/__perf__/utils/product-integration/NotificationsPopup.tsx +6 -5
- package/__perf__/utils/product-integration/SampleFooter.tsx +14 -13
- package/dist/cjs/common/constants.js +1 -1
- package/dist/cjs/common/hooks/index.js +23 -0
- package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +46 -0
- package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +46 -0
- package/dist/cjs/common/utils.js +3 -3
- package/dist/cjs/components/index.js +22 -22
- package/dist/cjs/components/resize-control/grab-area.js +43 -5
- package/dist/cjs/components/resize-control/index.js +24 -22
- package/dist/cjs/components/resize-control/resize-button.js +61 -5
- package/dist/cjs/components/resize-control/shadow.js +48 -0
- package/dist/cjs/components/skip-links/index.js +4 -4
- package/dist/cjs/components/skip-links/skip-link-components.js +53 -9
- package/dist/cjs/components/slots/banner.js +27 -11
- package/dist/cjs/components/slots/content.js +9 -2
- package/dist/cjs/components/slots/internal/left-sidebar-inner.js +65 -0
- package/dist/cjs/components/slots/internal/left-sidebar-outer.js +100 -0
- package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +63 -0
- package/dist/cjs/components/slots/internal/slot-focus-ring.js +61 -0
- package/dist/cjs/components/slots/left-panel.js +26 -11
- package/dist/cjs/components/slots/left-sidebar-without-resize.js +10 -10
- package/dist/cjs/components/slots/left-sidebar.js +23 -18
- package/dist/cjs/components/slots/main.js +53 -6
- package/dist/cjs/components/slots/page-layout.js +10 -3
- package/dist/cjs/components/slots/right-panel.js +26 -11
- package/dist/cjs/components/slots/right-sidebar.js +57 -13
- package/dist/cjs/components/slots/top-navigation.js +27 -11
- package/dist/cjs/controllers/index.js +14 -14
- package/dist/cjs/controllers/sidebar-resize-context.js +8 -5
- package/dist/cjs/controllers/sidebar-resize-controller.js +10 -5
- package/dist/cjs/controllers/skip-link-context.js +1 -1
- package/dist/cjs/index.js +34 -34
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/hooks/index.js +2 -0
- package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +29 -0
- package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +29 -0
- package/dist/es2019/components/resize-control/grab-area.js +46 -4
- package/dist/es2019/components/resize-control/index.js +12 -9
- package/dist/es2019/components/resize-control/resize-button.js +61 -4
- package/dist/es2019/components/resize-control/shadow.js +43 -0
- package/dist/es2019/components/skip-links/skip-link-components.js +47 -5
- package/dist/es2019/components/slots/banner.js +21 -7
- package/dist/es2019/components/slots/content.js +8 -2
- package/dist/es2019/components/slots/internal/left-sidebar-inner.js +52 -0
- package/dist/es2019/components/slots/internal/left-sidebar-outer.js +79 -0
- package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +49 -0
- package/dist/es2019/components/slots/internal/slot-focus-ring.js +50 -0
- package/dist/es2019/components/slots/left-panel.js +20 -7
- package/dist/es2019/components/slots/left-sidebar-without-resize.js +10 -11
- package/dist/es2019/components/slots/left-sidebar.js +20 -17
- package/dist/es2019/components/slots/main.js +46 -6
- package/dist/es2019/components/slots/page-layout.js +15 -3
- package/dist/es2019/components/slots/right-panel.js +20 -7
- package/dist/es2019/components/slots/right-sidebar.js +50 -8
- package/dist/es2019/components/slots/top-navigation.js +21 -7
- package/dist/es2019/controllers/sidebar-resize-context.js +2 -1
- package/dist/es2019/controllers/sidebar-resize-controller.js +10 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/hooks/index.js +2 -0
- package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +34 -0
- package/dist/esm/common/hooks/use-is-sidebar-dragging.js +34 -0
- package/dist/esm/common/utils.js +2 -2
- package/dist/esm/components/resize-control/grab-area.js +44 -5
- package/dist/esm/components/resize-control/index.js +25 -22
- package/dist/esm/components/resize-control/resize-button.js +59 -5
- package/dist/esm/components/resize-control/shadow.js +37 -0
- package/dist/esm/components/skip-links/skip-link-components.js +49 -7
- package/dist/esm/components/slots/banner.js +27 -12
- package/dist/esm/components/slots/content.js +8 -2
- package/dist/esm/components/slots/internal/left-sidebar-inner.js +53 -0
- package/dist/esm/components/slots/internal/left-sidebar-outer.js +82 -0
- package/dist/esm/components/slots/internal/resizable-children-wrapper.js +51 -0
- package/dist/esm/components/slots/internal/slot-focus-ring.js +51 -0
- package/dist/esm/components/slots/left-panel.js +26 -12
- package/dist/esm/components/slots/left-sidebar-without-resize.js +10 -10
- package/dist/esm/components/slots/left-sidebar.js +22 -18
- package/dist/esm/components/slots/main.js +49 -8
- package/dist/esm/components/slots/page-layout.js +12 -3
- package/dist/esm/components/slots/right-panel.js +26 -12
- package/dist/esm/components/slots/right-sidebar.js +57 -14
- package/dist/esm/components/slots/top-navigation.js +27 -12
- package/dist/esm/controllers/sidebar-resize-context.js +6 -4
- package/dist/esm/controllers/sidebar-resize-controller.js +10 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/common/hooks/index.d.ts +2 -0
- package/dist/types/common/hooks/use-is-sidebar-collapsing.d.ts +2 -0
- package/dist/types/common/hooks/use-is-sidebar-dragging.d.ts +2 -0
- package/dist/types/components/resize-control/index.d.ts +1 -0
- package/dist/types/components/resize-control/resize-button.d.ts +1 -0
- package/dist/types/components/resize-control/shadow.d.ts +6 -0
- package/dist/types/components/slots/banner.d.ts +1 -0
- package/dist/types/components/slots/internal/left-sidebar-inner.d.ts +9 -0
- package/dist/types/components/slots/internal/left-sidebar-outer.d.ts +13 -0
- package/dist/types/components/slots/internal/resizable-children-wrapper.d.ts +10 -0
- package/dist/types/components/slots/internal/slot-focus-ring.d.ts +19 -0
- package/dist/types/components/slots/left-panel.d.ts +1 -0
- package/dist/types/components/slots/left-sidebar-without-resize.d.ts +1 -0
- package/dist/types/components/slots/left-sidebar.d.ts +1 -0
- package/dist/types/components/slots/main.d.ts +1 -0
- package/dist/types/components/slots/page-layout.d.ts +1 -0
- package/dist/types/components/slots/right-panel.d.ts +1 -0
- package/dist/types/components/slots/right-sidebar.d.ts +1 -0
- package/dist/types/components/slots/slot-dimensions.d.ts +1 -0
- package/dist/types/components/slots/top-navigation.d.ts +1 -0
- package/dist/types/controllers/sidebar-resize-context.d.ts +1 -0
- package/package.json +25 -20
- package/dist/cjs/components/resize-control/styles.js +0 -156
- package/dist/cjs/components/skip-links/styles.js +0 -58
- package/dist/cjs/components/slots/left-sidebar-styles.js +0 -116
- package/dist/cjs/components/slots/styles.js +0 -154
- package/dist/es2019/components/resize-control/styles.js +0 -136
- package/dist/es2019/components/skip-links/styles.js +0 -41
- package/dist/es2019/components/slots/left-sidebar-styles.js +0 -96
- package/dist/es2019/components/slots/styles.js +0 -130
- package/dist/esm/components/resize-control/styles.js +0 -131
- package/dist/esm/components/skip-links/styles.js +0 -45
- package/dist/esm/components/slots/left-sidebar-styles.js +0 -94
- package/dist/esm/components/slots/styles.js +0 -117
- package/dist/types/components/resize-control/styles.d.ts +0 -41
- package/dist/types/components/skip-links/styles.d.ts +0 -2
- package/dist/types/components/slots/left-sidebar-styles.d.ts +0 -5
- package/dist/types/components/slots/styles.d.ts +0 -23
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.useSkipLinks = exports.useSkipLink = exports.SkipLinksContext = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "BANNER_HEIGHT", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _constants.BANNER_HEIGHT;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "Banner", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return _components.
|
|
15
|
+
return _components.Banner;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "Content", {
|
|
@@ -21,70 +21,70 @@ Object.defineProperty(exports, "Content", {
|
|
|
21
21
|
return _components.Content;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
-
Object.defineProperty(exports, "
|
|
24
|
+
Object.defineProperty(exports, "LEFT_PANEL_WIDTH", {
|
|
25
25
|
enumerable: true,
|
|
26
26
|
get: function get() {
|
|
27
|
-
return
|
|
27
|
+
return _constants.LEFT_PANEL_WIDTH;
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
Object.defineProperty(exports, "
|
|
30
|
+
Object.defineProperty(exports, "LEFT_SIDEBAR_WIDTH", {
|
|
31
31
|
enumerable: true,
|
|
32
32
|
get: function get() {
|
|
33
|
-
return
|
|
33
|
+
return _constants.LEFT_SIDEBAR_WIDTH;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
-
Object.defineProperty(exports, "
|
|
36
|
+
Object.defineProperty(exports, "LeftPanel", {
|
|
37
37
|
enumerable: true,
|
|
38
38
|
get: function get() {
|
|
39
|
-
return _components.
|
|
39
|
+
return _components.LeftPanel;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
Object.defineProperty(exports, "
|
|
42
|
+
Object.defineProperty(exports, "LeftSidebar", {
|
|
43
43
|
enumerable: true,
|
|
44
44
|
get: function get() {
|
|
45
|
-
return _components.
|
|
45
|
+
return _components.LeftSidebar;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
-
Object.defineProperty(exports, "
|
|
48
|
+
Object.defineProperty(exports, "LeftSidebarWithoutResize", {
|
|
49
49
|
enumerable: true,
|
|
50
50
|
get: function get() {
|
|
51
|
-
return _components.
|
|
51
|
+
return _components.LeftSidebarWithoutResize;
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
|
-
Object.defineProperty(exports, "
|
|
54
|
+
Object.defineProperty(exports, "Main", {
|
|
55
55
|
enumerable: true,
|
|
56
56
|
get: function get() {
|
|
57
|
-
return _components.
|
|
57
|
+
return _components.Main;
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
|
-
Object.defineProperty(exports, "
|
|
60
|
+
Object.defineProperty(exports, "PageLayout", {
|
|
61
61
|
enumerable: true,
|
|
62
62
|
get: function get() {
|
|
63
|
-
return _components.
|
|
63
|
+
return _components.PageLayout;
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
|
-
Object.defineProperty(exports, "
|
|
66
|
+
Object.defineProperty(exports, "RIGHT_PANEL_WIDTH", {
|
|
67
67
|
enumerable: true,
|
|
68
68
|
get: function get() {
|
|
69
|
-
return
|
|
69
|
+
return _constants.RIGHT_PANEL_WIDTH;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
Object.defineProperty(exports, "
|
|
72
|
+
Object.defineProperty(exports, "RIGHT_SIDEBAR_WIDTH", {
|
|
73
73
|
enumerable: true,
|
|
74
74
|
get: function get() {
|
|
75
|
-
return _constants.
|
|
75
|
+
return _constants.RIGHT_SIDEBAR_WIDTH;
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
|
-
Object.defineProperty(exports, "
|
|
78
|
+
Object.defineProperty(exports, "RightPanel", {
|
|
79
79
|
enumerable: true,
|
|
80
80
|
get: function get() {
|
|
81
|
-
return
|
|
81
|
+
return _components.RightPanel;
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
|
-
Object.defineProperty(exports, "
|
|
84
|
+
Object.defineProperty(exports, "RightSidebar", {
|
|
85
85
|
enumerable: true,
|
|
86
86
|
get: function get() {
|
|
87
|
-
return
|
|
87
|
+
return _components.RightSidebar;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
Object.defineProperty(exports, "TOP_NAVIGATION_HEIGHT", {
|
|
@@ -93,28 +93,28 @@ Object.defineProperty(exports, "TOP_NAVIGATION_HEIGHT", {
|
|
|
93
93
|
return _constants.TOP_NAVIGATION_HEIGHT;
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
-
Object.defineProperty(exports, "
|
|
96
|
+
Object.defineProperty(exports, "TopNavigation", {
|
|
97
97
|
enumerable: true,
|
|
98
98
|
get: function get() {
|
|
99
|
-
return
|
|
99
|
+
return _components.TopNavigation;
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
|
-
Object.defineProperty(exports, "
|
|
102
|
+
Object.defineProperty(exports, "useCustomSkipLink", {
|
|
103
103
|
enumerable: true,
|
|
104
104
|
get: function get() {
|
|
105
|
-
return
|
|
105
|
+
return _components.useCustomSkipLink;
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
|
-
Object.defineProperty(exports, "
|
|
108
|
+
Object.defineProperty(exports, "useLeftSidebarFlyoutLock", {
|
|
109
109
|
enumerable: true,
|
|
110
110
|
get: function get() {
|
|
111
|
-
return _controllers.
|
|
111
|
+
return _controllers.useLeftSidebarFlyoutLock;
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
-
Object.defineProperty(exports, "
|
|
114
|
+
Object.defineProperty(exports, "usePageLayoutResize", {
|
|
115
115
|
enumerable: true,
|
|
116
116
|
get: function get() {
|
|
117
|
-
return _controllers.
|
|
117
|
+
return _controllers.usePageLayoutResize;
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { IS_SIDEBAR_COLLAPSING } from '../constants';
|
|
3
|
+
|
|
4
|
+
const getIsCollapsing = () => {
|
|
5
|
+
// SSR bail-out because document is undefined on the server
|
|
6
|
+
if (typeof document === 'undefined') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return document.documentElement.getAttribute(IS_SIDEBAR_COLLAPSING) === 'true';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const useIsSidebarCollapsing = () => {
|
|
14
|
+
const [isCollapsing, setIsCollapsing] = useState(getIsCollapsing);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const observer = new MutationObserver(() => {
|
|
17
|
+
setIsCollapsing(getIsCollapsing);
|
|
18
|
+
});
|
|
19
|
+
observer.observe(document.documentElement, {
|
|
20
|
+
attributeFilter: [IS_SIDEBAR_COLLAPSING]
|
|
21
|
+
});
|
|
22
|
+
return () => {
|
|
23
|
+
observer.disconnect();
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
return isCollapsing;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default useIsSidebarCollapsing;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { IS_SIDEBAR_DRAGGING } from '../constants';
|
|
3
|
+
|
|
4
|
+
const getIsDragging = () => {
|
|
5
|
+
// SSR bail-out because document is undefined on the server
|
|
6
|
+
if (typeof document === 'undefined') {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return document.documentElement.getAttribute(IS_SIDEBAR_DRAGGING) === 'true';
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const useIsSidebarDragging = () => {
|
|
14
|
+
const [isDragging, setIsDragging] = useState(getIsDragging);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const observer = new MutationObserver(() => {
|
|
17
|
+
setIsDragging(getIsDragging);
|
|
18
|
+
});
|
|
19
|
+
observer.observe(document.documentElement, {
|
|
20
|
+
attributeFilter: [IS_SIDEBAR_DRAGGING]
|
|
21
|
+
});
|
|
22
|
+
return () => {
|
|
23
|
+
observer.disconnect();
|
|
24
|
+
};
|
|
25
|
+
}, []);
|
|
26
|
+
return isDragging;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export default useIsSidebarDragging;
|
|
@@ -1,9 +1,51 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { jsx } from '@emotion/core';
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
import { B100, B200 } from '@atlaskit/theme/colors';
|
|
5
6
|
import { GRAB_AREA_LINE_SELECTOR, GRAB_AREA_SELECTOR } from '../../common/constants';
|
|
6
|
-
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Determines the color of the grab line.
|
|
10
|
+
*
|
|
11
|
+
* Used on internal leaf node, so naming collisions won't matter.
|
|
12
|
+
*/
|
|
13
|
+
const varLineColor = '--ds-line';
|
|
14
|
+
const grabAreaStyles = css({
|
|
15
|
+
width: 24,
|
|
16
|
+
height: '100%',
|
|
17
|
+
padding: 0,
|
|
18
|
+
backgroundColor: 'transparent',
|
|
19
|
+
border: 0,
|
|
20
|
+
cursor: 'ew-resize',
|
|
21
|
+
'&::-moz-focus-inner': {
|
|
22
|
+
border: 0
|
|
23
|
+
},
|
|
24
|
+
':focus': {
|
|
25
|
+
outline: 0
|
|
26
|
+
},
|
|
27
|
+
':enabled': {
|
|
28
|
+
':hover': {
|
|
29
|
+
[varLineColor]: `var(--ds-border-selected, ${B100})`
|
|
30
|
+
},
|
|
31
|
+
':active, :focus': {
|
|
32
|
+
[varLineColor]: `var(--ds-border-selected, ${B200})`
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const grabAreaCollapsedStyles = css({
|
|
37
|
+
padding: 0,
|
|
38
|
+
backgroundColor: 'transparent',
|
|
39
|
+
border: 0,
|
|
40
|
+
cursor: 'default'
|
|
41
|
+
});
|
|
42
|
+
const lineStyles = css({
|
|
43
|
+
display: 'block',
|
|
44
|
+
width: 2,
|
|
45
|
+
height: '100%',
|
|
46
|
+
backgroundColor: `var(${varLineColor})`,
|
|
47
|
+
transition: 'background-color 200ms'
|
|
48
|
+
});
|
|
7
49
|
const grabAreaLineSelector = {
|
|
8
50
|
[GRAB_AREA_LINE_SELECTOR]: true
|
|
9
51
|
};
|
|
@@ -18,9 +60,9 @@ const GrabArea = ({
|
|
|
18
60
|
}) => jsx("button", _extends({}, grabAreaSelector, {
|
|
19
61
|
"data-testid": testId,
|
|
20
62
|
type: "button",
|
|
21
|
-
css:
|
|
63
|
+
css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles]
|
|
22
64
|
}, rest), jsx("span", _extends({
|
|
23
|
-
css:
|
|
65
|
+
css: lineStyles
|
|
24
66
|
}, grabAreaLineSelector)));
|
|
25
67
|
|
|
26
68
|
export default GrabArea;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { useCallback, useContext, useMemo, useRef, useState } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
6
|
import rafSchd from 'raf-schd';
|
|
7
7
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_DRAGGING, MIN_LEFT_SIDEBAR_DRAG_THRESHOLD, RESIZE_BUTTON_SELECTOR, RESIZE_CONTROL_SELECTOR, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
8
8
|
import { getLeftPanelWidth, getLeftSidebarPercentage } from '../../common/utils';
|
|
@@ -11,16 +11,19 @@ import { SidebarResizeContext } from '../../controllers/sidebar-resize-context';
|
|
|
11
11
|
|
|
12
12
|
import GrabArea from './grab-area';
|
|
13
13
|
import ResizeButton from './resize-button';
|
|
14
|
-
import
|
|
14
|
+
import Shadow from './shadow';
|
|
15
15
|
const cssSelector = {
|
|
16
16
|
[RESIZE_CONTROL_SELECTOR]: true
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const resizeControlStyles = css({
|
|
19
|
+
position: 'absolute',
|
|
20
|
+
top: 0,
|
|
21
|
+
bottom: 0,
|
|
22
|
+
left: '100%',
|
|
23
|
+
outline: 'none'
|
|
24
|
+
});
|
|
25
|
+
const showResizeButtonStyles = css({
|
|
26
|
+
'--ds--resize-button--opacity': 1
|
|
24
27
|
});
|
|
25
28
|
|
|
26
29
|
const ResizeControl = ({
|
|
@@ -236,7 +239,7 @@ const ResizeControl = ({
|
|
|
236
239
|
/* eslint-disable jsx-a11y/role-supports-aria-props */
|
|
237
240
|
|
|
238
241
|
return jsx("div", _extends({}, cssSelector, {
|
|
239
|
-
css:
|
|
242
|
+
css: [resizeControlStyles, (isGrabAreaFocused || isLeftSidebarCollapsed) && showResizeButtonStyles]
|
|
240
243
|
}), jsx(Shadow, {
|
|
241
244
|
testId: testId && `${testId}-shadow`
|
|
242
245
|
}), jsx(GrabArea, {
|
|
@@ -1,10 +1,67 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { jsx } from '@emotion/core';
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
5
|
import ChevronRight from '@atlaskit/icon/glyph/chevron-right';
|
|
6
|
+
import { easeOut } from '@atlaskit/motion/curves';
|
|
7
|
+
import { mediumDurationMs, smallDurationMs } from '@atlaskit/motion/durations';
|
|
8
|
+
import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
|
|
6
9
|
import { RESIZE_BUTTON_SELECTOR } from '../../common/constants';
|
|
7
|
-
|
|
10
|
+
const increaseHitAreaStyles = css({
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
top: -8,
|
|
13
|
+
right: -12,
|
|
14
|
+
bottom: -8,
|
|
15
|
+
left: -8
|
|
16
|
+
});
|
|
17
|
+
const resizeIconButtonStyles = css({
|
|
18
|
+
width: 24,
|
|
19
|
+
height: 24,
|
|
20
|
+
padding: 0,
|
|
21
|
+
position: 'absolute',
|
|
22
|
+
top: 32,
|
|
23
|
+
left: 0,
|
|
24
|
+
backgroundColor: `var(--ds-surface-overlay, ${N0})`,
|
|
25
|
+
border: 0,
|
|
26
|
+
borderRadius: '50%',
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* TODO: https://product-fabric.atlassian.net/browse/DSP-3392
|
|
30
|
+
* This shadow needs further investigation,
|
|
31
|
+
* along with the hover and active background colors.
|
|
32
|
+
*/
|
|
33
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
34
|
+
boxShadow: `0 0 0 1px ${N30A}, 0 2px 4px 1px ${N30A}`,
|
|
35
|
+
color: `var(--ds-text-subtle, ${N200})`,
|
|
36
|
+
cursor: 'pointer',
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The fallback value of 0 ensures that the button is hidden by default,
|
|
40
|
+
* unless some parent (or the button itself) overrides it.
|
|
41
|
+
*/
|
|
42
|
+
opacity: `var(--ds--resize-button--opacity,0)`,
|
|
43
|
+
outline: 0,
|
|
44
|
+
transform: 'translateX(-50%)',
|
|
45
|
+
transition: `
|
|
46
|
+
background-color ${smallDurationMs}ms linear,
|
|
47
|
+
color ${smallDurationMs}ms linear,
|
|
48
|
+
opacity ${mediumDurationMs}ms ${easeOut}
|
|
49
|
+
`,
|
|
50
|
+
':hover': {
|
|
51
|
+
backgroundColor: `var(--ds-background-selected-bold, ${B100})`,
|
|
52
|
+
color: `var(--ds-text-inverse, ${N0})`,
|
|
53
|
+
opacity: 1
|
|
54
|
+
},
|
|
55
|
+
':active, :focus': {
|
|
56
|
+
backgroundColor: `var(--ds-background-selected-bold-hovered, ${B200})`,
|
|
57
|
+
color: `var(--ds-text-inverse, ${N0})`,
|
|
58
|
+
opacity: 1
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const resizeIconButtonExpandedStyles = css({
|
|
62
|
+
transform: 'rotate(180deg)',
|
|
63
|
+
transformOrigin: 7
|
|
64
|
+
});
|
|
8
65
|
|
|
9
66
|
const preventDefault = event => event.preventDefault();
|
|
10
67
|
|
|
@@ -22,7 +79,7 @@ const ResizeButton = ({
|
|
|
22
79
|
"aria-expanded": !isLeftSidebarCollapsed,
|
|
23
80
|
"aria-label": label,
|
|
24
81
|
type: "button",
|
|
25
|
-
css:
|
|
82
|
+
css: [resizeIconButtonStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
26
83
|
"data-testid": testId // Prevents focus staying attached to the button
|
|
27
84
|
// when pressed
|
|
28
85
|
,
|
|
@@ -30,7 +87,7 @@ const ResizeButton = ({
|
|
|
30
87
|
}, props), jsx(ChevronRight, {
|
|
31
88
|
label: ""
|
|
32
89
|
}), jsx("div", {
|
|
33
|
-
css:
|
|
90
|
+
css: increaseHitAreaStyles
|
|
34
91
|
}));
|
|
35
92
|
|
|
36
93
|
export default ResizeButton;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { easeOut } from '@atlaskit/motion';
|
|
4
|
+
import { useIsSidebarDragging } from '../../common/hooks';
|
|
5
|
+
const colorStops = `
|
|
6
|
+
rgba(0, 0, 0, 0.2) 0px,
|
|
7
|
+
rgba(0, 0, 0, 0.2) 1px,
|
|
8
|
+
rgba(0, 0, 0, 0.1) 1px,
|
|
9
|
+
rgba(0, 0, 0, 0) 100%
|
|
10
|
+
`;
|
|
11
|
+
const direction = 'to left';
|
|
12
|
+
const transitionDuration = '0.22s';
|
|
13
|
+
const shadowStyles = css({
|
|
14
|
+
width: 3,
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
top: 0,
|
|
17
|
+
bottom: 0,
|
|
18
|
+
left: -1,
|
|
19
|
+
background: `var(--ds-border, ${`linear-gradient(${direction}, ${colorStops})`})`,
|
|
20
|
+
opacity: 0.5,
|
|
21
|
+
pointerEvents: 'none',
|
|
22
|
+
transitionDuration: transitionDuration,
|
|
23
|
+
transitionProperty: 'left, opacity, width',
|
|
24
|
+
transitionTimingFunction: easeOut
|
|
25
|
+
});
|
|
26
|
+
const draggingStyles = css({
|
|
27
|
+
width: 6,
|
|
28
|
+
left: -6,
|
|
29
|
+
background: `var(--ds-background-neutral-subtle, ${`linear-gradient(${direction}, ${colorStops})`})`,
|
|
30
|
+
opacity: 0.8
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const Shadow = ({
|
|
34
|
+
testId
|
|
35
|
+
}) => {
|
|
36
|
+
const isDragging = useIsSidebarDragging();
|
|
37
|
+
return jsx("div", {
|
|
38
|
+
"data-testid": testId,
|
|
39
|
+
css: [shadowStyles, isDragging && draggingStyles]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default Shadow;
|
|
@@ -1,8 +1,46 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/core';
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
4
|
+
import { N30A, N60A } from '@atlaskit/theme/colors';
|
|
3
5
|
import { PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
|
|
4
6
|
import { useSkipLinks } from '../../controllers';
|
|
5
|
-
|
|
7
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
8
|
+
const prefersReducedMotionStyles = css(prefersReducedMotion());
|
|
9
|
+
const skipLinkStyles = css({
|
|
10
|
+
margin: 10,
|
|
11
|
+
padding: '0.8rem 1rem',
|
|
12
|
+
position: 'fixed',
|
|
13
|
+
zIndex: -1,
|
|
14
|
+
left: -999999,
|
|
15
|
+
background: "var(--ds-surface-overlay, white)",
|
|
16
|
+
border: 'none',
|
|
17
|
+
borderRadius: 3,
|
|
18
|
+
boxShadow: `var(--ds-shadow-overlay, ${`0 0 0 1px ${N30A}, 0 2px 10px ${N30A}, 0 0 20px -4px ${N60A}`})`,
|
|
19
|
+
opacity: 0,
|
|
20
|
+
|
|
21
|
+
/* Do the transform when focused */
|
|
22
|
+
transform: 'translateY(-50%)',
|
|
23
|
+
transition: `transform 0.3s ${easeOut}`,
|
|
24
|
+
':focus-within': {
|
|
25
|
+
/**
|
|
26
|
+
* Max z-index is 2147483647. Skip links always be on top,
|
|
27
|
+
* but giving a few digits extra space just in case there's a future need.
|
|
28
|
+
*/
|
|
29
|
+
zIndex: 2147483640,
|
|
30
|
+
left: 0,
|
|
31
|
+
opacity: 1,
|
|
32
|
+
transform: 'translateY(0%)'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const skipLinkListStyles = css({
|
|
36
|
+
marginTop: 4,
|
|
37
|
+
paddingLeft: 0,
|
|
38
|
+
listStylePosition: 'outside',
|
|
39
|
+
listStyleType: 'none'
|
|
40
|
+
});
|
|
41
|
+
const skipLinkListItemStyles = css({
|
|
42
|
+
marginTop: 0
|
|
43
|
+
});
|
|
6
44
|
|
|
7
45
|
const assignIndex = (num, arr) => {
|
|
8
46
|
if (!arr.includes(num)) {
|
|
@@ -58,9 +96,11 @@ export const SkipLinkWrapper = ({
|
|
|
58
96
|
return jsx("div", {
|
|
59
97
|
onFocus: attachEscHandler,
|
|
60
98
|
onBlur: removeEscHandler,
|
|
61
|
-
css: skipLinkStyles,
|
|
99
|
+
css: [skipLinkStyles, prefersReducedMotionStyles],
|
|
62
100
|
"data-skip-link-wrapper": true
|
|
63
|
-
}, jsx("h5", null, skipLinksLabel), jsx("ol",
|
|
101
|
+
}, jsx("h5", null, skipLinksLabel), jsx("ol", {
|
|
102
|
+
css: skipLinkListStyles
|
|
103
|
+
}, sortSkipLinks(skipLinksData).map(({
|
|
64
104
|
id,
|
|
65
105
|
skipLinkTitle
|
|
66
106
|
}) => jsx(SkipLink, {
|
|
@@ -110,7 +150,9 @@ export const SkipLink = ({
|
|
|
110
150
|
isFocusable,
|
|
111
151
|
title
|
|
112
152
|
}) => {
|
|
113
|
-
return jsx("li",
|
|
153
|
+
return jsx("li", {
|
|
154
|
+
css: skipLinkListItemStyles
|
|
155
|
+
}, jsx("a", {
|
|
114
156
|
tabIndex: isFocusable ? 0 : -1,
|
|
115
157
|
href: href,
|
|
116
158
|
onClick: focusTargetRef(href),
|
|
@@ -2,12 +2,23 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
6
|
-
import { DEFAULT_BANNER_HEIGHT, VAR_BANNER_HEIGHT } from '../../common/constants';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
|
+
import { BANNER, BANNER_HEIGHT, DEFAULT_BANNER_HEIGHT, LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, VAR_BANNER_HEIGHT } from '../../common/constants';
|
|
7
7
|
import { getPageLayoutSlotSelector, resolveDimension } from '../../common/utils';
|
|
8
8
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
9
|
+
import SlotFocusRing from './internal/slot-focus-ring';
|
|
9
10
|
import SlotDimensions from './slot-dimensions';
|
|
10
|
-
|
|
11
|
+
const bannerStyles = css({
|
|
12
|
+
height: BANNER_HEIGHT,
|
|
13
|
+
gridArea: BANNER
|
|
14
|
+
});
|
|
15
|
+
const bannerFixedStyles = css({
|
|
16
|
+
position: 'fixed',
|
|
17
|
+
zIndex: 2,
|
|
18
|
+
top: 0,
|
|
19
|
+
right: RIGHT_PANEL_WIDTH,
|
|
20
|
+
left: LEFT_PANEL_WIDTH
|
|
21
|
+
});
|
|
11
22
|
|
|
12
23
|
const Banner = props => {
|
|
13
24
|
const {
|
|
@@ -28,17 +39,20 @@ const Banner = props => {
|
|
|
28
39
|
publishGridState({
|
|
29
40
|
[VAR_BANNER_HEIGHT]: 0
|
|
30
41
|
});
|
|
31
|
-
};
|
|
42
|
+
};
|
|
32
43
|
}, [bannerHeight]);
|
|
33
44
|
useSkipLink(id, skipLinkTitle);
|
|
34
|
-
return jsx(
|
|
35
|
-
|
|
45
|
+
return jsx(SlotFocusRing, null, ({
|
|
46
|
+
className
|
|
47
|
+
}) => jsx("div", _extends({
|
|
48
|
+
css: [bannerStyles, isFixed && bannerFixedStyles],
|
|
49
|
+
className: className,
|
|
36
50
|
"data-testid": testId,
|
|
37
51
|
id: id
|
|
38
52
|
}, getPageLayoutSlotSelector('banner')), jsx(SlotDimensions, {
|
|
39
53
|
variableName: VAR_BANNER_HEIGHT,
|
|
40
54
|
value: bannerHeight
|
|
41
|
-
}), children);
|
|
55
|
+
}), children));
|
|
42
56
|
};
|
|
43
57
|
|
|
44
58
|
export default Banner;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/core';
|
|
3
|
-
import {
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { CONTENT } from '../../common/constants';
|
|
4
|
+
const contentStyles = css({
|
|
5
|
+
display: 'flex',
|
|
6
|
+
height: '100%',
|
|
7
|
+
position: 'relative',
|
|
8
|
+
gridArea: CONTENT
|
|
9
|
+
});
|
|
4
10
|
|
|
5
11
|
const Content = props => {
|
|
6
12
|
const {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
4
|
+
import { BANNER_HEIGHT, LEFT_PANEL_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, TRANSITION_DURATION } from '../../../common/constants';
|
|
5
|
+
import { useIsSidebarDragging } from '../../../common/hooks';
|
|
6
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
7
|
+
const prefersReducedMotionStyles = css(prefersReducedMotion());
|
|
8
|
+
/**
|
|
9
|
+
* This inner wrapper is required to allow the sidebar to be `position: fixed`.
|
|
10
|
+
*
|
|
11
|
+
* If we were to apply `position: fixed` to the outer wrapper, it will be popped
|
|
12
|
+
* out of its flex container and Main would stretch to occupy all the space.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const fixedInnerStyles = css({
|
|
16
|
+
width: `${LEFT_SIDEBAR_WIDTH}`,
|
|
17
|
+
position: 'fixed',
|
|
18
|
+
top: `calc(${BANNER_HEIGHT} + ${TOP_NAVIGATION_HEIGHT})`,
|
|
19
|
+
bottom: 0,
|
|
20
|
+
left: `${LEFT_PANEL_WIDTH}`,
|
|
21
|
+
transition: `width ${TRANSITION_DURATION}ms ${easeOut} 0s`
|
|
22
|
+
});
|
|
23
|
+
const fixedInnerFlyoutStyles = css({
|
|
24
|
+
width: LEFT_SIDEBAR_FLYOUT_WIDTH
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Static in the sense of `position: static`.
|
|
28
|
+
*
|
|
29
|
+
* It will expand the page height to fit its content.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const staticInnerStyles = css({
|
|
33
|
+
height: '100%'
|
|
34
|
+
});
|
|
35
|
+
const draggingStyles = css({
|
|
36
|
+
cursor: 'ew-resize',
|
|
37
|
+
// Make sure drag to resize does not animate as the user drags
|
|
38
|
+
transition: 'none'
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const LeftSidebarInner = ({
|
|
42
|
+
children,
|
|
43
|
+
isFixed = false,
|
|
44
|
+
isFlyoutOpen = false
|
|
45
|
+
}) => {
|
|
46
|
+
const isDragging = useIsSidebarDragging();
|
|
47
|
+
return jsx("div", {
|
|
48
|
+
css: [!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
|
|
49
|
+
}, children);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default LeftSidebarInner;
|