@atlaskit/page-layout 1.1.0 → 1.2.2
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 +26 -0
- package/README.md +3 -3
- package/__perf__/utils/perf-example.tsx +24 -17
- package/__perf__/utils/product-integration/NotificationsPopup.tsx +6 -5
- package/__perf__/utils/product-integration/SampleFooter.tsx +13 -13
- 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/components/resize-control/grab-area.js +42 -4
- package/dist/cjs/components/resize-control/index.js +22 -20
- package/dist/cjs/components/resize-control/resize-button.js +59 -4
- package/dist/cjs/components/resize-control/shadow.js +48 -0
- package/dist/cjs/components/skip-links/skip-link-components.js +49 -5
- 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 +21 -16
- 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/sidebar-resize-context.js +2 -1
- package/dist/cjs/controllers/sidebar-resize-controller.js +10 -5
- 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/components/resize-control/grab-area.js +42 -4
- package/dist/esm/components/resize-control/index.js +23 -20
- package/dist/esm/components/resize-control/resize-button.js +57 -4
- package/dist/esm/components/resize-control/shadow.js +37 -0
- package/dist/esm/components/skip-links/skip-link-components.js +47 -5
- 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 +20 -16
- 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 +2 -1
- 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/common/utils.d.ts +0 -1
- package/dist/types/components/resize-control/shadow.d.ts +6 -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/controllers/sidebar-resize-context.d.ts +1 -0
- package/package.json +10 -7
- package/dist/cjs/components/resize-control/styles.js +0 -158
- 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 -139
- 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 -133
- 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
|
@@ -2,12 +2,49 @@ 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_RIGHT_SIDEBAR_WIDTH, VAR_RIGHT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
|
+
import { BANNER_HEIGHT, DEFAULT_RIGHT_SIDEBAR_WIDTH, RIGHT_PANEL_WIDTH, RIGHT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, VAR_RIGHT_SIDEBAR_WIDTH } 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
|
+
/**
|
|
12
|
+
* This inner wrapper is required to allow the sidebar to be `position: fixed`.
|
|
13
|
+
*
|
|
14
|
+
* If we were to apply `position: fixed` to the outer wrapper, it will be popped
|
|
15
|
+
* out of its flex container and Main would stretch to occupy all the space.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const fixedInnerStyles = css({
|
|
19
|
+
/**
|
|
20
|
+
* This width on the inner wrapper is required when it is using fixed
|
|
21
|
+
* positioning. Otherwise its width is slightly off.
|
|
22
|
+
*/
|
|
23
|
+
width: RIGHT_SIDEBAR_WIDTH,
|
|
24
|
+
position: 'fixed',
|
|
25
|
+
top: `calc(${BANNER_HEIGHT} + ${TOP_NAVIGATION_HEIGHT})`,
|
|
26
|
+
right: `calc(${RIGHT_PANEL_WIDTH})`,
|
|
27
|
+
bottom: 0
|
|
28
|
+
});
|
|
29
|
+
const staticInnerStyles = css({
|
|
30
|
+
height: '100%'
|
|
31
|
+
});
|
|
32
|
+
const outerStyles = css({
|
|
33
|
+
width: RIGHT_SIDEBAR_WIDTH
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* In fixed mode this element's child is taken out of the document flow.
|
|
37
|
+
* It doesn't take up the width as expected,
|
|
38
|
+
* so the pseudo element forces it to take up the necessary width.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
const fixedOuterStyles = css({
|
|
42
|
+
'&::after': {
|
|
43
|
+
display: 'inline-block',
|
|
44
|
+
width: RIGHT_SIDEBAR_WIDTH,
|
|
45
|
+
content: "''"
|
|
46
|
+
}
|
|
47
|
+
});
|
|
11
48
|
|
|
12
49
|
const RightSidebar = props => {
|
|
13
50
|
const {
|
|
@@ -28,19 +65,24 @@ const RightSidebar = props => {
|
|
|
28
65
|
publishGridState({
|
|
29
66
|
[VAR_RIGHT_SIDEBAR_WIDTH]: 0
|
|
30
67
|
});
|
|
31
|
-
};
|
|
68
|
+
};
|
|
32
69
|
}, [rightSidebarWidth, id]);
|
|
33
70
|
useSkipLink(id, skipLinkTitle);
|
|
34
|
-
return jsx(
|
|
71
|
+
return jsx(SlotFocusRing, {
|
|
72
|
+
isSidebar: true
|
|
73
|
+
}, ({
|
|
74
|
+
className
|
|
75
|
+
}) => jsx("div", _extends({
|
|
35
76
|
"data-testid": testId,
|
|
36
|
-
css:
|
|
77
|
+
css: [outerStyles, isFixed && fixedOuterStyles],
|
|
78
|
+
className: className,
|
|
37
79
|
id: id
|
|
38
80
|
}, getPageLayoutSlotSelector('right-sidebar')), jsx(SlotDimensions, {
|
|
39
81
|
variableName: VAR_RIGHT_SIDEBAR_WIDTH,
|
|
40
82
|
value: rightSidebarWidth
|
|
41
83
|
}), jsx("div", {
|
|
42
|
-
css:
|
|
43
|
-
}, children));
|
|
84
|
+
css: [isFixed && fixedInnerStyles, !isFixed && staticInnerStyles]
|
|
85
|
+
}, children)));
|
|
44
86
|
};
|
|
45
87
|
|
|
46
88
|
export default RightSidebar;
|
|
@@ -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_TOP_NAVIGATION_HEIGHT, VAR_TOP_NAVIGATION_HEIGHT } from '../../common/constants';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
|
+
import { BANNER_HEIGHT, DEFAULT_TOP_NAVIGATION_HEIGHT, LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, TOP_NAVIGATION, TOP_NAVIGATION_HEIGHT, VAR_TOP_NAVIGATION_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 topNavigationStyles = css({
|
|
12
|
+
height: TOP_NAVIGATION_HEIGHT,
|
|
13
|
+
gridArea: TOP_NAVIGATION
|
|
14
|
+
});
|
|
15
|
+
const fixedStyles = css({
|
|
16
|
+
position: 'fixed',
|
|
17
|
+
zIndex: 2,
|
|
18
|
+
top: BANNER_HEIGHT,
|
|
19
|
+
right: RIGHT_PANEL_WIDTH,
|
|
20
|
+
left: LEFT_PANEL_WIDTH
|
|
21
|
+
});
|
|
11
22
|
|
|
12
23
|
const TopNavigation = props => {
|
|
13
24
|
const {
|
|
@@ -28,17 +39,20 @@ const TopNavigation = props => {
|
|
|
28
39
|
publishGridState({
|
|
29
40
|
[VAR_TOP_NAVIGATION_HEIGHT]: 0
|
|
30
41
|
});
|
|
31
|
-
};
|
|
42
|
+
};
|
|
32
43
|
}, [topNavigationHeight]);
|
|
33
44
|
useSkipLink(id, skipLinkTitle);
|
|
34
|
-
return jsx(
|
|
35
|
-
|
|
45
|
+
return jsx(SlotFocusRing, null, ({
|
|
46
|
+
className
|
|
47
|
+
}) => jsx("div", _extends({
|
|
48
|
+
css: [topNavigationStyles, isFixed && fixedStyles],
|
|
49
|
+
className: className,
|
|
36
50
|
"data-testid": testId,
|
|
37
51
|
id: id
|
|
38
52
|
}, getPageLayoutSlotSelector('top-navigation')), jsx(SlotDimensions, {
|
|
39
53
|
variableName: VAR_TOP_NAVIGATION_HEIGHT,
|
|
40
54
|
value: topNavigationHeight
|
|
41
|
-
}), children);
|
|
55
|
+
}), children));
|
|
42
56
|
};
|
|
43
57
|
|
|
44
58
|
export default TopNavigation;
|
|
@@ -8,7 +8,8 @@ const leftSidebarState = {
|
|
|
8
8
|
isLeftSidebarCollapsed: false,
|
|
9
9
|
leftSidebarWidth: 0,
|
|
10
10
|
lastLeftSidebarWidth: 0,
|
|
11
|
-
flyoutLockCount: 0
|
|
11
|
+
flyoutLockCount: 0,
|
|
12
|
+
isFixed: true
|
|
12
13
|
};
|
|
13
14
|
export const SidebarResizeContext = /*#__PURE__*/createContext({
|
|
14
15
|
isLeftSidebarCollapsed: false,
|
|
@@ -22,7 +22,8 @@ export const SidebarResizeController = ({
|
|
|
22
22
|
isLeftSidebarCollapsed: false,
|
|
23
23
|
leftSidebarWidth: 0,
|
|
24
24
|
lastLeftSidebarWidth: 0,
|
|
25
|
-
flyoutLockCount: 0
|
|
25
|
+
flyoutLockCount: 0,
|
|
26
|
+
isFixed: true
|
|
26
27
|
});
|
|
27
28
|
const {
|
|
28
29
|
isLeftSidebarCollapsed
|
|
@@ -49,7 +50,8 @@ export const SidebarResizeController = ({
|
|
|
49
50
|
const {
|
|
50
51
|
lastLeftSidebarWidth,
|
|
51
52
|
isResizing,
|
|
52
|
-
flyoutLockCount
|
|
53
|
+
flyoutLockCount,
|
|
54
|
+
isFixed
|
|
53
55
|
} = leftSidebarState;
|
|
54
56
|
|
|
55
57
|
if (isResizing) {
|
|
@@ -63,7 +65,8 @@ export const SidebarResizeController = ({
|
|
|
63
65
|
leftSidebarWidth: width,
|
|
64
66
|
lastLeftSidebarWidth,
|
|
65
67
|
isResizing,
|
|
66
|
-
flyoutLockCount
|
|
68
|
+
flyoutLockCount,
|
|
69
|
+
isFixed
|
|
67
70
|
};
|
|
68
71
|
setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
|
|
69
72
|
|
|
@@ -75,7 +78,8 @@ export const SidebarResizeController = ({
|
|
|
75
78
|
const {
|
|
76
79
|
leftSidebarWidth,
|
|
77
80
|
isResizing,
|
|
78
|
-
flyoutLockCount
|
|
81
|
+
flyoutLockCount,
|
|
82
|
+
isFixed
|
|
79
83
|
} = leftSidebarState;
|
|
80
84
|
|
|
81
85
|
if (isResizing) {
|
|
@@ -91,7 +95,8 @@ export const SidebarResizeController = ({
|
|
|
91
95
|
leftSidebarWidth: COLLAPSED_LEFT_SIDEBAR_WIDTH,
|
|
92
96
|
lastLeftSidebarWidth: leftSidebarWidth,
|
|
93
97
|
isResizing,
|
|
94
|
-
flyoutLockCount
|
|
98
|
+
flyoutLockCount,
|
|
99
|
+
isFixed
|
|
95
100
|
};
|
|
96
101
|
setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
|
|
97
102
|
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { IS_SIDEBAR_COLLAPSING } from '../constants';
|
|
4
|
+
|
|
5
|
+
var getIsCollapsing = function getIsCollapsing() {
|
|
6
|
+
// SSR bail-out because document is undefined on the server
|
|
7
|
+
if (typeof document === 'undefined') {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return document.documentElement.getAttribute(IS_SIDEBAR_COLLAPSING) === 'true';
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var useIsSidebarCollapsing = function useIsSidebarCollapsing() {
|
|
15
|
+
var _useState = useState(getIsCollapsing),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
isCollapsing = _useState2[0],
|
|
18
|
+
setIsCollapsing = _useState2[1];
|
|
19
|
+
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
var observer = new MutationObserver(function () {
|
|
22
|
+
setIsCollapsing(getIsCollapsing);
|
|
23
|
+
});
|
|
24
|
+
observer.observe(document.documentElement, {
|
|
25
|
+
attributeFilter: [IS_SIDEBAR_COLLAPSING]
|
|
26
|
+
});
|
|
27
|
+
return function () {
|
|
28
|
+
observer.disconnect();
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
return isCollapsing;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default useIsSidebarCollapsing;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { IS_SIDEBAR_DRAGGING } from '../constants';
|
|
4
|
+
|
|
5
|
+
var getIsDragging = function getIsDragging() {
|
|
6
|
+
// SSR bail-out because document is undefined on the server
|
|
7
|
+
if (typeof document === 'undefined') {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return document.documentElement.getAttribute(IS_SIDEBAR_DRAGGING) === 'true';
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var useIsSidebarDragging = function useIsSidebarDragging() {
|
|
15
|
+
var _useState = useState(getIsDragging),
|
|
16
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
17
|
+
isDragging = _useState2[0],
|
|
18
|
+
setIsDragging = _useState2[1];
|
|
19
|
+
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
var observer = new MutationObserver(function () {
|
|
22
|
+
setIsDragging(getIsDragging);
|
|
23
|
+
});
|
|
24
|
+
observer.observe(document.documentElement, {
|
|
25
|
+
attributeFilter: [IS_SIDEBAR_DRAGGING]
|
|
26
|
+
});
|
|
27
|
+
return function () {
|
|
28
|
+
observer.disconnect();
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
return isDragging;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default useIsSidebarDragging;
|
|
@@ -4,9 +4,47 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
var _excluded = ["testId", "isLeftSidebarCollapsed"];
|
|
5
5
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
|
-
import { jsx } from '@emotion/core';
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
8
|
+
import { B100, B200 } from '@atlaskit/theme/colors';
|
|
8
9
|
import { GRAB_AREA_LINE_SELECTOR, GRAB_AREA_SELECTOR } from '../../common/constants';
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Determines the color of the grab line.
|
|
13
|
+
*
|
|
14
|
+
* Used on internal leaf node, so naming collisions won't matter.
|
|
15
|
+
*/
|
|
16
|
+
var varLineColor = '--ds-line';
|
|
17
|
+
var grabAreaStyles = css({
|
|
18
|
+
width: 24,
|
|
19
|
+
height: '100%',
|
|
20
|
+
padding: 0,
|
|
21
|
+
backgroundColor: 'transparent',
|
|
22
|
+
border: 0,
|
|
23
|
+
cursor: 'ew-resize',
|
|
24
|
+
'&::-moz-focus-inner': {
|
|
25
|
+
border: 0
|
|
26
|
+
},
|
|
27
|
+
':focus': {
|
|
28
|
+
outline: 0
|
|
29
|
+
},
|
|
30
|
+
':enabled': {
|
|
31
|
+
':hover': _defineProperty({}, varLineColor, "var(--ds-border-selected, ".concat(B100, ")")),
|
|
32
|
+
':active, :focus': _defineProperty({}, varLineColor, "var(--ds-border-selected, ".concat(B200, ")"))
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
var grabAreaCollapsedStyles = css({
|
|
36
|
+
padding: 0,
|
|
37
|
+
backgroundColor: 'transparent',
|
|
38
|
+
border: 0,
|
|
39
|
+
cursor: 'default'
|
|
40
|
+
});
|
|
41
|
+
var lineStyles = css({
|
|
42
|
+
display: 'block',
|
|
43
|
+
width: 2,
|
|
44
|
+
height: '100%',
|
|
45
|
+
backgroundColor: "var(".concat(varLineColor, ")"),
|
|
46
|
+
transition: 'background-color 200ms'
|
|
47
|
+
});
|
|
10
48
|
|
|
11
49
|
var grabAreaLineSelector = _defineProperty({}, GRAB_AREA_LINE_SELECTOR, true);
|
|
12
50
|
|
|
@@ -21,9 +59,9 @@ var GrabArea = function GrabArea(_ref) {
|
|
|
21
59
|
return jsx("button", _extends({}, grabAreaSelector, {
|
|
22
60
|
"data-testid": testId,
|
|
23
61
|
type: "button",
|
|
24
|
-
css:
|
|
62
|
+
css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles]
|
|
25
63
|
}, rest), jsx("span", _extends({
|
|
26
|
-
css:
|
|
64
|
+
css: lineStyles
|
|
27
65
|
}, grabAreaLineSelector)));
|
|
28
66
|
};
|
|
29
67
|
|
|
@@ -8,7 +8,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
|
|
9
9
|
/** @jsx jsx */
|
|
10
10
|
import { useCallback, useContext, useMemo, useRef, useState } from 'react';
|
|
11
|
-
import { jsx } from '@emotion/core';
|
|
11
|
+
import { css, jsx } from '@emotion/core';
|
|
12
12
|
import rafSchd from 'raf-schd';
|
|
13
13
|
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';
|
|
14
14
|
import { getLeftPanelWidth, getLeftSidebarPercentage } from '../../common/utils';
|
|
@@ -17,27 +17,30 @@ import { SidebarResizeContext } from '../../controllers/sidebar-resize-context';
|
|
|
17
17
|
|
|
18
18
|
import GrabArea from './grab-area';
|
|
19
19
|
import ResizeButton from './resize-button';
|
|
20
|
-
import
|
|
20
|
+
import Shadow from './shadow';
|
|
21
21
|
|
|
22
22
|
var cssSelector = _defineProperty({}, RESIZE_CONTROL_SELECTOR, true);
|
|
23
23
|
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
24
|
+
var resizeControlStyles = css({
|
|
25
|
+
position: 'absolute',
|
|
26
|
+
top: 0,
|
|
27
|
+
bottom: 0,
|
|
28
|
+
left: '100%',
|
|
29
|
+
outline: 'none'
|
|
30
|
+
});
|
|
31
|
+
var showResizeButtonStyles = css({
|
|
32
|
+
'--ds--resize-button--opacity': 1
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
var ResizeControl = function ResizeControl(_ref) {
|
|
36
|
+
var testId = _ref.testId,
|
|
37
|
+
overrides = _ref.overrides,
|
|
38
|
+
_ref$resizeButtonLabe = _ref.resizeButtonLabel,
|
|
39
|
+
resizeButtonLabel = _ref$resizeButtonLabe === void 0 ? '' : _ref$resizeButtonLabe,
|
|
40
|
+
_ref$resizeGrabAreaLa = _ref.resizeGrabAreaLabel,
|
|
41
|
+
resizeGrabAreaLabel = _ref$resizeGrabAreaLa === void 0 ? 'Resize' : _ref$resizeGrabAreaLa,
|
|
42
|
+
onResizeStart = _ref.onResizeStart,
|
|
43
|
+
onResizeEnd = _ref.onResizeEnd;
|
|
41
44
|
|
|
42
45
|
var _useContext = useContext(SidebarResizeContext),
|
|
43
46
|
expandLeftSidebar = _useContext.expandLeftSidebar,
|
|
@@ -247,7 +250,7 @@ var ResizeControl = function ResizeControl(_ref2) {
|
|
|
247
250
|
/* eslint-disable jsx-a11y/role-supports-aria-props */
|
|
248
251
|
|
|
249
252
|
return jsx("div", _extends({}, cssSelector, {
|
|
250
|
-
css:
|
|
253
|
+
css: [resizeControlStyles, (isGrabAreaFocused || isLeftSidebarCollapsed) && showResizeButtonStyles]
|
|
251
254
|
}), jsx(Shadow, {
|
|
252
255
|
testId: testId && "".concat(testId, "-shadow")
|
|
253
256
|
}), jsx(GrabArea, {
|
|
@@ -4,10 +4,63 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
var _excluded = ["isLeftSidebarCollapsed", "label", "testId"];
|
|
5
5
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
|
-
import { jsx } from '@emotion/core';
|
|
7
|
+
import { css, jsx } from '@emotion/core';
|
|
8
8
|
import ChevronRight from '@atlaskit/icon/glyph/chevron-right';
|
|
9
|
+
import { easeOut } from '@atlaskit/motion/curves';
|
|
10
|
+
import { mediumDurationMs, smallDurationMs } from '@atlaskit/motion/durations';
|
|
11
|
+
import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
|
|
9
12
|
import { RESIZE_BUTTON_SELECTOR } from '../../common/constants';
|
|
10
|
-
|
|
13
|
+
var increaseHitAreaStyles = css({
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
top: -8,
|
|
16
|
+
right: -12,
|
|
17
|
+
bottom: -8,
|
|
18
|
+
left: -8
|
|
19
|
+
});
|
|
20
|
+
var resizeIconButtonStyles = css({
|
|
21
|
+
width: 24,
|
|
22
|
+
height: 24,
|
|
23
|
+
padding: 0,
|
|
24
|
+
position: 'absolute',
|
|
25
|
+
top: 32,
|
|
26
|
+
left: 0,
|
|
27
|
+
backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
|
|
28
|
+
border: 0,
|
|
29
|
+
borderRadius: '50%',
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* TODO: https://product-fabric.atlassian.net/browse/DSP-3392
|
|
33
|
+
* This shadow needs further investigation,
|
|
34
|
+
* along with the hover and active background colors.
|
|
35
|
+
*/
|
|
36
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
37
|
+
boxShadow: "0 0 0 1px ".concat(N30A, ", 0 2px 4px 1px ").concat(N30A),
|
|
38
|
+
color: "var(--ds-text-subtle, ".concat(N200, ")"),
|
|
39
|
+
cursor: 'pointer',
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The fallback value of 0 ensures that the button is hidden by default,
|
|
43
|
+
* unless some parent (or the button itself) overrides it.
|
|
44
|
+
*/
|
|
45
|
+
opacity: "var(--ds--resize-button--opacity,0)",
|
|
46
|
+
outline: 0,
|
|
47
|
+
transform: 'translateX(-50%)',
|
|
48
|
+
transition: "\n background-color ".concat(smallDurationMs, "ms linear,\n color ").concat(smallDurationMs, "ms linear,\n opacity ").concat(mediumDurationMs, "ms ").concat(easeOut, "\n "),
|
|
49
|
+
':hover': {
|
|
50
|
+
backgroundColor: "var(--ds-background-selected-bold, ".concat(B100, ")"),
|
|
51
|
+
color: "var(--ds-text-inverse, ".concat(N0, ")"),
|
|
52
|
+
opacity: 1
|
|
53
|
+
},
|
|
54
|
+
':active, :focus': {
|
|
55
|
+
backgroundColor: "var(--ds-background-selected-bold-hovered, ".concat(B200, ")"),
|
|
56
|
+
color: "var(--ds-text-inverse, ".concat(N0, ")"),
|
|
57
|
+
opacity: 1
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
var resizeIconButtonExpandedStyles = css({
|
|
61
|
+
transform: 'rotate(180deg)',
|
|
62
|
+
transformOrigin: 7
|
|
63
|
+
});
|
|
11
64
|
|
|
12
65
|
var preventDefault = function preventDefault(event) {
|
|
13
66
|
return event.preventDefault();
|
|
@@ -26,7 +79,7 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
26
79
|
"aria-expanded": !isLeftSidebarCollapsed,
|
|
27
80
|
"aria-label": label,
|
|
28
81
|
type: "button",
|
|
29
|
-
css:
|
|
82
|
+
css: [resizeIconButtonStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
30
83
|
"data-testid": testId // Prevents focus staying attached to the button
|
|
31
84
|
// when pressed
|
|
32
85
|
,
|
|
@@ -34,7 +87,7 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
34
87
|
}, props), jsx(ChevronRight, {
|
|
35
88
|
label: ""
|
|
36
89
|
}), jsx("div", {
|
|
37
|
-
css:
|
|
90
|
+
css: increaseHitAreaStyles
|
|
38
91
|
}));
|
|
39
92
|
};
|
|
40
93
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { easeOut } from '@atlaskit/motion';
|
|
4
|
+
import { useIsSidebarDragging } from '../../common/hooks';
|
|
5
|
+
var colorStops = "\n rgba(0, 0, 0, 0.2) 0px,\n rgba(0, 0, 0, 0.2) 1px,\n rgba(0, 0, 0, 0.1) 1px,\n rgba(0, 0, 0, 0) 100%\n ";
|
|
6
|
+
var direction = 'to left';
|
|
7
|
+
var transitionDuration = '0.22s';
|
|
8
|
+
var shadowStyles = css({
|
|
9
|
+
width: 3,
|
|
10
|
+
position: 'absolute',
|
|
11
|
+
top: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
left: -1,
|
|
14
|
+
background: "var(--ds-border, ".concat("linear-gradient(".concat(direction, ", ").concat(colorStops, ")"), ")"),
|
|
15
|
+
opacity: 0.5,
|
|
16
|
+
pointerEvents: 'none',
|
|
17
|
+
transitionDuration: transitionDuration,
|
|
18
|
+
transitionProperty: 'left, opacity, width',
|
|
19
|
+
transitionTimingFunction: easeOut
|
|
20
|
+
});
|
|
21
|
+
var draggingStyles = css({
|
|
22
|
+
width: 6,
|
|
23
|
+
left: -6,
|
|
24
|
+
background: "var(--ds-background-neutral-subtle, ".concat("linear-gradient(".concat(direction, ", ").concat(colorStops, ")"), ")"),
|
|
25
|
+
opacity: 0.8
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
var Shadow = function Shadow(_ref) {
|
|
29
|
+
var testId = _ref.testId;
|
|
30
|
+
var isDragging = useIsSidebarDragging();
|
|
31
|
+
return jsx("div", {
|
|
32
|
+
"data-testid": testId,
|
|
33
|
+
css: [shadowStyles, isDragging && draggingStyles]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default Shadow;
|
|
@@ -6,10 +6,48 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
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) { _defineProperty(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; }
|
|
7
7
|
|
|
8
8
|
/** @jsx jsx */
|
|
9
|
-
import { jsx } from '@emotion/core';
|
|
9
|
+
import { css, jsx } from '@emotion/core';
|
|
10
|
+
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
11
|
+
import { N30A, N60A } from '@atlaskit/theme/colors';
|
|
10
12
|
import { PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
|
|
11
13
|
import { useSkipLinks } from '../../controllers';
|
|
12
|
-
|
|
14
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
15
|
+
var prefersReducedMotionStyles = css(prefersReducedMotion());
|
|
16
|
+
var skipLinkStyles = css({
|
|
17
|
+
margin: 10,
|
|
18
|
+
padding: '0.8rem 1rem',
|
|
19
|
+
position: 'fixed',
|
|
20
|
+
zIndex: -1,
|
|
21
|
+
left: -999999,
|
|
22
|
+
background: "var(--ds-surface-overlay, white)",
|
|
23
|
+
border: 'none',
|
|
24
|
+
borderRadius: 3,
|
|
25
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 0 1px ".concat(N30A, ", 0 2px 10px ").concat(N30A, ", 0 0 20px -4px ").concat(N60A), ")"),
|
|
26
|
+
opacity: 0,
|
|
27
|
+
|
|
28
|
+
/* Do the transform when focused */
|
|
29
|
+
transform: 'translateY(-50%)',
|
|
30
|
+
transition: "transform 0.3s ".concat(easeOut),
|
|
31
|
+
':focus-within': {
|
|
32
|
+
/**
|
|
33
|
+
* Max z-index is 2147483647. Skip links always be on top,
|
|
34
|
+
* but giving a few digits extra space just in case there's a future need.
|
|
35
|
+
*/
|
|
36
|
+
zIndex: 2147483640,
|
|
37
|
+
left: 0,
|
|
38
|
+
opacity: 1,
|
|
39
|
+
transform: 'translateY(0%)'
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
var skipLinkListStyles = css({
|
|
43
|
+
marginTop: 4,
|
|
44
|
+
paddingLeft: 0,
|
|
45
|
+
listStylePosition: 'outside',
|
|
46
|
+
listStyleType: 'none'
|
|
47
|
+
});
|
|
48
|
+
var skipLinkListItemStyles = css({
|
|
49
|
+
marginTop: 0
|
|
50
|
+
});
|
|
13
51
|
|
|
14
52
|
var assignIndex = function assignIndex(num, arr) {
|
|
15
53
|
if (!arr.includes(num)) {
|
|
@@ -76,9 +114,11 @@ export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
|
|
|
76
114
|
return jsx("div", {
|
|
77
115
|
onFocus: attachEscHandler,
|
|
78
116
|
onBlur: removeEscHandler,
|
|
79
|
-
css: skipLinkStyles,
|
|
117
|
+
css: [skipLinkStyles, prefersReducedMotionStyles],
|
|
80
118
|
"data-skip-link-wrapper": true
|
|
81
|
-
}, jsx("h5", null, skipLinksLabel), jsx("ol",
|
|
119
|
+
}, jsx("h5", null, skipLinksLabel), jsx("ol", {
|
|
120
|
+
css: skipLinkListStyles
|
|
121
|
+
}, sortSkipLinks(skipLinksData).map(function (_ref2) {
|
|
82
122
|
var id = _ref2.id,
|
|
83
123
|
skipLinkTitle = _ref2.skipLinkTitle;
|
|
84
124
|
return jsx(SkipLink, {
|
|
@@ -130,7 +170,9 @@ export var SkipLink = function SkipLink(_ref3) {
|
|
|
130
170
|
children = _ref3.children,
|
|
131
171
|
isFocusable = _ref3.isFocusable,
|
|
132
172
|
title = _ref3.title;
|
|
133
|
-
return jsx("li",
|
|
173
|
+
return jsx("li", {
|
|
174
|
+
css: skipLinkListItemStyles
|
|
175
|
+
}, jsx("a", {
|
|
134
176
|
tabIndex: isFocusable ? 0 : -1,
|
|
135
177
|
href: href,
|
|
136
178
|
onClick: focusTargetRef(href),
|
|
@@ -3,12 +3,23 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
3
3
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
|
-
import { jsx } from '@emotion/core';
|
|
7
|
-
import { DEFAULT_BANNER_HEIGHT, VAR_BANNER_HEIGHT } from '../../common/constants';
|
|
6
|
+
import { css, jsx } from '@emotion/core';
|
|
7
|
+
import { BANNER, BANNER_HEIGHT, DEFAULT_BANNER_HEIGHT, LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, VAR_BANNER_HEIGHT } from '../../common/constants';
|
|
8
8
|
import { getPageLayoutSlotSelector, resolveDimension } from '../../common/utils';
|
|
9
9
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
10
|
+
import SlotFocusRing from './internal/slot-focus-ring';
|
|
10
11
|
import SlotDimensions from './slot-dimensions';
|
|
11
|
-
|
|
12
|
+
var bannerStyles = css({
|
|
13
|
+
height: BANNER_HEIGHT,
|
|
14
|
+
gridArea: BANNER
|
|
15
|
+
});
|
|
16
|
+
var bannerFixedStyles = css({
|
|
17
|
+
position: 'fixed',
|
|
18
|
+
zIndex: 2,
|
|
19
|
+
top: 0,
|
|
20
|
+
right: RIGHT_PANEL_WIDTH,
|
|
21
|
+
left: LEFT_PANEL_WIDTH
|
|
22
|
+
});
|
|
12
23
|
|
|
13
24
|
var Banner = function Banner(props) {
|
|
14
25
|
var children = props.children,
|
|
@@ -25,17 +36,21 @@ var Banner = function Banner(props) {
|
|
|
25
36
|
publishGridState(_defineProperty({}, VAR_BANNER_HEIGHT, bannerHeight));
|
|
26
37
|
return function () {
|
|
27
38
|
publishGridState(_defineProperty({}, VAR_BANNER_HEIGHT, 0));
|
|
28
|
-
};
|
|
39
|
+
};
|
|
29
40
|
}, [bannerHeight]);
|
|
30
41
|
useSkipLink(id, skipLinkTitle);
|
|
31
|
-
return jsx(
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
return jsx(SlotFocusRing, null, function (_ref) {
|
|
43
|
+
var className = _ref.className;
|
|
44
|
+
return jsx("div", _extends({
|
|
45
|
+
css: [bannerStyles, isFixed && bannerFixedStyles],
|
|
46
|
+
className: className,
|
|
47
|
+
"data-testid": testId,
|
|
48
|
+
id: id
|
|
49
|
+
}, getPageLayoutSlotSelector('banner')), jsx(SlotDimensions, {
|
|
50
|
+
variableName: VAR_BANNER_HEIGHT,
|
|
51
|
+
value: bannerHeight
|
|
52
|
+
}), children);
|
|
53
|
+
});
|
|
39
54
|
};
|
|
40
55
|
|
|
41
56
|
export default Banner;
|