@atlaskit/page-layout 4.3.1 → 4.3.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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/common/constants.js +19 -0
- package/dist/cjs/common/get-grid-state-from-storage.js +13 -0
- package/dist/cjs/common/get-left-panel-width.js +13 -0
- package/dist/cjs/common/get-left-sidebar-percentage.js +17 -0
- package/dist/cjs/common/get-page-layout-slot-css-selector.js +10 -0
- package/dist/cjs/common/get-page-layout-slot-selector.js +12 -0
- package/dist/cjs/common/merge-grid-state-into-storage.js +22 -0
- package/dist/cjs/common/remove-from-grid-state-in-storage.js +18 -0
- package/dist/cjs/common/resolve-dimension.js +16 -0
- package/dist/cjs/components/resize-control/index.js +7 -6
- package/dist/cjs/components/skip-links/skip-link-components.js +11 -174
- package/dist/cjs/components/skip-links/skip-link-wrapper.js +130 -0
- package/dist/cjs/components/skip-links/skip-link.js +63 -0
- package/dist/cjs/components/skip-links/use-custom-skip-link.js +5 -0
- package/dist/cjs/components/slots/banner-slot.js +6 -3
- package/dist/cjs/components/slots/content.js +2 -0
- package/dist/cjs/components/slots/internal/left-sidebar-outer.js +2 -2
- package/dist/cjs/components/slots/left-panel.js +6 -3
- package/dist/cjs/components/slots/left-sidebar-without-resize.js +4 -2
- package/dist/cjs/components/slots/left-sidebar.js +10 -6
- package/dist/cjs/components/slots/main.js +4 -2
- package/dist/cjs/components/slots/page-layout.js +6 -0
- package/dist/cjs/components/slots/right-panel.js +6 -3
- package/dist/cjs/components/slots/right-sidebar.js +6 -3
- package/dist/cjs/components/slots/top-navigation.js +6 -3
- package/dist/cjs/controllers/index.js +6 -3
- package/dist/cjs/controllers/sidebar-resize-context.js +2 -50
- package/dist/cjs/controllers/sidebar-resize-controller.js +2 -2
- package/dist/cjs/controllers/skip-link-context.js +3 -13
- package/dist/cjs/controllers/skip-link-controller.js +2 -2
- package/dist/cjs/controllers/skip-links-context.js +15 -0
- package/dist/cjs/controllers/use-left-sidebar-flyout-lock.js +49 -0
- package/dist/cjs/controllers/use-page-layout-grid.js +4 -3
- package/dist/cjs/controllers/use-page-layout-resize.js +20 -0
- package/dist/cjs/controllers/use-skip-links.js +11 -0
- package/dist/cjs/entry-points/sidebar-resize-context.js +4 -3
- package/dist/es2019/common/constants.js +19 -0
- package/dist/es2019/common/get-grid-state-from-storage.js +6 -0
- package/dist/es2019/common/get-left-panel-width.js +7 -0
- package/dist/es2019/common/get-left-sidebar-percentage.js +11 -0
- package/dist/es2019/common/get-page-layout-slot-css-selector.js +2 -0
- package/dist/es2019/common/get-page-layout-slot-selector.js +4 -0
- package/dist/es2019/common/merge-grid-state-into-storage.js +14 -0
- package/dist/es2019/common/remove-from-grid-state-in-storage.js +11 -0
- package/dist/es2019/common/resolve-dimension.js +8 -0
- package/dist/es2019/components/resize-control/index.js +2 -1
- package/dist/es2019/components/skip-links/skip-link-components.js +2 -165
- package/dist/es2019/components/skip-links/skip-link-wrapper.js +114 -0
- package/dist/es2019/components/skip-links/skip-link.js +54 -0
- package/dist/es2019/components/skip-links/use-custom-skip-link.js +6 -0
- package/dist/es2019/components/slots/banner-slot.js +4 -1
- package/dist/es2019/components/slots/content.js +2 -0
- package/dist/es2019/components/slots/internal/left-sidebar-outer.js +1 -1
- package/dist/es2019/components/slots/left-panel.js +4 -1
- package/dist/es2019/components/slots/left-sidebar-without-resize.js +3 -1
- package/dist/es2019/components/slots/left-sidebar.js +5 -1
- package/dist/es2019/components/slots/main.js +3 -1
- package/dist/es2019/components/slots/page-layout.js +6 -0
- package/dist/es2019/components/slots/right-panel.js +4 -1
- package/dist/es2019/components/slots/right-sidebar.js +4 -1
- package/dist/es2019/components/slots/top-navigation.js +4 -1
- package/dist/es2019/controllers/index.js +5 -2
- package/dist/es2019/controllers/sidebar-resize-context.js +2 -45
- package/dist/es2019/controllers/sidebar-resize-controller.js +1 -1
- package/dist/es2019/controllers/skip-link-context.js +2 -9
- package/dist/es2019/controllers/skip-link-controller.js +1 -1
- package/dist/es2019/controllers/skip-links-context.js +8 -0
- package/dist/es2019/controllers/use-left-sidebar-flyout-lock.js +39 -0
- package/dist/es2019/controllers/use-page-layout-grid.js +2 -1
- package/dist/es2019/controllers/use-page-layout-resize.js +12 -0
- package/dist/es2019/controllers/use-skip-links.js +3 -0
- package/dist/es2019/entry-points/sidebar-resize-context.js +2 -1
- package/dist/esm/common/constants.js +19 -0
- package/dist/esm/common/get-grid-state-from-storage.js +6 -0
- package/dist/esm/common/get-left-panel-width.js +7 -0
- package/dist/esm/common/get-left-sidebar-percentage.js +11 -0
- package/dist/esm/common/get-page-layout-slot-css-selector.js +4 -0
- package/dist/esm/common/get-page-layout-slot-selector.js +5 -0
- package/dist/esm/common/merge-grid-state-into-storage.js +15 -0
- package/dist/esm/common/remove-from-grid-state-in-storage.js +11 -0
- package/dist/esm/common/resolve-dimension.js +10 -0
- package/dist/esm/components/resize-control/index.js +2 -1
- package/dist/esm/components/skip-links/skip-link-components.js +2 -179
- package/dist/esm/components/skip-links/skip-link-wrapper.js +127 -0
- package/dist/esm/components/skip-links/skip-link.js +55 -0
- package/dist/esm/components/skip-links/use-custom-skip-link.js +6 -0
- package/dist/esm/components/slots/banner-slot.js +4 -1
- package/dist/esm/components/slots/content.js +2 -0
- package/dist/esm/components/slots/internal/left-sidebar-outer.js +1 -1
- package/dist/esm/components/slots/left-panel.js +4 -1
- package/dist/esm/components/slots/left-sidebar-without-resize.js +3 -1
- package/dist/esm/components/slots/left-sidebar.js +5 -1
- package/dist/esm/components/slots/main.js +3 -1
- package/dist/esm/components/slots/page-layout.js +6 -0
- package/dist/esm/components/slots/right-panel.js +4 -1
- package/dist/esm/components/slots/right-sidebar.js +4 -1
- package/dist/esm/components/slots/top-navigation.js +4 -1
- package/dist/esm/controllers/index.js +5 -2
- package/dist/esm/controllers/sidebar-resize-context.js +2 -50
- package/dist/esm/controllers/sidebar-resize-controller.js +1 -1
- package/dist/esm/controllers/skip-link-context.js +2 -11
- package/dist/esm/controllers/skip-link-controller.js +1 -1
- package/dist/esm/controllers/skip-links-context.js +8 -0
- package/dist/esm/controllers/use-left-sidebar-flyout-lock.js +43 -0
- package/dist/esm/controllers/use-page-layout-grid.js +2 -1
- package/dist/esm/controllers/use-page-layout-resize.js +13 -0
- package/dist/esm/controllers/use-skip-links.js +5 -0
- package/dist/esm/entry-points/sidebar-resize-context.js +2 -1
- package/dist/types/common/constants.d.ts +18 -0
- package/dist/types/common/get-grid-state-from-storage.d.ts +1 -0
- package/dist/types/common/get-left-panel-width.d.ts +1 -0
- package/dist/types/common/get-left-sidebar-percentage.d.ts +1 -0
- package/dist/types/common/get-page-layout-slot-css-selector.d.ts +1 -0
- package/dist/types/common/get-page-layout-slot-selector.d.ts +3 -0
- package/dist/types/common/merge-grid-state-into-storage.d.ts +1 -0
- package/dist/types/common/remove-from-grid-state-in-storage.d.ts +1 -0
- package/dist/types/common/resolve-dimension.d.ts +2 -0
- package/dist/types/common/types.d.ts +14 -2
- package/dist/types/components/resize-control/types.d.ts +1 -1
- package/dist/types/components/skip-links/skip-link-components.d.ts +2 -20
- package/dist/types/components/skip-links/skip-link-wrapper.d.ts +14 -0
- package/dist/types/components/skip-links/skip-link.d.ts +10 -0
- package/dist/types/components/skip-links/use-custom-skip-link.d.ts +5 -0
- package/dist/types/components/slots/banner-slot.d.ts +2 -0
- package/dist/types/components/slots/content.d.ts +2 -0
- package/dist/types/components/slots/left-panel.d.ts +2 -0
- package/dist/types/components/slots/left-sidebar-without-resize.d.ts +2 -0
- package/dist/types/components/slots/left-sidebar.d.ts +2 -0
- package/dist/types/components/slots/main.d.ts +2 -0
- package/dist/types/components/slots/page-layout.d.ts +2 -0
- package/dist/types/components/slots/right-panel.d.ts +2 -0
- package/dist/types/components/slots/right-sidebar.d.ts +2 -0
- package/dist/types/components/slots/top-navigation.d.ts +2 -0
- package/dist/types/controllers/index.d.ts +5 -2
- package/dist/types/controllers/sidebar-resize-context.d.ts +1 -39
- package/dist/types/controllers/skip-link-context.d.ts +1 -4
- package/dist/types/controllers/skip-links-context.d.ts +3 -0
- package/dist/types/controllers/types.d.ts +13 -0
- package/dist/types/controllers/use-left-sidebar-flyout-lock.d.ts +20 -0
- package/dist/types/controllers/use-page-layout-resize.d.ts +16 -0
- package/dist/types/controllers/use-skip-links.d.ts +2 -0
- package/dist/types/entry-points/sidebar-resize-context.d.ts +3 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types-ts4.5/common/constants.d.ts +18 -0
- package/dist/types-ts4.5/common/get-grid-state-from-storage.d.ts +1 -0
- package/dist/types-ts4.5/common/get-left-panel-width.d.ts +1 -0
- package/dist/types-ts4.5/common/get-left-sidebar-percentage.d.ts +1 -0
- package/dist/types-ts4.5/common/get-page-layout-slot-css-selector.d.ts +1 -0
- package/dist/types-ts4.5/common/get-page-layout-slot-selector.d.ts +3 -0
- package/dist/types-ts4.5/common/merge-grid-state-into-storage.d.ts +1 -0
- package/dist/types-ts4.5/common/remove-from-grid-state-in-storage.d.ts +1 -0
- package/dist/types-ts4.5/common/resolve-dimension.d.ts +2 -0
- package/dist/types-ts4.5/common/types.d.ts +14 -2
- package/dist/types-ts4.5/components/resize-control/types.d.ts +1 -1
- package/dist/types-ts4.5/components/skip-links/skip-link-components.d.ts +2 -20
- package/dist/types-ts4.5/components/skip-links/skip-link-wrapper.d.ts +14 -0
- package/dist/types-ts4.5/components/skip-links/skip-link.d.ts +10 -0
- package/dist/types-ts4.5/components/skip-links/use-custom-skip-link.d.ts +5 -0
- package/dist/types-ts4.5/components/slots/banner-slot.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/content.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/left-panel.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/left-sidebar-without-resize.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/left-sidebar.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/main.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/page-layout.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/right-panel.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/right-sidebar.d.ts +2 -0
- package/dist/types-ts4.5/components/slots/top-navigation.d.ts +2 -0
- package/dist/types-ts4.5/controllers/index.d.ts +5 -2
- package/dist/types-ts4.5/controllers/sidebar-resize-context.d.ts +1 -39
- package/dist/types-ts4.5/controllers/skip-link-context.d.ts +1 -4
- package/dist/types-ts4.5/controllers/skip-links-context.d.ts +3 -0
- package/dist/types-ts4.5/controllers/types.d.ts +13 -0
- package/dist/types-ts4.5/controllers/use-left-sidebar-flyout-lock.d.ts +20 -0
- package/dist/types-ts4.5/controllers/use-page-layout-resize.d.ts +16 -0
- package/dist/types-ts4.5/controllers/use-skip-links.d.ts +2 -0
- package/dist/types-ts4.5/entry-points/sidebar-resize-context.d.ts +3 -2
- package/dist/types-ts4.5/index.d.ts +2 -1
- package/package.json +8 -8
- package/dist/cjs/common/utils.js +0 -66
- package/dist/es2019/common/utils.js +0 -55
- package/dist/esm/common/utils.js +0 -60
- package/dist/types/common/utils.d.ts +0 -12
- package/dist/types-ts4.5/common/utils.d.ts +0 -12
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
6
|
+
/**
|
|
7
|
+
* @jsxRuntime classic
|
|
8
|
+
* @jsx jsx
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
12
|
+
import { css, jsx } from '@emotion/react';
|
|
13
|
+
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
14
|
+
import { DEFAULT_I18N_PROPS_SKIP_LINKS, PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
|
|
15
|
+
import { useSkipLinks } from '../../controllers';
|
|
16
|
+
import { SkipLink } from './skip-link';
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
18
|
+
var prefersReducedMotionStyles = css(prefersReducedMotion());
|
|
19
|
+
var skipLinkStyles = css({
|
|
20
|
+
margin: "var(--ds-space-250, 20px)",
|
|
21
|
+
padding: '0.8rem 1rem',
|
|
22
|
+
position: 'fixed',
|
|
23
|
+
zIndex: -1,
|
|
24
|
+
backgroundColor: "var(--ds-surface-overlay, #FFFFFF)",
|
|
25
|
+
border: 'none',
|
|
26
|
+
borderRadius: "var(--ds-radius-small, 3px)",
|
|
27
|
+
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)",
|
|
28
|
+
insetInlineStart: -999999,
|
|
29
|
+
opacity: 0,
|
|
30
|
+
transform: 'translateY(-50%)',
|
|
31
|
+
transition: "transform 0.3s ".concat(easeOut),
|
|
32
|
+
'&:focus-within': {
|
|
33
|
+
zIndex: 2147483640,
|
|
34
|
+
insetInlineStart: 0,
|
|
35
|
+
opacity: 1,
|
|
36
|
+
transform: 'translateY(0%)'
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
var skipLinkHeadingStyles = css({
|
|
40
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)"
|
|
41
|
+
});
|
|
42
|
+
var skipLinkListStyles = css({
|
|
43
|
+
listStylePosition: 'outside',
|
|
44
|
+
listStyleType: 'none',
|
|
45
|
+
marginBlockStart: "var(--ds-space-050, 4px)",
|
|
46
|
+
paddingInlineStart: 0
|
|
47
|
+
});
|
|
48
|
+
var _assignIndex = function assignIndex(num, arr) {
|
|
49
|
+
if (!arr.includes(num)) {
|
|
50
|
+
return num;
|
|
51
|
+
}
|
|
52
|
+
return _assignIndex(num + 1, arr);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The default label will be used when the `skipLinksLabel` attribute is not
|
|
57
|
+
* provided or the attribute is an empty string. If a string comprised only of
|
|
58
|
+
* spaces is provided, the skip link heading element will be removed, but the
|
|
59
|
+
* default label will still be used in `title` attribute of the skip links
|
|
60
|
+
* themselves.
|
|
61
|
+
*/
|
|
62
|
+
export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
|
|
63
|
+
var skipLinksLabel = _ref.skipLinksLabel;
|
|
64
|
+
var _useSkipLinks = useSkipLinks(),
|
|
65
|
+
skipLinksData = _useSkipLinks.skipLinksData;
|
|
66
|
+
if (skipLinksData.length === 0) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
var sortSkipLinks = function sortSkipLinks(arr) {
|
|
70
|
+
var customLinks = arr.filter(function (link) {
|
|
71
|
+
return Number.isInteger(link.listIndex);
|
|
72
|
+
});
|
|
73
|
+
if (customLinks.length === 0) {
|
|
74
|
+
return arr;
|
|
75
|
+
}
|
|
76
|
+
var usedIndexes = customLinks.map(function (a) {
|
|
77
|
+
return a.listIndex;
|
|
78
|
+
});
|
|
79
|
+
var regularLinksWithIdx = arr.filter(function (link) {
|
|
80
|
+
return link.listIndex === undefined;
|
|
81
|
+
}).map(function (link, idx) {
|
|
82
|
+
var listIndex = _assignIndex(idx, usedIndexes);
|
|
83
|
+
usedIndexes.push(listIndex);
|
|
84
|
+
return _objectSpread(_objectSpread({}, link), {}, {
|
|
85
|
+
listIndex: listIndex
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
return [].concat(_toConsumableArray(customLinks), _toConsumableArray(regularLinksWithIdx)).sort(function (a, b) {
|
|
89
|
+
return a.listIndex - b.listIndex;
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
var escapeHandler = function escapeHandler(event) {
|
|
93
|
+
if (event.keyCode === 27) {
|
|
94
|
+
var container = document.querySelector("[".concat(PAGE_LAYOUT_CONTAINER_SELECTOR, "=\"true\"]") // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
95
|
+
);
|
|
96
|
+
if (container !== null) {
|
|
97
|
+
container.focus();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var attachEscHandler = function attachEscHandler() {
|
|
102
|
+
return window.addEventListener('keydown', escapeHandler, false);
|
|
103
|
+
};
|
|
104
|
+
var removeEscHandler = function removeEscHandler() {
|
|
105
|
+
return window.removeEventListener('keydown', escapeHandler, false);
|
|
106
|
+
};
|
|
107
|
+
var emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
|
|
108
|
+
var label = skipLinksLabel || DEFAULT_I18N_PROPS_SKIP_LINKS;
|
|
109
|
+
return jsx("div", {
|
|
110
|
+
onFocus: attachEscHandler,
|
|
111
|
+
onBlur: removeEscHandler,
|
|
112
|
+
css: [skipLinkStyles, prefersReducedMotionStyles],
|
|
113
|
+
"data-skip-link-wrapper": true
|
|
114
|
+
}, emptyLabelOverride ? null : jsx("p", {
|
|
115
|
+
css: skipLinkHeadingStyles
|
|
116
|
+
}, label), jsx("ol", {
|
|
117
|
+
css: skipLinkListStyles
|
|
118
|
+
}, sortSkipLinks(skipLinksData).map(function (_ref2) {
|
|
119
|
+
var id = _ref2.id,
|
|
120
|
+
skipLinkTitle = _ref2.skipLinkTitle;
|
|
121
|
+
return jsx(SkipLink, {
|
|
122
|
+
key: id,
|
|
123
|
+
href: "#".concat(id),
|
|
124
|
+
isFocusable: true
|
|
125
|
+
}, skipLinkTitle);
|
|
126
|
+
})));
|
|
127
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled
|
|
8
|
+
import { css, jsx } from '@emotion/react';
|
|
9
|
+
import Link from '@atlaskit/link';
|
|
10
|
+
var skipLinkListItemStyles = css({
|
|
11
|
+
marginBlockStart: 0
|
|
12
|
+
});
|
|
13
|
+
var focusTargetRef = function focusTargetRef(href) {
|
|
14
|
+
return function (event) {
|
|
15
|
+
event.preventDefault();
|
|
16
|
+
var targetRef = document.querySelector(href);
|
|
17
|
+
|
|
18
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
var key = event.which || event.keycode;
|
|
21
|
+
// if it is a keypress and the key is not
|
|
22
|
+
// space or enter, just ignore it.
|
|
23
|
+
if (key && key !== 13 && key !== 32) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (targetRef) {
|
|
27
|
+
targetRef.setAttribute('tabindex', '-1');
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
targetRef.addEventListener('blur', handleBlur);
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
targetRef.focus();
|
|
32
|
+
document.activeElement && document.activeElement.scrollIntoView({
|
|
33
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
34
|
+
behavior: 'smooth'
|
|
35
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
36
|
+
});
|
|
37
|
+
window.scrollTo(0, 0);
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
44
|
+
export var SkipLink = function SkipLink(_ref) {
|
|
45
|
+
var href = _ref.href,
|
|
46
|
+
children = _ref.children,
|
|
47
|
+
isFocusable = _ref.isFocusable;
|
|
48
|
+
return jsx("li", {
|
|
49
|
+
css: skipLinkListItemStyles
|
|
50
|
+
}, jsx(Link, {
|
|
51
|
+
tabIndex: isFocusable ? 0 : -1,
|
|
52
|
+
href: href,
|
|
53
|
+
onClick: focusTargetRef(href)
|
|
54
|
+
}, children));
|
|
55
|
+
};
|
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
6
|
import { useSkipLinks } from '../../controllers';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* __useCustomSkipLink__
|
|
10
|
+
*
|
|
11
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
12
|
+
*/
|
|
7
13
|
export var useCustomSkipLink = function useCustomSkipLink(id, skipLinkTitle) {
|
|
8
14
|
var listIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
9
15
|
var _useSkipLinks = useSkipLinks(),
|
|
@@ -9,7 +9,8 @@ import { useEffect } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { BANNER, BANNER_HEIGHT, DEFAULT_BANNER_HEIGHT, LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, VAR_BANNER_HEIGHT } from '../../common/constants';
|
|
12
|
-
import { getPageLayoutSlotSelector
|
|
12
|
+
import { getPageLayoutSlotSelector } from '../../common/get-page-layout-slot-selector';
|
|
13
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
13
14
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
14
15
|
import SlotFocusRing from './internal/slot-focus-ring';
|
|
15
16
|
import SlotDimensions from './slot-dimensions';
|
|
@@ -36,6 +37,8 @@ var bannerFixedStyles = css({
|
|
|
36
37
|
*
|
|
37
38
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
38
39
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
40
|
+
*
|
|
41
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
39
42
|
*/
|
|
40
43
|
var Banner = function Banner(props) {
|
|
41
44
|
var children = props.children,
|
|
@@ -21,6 +21,8 @@ var contentStyles = css({
|
|
|
21
21
|
*
|
|
22
22
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
23
23
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
24
|
+
*
|
|
25
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
24
26
|
*/
|
|
25
27
|
var Content = function Content(props) {
|
|
26
28
|
var children = props.children,
|
|
@@ -11,8 +11,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
11
11
|
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
12
12
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
13
13
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, LEFT_SIDEBAR_FLYOUT_WIDTH, LEFT_SIDEBAR_WIDTH, MAX_MOBILE_SIDEBAR_FLYOUT_WIDTH, MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, TRANSITION_DURATION } from '../../../common/constants';
|
|
14
|
+
import { getPageLayoutSlotSelector } from '../../../common/get-page-layout-slot-selector';
|
|
14
15
|
import { useIsSidebarDragging } from '../../../common/hooks';
|
|
15
|
-
import { getPageLayoutSlotSelector } from '../../../common/utils';
|
|
16
16
|
import { SidebarResizeContext } from '../../../controllers';
|
|
17
17
|
import SlotFocusRing from './slot-focus-ring';
|
|
18
18
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
@@ -9,7 +9,8 @@ import { useEffect } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { DEFAULT_LEFT_PANEL_WIDTH, LEFT_PANEL, LEFT_PANEL_WIDTH, VAR_LEFT_PANEL_WIDTH } from '../../common/constants';
|
|
12
|
-
import { getPageLayoutSlotSelector
|
|
12
|
+
import { getPageLayoutSlotSelector } from '../../common/get-page-layout-slot-selector';
|
|
13
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
13
14
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
14
15
|
import SlotFocusRing from './internal/slot-focus-ring';
|
|
15
16
|
import SlotDimensions from './slot-dimensions';
|
|
@@ -33,6 +34,8 @@ var leftPanelFixedStyles = css({
|
|
|
33
34
|
*
|
|
34
35
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
35
36
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
37
|
+
*
|
|
38
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
36
39
|
*/
|
|
37
40
|
var LeftPanel = function LeftPanel(props) {
|
|
38
41
|
var children = props.children,
|
|
@@ -8,7 +8,7 @@ import { useEffect } from 'react';
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
9
9
|
import { jsx } from '@emotion/react';
|
|
10
10
|
import { VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
11
|
-
import { resolveDimension } from '../../common/
|
|
11
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
12
12
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
13
13
|
import LeftSidebarInner from './internal/left-sidebar-inner';
|
|
14
14
|
import LeftSidebarOuter from './internal/left-sidebar-outer';
|
|
@@ -21,6 +21,8 @@ import SlotDimensions from './slot-dimensions';
|
|
|
21
21
|
*
|
|
22
22
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
23
23
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
24
|
+
*
|
|
25
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
24
26
|
*/
|
|
25
27
|
var LeftSidebarWithoutResize = function LeftSidebarWithoutResize(props) {
|
|
26
28
|
var children = props.children,
|
|
@@ -14,7 +14,9 @@ import useCloseOnEscapePress from '@atlaskit/ds-lib/use-close-on-escape-press';
|
|
|
14
14
|
import { easeOut } from '@atlaskit/motion';
|
|
15
15
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
16
16
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, FLYOUT_DELAY, MOBILE_COLLAPSED_LEFT_SIDEBAR_WIDTH, RESIZE_BUTTON_SELECTOR, TRANSITION_DURATION, VAR_LEFT_SIDEBAR_FLYOUT, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
17
|
-
import { getGridStateFromStorage
|
|
17
|
+
import { getGridStateFromStorage } from '../../common/get-grid-state-from-storage';
|
|
18
|
+
import { mergeGridStateIntoStorage } from '../../common/merge-grid-state-into-storage';
|
|
19
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
18
20
|
import { publishGridState, SidebarResizeContext, useSkipLink } from '../../controllers';
|
|
19
21
|
import ResizeControl from '../resize-control';
|
|
20
22
|
import LeftSidebarInner from './internal/left-sidebar-inner';
|
|
@@ -46,6 +48,8 @@ var hiddenBackdropStyles = css({
|
|
|
46
48
|
*
|
|
47
49
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
48
50
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
51
|
+
*
|
|
52
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
49
53
|
*/
|
|
50
54
|
var LeftSidebar = function LeftSidebar(props) {
|
|
51
55
|
var children = props.children,
|
|
@@ -10,8 +10,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import { prefersReducedMotion } from '@atlaskit/motion/accessibility';
|
|
11
11
|
import { easeOut } from '@atlaskit/motion/curves';
|
|
12
12
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH, TRANSITION_DURATION, VAR_LEFT_SIDEBAR_FLYOUT } from '../../common/constants';
|
|
13
|
+
import { getPageLayoutSlotSelector } from '../../common/get-page-layout-slot-selector';
|
|
13
14
|
import { useIsSidebarDragging } from '../../common/hooks';
|
|
14
|
-
import { getPageLayoutSlotSelector } from '../../common/utils';
|
|
15
15
|
import { SidebarResizeContext, useSkipLink } from '../../controllers';
|
|
16
16
|
import SlotFocusRing from './internal/slot-focus-ring';
|
|
17
17
|
|
|
@@ -47,6 +47,8 @@ var flyoutStyles = css({
|
|
|
47
47
|
*
|
|
48
48
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
49
49
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
50
|
+
*
|
|
51
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
50
52
|
*/
|
|
51
53
|
var Main = function Main(props) {
|
|
52
54
|
var children = props.children,
|
|
@@ -8,6 +8,7 @@ import { Fragment } from 'react';
|
|
|
8
8
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
|
+
import warnOnce from '@atlaskit/ds-lib/warn-once';
|
|
11
12
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
12
13
|
import { BANNER, BANNER_HEIGHT, CONTENT, DEFAULT_I18N_PROPS_SKIP_LINKS, LEFT_PANEL, LEFT_PANEL_WIDTH, PAGE_LAYOUT_CONTAINER_SELECTOR, RIGHT_PANEL, RIGHT_PANEL_WIDTH, TOP_NAVIGATION, TOP_NAVIGATION_HEIGHT } from '../../common/constants';
|
|
13
14
|
import { SidebarResizeController, SkipLinksController } from '../../controllers';
|
|
@@ -38,6 +39,8 @@ var gridStylesMobileStyles = css(_defineProperty({}, UNSAFE_media.below.sm, {
|
|
|
38
39
|
*
|
|
39
40
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
40
41
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
42
|
+
*
|
|
43
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
41
44
|
*/
|
|
42
45
|
var PageLayout = function PageLayout(_ref) {
|
|
43
46
|
var _ref$skipLinksLabel = _ref.skipLinksLabel,
|
|
@@ -46,6 +49,9 @@ var PageLayout = function PageLayout(_ref) {
|
|
|
46
49
|
testId = _ref.testId,
|
|
47
50
|
onLeftSidebarExpand = _ref.onLeftSidebarExpand,
|
|
48
51
|
onLeftSidebarCollapse = _ref.onLeftSidebarCollapse;
|
|
52
|
+
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'CI') {
|
|
53
|
+
warnOnce('@atlaskit/page-layout is deprecated. Use @atlaskit/navigation-system instead.');
|
|
54
|
+
}
|
|
49
55
|
return jsx(Fragment, null, jsx(SkipLinksController, null, jsx(SkipLinkWrapper, {
|
|
50
56
|
skipLinksLabel: skipLinksLabel
|
|
51
57
|
}), jsx("div", _extends({}, pageLayoutSelector, {
|
|
@@ -9,7 +9,8 @@ import { useEffect } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { DEFAULT_RIGHT_PANEL_WIDTH, RIGHT_PANEL, RIGHT_PANEL_WIDTH, VAR_RIGHT_PANEL_WIDTH } from '../../common/constants';
|
|
12
|
-
import { getPageLayoutSlotSelector
|
|
12
|
+
import { getPageLayoutSlotSelector } from '../../common/get-page-layout-slot-selector';
|
|
13
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
13
14
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
14
15
|
import SlotFocusRing from './internal/slot-focus-ring';
|
|
15
16
|
import SlotDimensions from './slot-dimensions';
|
|
@@ -33,6 +34,8 @@ var fixedStyles = css({
|
|
|
33
34
|
*
|
|
34
35
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
35
36
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
37
|
+
*
|
|
38
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
36
39
|
*/
|
|
37
40
|
var RightPanel = function RightPanel(props) {
|
|
38
41
|
var children = props.children,
|
|
@@ -9,7 +9,8 @@ import { useEffect } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
import { BANNER_HEIGHT, DEFAULT_RIGHT_SIDEBAR_WIDTH, RIGHT_PANEL_WIDTH, RIGHT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, VAR_RIGHT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
12
|
-
import { getPageLayoutSlotSelector
|
|
12
|
+
import { getPageLayoutSlotSelector } from '../../common/get-page-layout-slot-selector';
|
|
13
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
13
14
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
14
15
|
import SlotFocusRing from './internal/slot-focus-ring';
|
|
15
16
|
import SlotDimensions from './slot-dimensions';
|
|
@@ -60,6 +61,8 @@ var fixedOuterStyles = css({
|
|
|
60
61
|
*
|
|
61
62
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
62
63
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
64
|
+
*
|
|
65
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
63
66
|
*/
|
|
64
67
|
var RightSidebar = function RightSidebar(props) {
|
|
65
68
|
var children = props.children,
|
|
@@ -9,7 +9,8 @@ import { useEffect } from 'react';
|
|
|
9
9
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
10
10
|
import { css, jsx } from '@emotion/react';
|
|
11
11
|
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';
|
|
12
|
-
import { getPageLayoutSlotSelector
|
|
12
|
+
import { getPageLayoutSlotSelector } from '../../common/get-page-layout-slot-selector';
|
|
13
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
13
14
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
14
15
|
import SlotFocusRing from './internal/slot-focus-ring';
|
|
15
16
|
import SlotDimensions from './slot-dimensions';
|
|
@@ -37,6 +38,8 @@ var fixedStyles = css({
|
|
|
37
38
|
*
|
|
38
39
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
39
40
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
41
|
+
*
|
|
42
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
40
43
|
*/
|
|
41
44
|
var TopNavigation = function TopNavigation(props) {
|
|
42
45
|
var children = props.children,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export { default as publishGridState } from './use-page-layout-grid';
|
|
2
|
-
export { SidebarResizeContext
|
|
2
|
+
export { SidebarResizeContext } from './sidebar-resize-context';
|
|
3
|
+
export { usePageLayoutResize } from './use-page-layout-resize';
|
|
4
|
+
export { useLeftSidebarFlyoutLock } from './use-left-sidebar-flyout-lock';
|
|
3
5
|
export { SidebarResizeController } from './sidebar-resize-controller';
|
|
4
|
-
export {
|
|
6
|
+
export { useSkipLink } from './skip-link-context';
|
|
7
|
+
export { useSkipLinks } from './use-skip-links';
|
|
5
8
|
export { SkipLinksController } from './skip-link-controller';
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["setLeftSidebarState"];
|
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import { createContext, useContext, useEffect } from 'react';
|
|
1
|
+
import { createContext } from 'react';
|
|
7
2
|
import noop from '@atlaskit/ds-lib/noop';
|
|
8
3
|
var leftSidebarState = {
|
|
9
4
|
isFlyoutOpen: false,
|
|
@@ -15,7 +10,6 @@ var leftSidebarState = {
|
|
|
15
10
|
isFixed: true,
|
|
16
11
|
hasInit: false
|
|
17
12
|
};
|
|
18
|
-
|
|
19
13
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
20
14
|
export var SidebarResizeContext = /*#__PURE__*/createContext({
|
|
21
15
|
isLeftSidebarCollapsed: false,
|
|
@@ -24,46 +18,4 @@ export var SidebarResizeContext = /*#__PURE__*/createContext({
|
|
|
24
18
|
leftSidebarState: leftSidebarState,
|
|
25
19
|
setLeftSidebarState: noop,
|
|
26
20
|
toggleLeftSidebar: noop
|
|
27
|
-
});
|
|
28
|
-
export var usePageLayoutResize = function usePageLayoutResize() {
|
|
29
|
-
var _useContext = useContext(SidebarResizeContext),
|
|
30
|
-
setLeftSidebarState = _useContext.setLeftSidebarState,
|
|
31
|
-
context = _objectWithoutProperties(_useContext, _excluded);
|
|
32
|
-
return context;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* _**WARNING:**_ This hook is intended as a temporary solution and
|
|
37
|
-
* is likely to be removed in a future version of page-layout.
|
|
38
|
-
*
|
|
39
|
-
* ---
|
|
40
|
-
*
|
|
41
|
-
* This hook will prevent the left sidebar from automatically collapsing
|
|
42
|
-
* when it is in a flyout state.
|
|
43
|
-
*
|
|
44
|
-
* The intended use case for this hook is to allow popup menus in the
|
|
45
|
-
* left sidebar to be usable while it is in a flyout state.
|
|
46
|
-
*
|
|
47
|
-
* ## Usage
|
|
48
|
-
* The intended usage is to use this hook within the popup component
|
|
49
|
-
* you are rendering. This way the left sidebar will be locked for
|
|
50
|
-
* as long as the popup is open.
|
|
51
|
-
*/
|
|
52
|
-
export var useLeftSidebarFlyoutLock = function useLeftSidebarFlyoutLock() {
|
|
53
|
-
var _useContext2 = useContext(SidebarResizeContext),
|
|
54
|
-
setLeftSidebarState = _useContext2.setLeftSidebarState;
|
|
55
|
-
useEffect(function () {
|
|
56
|
-
setLeftSidebarState(function (current) {
|
|
57
|
-
return _objectSpread(_objectSpread({}, current), {}, {
|
|
58
|
-
flyoutLockCount: current.flyoutLockCount + 1
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
return function () {
|
|
62
|
-
setLeftSidebarState(function (current) {
|
|
63
|
-
return _objectSpread(_objectSpread({}, current), {}, {
|
|
64
|
-
flyoutLockCount: current.flyoutLockCount - 1
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
}, [setLeftSidebarState]);
|
|
69
|
-
};
|
|
21
|
+
});
|
|
@@ -5,7 +5,7 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
5
5
|
import { isReducedMotion } from '@atlaskit/motion';
|
|
6
6
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
7
7
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_COLLAPSING } from '../common/constants';
|
|
8
|
-
import { getPageLayoutSlotCSSSelector } from '../common/
|
|
8
|
+
import { getPageLayoutSlotCSSSelector } from '../common/get-page-layout-slot-css-selector';
|
|
9
9
|
import { SidebarResizeContext } from './sidebar-resize-context';
|
|
10
10
|
var handleDataAttributesAndCb = function handleDataAttributesAndCb() {
|
|
11
11
|
var callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : noop;
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
4
|
-
export var SkipLinksContext = /*#__PURE__*/createContext({
|
|
5
|
-
skipLinksData: [],
|
|
6
|
-
registerSkipLink: noop,
|
|
7
|
-
unregisterSkipLink: noop
|
|
8
|
-
});
|
|
9
|
-
export var useSkipLinks = function useSkipLinks() {
|
|
10
|
-
return useContext(SkipLinksContext);
|
|
11
|
-
};
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useSkipLinks } from './use-skip-links';
|
|
12
3
|
export var useSkipLink = function useSkipLink(id, skipLinkTitle) {
|
|
13
4
|
var _useSkipLinks = useSkipLinks(),
|
|
14
5
|
registerSkipLink = _useSkipLinks.registerSkipLink,
|
|
@@ -2,7 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import React, { useRef, useState } from 'react';
|
|
4
4
|
import { PAGE_LAYOUT_SLOT_SELECTOR } from '../common/constants';
|
|
5
|
-
import { SkipLinksContext } from './skip-
|
|
5
|
+
import { SkipLinksContext } from './skip-links-context';
|
|
6
6
|
var byDOMOrder = function byDOMOrder(a, b) {
|
|
7
7
|
var _a$listIndex, _b$listIndex;
|
|
8
8
|
var elems = Array.from(document.querySelectorAll("[".concat(PAGE_LAYOUT_SLOT_SELECTOR, "]")));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
3
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
4
|
+
export var SkipLinksContext = /*#__PURE__*/createContext({
|
|
5
|
+
skipLinksData: [],
|
|
6
|
+
registerSkipLink: noop,
|
|
7
|
+
unregisterSkipLink: noop
|
|
8
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { useContext, useEffect } from 'react';
|
|
5
|
+
import { SidebarResizeContext } from './sidebar-resize-context';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* _**WARNING:**_ This hook is intended as a temporary solution and
|
|
9
|
+
* is likely to be removed in a future version of page-layout.
|
|
10
|
+
*
|
|
11
|
+
* ---
|
|
12
|
+
*
|
|
13
|
+
* This hook will prevent the left sidebar from automatically collapsing
|
|
14
|
+
* when it is in a flyout state.
|
|
15
|
+
*
|
|
16
|
+
* The intended use case for this hook is to allow popup menus in the
|
|
17
|
+
* left sidebar to be usable while it is in a flyout state.
|
|
18
|
+
*
|
|
19
|
+
* ## Usage
|
|
20
|
+
* The intended usage is to use this hook within the popup component
|
|
21
|
+
* you are rendering. This way the left sidebar will be locked for
|
|
22
|
+
* as long as the popup is open.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
25
|
+
*/
|
|
26
|
+
export var useLeftSidebarFlyoutLock = function useLeftSidebarFlyoutLock() {
|
|
27
|
+
var _useContext = useContext(SidebarResizeContext),
|
|
28
|
+
setLeftSidebarState = _useContext.setLeftSidebarState;
|
|
29
|
+
useEffect(function () {
|
|
30
|
+
setLeftSidebarState(function (current) {
|
|
31
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
32
|
+
flyoutLockCount: current.flyoutLockCount + 1
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
return function () {
|
|
36
|
+
setLeftSidebarState(function (current) {
|
|
37
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
38
|
+
flyoutLockCount: current.flyoutLockCount - 1
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
}, [setLeftSidebarState]);
|
|
43
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
-
import { mergeGridStateIntoStorage
|
|
3
|
+
import { mergeGridStateIntoStorage } from '../common/merge-grid-state-into-storage';
|
|
4
|
+
import { removeFromGridStateInStorage } from '../common/remove-from-grid-state-in-storage';
|
|
4
5
|
var publishGridState = function publishGridState(gridState) {
|
|
5
6
|
Object.entries(gridState).forEach(function (_ref) {
|
|
6
7
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
var _excluded = ["setLeftSidebarState"];
|
|
3
|
+
import { useContext } from 'react';
|
|
4
|
+
import { SidebarResizeContext } from './sidebar-resize-context';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
7
|
+
*/
|
|
8
|
+
export var usePageLayoutResize = function usePageLayoutResize() {
|
|
9
|
+
var _useContext = useContext(SidebarResizeContext),
|
|
10
|
+
setLeftSidebarState = _useContext.setLeftSidebarState,
|
|
11
|
+
context = _objectWithoutProperties(_useContext, _excluded);
|
|
12
|
+
return context;
|
|
13
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { usePageLayoutResize
|
|
1
|
+
export { usePageLayoutResize } from '../controllers/use-page-layout-resize';
|
|
2
|
+
export { useLeftSidebarFlyoutLock } from '../controllers/use-left-sidebar-flyout-lock';
|
|
@@ -33,10 +33,28 @@ export declare const RESIZE_CONTROL_SELECTOR = "data-resize-control";
|
|
|
33
33
|
export declare const PAGE_LAYOUT_SLOT_SELECTOR = "data-ds--page-layout--slot";
|
|
34
34
|
export declare const DEFAULT_I18N_PROPS_SKIP_LINKS = "Skip to:";
|
|
35
35
|
export declare const PAGE_LAYOUT_CONTAINER_SELECTOR = "data-layout-container";
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
38
|
+
*/
|
|
36
39
|
export declare const LEFT_PANEL_WIDTH: 'var(--leftPanelWidth, 0px)';
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
42
|
+
*/
|
|
37
43
|
export declare const RIGHT_PANEL_WIDTH: 'var(--rightPanelWidth, 0px)';
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
46
|
+
*/
|
|
38
47
|
export declare const LEFT_SIDEBAR_WIDTH: 'var(--leftSidebarWidth, 0px)';
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
50
|
+
*/
|
|
39
51
|
export declare const RIGHT_SIDEBAR_WIDTH: 'var(--rightSidebarWidth, 0px)';
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
54
|
+
*/
|
|
40
55
|
export declare const TOP_NAVIGATION_HEIGHT: 'var(--topNavigationHeight, 0px)';
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
58
|
+
*/
|
|
41
59
|
export declare const BANNER_HEIGHT: 'var(--bannerHeight, 0px)';
|
|
42
60
|
export declare const LEFT_SIDEBAR_FLYOUT_WIDTH: 'var(--leftSidebarFlyoutWidth, 240px)';
|