@atlaskit/page-layout 4.3.0 → 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 +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 +11 -11
- 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
|
@@ -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_RIGHT_PANEL_WIDTH, RIGHT_PANEL, RIGHT_PANEL_WIDTH, VAR_RIGHT_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 fixedStyles = 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 RightPanel = props => {
|
|
37
40
|
const {
|
|
@@ -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_HEIGHT, DEFAULT_RIGHT_SIDEBAR_WIDTH, RIGHT_PANEL_WIDTH, RIGHT_SIDEBAR_WIDTH, TOP_NAVIGATION_HEIGHT, VAR_RIGHT_SIDEBAR_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';
|
|
@@ -59,6 +60,8 @@ const fixedOuterStyles = css({
|
|
|
59
60
|
*
|
|
60
61
|
* - [Examples](https://atlassian.design/components/page-layout/examples)
|
|
61
62
|
* - [Code](https://atlassian.design/components/page-layout/code)
|
|
63
|
+
*
|
|
64
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
62
65
|
*/
|
|
63
66
|
const RightSidebar = props => {
|
|
64
67
|
const {
|
|
@@ -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_HEIGHT, DEFAULT_TOP_NAVIGATION_HEIGHT, LEFT_PANEL_WIDTH, RIGHT_PANEL_WIDTH, TOP_NAVIGATION, TOP_NAVIGATION_HEIGHT, VAR_TOP_NAVIGATION_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';
|
|
@@ -36,6 +37,8 @@ const fixedStyles = 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
|
const TopNavigation = props => {
|
|
41
44
|
const {
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import { createContext
|
|
1
|
+
import { createContext } from 'react';
|
|
2
2
|
import noop from '@atlaskit/ds-lib/noop';
|
|
3
3
|
const leftSidebarState = {
|
|
4
4
|
isFlyoutOpen: false,
|
|
@@ -10,7 +10,6 @@ const leftSidebarState = {
|
|
|
10
10
|
isFixed: true,
|
|
11
11
|
hasInit: false
|
|
12
12
|
};
|
|
13
|
-
|
|
14
13
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
15
14
|
export const SidebarResizeContext = /*#__PURE__*/createContext({
|
|
16
15
|
isLeftSidebarCollapsed: false,
|
|
@@ -19,46 +18,4 @@ export const SidebarResizeContext = /*#__PURE__*/createContext({
|
|
|
19
18
|
leftSidebarState,
|
|
20
19
|
setLeftSidebarState: noop,
|
|
21
20
|
toggleLeftSidebar: noop
|
|
22
|
-
});
|
|
23
|
-
export const usePageLayoutResize = () => {
|
|
24
|
-
const {
|
|
25
|
-
setLeftSidebarState,
|
|
26
|
-
...context
|
|
27
|
-
} = useContext(SidebarResizeContext);
|
|
28
|
-
return context;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* _**WARNING:**_ This hook is intended as a temporary solution and
|
|
33
|
-
* is likely to be removed in a future version of page-layout.
|
|
34
|
-
*
|
|
35
|
-
* ---
|
|
36
|
-
*
|
|
37
|
-
* This hook will prevent the left sidebar from automatically collapsing
|
|
38
|
-
* when it is in a flyout state.
|
|
39
|
-
*
|
|
40
|
-
* The intended use case for this hook is to allow popup menus in the
|
|
41
|
-
* left sidebar to be usable while it is in a flyout state.
|
|
42
|
-
*
|
|
43
|
-
* ## Usage
|
|
44
|
-
* The intended usage is to use this hook within the popup component
|
|
45
|
-
* you are rendering. This way the left sidebar will be locked for
|
|
46
|
-
* as long as the popup is open.
|
|
47
|
-
*/
|
|
48
|
-
export const useLeftSidebarFlyoutLock = () => {
|
|
49
|
-
const {
|
|
50
|
-
setLeftSidebarState
|
|
51
|
-
} = useContext(SidebarResizeContext);
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
setLeftSidebarState(current => ({
|
|
54
|
-
...current,
|
|
55
|
-
flyoutLockCount: current.flyoutLockCount + 1
|
|
56
|
-
}));
|
|
57
|
-
return () => {
|
|
58
|
-
setLeftSidebarState(current => ({
|
|
59
|
-
...current,
|
|
60
|
-
flyoutLockCount: current.flyoutLockCount - 1
|
|
61
|
-
}));
|
|
62
|
-
};
|
|
63
|
-
}, [setLeftSidebarState]);
|
|
64
|
-
};
|
|
21
|
+
});
|
|
@@ -4,7 +4,7 @@ import noop from '@atlaskit/ds-lib/noop';
|
|
|
4
4
|
import { isReducedMotion } from '@atlaskit/motion';
|
|
5
5
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
6
6
|
import { COLLAPSED_LEFT_SIDEBAR_WIDTH, DEFAULT_LEFT_SIDEBAR_WIDTH, IS_SIDEBAR_COLLAPSING } from '../common/constants';
|
|
7
|
-
import { getPageLayoutSlotCSSSelector } from '../common/
|
|
7
|
+
import { getPageLayoutSlotCSSSelector } from '../common/get-page-layout-slot-css-selector';
|
|
8
8
|
import { SidebarResizeContext } from './sidebar-resize-context';
|
|
9
9
|
const handleDataAttributesAndCb = (callback = noop, leftSidebarState) => {
|
|
10
10
|
document.documentElement.removeAttribute(IS_SIDEBAR_COLLAPSING);
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
4
|
-
export const SkipLinksContext = /*#__PURE__*/createContext({
|
|
5
|
-
skipLinksData: [],
|
|
6
|
-
registerSkipLink: noop,
|
|
7
|
-
unregisterSkipLink: noop
|
|
8
|
-
});
|
|
9
|
-
export const useSkipLinks = () => useContext(SkipLinksContext);
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useSkipLinks } from './use-skip-links';
|
|
10
3
|
export const useSkipLink = (id, skipLinkTitle) => {
|
|
11
4
|
const {
|
|
12
5
|
registerSkipLink,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, useState } from 'react';
|
|
2
2
|
import { PAGE_LAYOUT_SLOT_SELECTOR } from '../common/constants';
|
|
3
|
-
import { SkipLinksContext } from './skip-
|
|
3
|
+
import { SkipLinksContext } from './skip-links-context';
|
|
4
4
|
const byDOMOrder = (a, b) => {
|
|
5
5
|
var _a$listIndex, _b$listIndex;
|
|
6
6
|
const elems = Array.from(document.querySelectorAll(`[${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 const SkipLinksContext = /*#__PURE__*/createContext({
|
|
5
|
+
skipLinksData: [],
|
|
6
|
+
registerSkipLink: noop,
|
|
7
|
+
unregisterSkipLink: noop
|
|
8
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { SidebarResizeContext } from './sidebar-resize-context';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* _**WARNING:**_ This hook is intended as a temporary solution and
|
|
6
|
+
* is likely to be removed in a future version of page-layout.
|
|
7
|
+
*
|
|
8
|
+
* ---
|
|
9
|
+
*
|
|
10
|
+
* This hook will prevent the left sidebar from automatically collapsing
|
|
11
|
+
* when it is in a flyout state.
|
|
12
|
+
*
|
|
13
|
+
* The intended use case for this hook is to allow popup menus in the
|
|
14
|
+
* left sidebar to be usable while it is in a flyout state.
|
|
15
|
+
*
|
|
16
|
+
* ## Usage
|
|
17
|
+
* The intended usage is to use this hook within the popup component
|
|
18
|
+
* you are rendering. This way the left sidebar will be locked for
|
|
19
|
+
* as long as the popup is open.
|
|
20
|
+
*
|
|
21
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
22
|
+
*/
|
|
23
|
+
export const useLeftSidebarFlyoutLock = () => {
|
|
24
|
+
const {
|
|
25
|
+
setLeftSidebarState
|
|
26
|
+
} = useContext(SidebarResizeContext);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
setLeftSidebarState(current => ({
|
|
29
|
+
...current,
|
|
30
|
+
flyoutLockCount: current.flyoutLockCount + 1
|
|
31
|
+
}));
|
|
32
|
+
return () => {
|
|
33
|
+
setLeftSidebarState(current => ({
|
|
34
|
+
...current,
|
|
35
|
+
flyoutLockCount: current.flyoutLockCount - 1
|
|
36
|
+
}));
|
|
37
|
+
};
|
|
38
|
+
}, [setLeftSidebarState]);
|
|
39
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { mergeGridStateIntoStorage
|
|
1
|
+
import { mergeGridStateIntoStorage } from '../common/merge-grid-state-into-storage';
|
|
2
|
+
import { removeFromGridStateInStorage } from '../common/remove-from-grid-state-in-storage';
|
|
2
3
|
const publishGridState = gridState => {
|
|
3
4
|
Object.entries(gridState).forEach(([slotName, value]) => {
|
|
4
5
|
if (!value) {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { SidebarResizeContext } from './sidebar-resize-context';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
5
|
+
*/
|
|
6
|
+
export const usePageLayoutResize = () => {
|
|
7
|
+
const {
|
|
8
|
+
setLeftSidebarState,
|
|
9
|
+
...context
|
|
10
|
+
} = useContext(SidebarResizeContext);
|
|
11
|
+
return context;
|
|
12
|
+
};
|
|
@@ -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';
|
|
@@ -42,10 +42,29 @@ export var RESIZE_CONTROL_SELECTOR = 'data-resize-control';
|
|
|
42
42
|
export var PAGE_LAYOUT_SLOT_SELECTOR = 'data-ds--page-layout--slot';
|
|
43
43
|
export var DEFAULT_I18N_PROPS_SKIP_LINKS = 'Skip to:';
|
|
44
44
|
export var 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 var LEFT_PANEL_WIDTH = "var(--".concat(VAR_LEFT_PANEL_WIDTH, ", 0px)");
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
52
|
+
*/
|
|
46
53
|
export var RIGHT_PANEL_WIDTH = "var(--".concat(VAR_RIGHT_PANEL_WIDTH, ", 0px)");
|
|
54
|
+
/**
|
|
55
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
56
|
+
*/
|
|
47
57
|
export var LEFT_SIDEBAR_WIDTH = "var(--".concat(VAR_LEFT_SIDEBAR_WIDTH, ", 0px)");
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
60
|
+
*/
|
|
48
61
|
export var RIGHT_SIDEBAR_WIDTH = "var(--".concat(VAR_RIGHT_SIDEBAR_WIDTH, ", 0px)");
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
64
|
+
*/
|
|
49
65
|
export var TOP_NAVIGATION_HEIGHT = "var(--".concat(VAR_TOP_NAVIGATION_HEIGHT, ", 0px)");
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated `@atlaskit/page-layout` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
68
|
+
*/
|
|
50
69
|
export var BANNER_HEIGHT = "var(--".concat(VAR_BANNER_HEIGHT, ", 0px)");
|
|
51
70
|
export var LEFT_SIDEBAR_FLYOUT_WIDTH = "var(--".concat(VAR_LEFT_SIDEBAR_FLYOUT, ", ").concat(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 var getGridStateFromStorage = function getGridStateFromStorage(key) {
|
|
4
|
+
var 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 var getLeftPanelWidth = function getLeftPanelWidth() {
|
|
3
|
+
if (typeof window === 'undefined') {
|
|
4
|
+
return 0;
|
|
5
|
+
}
|
|
6
|
+
return parseInt(window.getComputedStyle(document.documentElement).getPropertyValue("--".concat(LEFT_PANEL_WIDTH)), 10) || 0;
|
|
7
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DEFAULT_LEFT_SIDEBAR_WIDTH } from './constants';
|
|
2
|
+
export var getLeftSidebarPercentage = function getLeftSidebarPercentage(currentWidth, maxWidth) {
|
|
3
|
+
var 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,5 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { PAGE_LAYOUT_SLOT_SELECTOR } from './constants';
|
|
3
|
+
export var getPageLayoutSlotSelector = function getPageLayoutSlotSelector(slotName) {
|
|
4
|
+
return _defineProperty({}, PAGE_LAYOUT_SLOT_SELECTOR, slotName);
|
|
5
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
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
|
+
import { PAGE_LAYOUT_LS_KEY } from './constants';
|
|
6
|
+
import safeLocalStorage from './safe-local-storage';
|
|
7
|
+
export var mergeGridStateIntoStorage = function mergeGridStateIntoStorage(key, value) {
|
|
8
|
+
var storageValue = JSON.parse(safeLocalStorage().getItem(PAGE_LAYOUT_LS_KEY) || '{}');
|
|
9
|
+
if (value !== null && _typeof(value) === 'object') {
|
|
10
|
+
storageValue[key] = _objectSpread(_objectSpread({}, storageValue[key]), value);
|
|
11
|
+
} else {
|
|
12
|
+
storageValue[key] = value;
|
|
13
|
+
}
|
|
14
|
+
safeLocalStorage().setItem(PAGE_LAYOUT_LS_KEY, JSON.stringify(storageValue));
|
|
15
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PAGE_LAYOUT_LS_KEY } from './constants';
|
|
2
|
+
import safeLocalStorage from './safe-local-storage';
|
|
3
|
+
export var removeFromGridStateInStorage = function removeFromGridStateInStorage(key, secondKey) {
|
|
4
|
+
var 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,10 @@
|
|
|
1
|
+
import { getGridStateFromStorage } from './get-grid-state-from-storage';
|
|
2
|
+
export var resolveDimension = function resolveDimension(key) {
|
|
3
|
+
var dimension = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
4
|
+
var shouldPersist = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
5
|
+
if (shouldPersist) {
|
|
6
|
+
var cachedGridState = getGridStateFromStorage('gridState');
|
|
7
|
+
return cachedGridState && Object.keys(cachedGridState).length > 0 && cachedGridState[key] ? cachedGridState[key] : dimension;
|
|
8
|
+
}
|
|
9
|
+
return dimension;
|
|
10
|
+
};
|
|
@@ -15,7 +15,8 @@ import { bindAll } from 'bind-event-listener';
|
|
|
15
15
|
import rafSchd from 'raf-schd';
|
|
16
16
|
import { UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
|
|
17
17
|
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';
|
|
18
|
-
import { getLeftPanelWidth
|
|
18
|
+
import { getLeftPanelWidth } from '../../common/get-left-panel-width';
|
|
19
|
+
import { getLeftSidebarPercentage } from '../../common/get-left-sidebar-percentage';
|
|
19
20
|
import { SidebarResizeContext } from '../../controllers/sidebar-resize-context';
|
|
20
21
|
/* import useUpdateCssVar from '../../controllers/use-update-css-vars'; */
|
|
21
22
|
|
|
@@ -1,179 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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, @typescript-eslint/consistent-type-imports
|
|
12
|
-
import { css, jsx } from '@emotion/react';
|
|
13
|
-
import Link from '@atlaskit/link';
|
|
14
|
-
import { easeOut, prefersReducedMotion } from '@atlaskit/motion';
|
|
15
|
-
import { DEFAULT_I18N_PROPS_SKIP_LINKS, PAGE_LAYOUT_CONTAINER_SELECTOR } from '../../common/constants';
|
|
16
|
-
import { useSkipLinks } from '../../controllers';
|
|
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
|
-
background: "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 skipLinkListItemStyles = css({
|
|
49
|
-
marginBlockStart: 0
|
|
50
|
-
});
|
|
51
|
-
var _assignIndex = function assignIndex(num, arr) {
|
|
52
|
-
if (!arr.includes(num)) {
|
|
53
|
-
return num;
|
|
54
|
-
}
|
|
55
|
-
return _assignIndex(num + 1, arr);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* The default label will be used when the `skipLinksLabel` attribute is not
|
|
60
|
-
* provided or the attribute is an empty string. If a string comprised only of
|
|
61
|
-
* spaces is provided, the skip link heading element will be removed, but the
|
|
62
|
-
* default label will still be used in `title` attribute of the skip links
|
|
63
|
-
* themselves.
|
|
64
|
-
*/
|
|
65
|
-
export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
|
|
66
|
-
var skipLinksLabel = _ref.skipLinksLabel;
|
|
67
|
-
var _useSkipLinks = useSkipLinks(),
|
|
68
|
-
skipLinksData = _useSkipLinks.skipLinksData;
|
|
69
|
-
if (skipLinksData.length === 0) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
var sortSkipLinks = function sortSkipLinks(arr) {
|
|
73
|
-
var customLinks = arr.filter(function (link) {
|
|
74
|
-
return Number.isInteger(link.listIndex);
|
|
75
|
-
});
|
|
76
|
-
if (customLinks.length === 0) {
|
|
77
|
-
return arr;
|
|
78
|
-
}
|
|
79
|
-
var usedIndexes = customLinks.map(function (a) {
|
|
80
|
-
return a.listIndex;
|
|
81
|
-
});
|
|
82
|
-
var regularLinksWithIdx = arr.filter(function (link) {
|
|
83
|
-
return link.listIndex === undefined;
|
|
84
|
-
}).map(function (link, idx) {
|
|
85
|
-
var listIndex = _assignIndex(idx, usedIndexes);
|
|
86
|
-
usedIndexes.push(listIndex);
|
|
87
|
-
return _objectSpread(_objectSpread({}, link), {}, {
|
|
88
|
-
listIndex: listIndex
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
return [].concat(_toConsumableArray(customLinks), _toConsumableArray(regularLinksWithIdx)).sort(function (a, b) {
|
|
92
|
-
return a.listIndex - b.listIndex;
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
var escapeHandler = function escapeHandler(event) {
|
|
96
|
-
if (event.keyCode === 27) {
|
|
97
|
-
var container = document.querySelector("[".concat(PAGE_LAYOUT_CONTAINER_SELECTOR, "=\"true\"]") // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
98
|
-
);
|
|
99
|
-
if (container !== null) {
|
|
100
|
-
container.focus();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
var attachEscHandler = function attachEscHandler() {
|
|
105
|
-
return window.addEventListener('keydown', escapeHandler, false);
|
|
106
|
-
};
|
|
107
|
-
var removeEscHandler = function removeEscHandler() {
|
|
108
|
-
return window.removeEventListener('keydown', escapeHandler, false);
|
|
109
|
-
};
|
|
110
|
-
var emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
|
|
111
|
-
var label = skipLinksLabel || DEFAULT_I18N_PROPS_SKIP_LINKS;
|
|
112
|
-
return jsx("div", {
|
|
113
|
-
onFocus: attachEscHandler,
|
|
114
|
-
onBlur: removeEscHandler,
|
|
115
|
-
css: [skipLinkStyles, prefersReducedMotionStyles],
|
|
116
|
-
"data-skip-link-wrapper": true
|
|
117
|
-
}, emptyLabelOverride ? null : jsx("p", {
|
|
118
|
-
css: skipLinkHeadingStyles
|
|
119
|
-
}, label), jsx("ol", {
|
|
120
|
-
css: skipLinkListStyles
|
|
121
|
-
}, sortSkipLinks(skipLinksData).map(function (_ref2) {
|
|
122
|
-
var id = _ref2.id,
|
|
123
|
-
skipLinkTitle = _ref2.skipLinkTitle;
|
|
124
|
-
return jsx(SkipLink, {
|
|
125
|
-
key: id,
|
|
126
|
-
href: "#".concat(id),
|
|
127
|
-
isFocusable: true
|
|
128
|
-
}, skipLinkTitle);
|
|
129
|
-
})));
|
|
130
|
-
};
|
|
131
|
-
var _handleBlur = function handleBlur(event) {
|
|
132
|
-
// @ts-ignore
|
|
133
|
-
event.target.removeAttribute('tabindex');
|
|
134
|
-
// @ts-ignore
|
|
135
|
-
event.target.removeEventListener('blur', _handleBlur);
|
|
136
|
-
};
|
|
137
|
-
var focusTargetRef = function focusTargetRef(href) {
|
|
138
|
-
return function (event) {
|
|
139
|
-
event.preventDefault();
|
|
140
|
-
var targetRef = document.querySelector(href);
|
|
141
|
-
|
|
142
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
143
|
-
// @ts-ignore
|
|
144
|
-
var key = event.which || event.keycode;
|
|
145
|
-
// if it is a keypress and the key is not
|
|
146
|
-
// space or enter, just ignore it.
|
|
147
|
-
if (key && key !== 13 && key !== 32) {
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (targetRef) {
|
|
151
|
-
targetRef.setAttribute('tabindex', '-1');
|
|
152
|
-
// @ts-ignore
|
|
153
|
-
targetRef.addEventListener('blur', _handleBlur);
|
|
154
|
-
// @ts-ignore
|
|
155
|
-
targetRef.focus();
|
|
156
|
-
document.activeElement && document.activeElement.scrollIntoView({
|
|
157
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
158
|
-
behavior: 'smooth'
|
|
159
|
-
// eslint-disable-next-line @atlaskit/platform/no-direct-document-usage
|
|
160
|
-
});
|
|
161
|
-
window.scrollTo(0, 0);
|
|
162
|
-
}
|
|
163
|
-
return false;
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
168
|
-
export var SkipLink = function SkipLink(_ref3) {
|
|
169
|
-
var href = _ref3.href,
|
|
170
|
-
children = _ref3.children,
|
|
171
|
-
isFocusable = _ref3.isFocusable;
|
|
172
|
-
return jsx("li", {
|
|
173
|
-
css: skipLinkListItemStyles
|
|
174
|
-
}, jsx(Link, {
|
|
175
|
-
tabIndex: isFocusable ? 0 : -1,
|
|
176
|
-
href: href,
|
|
177
|
-
onClick: focusTargetRef(href)
|
|
178
|
-
}, children));
|
|
179
|
-
};
|
|
1
|
+
export { SkipLinkWrapper } from './skip-link-wrapper';
|
|
2
|
+
export { SkipLink } from './skip-link';
|