@atlaskit/page-layout 1.1.0 → 1.2.2

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