@atlaskit/page-layout 1.0.6 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +3 -3
- package/__perf__/utils/perf-example.tsx +27 -18
- package/__perf__/utils/product-integration/Create.tsx +5 -1
- package/__perf__/utils/product-integration/NotificationsPopup.tsx +6 -5
- package/__perf__/utils/product-integration/SampleFooter.tsx +14 -13
- package/dist/cjs/common/constants.js +1 -1
- package/dist/cjs/common/hooks/index.js +23 -0
- package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +46 -0
- package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +46 -0
- package/dist/cjs/common/utils.js +3 -3
- package/dist/cjs/components/index.js +22 -22
- package/dist/cjs/components/resize-control/grab-area.js +43 -5
- package/dist/cjs/components/resize-control/index.js +24 -22
- package/dist/cjs/components/resize-control/resize-button.js +61 -5
- package/dist/cjs/components/resize-control/shadow.js +48 -0
- package/dist/cjs/components/skip-links/index.js +4 -4
- package/dist/cjs/components/skip-links/skip-link-components.js +53 -9
- package/dist/cjs/components/slots/banner.js +27 -11
- package/dist/cjs/components/slots/content.js +9 -2
- package/dist/cjs/components/slots/internal/left-sidebar-inner.js +65 -0
- package/dist/cjs/components/slots/internal/left-sidebar-outer.js +100 -0
- package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +63 -0
- package/dist/cjs/components/slots/internal/slot-focus-ring.js +61 -0
- package/dist/cjs/components/slots/left-panel.js +26 -11
- package/dist/cjs/components/slots/left-sidebar-without-resize.js +10 -10
- package/dist/cjs/components/slots/left-sidebar.js +23 -18
- package/dist/cjs/components/slots/main.js +53 -6
- package/dist/cjs/components/slots/page-layout.js +10 -3
- package/dist/cjs/components/slots/right-panel.js +26 -11
- package/dist/cjs/components/slots/right-sidebar.js +57 -13
- package/dist/cjs/components/slots/top-navigation.js +27 -11
- package/dist/cjs/controllers/index.js +14 -14
- package/dist/cjs/controllers/sidebar-resize-context.js +8 -5
- package/dist/cjs/controllers/sidebar-resize-controller.js +10 -5
- package/dist/cjs/controllers/skip-link-context.js +1 -1
- package/dist/cjs/index.js +34 -34
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/hooks/index.js +2 -0
- package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +29 -0
- package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +29 -0
- package/dist/es2019/components/resize-control/grab-area.js +46 -4
- package/dist/es2019/components/resize-control/index.js +12 -9
- package/dist/es2019/components/resize-control/resize-button.js +61 -4
- package/dist/es2019/components/resize-control/shadow.js +43 -0
- package/dist/es2019/components/skip-links/skip-link-components.js +47 -5
- package/dist/es2019/components/slots/banner.js +21 -7
- package/dist/es2019/components/slots/content.js +8 -2
- package/dist/es2019/components/slots/internal/left-sidebar-inner.js +52 -0
- package/dist/es2019/components/slots/internal/left-sidebar-outer.js +79 -0
- package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +49 -0
- package/dist/es2019/components/slots/internal/slot-focus-ring.js +50 -0
- package/dist/es2019/components/slots/left-panel.js +20 -7
- package/dist/es2019/components/slots/left-sidebar-without-resize.js +10 -11
- package/dist/es2019/components/slots/left-sidebar.js +20 -17
- package/dist/es2019/components/slots/main.js +46 -6
- package/dist/es2019/components/slots/page-layout.js +15 -3
- package/dist/es2019/components/slots/right-panel.js +20 -7
- package/dist/es2019/components/slots/right-sidebar.js +50 -8
- package/dist/es2019/components/slots/top-navigation.js +21 -7
- package/dist/es2019/controllers/sidebar-resize-context.js +2 -1
- package/dist/es2019/controllers/sidebar-resize-controller.js +10 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/hooks/index.js +2 -0
- package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +34 -0
- package/dist/esm/common/hooks/use-is-sidebar-dragging.js +34 -0
- package/dist/esm/common/utils.js +2 -2
- package/dist/esm/components/resize-control/grab-area.js +44 -5
- package/dist/esm/components/resize-control/index.js +25 -22
- package/dist/esm/components/resize-control/resize-button.js +59 -5
- package/dist/esm/components/resize-control/shadow.js +37 -0
- package/dist/esm/components/skip-links/skip-link-components.js +49 -7
- package/dist/esm/components/slots/banner.js +27 -12
- package/dist/esm/components/slots/content.js +8 -2
- package/dist/esm/components/slots/internal/left-sidebar-inner.js +53 -0
- package/dist/esm/components/slots/internal/left-sidebar-outer.js +82 -0
- package/dist/esm/components/slots/internal/resizable-children-wrapper.js +51 -0
- package/dist/esm/components/slots/internal/slot-focus-ring.js +51 -0
- package/dist/esm/components/slots/left-panel.js +26 -12
- package/dist/esm/components/slots/left-sidebar-without-resize.js +10 -10
- package/dist/esm/components/slots/left-sidebar.js +22 -18
- package/dist/esm/components/slots/main.js +49 -8
- package/dist/esm/components/slots/page-layout.js +12 -3
- package/dist/esm/components/slots/right-panel.js +26 -12
- package/dist/esm/components/slots/right-sidebar.js +57 -14
- package/dist/esm/components/slots/top-navigation.js +27 -12
- package/dist/esm/controllers/sidebar-resize-context.js +6 -4
- package/dist/esm/controllers/sidebar-resize-controller.js +10 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/common/hooks/index.d.ts +2 -0
- package/dist/types/common/hooks/use-is-sidebar-collapsing.d.ts +2 -0
- package/dist/types/common/hooks/use-is-sidebar-dragging.d.ts +2 -0
- package/dist/types/components/resize-control/index.d.ts +1 -0
- package/dist/types/components/resize-control/resize-button.d.ts +1 -0
- package/dist/types/components/resize-control/shadow.d.ts +6 -0
- package/dist/types/components/slots/banner.d.ts +1 -0
- package/dist/types/components/slots/internal/left-sidebar-inner.d.ts +9 -0
- package/dist/types/components/slots/internal/left-sidebar-outer.d.ts +13 -0
- package/dist/types/components/slots/internal/resizable-children-wrapper.d.ts +10 -0
- package/dist/types/components/slots/internal/slot-focus-ring.d.ts +19 -0
- package/dist/types/components/slots/left-panel.d.ts +1 -0
- package/dist/types/components/slots/left-sidebar-without-resize.d.ts +1 -0
- package/dist/types/components/slots/left-sidebar.d.ts +1 -0
- package/dist/types/components/slots/main.d.ts +1 -0
- package/dist/types/components/slots/page-layout.d.ts +1 -0
- package/dist/types/components/slots/right-panel.d.ts +1 -0
- package/dist/types/components/slots/right-sidebar.d.ts +1 -0
- package/dist/types/components/slots/slot-dimensions.d.ts +1 -0
- package/dist/types/components/slots/top-navigation.d.ts +1 -0
- package/dist/types/controllers/sidebar-resize-context.d.ts +1 -0
- package/package.json +25 -20
- package/dist/cjs/components/resize-control/styles.js +0 -156
- package/dist/cjs/components/skip-links/styles.js +0 -58
- package/dist/cjs/components/slots/left-sidebar-styles.js +0 -116
- package/dist/cjs/components/slots/styles.js +0 -154
- package/dist/es2019/components/resize-control/styles.js +0 -136
- package/dist/es2019/components/skip-links/styles.js +0 -41
- package/dist/es2019/components/slots/left-sidebar-styles.js +0 -96
- package/dist/es2019/components/slots/styles.js +0 -130
- package/dist/esm/components/resize-control/styles.js +0 -131
- package/dist/esm/components/skip-links/styles.js +0 -45
- package/dist/esm/components/slots/left-sidebar-styles.js +0 -94
- package/dist/esm/components/slots/styles.js +0 -117
- package/dist/types/components/resize-control/styles.d.ts +0 -41
- package/dist/types/components/skip-links/styles.d.ts +0 -2
- package/dist/types/components/slots/left-sidebar-styles.d.ts +0 -5
- package/dist/types/components/slots/styles.d.ts +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
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
|
+
|
|
17
|
+
## 1.1.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [`567a96da90e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/567a96da90e) - [ux] Instrumented page-layout with the new theming package, `@atlaskit/tokens`. New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha).These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
27
|
+
## 1.0.7
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [`19d72473dfb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/19d72473dfb) - Bump raf-schd to latest (4.0.3), including better TS typings.
|
|
32
|
+
|
|
3
33
|
## 1.0.6
|
|
4
34
|
|
|
5
35
|
### Patch 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/)
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { css, jsx } from '@emotion/core';
|
|
4
4
|
|
|
5
|
+
import { token } from '@atlaskit/tokens';
|
|
6
|
+
|
|
5
7
|
import {
|
|
6
8
|
Content,
|
|
7
9
|
LeftSidebar,
|
|
@@ -13,6 +15,15 @@ import {
|
|
|
13
15
|
import JiraIntegrationExample from './product-integration/AtlassianNavigation';
|
|
14
16
|
import Sidebar from './product-integration/SideNavigation';
|
|
15
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
|
+
|
|
16
27
|
const Wrapper = ({
|
|
17
28
|
borderColor,
|
|
18
29
|
children,
|
|
@@ -25,21 +36,27 @@ const Wrapper = ({
|
|
|
25
36
|
noHorizontalScrollbar?: boolean;
|
|
26
37
|
}) => (
|
|
27
38
|
<div
|
|
28
|
-
css={
|
|
39
|
+
css={wrapperStyles}
|
|
40
|
+
style={{
|
|
29
41
|
outline: noOutline ? 'none' : `2px dashed ${borderColor}`,
|
|
30
|
-
outlineOffset: -4,
|
|
31
|
-
padding: 8,
|
|
32
|
-
height: '100%',
|
|
33
|
-
boxSizing: 'border-box',
|
|
34
|
-
overflowY: 'auto',
|
|
35
42
|
overflowX: noHorizontalScrollbar ? 'hidden' : 'auto',
|
|
36
|
-
backgroundColor: 'white',
|
|
37
43
|
}}
|
|
38
44
|
>
|
|
39
45
|
{children}
|
|
40
46
|
</div>
|
|
41
47
|
);
|
|
42
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
|
+
|
|
43
60
|
const BasicGrid = () => {
|
|
44
61
|
return (
|
|
45
62
|
<PageLayout>
|
|
@@ -48,21 +65,13 @@ const BasicGrid = () => {
|
|
|
48
65
|
</TopNavigation>
|
|
49
66
|
<Content testId="content">
|
|
50
67
|
<LeftSidebar testId="left-sidebar" isFixed={false} width={450}>
|
|
51
|
-
<div
|
|
52
|
-
css={css`
|
|
53
|
-
height: 100%;
|
|
54
|
-
& nav {
|
|
55
|
-
min-width: 20px;
|
|
56
|
-
overflow-x: hidden;
|
|
57
|
-
}
|
|
58
|
-
`}
|
|
59
|
-
>
|
|
68
|
+
<div css={sidebarWrapperStyles}>
|
|
60
69
|
<Sidebar />
|
|
61
70
|
</div>
|
|
62
71
|
</LeftSidebar>
|
|
63
72
|
<Main>
|
|
64
|
-
<Wrapper noOutline borderColor=
|
|
65
|
-
<h3 css={
|
|
73
|
+
<Wrapper noOutline borderColor={token('color.border', 'black')}>
|
|
74
|
+
<h3 css={slotLabelStyles}>Main</h3>
|
|
66
75
|
</Wrapper>
|
|
67
76
|
</Main>
|
|
68
77
|
</Content>
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { Create } from '@atlaskit/atlassian-navigation';
|
|
4
|
+
import { token } from '@atlaskit/tokens';
|
|
4
5
|
|
|
5
6
|
const StyledTooltip = () => (
|
|
6
7
|
<span>
|
|
7
8
|
Create
|
|
8
|
-
<span style={{ color: 'orange' }}>
|
|
9
|
+
<span style={{ color: token('color.text.accent.orange', 'orange') }}>
|
|
10
|
+
{' '}
|
|
11
|
+
[c]
|
|
12
|
+
</span>
|
|
9
13
|
</span>
|
|
10
14
|
);
|
|
11
15
|
|
|
@@ -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,38 +1,39 @@
|
|
|
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';
|
|
8
8
|
import { B400, N200 } from '@atlaskit/theme/colors';
|
|
9
|
+
import { token } from '@atlaskit/tokens';
|
|
9
10
|
|
|
10
11
|
const Container: React.FC<CustomItemComponentProps> = (props) => {
|
|
11
12
|
return <div {...props} />;
|
|
12
13
|
};
|
|
13
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
|
+
|
|
14
25
|
// This example footer conforms to a design taken from Jira designs found at
|
|
15
26
|
// https://www.figma.com/file/GA22za6unqO2WsBWM0Ddxk/Jira-navigation-3?node-id=124%3A7194
|
|
16
27
|
const ExampleFooter = () => {
|
|
17
|
-
const linkCSS = {
|
|
18
|
-
fontSize: 12,
|
|
19
|
-
color: N200,
|
|
20
|
-
'&:hover': {
|
|
21
|
-
color: B400,
|
|
22
|
-
textDecoration: 'none',
|
|
23
|
-
cursor: 'pointer',
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
|
|
27
28
|
return (
|
|
28
29
|
<Footer
|
|
29
30
|
component={Container}
|
|
30
31
|
description={
|
|
31
32
|
<Fragment>
|
|
32
33
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
33
|
-
<a css={
|
|
34
|
+
<a css={linkStyles}>Give feedback</a> {' ∙ '}
|
|
34
35
|
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
35
|
-
<a css={
|
|
36
|
+
<a css={linkStyles}>Learn more</a>
|
|
36
37
|
</Fragment>
|
|
37
38
|
}
|
|
38
39
|
>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.VAR_TOP_NAVIGATION_HEIGHT = exports.VAR_RIGHT_SIDEBAR_WIDTH = exports.VAR_RIGHT_PANEL_WIDTH = exports.VAR_LEFT_SIDEBAR_WIDTH = exports.VAR_LEFT_SIDEBAR_FLYOUT = exports.VAR_LEFT_PANEL_WIDTH = exports.VAR_BANNER_HEIGHT = exports.TRANSITION_DURATION = exports.TOP_NAVIGATION_HEIGHT = exports.TOP_NAVIGATION = exports.RIGHT_SIDEBAR_WIDTH = exports.RIGHT_SIDEBAR = exports.RIGHT_PANEL_WIDTH = exports.RIGHT_PANEL = exports.RESIZE_CONTROL_SELECTOR = exports.RESIZE_BUTTON_SELECTOR = exports.PAGE_LAYOUT_SLOT_SELECTOR = exports.PAGE_LAYOUT_LS_KEY = exports.PAGE_LAYOUT_CONTAINER_SELECTOR = exports.MIN_LEFT_SIDEBAR_WIDTH = exports.MIN_LEFT_SIDEBAR_DRAG_THRESHOLD = exports.MAIN = exports.LEFT_SIDEBAR_WIDTH = exports.LEFT_SIDEBAR_FLYOUT_WIDTH = exports.LEFT_SIDEBAR_EXPANDED_WIDTH = exports.LEFT_SIDEBAR = exports.LEFT_PANEL_WIDTH = exports.LEFT_PANEL = exports.IS_SIDEBAR_DRAGGING = exports.IS_SIDEBAR_COLLAPSING = exports.IS_FLYOUT_OPEN = exports.GRAB_AREA_SELECTOR = exports.GRAB_AREA_LINE_SELECTOR = exports.FLYOUT_DELAY = exports.DIMENSIONS = exports.DEFAULT_TOP_NAVIGATION_HEIGHT = exports.DEFAULT_RIGHT_SIDEBAR_WIDTH = exports.DEFAULT_RIGHT_PANEL_WIDTH = exports.DEFAULT_LEFT_SIDEBAR_WIDTH = exports.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH = exports.DEFAULT_LEFT_PANEL_WIDTH = exports.DEFAULT_I18N_PROPS_SKIP_LINKS = exports.DEFAULT_BANNER_HEIGHT = exports.CONTENT = exports.COLLAPSED_LEFT_SIDEBAR_WIDTH = exports.BANNER_HEIGHT = exports.BANNER = void 0;
|
|
7
7
|
// dimension vars
|
|
8
8
|
var VAR_LEFT_PANEL_WIDTH = 'leftPanelWidth';
|
|
9
9
|
exports.VAR_LEFT_PANEL_WIDTH = VAR_LEFT_PANEL_WIDTH;
|
|
@@ -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;
|
package/dist/cjs/common/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.resolveDimension = exports.removeFromGridStateInStorage = exports.mergeGridStateIntoStorage = exports.getPageLayoutSlotSelector = exports.getPageLayoutSlotCSSSelector = exports.getLeftSidebarPercentage = exports.getLeftPanelWidth = exports.getGridStateFromStorage = exports.emptyGridState = void 0;
|
|
9
9
|
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
|
|
@@ -15,9 +15,9 @@ var _constants = require("./constants");
|
|
|
15
15
|
|
|
16
16
|
var _safeLocalStorage = _interopRequireDefault(require("./safe-local-storage"));
|
|
17
17
|
|
|
18
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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
19
|
|
|
20
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
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
21
|
|
|
22
22
|
var emptyGridState = _constants.DIMENSIONS.reduce(function (acc, currentValue) {
|
|
23
23
|
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2.default)({}, currentValue, 0));
|
|
@@ -5,70 +5,70 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
Object.defineProperty(exports, "
|
|
8
|
+
Object.defineProperty(exports, "Banner", {
|
|
9
9
|
enumerable: true,
|
|
10
10
|
get: function get() {
|
|
11
|
-
return
|
|
11
|
+
return _banner.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
Object.defineProperty(exports, "
|
|
14
|
+
Object.defineProperty(exports, "Content", {
|
|
15
15
|
enumerable: true,
|
|
16
16
|
get: function get() {
|
|
17
|
-
return
|
|
17
|
+
return _content.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
Object.defineProperty(exports, "
|
|
20
|
+
Object.defineProperty(exports, "LeftPanel", {
|
|
21
21
|
enumerable: true,
|
|
22
22
|
get: function get() {
|
|
23
|
-
return
|
|
23
|
+
return _leftPanel.default;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
|
-
Object.defineProperty(exports, "
|
|
26
|
+
Object.defineProperty(exports, "LeftSidebar", {
|
|
27
27
|
enumerable: true,
|
|
28
28
|
get: function get() {
|
|
29
|
-
return
|
|
29
|
+
return _leftSidebar.default;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
Object.defineProperty(exports, "
|
|
32
|
+
Object.defineProperty(exports, "LeftSidebarWithoutResize", {
|
|
33
33
|
enumerable: true,
|
|
34
34
|
get: function get() {
|
|
35
|
-
return
|
|
35
|
+
return _leftSidebarWithoutResize.default;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
|
-
Object.defineProperty(exports, "
|
|
38
|
+
Object.defineProperty(exports, "Main", {
|
|
39
39
|
enumerable: true,
|
|
40
40
|
get: function get() {
|
|
41
|
-
return
|
|
41
|
+
return _main.default;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
Object.defineProperty(exports, "
|
|
44
|
+
Object.defineProperty(exports, "PageLayout", {
|
|
45
45
|
enumerable: true,
|
|
46
46
|
get: function get() {
|
|
47
|
-
return
|
|
47
|
+
return _pageLayout.default;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
Object.defineProperty(exports, "
|
|
50
|
+
Object.defineProperty(exports, "ResizeControl", {
|
|
51
51
|
enumerable: true,
|
|
52
52
|
get: function get() {
|
|
53
|
-
return
|
|
53
|
+
return _resizeControl.default;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
|
-
Object.defineProperty(exports, "
|
|
56
|
+
Object.defineProperty(exports, "RightPanel", {
|
|
57
57
|
enumerable: true,
|
|
58
58
|
get: function get() {
|
|
59
|
-
return
|
|
59
|
+
return _rightPanel.default;
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
|
-
Object.defineProperty(exports, "
|
|
62
|
+
Object.defineProperty(exports, "RightSidebar", {
|
|
63
63
|
enumerable: true,
|
|
64
64
|
get: function get() {
|
|
65
|
-
return
|
|
65
|
+
return _rightSidebar.default;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
|
-
Object.defineProperty(exports, "
|
|
68
|
+
Object.defineProperty(exports, "TopNavigation", {
|
|
69
69
|
enumerable: true,
|
|
70
70
|
get: function get() {
|
|
71
|
-
return
|
|
71
|
+
return _topNavigation.default;
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "useCustomSkipLink", {
|
|
@@ -15,24 +15,62 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
15
15
|
|
|
16
16
|
var _core = require("@emotion/core");
|
|
17
17
|
|
|
18
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
19
|
+
|
|
18
20
|
var _constants = require("../../common/constants");
|
|
19
21
|
|
|
20
|
-
var
|
|
22
|
+
var _excluded = ["testId", "isLeftSidebarCollapsed"];
|
|
21
23
|
|
|
22
|
-
/**
|
|
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
|
|
|
26
64
|
var GrabArea = function GrabArea(_ref) {
|
|
27
65
|
var testId = _ref.testId,
|
|
28
66
|
isLeftSidebarCollapsed = _ref.isLeftSidebarCollapsed,
|
|
29
|
-
rest = (0, _objectWithoutProperties2.default)(_ref,
|
|
67
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
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
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
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
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
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",
|