@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/page-layout
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`21534d3647e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/21534d3647e) - [ux] Update theme colours and remove shadow from resize bar
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`ac9343c3ed4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac9343c3ed4) - Replaces usage of deprecated design tokens. No visual or functional changes
|
|
12
|
+
- [`ad0e912661a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad0e912661a) - Styles have been rewritten to be static, in preparation for compiled adoption.
|
|
13
|
+
- [`8940901481d`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8940901481d) - [ux] The width of right sidebars with fixed positioning (`<RightSidebar isFixed />`) has been fixed. Previously they had automatic sizing, which led to inconsistencies in appearance between static and fixed positioning.
|
|
14
|
+
- [`62edf20ab1e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/62edf20ab1e) - Migrates all usage of brand tokens to either selected or information tokens. This change is purely for semantic reasons, there are no visual or behavioural changes.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 1.1.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ yarn add @atlaskit/page-layout
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
Detailed docs and example usage can be found [here](https://
|
|
13
|
+
Detailed docs and example usage can be found [here](https://atlassian.design/components/page-layout/).
|
|
14
14
|
|
|
15
|
-
To add side navigation, use [@atlaskit/side-navigation](https://
|
|
16
|
-
To add top/global navigation, use [@atlaskit/atlassian-navigation](https://
|
|
15
|
+
To add side navigation, use [@atlaskit/side-navigation](https://atlassian.design/components/side-navigation/)
|
|
16
|
+
To add top/global navigation, use [@atlaskit/atlassian-navigation](https://atlassian.design/components/atlassian-navigation/)
|
|
@@ -15,6 +15,15 @@ import {
|
|
|
15
15
|
import JiraIntegrationExample from './product-integration/AtlassianNavigation';
|
|
16
16
|
import Sidebar from './product-integration/SideNavigation';
|
|
17
17
|
|
|
18
|
+
const wrapperStyles = css({
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
height: '100%',
|
|
21
|
+
padding: 8,
|
|
22
|
+
backgroundColor: token('color.background.neutral.subtle', 'white'),
|
|
23
|
+
outlineOffset: -4,
|
|
24
|
+
overflowY: 'auto',
|
|
25
|
+
});
|
|
26
|
+
|
|
18
27
|
const Wrapper = ({
|
|
19
28
|
borderColor,
|
|
20
29
|
children,
|
|
@@ -27,21 +36,27 @@ const Wrapper = ({
|
|
|
27
36
|
noHorizontalScrollbar?: boolean;
|
|
28
37
|
}) => (
|
|
29
38
|
<div
|
|
30
|
-
css={
|
|
39
|
+
css={wrapperStyles}
|
|
40
|
+
style={{
|
|
31
41
|
outline: noOutline ? 'none' : `2px dashed ${borderColor}`,
|
|
32
|
-
outlineOffset: -4,
|
|
33
|
-
padding: 8,
|
|
34
|
-
height: '100%',
|
|
35
|
-
boxSizing: 'border-box',
|
|
36
|
-
overflowY: 'auto',
|
|
37
42
|
overflowX: noHorizontalScrollbar ? 'hidden' : 'auto',
|
|
38
|
-
backgroundColor: token('color.background.neutral.subtle', 'white'),
|
|
39
43
|
}}
|
|
40
44
|
>
|
|
41
45
|
{children}
|
|
42
46
|
</div>
|
|
43
47
|
);
|
|
44
48
|
|
|
49
|
+
const sidebarWrapperStyles = css({
|
|
50
|
+
height: '100%',
|
|
51
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
52
|
+
nav: {
|
|
53
|
+
minWidth: 20,
|
|
54
|
+
overflowX: 'hidden',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const slotLabelStyles = css({ textAlign: 'center' });
|
|
59
|
+
|
|
45
60
|
const BasicGrid = () => {
|
|
46
61
|
return (
|
|
47
62
|
<PageLayout>
|
|
@@ -50,21 +65,13 @@ const BasicGrid = () => {
|
|
|
50
65
|
</TopNavigation>
|
|
51
66
|
<Content testId="content">
|
|
52
67
|
<LeftSidebar testId="left-sidebar" isFixed={false} width={450}>
|
|
53
|
-
<div
|
|
54
|
-
css={css`
|
|
55
|
-
height: 100%;
|
|
56
|
-
& nav {
|
|
57
|
-
min-width: 20px;
|
|
58
|
-
overflow-x: hidden;
|
|
59
|
-
}
|
|
60
|
-
`}
|
|
61
|
-
>
|
|
68
|
+
<div css={sidebarWrapperStyles}>
|
|
62
69
|
<Sidebar />
|
|
63
70
|
</div>
|
|
64
71
|
</LeftSidebar>
|
|
65
72
|
<Main>
|
|
66
73
|
<Wrapper noOutline borderColor={token('color.border', 'black')}>
|
|
67
|
-
<h3 css={
|
|
74
|
+
<h3 css={slotLabelStyles}>Main</h3>
|
|
68
75
|
</Wrapper>
|
|
69
76
|
</Main>
|
|
70
77
|
</Content>
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
|
|
4
|
-
import { jsx } from '@emotion/core';
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
5
|
|
|
6
6
|
import { Notifications } from '@atlaskit/atlassian-navigation';
|
|
7
7
|
import { Notifications as NotificationsIframe } from '@atlaskit/atlassian-notifications';
|
|
8
8
|
import { NotificationIndicator } from '@atlaskit/notification-indicator';
|
|
9
9
|
import { NotificationLogClient } from '@atlaskit/notification-log-client';
|
|
10
10
|
import Popup from '@atlaskit/popup';
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
const wrapperStyles = css({
|
|
13
|
+
display: 'flex',
|
|
12
14
|
width: 540,
|
|
13
15
|
height: 'calc(100vh - 200px)',
|
|
14
16
|
paddingTop: 18,
|
|
15
17
|
paddingLeft: 18,
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
+
});
|
|
18
19
|
|
|
19
20
|
const NotificationsContent = () => (
|
|
20
|
-
<div css={
|
|
21
|
+
<div css={wrapperStyles}>
|
|
21
22
|
<NotificationsIframe
|
|
22
23
|
// _url="https://start.stg.atlassian.com/notificationsDrawer/iframe.html?scope=user&product=uchi&locale=en"
|
|
23
24
|
_url="https://start.stg.atlassian.com/notificationsDrawer/iframe.html"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import React, { Fragment } from 'react';
|
|
3
3
|
|
|
4
|
-
import { jsx } from '@emotion/core';
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
5
|
|
|
6
6
|
import { CustomItemComponentProps } from '@atlaskit/menu';
|
|
7
7
|
import { Footer } from '@atlaskit/side-navigation';
|
|
@@ -12,28 +12,28 @@ const Container: React.FC<CustomItemComponentProps> = (props) => {
|
|
|
12
12
|
return <div {...props} />;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
const linkStyles = css({
|
|
16
|
+
color: token('color.text.subtle', N200),
|
|
17
|
+
fontSize: 12,
|
|
18
|
+
':hover': {
|
|
19
|
+
color: token('color.link', B400),
|
|
20
|
+
cursor: 'pointer',
|
|
21
|
+
textDecoration: 'none',
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
15
25
|
// This example footer conforms to a design taken from Jira designs found at
|
|
16
26
|
// https://www.figma.com/file/GA22za6unqO2WsBWM0Ddxk/Jira-navigation-3?node-id=124%3A7194
|
|
17
27
|
const ExampleFooter = () => {
|
|
18
|
-
const linkCSS = {
|
|
19
|
-
fontSize: 12,
|
|
20
|
-
color: token('color.text.subtle', N200),
|
|
21
|
-
'&:hover': {
|
|
22
|
-
color: token('color.background.brand.hovered', B400),
|
|
23
|
-
textDecoration: 'none',
|
|
24
|
-
cursor: 'pointer',
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
28
|
return (
|
|
29
29
|
<Footer
|
|
30
30
|
component={Container}
|
|
31
31
|
description={
|
|
32
32
|
<Fragment>
|
|
33
33
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
34
|
-
<a css={
|
|
34
|
+
<a css={linkStyles}>Give feedback</a> {' ∙ '}
|
|
35
35
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
36
|
-
<a css={
|
|
36
|
+
<a css={linkStyles}>Learn more</a>
|
|
37
37
|
</Fragment>
|
|
38
38
|
}
|
|
39
39
|
>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "useIsSidebarCollapsing", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _useIsSidebarCollapsing.default;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "useIsSidebarDragging", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function get() {
|
|
17
|
+
return _useIsSidebarDragging.default;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
var _useIsSidebarCollapsing = _interopRequireDefault(require("./use-is-sidebar-collapsing"));
|
|
22
|
+
|
|
23
|
+
var _useIsSidebarDragging = _interopRequireDefault(require("./use-is-sidebar-dragging"));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
var _constants = require("../constants");
|
|
15
|
+
|
|
16
|
+
var getIsCollapsing = function getIsCollapsing() {
|
|
17
|
+
// SSR bail-out because document is undefined on the server
|
|
18
|
+
if (typeof document === 'undefined') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return document.documentElement.getAttribute(_constants.IS_SIDEBAR_COLLAPSING) === 'true';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var useIsSidebarCollapsing = function useIsSidebarCollapsing() {
|
|
26
|
+
var _useState = (0, _react.useState)(getIsCollapsing),
|
|
27
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
28
|
+
isCollapsing = _useState2[0],
|
|
29
|
+
setIsCollapsing = _useState2[1];
|
|
30
|
+
|
|
31
|
+
(0, _react.useEffect)(function () {
|
|
32
|
+
var observer = new MutationObserver(function () {
|
|
33
|
+
setIsCollapsing(getIsCollapsing);
|
|
34
|
+
});
|
|
35
|
+
observer.observe(document.documentElement, {
|
|
36
|
+
attributeFilter: [_constants.IS_SIDEBAR_COLLAPSING]
|
|
37
|
+
});
|
|
38
|
+
return function () {
|
|
39
|
+
observer.disconnect();
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
return isCollapsing;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var _default = useIsSidebarCollapsing;
|
|
46
|
+
exports.default = _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
var _constants = require("../constants");
|
|
15
|
+
|
|
16
|
+
var getIsDragging = function getIsDragging() {
|
|
17
|
+
// SSR bail-out because document is undefined on the server
|
|
18
|
+
if (typeof document === 'undefined') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return document.documentElement.getAttribute(_constants.IS_SIDEBAR_DRAGGING) === 'true';
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
var useIsSidebarDragging = function useIsSidebarDragging() {
|
|
26
|
+
var _useState = (0, _react.useState)(getIsDragging),
|
|
27
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
28
|
+
isDragging = _useState2[0],
|
|
29
|
+
setIsDragging = _useState2[1];
|
|
30
|
+
|
|
31
|
+
(0, _react.useEffect)(function () {
|
|
32
|
+
var observer = new MutationObserver(function () {
|
|
33
|
+
setIsDragging(getIsDragging);
|
|
34
|
+
});
|
|
35
|
+
observer.observe(document.documentElement, {
|
|
36
|
+
attributeFilter: [_constants.IS_SIDEBAR_DRAGGING]
|
|
37
|
+
});
|
|
38
|
+
return function () {
|
|
39
|
+
observer.disconnect();
|
|
40
|
+
};
|
|
41
|
+
}, []);
|
|
42
|
+
return isDragging;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
var _default = useIsSidebarDragging;
|
|
46
|
+
exports.default = _default;
|
|
@@ -15,11 +15,49 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
|
|
16
16
|
var _core = require("@emotion/core");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _constants = require("../../common/constants");
|
|
21
21
|
|
|
22
22
|
var _excluded = ["testId", "isLeftSidebarCollapsed"];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Determines the color of the grab line.
|
|
26
|
+
*
|
|
27
|
+
* Used on internal leaf node, so naming collisions won't matter.
|
|
28
|
+
*/
|
|
29
|
+
var varLineColor = '--ds-line';
|
|
30
|
+
var grabAreaStyles = (0, _core.css)({
|
|
31
|
+
width: 24,
|
|
32
|
+
height: '100%',
|
|
33
|
+
padding: 0,
|
|
34
|
+
backgroundColor: 'transparent',
|
|
35
|
+
border: 0,
|
|
36
|
+
cursor: 'ew-resize',
|
|
37
|
+
'&::-moz-focus-inner': {
|
|
38
|
+
border: 0
|
|
39
|
+
},
|
|
40
|
+
':focus': {
|
|
41
|
+
outline: 0
|
|
42
|
+
},
|
|
43
|
+
':enabled': {
|
|
44
|
+
':hover': (0, _defineProperty2.default)({}, varLineColor, "var(--ds-border-selected, ".concat(_colors.B100, ")")),
|
|
45
|
+
':active, :focus': (0, _defineProperty2.default)({}, varLineColor, "var(--ds-border-selected, ".concat(_colors.B200, ")"))
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
var grabAreaCollapsedStyles = (0, _core.css)({
|
|
49
|
+
padding: 0,
|
|
50
|
+
backgroundColor: 'transparent',
|
|
51
|
+
border: 0,
|
|
52
|
+
cursor: 'default'
|
|
53
|
+
});
|
|
54
|
+
var lineStyles = (0, _core.css)({
|
|
55
|
+
display: 'block',
|
|
56
|
+
width: 2,
|
|
57
|
+
height: '100%',
|
|
58
|
+
backgroundColor: "var(".concat(varLineColor, ")"),
|
|
59
|
+
transition: 'background-color 200ms'
|
|
60
|
+
});
|
|
23
61
|
var grabAreaLineSelector = (0, _defineProperty2.default)({}, _constants.GRAB_AREA_LINE_SELECTOR, true);
|
|
24
62
|
var grabAreaSelector = (0, _defineProperty2.default)({}, _constants.GRAB_AREA_SELECTOR, true); // TODO: Consider allowing this to be controlled using arrow keys
|
|
25
63
|
|
|
@@ -30,9 +68,9 @@ var GrabArea = function GrabArea(_ref) {
|
|
|
30
68
|
return (0, _core.jsx)("button", (0, _extends2.default)({}, grabAreaSelector, {
|
|
31
69
|
"data-testid": testId,
|
|
32
70
|
type: "button",
|
|
33
|
-
css:
|
|
71
|
+
css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles]
|
|
34
72
|
}, rest), (0, _core.jsx)("span", (0, _extends2.default)({
|
|
35
|
-
css:
|
|
73
|
+
css: lineStyles
|
|
36
74
|
}, grabAreaLineSelector)));
|
|
37
75
|
};
|
|
38
76
|
|
|
@@ -29,31 +29,33 @@ var _grabArea = _interopRequireDefault(require("./grab-area"));
|
|
|
29
29
|
|
|
30
30
|
var _resizeButton2 = _interopRequireDefault(require("./resize-button"));
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _shadow = _interopRequireDefault(require("./shadow"));
|
|
33
33
|
|
|
34
34
|
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; }
|
|
35
35
|
|
|
36
36
|
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; }
|
|
37
37
|
|
|
38
38
|
var cssSelector = (0, _defineProperty2.default)({}, _constants.RESIZE_CONTROL_SELECTOR, true);
|
|
39
|
+
var resizeControlStyles = (0, _core.css)({
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: 0,
|
|
42
|
+
bottom: 0,
|
|
43
|
+
left: '100%',
|
|
44
|
+
outline: 'none'
|
|
45
|
+
});
|
|
46
|
+
var showResizeButtonStyles = (0, _core.css)({
|
|
47
|
+
'--ds--resize-button--opacity': 1
|
|
48
|
+
});
|
|
39
49
|
|
|
40
|
-
var
|
|
41
|
-
var testId = _ref.testId
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var testId = _ref2.testId,
|
|
50
|
-
overrides = _ref2.overrides,
|
|
51
|
-
_ref2$resizeButtonLab = _ref2.resizeButtonLabel,
|
|
52
|
-
resizeButtonLabel = _ref2$resizeButtonLab === void 0 ? '' : _ref2$resizeButtonLab,
|
|
53
|
-
_ref2$resizeGrabAreaL = _ref2.resizeGrabAreaLabel,
|
|
54
|
-
resizeGrabAreaLabel = _ref2$resizeGrabAreaL === void 0 ? 'Resize' : _ref2$resizeGrabAreaL,
|
|
55
|
-
onResizeStart = _ref2.onResizeStart,
|
|
56
|
-
onResizeEnd = _ref2.onResizeEnd;
|
|
50
|
+
var ResizeControl = function ResizeControl(_ref) {
|
|
51
|
+
var testId = _ref.testId,
|
|
52
|
+
overrides = _ref.overrides,
|
|
53
|
+
_ref$resizeButtonLabe = _ref.resizeButtonLabel,
|
|
54
|
+
resizeButtonLabel = _ref$resizeButtonLabe === void 0 ? '' : _ref$resizeButtonLabe,
|
|
55
|
+
_ref$resizeGrabAreaLa = _ref.resizeGrabAreaLabel,
|
|
56
|
+
resizeGrabAreaLabel = _ref$resizeGrabAreaLa === void 0 ? 'Resize' : _ref$resizeGrabAreaLa,
|
|
57
|
+
onResizeStart = _ref.onResizeStart,
|
|
58
|
+
onResizeEnd = _ref.onResizeEnd;
|
|
57
59
|
|
|
58
60
|
var _useContext = (0, _react.useContext)(_sidebarResizeContext.SidebarResizeContext),
|
|
59
61
|
expandLeftSidebar = _useContext.expandLeftSidebar,
|
|
@@ -263,8 +265,8 @@ var ResizeControl = function ResizeControl(_ref2) {
|
|
|
263
265
|
/* eslint-disable jsx-a11y/role-supports-aria-props */
|
|
264
266
|
|
|
265
267
|
return (0, _core.jsx)("div", (0, _extends2.default)({}, cssSelector, {
|
|
266
|
-
css:
|
|
267
|
-
}), (0, _core.jsx)(
|
|
268
|
+
css: [resizeControlStyles, (isGrabAreaFocused || isLeftSidebarCollapsed) && showResizeButtonStyles]
|
|
269
|
+
}), (0, _core.jsx)(_shadow.default, {
|
|
268
270
|
testId: testId && "".concat(testId, "-shadow")
|
|
269
271
|
}), (0, _core.jsx)(_grabArea.default, {
|
|
270
272
|
role: "separator",
|
|
@@ -17,11 +17,66 @@ var _core = require("@emotion/core");
|
|
|
17
17
|
|
|
18
18
|
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-right"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _curves = require("@atlaskit/motion/curves");
|
|
21
|
+
|
|
22
|
+
var _durations = require("@atlaskit/motion/durations");
|
|
21
23
|
|
|
22
|
-
var
|
|
24
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
25
|
+
|
|
26
|
+
var _constants = require("../../common/constants");
|
|
23
27
|
|
|
24
28
|
var _excluded = ["isLeftSidebarCollapsed", "label", "testId"];
|
|
29
|
+
var increaseHitAreaStyles = (0, _core.css)({
|
|
30
|
+
position: 'absolute',
|
|
31
|
+
top: -8,
|
|
32
|
+
right: -12,
|
|
33
|
+
bottom: -8,
|
|
34
|
+
left: -8
|
|
35
|
+
});
|
|
36
|
+
var resizeIconButtonStyles = (0, _core.css)({
|
|
37
|
+
width: 24,
|
|
38
|
+
height: 24,
|
|
39
|
+
padding: 0,
|
|
40
|
+
position: 'absolute',
|
|
41
|
+
top: 32,
|
|
42
|
+
left: 0,
|
|
43
|
+
backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
44
|
+
border: 0,
|
|
45
|
+
borderRadius: '50%',
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* TODO: https://product-fabric.atlassian.net/browse/DSP-3392
|
|
49
|
+
* This shadow needs further investigation,
|
|
50
|
+
* along with the hover and active background colors.
|
|
51
|
+
*/
|
|
52
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
53
|
+
boxShadow: "0 0 0 1px ".concat(_colors.N30A, ", 0 2px 4px 1px ").concat(_colors.N30A),
|
|
54
|
+
color: "var(--ds-text-subtle, ".concat(_colors.N200, ")"),
|
|
55
|
+
cursor: 'pointer',
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The fallback value of 0 ensures that the button is hidden by default,
|
|
59
|
+
* unless some parent (or the button itself) overrides it.
|
|
60
|
+
*/
|
|
61
|
+
opacity: "var(--ds--resize-button--opacity,0)",
|
|
62
|
+
outline: 0,
|
|
63
|
+
transform: 'translateX(-50%)',
|
|
64
|
+
transition: "\n background-color ".concat(_durations.smallDurationMs, "ms linear,\n color ").concat(_durations.smallDurationMs, "ms linear,\n opacity ").concat(_durations.mediumDurationMs, "ms ").concat(_curves.easeOut, "\n "),
|
|
65
|
+
':hover': {
|
|
66
|
+
backgroundColor: "var(--ds-background-selected-bold, ".concat(_colors.B100, ")"),
|
|
67
|
+
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")"),
|
|
68
|
+
opacity: 1
|
|
69
|
+
},
|
|
70
|
+
':active, :focus': {
|
|
71
|
+
backgroundColor: "var(--ds-background-selected-bold-hovered, ".concat(_colors.B200, ")"),
|
|
72
|
+
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")"),
|
|
73
|
+
opacity: 1
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
var resizeIconButtonExpandedStyles = (0, _core.css)({
|
|
77
|
+
transform: 'rotate(180deg)',
|
|
78
|
+
transformOrigin: 7
|
|
79
|
+
});
|
|
25
80
|
|
|
26
81
|
var preventDefault = function preventDefault(event) {
|
|
27
82
|
return event.preventDefault();
|
|
@@ -39,7 +94,7 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
39
94
|
"aria-expanded": !isLeftSidebarCollapsed,
|
|
40
95
|
"aria-label": label,
|
|
41
96
|
type: "button",
|
|
42
|
-
css:
|
|
97
|
+
css: [resizeIconButtonStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
43
98
|
"data-testid": testId // Prevents focus staying attached to the button
|
|
44
99
|
// when pressed
|
|
45
100
|
,
|
|
@@ -47,7 +102,7 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
47
102
|
}, props), (0, _core.jsx)(_chevronRight.default, {
|
|
48
103
|
label: ""
|
|
49
104
|
}), (0, _core.jsx)("div", {
|
|
50
|
-
css:
|
|
105
|
+
css: increaseHitAreaStyles
|
|
51
106
|
}));
|
|
52
107
|
};
|
|
53
108
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _core = require("@emotion/core");
|
|
9
|
+
|
|
10
|
+
var _motion = require("@atlaskit/motion");
|
|
11
|
+
|
|
12
|
+
var _hooks = require("../../common/hooks");
|
|
13
|
+
|
|
14
|
+
/** @jsx jsx */
|
|
15
|
+
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 ";
|
|
16
|
+
var direction = 'to left';
|
|
17
|
+
var transitionDuration = '0.22s';
|
|
18
|
+
var shadowStyles = (0, _core.css)({
|
|
19
|
+
width: 3,
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: 0,
|
|
22
|
+
bottom: 0,
|
|
23
|
+
left: -1,
|
|
24
|
+
background: "var(--ds-border, ".concat("linear-gradient(".concat(direction, ", ").concat(colorStops, ")"), ")"),
|
|
25
|
+
opacity: 0.5,
|
|
26
|
+
pointerEvents: 'none',
|
|
27
|
+
transitionDuration: transitionDuration,
|
|
28
|
+
transitionProperty: 'left, opacity, width',
|
|
29
|
+
transitionTimingFunction: _motion.easeOut
|
|
30
|
+
});
|
|
31
|
+
var draggingStyles = (0, _core.css)({
|
|
32
|
+
width: 6,
|
|
33
|
+
left: -6,
|
|
34
|
+
background: "var(--ds-background-neutral-subtle, ".concat("linear-gradient(".concat(direction, ", ").concat(colorStops, ")"), ")"),
|
|
35
|
+
opacity: 0.8
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
var Shadow = function Shadow(_ref) {
|
|
39
|
+
var testId = _ref.testId;
|
|
40
|
+
var isDragging = (0, _hooks.useIsSidebarDragging)();
|
|
41
|
+
return (0, _core.jsx)("div", {
|
|
42
|
+
"data-testid": testId,
|
|
43
|
+
css: [shadowStyles, isDragging && draggingStyles]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var _default = Shadow;
|
|
48
|
+
exports.default = _default;
|
|
@@ -13,16 +13,56 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
|
|
14
14
|
var _core = require("@emotion/core");
|
|
15
15
|
|
|
16
|
+
var _motion = require("@atlaskit/motion");
|
|
17
|
+
|
|
18
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
19
|
+
|
|
16
20
|
var _constants = require("../../common/constants");
|
|
17
21
|
|
|
18
22
|
var _controllers = require("../../controllers");
|
|
19
23
|
|
|
20
|
-
var _styles = require("./styles");
|
|
21
|
-
|
|
22
24
|
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; }
|
|
23
25
|
|
|
24
26
|
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; }
|
|
25
27
|
|
|
28
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
29
|
+
var prefersReducedMotionStyles = (0, _core.css)((0, _motion.prefersReducedMotion)());
|
|
30
|
+
var skipLinkStyles = (0, _core.css)({
|
|
31
|
+
margin: 10,
|
|
32
|
+
padding: '0.8rem 1rem',
|
|
33
|
+
position: 'fixed',
|
|
34
|
+
zIndex: -1,
|
|
35
|
+
left: -999999,
|
|
36
|
+
background: "var(--ds-surface-overlay, white)",
|
|
37
|
+
border: 'none',
|
|
38
|
+
borderRadius: 3,
|
|
39
|
+
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), ")"),
|
|
40
|
+
opacity: 0,
|
|
41
|
+
|
|
42
|
+
/* Do the transform when focused */
|
|
43
|
+
transform: 'translateY(-50%)',
|
|
44
|
+
transition: "transform 0.3s ".concat(_motion.easeOut),
|
|
45
|
+
':focus-within': {
|
|
46
|
+
/**
|
|
47
|
+
* Max z-index is 2147483647. Skip links always be on top,
|
|
48
|
+
* but giving a few digits extra space just in case there's a future need.
|
|
49
|
+
*/
|
|
50
|
+
zIndex: 2147483640,
|
|
51
|
+
left: 0,
|
|
52
|
+
opacity: 1,
|
|
53
|
+
transform: 'translateY(0%)'
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var skipLinkListStyles = (0, _core.css)({
|
|
57
|
+
marginTop: 4,
|
|
58
|
+
paddingLeft: 0,
|
|
59
|
+
listStylePosition: 'outside',
|
|
60
|
+
listStyleType: 'none'
|
|
61
|
+
});
|
|
62
|
+
var skipLinkListItemStyles = (0, _core.css)({
|
|
63
|
+
marginTop: 0
|
|
64
|
+
});
|
|
65
|
+
|
|
26
66
|
var assignIndex = function assignIndex(num, arr) {
|
|
27
67
|
if (!arr.includes(num)) {
|
|
28
68
|
return num;
|
|
@@ -88,9 +128,11 @@ var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
|
|
|
88
128
|
return (0, _core.jsx)("div", {
|
|
89
129
|
onFocus: attachEscHandler,
|
|
90
130
|
onBlur: removeEscHandler,
|
|
91
|
-
css:
|
|
131
|
+
css: [skipLinkStyles, prefersReducedMotionStyles],
|
|
92
132
|
"data-skip-link-wrapper": true
|
|
93
|
-
}, (0, _core.jsx)("h5", null, skipLinksLabel), (0, _core.jsx)("ol",
|
|
133
|
+
}, (0, _core.jsx)("h5", null, skipLinksLabel), (0, _core.jsx)("ol", {
|
|
134
|
+
css: skipLinkListStyles
|
|
135
|
+
}, sortSkipLinks(skipLinksData).map(function (_ref2) {
|
|
94
136
|
var id = _ref2.id,
|
|
95
137
|
skipLinkTitle = _ref2.skipLinkTitle;
|
|
96
138
|
return (0, _core.jsx)(SkipLink, {
|
|
@@ -144,7 +186,9 @@ var SkipLink = function SkipLink(_ref3) {
|
|
|
144
186
|
children = _ref3.children,
|
|
145
187
|
isFocusable = _ref3.isFocusable,
|
|
146
188
|
title = _ref3.title;
|
|
147
|
-
return (0, _core.jsx)("li",
|
|
189
|
+
return (0, _core.jsx)("li", {
|
|
190
|
+
css: skipLinkListItemStyles
|
|
191
|
+
}, (0, _core.jsx)("a", {
|
|
148
192
|
tabIndex: isFocusable ? 0 : -1,
|
|
149
193
|
href: href,
|
|
150
194
|
onClick: focusTargetRef(href),
|