@atlaskit/page-layout 4.3.1 → 4.3.3
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 +13 -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,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useSkipLinks = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _skipLinksContext = require("./skip-links-context");
|
|
9
|
+
var useSkipLinks = exports.useSkipLinks = function useSkipLinks() {
|
|
10
|
+
return (0, _react.useContext)(_skipLinksContext.SkipLinksContext);
|
|
11
|
+
};
|
|
@@ -6,13 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
Object.defineProperty(exports, "useLeftSidebarFlyoutLock", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function get() {
|
|
9
|
-
return
|
|
9
|
+
return _useLeftSidebarFlyoutLock.useLeftSidebarFlyoutLock;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "usePageLayoutResize", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function get() {
|
|
15
|
-
return
|
|
15
|
+
return _usePageLayoutResize.usePageLayoutResize;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
var
|
|
18
|
+
var _usePageLayoutResize = require("../controllers/use-page-layout-resize");
|
|
19
|
+
var _useLeftSidebarFlyoutLock = require("../controllers/use-left-sidebar-flyout-lock");
|
|
@@ -42,10 +42,29 @@ export const RESIZE_CONTROL_SELECTOR = 'data-resize-control';
|
|
|
42
42
|
export const PAGE_LAYOUT_SLOT_SELECTOR = 'data-ds--page-layout--slot';
|
|
43
43
|
export const DEFAULT_I18N_PROPS_SKIP_LINKS = 'Skip to:';
|
|
44
44
|
export const PAGE_LAYOUT_CONTAINER_SELECTOR = 'data-layout-container';
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
48
|
+
*/
|
|
45
49
|
export const LEFT_PANEL_WIDTH = `var(--${VAR_LEFT_PANEL_WIDTH}, 0px)`;
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
52
|
+
*/
|
|
46
53
|
export const RIGHT_PANEL_WIDTH = `var(--${VAR_RIGHT_PANEL_WIDTH}, 0px)`;
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
56
|
+
*/
|
|
47
57
|
export const LEFT_SIDEBAR_WIDTH = `var(--${VAR_LEFT_SIDEBAR_WIDTH}, 0px)`;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
60
|
+
*/
|
|
48
61
|
export const RIGHT_SIDEBAR_WIDTH = `var(--${VAR_RIGHT_SIDEBAR_WIDTH}, 0px)`;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
64
|
+
*/
|
|
49
65
|
export const TOP_NAVIGATION_HEIGHT = `var(--${VAR_TOP_NAVIGATION_HEIGHT}, 0px)`;
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
68
|
+
*/
|
|
50
69
|
export const BANNER_HEIGHT = `var(--${VAR_BANNER_HEIGHT}, 0px)`;
|
|
51
70
|
export const LEFT_SIDEBAR_FLYOUT_WIDTH = `var(--${VAR_LEFT_SIDEBAR_FLYOUT}, ${DEFAULT_LEFT_SIDEBAR_FLYOUT_WIDTH}px)`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PAGE_LAYOUT_LS_KEY } from './constants';
|
|
2
|
+
import safeLocalStorage from './safe-local-storage';
|
|
3
|
+
export const getGridStateFromStorage = key => {
|
|
4
|
+
const storageValue = JSON.parse(safeLocalStorage().getItem(PAGE_LAYOUT_LS_KEY) || '{}');
|
|
5
|
+
return storageValue[key];
|
|
6
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LEFT_PANEL_WIDTH } from './constants';
|
|
2
|
+
export const getLeftPanelWidth = () => {
|
|
3
|
+
if (typeof window === 'undefined') {
|
|
4
|
+
return 0;
|
|
5
|
+
}
|
|
6
|
+
return parseInt(window.getComputedStyle(document.documentElement).getPropertyValue(`--${LEFT_PANEL_WIDTH}`), 10) || 0;
|
|
7
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DEFAULT_LEFT_SIDEBAR_WIDTH } from './constants';
|
|
2
|
+
export const getLeftSidebarPercentage = (currentWidth, maxWidth) => {
|
|
3
|
+
const total = (currentWidth - DEFAULT_LEFT_SIDEBAR_WIDTH) / (maxWidth - DEFAULT_LEFT_SIDEBAR_WIDTH);
|
|
4
|
+
if (total < 0) {
|
|
5
|
+
return 0;
|
|
6
|
+
}
|
|
7
|
+
if (total > 1) {
|
|
8
|
+
return 100;
|
|
9
|
+
}
|
|
10
|
+
return Math.floor(total * 100);
|
|
11
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PAGE_LAYOUT_LS_KEY } from './constants';
|
|
2
|
+
import safeLocalStorage from './safe-local-storage';
|
|
3
|
+
export const mergeGridStateIntoStorage = (key, value) => {
|
|
4
|
+
const storageValue = JSON.parse(safeLocalStorage().getItem(PAGE_LAYOUT_LS_KEY) || '{}');
|
|
5
|
+
if (value !== null && typeof value === 'object') {
|
|
6
|
+
storageValue[key] = {
|
|
7
|
+
...storageValue[key],
|
|
8
|
+
...value
|
|
9
|
+
};
|
|
10
|
+
} else {
|
|
11
|
+
storageValue[key] = value;
|
|
12
|
+
}
|
|
13
|
+
safeLocalStorage().setItem(PAGE_LAYOUT_LS_KEY, JSON.stringify(storageValue));
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PAGE_LAYOUT_LS_KEY } from './constants';
|
|
2
|
+
import safeLocalStorage from './safe-local-storage';
|
|
3
|
+
export const removeFromGridStateInStorage = (key, secondKey) => {
|
|
4
|
+
const storageValue = JSON.parse(safeLocalStorage().getItem(PAGE_LAYOUT_LS_KEY) || '{}');
|
|
5
|
+
if (secondKey && storageValue[key]) {
|
|
6
|
+
delete storageValue[key][secondKey];
|
|
7
|
+
} else {
|
|
8
|
+
delete storageValue[key];
|
|
9
|
+
}
|
|
10
|
+
safeLocalStorage().setItem(PAGE_LAYOUT_LS_KEY, JSON.stringify(storageValue));
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getGridStateFromStorage } from './get-grid-state-from-storage';
|
|
2
|
+
export const resolveDimension = (key, dimension = 0, shouldPersist = false) => {
|
|
3
|
+
if (shouldPersist) {
|
|
4
|
+
const cachedGridState = getGridStateFromStorage('gridState');
|
|
5
|
+
return cachedGridState && Object.keys(cachedGridState).length > 0 && cachedGridState[key] ? cachedGridState[key] : dimension;
|
|
6
|
+
}
|
|
7
|
+
return dimension;
|
|
8
|
+
};
|
|
@@ -11,7 +11,8 @@ import { bindAll } from 'bind-event-listener';
|
|
|
11
11
|
import rafSchd from 'raf-schd';
|
|
12
12
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
13
13
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_DRAGGING, MIN_LEFT_SIDEBAR_DRAG_THRESHOLD, RESIZE_CONTROL_SELECTOR, VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
14
|
-
import { getLeftPanelWidth
|
|
14
|
+
import { getLeftPanelWidth } from '../../common/get-left-panel-width';
|
|
15
|
+
import { getLeftSidebarPercentage } from '../../common/get-left-sidebar-percentage';
|
|
15
16
|
import { SidebarResizeContext } from '../../controllers/sidebar-resize-context';
|
|
16
17
|
/* import useUpdateCssVar from '../../controllers/use-update-css-vars'; */
|
|
17
18
|
|
|
@@ -1,165 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @jsxRuntime classic
|
|
4
|
-
* @jsx jsx
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
8
|
-
import { css, jsx } from '@emotion/react';
|
|
9
|
-
import Link from '@atlaskit/link';
|
|
10
|
-
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
11
|
-
import { DEFAULT_I18N_PROPS_SKIP_LINKS, PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
|
|
12
|
-
import { useSkipLinks } from '../../controllers';
|
|
13
|
-
// 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
|
|
14
|
-
const prefersReducedMotionStyles = css(prefersReducedMotion());
|
|
15
|
-
const skipLinkStyles = css({
|
|
16
|
-
margin: "var(--ds-space-250, 20px)",
|
|
17
|
-
padding: '0.8rem 1rem',
|
|
18
|
-
position: 'fixed',
|
|
19
|
-
zIndex: -1,
|
|
20
|
-
background: "var(--ds-surface-overlay, #FFFFFF)",
|
|
21
|
-
border: 'none',
|
|
22
|
-
borderRadius: "var(--ds-radius-small, 3px)",
|
|
23
|
-
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)",
|
|
24
|
-
insetInlineStart: -999999,
|
|
25
|
-
opacity: 0,
|
|
26
|
-
transform: 'translateY(-50%)',
|
|
27
|
-
transition: `transform 0.3s ${easeOut}`,
|
|
28
|
-
'&:focus-within': {
|
|
29
|
-
zIndex: 2147483640,
|
|
30
|
-
insetInlineStart: 0,
|
|
31
|
-
opacity: 1,
|
|
32
|
-
transform: 'translateY(0%)'
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
const skipLinkHeadingStyles = css({
|
|
36
|
-
fontWeight: "var(--ds-font-weight-semibold, 600)"
|
|
37
|
-
});
|
|
38
|
-
const skipLinkListStyles = css({
|
|
39
|
-
listStylePosition: 'outside',
|
|
40
|
-
listStyleType: 'none',
|
|
41
|
-
marginBlockStart: "var(--ds-space-050, 4px)",
|
|
42
|
-
paddingInlineStart: 0
|
|
43
|
-
});
|
|
44
|
-
const skipLinkListItemStyles = css({
|
|
45
|
-
marginBlockStart: 0
|
|
46
|
-
});
|
|
47
|
-
const assignIndex = (num, arr) => {
|
|
48
|
-
if (!arr.includes(num)) {
|
|
49
|
-
return num;
|
|
50
|
-
}
|
|
51
|
-
return assignIndex(num + 1, arr);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* The default label will be used when the `skipLinksLabel` attribute is not
|
|
56
|
-
* provided or the attribute is an empty string. If a string comprised only of
|
|
57
|
-
* spaces is provided, the skip link heading element will be removed, but the
|
|
58
|
-
* default label will still be used in `title` attribute of the skip links
|
|
59
|
-
* themselves.
|
|
60
|
-
*/
|
|
61
|
-
export const SkipLinkWrapper = ({
|
|
62
|
-
skipLinksLabel
|
|
63
|
-
}) => {
|
|
64
|
-
const {
|
|
65
|
-
skipLinksData
|
|
66
|
-
} = useSkipLinks();
|
|
67
|
-
if (skipLinksData.length === 0) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const sortSkipLinks = arr => {
|
|
71
|
-
const customLinks = arr.filter(link => Number.isInteger(link.listIndex));
|
|
72
|
-
if (customLinks.length === 0) {
|
|
73
|
-
return arr;
|
|
74
|
-
}
|
|
75
|
-
const usedIndexes = customLinks.map(a => a.listIndex);
|
|
76
|
-
const regularLinksWithIdx = arr.filter(link => link.listIndex === undefined).map((link, idx) => {
|
|
77
|
-
const listIndex = assignIndex(idx, usedIndexes);
|
|
78
|
-
usedIndexes.push(listIndex);
|
|
79
|
-
return {
|
|
80
|
-
...link,
|
|
81
|
-
listIndex
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
return [...customLinks, ...regularLinksWithIdx].sort((a, b) => a.listIndex - b.listIndex);
|
|
85
|
-
};
|
|
86
|
-
const escapeHandler = event => {
|
|
87
|
-
if (event.keyCode === 27) {
|
|
88
|
-
const container = document.querySelector(`[${PAGE_LAYOUT_CONTAINER_SELECTOR}="true"]`
|
|
89
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
90
|
-
);
|
|
91
|
-
if (container !== null) {
|
|
92
|
-
container.focus();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const attachEscHandler = () => window.addEventListener('keydown', escapeHandler, false);
|
|
97
|
-
const removeEscHandler = () => window.removeEventListener('keydown', escapeHandler, false);
|
|
98
|
-
const emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
|
|
99
|
-
const label = skipLinksLabel || DEFAULT_I18N_PROPS_SKIP_LINKS;
|
|
100
|
-
return jsx("div", {
|
|
101
|
-
onFocus: attachEscHandler,
|
|
102
|
-
onBlur: removeEscHandler,
|
|
103
|
-
css: [skipLinkStyles, prefersReducedMotionStyles],
|
|
104
|
-
"data-skip-link-wrapper": true
|
|
105
|
-
}, emptyLabelOverride ? null : jsx("p", {
|
|
106
|
-
css: skipLinkHeadingStyles
|
|
107
|
-
}, label), jsx("ol", {
|
|
108
|
-
css: skipLinkListStyles
|
|
109
|
-
}, sortSkipLinks(skipLinksData).map(({
|
|
110
|
-
id,
|
|
111
|
-
skipLinkTitle
|
|
112
|
-
}) => jsx(SkipLink, {
|
|
113
|
-
key: id,
|
|
114
|
-
href: `#${id}`,
|
|
115
|
-
isFocusable: true
|
|
116
|
-
}, skipLinkTitle))));
|
|
117
|
-
};
|
|
118
|
-
const handleBlur = event => {
|
|
119
|
-
// @ts-ignore
|
|
120
|
-
event.target.removeAttribute('tabindex');
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
event.target.removeEventListener('blur', handleBlur);
|
|
123
|
-
};
|
|
124
|
-
const focusTargetRef = href => event => {
|
|
125
|
-
event.preventDefault();
|
|
126
|
-
const targetRef = document.querySelector(href);
|
|
127
|
-
|
|
128
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
129
|
-
// @ts-ignore
|
|
130
|
-
const key = event.which || event.keycode;
|
|
131
|
-
// if it is a keypress and the key is not
|
|
132
|
-
// space or enter, just ignore it.
|
|
133
|
-
if (key && key !== 13 && key !== 32) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
if (targetRef) {
|
|
137
|
-
targetRef.setAttribute('tabindex', '-1');
|
|
138
|
-
// @ts-ignore
|
|
139
|
-
targetRef.addEventListener('blur', handleBlur);
|
|
140
|
-
// @ts-ignore
|
|
141
|
-
targetRef.focus();
|
|
142
|
-
document.activeElement && document.activeElement.scrollIntoView({
|
|
143
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
144
|
-
behavior: 'smooth'
|
|
145
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
146
|
-
});
|
|
147
|
-
window.scrollTo(0, 0);
|
|
148
|
-
}
|
|
149
|
-
return false;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
153
|
-
export const SkipLink = ({
|
|
154
|
-
href,
|
|
155
|
-
children,
|
|
156
|
-
isFocusable
|
|
157
|
-
}) => {
|
|
158
|
-
return jsx("li", {
|
|
159
|
-
css: skipLinkListItemStyles
|
|
160
|
-
}, jsx(Link, {
|
|
161
|
-
tabIndex: isFocusable ? 0 : -1,
|
|
162
|
-
href: href,
|
|
163
|
-
onClick: focusTargetRef(href)
|
|
164
|
-
}, children));
|
|
165
|
-
};
|
|
1
|
+
export { SkipLinkWrapper } from './skip-link-wrapper';
|
|
2
|
+
export { SkipLink } from './skip-link';
|
|
@@ -0,0 +1,114 @@
|
|
|
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 { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
10
|
+
import { DEFAULT_I18N_PROPS_SKIP_LINKS, PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
|
|
11
|
+
import { useSkipLinks } from '../../controllers';
|
|
12
|
+
import { SkipLink } from './skip-link';
|
|
13
|
+
// 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
|
|
14
|
+
const prefersReducedMotionStyles = css(prefersReducedMotion());
|
|
15
|
+
const skipLinkStyles = css({
|
|
16
|
+
margin: "var(--ds-space-250, 20px)",
|
|
17
|
+
padding: '0.8rem 1rem',
|
|
18
|
+
position: 'fixed',
|
|
19
|
+
zIndex: -1,
|
|
20
|
+
backgroundColor: "var(--ds-surface-overlay, #FFFFFF)",
|
|
21
|
+
border: 'none',
|
|
22
|
+
borderRadius: "var(--ds-radius-small, 3px)",
|
|
23
|
+
boxShadow: "var(--ds-shadow-overlay, 0px 8px 12px #1E1F2126, 0px 0px 1px #1E1F214f)",
|
|
24
|
+
insetInlineStart: -999999,
|
|
25
|
+
opacity: 0,
|
|
26
|
+
transform: 'translateY(-50%)',
|
|
27
|
+
transition: `transform 0.3s ${easeOut}`,
|
|
28
|
+
'&:focus-within': {
|
|
29
|
+
zIndex: 2147483640,
|
|
30
|
+
insetInlineStart: 0,
|
|
31
|
+
opacity: 1,
|
|
32
|
+
transform: 'translateY(0%)'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const skipLinkHeadingStyles = css({
|
|
36
|
+
fontWeight: "var(--ds-font-weight-semibold, 600)"
|
|
37
|
+
});
|
|
38
|
+
const skipLinkListStyles = css({
|
|
39
|
+
listStylePosition: 'outside',
|
|
40
|
+
listStyleType: 'none',
|
|
41
|
+
marginBlockStart: "var(--ds-space-050, 4px)",
|
|
42
|
+
paddingInlineStart: 0
|
|
43
|
+
});
|
|
44
|
+
const assignIndex = (num, arr) => {
|
|
45
|
+
if (!arr.includes(num)) {
|
|
46
|
+
return num;
|
|
47
|
+
}
|
|
48
|
+
return assignIndex(num + 1, arr);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The default label will be used when the `skipLinksLabel` attribute is not
|
|
53
|
+
* provided or the attribute is an empty string. If a string comprised only of
|
|
54
|
+
* spaces is provided, the skip link heading element will be removed, but the
|
|
55
|
+
* default label will still be used in `title` attribute of the skip links
|
|
56
|
+
* themselves.
|
|
57
|
+
*/
|
|
58
|
+
export const SkipLinkWrapper = ({
|
|
59
|
+
skipLinksLabel
|
|
60
|
+
}) => {
|
|
61
|
+
const {
|
|
62
|
+
skipLinksData
|
|
63
|
+
} = useSkipLinks();
|
|
64
|
+
if (skipLinksData.length === 0) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
const sortSkipLinks = arr => {
|
|
68
|
+
const customLinks = arr.filter(link => Number.isInteger(link.listIndex));
|
|
69
|
+
if (customLinks.length === 0) {
|
|
70
|
+
return arr;
|
|
71
|
+
}
|
|
72
|
+
const usedIndexes = customLinks.map(a => a.listIndex);
|
|
73
|
+
const regularLinksWithIdx = arr.filter(link => link.listIndex === undefined).map((link, idx) => {
|
|
74
|
+
const listIndex = assignIndex(idx, usedIndexes);
|
|
75
|
+
usedIndexes.push(listIndex);
|
|
76
|
+
return {
|
|
77
|
+
...link,
|
|
78
|
+
listIndex
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
return [...customLinks, ...regularLinksWithIdx].sort((a, b) => a.listIndex - b.listIndex);
|
|
82
|
+
};
|
|
83
|
+
const escapeHandler = event => {
|
|
84
|
+
if (event.keyCode === 27) {
|
|
85
|
+
const container = document.querySelector(`[${PAGE_LAYOUT_CONTAINER_SELECTOR}="true"]`
|
|
86
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
87
|
+
);
|
|
88
|
+
if (container !== null) {
|
|
89
|
+
container.focus();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const attachEscHandler = () => window.addEventListener('keydown', escapeHandler, false);
|
|
94
|
+
const removeEscHandler = () => window.removeEventListener('keydown', escapeHandler, false);
|
|
95
|
+
const emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
|
|
96
|
+
const label = skipLinksLabel || DEFAULT_I18N_PROPS_SKIP_LINKS;
|
|
97
|
+
return jsx("div", {
|
|
98
|
+
onFocus: attachEscHandler,
|
|
99
|
+
onBlur: removeEscHandler,
|
|
100
|
+
css: [skipLinkStyles, prefersReducedMotionStyles],
|
|
101
|
+
"data-skip-link-wrapper": true
|
|
102
|
+
}, emptyLabelOverride ? null : jsx("p", {
|
|
103
|
+
css: skipLinkHeadingStyles
|
|
104
|
+
}, label), jsx("ol", {
|
|
105
|
+
css: skipLinkListStyles
|
|
106
|
+
}, sortSkipLinks(skipLinksData).map(({
|
|
107
|
+
id,
|
|
108
|
+
skipLinkTitle
|
|
109
|
+
}) => jsx(SkipLink, {
|
|
110
|
+
key: id,
|
|
111
|
+
href: `#${id}`,
|
|
112
|
+
isFocusable: true
|
|
113
|
+
}, skipLinkTitle))));
|
|
114
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
const skipLinkListItemStyles = css({
|
|
11
|
+
marginBlockStart: 0
|
|
12
|
+
});
|
|
13
|
+
const focusTargetRef = href => event => {
|
|
14
|
+
event.preventDefault();
|
|
15
|
+
const targetRef = document.querySelector(href);
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
const key = event.which || event.keycode;
|
|
20
|
+
// if it is a keypress and the key is not
|
|
21
|
+
// space or enter, just ignore it.
|
|
22
|
+
if (key && key !== 13 && key !== 32) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (targetRef) {
|
|
26
|
+
targetRef.setAttribute('tabindex', '-1');
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
targetRef.addEventListener('blur', handleBlur);
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
targetRef.focus();
|
|
31
|
+
document.activeElement && document.activeElement.scrollIntoView({
|
|
32
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
33
|
+
behavior: 'smooth'
|
|
34
|
+
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
35
|
+
});
|
|
36
|
+
window.scrollTo(0, 0);
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
42
|
+
export const SkipLink = ({
|
|
43
|
+
href,
|
|
44
|
+
children,
|
|
45
|
+
isFocusable
|
|
46
|
+
}) => {
|
|
47
|
+
return jsx("li", {
|
|
48
|
+
css: skipLinkListItemStyles
|
|
49
|
+
}, jsx(Link, {
|
|
50
|
+
tabIndex: isFocusable ? 0 : -1,
|
|
51
|
+
href: href,
|
|
52
|
+
onClick: focusTargetRef(href)
|
|
53
|
+
}, children));
|
|
54
|
+
};
|
|
@@ -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 const useCustomSkipLink = (id, skipLinkTitle, listIndex = 0) => {
|
|
8
14
|
const {
|
|
9
15
|
registerSkipLink,
|
|
@@ -8,7 +8,8 @@ import { useEffect } from 'react';
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { BANNER, BANNER_HEIGHT, DEFAULT_BANNER_HEIGHT, LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, VAR_BANNER_HEIGHT } from '../../common/constants';
|
|
11
|
-
import { getPageLayoutSlotSelector
|
|
11
|
+
import { getPageLayoutSlotSelector } from '../../common/get-page-layout-slot-selector';
|
|
12
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
12
13
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
13
14
|
import SlotFocusRing from './internal/slot-focus-ring';
|
|
14
15
|
import SlotDimensions from './slot-dimensions';
|
|
@@ -35,6 +36,8 @@ const bannerFixedStyles = css({
|
|
|
35
36
|
*
|
|
36
37
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
37
38
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
39
|
+
*
|
|
40
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
38
41
|
*/
|
|
39
42
|
const Banner = props => {
|
|
40
43
|
const {
|
|
@@ -21,6 +21,8 @@ const 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
|
const Content = props => {
|
|
26
28
|
const {
|
|
@@ -10,8 +10,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
11
11
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
12
12
|
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';
|
|
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 } from '../../../controllers';
|
|
16
16
|
import SlotFocusRing from './slot-focus-ring';
|
|
17
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
|
|
@@ -8,7 +8,8 @@ import { useEffect } from 'react';
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { DEFAULT_LEFT_PANEL_WIDTH, LEFT_PANEL, LEFT_PANEL_WIDTH, VAR_LEFT_PANEL_WIDTH } from '../../common/constants';
|
|
11
|
-
import { getPageLayoutSlotSelector
|
|
11
|
+
import { getPageLayoutSlotSelector } from '../../common/get-page-layout-slot-selector';
|
|
12
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
12
13
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
13
14
|
import SlotFocusRing from './internal/slot-focus-ring';
|
|
14
15
|
import SlotDimensions from './slot-dimensions';
|
|
@@ -32,6 +33,8 @@ const leftPanelFixedStyles = css({
|
|
|
32
33
|
*
|
|
33
34
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
34
35
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
36
|
+
*
|
|
37
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
35
38
|
*/
|
|
36
39
|
const LeftPanel = props => {
|
|
37
40
|
const {
|
|
@@ -7,7 +7,7 @@ import { useEffect } from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { VAR_LEFT_SIDEBAR_WIDTH } from '../../common/constants';
|
|
10
|
-
import { resolveDimension } from '../../common/
|
|
10
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
11
11
|
import { publishGridState, useSkipLink } from '../../controllers';
|
|
12
12
|
import LeftSidebarInner from './internal/left-sidebar-inner';
|
|
13
13
|
import LeftSidebarOuter from './internal/left-sidebar-outer';
|
|
@@ -20,6 +20,8 @@ import SlotDimensions from './slot-dimensions';
|
|
|
20
20
|
*
|
|
21
21
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
22
22
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
23
|
+
*
|
|
24
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
23
25
|
*/
|
|
24
26
|
const LeftSidebarWithoutResize = props => {
|
|
25
27
|
const {
|
|
@@ -11,7 +11,9 @@ import useCloseOnEscapePress from '@atlaskit/ds-lib/use-close-on-escape-press';
|
|
|
11
11
|
import { easeOut } from '@atlaskit/motion';
|
|
12
12
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
13
13
|
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';
|
|
14
|
-
import { getGridStateFromStorage
|
|
14
|
+
import { getGridStateFromStorage } from '../../common/get-grid-state-from-storage';
|
|
15
|
+
import { mergeGridStateIntoStorage } from '../../common/merge-grid-state-into-storage';
|
|
16
|
+
import { resolveDimension } from '../../common/resolve-dimension';
|
|
15
17
|
import { publishGridState, SidebarResizeContext, useSkipLink } from '../../controllers';
|
|
16
18
|
import ResizeControl from '../resize-control';
|
|
17
19
|
import LeftSidebarInner from './internal/left-sidebar-inner';
|
|
@@ -43,6 +45,8 @@ const hiddenBackdropStyles = css({
|
|
|
43
45
|
*
|
|
44
46
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
45
47
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
48
|
+
*
|
|
49
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
46
50
|
*/
|
|
47
51
|
const LeftSidebar = props => {
|
|
48
52
|
const {
|
|
@@ -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 @@ const 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
|
const Main = props => {
|
|
52
54
|
const {
|
|
@@ -7,6 +7,7 @@ import { Fragment } from 'react';
|
|
|
7
7
|
|
|
8
8
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled, @typescript-eslint/consistent-type-imports
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import warnOnce from '@atlaskit/ds-lib/warn-once';
|
|
10
11
|
import { UNSAFE_media } from '@atlaskit/primitives/responsive';
|
|
11
12
|
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';
|
|
12
13
|
import { SidebarResizeController, SkipLinksController } from '../../controllers';
|
|
@@ -56,6 +57,8 @@ const gridStylesMobileStyles = css({
|
|
|
56
57
|
*
|
|
57
58
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
58
59
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
60
|
+
*
|
|
61
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
59
62
|
*/
|
|
60
63
|
const PageLayout = ({
|
|
61
64
|
skipLinksLabel = DEFAULT_I18N_PROPS_SKIP_LINKS,
|
|
@@ -64,6 +67,9 @@ const PageLayout = ({
|
|
|
64
67
|
onLeftSidebarExpand,
|
|
65
68
|
onLeftSidebarCollapse
|
|
66
69
|
}) => {
|
|
70
|
+
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'CI') {
|
|
71
|
+
warnOnce('@atlaskit/page-layout is deprecated. Use @atlaskit/navigation-system instead.');
|
|
72
|
+
}
|
|
67
73
|
return jsx(Fragment, null, jsx(SkipLinksController, null, jsx(SkipLinkWrapper, {
|
|
68
74
|
skipLinksLabel: skipLinksLabel
|
|
69
75
|
}), jsx("div", _extends({}, pageLayoutSelector, {
|