@atlaskit/page-layout 1.0.7 → 1.2.1

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 (107) 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/hooks/index.js +23 -0
  8. package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +46 -0
  9. package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +46 -0
  10. package/dist/cjs/components/resize-control/grab-area.js +42 -4
  11. package/dist/cjs/components/resize-control/index.js +22 -20
  12. package/dist/cjs/components/resize-control/resize-button.js +59 -4
  13. package/dist/cjs/components/resize-control/shadow.js +48 -0
  14. package/dist/cjs/components/skip-links/skip-link-components.js +49 -5
  15. package/dist/cjs/components/slots/banner.js +27 -11
  16. package/dist/cjs/components/slots/content.js +9 -2
  17. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +65 -0
  18. package/dist/cjs/components/slots/internal/left-sidebar-outer.js +100 -0
  19. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +63 -0
  20. package/dist/cjs/components/slots/internal/slot-focus-ring.js +61 -0
  21. package/dist/cjs/components/slots/left-panel.js +26 -11
  22. package/dist/cjs/components/slots/left-sidebar-without-resize.js +10 -10
  23. package/dist/cjs/components/slots/left-sidebar.js +21 -16
  24. package/dist/cjs/components/slots/main.js +53 -6
  25. package/dist/cjs/components/slots/page-layout.js +10 -3
  26. package/dist/cjs/components/slots/right-panel.js +26 -11
  27. package/dist/cjs/components/slots/right-sidebar.js +57 -13
  28. package/dist/cjs/components/slots/top-navigation.js +27 -11
  29. package/dist/cjs/controllers/sidebar-resize-context.js +2 -1
  30. package/dist/cjs/controllers/sidebar-resize-controller.js +10 -5
  31. package/dist/cjs/version.json +1 -1
  32. package/dist/es2019/common/hooks/index.js +2 -0
  33. package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +29 -0
  34. package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +29 -0
  35. package/dist/es2019/components/resize-control/grab-area.js +46 -4
  36. package/dist/es2019/components/resize-control/index.js +12 -9
  37. package/dist/es2019/components/resize-control/resize-button.js +61 -4
  38. package/dist/es2019/components/resize-control/shadow.js +43 -0
  39. package/dist/es2019/components/skip-links/skip-link-components.js +47 -5
  40. package/dist/es2019/components/slots/banner.js +21 -7
  41. package/dist/es2019/components/slots/content.js +8 -2
  42. package/dist/es2019/components/slots/internal/left-sidebar-inner.js +52 -0
  43. package/dist/es2019/components/slots/internal/left-sidebar-outer.js +79 -0
  44. package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +49 -0
  45. package/dist/es2019/components/slots/internal/slot-focus-ring.js +50 -0
  46. package/dist/es2019/components/slots/left-panel.js +20 -7
  47. package/dist/es2019/components/slots/left-sidebar-without-resize.js +10 -11
  48. package/dist/es2019/components/slots/left-sidebar.js +20 -17
  49. package/dist/es2019/components/slots/main.js +46 -6
  50. package/dist/es2019/components/slots/page-layout.js +15 -3
  51. package/dist/es2019/components/slots/right-panel.js +20 -7
  52. package/dist/es2019/components/slots/right-sidebar.js +50 -8
  53. package/dist/es2019/components/slots/top-navigation.js +21 -7
  54. package/dist/es2019/controllers/sidebar-resize-context.js +2 -1
  55. package/dist/es2019/controllers/sidebar-resize-controller.js +10 -5
  56. package/dist/es2019/version.json +1 -1
  57. package/dist/esm/common/hooks/index.js +2 -0
  58. package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +34 -0
  59. package/dist/esm/common/hooks/use-is-sidebar-dragging.js +34 -0
  60. package/dist/esm/components/resize-control/grab-area.js +42 -4
  61. package/dist/esm/components/resize-control/index.js +23 -20
  62. package/dist/esm/components/resize-control/resize-button.js +57 -4
  63. package/dist/esm/components/resize-control/shadow.js +37 -0
  64. package/dist/esm/components/skip-links/skip-link-components.js +47 -5
  65. package/dist/esm/components/slots/banner.js +27 -12
  66. package/dist/esm/components/slots/content.js +8 -2
  67. package/dist/esm/components/slots/internal/left-sidebar-inner.js +53 -0
  68. package/dist/esm/components/slots/internal/left-sidebar-outer.js +82 -0
  69. package/dist/esm/components/slots/internal/resizable-children-wrapper.js +51 -0
  70. package/dist/esm/components/slots/internal/slot-focus-ring.js +51 -0
  71. package/dist/esm/components/slots/left-panel.js +26 -12
  72. package/dist/esm/components/slots/left-sidebar-without-resize.js +10 -10
  73. package/dist/esm/components/slots/left-sidebar.js +20 -16
  74. package/dist/esm/components/slots/main.js +49 -8
  75. package/dist/esm/components/slots/page-layout.js +12 -3
  76. package/dist/esm/components/slots/right-panel.js +26 -12
  77. package/dist/esm/components/slots/right-sidebar.js +57 -14
  78. package/dist/esm/components/slots/top-navigation.js +27 -12
  79. package/dist/esm/controllers/sidebar-resize-context.js +2 -1
  80. package/dist/esm/controllers/sidebar-resize-controller.js +10 -5
  81. package/dist/esm/version.json +1 -1
  82. package/dist/types/common/hooks/index.d.ts +2 -0
  83. package/dist/types/common/hooks/use-is-sidebar-collapsing.d.ts +2 -0
  84. package/dist/types/common/hooks/use-is-sidebar-dragging.d.ts +2 -0
  85. package/dist/types/components/resize-control/shadow.d.ts +6 -0
  86. package/dist/types/components/slots/internal/left-sidebar-inner.d.ts +9 -0
  87. package/dist/types/components/slots/internal/left-sidebar-outer.d.ts +13 -0
  88. package/dist/types/components/slots/internal/resizable-children-wrapper.d.ts +10 -0
  89. package/dist/types/components/slots/internal/slot-focus-ring.d.ts +19 -0
  90. package/dist/types/controllers/sidebar-resize-context.d.ts +1 -0
  91. package/package.json +14 -9
  92. package/dist/cjs/components/resize-control/styles.js +0 -156
  93. package/dist/cjs/components/skip-links/styles.js +0 -58
  94. package/dist/cjs/components/slots/left-sidebar-styles.js +0 -116
  95. package/dist/cjs/components/slots/styles.js +0 -154
  96. package/dist/es2019/components/resize-control/styles.js +0 -136
  97. package/dist/es2019/components/skip-links/styles.js +0 -41
  98. package/dist/es2019/components/slots/left-sidebar-styles.js +0 -96
  99. package/dist/es2019/components/slots/styles.js +0 -130
  100. package/dist/esm/components/resize-control/styles.js +0 -131
  101. package/dist/esm/components/skip-links/styles.js +0 -45
  102. package/dist/esm/components/slots/left-sidebar-styles.js +0 -94
  103. package/dist/esm/components/slots/styles.js +0 -117
  104. package/dist/types/components/resize-control/styles.d.ts +0 -41
  105. package/dist/types/components/skip-links/styles.d.ts +0 -2
  106. package/dist/types/components/slots/left-sidebar-styles.d.ts +0 -5
  107. 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.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`21534d3647e`](https://bitbucket.org/atlassian/atlassian-frontend/commits/21534d3647e) - [ux] Update theme colours and remove shadow from resize bar
14
+
15
+ ### Patch Changes
16
+
17
+ - [`ac9343c3ed4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ac9343c3ed4) - Replaces usage of deprecated design tokens. No visual or functional changes
18
+ - [`ad0e912661a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad0e912661a) - Styles have been rewritten to be static, in preparation for compiled adoption.
19
+ - [`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.
20
+ - [`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.
21
+ - Updated dependencies
22
+
23
+ ## 1.1.0
24
+
25
+ ### Minor Changes
26
+
27
+ - [`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.
28
+
29
+ ### Patch Changes
30
+
31
+ - Updated dependencies
32
+
3
33
  ## 1.0.7
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
  >
@@ -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 _constants = require("../../common/constants");
18
+ var _colors = require("@atlaskit/theme/colors");
19
19
 
20
- var _styles = require("./styles");
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: (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
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 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",
@@ -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 _constants = require("../../common/constants");
20
+ var _curves = require("@atlaskit/motion/curves");
21
+
22
+ var _durations = require("@atlaskit/motion/durations");
21
23
 
22
- var _styles = require("./styles");
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: (0, _styles.resizeIconButtonCSS)(isLeftSidebarCollapsed),
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: _styles.increaseHitArea
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;