@atlaskit/page-layout 1.1.0 → 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 +14 -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/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 +8 -5
- 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
|
@@ -3,12 +3,49 @@ 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_RIGHT_SIDEBAR_WIDTH, VAR_RIGHT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
6
|
+
import { css, jsx } from '@emotion/core';
|
|
7
|
+
import { BANNER_HEIGHT, DEFAULT_RIGHT_SIDEBAR_WIDTH, RIGHT_PANEL_WIDTH, RIGHT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, VAR_RIGHT_SIDEBAR_WIDTH } 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
|
+
/**
|
|
13
|
+
* This inner wrapper is required to allow the sidebar to be `position: fixed`.
|
|
14
|
+
*
|
|
15
|
+
* If we were to apply `position: fixed` to the outer wrapper, it will be popped
|
|
16
|
+
* out of its flex container and Main would stretch to occupy all the space.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
var fixedInnerStyles = css({
|
|
20
|
+
/**
|
|
21
|
+
* This width on the inner wrapper is required when it is using fixed
|
|
22
|
+
* positioning. Otherwise its width is slightly off.
|
|
23
|
+
*/
|
|
24
|
+
width: RIGHT_SIDEBAR_WIDTH,
|
|
25
|
+
position: 'fixed',
|
|
26
|
+
top: "calc(".concat(BANNER_HEIGHT, " + ").concat(TOP_NAVIGATION_HEIGHT, ")"),
|
|
27
|
+
right: "calc(".concat(RIGHT_PANEL_WIDTH, ")"),
|
|
28
|
+
bottom: 0
|
|
29
|
+
});
|
|
30
|
+
var staticInnerStyles = css({
|
|
31
|
+
height: '100%'
|
|
32
|
+
});
|
|
33
|
+
var outerStyles = css({
|
|
34
|
+
width: RIGHT_SIDEBAR_WIDTH
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* In fixed mode this element's child is taken out of the document flow.
|
|
38
|
+
* It doesn't take up the width as expected,
|
|
39
|
+
* so the pseudo element forces it to take up the necessary width.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
var fixedOuterStyles = css({
|
|
43
|
+
'&::after': {
|
|
44
|
+
display: 'inline-block',
|
|
45
|
+
width: RIGHT_SIDEBAR_WIDTH,
|
|
46
|
+
content: "''"
|
|
47
|
+
}
|
|
48
|
+
});
|
|
12
49
|
|
|
13
50
|
var RightSidebar = function RightSidebar(props) {
|
|
14
51
|
var children = props.children,
|
|
@@ -24,19 +61,25 @@ var RightSidebar = function RightSidebar(props) {
|
|
|
24
61
|
publishGridState(_defineProperty({}, VAR_RIGHT_SIDEBAR_WIDTH, rightSidebarWidth));
|
|
25
62
|
return function () {
|
|
26
63
|
publishGridState(_defineProperty({}, VAR_RIGHT_SIDEBAR_WIDTH, 0));
|
|
27
|
-
};
|
|
64
|
+
};
|
|
28
65
|
}, [rightSidebarWidth, id]);
|
|
29
66
|
useSkipLink(id, skipLinkTitle);
|
|
30
|
-
return jsx(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
67
|
+
return jsx(SlotFocusRing, {
|
|
68
|
+
isSidebar: true
|
|
69
|
+
}, function (_ref) {
|
|
70
|
+
var className = _ref.className;
|
|
71
|
+
return jsx("div", _extends({
|
|
72
|
+
"data-testid": testId,
|
|
73
|
+
css: [outerStyles, isFixed && fixedOuterStyles],
|
|
74
|
+
className: className,
|
|
75
|
+
id: id
|
|
76
|
+
}, getPageLayoutSlotSelector('right-sidebar')), jsx(SlotDimensions, {
|
|
77
|
+
variableName: VAR_RIGHT_SIDEBAR_WIDTH,
|
|
78
|
+
value: rightSidebarWidth
|
|
79
|
+
}), jsx("div", {
|
|
80
|
+
css: [isFixed && fixedInnerStyles, !isFixed && staticInnerStyles]
|
|
81
|
+
}, children));
|
|
82
|
+
});
|
|
40
83
|
};
|
|
41
84
|
|
|
42
85
|
export default RightSidebar;
|
|
@@ -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_TOP_NAVIGATION_HEIGHT, VAR_TOP_NAVIGATION_HEIGHT } from '../../common/constants';
|
|
6
|
+
import { css, jsx } from '@emotion/core';
|
|
7
|
+
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';
|
|
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 topNavigationStyles = css({
|
|
13
|
+
height: TOP_NAVIGATION_HEIGHT,
|
|
14
|
+
gridArea: TOP_NAVIGATION
|
|
15
|
+
});
|
|
16
|
+
var fixedStyles = css({
|
|
17
|
+
position: 'fixed',
|
|
18
|
+
zIndex: 2,
|
|
19
|
+
top: BANNER_HEIGHT,
|
|
20
|
+
right: RIGHT_PANEL_WIDTH,
|
|
21
|
+
left: LEFT_PANEL_WIDTH
|
|
22
|
+
});
|
|
12
23
|
|
|
13
24
|
var TopNavigation = function TopNavigation(props) {
|
|
14
25
|
var children = props.children,
|
|
@@ -25,17 +36,21 @@ var TopNavigation = function TopNavigation(props) {
|
|
|
25
36
|
publishGridState(_defineProperty({}, VAR_TOP_NAVIGATION_HEIGHT, topNavigationHeight));
|
|
26
37
|
return function () {
|
|
27
38
|
publishGridState(_defineProperty({}, VAR_TOP_NAVIGATION_HEIGHT, 0));
|
|
28
|
-
};
|
|
39
|
+
};
|
|
29
40
|
}, [topNavigationHeight]);
|
|
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: [topNavigationStyles, isFixed && fixedStyles],
|
|
46
|
+
className: className,
|
|
47
|
+
"data-testid": testId,
|
|
48
|
+
id: id
|
|
49
|
+
}, getPageLayoutSlotSelector('top-navigation')), jsx(SlotDimensions, {
|
|
50
|
+
variableName: VAR_TOP_NAVIGATION_HEIGHT,
|
|
51
|
+
value: topNavigationHeight
|
|
52
|
+
}), children);
|
|
53
|
+
});
|
|
39
54
|
};
|
|
40
55
|
|
|
41
56
|
export default TopNavigation;
|
|
@@ -16,7 +16,8 @@ var leftSidebarState = {
|
|
|
16
16
|
isLeftSidebarCollapsed: false,
|
|
17
17
|
leftSidebarWidth: 0,
|
|
18
18
|
lastLeftSidebarWidth: 0,
|
|
19
|
-
flyoutLockCount: 0
|
|
19
|
+
flyoutLockCount: 0,
|
|
20
|
+
isFixed: true
|
|
20
21
|
};
|
|
21
22
|
export var SidebarResizeContext = /*#__PURE__*/createContext({
|
|
22
23
|
isLeftSidebarCollapsed: false,
|
|
@@ -26,7 +26,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
|
|
|
26
26
|
isLeftSidebarCollapsed: false,
|
|
27
27
|
leftSidebarWidth: 0,
|
|
28
28
|
lastLeftSidebarWidth: 0,
|
|
29
|
-
flyoutLockCount: 0
|
|
29
|
+
flyoutLockCount: 0,
|
|
30
|
+
isFixed: true
|
|
30
31
|
}),
|
|
31
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
33
|
leftSidebarState = _useState2[0],
|
|
@@ -54,7 +55,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
|
|
|
54
55
|
var expandLeftSidebar = useCallback(function () {
|
|
55
56
|
var lastLeftSidebarWidth = leftSidebarState.lastLeftSidebarWidth,
|
|
56
57
|
isResizing = leftSidebarState.isResizing,
|
|
57
|
-
flyoutLockCount = leftSidebarState.flyoutLockCount
|
|
58
|
+
flyoutLockCount = leftSidebarState.flyoutLockCount,
|
|
59
|
+
isFixed = leftSidebarState.isFixed;
|
|
58
60
|
|
|
59
61
|
if (isResizing) {
|
|
60
62
|
return;
|
|
@@ -67,7 +69,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
|
|
|
67
69
|
leftSidebarWidth: width,
|
|
68
70
|
lastLeftSidebarWidth: lastLeftSidebarWidth,
|
|
69
71
|
isResizing: isResizing,
|
|
70
|
-
flyoutLockCount: flyoutLockCount
|
|
72
|
+
flyoutLockCount: flyoutLockCount,
|
|
73
|
+
isFixed: isFixed
|
|
71
74
|
};
|
|
72
75
|
setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
|
|
73
76
|
|
|
@@ -78,7 +81,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
|
|
|
78
81
|
var collapseLeftSidebar = useCallback(function (event, collapseWithoutTransition) {
|
|
79
82
|
var leftSidebarWidth = leftSidebarState.leftSidebarWidth,
|
|
80
83
|
isResizing = leftSidebarState.isResizing,
|
|
81
|
-
flyoutLockCount = leftSidebarState.flyoutLockCount
|
|
84
|
+
flyoutLockCount = leftSidebarState.flyoutLockCount,
|
|
85
|
+
isFixed = leftSidebarState.isFixed;
|
|
82
86
|
|
|
83
87
|
if (isResizing) {
|
|
84
88
|
return;
|
|
@@ -93,7 +97,8 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
|
|
|
93
97
|
leftSidebarWidth: COLLAPSED_LEFT_SIDEBAR_WIDTH,
|
|
94
98
|
lastLeftSidebarWidth: leftSidebarWidth,
|
|
95
99
|
isResizing: isResizing,
|
|
96
|
-
flyoutLockCount: flyoutLockCount
|
|
100
|
+
flyoutLockCount: flyoutLockCount,
|
|
101
|
+
isFixed: isFixed
|
|
97
102
|
};
|
|
98
103
|
setLeftSidebarState(updatedLeftSidebarState); // onTransitionEnd isn't triggered when a user prefers reduced motion
|
|
99
104
|
|
package/dist/esm/version.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
declare type LeftSidebarInnerProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isFixed?: boolean;
|
|
6
|
+
isFlyoutOpen?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const LeftSidebarInner: ({ children, isFixed, isFlyoutOpen, }: LeftSidebarInnerProps) => JSX.Element;
|
|
9
|
+
export default LeftSidebarInner;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { MouseEventHandler, ReactNode } from 'react';
|
|
3
|
+
declare type LeftSidebarOuterProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isFixed?: boolean;
|
|
6
|
+
isFlyoutOpen?: boolean;
|
|
7
|
+
testId?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
onMouseOver?: MouseEventHandler;
|
|
10
|
+
onMouseLeave?: MouseEventHandler;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: import("react").ForwardRefExoticComponent<LeftSidebarOuterProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
declare type ResizableChildrenWrapperProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
isFlyoutOpen?: boolean;
|
|
6
|
+
isLeftSidebarCollapsed?: boolean;
|
|
7
|
+
hasCollapsedState?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const ResizableChildrenWrapper: ({ children, isLeftSidebarCollapsed, hasCollapsedState, isFlyoutOpen, }: ResizableChildrenWrapperProps) => JSX.Element;
|
|
10
|
+
export default ResizableChildrenWrapper;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
declare type SlotFocusRingProps = {
|
|
4
|
+
children: (props: {
|
|
5
|
+
className: string;
|
|
6
|
+
}) => ReactNode;
|
|
7
|
+
isSidebar?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* We don't use `@atlaskit/focus-ring` here,
|
|
11
|
+
* because we need inset focus styles and:
|
|
12
|
+
*
|
|
13
|
+
* 1. If we set them directly to the layout element,
|
|
14
|
+
* then any child element's background will cover the shadow.
|
|
15
|
+
* 2. We cannot wrap `children` in `FocusRing`,
|
|
16
|
+
* because there's no guarantee the passed child takes `className`.
|
|
17
|
+
*/
|
|
18
|
+
declare const SlotFocusRing: ({ children, isSidebar }: SlotFocusRingProps) => JSX.Element;
|
|
19
|
+
export default SlotFocusRing;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/page-layout",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "A collection of components which let you compose an application's page layout",
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "A collection of components which let you compose an application's page layout.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
7
7
|
},
|
|
@@ -19,14 +19,15 @@
|
|
|
19
19
|
"deprecatedAutoEntryPoints": true,
|
|
20
20
|
"releaseModel": "scheduled",
|
|
21
21
|
"website": {
|
|
22
|
-
"name": "Page
|
|
22
|
+
"name": "Page layout"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
|
+
"homepage": "https://atlassian.design/components/page-layout/",
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@atlaskit/icon": "^21.10.0",
|
|
27
28
|
"@atlaskit/motion": "^1.0.0",
|
|
28
29
|
"@atlaskit/theme": "^12.1.0",
|
|
29
|
-
"@atlaskit/tokens": "^0.
|
|
30
|
+
"@atlaskit/tokens": "^0.8.0",
|
|
30
31
|
"@babel/runtime": "^7.0.0",
|
|
31
32
|
"@emotion/core": "^10.0.9",
|
|
32
33
|
"raf-schd": "^4.0.3"
|
|
@@ -57,6 +58,7 @@
|
|
|
57
58
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
58
59
|
"@testing-library/dom": "^7.7.3",
|
|
59
60
|
"@testing-library/react": "^8.0.1",
|
|
61
|
+
"@testing-library/react-hooks": "^1.0.4",
|
|
60
62
|
"@types/raf-schd": "^4.0.1",
|
|
61
63
|
"jest-emotion": "^10.0.32",
|
|
62
64
|
"raf-stub": "^2.0.1",
|
|
@@ -85,7 +87,8 @@
|
|
|
85
87
|
],
|
|
86
88
|
"deprecation": "no-deprecated-imports",
|
|
87
89
|
"styling": [
|
|
88
|
-
"emotion"
|
|
90
|
+
"emotion",
|
|
91
|
+
"static"
|
|
89
92
|
]
|
|
90
93
|
}
|
|
91
94
|
},
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.shadowCSS = exports.resizeIconButtonCSS = exports.resizeControlCSS = exports.lineCSS = exports.increaseHitArea = exports.grabAreaCSS = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _motion = require("@atlaskit/motion");
|
|
13
|
-
|
|
14
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
15
|
-
|
|
16
|
-
var _constants = require("../../common/constants");
|
|
17
|
-
|
|
18
|
-
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
|
-
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
|
-
var resizeControlCSS = function resizeControlCSS(setIsGrabAreaFocused, isLeftSidebarCollapsed) {
|
|
23
|
-
var _$concat, _ref;
|
|
24
|
-
|
|
25
|
-
return _ref = {
|
|
26
|
-
left: '100%',
|
|
27
|
-
top: 0,
|
|
28
|
-
bottom: 0,
|
|
29
|
-
position: 'absolute',
|
|
30
|
-
outline: 'none'
|
|
31
|
-
}, (0, _defineProperty2.default)(_ref, "[".concat(_constants.GRAB_AREA_SELECTOR, "]:enabled"), (_$concat = {}, (0, _defineProperty2.default)(_$concat, "&:hover [".concat(_constants.GRAB_AREA_LINE_SELECTOR, "]"), {
|
|
32
|
-
backgroundColor: "var(--ds-background-brand-bold-hovered, ".concat(_colors.B100, ")")
|
|
33
|
-
}), (0, _defineProperty2.default)(_$concat, "&:active [".concat(_constants.GRAB_AREA_LINE_SELECTOR, "] , &:focus [").concat(_constants.GRAB_AREA_LINE_SELECTOR, "]"), {
|
|
34
|
-
backgroundColor: "var(--ds-background-brand-bold-pressed, ".concat(_colors.B200, ")")
|
|
35
|
-
}), (0, _defineProperty2.default)(_$concat, "&:hover [".concat(_constants.RESIZE_BUTTON_SELECTOR, "]:not(:focus):not(:hover)"), {
|
|
36
|
-
backgroundColor: "var(--ds-background-brand-bold-hovered, ".concat(_colors.B100, ")")
|
|
37
|
-
}), (0, _defineProperty2.default)(_$concat, "&:hover [".concat(_constants.RESIZE_BUTTON_SELECTOR, "]"), {
|
|
38
|
-
opacity: 1
|
|
39
|
-
}), _$concat)), (0, _defineProperty2.default)(_ref, "[".concat(_constants.RESIZE_BUTTON_SELECTOR, "]"), {
|
|
40
|
-
opacity: setIsGrabAreaFocused || isLeftSidebarCollapsed ? 1 : 0
|
|
41
|
-
}), _ref;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
exports.resizeControlCSS = resizeControlCSS;
|
|
45
|
-
|
|
46
|
-
var resizeIconButtonCSS = function resizeIconButtonCSS(isCollapsed) {
|
|
47
|
-
return _objectSpread(_objectSpread({
|
|
48
|
-
backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
49
|
-
position: 'absolute',
|
|
50
|
-
top: 32,
|
|
51
|
-
left: 0,
|
|
52
|
-
transform: 'translateX(-50%)',
|
|
53
|
-
border: 0,
|
|
54
|
-
borderRadius: '50%',
|
|
55
|
-
// TODO https://product-fabric.atlassian.net/browse/DSP-3392
|
|
56
|
-
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
57
|
-
boxShadow: "0 0 0 1px ".concat(_colors.N30A, ", 0 2px 4px 1px ").concat(_colors.N30A),
|
|
58
|
-
color: "var(--ds-text-subtle, ".concat(_colors.N200, ")"),
|
|
59
|
-
cursor: 'pointer',
|
|
60
|
-
height: 24,
|
|
61
|
-
opacity: 0,
|
|
62
|
-
outline: 0,
|
|
63
|
-
padding: 0,
|
|
64
|
-
transition: "\n background-color ".concat(_motion.smallDurationMs, "ms linear,\n color ").concat(_motion.smallDurationMs, "ms linear,\n opacity ").concat(_motion.mediumDurationMs, "ms ").concat(_motion.easeOut, "\n "),
|
|
65
|
-
width: 24,
|
|
66
|
-
':hover': {
|
|
67
|
-
backgroundColor: "var(--ds-background-brand-hovered, ".concat(_colors.B100, ")"),
|
|
68
|
-
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")"),
|
|
69
|
-
opacity: 1
|
|
70
|
-
},
|
|
71
|
-
':active': {
|
|
72
|
-
backgroundColor: "var(--ds-background-brand-pressed, ".concat(_colors.B200, ")"),
|
|
73
|
-
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")"),
|
|
74
|
-
opacity: 1
|
|
75
|
-
},
|
|
76
|
-
':focus': {
|
|
77
|
-
backgroundColor: "var(--ds-background-brand-pressed, ".concat(_colors.B200, ")"),
|
|
78
|
-
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")"),
|
|
79
|
-
opacity: 1
|
|
80
|
-
}
|
|
81
|
-
}, !isCollapsed && {
|
|
82
|
-
transform: 'rotate(180deg)',
|
|
83
|
-
transformOrigin: 7,
|
|
84
|
-
opacity: 1
|
|
85
|
-
}), {}, (0, _defineProperty2.default)({}, "[".concat(_constants.IS_SIDEBAR_DRAGGING, "] &"), {
|
|
86
|
-
opacity: 1
|
|
87
|
-
}));
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
exports.resizeIconButtonCSS = resizeIconButtonCSS;
|
|
91
|
-
|
|
92
|
-
var grabAreaCSS = function grabAreaCSS(isLeftSidebarCollapsed) {
|
|
93
|
-
var _objectSpread3;
|
|
94
|
-
|
|
95
|
-
return _objectSpread((_objectSpread3 = {
|
|
96
|
-
cursor: 'ew-resize',
|
|
97
|
-
height: '100%',
|
|
98
|
-
width: '24px',
|
|
99
|
-
padding: 0,
|
|
100
|
-
border: 0,
|
|
101
|
-
backgroundColor: 'transparent'
|
|
102
|
-
}, (0, _defineProperty2.default)(_objectSpread3, '&::-moz-focus-inner', {
|
|
103
|
-
border: 0
|
|
104
|
-
}), (0, _defineProperty2.default)(_objectSpread3, ':focus', {
|
|
105
|
-
outline: 0
|
|
106
|
-
}), _objectSpread3), isLeftSidebarCollapsed && {
|
|
107
|
-
padding: 0,
|
|
108
|
-
border: 0,
|
|
109
|
-
backgroundColor: 'transparent',
|
|
110
|
-
cursor: 'default'
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
exports.grabAreaCSS = grabAreaCSS;
|
|
115
|
-
|
|
116
|
-
var lineCSS = function lineCSS(isLeftSidebarCollapsed) {
|
|
117
|
-
return _objectSpread({
|
|
118
|
-
display: 'block',
|
|
119
|
-
height: '100%',
|
|
120
|
-
transition: 'background-color 200ms',
|
|
121
|
-
width: 2
|
|
122
|
-
}, isLeftSidebarCollapsed && {
|
|
123
|
-
'&&': {
|
|
124
|
-
backgroundColor: 'transparent'
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
exports.lineCSS = lineCSS;
|
|
130
|
-
var increaseHitArea = {
|
|
131
|
-
position: 'absolute',
|
|
132
|
-
left: -8,
|
|
133
|
-
right: -12,
|
|
134
|
-
bottom: -8,
|
|
135
|
-
top: -8
|
|
136
|
-
};
|
|
137
|
-
exports.increaseHitArea = increaseHitArea;
|
|
138
|
-
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 ";
|
|
139
|
-
var direction = 'to left';
|
|
140
|
-
var transitionDuration = '0.22s';
|
|
141
|
-
var shadowCSS = (0, _defineProperty2.default)({
|
|
142
|
-
background: "linear-gradient(".concat(direction, ", ").concat(colorStops, ")"),
|
|
143
|
-
bottom: 0,
|
|
144
|
-
top: 0,
|
|
145
|
-
left: -1,
|
|
146
|
-
opacity: 0.5,
|
|
147
|
-
pointerEvents: 'none',
|
|
148
|
-
position: 'absolute',
|
|
149
|
-
transitionDuration: transitionDuration,
|
|
150
|
-
transitionProperty: 'left, opacity, width',
|
|
151
|
-
transitionTimingFunction: _motion.easeOut,
|
|
152
|
-
width: 3
|
|
153
|
-
}, "[".concat(_constants.IS_SIDEBAR_DRAGGING, "] &"), {
|
|
154
|
-
opacity: 0.8,
|
|
155
|
-
width: 6,
|
|
156
|
-
left: -6
|
|
157
|
-
});
|
|
158
|
-
exports.shadowCSS = shadowCSS;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.skipLinkStyles = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _motion = require("@atlaskit/motion");
|
|
13
|
-
|
|
14
|
-
var _colors = require("@atlaskit/theme/colors");
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
var skipLinkStyles = _objectSpread(_objectSpread({
|
|
21
|
-
zIndex: -1,
|
|
22
|
-
left: -999999,
|
|
23
|
-
position: 'fixed',
|
|
24
|
-
opacity: 0,
|
|
25
|
-
background: "var(--ds-surface-overlay, white)",
|
|
26
|
-
border: 'none',
|
|
27
|
-
padding: '0.8rem 1rem',
|
|
28
|
-
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 0 1px ".concat(_colors.N30A, ", 0 2px 10px ").concat(_colors.N30A, ", 0 0 20px -4px ").concat(_colors.N60A), ")"),
|
|
29
|
-
borderRadius: '3px',
|
|
30
|
-
margin: 10
|
|
31
|
-
}, (0, _motion.prefersReducedMotion)()), {}, {
|
|
32
|
-
transform: 'translateY(-50%)',
|
|
33
|
-
transition: "transform 0.3s ".concat(_motion.easeOut),
|
|
34
|
-
':focus-within': {
|
|
35
|
-
transform: 'translateY(0%)',
|
|
36
|
-
opacity: 1,
|
|
37
|
-
left: 0,
|
|
38
|
-
|
|
39
|
-
/* Max z-index is 2147483647. Skip links always be on top,
|
|
40
|
-
but giving a few digits extra space just in case there's
|
|
41
|
-
a future need. */
|
|
42
|
-
zIndex: 2147483640
|
|
43
|
-
},
|
|
44
|
-
'& > span': {
|
|
45
|
-
fontWeight: 'bold'
|
|
46
|
-
},
|
|
47
|
-
'> ol': {
|
|
48
|
-
listStyleType: 'none',
|
|
49
|
-
listStylePosition: 'outside',
|
|
50
|
-
paddingLeft: 0,
|
|
51
|
-
marginTop: '4px',
|
|
52
|
-
'> li': {
|
|
53
|
-
marginTop: 0
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
exports.skipLinkStyles = skipLinkStyles;
|