@atlaskit/page-layout 1.0.6 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +3 -3
- package/__perf__/utils/perf-example.tsx +27 -18
- package/__perf__/utils/product-integration/Create.tsx +5 -1
- package/__perf__/utils/product-integration/NotificationsPopup.tsx +6 -5
- package/__perf__/utils/product-integration/SampleFooter.tsx +14 -13
- package/dist/cjs/common/constants.js +1 -1
- package/dist/cjs/common/hooks/index.js +23 -0
- package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +46 -0
- package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +46 -0
- package/dist/cjs/common/utils.js +3 -3
- package/dist/cjs/components/index.js +22 -22
- package/dist/cjs/components/resize-control/grab-area.js +43 -5
- package/dist/cjs/components/resize-control/index.js +24 -22
- package/dist/cjs/components/resize-control/resize-button.js +61 -5
- package/dist/cjs/components/resize-control/shadow.js +48 -0
- package/dist/cjs/components/skip-links/index.js +4 -4
- package/dist/cjs/components/skip-links/skip-link-components.js +53 -9
- package/dist/cjs/components/slots/banner.js +27 -11
- package/dist/cjs/components/slots/content.js +9 -2
- package/dist/cjs/components/slots/internal/left-sidebar-inner.js +65 -0
- package/dist/cjs/components/slots/internal/left-sidebar-outer.js +100 -0
- package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +63 -0
- package/dist/cjs/components/slots/internal/slot-focus-ring.js +61 -0
- package/dist/cjs/components/slots/left-panel.js +26 -11
- package/dist/cjs/components/slots/left-sidebar-without-resize.js +10 -10
- package/dist/cjs/components/slots/left-sidebar.js +23 -18
- package/dist/cjs/components/slots/main.js +53 -6
- package/dist/cjs/components/slots/page-layout.js +10 -3
- package/dist/cjs/components/slots/right-panel.js +26 -11
- package/dist/cjs/components/slots/right-sidebar.js +57 -13
- package/dist/cjs/components/slots/top-navigation.js +27 -11
- package/dist/cjs/controllers/index.js +14 -14
- package/dist/cjs/controllers/sidebar-resize-context.js +8 -5
- package/dist/cjs/controllers/sidebar-resize-controller.js +10 -5
- package/dist/cjs/controllers/skip-link-context.js +1 -1
- package/dist/cjs/index.js +34 -34
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/hooks/index.js +2 -0
- package/dist/es2019/common/hooks/use-is-sidebar-collapsing.js +29 -0
- package/dist/es2019/common/hooks/use-is-sidebar-dragging.js +29 -0
- package/dist/es2019/components/resize-control/grab-area.js +46 -4
- package/dist/es2019/components/resize-control/index.js +12 -9
- package/dist/es2019/components/resize-control/resize-button.js +61 -4
- package/dist/es2019/components/resize-control/shadow.js +43 -0
- package/dist/es2019/components/skip-links/skip-link-components.js +47 -5
- package/dist/es2019/components/slots/banner.js +21 -7
- package/dist/es2019/components/slots/content.js +8 -2
- package/dist/es2019/components/slots/internal/left-sidebar-inner.js +52 -0
- package/dist/es2019/components/slots/internal/left-sidebar-outer.js +79 -0
- package/dist/es2019/components/slots/internal/resizable-children-wrapper.js +49 -0
- package/dist/es2019/components/slots/internal/slot-focus-ring.js +50 -0
- package/dist/es2019/components/slots/left-panel.js +20 -7
- package/dist/es2019/components/slots/left-sidebar-without-resize.js +10 -11
- package/dist/es2019/components/slots/left-sidebar.js +20 -17
- package/dist/es2019/components/slots/main.js +46 -6
- package/dist/es2019/components/slots/page-layout.js +15 -3
- package/dist/es2019/components/slots/right-panel.js +20 -7
- package/dist/es2019/components/slots/right-sidebar.js +50 -8
- package/dist/es2019/components/slots/top-navigation.js +21 -7
- package/dist/es2019/controllers/sidebar-resize-context.js +2 -1
- package/dist/es2019/controllers/sidebar-resize-controller.js +10 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/hooks/index.js +2 -0
- package/dist/esm/common/hooks/use-is-sidebar-collapsing.js +34 -0
- package/dist/esm/common/hooks/use-is-sidebar-dragging.js +34 -0
- package/dist/esm/common/utils.js +2 -2
- package/dist/esm/components/resize-control/grab-area.js +44 -5
- package/dist/esm/components/resize-control/index.js +25 -22
- package/dist/esm/components/resize-control/resize-button.js +59 -5
- package/dist/esm/components/resize-control/shadow.js +37 -0
- package/dist/esm/components/skip-links/skip-link-components.js +49 -7
- package/dist/esm/components/slots/banner.js +27 -12
- package/dist/esm/components/slots/content.js +8 -2
- package/dist/esm/components/slots/internal/left-sidebar-inner.js +53 -0
- package/dist/esm/components/slots/internal/left-sidebar-outer.js +82 -0
- package/dist/esm/components/slots/internal/resizable-children-wrapper.js +51 -0
- package/dist/esm/components/slots/internal/slot-focus-ring.js +51 -0
- package/dist/esm/components/slots/left-panel.js +26 -12
- package/dist/esm/components/slots/left-sidebar-without-resize.js +10 -10
- package/dist/esm/components/slots/left-sidebar.js +22 -18
- package/dist/esm/components/slots/main.js +49 -8
- package/dist/esm/components/slots/page-layout.js +12 -3
- package/dist/esm/components/slots/right-panel.js +26 -12
- package/dist/esm/components/slots/right-sidebar.js +57 -14
- package/dist/esm/components/slots/top-navigation.js +27 -12
- package/dist/esm/controllers/sidebar-resize-context.js +6 -4
- package/dist/esm/controllers/sidebar-resize-controller.js +10 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/common/hooks/index.d.ts +2 -0
- package/dist/types/common/hooks/use-is-sidebar-collapsing.d.ts +2 -0
- package/dist/types/common/hooks/use-is-sidebar-dragging.d.ts +2 -0
- package/dist/types/components/resize-control/index.d.ts +1 -0
- package/dist/types/components/resize-control/resize-button.d.ts +1 -0
- package/dist/types/components/resize-control/shadow.d.ts +6 -0
- package/dist/types/components/slots/banner.d.ts +1 -0
- package/dist/types/components/slots/internal/left-sidebar-inner.d.ts +9 -0
- package/dist/types/components/slots/internal/left-sidebar-outer.d.ts +13 -0
- package/dist/types/components/slots/internal/resizable-children-wrapper.d.ts +10 -0
- package/dist/types/components/slots/internal/slot-focus-ring.d.ts +19 -0
- package/dist/types/components/slots/left-panel.d.ts +1 -0
- package/dist/types/components/slots/left-sidebar-without-resize.d.ts +1 -0
- package/dist/types/components/slots/left-sidebar.d.ts +1 -0
- package/dist/types/components/slots/main.d.ts +1 -0
- package/dist/types/components/slots/page-layout.d.ts +1 -0
- package/dist/types/components/slots/right-panel.d.ts +1 -0
- package/dist/types/components/slots/right-sidebar.d.ts +1 -0
- package/dist/types/components/slots/slot-dimensions.d.ts +1 -0
- package/dist/types/components/slots/top-navigation.d.ts +1 -0
- package/dist/types/controllers/sidebar-resize-context.d.ts +1 -0
- package/package.json +25 -20
- package/dist/cjs/components/resize-control/styles.js +0 -156
- package/dist/cjs/components/skip-links/styles.js +0 -58
- package/dist/cjs/components/slots/left-sidebar-styles.js +0 -116
- package/dist/cjs/components/slots/styles.js +0 -154
- package/dist/es2019/components/resize-control/styles.js +0 -136
- package/dist/es2019/components/skip-links/styles.js +0 -41
- package/dist/es2019/components/slots/left-sidebar-styles.js +0 -96
- package/dist/es2019/components/slots/styles.js +0 -130
- package/dist/esm/components/resize-control/styles.js +0 -131
- package/dist/esm/components/skip-links/styles.js +0 -45
- package/dist/esm/components/slots/left-sidebar-styles.js +0 -94
- package/dist/esm/components/slots/styles.js +0 -117
- package/dist/types/components/resize-control/styles.d.ts +0 -41
- package/dist/types/components/skip-links/styles.d.ts +0 -2
- package/dist/types/components/slots/left-sidebar-styles.d.ts +0 -5
- package/dist/types/components/slots/styles.d.ts +0 -23
|
@@ -17,11 +17,67 @@ var _core = require("@emotion/core");
|
|
|
17
17
|
|
|
18
18
|
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-right"));
|
|
19
19
|
|
|
20
|
+
var _curves = require("@atlaskit/motion/curves");
|
|
21
|
+
|
|
22
|
+
var _durations = require("@atlaskit/motion/durations");
|
|
23
|
+
|
|
24
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
25
|
+
|
|
20
26
|
var _constants = require("../../common/constants");
|
|
21
27
|
|
|
22
|
-
var
|
|
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
|
+
});
|
|
23
80
|
|
|
24
|
-
/** @jsx jsx */
|
|
25
81
|
var preventDefault = function preventDefault(event) {
|
|
26
82
|
return event.preventDefault();
|
|
27
83
|
};
|
|
@@ -32,13 +88,13 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
32
88
|
var isLeftSidebarCollapsed = _ref.isLeftSidebarCollapsed,
|
|
33
89
|
label = _ref.label,
|
|
34
90
|
testId = _ref.testId,
|
|
35
|
-
props = (0, _objectWithoutProperties2.default)(_ref,
|
|
91
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
36
92
|
return (0, _core.jsx)("button", (0, _extends2.default)({}, cssSelector, {
|
|
37
93
|
// DO NOT remove. used as a CSS selector.
|
|
38
94
|
"aria-expanded": !isLeftSidebarCollapsed,
|
|
39
95
|
"aria-label": label,
|
|
40
96
|
type: "button",
|
|
41
|
-
css:
|
|
97
|
+
css: [resizeIconButtonStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
|
|
42
98
|
"data-testid": testId // Prevents focus staying attached to the button
|
|
43
99
|
// when pressed
|
|
44
100
|
,
|
|
@@ -46,7 +102,7 @@ var ResizeButton = function ResizeButton(_ref) {
|
|
|
46
102
|
}, props), (0, _core.jsx)(_chevronRight.default, {
|
|
47
103
|
label: ""
|
|
48
104
|
}), (0, _core.jsx)("div", {
|
|
49
|
-
css:
|
|
105
|
+
css: increaseHitAreaStyles
|
|
50
106
|
}));
|
|
51
107
|
};
|
|
52
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;
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "SkipLink", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return _skipLinkComponents.
|
|
9
|
+
return _skipLinkComponents.SkipLink;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "SkipLinkWrapper", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return _skipLinkComponents.
|
|
15
|
+
return _skipLinkComponents.SkipLinkWrapper;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "useCustomSkipLink", {
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.SkipLinkWrapper = exports.SkipLink = void 0;
|
|
9
9
|
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
|
|
@@ -13,15 +13,55 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
13
13
|
|
|
14
14
|
var _core = require("@emotion/core");
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _motion = require("@atlaskit/motion");
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _constants = require("../../common/constants");
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
var _controllers = require("../../controllers");
|
|
23
23
|
|
|
24
|
-
function
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
29
|
+
var prefersReducedMotionStyles = (0, _core.css)((0, _motion.prefersReducedMotion)());
|
|
30
|
+
var skipLinkStyles = (0, _core.css)({
|
|
31
|
+
margin: 10,
|
|
32
|
+
padding: '0.8rem 1rem',
|
|
33
|
+
position: 'fixed',
|
|
34
|
+
zIndex: -1,
|
|
35
|
+
left: -999999,
|
|
36
|
+
background: "var(--ds-surface-overlay, white)",
|
|
37
|
+
border: 'none',
|
|
38
|
+
borderRadius: 3,
|
|
39
|
+
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), ")"),
|
|
40
|
+
opacity: 0,
|
|
41
|
+
|
|
42
|
+
/* Do the transform when focused */
|
|
43
|
+
transform: 'translateY(-50%)',
|
|
44
|
+
transition: "transform 0.3s ".concat(_motion.easeOut),
|
|
45
|
+
':focus-within': {
|
|
46
|
+
/**
|
|
47
|
+
* Max z-index is 2147483647. Skip links always be on top,
|
|
48
|
+
* but giving a few digits extra space just in case there's a future need.
|
|
49
|
+
*/
|
|
50
|
+
zIndex: 2147483640,
|
|
51
|
+
left: 0,
|
|
52
|
+
opacity: 1,
|
|
53
|
+
transform: 'translateY(0%)'
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var skipLinkListStyles = (0, _core.css)({
|
|
57
|
+
marginTop: 4,
|
|
58
|
+
paddingLeft: 0,
|
|
59
|
+
listStylePosition: 'outside',
|
|
60
|
+
listStyleType: 'none'
|
|
61
|
+
});
|
|
62
|
+
var skipLinkListItemStyles = (0, _core.css)({
|
|
63
|
+
marginTop: 0
|
|
64
|
+
});
|
|
25
65
|
|
|
26
66
|
var assignIndex = function assignIndex(num, arr) {
|
|
27
67
|
if (!arr.includes(num)) {
|
|
@@ -88,9 +128,11 @@ var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
|
|
|
88
128
|
return (0, _core.jsx)("div", {
|
|
89
129
|
onFocus: attachEscHandler,
|
|
90
130
|
onBlur: removeEscHandler,
|
|
91
|
-
css:
|
|
131
|
+
css: [skipLinkStyles, prefersReducedMotionStyles],
|
|
92
132
|
"data-skip-link-wrapper": true
|
|
93
|
-
}, (0, _core.jsx)("h5", null, skipLinksLabel), (0, _core.jsx)("ol",
|
|
133
|
+
}, (0, _core.jsx)("h5", null, skipLinksLabel), (0, _core.jsx)("ol", {
|
|
134
|
+
css: skipLinkListStyles
|
|
135
|
+
}, sortSkipLinks(skipLinksData).map(function (_ref2) {
|
|
94
136
|
var id = _ref2.id,
|
|
95
137
|
skipLinkTitle = _ref2.skipLinkTitle;
|
|
96
138
|
return (0, _core.jsx)(SkipLink, {
|
|
@@ -144,7 +186,9 @@ var SkipLink = function SkipLink(_ref3) {
|
|
|
144
186
|
children = _ref3.children,
|
|
145
187
|
isFocusable = _ref3.isFocusable,
|
|
146
188
|
title = _ref3.title;
|
|
147
|
-
return (0, _core.jsx)("li",
|
|
189
|
+
return (0, _core.jsx)("li", {
|
|
190
|
+
css: skipLinkListItemStyles
|
|
191
|
+
}, (0, _core.jsx)("a", {
|
|
148
192
|
tabIndex: isFocusable ? 0 : -1,
|
|
149
193
|
href: href,
|
|
150
194
|
onClick: focusTargetRef(href),
|
|
@@ -21,11 +21,23 @@ var _utils = require("../../common/utils");
|
|
|
21
21
|
|
|
22
22
|
var _controllers = require("../../controllers");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _slotFocusRing = _interopRequireDefault(require("./internal/slot-focus-ring"));
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _slotDimensions = _interopRequireDefault(require("./slot-dimensions"));
|
|
27
27
|
|
|
28
28
|
/** @jsx jsx */
|
|
29
|
+
var bannerStyles = (0, _core.css)({
|
|
30
|
+
height: _constants.BANNER_HEIGHT,
|
|
31
|
+
gridArea: _constants.BANNER
|
|
32
|
+
});
|
|
33
|
+
var bannerFixedStyles = (0, _core.css)({
|
|
34
|
+
position: 'fixed',
|
|
35
|
+
zIndex: 2,
|
|
36
|
+
top: 0,
|
|
37
|
+
right: _constants.RIGHT_PANEL_WIDTH,
|
|
38
|
+
left: _constants.LEFT_PANEL_WIDTH
|
|
39
|
+
});
|
|
40
|
+
|
|
29
41
|
var Banner = function Banner(props) {
|
|
30
42
|
var children = props.children,
|
|
31
43
|
_props$height = props.height,
|
|
@@ -41,17 +53,21 @@ var Banner = function Banner(props) {
|
|
|
41
53
|
(0, _controllers.publishGridState)((0, _defineProperty2.default)({}, _constants.VAR_BANNER_HEIGHT, bannerHeight));
|
|
42
54
|
return function () {
|
|
43
55
|
(0, _controllers.publishGridState)((0, _defineProperty2.default)({}, _constants.VAR_BANNER_HEIGHT, 0));
|
|
44
|
-
};
|
|
56
|
+
};
|
|
45
57
|
}, [bannerHeight]);
|
|
46
58
|
(0, _controllers.useSkipLink)(id, skipLinkTitle);
|
|
47
|
-
return (0, _core.jsx)(
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
return (0, _core.jsx)(_slotFocusRing.default, null, function (_ref) {
|
|
60
|
+
var className = _ref.className;
|
|
61
|
+
return (0, _core.jsx)("div", (0, _extends2.default)({
|
|
62
|
+
css: [bannerStyles, isFixed && bannerFixedStyles],
|
|
63
|
+
className: className,
|
|
64
|
+
"data-testid": testId,
|
|
65
|
+
id: id
|
|
66
|
+
}, (0, _utils.getPageLayoutSlotSelector)('banner')), (0, _core.jsx)(_slotDimensions.default, {
|
|
67
|
+
variableName: _constants.VAR_BANNER_HEIGHT,
|
|
68
|
+
value: bannerHeight
|
|
69
|
+
}), children);
|
|
70
|
+
});
|
|
55
71
|
};
|
|
56
72
|
|
|
57
73
|
var _default = Banner;
|
|
@@ -7,15 +7,22 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _core = require("@emotion/core");
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _constants = require("../../common/constants");
|
|
11
11
|
|
|
12
12
|
/** @jsx jsx */
|
|
13
|
+
var contentStyles = (0, _core.css)({
|
|
14
|
+
display: 'flex',
|
|
15
|
+
height: '100%',
|
|
16
|
+
position: 'relative',
|
|
17
|
+
gridArea: _constants.CONTENT
|
|
18
|
+
});
|
|
19
|
+
|
|
13
20
|
var Content = function Content(props) {
|
|
14
21
|
var children = props.children,
|
|
15
22
|
testId = props.testId;
|
|
16
23
|
return (0, _core.jsx)("div", {
|
|
17
24
|
"data-testid": testId,
|
|
18
|
-
css:
|
|
25
|
+
css: contentStyles
|
|
19
26
|
}, children);
|
|
20
27
|
};
|
|
21
28
|
|
|
@@ -0,0 +1,65 @@
|
|
|
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 _constants = require("../../../common/constants");
|
|
13
|
+
|
|
14
|
+
var _hooks = require("../../../common/hooks");
|
|
15
|
+
|
|
16
|
+
/** @jsx jsx */
|
|
17
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
18
|
+
var prefersReducedMotionStyles = (0, _core.css)((0, _motion.prefersReducedMotion)());
|
|
19
|
+
/**
|
|
20
|
+
* This inner wrapper is required to allow the sidebar to be `position: fixed`.
|
|
21
|
+
*
|
|
22
|
+
* If we were to apply `position: fixed` to the outer wrapper, it will be popped
|
|
23
|
+
* out of its flex container and Main would stretch to occupy all the space.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var fixedInnerStyles = (0, _core.css)({
|
|
27
|
+
width: "".concat(_constants.LEFT_SIDEBAR_WIDTH),
|
|
28
|
+
position: 'fixed',
|
|
29
|
+
top: "calc(".concat(_constants.BANNER_HEIGHT, " + ").concat(_constants.TOP_NAVIGATION_HEIGHT, ")"),
|
|
30
|
+
bottom: 0,
|
|
31
|
+
left: "".concat(_constants.LEFT_PANEL_WIDTH),
|
|
32
|
+
transition: "width ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s")
|
|
33
|
+
});
|
|
34
|
+
var fixedInnerFlyoutStyles = (0, _core.css)({
|
|
35
|
+
width: _constants.LEFT_SIDEBAR_FLYOUT_WIDTH
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Static in the sense of `position: static`.
|
|
39
|
+
*
|
|
40
|
+
* It will expand the page height to fit its content.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
var staticInnerStyles = (0, _core.css)({
|
|
44
|
+
height: '100%'
|
|
45
|
+
});
|
|
46
|
+
var draggingStyles = (0, _core.css)({
|
|
47
|
+
cursor: 'ew-resize',
|
|
48
|
+
// Make sure drag to resize does not animate as the user drags
|
|
49
|
+
transition: 'none'
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
var LeftSidebarInner = function LeftSidebarInner(_ref) {
|
|
53
|
+
var children = _ref.children,
|
|
54
|
+
_ref$isFixed = _ref.isFixed,
|
|
55
|
+
isFixed = _ref$isFixed === void 0 ? false : _ref$isFixed,
|
|
56
|
+
_ref$isFlyoutOpen = _ref.isFlyoutOpen,
|
|
57
|
+
isFlyoutOpen = _ref$isFlyoutOpen === void 0 ? false : _ref$isFlyoutOpen;
|
|
58
|
+
var isDragging = (0, _hooks.useIsSidebarDragging)();
|
|
59
|
+
return (0, _core.jsx)("div", {
|
|
60
|
+
css: [!isFixed && staticInnerStyles, isFixed && fixedInnerStyles, isFixed && isFlyoutOpen && fixedInnerFlyoutStyles, isDragging && draggingStyles, prefersReducedMotionStyles]
|
|
61
|
+
}, children);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
var _default = LeftSidebarInner;
|
|
65
|
+
exports.default = _default;
|
|
@@ -0,0 +1,100 @@
|
|
|
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
var _core = require("@emotion/core");
|
|
15
|
+
|
|
16
|
+
var _motion = require("@atlaskit/motion");
|
|
17
|
+
|
|
18
|
+
var _constants = require("../../../common/constants");
|
|
19
|
+
|
|
20
|
+
var _hooks = require("../../../common/hooks");
|
|
21
|
+
|
|
22
|
+
var _utils = require("../../../common/utils");
|
|
23
|
+
|
|
24
|
+
var _slotFocusRing = _interopRequireDefault(require("./slot-focus-ring"));
|
|
25
|
+
|
|
26
|
+
/** @jsx jsx */
|
|
27
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
28
|
+
var prefersReducedMotionStyles = (0, _core.css)((0, _motion.prefersReducedMotion)());
|
|
29
|
+
var outerStyles = (0, _core.css)({
|
|
30
|
+
width: _constants.LEFT_SIDEBAR_WIDTH,
|
|
31
|
+
marginLeft: 0,
|
|
32
|
+
position: 'relative',
|
|
33
|
+
zIndex: 1,
|
|
34
|
+
transition: "width ".concat(_constants.TRANSITION_DURATION, "ms ").concat(_motion.easeOut, " 0s"),
|
|
35
|
+
':hover': {
|
|
36
|
+
'--ds--resize-button--opacity': 1
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
var draggingStyles = (0, _core.css)({
|
|
40
|
+
cursor: 'ew-resize',
|
|
41
|
+
// Make sure drag to resize does not animate as the user drags
|
|
42
|
+
transition: 'none'
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* In fixed mode this element's child is taken out of the document flow.
|
|
46
|
+
* It doesn't take up the width as expected,
|
|
47
|
+
* so the pseudo element forces it to take up the necessary width.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
var fixedStyles = (0, _core.css)({
|
|
51
|
+
'::after': {
|
|
52
|
+
display: 'inline-block',
|
|
53
|
+
width: "".concat(_constants.LEFT_SIDEBAR_WIDTH),
|
|
54
|
+
content: "''"
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
var flyoutStyles = (0, _core.css)({
|
|
58
|
+
width: _constants.LEFT_SIDEBAR_FLYOUT_WIDTH
|
|
59
|
+
});
|
|
60
|
+
var flyoutFixedStyles = (0, _core.css)({
|
|
61
|
+
width: _constants.COLLAPSED_LEFT_SIDEBAR_WIDTH
|
|
62
|
+
});
|
|
63
|
+
var selector = (0, _utils.getPageLayoutSlotSelector)('left-sidebar');
|
|
64
|
+
|
|
65
|
+
var LeftSidebarOuter = function LeftSidebarOuter(_ref, ref) {
|
|
66
|
+
var children = _ref.children,
|
|
67
|
+
_ref$isFixed = _ref.isFixed,
|
|
68
|
+
isFixed = _ref$isFixed === void 0 ? false : _ref$isFixed,
|
|
69
|
+
_ref$isFlyoutOpen = _ref.isFlyoutOpen,
|
|
70
|
+
isFlyoutOpen = _ref$isFlyoutOpen === void 0 ? false : _ref$isFlyoutOpen,
|
|
71
|
+
testId = _ref.testId,
|
|
72
|
+
onMouseLeave = _ref.onMouseLeave,
|
|
73
|
+
onMouseOver = _ref.onMouseOver,
|
|
74
|
+
id = _ref.id;
|
|
75
|
+
var isDragging = (0, _hooks.useIsSidebarDragging)();
|
|
76
|
+
return (0, _core.jsx)(_slotFocusRing.default, {
|
|
77
|
+
isSidebar: true
|
|
78
|
+
}, function (_ref2) {
|
|
79
|
+
var className = _ref2.className;
|
|
80
|
+
return (
|
|
81
|
+
/**
|
|
82
|
+
* The mouse handlers control flyout behavior, a mouse-only experience.
|
|
83
|
+
*/
|
|
84
|
+
// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
85
|
+
(0, _core.jsx)("div", (0, _extends2.default)({
|
|
86
|
+
css: [outerStyles, isFixed && fixedStyles, isFlyoutOpen && flyoutStyles, isFlyoutOpen && isFixed && flyoutFixedStyles, isDragging && draggingStyles, prefersReducedMotionStyles],
|
|
87
|
+
className: className,
|
|
88
|
+
"data-testid": testId,
|
|
89
|
+
id: id,
|
|
90
|
+
onMouseOver: onMouseOver,
|
|
91
|
+
onMouseLeave: onMouseLeave,
|
|
92
|
+
ref: ref
|
|
93
|
+
}, selector), children)
|
|
94
|
+
);
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var _default = /*#__PURE__*/(0, _react.forwardRef)(LeftSidebarOuter);
|
|
99
|
+
|
|
100
|
+
exports.default = _default;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 _constants = require("../../../common/constants");
|
|
13
|
+
|
|
14
|
+
var _hooks = require("../../../common/hooks");
|
|
15
|
+
|
|
16
|
+
/** @jsx jsx */
|
|
17
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
18
|
+
var prefersReducedMotionStyles = (0, _core.css)((0, _motion.prefersReducedMotion)());
|
|
19
|
+
/**
|
|
20
|
+
* The transition duration is intentionally set to 0ms.
|
|
21
|
+
*
|
|
22
|
+
* A transition is being used here to delay the setting of
|
|
23
|
+
* opacity and visibility so that it syncs collapsing sidebar.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
var hideLeftSidebarContentsStyles = (0, _core.css)({
|
|
27
|
+
opacity: 0,
|
|
28
|
+
transition: "opacity 0ms linear, visibility 0ms linear",
|
|
29
|
+
transitionDelay: "".concat(_constants.TRANSITION_DURATION - 100, "ms"),
|
|
30
|
+
visibility: 'hidden'
|
|
31
|
+
});
|
|
32
|
+
var resizableChildrenWrapperStyles = (0, _core.css)({
|
|
33
|
+
height: '100%',
|
|
34
|
+
opacity: 1,
|
|
35
|
+
overflow: 'hidden auto',
|
|
36
|
+
transition: 'none',
|
|
37
|
+
visibility: 'visible'
|
|
38
|
+
});
|
|
39
|
+
var fixedChildrenWrapperStyles = (0, _core.css)({
|
|
40
|
+
minWidth: 240,
|
|
41
|
+
height: '100%'
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
var ResizableChildrenWrapper = function ResizableChildrenWrapper(_ref) {
|
|
45
|
+
var children = _ref.children,
|
|
46
|
+
_ref$isLeftSidebarCol = _ref.isLeftSidebarCollapsed,
|
|
47
|
+
isLeftSidebarCollapsed = _ref$isLeftSidebarCol === void 0 ? false : _ref$isLeftSidebarCol,
|
|
48
|
+
_ref$hasCollapsedStat = _ref.hasCollapsedState,
|
|
49
|
+
hasCollapsedState = _ref$hasCollapsedStat === void 0 ? false : _ref$hasCollapsedStat,
|
|
50
|
+
_ref$isFlyoutOpen = _ref.isFlyoutOpen,
|
|
51
|
+
isFlyoutOpen = _ref$isFlyoutOpen === void 0 ? false : _ref$isFlyoutOpen;
|
|
52
|
+
var isCollapsing = (0, _hooks.useIsSidebarCollapsing)();
|
|
53
|
+
var isCollapsed = isLeftSidebarCollapsed || hasCollapsedState;
|
|
54
|
+
var isHidden = isCollapsing || isCollapsed && !isFlyoutOpen;
|
|
55
|
+
return (0, _core.jsx)("div", {
|
|
56
|
+
css: [resizableChildrenWrapperStyles, isHidden && hideLeftSidebarContentsStyles, prefersReducedMotionStyles]
|
|
57
|
+
}, (0, _core.jsx)("div", {
|
|
58
|
+
css: fixedChildrenWrapperStyles
|
|
59
|
+
}, children));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var _default = ResizableChildrenWrapper;
|
|
63
|
+
exports.default = _default;
|
|
@@ -0,0 +1,61 @@
|
|
|
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 _colors = require("@atlaskit/theme/colors");
|
|
11
|
+
|
|
12
|
+
/** @jsx jsx */
|
|
13
|
+
var focusStyles = (0, _core.css)({
|
|
14
|
+
':focus': {
|
|
15
|
+
outline: 'none',
|
|
16
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
17
|
+
'> div': {
|
|
18
|
+
boxShadow: "0px 0px 0px 2px inset ".concat("var(--ds-border-focused, ".concat(_colors.B100, ")")),
|
|
19
|
+
outline: 'none'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Sidebars have an outer and inner component,
|
|
25
|
+
* so the nested selector needs to target an extra level deeper.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
var sidebarFocusStyles = (0, _core.css)({
|
|
29
|
+
':focus': {
|
|
30
|
+
outline: 'none',
|
|
31
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
32
|
+
'> div > div': {
|
|
33
|
+
boxShadow: "0px 0px 0px 2px inset ".concat("var(--ds-border-focused, ".concat(_colors.B100, ")")),
|
|
34
|
+
outline: 'none'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* We don't use `@atlaskit/focus-ring` here,
|
|
40
|
+
* because we need inset focus styles and:
|
|
41
|
+
*
|
|
42
|
+
* 1. If we set them directly to the layout element,
|
|
43
|
+
* then any child element's background will cover the shadow.
|
|
44
|
+
* 2. We cannot wrap `children` in `FocusRing`,
|
|
45
|
+
* because there's no guarantee the passed child takes `className`.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
var SlotFocusRing = function SlotFocusRing(_ref) {
|
|
49
|
+
var children = _ref.children,
|
|
50
|
+
_ref$isSidebar = _ref.isSidebar,
|
|
51
|
+
isSidebar = _ref$isSidebar === void 0 ? false : _ref$isSidebar;
|
|
52
|
+
return (0, _core.jsx)(_core.ClassNames, null, function (_ref2) {
|
|
53
|
+
var css = _ref2.css;
|
|
54
|
+
return children({
|
|
55
|
+
className: isSidebar ? css(sidebarFocusStyles) : css(focusStyles)
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var _default = SlotFocusRing;
|
|
61
|
+
exports.default = _default;
|