@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.
Files changed (127) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +3 -3
  3. package/__perf__/utils/perf-example.tsx +27 -18
  4. package/__perf__/utils/product-integration/Create.tsx +5 -1
  5. package/__perf__/utils/product-integration/NotificationsPopup.tsx +6 -5
  6. package/__perf__/utils/product-integration/SampleFooter.tsx +14 -13
  7. package/dist/cjs/common/constants.js +1 -1
  8. package/dist/cjs/common/hooks/index.js +23 -0
  9. package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +46 -0
  10. package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +46 -0
  11. package/dist/cjs/common/utils.js +3 -3
  12. package/dist/cjs/components/index.js +22 -22
  13. package/dist/cjs/components/resize-control/grab-area.js +43 -5
  14. package/dist/cjs/components/resize-control/index.js +24 -22
  15. package/dist/cjs/components/resize-control/resize-button.js +61 -5
  16. package/dist/cjs/components/resize-control/shadow.js +48 -0
  17. package/dist/cjs/components/skip-links/index.js +4 -4
  18. package/dist/cjs/components/skip-links/skip-link-components.js +53 -9
  19. package/dist/cjs/components/slots/banner.js +27 -11
  20. package/dist/cjs/components/slots/content.js +9 -2
  21. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +65 -0
  22. package/dist/cjs/components/slots/internal/left-sidebar-outer.js +100 -0
  23. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +63 -0
  24. package/dist/cjs/components/slots/internal/slot-focus-ring.js +61 -0
  25. package/dist/cjs/components/slots/left-panel.js +26 -11
  26. package/dist/cjs/components/slots/left-sidebar-without-resize.js +10 -10
  27. package/dist/cjs/components/slots/left-sidebar.js +23 -18
  28. package/dist/cjs/components/slots/main.js +53 -6
  29. package/dist/cjs/components/slots/page-layout.js +10 -3
  30. package/dist/cjs/components/slots/right-panel.js +26 -11
  31. package/dist/cjs/components/slots/right-sidebar.js +57 -13
  32. package/dist/cjs/components/slots/top-navigation.js +27 -11
  33. package/dist/cjs/controllers/index.js +14 -14
  34. package/dist/cjs/controllers/sidebar-resize-context.js +8 -5
  35. package/dist/cjs/controllers/sidebar-resize-controller.js +10 -5
  36. package/dist/cjs/controllers/skip-link-context.js +1 -1
  37. package/dist/cjs/index.js +34 -34
  38. package/dist/cjs/version.json +1 -1
  39. package/dist/es2019/common/hooks/index.js +2 -0
  40. package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +29 -0
  41. package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +29 -0
  42. package/dist/es2019/components/resize-control/grab-area.js +46 -4
  43. package/dist/es2019/components/resize-control/index.js +12 -9
  44. package/dist/es2019/components/resize-control/resize-button.js +61 -4
  45. package/dist/es2019/components/resize-control/shadow.js +43 -0
  46. package/dist/es2019/components/skip-links/skip-link-components.js +47 -5
  47. package/dist/es2019/components/slots/banner.js +21 -7
  48. package/dist/es2019/components/slots/content.js +8 -2
  49. package/dist/es2019/components/slots/internal/left-sidebar-inner.js +52 -0
  50. package/dist/es2019/components/slots/internal/left-sidebar-outer.js +79 -0
  51. package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +49 -0
  52. package/dist/es2019/components/slots/internal/slot-focus-ring.js +50 -0
  53. package/dist/es2019/components/slots/left-panel.js +20 -7
  54. package/dist/es2019/components/slots/left-sidebar-without-resize.js +10 -11
  55. package/dist/es2019/components/slots/left-sidebar.js +20 -17
  56. package/dist/es2019/components/slots/main.js +46 -6
  57. package/dist/es2019/components/slots/page-layout.js +15 -3
  58. package/dist/es2019/components/slots/right-panel.js +20 -7
  59. package/dist/es2019/components/slots/right-sidebar.js +50 -8
  60. package/dist/es2019/components/slots/top-navigation.js +21 -7
  61. package/dist/es2019/controllers/sidebar-resize-context.js +2 -1
  62. package/dist/es2019/controllers/sidebar-resize-controller.js +10 -5
  63. package/dist/es2019/version.json +1 -1
  64. package/dist/esm/common/hooks/index.js +2 -0
  65. package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +34 -0
  66. package/dist/esm/common/hooks/use-is-sidebar-dragging.js +34 -0
  67. package/dist/esm/common/utils.js +2 -2
  68. package/dist/esm/components/resize-control/grab-area.js +44 -5
  69. package/dist/esm/components/resize-control/index.js +25 -22
  70. package/dist/esm/components/resize-control/resize-button.js +59 -5
  71. package/dist/esm/components/resize-control/shadow.js +37 -0
  72. package/dist/esm/components/skip-links/skip-link-components.js +49 -7
  73. package/dist/esm/components/slots/banner.js +27 -12
  74. package/dist/esm/components/slots/content.js +8 -2
  75. package/dist/esm/components/slots/internal/left-sidebar-inner.js +53 -0
  76. package/dist/esm/components/slots/internal/left-sidebar-outer.js +82 -0
  77. package/dist/esm/components/slots/internal/resizable-children-wrapper.js +51 -0
  78. package/dist/esm/components/slots/internal/slot-focus-ring.js +51 -0
  79. package/dist/esm/components/slots/left-panel.js +26 -12
  80. package/dist/esm/components/slots/left-sidebar-without-resize.js +10 -10
  81. package/dist/esm/components/slots/left-sidebar.js +22 -18
  82. package/dist/esm/components/slots/main.js +49 -8
  83. package/dist/esm/components/slots/page-layout.js +12 -3
  84. package/dist/esm/components/slots/right-panel.js +26 -12
  85. package/dist/esm/components/slots/right-sidebar.js +57 -14
  86. package/dist/esm/components/slots/top-navigation.js +27 -12
  87. package/dist/esm/controllers/sidebar-resize-context.js +6 -4
  88. package/dist/esm/controllers/sidebar-resize-controller.js +10 -5
  89. package/dist/esm/version.json +1 -1
  90. package/dist/types/common/hooks/index.d.ts +2 -0
  91. package/dist/types/common/hooks/use-is-sidebar-collapsing.d.ts +2 -0
  92. package/dist/types/common/hooks/use-is-sidebar-dragging.d.ts +2 -0
  93. package/dist/types/components/resize-control/index.d.ts +1 -0
  94. package/dist/types/components/resize-control/resize-button.d.ts +1 -0
  95. package/dist/types/components/resize-control/shadow.d.ts +6 -0
  96. package/dist/types/components/slots/banner.d.ts +1 -0
  97. package/dist/types/components/slots/internal/left-sidebar-inner.d.ts +9 -0
  98. package/dist/types/components/slots/internal/left-sidebar-outer.d.ts +13 -0
  99. package/dist/types/components/slots/internal/resizable-children-wrapper.d.ts +10 -0
  100. package/dist/types/components/slots/internal/slot-focus-ring.d.ts +19 -0
  101. package/dist/types/components/slots/left-panel.d.ts +1 -0
  102. package/dist/types/components/slots/left-sidebar-without-resize.d.ts +1 -0
  103. package/dist/types/components/slots/left-sidebar.d.ts +1 -0
  104. package/dist/types/components/slots/main.d.ts +1 -0
  105. package/dist/types/components/slots/page-layout.d.ts +1 -0
  106. package/dist/types/components/slots/right-panel.d.ts +1 -0
  107. package/dist/types/components/slots/right-sidebar.d.ts +1 -0
  108. package/dist/types/components/slots/slot-dimensions.d.ts +1 -0
  109. package/dist/types/components/slots/top-navigation.d.ts +1 -0
  110. package/dist/types/controllers/sidebar-resize-context.d.ts +1 -0
  111. package/package.json +25 -20
  112. package/dist/cjs/components/resize-control/styles.js +0 -156
  113. package/dist/cjs/components/skip-links/styles.js +0 -58
  114. package/dist/cjs/components/slots/left-sidebar-styles.js +0 -116
  115. package/dist/cjs/components/slots/styles.js +0 -154
  116. package/dist/es2019/components/resize-control/styles.js +0 -136
  117. package/dist/es2019/components/skip-links/styles.js +0 -41
  118. package/dist/es2019/components/slots/left-sidebar-styles.js +0 -96
  119. package/dist/es2019/components/slots/styles.js +0 -130
  120. package/dist/esm/components/resize-control/styles.js +0 -131
  121. package/dist/esm/components/skip-links/styles.js +0 -45
  122. package/dist/esm/components/slots/left-sidebar-styles.js +0 -94
  123. package/dist/esm/components/slots/styles.js +0 -117
  124. package/dist/types/components/resize-control/styles.d.ts +0 -41
  125. package/dist/types/components/skip-links/styles.d.ts +0 -2
  126. package/dist/types/components/slots/left-sidebar-styles.d.ts +0 -5
  127. 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://atlaskit.atlassian.com/packages/design-system/page-layout).
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://atlaskit.atlassian.com/packages/navigation/side-navigation)
16
- To add top/global navigation, use [@atlaskit/atlassian-navigation](https://atlaskit.atlassian.com/packages/navigation/atlassian-navigation)
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="black">
65
- <h3 css={{ textAlign: 'center' }}>Main</h3>
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' }}> [c]</span>
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
- const wrapperCSS = {
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
- display: 'flex',
17
- };
18
+ });
18
19
 
19
20
  const NotificationsContent = () => (
20
- <div css={wrapperCSS}>
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={linkCSS}>Give feedback</a> {' ∙ '}
34
+ <a css={linkStyles}>Give feedback</a> {' ∙ '}
34
35
  {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
35
- <a css={linkCSS}>Learn more</a>
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.LEFT_SIDEBAR_FLYOUT_WIDTH = exports.BANNER_HEIGHT = exports.TOP_NAVIGATION_HEIGHT = exports.RIGHT_SIDEBAR_WIDTH = exports.LEFT_SIDEBAR_WIDTH = exports.RIGHT_PANEL_WIDTH = exports.LEFT_PANEL_WIDTH = exports.PAGE_LAYOUT_CONTAINER_SELECTOR = exports.DEFAULT_I18N_PROPS_SKIP_LINKS = exports.PAGE_LAYOUT_SLOT_SELECTOR = exports.RESIZE_CONTROL_SELECTOR = exports.RESIZE_BUTTON_SELECTOR = exports.GRAB_AREA_SELECTOR = exports.GRAB_AREA_LINE_SELECTOR = exports.IS_FLYOUT_OPEN = exports.IS_SIDEBAR_COLLAPSING = exports.IS_SIDEBAR_DRAGGING = exports.PAGE_LAYOUT_LS_KEY = exports.LEFT_SIDEBAR_EXPANDED_WIDTH = exports.FLYOUT_DELAY = exports.TRANSITION_DURATION = exports.MIN_LEFT_SIDEBAR_DRAG_THRESHOLD = exports.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH = exports.MIN_LEFT_SIDEBAR_WIDTH = exports.COLLAPSED_LEFT_SIDEBAR_WIDTH = exports.DEFAULT_LEFT_PANEL_WIDTH = exports.DEFAULT_RIGHT_PANEL_WIDTH = exports.DEFAULT_RIGHT_SIDEBAR_WIDTH = exports.DEFAULT_LEFT_SIDEBAR_WIDTH = exports.DEFAULT_TOP_NAVIGATION_HEIGHT = exports.DEFAULT_BANNER_HEIGHT = exports.RIGHT_SIDEBAR = exports.LEFT_SIDEBAR = exports.MAIN = exports.CONTENT = exports.TOP_NAVIGATION = exports.BANNER = exports.RIGHT_PANEL = exports.LEFT_PANEL = exports.DIMENSIONS = exports.VAR_LEFT_SIDEBAR_FLYOUT = exports.VAR_BANNER_HEIGHT = exports.VAR_TOP_NAVIGATION_HEIGHT = exports.VAR_RIGHT_PANEL_WIDTH = exports.VAR_RIGHT_SIDEBAR_WIDTH = exports.VAR_LEFT_SIDEBAR_WIDTH = exports.VAR_LEFT_PANEL_WIDTH = void 0;
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;
@@ -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.getPageLayoutSlotCSSSelector = exports.getPageLayoutSlotSelector = exports.getLeftSidebarPercentage = exports.getLeftPanelWidth = exports.resolveDimension = exports.removeFromGridStateInStorage = exports.getGridStateFromStorage = exports.mergeGridStateIntoStorage = exports.emptyGridState = void 0;
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); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
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] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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, "PageLayout", {
8
+ Object.defineProperty(exports, "Banner", {
9
9
  enumerable: true,
10
10
  get: function get() {
11
- return _pageLayout.default;
11
+ return _banner.default;
12
12
  }
13
13
  });
14
- Object.defineProperty(exports, "Main", {
14
+ Object.defineProperty(exports, "Content", {
15
15
  enumerable: true,
16
16
  get: function get() {
17
- return _main.default;
17
+ return _content.default;
18
18
  }
19
19
  });
20
- Object.defineProperty(exports, "RightPanel", {
20
+ Object.defineProperty(exports, "LeftPanel", {
21
21
  enumerable: true,
22
22
  get: function get() {
23
- return _rightPanel.default;
23
+ return _leftPanel.default;
24
24
  }
25
25
  });
26
- Object.defineProperty(exports, "LeftPanel", {
26
+ Object.defineProperty(exports, "LeftSidebar", {
27
27
  enumerable: true,
28
28
  get: function get() {
29
- return _leftPanel.default;
29
+ return _leftSidebar.default;
30
30
  }
31
31
  });
32
- Object.defineProperty(exports, "RightSidebar", {
32
+ Object.defineProperty(exports, "LeftSidebarWithoutResize", {
33
33
  enumerable: true,
34
34
  get: function get() {
35
- return _rightSidebar.default;
35
+ return _leftSidebarWithoutResize.default;
36
36
  }
37
37
  });
38
- Object.defineProperty(exports, "LeftSidebar", {
38
+ Object.defineProperty(exports, "Main", {
39
39
  enumerable: true,
40
40
  get: function get() {
41
- return _leftSidebar.default;
41
+ return _main.default;
42
42
  }
43
43
  });
44
- Object.defineProperty(exports, "LeftSidebarWithoutResize", {
44
+ Object.defineProperty(exports, "PageLayout", {
45
45
  enumerable: true,
46
46
  get: function get() {
47
- return _leftSidebarWithoutResize.default;
47
+ return _pageLayout.default;
48
48
  }
49
49
  });
50
- Object.defineProperty(exports, "Banner", {
50
+ Object.defineProperty(exports, "ResizeControl", {
51
51
  enumerable: true,
52
52
  get: function get() {
53
- return _banner.default;
53
+ return _resizeControl.default;
54
54
  }
55
55
  });
56
- Object.defineProperty(exports, "TopNavigation", {
56
+ Object.defineProperty(exports, "RightPanel", {
57
57
  enumerable: true,
58
58
  get: function get() {
59
- return _topNavigation.default;
59
+ return _rightPanel.default;
60
60
  }
61
61
  });
62
- Object.defineProperty(exports, "Content", {
62
+ Object.defineProperty(exports, "RightSidebar", {
63
63
  enumerable: true,
64
64
  get: function get() {
65
- return _content.default;
65
+ return _rightSidebar.default;
66
66
  }
67
67
  });
68
- Object.defineProperty(exports, "ResizeControl", {
68
+ Object.defineProperty(exports, "TopNavigation", {
69
69
  enumerable: true,
70
70
  get: function get() {
71
- return _resizeControl.default;
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 _styles = require("./styles");
22
+ var _excluded = ["testId", "isLeftSidebarCollapsed"];
21
23
 
22
- /** @jsx jsx */
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, ["testId", "isLeftSidebarCollapsed"]);
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: (0, _styles.grabAreaCSS)(isLeftSidebarCollapsed)
71
+ css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles]
34
72
  }, rest), (0, _core.jsx)("span", (0, _extends2.default)({
35
- css: (0, _styles.lineCSS)(isLeftSidebarCollapsed)
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 _styles = require("./styles");
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); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
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] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
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 Shadow = function Shadow(_ref) {
41
- var testId = _ref.testId;
42
- return (0, _core.jsx)("div", {
43
- "data-testid": testId,
44
- css: _styles.shadowCSS
45
- });
46
- };
47
-
48
- var ResizeControl = function ResizeControl(_ref2) {
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: (0, _styles.resizeControlCSS)(isGrabAreaFocused, isLeftSidebarCollapsed)
267
- }), (0, _core.jsx)(Shadow, {
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",