@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
@@ -1,116 +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.resizeableChildrenWrapperStyle = exports.leftSidebarStyles = exports.fixedLeftSidebarInnerStyles = exports.fixedChildrenWrapperStyle = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _motion = require("@atlaskit/motion");
13
-
14
- var _constants = require("../../common/constants");
15
-
16
- var _utils = require("../../common/utils");
17
-
18
- var _styles = require("./styles");
19
-
20
- 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; }
21
-
22
- 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; }
23
-
24
- // This inner wrapper is required to allow the
25
- // sidebar to be position: fixed. If we were to apply position: fixed
26
- // to the outer wrapper, it will be popped out of it's flex container
27
- // and Main would stretch to occupy all the space.
28
- var fixedLeftSidebarInnerStyles = function fixedLeftSidebarInnerStyles(isFixed, isFlyoutOpen, isLeftSidebarCollapsed) {
29
- return _objectSpread(_objectSpread(_objectSpread({}, _styles.focusStyles), isFixed ? _objectSpread((0, _defineProperty2.default)({
30
- position: 'fixed',
31
- top: "calc(".concat(_constants.BANNER_HEIGHT, " + ").concat(_constants.TOP_NAVIGATION_HEIGHT, ")"),
32
- left: "".concat(_constants.LEFT_PANEL_WIDTH),
33
- bottom: 0,
34
- width: "".concat(_constants.LEFT_SIDEBAR_WIDTH),
35
- transition: "width ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s")
36
- }, "[".concat(_constants.IS_SIDEBAR_DRAGGING, "] &"), {
37
- // Make sure drag to resize does not animate as the user drags
38
- transition: 'none',
39
- cursor: 'ew-resize'
40
- }), isFlyoutOpen && {
41
- width: _constants.LEFT_SIDEBAR_FLYOUT_WIDTH
42
- }) : {
43
- height: '100%'
44
- }), (0, _motion.prefersReducedMotion)());
45
- };
46
-
47
- exports.fixedLeftSidebarInnerStyles = fixedLeftSidebarInnerStyles;
48
-
49
- var leftSidebarStyles = function leftSidebarStyles(isFixed, isFlyoutOpen) {
50
- var _objectSpread3;
51
-
52
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread3 = {
53
- position: 'relative',
54
- width: "".concat(_constants.LEFT_SIDEBAR_WIDTH),
55
- transition: "width ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s"),
56
- zIndex: 1,
57
- // Make resize affordance appear on top of content
58
- marginLeft: 0
59
- }, (0, _defineProperty2.default)(_objectSpread3, "[".concat(_constants.IS_SIDEBAR_DRAGGING, "] &"), {
60
- // Make sure drag to resize does not animate as the user drags
61
- transition: 'none',
62
- cursor: 'ew-resize'
63
- }), (0, _defineProperty2.default)(_objectSpread3, "&:hover [".concat(_constants.RESIZE_BUTTON_SELECTOR, "]"), {
64
- opacity: 1
65
- }), _objectSpread3), isFlyoutOpen && {
66
- width: _constants.LEFT_SIDEBAR_FLYOUT_WIDTH
67
- }), isFlyoutOpen && !isFixed && (0, _defineProperty2.default)({}, "& + ".concat((0, _utils.getPageLayoutSlotCSSSelector)('main')), {
68
- // adds a negative left margin to main
69
- // which transitions at the same speed
70
- // with which left sidebars width increases
71
- // This give an illusion that the flyout is appearing
72
- // on top of the main content, while main remains in place
73
- marginLeft: "calc(-1 * var(--".concat(_constants.VAR_LEFT_SIDEBAR_FLYOUT, ", ").concat(_constants.DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, "px) + ").concat(_constants.COLLAPSED_LEFT_SIDEBAR_WIDTH, "px)")
74
- })), isFixed && _objectSpread({
75
- // in fixed mode this element's child is taken out of the document flow
76
- // It doesn't take up the width as expected
77
- // psuedo element forces it to take up the necessary width
78
- '&::after': {
79
- content: "''",
80
- display: 'inline-block',
81
- width: "".concat(_constants.LEFT_SIDEBAR_WIDTH)
82
- }
83
- }, isFlyoutOpen && {
84
- width: _constants.COLLAPSED_LEFT_SIDEBAR_WIDTH
85
- })), _styles.focusStyles), (0, _motion.prefersReducedMotion)());
86
- };
87
-
88
- exports.leftSidebarStyles = leftSidebarStyles;
89
-
90
- var resizeableChildrenWrapperStyle = function resizeableChildrenWrapperStyle(isFlyoutOpen, isLeftSidebarCollapsed, collapsedState) {
91
- return _objectSpread((0, _defineProperty2.default)({
92
- visibility: 'visible',
93
- transition: 'none',
94
- opacity: 1,
95
- overflow: 'hidden auto',
96
- height: '100%'
97
- }, "[".concat(_constants.IS_SIDEBAR_COLLAPSING, "] &"), hideLeftSidebarContents), (isLeftSidebarCollapsed || collapsedState) && !isFlyoutOpen && hideLeftSidebarContents);
98
- };
99
-
100
- exports.resizeableChildrenWrapperStyle = resizeableChildrenWrapperStyle;
101
-
102
- var hideLeftSidebarContents = _objectSpread({
103
- // the transition duration is intentionally set to 0ms
104
- // transition is being used here to delay the setting of
105
- // opacity and visibility so that it syncs collapsing sidebar.
106
- transition: "opacity 0ms linear, visibility 0ms linear",
107
- transitionDelay: "".concat(_constants.TRANSITION_DURATION - 100, "ms"),
108
- opacity: 0,
109
- visibility: 'hidden'
110
- }, (0, _motion.prefersReducedMotion)());
111
-
112
- var fixedChildrenWrapperStyle = {
113
- height: '100%',
114
- minWidth: '240px'
115
- };
116
- exports.fixedChildrenWrapperStyle = fixedChildrenWrapperStyle;
@@ -1,154 +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.topNavigationStyles = exports.rightSidebarStyles = exports.rightPanelStyles = exports.mainStyles = exports.leftPanelStyles = exports.gridStyles = exports.focusStyles = exports.fixedRightSidebarInnerStyles = exports.contentStyles = exports.bannerStyles = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
- var _core = require("@emotion/core");
15
-
16
- var _motion = require("@atlaskit/motion");
17
-
18
- var _constants = require("../../common/constants");
19
-
20
- var _templateObject, _templateObject2;
21
-
22
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
23
-
24
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
25
-
26
- var gridTemplateAreas = "\n \"".concat(_constants.LEFT_PANEL, " ").concat(_constants.BANNER, " ").concat(_constants.RIGHT_PANEL, "\"\n \"").concat(_constants.LEFT_PANEL, " ").concat(_constants.TOP_NAVIGATION, " ").concat(_constants.RIGHT_PANEL, "\"\n \"").concat(_constants.LEFT_PANEL, " ").concat(_constants.CONTENT, " ").concat(_constants.RIGHT_PANEL, "\"\n ");
27
- var gridStyles = (0, _core.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n outline: none;\n\n display: grid;\n height: 100%;\n // prettier-ignore\n grid-template-columns: ", " minmax(0, 1fr) ", ";\n grid-template-rows:\n ", " ", "\n auto;\n grid-template-areas: ", ";\n"])), _constants.LEFT_PANEL_WIDTH, _constants.RIGHT_PANEL_WIDTH, _constants.BANNER_HEIGHT, _constants.TOP_NAVIGATION_HEIGHT, gridTemplateAreas);
28
- exports.gridStyles = gridStyles;
29
- var contentStyles = (0, _core.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n grid-area: ", ";\n display: flex;\n height: 100%;\n position: relative;\n"])), _constants.CONTENT);
30
- exports.contentStyles = contentStyles;
31
- var focusStyles = {
32
- '&:focus': {
33
- outline: 'none',
34
- '& [data-wrapper-element]': {
35
- outline: 'none',
36
- boxShadow: '0px 0px 0px 2px inset #4C9AFF'
37
- },
38
- '& > div:not([data-skip-link-wrapper])': {
39
- outline: 'none',
40
- boxShadow: '0px 0px 0px 2px inset #4C9AFF'
41
- }
42
- }
43
- };
44
- exports.focusStyles = focusStyles;
45
-
46
- var bannerStyles = function bannerStyles(isFixed) {
47
- return _objectSpread(_objectSpread({
48
- gridArea: "".concat(_constants.BANNER),
49
- height: "".concat(_constants.BANNER_HEIGHT)
50
- }, focusStyles), isFixed && {
51
- position: 'fixed',
52
- top: 0,
53
- left: "".concat(_constants.LEFT_PANEL_WIDTH),
54
- right: "".concat(_constants.RIGHT_PANEL_WIDTH),
55
- zIndex: 2
56
- });
57
- };
58
-
59
- exports.bannerStyles = bannerStyles;
60
-
61
- var topNavigationStyles = function topNavigationStyles(isFixed) {
62
- return _objectSpread(_objectSpread({
63
- gridArea: "".concat(_constants.TOP_NAVIGATION),
64
- height: "".concat(_constants.TOP_NAVIGATION_HEIGHT)
65
- }, focusStyles), isFixed && {
66
- position: 'fixed',
67
- top: "".concat(_constants.BANNER_HEIGHT),
68
- left: "".concat(_constants.LEFT_PANEL_WIDTH),
69
- right: "".concat(_constants.RIGHT_PANEL_WIDTH),
70
- zIndex: 2
71
- });
72
- };
73
-
74
- exports.topNavigationStyles = topNavigationStyles;
75
-
76
- var mainStyles = _objectSpread(_objectSpread({}, focusStyles), {}, (0, _defineProperty2.default)({
77
- // Prevent flex container from blowing
78
- // up when there's super wide content
79
- flexGrow: 1,
80
- minWidth: 0,
81
- // Transition negative margin on main
82
- // in sync with the increase in width of
83
- // leftSidebar
84
- transition: "margin-left ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s"),
85
- marginLeft: 0
86
- }, "[".concat(_constants.IS_SIDEBAR_DRAGGING, "] &"), {
87
- // Make sure drag to resize remains snappy
88
- transition: 'none',
89
- cursor: 'ew-resize'
90
- }), (0, _motion.prefersReducedMotion)()); // This inner wrapper is required to allow the
91
- // sidebar to be position: fixed. If we were to apply position: fixed
92
- // to the outer wrapper, it will be popped out of it's flex container
93
- // and Main would stretch to occupy all the space.
94
-
95
-
96
- exports.mainStyles = mainStyles;
97
-
98
- var fixedRightSidebarInnerStyles = function fixedRightSidebarInnerStyles(isFixed) {
99
- return _objectSpread(_objectSpread({}, focusStyles), isFixed ? {
100
- position: 'fixed',
101
- top: "calc(".concat(_constants.BANNER_HEIGHT, " + ").concat(_constants.TOP_NAVIGATION_HEIGHT, ")"),
102
- right: "calc(".concat(_constants.RIGHT_PANEL_WIDTH, ")"),
103
- bottom: 0
104
- } : {
105
- height: '100%'
106
- });
107
- };
108
-
109
- exports.fixedRightSidebarInnerStyles = fixedRightSidebarInnerStyles;
110
-
111
- var rightSidebarStyles = function rightSidebarStyles(isFixed) {
112
- return _objectSpread(_objectSpread({
113
- width: "".concat(_constants.RIGHT_SIDEBAR_WIDTH)
114
- }, focusStyles), isFixed && {
115
- // in fixed mode this element's child is taken out of the document flow
116
- // It doesn't take up the width as expected
117
- // psuedo element forces it to take up the necessary width
118
- '&::after': {
119
- content: "''",
120
- display: 'inline-block',
121
- width: "".concat(_constants.RIGHT_SIDEBAR_WIDTH)
122
- }
123
- });
124
- };
125
-
126
- exports.rightSidebarStyles = rightSidebarStyles;
127
-
128
- var rightPanelStyles = function rightPanelStyles(isFixed) {
129
- return _objectSpread(_objectSpread({
130
- gridArea: _constants.RIGHT_PANEL
131
- }, focusStyles), isFixed && {
132
- position: 'fixed',
133
- width: "".concat(_constants.RIGHT_PANEL_WIDTH),
134
- top: 0,
135
- bottom: 0,
136
- right: 0
137
- });
138
- };
139
-
140
- exports.rightPanelStyles = rightPanelStyles;
141
-
142
- var leftPanelStyles = function leftPanelStyles(isFixed) {
143
- return _objectSpread(_objectSpread({
144
- gridArea: _constants.LEFT_PANEL
145
- }, focusStyles), isFixed && {
146
- position: 'fixed',
147
- width: "".concat(_constants.LEFT_PANEL_WIDTH),
148
- top: 0,
149
- bottom: 0,
150
- left: 0
151
- });
152
- };
153
-
154
- exports.leftPanelStyles = leftPanelStyles;
@@ -1,136 +0,0 @@
1
- import { easeOut, mediumDurationMs, smallDurationMs } from '@atlaskit/motion';
2
- import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
3
- import { GRAB_AREA_LINE_SELECTOR, GRAB_AREA_SELECTOR, IS_SIDEBAR_DRAGGING, RESIZE_BUTTON_SELECTOR } from '../../common/constants';
4
- export const resizeControlCSS = (setIsGrabAreaFocused, isLeftSidebarCollapsed) => ({
5
- left: '100%',
6
- top: 0,
7
- bottom: 0,
8
- position: 'absolute',
9
- outline: 'none',
10
- [`[${GRAB_AREA_SELECTOR}]:enabled`]: {
11
- [`&:hover [${GRAB_AREA_LINE_SELECTOR}]`]: {
12
- backgroundColor: B100
13
- },
14
- [`&:active [${GRAB_AREA_LINE_SELECTOR}] , &:focus [${GRAB_AREA_LINE_SELECTOR}]`]: {
15
- backgroundColor: B200
16
- },
17
- [`&:hover [${RESIZE_BUTTON_SELECTOR}]:not(:focus):not(:hover)`]: {
18
- color: B100
19
- },
20
- [`&:hover [${RESIZE_BUTTON_SELECTOR}]`]: {
21
- opacity: 1
22
- }
23
- },
24
- [`[${RESIZE_BUTTON_SELECTOR}]`]: {
25
- opacity: setIsGrabAreaFocused || isLeftSidebarCollapsed ? 1 : 0
26
- }
27
- });
28
- export const resizeIconButtonCSS = isCollapsed => ({
29
- backgroundColor: N0,
30
- position: 'absolute',
31
- top: 32,
32
- left: 0,
33
- transform: 'translateX(-50%)',
34
- border: 0,
35
- borderRadius: '50%',
36
- boxShadow: `0 0 0 1px ${N30A}, 0 2px 4px 1px ${N30A}`,
37
- color: N200,
38
- cursor: 'pointer',
39
- height: 24,
40
- opacity: 0,
41
- outline: 0,
42
- padding: 0,
43
- transition: `
44
- background-color ${smallDurationMs}ms linear,
45
- color ${smallDurationMs}ms linear,
46
- opacity ${mediumDurationMs}ms ${easeOut}
47
- `,
48
- width: 24,
49
- ':hover': {
50
- backgroundColor: B100,
51
- color: N0,
52
- opacity: 1
53
- },
54
- ':active': {
55
- backgroundColor: B200,
56
- color: N0,
57
- opacity: 1
58
- },
59
- ':focus': {
60
- backgroundColor: B200,
61
- color: N0,
62
- opacity: 1
63
- },
64
- ...(!isCollapsed && {
65
- transform: 'rotate(180deg)',
66
- transformOrigin: 7,
67
- opacity: 1
68
- }),
69
- [`[${IS_SIDEBAR_DRAGGING}] &`]: {
70
- opacity: 1
71
- }
72
- });
73
- export const grabAreaCSS = isLeftSidebarCollapsed => ({
74
- cursor: 'ew-resize',
75
- height: '100%',
76
- width: '24px',
77
- padding: 0,
78
- border: 0,
79
- backgroundColor: 'transparent',
80
- ['&::-moz-focus-inner']: {
81
- border: 0
82
- },
83
- [':focus']: {
84
- outline: 0
85
- },
86
- ...(isLeftSidebarCollapsed && {
87
- padding: 0,
88
- border: 0,
89
- backgroundColor: 'transparent',
90
- cursor: 'default'
91
- })
92
- });
93
- export const lineCSS = isLeftSidebarCollapsed => ({
94
- display: 'block',
95
- height: '100%',
96
- transition: 'background-color 200ms',
97
- width: 2,
98
- ...(isLeftSidebarCollapsed && {
99
- '&&': {
100
- backgroundColor: 'transparent'
101
- }
102
- })
103
- });
104
- export const increaseHitArea = {
105
- position: 'absolute',
106
- left: -8,
107
- right: -12,
108
- bottom: -8,
109
- top: -8
110
- };
111
- const colorStops = `
112
- rgba(0, 0, 0, 0.2) 0px,
113
- rgba(0, 0, 0, 0.2) 1px,
114
- rgba(0, 0, 0, 0.1) 1px,
115
- rgba(0, 0, 0, 0) 100%
116
- `;
117
- const direction = 'to left';
118
- const transitionDuration = '0.22s';
119
- export const shadowCSS = {
120
- background: `linear-gradient(${direction}, ${colorStops})`,
121
- bottom: 0,
122
- top: 0,
123
- left: -1,
124
- opacity: 0.5,
125
- pointerEvents: 'none',
126
- position: 'absolute',
127
- transitionDuration,
128
- transitionProperty: 'left, opacity, width',
129
- transitionTimingFunction: easeOut,
130
- width: 3,
131
- [`[${IS_SIDEBAR_DRAGGING}] &`]: {
132
- opacity: 0.8,
133
- width: 6,
134
- left: -6
135
- }
136
- };
@@ -1,41 +0,0 @@
1
- import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
2
- import { N30A, N60A } from '@atlaskit/theme/colors';
3
- export const skipLinkStyles = {
4
- zIndex: -1,
5
- left: -999999,
6
- position: 'fixed',
7
- opacity: 0,
8
- background: 'white',
9
- border: 'none',
10
- padding: '0.8rem 1rem',
11
- boxShadow: `0 0 0 1px ${N30A}, 0 2px 10px ${N30A}, 0 0 20px -4px ${N60A}`,
12
- borderRadius: '3px',
13
- margin: 10,
14
-
15
- /* Do the transform when focused */
16
- ...prefersReducedMotion(),
17
- transform: 'translateY(-50%)',
18
- transition: `transform 0.3s ${easeOut}`,
19
- ':focus-within': {
20
- transform: 'translateY(0%)',
21
- opacity: 1,
22
- left: 0,
23
-
24
- /* Max z-index is 2147483647. Skip links always be on top,
25
- but giving a few digits extra space just in case there's
26
- a future need. */
27
- zIndex: 2147483640
28
- },
29
- '& > span': {
30
- fontWeight: 'bold'
31
- },
32
- '> ol': {
33
- listStyleType: 'none',
34
- listStylePosition: 'outside',
35
- paddingLeft: 0,
36
- marginTop: '4px',
37
- '> li': {
38
- marginTop: 0
39
- }
40
- }
41
- };
@@ -1,96 +0,0 @@
1
- import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
2
- import { BANNER_HEIGHT, COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, IS_SIDEBAR_COLLAPSING, IS_SIDEBAR_DRAGGING, LEFT_PANEL_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, RESIZE_BUTTON_SELECTOR, TOP_NAVIGATION_HEIGHT, TRANSITION_DURATION, VAR_LEFT_SIDEBAR_FLYOUT } from '../../common/constants';
3
- import { getPageLayoutSlotCSSSelector } from '../../common/utils';
4
- import { focusStyles } from './styles'; // This inner wrapper is required to allow the
5
- // sidebar to be position: fixed. If we were to apply position: fixed
6
- // to the outer wrapper, it will be popped out of it's flex container
7
- // and Main would stretch to occupy all the space.
8
-
9
- export const fixedLeftSidebarInnerStyles = (isFixed, isFlyoutOpen, isLeftSidebarCollapsed) => ({ ...focusStyles,
10
- ...(isFixed ? {
11
- position: 'fixed',
12
- top: `calc(${BANNER_HEIGHT} + ${TOP_NAVIGATION_HEIGHT})`,
13
- left: `${LEFT_PANEL_WIDTH}`,
14
- bottom: 0,
15
- width: `${LEFT_SIDEBAR_WIDTH}`,
16
- transition: `width ${TRANSITION_DURATION}ms ${easeOut} 0s`,
17
- [`[${IS_SIDEBAR_DRAGGING}] &`]: {
18
- // Make sure drag to resize does not animate as the user drags
19
- transition: 'none',
20
- cursor: 'ew-resize'
21
- },
22
- ...(isFlyoutOpen && {
23
- width: LEFT_SIDEBAR_FLYOUT_WIDTH
24
- })
25
- } : {
26
- height: '100%'
27
- }),
28
- ...prefersReducedMotion()
29
- });
30
- export const leftSidebarStyles = (isFixed, isFlyoutOpen) => ({
31
- position: 'relative',
32
- width: `${LEFT_SIDEBAR_WIDTH}`,
33
- transition: `width ${TRANSITION_DURATION}ms ${easeOut} 0s`,
34
- zIndex: 1,
35
- // Make resize affordance appear on top of content
36
- marginLeft: 0,
37
- [`[${IS_SIDEBAR_DRAGGING}] &`]: {
38
- // Make sure drag to resize does not animate as the user drags
39
- transition: 'none',
40
- cursor: 'ew-resize'
41
- },
42
- [`&:hover [${RESIZE_BUTTON_SELECTOR}]`]: {
43
- opacity: 1
44
- },
45
- ...(isFlyoutOpen && {
46
- width: LEFT_SIDEBAR_FLYOUT_WIDTH
47
- }),
48
- ...(isFlyoutOpen && !isFixed && {
49
- [`& + ${getPageLayoutSlotCSSSelector('main')}`]: {
50
- // adds a negative left margin to main
51
- // which transitions at the same speed
52
- // with which left sidebars width increases
53
- // This give an illusion that the flyout is appearing
54
- // on top of the main content, while main remains in place
55
- marginLeft: `calc(-1 * var(--${VAR_LEFT_SIDEBAR_FLYOUT}, ${DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH}px) + ${COLLAPSED_LEFT_SIDEBAR_WIDTH}px)`
56
- }
57
- }),
58
- ...(isFixed && {
59
- // in fixed mode this element's child is taken out of the document flow
60
- // It doesn't take up the width as expected
61
- // psuedo element forces it to take up the necessary width
62
- '&::after': {
63
- content: "''",
64
- display: 'inline-block',
65
- width: `${LEFT_SIDEBAR_WIDTH}`
66
- },
67
- ...(isFlyoutOpen && {
68
- width: COLLAPSED_LEFT_SIDEBAR_WIDTH
69
- })
70
- }),
71
- ...focusStyles,
72
- ...prefersReducedMotion()
73
- });
74
- export const resizeableChildrenWrapperStyle = (isFlyoutOpen, isLeftSidebarCollapsed, collapsedState) => ({
75
- visibility: 'visible',
76
- transition: 'none',
77
- opacity: 1,
78
- overflow: 'hidden auto',
79
- height: '100%',
80
- [`[${IS_SIDEBAR_COLLAPSING}] &`]: hideLeftSidebarContents,
81
- ...((isLeftSidebarCollapsed || collapsedState) && !isFlyoutOpen && hideLeftSidebarContents)
82
- });
83
- const hideLeftSidebarContents = {
84
- // the transition duration is intentionally set to 0ms
85
- // transition is being used here to delay the setting of
86
- // opacity and visibility so that it syncs collapsing sidebar.
87
- transition: `opacity 0ms linear, visibility 0ms linear`,
88
- transitionDelay: `${TRANSITION_DURATION - 100}ms`,
89
- opacity: 0,
90
- visibility: 'hidden',
91
- ...prefersReducedMotion()
92
- };
93
- export const fixedChildrenWrapperStyle = {
94
- height: '100%',
95
- minWidth: '240px'
96
- };
@@ -1,130 +0,0 @@
1
- import { css } from '@emotion/core';
2
- import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
3
- import { BANNER, BANNER_HEIGHT, CONTENT, IS_SIDEBAR_DRAGGING, LEFT_PANEL, LEFT_PANEL_WIDTH, RIGHT_PANEL, RIGHT_PANEL_WIDTH, RIGHT_SIDEBAR_WIDTH, TOP_NAVIGATION, TOP_NAVIGATION_HEIGHT, TRANSITION_DURATION } from '../../common/constants';
4
- const gridTemplateAreas = `
5
- "${LEFT_PANEL} ${BANNER} ${RIGHT_PANEL}"
6
- "${LEFT_PANEL} ${TOP_NAVIGATION} ${RIGHT_PANEL}"
7
- "${LEFT_PANEL} ${CONTENT} ${RIGHT_PANEL}"
8
- `;
9
- export const gridStyles = css`
10
- outline: none;
11
-
12
- display: grid;
13
- height: 100%;
14
- // prettier-ignore
15
- grid-template-columns: ${LEFT_PANEL_WIDTH} minmax(0, 1fr) ${RIGHT_PANEL_WIDTH};
16
- grid-template-rows:
17
- ${BANNER_HEIGHT} ${TOP_NAVIGATION_HEIGHT}
18
- auto;
19
- grid-template-areas: ${gridTemplateAreas};
20
- `;
21
- export const contentStyles = css`
22
- grid-area: ${CONTENT};
23
- display: flex;
24
- height: 100%;
25
- position: relative;
26
- `;
27
- export const focusStyles = {
28
- '&:focus': {
29
- outline: 'none',
30
- '& [data-wrapper-element]': {
31
- outline: 'none',
32
- boxShadow: '0px 0px 0px 2px inset #4C9AFF'
33
- },
34
- '& > div:not([data-skip-link-wrapper])': {
35
- outline: 'none',
36
- boxShadow: '0px 0px 0px 2px inset #4C9AFF'
37
- }
38
- }
39
- };
40
- export const bannerStyles = isFixed => ({
41
- gridArea: `${BANNER}`,
42
- height: `${BANNER_HEIGHT}`,
43
- ...focusStyles,
44
- ...(isFixed && {
45
- position: 'fixed',
46
- top: 0,
47
- left: `${LEFT_PANEL_WIDTH}`,
48
- right: `${RIGHT_PANEL_WIDTH}`,
49
- zIndex: 2
50
- })
51
- });
52
- export const topNavigationStyles = isFixed => ({
53
- gridArea: `${TOP_NAVIGATION}`,
54
- height: `${TOP_NAVIGATION_HEIGHT}`,
55
- ...focusStyles,
56
- ...(isFixed && {
57
- position: 'fixed',
58
- top: `${BANNER_HEIGHT}`,
59
- left: `${LEFT_PANEL_WIDTH}`,
60
- right: `${RIGHT_PANEL_WIDTH}`,
61
- zIndex: 2
62
- })
63
- });
64
- export const mainStyles = { ...focusStyles,
65
- // Prevent flex container from blowing
66
- // up when there's super wide content
67
- flexGrow: 1,
68
- minWidth: 0,
69
- // Transition negative margin on main
70
- // in sync with the increase in width of
71
- // leftSidebar
72
- transition: `margin-left ${TRANSITION_DURATION}ms ${easeOut} 0s`,
73
- marginLeft: 0,
74
- [`[${IS_SIDEBAR_DRAGGING}] &`]: {
75
- // Make sure drag to resize remains snappy
76
- transition: 'none',
77
- cursor: 'ew-resize'
78
- },
79
- ...prefersReducedMotion()
80
- }; // This inner wrapper is required to allow the
81
- // sidebar to be position: fixed. If we were to apply position: fixed
82
- // to the outer wrapper, it will be popped out of it's flex container
83
- // and Main would stretch to occupy all the space.
84
-
85
- export const fixedRightSidebarInnerStyles = isFixed => ({ ...focusStyles,
86
- ...(isFixed ? {
87
- position: 'fixed',
88
- top: `calc(${BANNER_HEIGHT} + ${TOP_NAVIGATION_HEIGHT})`,
89
- right: `calc(${RIGHT_PANEL_WIDTH})`,
90
- bottom: 0
91
- } : {
92
- height: '100%'
93
- })
94
- });
95
- export const rightSidebarStyles = isFixed => ({
96
- width: `${RIGHT_SIDEBAR_WIDTH}`,
97
- ...focusStyles,
98
- ...(isFixed && {
99
- // in fixed mode this element's child is taken out of the document flow
100
- // It doesn't take up the width as expected
101
- // psuedo element forces it to take up the necessary width
102
- '&::after': {
103
- content: "''",
104
- display: 'inline-block',
105
- width: `${RIGHT_SIDEBAR_WIDTH}`
106
- }
107
- })
108
- });
109
- export const rightPanelStyles = isFixed => ({
110
- gridArea: RIGHT_PANEL,
111
- ...focusStyles,
112
- ...(isFixed && {
113
- position: 'fixed',
114
- width: `${RIGHT_PANEL_WIDTH}`,
115
- top: 0,
116
- bottom: 0,
117
- right: 0
118
- })
119
- });
120
- export const leftPanelStyles = isFixed => ({
121
- gridArea: LEFT_PANEL,
122
- ...focusStyles,
123
- ...(isFixed && {
124
- position: 'fixed',
125
- width: `${LEFT_PANEL_WIDTH}`,
126
- top: 0,
127
- bottom: 0,
128
- left: 0
129
- })
130
- });