@atlaskit/navigation-system 8.2.0 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/constellation/layout/usage.mdx +2 -0
- package/constellation/top-nav-items/usage.mdx +2 -0
- package/dist/cjs/components/skip-links/skip-link.js +0 -1
- package/dist/cjs/components/skip-links/skip-links-container.compiled.css +2 -7
- package/dist/cjs/components/skip-links/skip-links-container.js +17 -14
- package/dist/cjs/components/skip-links/skip-links-popup.compiled.css +22 -0
- package/dist/cjs/components/skip-links/skip-links-popup.js +124 -0
- package/dist/cjs/context/skip-links/skip-links-provider.js +2 -0
- package/dist/cjs/ui/page-layout/root.js +6 -3
- package/dist/cjs/ui/page-layout/side-nav/side-nav.js +2 -12
- package/dist/es2019/components/skip-links/skip-link.js +0 -1
- package/dist/es2019/components/skip-links/skip-links-container.compiled.css +2 -7
- package/dist/es2019/components/skip-links/skip-links-container.js +17 -14
- package/dist/es2019/components/skip-links/skip-links-popup.compiled.css +22 -0
- package/dist/es2019/components/skip-links/skip-links-popup.js +107 -0
- package/dist/es2019/context/skip-links/skip-links-provider.js +2 -0
- package/dist/es2019/ui/page-layout/root.js +4 -3
- package/dist/es2019/ui/page-layout/side-nav/side-nav.js +2 -12
- package/dist/esm/components/skip-links/skip-link.js +0 -1
- package/dist/esm/components/skip-links/skip-links-container.compiled.css +2 -7
- package/dist/esm/components/skip-links/skip-links-container.js +17 -14
- package/dist/esm/components/skip-links/skip-links-popup.compiled.css +22 -0
- package/dist/esm/components/skip-links/skip-links-popup.js +115 -0
- package/dist/esm/context/skip-links/skip-links-provider.js +2 -0
- package/dist/esm/ui/page-layout/root.js +6 -3
- package/dist/esm/ui/page-layout/side-nav/side-nav.js +2 -12
- package/dist/types/components/skip-links/skip-link.d.ts +7 -5
- package/dist/types/components/skip-links/skip-links-container.d.ts +3 -2
- package/dist/types/components/skip-links/skip-links-popup.d.ts +11 -0
- package/dist/types/context/skip-links/skip-links-provider.d.ts +2 -1
- package/dist/types/ui/page-layout/root.d.ts +5 -1
- package/dist/types-ts4.5/components/skip-links/skip-link.d.ts +7 -5
- package/dist/types-ts4.5/components/skip-links/skip-links-container.d.ts +3 -2
- package/dist/types-ts4.5/components/skip-links/skip-links-popup.d.ts +11 -0
- package/dist/types-ts4.5/context/skip-links/skip-links-provider.d.ts +2 -1
- package/dist/types-ts4.5/ui/page-layout/root.d.ts +5 -1
- package/package.json +9 -12
- package/theming/color-utils/parse-hex/package.json +17 -0
- package/theming/color-utils/parse-hsl/package.json +17 -0
- package/theming/color-utils/parse-rgb/package.json +17 -0
- package/theming/color-utils/parse-user-color/package.json +17 -0
- package/theming/top-nav-button/package.json +17 -0
- package/theming/use-has-custom-theme/package.json +17 -0
- package/theming/use-legacy-search-theme/package.json +17 -0
- package/experimental/color-utils/parse-hex/package.json +0 -17
- package/experimental/color-utils/parse-hsl/package.json +0 -17
- package/experimental/color-utils/parse-rgb/package.json +0 -17
- package/experimental/color-utils/parse-user-color/package.json +0 -17
- package/experimental/top-nav-button/package.json +0 -17
- package/experimental/use-has-custom-theme/package.json +0 -17
- package/experimental/use-legacy-search-theme/package.json +0 -17
- /package/dist/cjs/entry-points/{experimental → theming}/color-utils/parse-hex.js +0 -0
- /package/dist/cjs/entry-points/{experimental → theming}/color-utils/parse-hsl.js +0 -0
- /package/dist/cjs/entry-points/{experimental → theming}/color-utils/parse-rgb.js +0 -0
- /package/dist/cjs/entry-points/{experimental → theming}/color-utils/parse-user-color.js +0 -0
- /package/dist/cjs/entry-points/{experimental → theming}/top-nav-button.js +0 -0
- /package/dist/cjs/entry-points/{experimental → theming}/use-has-custom-theme.js +0 -0
- /package/dist/cjs/entry-points/{experimental → theming}/use-legacy-search-theme.js +0 -0
- /package/dist/es2019/entry-points/{experimental → theming}/color-utils/parse-hex.js +0 -0
- /package/dist/es2019/entry-points/{experimental → theming}/color-utils/parse-hsl.js +0 -0
- /package/dist/es2019/entry-points/{experimental → theming}/color-utils/parse-rgb.js +0 -0
- /package/dist/es2019/entry-points/{experimental → theming}/color-utils/parse-user-color.js +0 -0
- /package/dist/es2019/entry-points/{experimental → theming}/top-nav-button.js +0 -0
- /package/dist/es2019/entry-points/{experimental → theming}/use-has-custom-theme.js +0 -0
- /package/dist/es2019/entry-points/{experimental → theming}/use-legacy-search-theme.js +0 -0
- /package/dist/esm/entry-points/{experimental → theming}/color-utils/parse-hex.js +0 -0
- /package/dist/esm/entry-points/{experimental → theming}/color-utils/parse-hsl.js +0 -0
- /package/dist/esm/entry-points/{experimental → theming}/color-utils/parse-rgb.js +0 -0
- /package/dist/esm/entry-points/{experimental → theming}/color-utils/parse-user-color.js +0 -0
- /package/dist/esm/entry-points/{experimental → theming}/top-nav-button.js +0 -0
- /package/dist/esm/entry-points/{experimental → theming}/use-has-custom-theme.js +0 -0
- /package/dist/esm/entry-points/{experimental → theming}/use-legacy-search-theme.js +0 -0
- /package/dist/types/entry-points/{experimental → theming}/color-utils/parse-hex.d.ts +0 -0
- /package/dist/types/entry-points/{experimental → theming}/color-utils/parse-hsl.d.ts +0 -0
- /package/dist/types/entry-points/{experimental → theming}/color-utils/parse-rgb.d.ts +0 -0
- /package/dist/types/entry-points/{experimental → theming}/color-utils/parse-user-color.d.ts +0 -0
- /package/dist/types/entry-points/{experimental → theming}/top-nav-button.d.ts +0 -0
- /package/dist/types/entry-points/{experimental → theming}/use-has-custom-theme.d.ts +0 -0
- /package/dist/types/entry-points/{experimental → theming}/use-legacy-search-theme.d.ts +0 -0
- /package/dist/types-ts4.5/entry-points/{experimental → theming}/color-utils/parse-hex.d.ts +0 -0
- /package/dist/types-ts4.5/entry-points/{experimental → theming}/color-utils/parse-hsl.d.ts +0 -0
- /package/dist/types-ts4.5/entry-points/{experimental → theming}/color-utils/parse-rgb.d.ts +0 -0
- /package/dist/types-ts4.5/entry-points/{experimental → theming}/color-utils/parse-user-color.d.ts +0 -0
- /package/dist/types-ts4.5/entry-points/{experimental → theming}/top-nav-button.d.ts +0 -0
- /package/dist/types-ts4.5/entry-points/{experimental → theming}/use-has-custom-theme.d.ts +0 -0
- /package/dist/types-ts4.5/entry-points/{experimental → theming}/use-legacy-search-theme.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 9.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c47d9797de1d4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c47d9797de1d4) -
|
|
8
|
+
Skip links are now rendered inside of a popup. This change is behind the
|
|
9
|
+
`platform_dst_nav4_skip_link_a11y_1` feature gate.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`36a98dddcf5af`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/36a98dddcf5af) -
|
|
14
|
+
Cleanup of feature gate navx-4418-fix-effect-state-updates-in-gsn (true)
|
|
15
|
+
|
|
16
|
+
## 9.0.0
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- [`2d4e2aa315dc1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2d4e2aa315dc1) -
|
|
21
|
+
Renamed the experimental theming entrypoints from `/experimental/*` to `/theming/*`. The
|
|
22
|
+
`/experimental/ribbon` entrypoint is unaffected.
|
|
23
|
+
|
|
24
|
+
Migration:
|
|
25
|
+
- `@atlaskit/navigation-system/experimental/top-nav-button` →
|
|
26
|
+
`@atlaskit/navigation-system/theming/top-nav-button`
|
|
27
|
+
- `@atlaskit/navigation-system/experimental/use-has-custom-theme` →
|
|
28
|
+
`@atlaskit/navigation-system/theming/use-has-custom-theme`
|
|
29
|
+
- `@atlaskit/navigation-system/experimental/use-legacy-search-theme` →
|
|
30
|
+
`@atlaskit/navigation-system/theming/use-legacy-search-theme`
|
|
31
|
+
- `@atlaskit/navigation-system/experimental/color-utils/parse-hex` →
|
|
32
|
+
`@atlaskit/navigation-system/theming/color-utils/parse-hex`
|
|
33
|
+
- `@atlaskit/navigation-system/experimental/color-utils/parse-hsl` →
|
|
34
|
+
`@atlaskit/navigation-system/theming/color-utils/parse-hsl`
|
|
35
|
+
- `@atlaskit/navigation-system/experimental/color-utils/parse-rgb` →
|
|
36
|
+
`@atlaskit/navigation-system/theming/color-utils/parse-rgb`
|
|
37
|
+
- `@atlaskit/navigation-system/experimental/color-utils/parse-user-color` →
|
|
38
|
+
`@atlaskit/navigation-system/theming/color-utils/parse-user-color`
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- Updated dependencies
|
|
43
|
+
|
|
3
44
|
## 8.2.0
|
|
4
45
|
|
|
5
46
|
### Minor Changes
|
|
@@ -23,6 +23,8 @@ navigational areas.
|
|
|
23
23
|
When applying components to the navigational areas,
|
|
24
24
|
[see navigation resources (Atlassians only)](https://hello.atlassian.net/wiki/spaces/navx/pages/5104144812).
|
|
25
25
|
|
|
26
|
+
## Parts
|
|
27
|
+
|
|
26
28
|
<Image
|
|
27
29
|
src={layoutAnatomyLight}
|
|
28
30
|
srcDark={layoutAnatomyDark}
|
|
@@ -22,6 +22,8 @@ import topNavItemsDont2Dark from './images/topNavItems-dont-2-dark.png';
|
|
|
22
22
|
Use top nav items to create common utilities in the top nav within
|
|
23
23
|
[layout](/components/navigation-system/layout/examples).
|
|
24
24
|
|
|
25
|
+
## Parts
|
|
26
|
+
|
|
25
27
|
<Image
|
|
26
28
|
src={topNavItemsAnatomyLight}
|
|
27
29
|
srcDark={topNavItemsAnatomyDark}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
3
|
-
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
4
3
|
._zulp1b66{gap:var(--ds-space-050,4px)}
|
|
5
|
-
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
6
4
|
._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
|
|
7
|
-
.
|
|
8
|
-
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}
|
|
9
|
-
._152tv47k{inset-block-start:var(--ds-space-250,20px)}
|
|
5
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._152tv47k{inset-block-start:var(--ds-space-250,20px)}
|
|
10
6
|
._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
11
7
|
._1e02v47k{inset-inline-start:var(--ds-space-250,20px)}
|
|
12
8
|
._1e0c1txw{display:flex}
|
|
@@ -19,7 +15,6 @@
|
|
|
19
15
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
20
16
|
._kqsw1n9t{position:fixed}
|
|
21
17
|
._lcxvglyw{pointer-events:none}
|
|
22
|
-
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
23
18
|
._tzy4idpf{opacity:0}
|
|
24
19
|
._18eu1wug:focus-within{pointer-events:auto}
|
|
25
20
|
._1digjh3g:focus-within{z-index:calc(infinity)}
|
|
@@ -16,16 +16,13 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
16
16
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
17
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
18
18
|
var _skipLink = require("./skip-link");
|
|
19
|
+
var _skipLinksPopup = require("./skip-links-popup");
|
|
19
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
21
|
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; }
|
|
21
22
|
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) { (0, _defineProperty2.default)(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; }
|
|
22
23
|
var styles = {
|
|
23
|
-
root: "_1e0c1txw _2lx21bp4 _kqsw1n9t _1e02v47k _152tv47k _bfhk1bhr _16qs130s _1pby1mrw _tzy4idpf _lcxvglyw _1digjh3g _1mygkb7n _18eu1wug",
|
|
24
|
-
|
|
25
|
-
rootNew: "_2rko1mok _1rjcu2gc _18zrpxbi",
|
|
26
|
-
label: "_11c8i4vh _1rjcu2gc _syazazsu",
|
|
27
|
-
skipLinkList: "_1e0c1txw _2lx21bp4 _1x8w11lx _2mzuglyw _1pfhze3t _bozgze3t",
|
|
28
|
-
skipLinkListOld: "_zulp1b66"
|
|
24
|
+
root: "_zulp1b66 _2rko12b0 _1rjcutpp _18zrutpp _1e0c1txw _2lx21bp4 _kqsw1n9t _1e02v47k _152tv47k _bfhk1bhr _16qs130s _1pby1mrw _tzy4idpf _lcxvglyw _1digjh3g _1mygkb7n _18eu1wug",
|
|
25
|
+
skipLinkList: "_zulp1b66 _1e0c1txw _2lx21bp4 _1x8w11lx _2mzuglyw _1pfhze3t _bozgze3t"
|
|
29
26
|
};
|
|
30
27
|
|
|
31
28
|
/**
|
|
@@ -96,10 +93,11 @@ var isOnlyWhitespaceRegex = /^\s*$/;
|
|
|
96
93
|
* The label is used as the heading of the skip links container. If the provided label is a string
|
|
97
94
|
* comprised only of only whitespace (e.g. '' or ' '), the skip link heading element will be removed.
|
|
98
95
|
*
|
|
99
|
-
*
|
|
96
|
+
* When `platform_dst_nav4_skip_link_a11y_1` is enabled, rendering is delegated to `SkipLinksPopup`.
|
|
100
97
|
*/
|
|
101
98
|
function SkipLinksContainer(_ref) {
|
|
102
99
|
var label = _ref.label,
|
|
100
|
+
triggerLabel = _ref.triggerLabel,
|
|
103
101
|
testId = _ref.testId,
|
|
104
102
|
links = _ref.links;
|
|
105
103
|
var sortedLinks = (0, _react.useMemo)(function () {
|
|
@@ -109,18 +107,23 @@ function SkipLinksContainer(_ref) {
|
|
|
109
107
|
return null;
|
|
110
108
|
}
|
|
111
109
|
var isEmptyLabel = isOnlyWhitespaceRegex.test(label);
|
|
110
|
+
if ((0, _platformFeatureFlags.fg)('platform_dst_nav4_skip_link_a11y_1')) {
|
|
111
|
+
return /*#__PURE__*/React.createElement(_skipLinksPopup.SkipLinksPopup, {
|
|
112
|
+
label: label,
|
|
113
|
+
triggerLabel: triggerLabel,
|
|
114
|
+
testId: testId,
|
|
115
|
+
links: sortedLinks
|
|
116
|
+
});
|
|
117
|
+
}
|
|
112
118
|
return /*#__PURE__*/React.createElement("div", {
|
|
113
119
|
onKeyDown: closeOnEscape,
|
|
114
120
|
"data-testid": testId ? "".concat(testId, "--skip-links-container") : undefined,
|
|
115
|
-
className: (0, _runtime.ax)([styles.root
|
|
116
|
-
}, !isEmptyLabel &&
|
|
117
|
-
"data-testid": testId ? "".concat(testId, "--skip-links-container--label") : undefined,
|
|
118
|
-
className: (0, _runtime.ax)([styles.label])
|
|
119
|
-
}, label) : /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
121
|
+
className: (0, _runtime.ax)([styles.root])
|
|
122
|
+
}, !isEmptyLabel && /*#__PURE__*/React.createElement(_compiled.Text, {
|
|
120
123
|
weight: "bold",
|
|
121
124
|
testId: testId ? "".concat(testId, "--skip-links-container--label") : undefined
|
|
122
|
-
}, label)
|
|
123
|
-
className: (0, _runtime.ax)([styles.skipLinkList
|
|
125
|
+
}, label), /*#__PURE__*/React.createElement("ol", {
|
|
126
|
+
className: (0, _runtime.ax)([styles.skipLinkList])
|
|
124
127
|
}, sortedLinks.map(function (_ref2) {
|
|
125
128
|
var id = _ref2.id,
|
|
126
129
|
label = _ref2.label,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
._11c8i4vh{font:var(--ds-font-heading-xxsmall,normal 653 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
3
|
+
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
4
|
+
._1dqoglyw{border-style:none}
|
|
5
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
|
|
6
|
+
._152tutpp{inset-block-start:var(--ds-space-150,9pt)}
|
|
7
|
+
._1e02utpp{inset-inline-start:var(--ds-space-150,9pt)}
|
|
8
|
+
._1e0c1txw{display:flex}
|
|
9
|
+
._1pby1mrw{z-index:-1}
|
|
10
|
+
._1pbyjh3g{z-index:calc(infinity)}
|
|
11
|
+
._1pfhze3t{margin-block-start:var(--ds-space-0,0)}
|
|
12
|
+
._1x8w11lx{list-style-position:outside}
|
|
13
|
+
._2lx21bp4{flex-direction:column}
|
|
14
|
+
._2mzuglyw{list-style-type:none}
|
|
15
|
+
._4ojojh3g:has(:focus-visible){z-index:calc(infinity)}
|
|
16
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
17
|
+
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
18
|
+
._c8j0kb7n:has(:focus-visible){opacity:1}
|
|
19
|
+
._kqsw1n9t{position:fixed}
|
|
20
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
21
|
+
._t9ecz6y5{transform:translateY(-100%)}
|
|
22
|
+
._tzy4idpf{opacity:0}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/* skip-links-popup.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.SkipLinksPopup = SkipLinksPopup;
|
|
10
|
+
require("./skip-links-popup.compiled.css");
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var React = _react;
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
|
+
var _reactDom = require("react-dom");
|
|
17
|
+
var _new = _interopRequireDefault(require("@atlaskit/button/new"));
|
|
18
|
+
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
19
|
+
var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
20
|
+
var _skipLink = require("./skip-link");
|
|
21
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
22
|
+
var contentStyles = {
|
|
23
|
+
root: "_1rjcu2gc _18zrpxbi _1e0c1txw _2lx21bp4 _1pbyjh3g",
|
|
24
|
+
skipLinkList: "_1e0c1txw _2lx21bp4 _1x8w11lx _2mzuglyw _1pfhze3t _bozgze3t",
|
|
25
|
+
label: "_11c8i4vh _1rjcu2gc _syazazsu"
|
|
26
|
+
};
|
|
27
|
+
var triggerStyles = {
|
|
28
|
+
root: "_2rko12b0 _1dqoglyw _kqsw1n9t _1e02utpp _152tutpp _1pby1mrw _tzy4idpf _bfhk1bhr _4ojojh3g _c8j0kb7n",
|
|
29
|
+
isOpen: "_tzy4idpf _t9ecz6y5"
|
|
30
|
+
};
|
|
31
|
+
var popupOffset = [0, 0];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Skip links shown behind `platform_dst_nav4_skip_link_a11y_1`: a single focus-revealed
|
|
35
|
+
* control opens a dialog listing skip targets.
|
|
36
|
+
*/
|
|
37
|
+
function SkipLinksPopup(_ref) {
|
|
38
|
+
var title = _ref.label,
|
|
39
|
+
triggerLabel = _ref.triggerLabel,
|
|
40
|
+
testId = _ref.testId,
|
|
41
|
+
links = _ref.links;
|
|
42
|
+
var titleId = (0, _react.useId)();
|
|
43
|
+
var _useState = (0, _react.useState)(false),
|
|
44
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
45
|
+
isOpen = _useState2[0],
|
|
46
|
+
setIsOpen = _useState2[1];
|
|
47
|
+
var triggerRef = (0, _react.useRef)(null);
|
|
48
|
+
var openPopup = (0, _react.useCallback)(function () {
|
|
49
|
+
setIsOpen(true);
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Closes the popup.
|
|
54
|
+
*
|
|
55
|
+
* Uses `flushSync` to avoid issues with focus management.
|
|
56
|
+
* This ensures the popup's focus lock is fully released by the time skip links or our `onClose` try to move focus.
|
|
57
|
+
*/
|
|
58
|
+
var closePopup = (0, _react.useCallback)(function () {
|
|
59
|
+
(0, _reactDom.flushSync)(function () {
|
|
60
|
+
setIsOpen(false);
|
|
61
|
+
});
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Restores focus to the trigger on close, if it hasn't moved to another element, such as when Esc is pressed instead of a skip link.
|
|
66
|
+
*
|
|
67
|
+
* We need this because using the standard `shouldReturnFocus` on the popup would break the skip link focus behaviour,
|
|
68
|
+
* as focus would always move back to the trigger.
|
|
69
|
+
*/
|
|
70
|
+
var onClose = (0, _react.useCallback)(function () {
|
|
71
|
+
closePopup();
|
|
72
|
+
|
|
73
|
+
// Focus on the body implies a skip link was not clicked
|
|
74
|
+
if (document.activeElement === document.body) {
|
|
75
|
+
var _triggerRef$current;
|
|
76
|
+
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 || _triggerRef$current.focus();
|
|
77
|
+
}
|
|
78
|
+
}, [closePopup]);
|
|
79
|
+
return /*#__PURE__*/React.createElement(_popup.default, {
|
|
80
|
+
isOpen: isOpen,
|
|
81
|
+
onClose: onClose,
|
|
82
|
+
placement: "bottom-start",
|
|
83
|
+
shouldRenderToParent: true,
|
|
84
|
+
shouldReturnFocus: false,
|
|
85
|
+
role: "dialog",
|
|
86
|
+
titleId: titleId,
|
|
87
|
+
testId: testId ? "".concat(testId, "--skip-links-container") : undefined,
|
|
88
|
+
offset: popupOffset,
|
|
89
|
+
content: function content() {
|
|
90
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
91
|
+
className: (0, _runtime.ax)([contentStyles.root])
|
|
92
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
93
|
+
"data-testid": testId ? "".concat(testId, "--skip-links-container--label") : undefined,
|
|
94
|
+
id: titleId,
|
|
95
|
+
className: (0, _runtime.ax)([contentStyles.label])
|
|
96
|
+
}, title), /*#__PURE__*/React.createElement("ol", {
|
|
97
|
+
className: (0, _runtime.ax)([contentStyles.skipLinkList])
|
|
98
|
+
}, links.map(function (_ref2) {
|
|
99
|
+
var id = _ref2.id,
|
|
100
|
+
label = _ref2.label,
|
|
101
|
+
_onBeforeNavigate = _ref2.onBeforeNavigate;
|
|
102
|
+
return /*#__PURE__*/React.createElement(_skipLink.SkipLink, {
|
|
103
|
+
key: id,
|
|
104
|
+
id: id,
|
|
105
|
+
onBeforeNavigate: function onBeforeNavigate() {
|
|
106
|
+
closePopup();
|
|
107
|
+
_onBeforeNavigate === null || _onBeforeNavigate === void 0 || _onBeforeNavigate();
|
|
108
|
+
}
|
|
109
|
+
}, label);
|
|
110
|
+
})));
|
|
111
|
+
},
|
|
112
|
+
trigger: function trigger(triggerProps) {
|
|
113
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: (0, _runtime.ax)([triggerStyles.root, isOpen && triggerStyles.isOpen])
|
|
115
|
+
}, /*#__PURE__*/React.createElement(_new.default, (0, _extends2.default)({}, triggerProps, {
|
|
116
|
+
ref: (0, _mergeRefs.default)([triggerProps.ref, triggerRef]),
|
|
117
|
+
appearance: "primary",
|
|
118
|
+
isSelected: isOpen,
|
|
119
|
+
testId: testId ? "".concat(testId, "--skip-links-trigger") : undefined,
|
|
120
|
+
onClick: openPopup
|
|
121
|
+
}), triggerLabel));
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
@@ -45,6 +45,7 @@ var getByDomOrderSortFunction = function getByDomOrderSortFunction() {
|
|
|
45
45
|
function SkipLinksProvider(_ref) {
|
|
46
46
|
var children = _ref.children,
|
|
47
47
|
label = _ref.label,
|
|
48
|
+
triggerLabel = _ref.triggerLabel,
|
|
48
49
|
testId = _ref.testId;
|
|
49
50
|
var _useState = (0, _react.useState)([]),
|
|
50
51
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -84,6 +85,7 @@ function SkipLinksProvider(_ref) {
|
|
|
84
85
|
value: contextValue
|
|
85
86
|
}, /*#__PURE__*/_react.default.createElement(_skipLinksContainer.SkipLinksContainer, {
|
|
86
87
|
label: label,
|
|
88
|
+
triggerLabel: triggerLabel,
|
|
87
89
|
testId: testId,
|
|
88
90
|
links: links
|
|
89
91
|
}), children);
|
|
@@ -35,12 +35,14 @@ function Root(_ref) {
|
|
|
35
35
|
xcss = _ref.xcss,
|
|
36
36
|
_ref$UNSAFE_dangerous = _ref.UNSAFE_dangerouslyHoistSlotSizes,
|
|
37
37
|
UNSAFE_dangerouslyHoistSlotSizes = _ref$UNSAFE_dangerous === void 0 ? false : _ref$UNSAFE_dangerous,
|
|
38
|
-
skipLinksLabel = _ref.skipLinksLabel,
|
|
38
|
+
_ref$skipLinksLabel = _ref.skipLinksLabel,
|
|
39
|
+
skipLinksLabel = _ref$skipLinksLabel === void 0 ? (0, _platformFeatureFlags.fg)('platform_dst_nav4_skip_link_a11y_1') ? 'Skip to' : 'Skip to:' : _ref$skipLinksLabel,
|
|
40
|
+
_ref$skipLinksTrigger = _ref.skipLinksTriggerLabel,
|
|
41
|
+
skipLinksTriggerLabel = _ref$skipLinksTrigger === void 0 ? 'Skip to' : _ref$skipLinksTrigger,
|
|
39
42
|
testId = _ref.testId,
|
|
40
43
|
defaultSideNavCollapsed = _ref.defaultSideNavCollapsed,
|
|
41
44
|
_ref$isSideNavShortcu = _ref.isSideNavShortcutEnabled,
|
|
42
45
|
isSideNavShortcutEnabled = _ref$isSideNavShortcu === void 0 ? false : _ref$isSideNavShortcu;
|
|
43
|
-
var resolvedSkipLinksLabel = skipLinksLabel !== null && skipLinksLabel !== void 0 ? skipLinksLabel : (0, _platformFeatureFlags.fg)('platform_dst_nav4_skip_link_a11y_1') ? 'Skip to' : 'Skip to:';
|
|
44
46
|
var ref = (0, _react.useRef)(null);
|
|
45
47
|
(0, _react.useEffect)(function () {
|
|
46
48
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -62,7 +64,8 @@ function Root(_ref) {
|
|
|
62
64
|
}, /*#__PURE__*/_react.default.createElement(_topNavStartContextProvider.TopNavStartProvider, null, /*#__PURE__*/_react.default.createElement(_openLayerObserver.OpenLayerObserver, null, /*#__PURE__*/_react.default.createElement(_hoistSlotSizesContext.DangerouslyHoistSlotSizes.Provider, {
|
|
63
65
|
value: UNSAFE_dangerouslyHoistSlotSizes
|
|
64
66
|
}, /*#__PURE__*/_react.default.createElement(_skipLinksProvider.SkipLinksProvider, {
|
|
65
|
-
label:
|
|
67
|
+
label: skipLinksLabel,
|
|
68
|
+
triggerLabel: skipLinksTriggerLabel,
|
|
66
69
|
testId: testId
|
|
67
70
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
68
71
|
ref: ref,
|
|
@@ -20,7 +20,6 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
20
20
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
21
21
|
var _useStableRef = _interopRequireDefault(require("@atlaskit/ds-lib/use-stable-ref"));
|
|
22
22
|
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
23
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
23
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
25
24
|
var _responsive = require("@atlaskit/primitives/responsive");
|
|
26
25
|
var _useSkipLinkInternal = require("../../../context/skip-links/use-skip-link-internal");
|
|
@@ -358,23 +357,14 @@ function SideNavInternal(_ref) {
|
|
|
358
357
|
|
|
359
358
|
// Sync the visibility in context (provided in `<Root>`) with the local `defaultCollapsed` prop provided to `SideNav`
|
|
360
359
|
// after SSR hydration. This should only run once, after the initial render on the client.
|
|
361
|
-
|
|
362
|
-
(0, _react.startTransition)(function () {
|
|
363
|
-
setSideNavState({
|
|
364
|
-
desktop: initialDefaultCollapsed ? 'collapsed' : 'expanded',
|
|
365
|
-
mobile: 'collapsed',
|
|
366
|
-
flyout: 'closed',
|
|
367
|
-
lastTrigger: null
|
|
368
|
-
});
|
|
369
|
-
});
|
|
370
|
-
} else {
|
|
360
|
+
(0, _react.startTransition)(function () {
|
|
371
361
|
setSideNavState({
|
|
372
362
|
desktop: initialDefaultCollapsed ? 'collapsed' : 'expanded',
|
|
373
363
|
mobile: 'collapsed',
|
|
374
364
|
flyout: 'closed',
|
|
375
365
|
lastTrigger: null
|
|
376
366
|
});
|
|
377
|
-
}
|
|
367
|
+
});
|
|
378
368
|
}, [initialDefaultCollapsed, setSideNavState, sideNavState]);
|
|
379
369
|
var handleExpand = (0, _react.useCallback)(function (_ref2) {
|
|
380
370
|
var screen = _ref2.screen,
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
3
|
-
._2rko1mok{border-radius:var(--ds-radius-large,8px)}
|
|
4
3
|
._zulp1b66{gap:var(--ds-space-050,4px)}
|
|
5
|
-
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
6
4
|
._18zrutpp{padding-inline:var(--ds-space-150,9pt)}
|
|
7
|
-
.
|
|
8
|
-
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}
|
|
9
|
-
._152tv47k{inset-block-start:var(--ds-space-250,20px)}
|
|
5
|
+
._1rjcutpp{padding-block:var(--ds-space-150,9pt)}._152tv47k{inset-block-start:var(--ds-space-250,20px)}
|
|
10
6
|
._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
11
7
|
._1e02v47k{inset-inline-start:var(--ds-space-250,20px)}
|
|
12
8
|
._1e0c1txw{display:flex}
|
|
@@ -19,7 +15,6 @@
|
|
|
19
15
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
20
16
|
._kqsw1n9t{position:fixed}
|
|
21
17
|
._lcxvglyw{pointer-events:none}
|
|
22
|
-
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
23
18
|
._tzy4idpf{opacity:0}
|
|
24
19
|
._18eu1wug:focus-within{pointer-events:auto}
|
|
25
20
|
._1digjh3g:focus-within{z-index:calc(infinity)}
|
|
@@ -6,13 +6,10 @@ import { useMemo } from 'react';
|
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
7
|
import { Text } from '@atlaskit/primitives/compiled';
|
|
8
8
|
import { SkipLink } from './skip-link';
|
|
9
|
+
import { SkipLinksPopup } from './skip-links-popup';
|
|
9
10
|
const styles = {
|
|
10
|
-
root: "_1e0c1txw _2lx21bp4 _kqsw1n9t _1e02v47k _152tv47k _bfhk1bhr _16qs130s _1pby1mrw _tzy4idpf _lcxvglyw _1digjh3g _1mygkb7n _18eu1wug",
|
|
11
|
-
|
|
12
|
-
rootNew: "_2rko1mok _1rjcu2gc _18zrpxbi",
|
|
13
|
-
label: "_11c8i4vh _1rjcu2gc _syazazsu",
|
|
14
|
-
skipLinkList: "_1e0c1txw _2lx21bp4 _1x8w11lx _2mzuglyw _1pfhze3t _bozgze3t",
|
|
15
|
-
skipLinkListOld: "_zulp1b66"
|
|
11
|
+
root: "_zulp1b66 _2rko12b0 _1rjcutpp _18zrutpp _1e0c1txw _2lx21bp4 _kqsw1n9t _1e02v47k _152tv47k _bfhk1bhr _16qs130s _1pby1mrw _tzy4idpf _lcxvglyw _1digjh3g _1mygkb7n _18eu1wug",
|
|
12
|
+
skipLinkList: "_zulp1b66 _1e0c1txw _2lx21bp4 _1x8w11lx _2mzuglyw _1pfhze3t _bozgze3t"
|
|
16
13
|
};
|
|
17
14
|
|
|
18
15
|
/**
|
|
@@ -76,10 +73,11 @@ const isOnlyWhitespaceRegex = /^\s*$/;
|
|
|
76
73
|
* The label is used as the heading of the skip links container. If the provided label is a string
|
|
77
74
|
* comprised only of only whitespace (e.g. '' or ' '), the skip link heading element will be removed.
|
|
78
75
|
*
|
|
79
|
-
*
|
|
76
|
+
* When `platform_dst_nav4_skip_link_a11y_1` is enabled, rendering is delegated to `SkipLinksPopup`.
|
|
80
77
|
*/
|
|
81
78
|
export function SkipLinksContainer({
|
|
82
79
|
label,
|
|
80
|
+
triggerLabel,
|
|
83
81
|
testId,
|
|
84
82
|
links
|
|
85
83
|
}) {
|
|
@@ -90,18 +88,23 @@ export function SkipLinksContainer({
|
|
|
90
88
|
return null;
|
|
91
89
|
}
|
|
92
90
|
const isEmptyLabel = isOnlyWhitespaceRegex.test(label);
|
|
91
|
+
if (fg('platform_dst_nav4_skip_link_a11y_1')) {
|
|
92
|
+
return /*#__PURE__*/React.createElement(SkipLinksPopup, {
|
|
93
|
+
label: label,
|
|
94
|
+
triggerLabel: triggerLabel,
|
|
95
|
+
testId: testId,
|
|
96
|
+
links: sortedLinks
|
|
97
|
+
});
|
|
98
|
+
}
|
|
93
99
|
return /*#__PURE__*/React.createElement("div", {
|
|
94
100
|
onKeyDown: closeOnEscape,
|
|
95
101
|
"data-testid": testId ? `${testId}--skip-links-container` : undefined,
|
|
96
|
-
className: ax([styles.root
|
|
97
|
-
}, !isEmptyLabel &&
|
|
98
|
-
"data-testid": testId ? `${testId}--skip-links-container--label` : undefined,
|
|
99
|
-
className: ax([styles.label])
|
|
100
|
-
}, label) : /*#__PURE__*/React.createElement(Text, {
|
|
102
|
+
className: ax([styles.root])
|
|
103
|
+
}, !isEmptyLabel && /*#__PURE__*/React.createElement(Text, {
|
|
101
104
|
weight: "bold",
|
|
102
105
|
testId: testId ? `${testId}--skip-links-container--label` : undefined
|
|
103
|
-
}, label)
|
|
104
|
-
className: ax([styles.skipLinkList
|
|
106
|
+
}, label), /*#__PURE__*/React.createElement("ol", {
|
|
107
|
+
className: ax([styles.skipLinkList])
|
|
105
108
|
}, sortedLinks.map(({
|
|
106
109
|
id,
|
|
107
110
|
label,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
._11c8i4vh{font:var(--ds-font-heading-xxsmall,normal 653 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
2
|
+
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
3
|
+
._18zrpxbi{padding-inline:var(--ds-space-200,1pc)}
|
|
4
|
+
._1dqoglyw{border-style:none}
|
|
5
|
+
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}
|
|
6
|
+
._152tutpp{inset-block-start:var(--ds-space-150,9pt)}
|
|
7
|
+
._1e02utpp{inset-inline-start:var(--ds-space-150,9pt)}
|
|
8
|
+
._1e0c1txw{display:flex}
|
|
9
|
+
._1pby1mrw{z-index:-1}
|
|
10
|
+
._1pbyjh3g{z-index:calc(infinity)}
|
|
11
|
+
._1pfhze3t{margin-block-start:var(--ds-space-0,0)}
|
|
12
|
+
._1x8w11lx{list-style-position:outside}
|
|
13
|
+
._2lx21bp4{flex-direction:column}
|
|
14
|
+
._2mzuglyw{list-style-type:none}
|
|
15
|
+
._4ojojh3g:has(:focus-visible){z-index:calc(infinity)}
|
|
16
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
17
|
+
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
18
|
+
._c8j0kb7n:has(:focus-visible){opacity:1}
|
|
19
|
+
._kqsw1n9t{position:fixed}
|
|
20
|
+
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
21
|
+
._t9ecz6y5{transform:translateY(-100%)}
|
|
22
|
+
._tzy4idpf{opacity:0}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/* skip-links-popup.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./skip-links-popup.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useCallback, useId, useRef, useState } from 'react';
|
|
7
|
+
import { flushSync } from 'react-dom';
|
|
8
|
+
import Button from '@atlaskit/button/new';
|
|
9
|
+
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
10
|
+
import Popup from '@atlaskit/popup';
|
|
11
|
+
import { SkipLink } from './skip-link';
|
|
12
|
+
const contentStyles = {
|
|
13
|
+
root: "_1rjcu2gc _18zrpxbi _1e0c1txw _2lx21bp4 _1pbyjh3g",
|
|
14
|
+
skipLinkList: "_1e0c1txw _2lx21bp4 _1x8w11lx _2mzuglyw _1pfhze3t _bozgze3t",
|
|
15
|
+
label: "_11c8i4vh _1rjcu2gc _syazazsu"
|
|
16
|
+
};
|
|
17
|
+
const triggerStyles = {
|
|
18
|
+
root: "_2rko12b0 _1dqoglyw _kqsw1n9t _1e02utpp _152tutpp _1pby1mrw _tzy4idpf _bfhk1bhr _4ojojh3g _c8j0kb7n",
|
|
19
|
+
isOpen: "_tzy4idpf _t9ecz6y5"
|
|
20
|
+
};
|
|
21
|
+
const popupOffset = [0, 0];
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Skip links shown behind `platform_dst_nav4_skip_link_a11y_1`: a single focus-revealed
|
|
25
|
+
* control opens a dialog listing skip targets.
|
|
26
|
+
*/
|
|
27
|
+
export function SkipLinksPopup({
|
|
28
|
+
label: title,
|
|
29
|
+
triggerLabel,
|
|
30
|
+
testId,
|
|
31
|
+
links
|
|
32
|
+
}) {
|
|
33
|
+
const titleId = useId();
|
|
34
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
35
|
+
const triggerRef = useRef(null);
|
|
36
|
+
const openPopup = useCallback(() => {
|
|
37
|
+
setIsOpen(true);
|
|
38
|
+
}, []);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Closes the popup.
|
|
42
|
+
*
|
|
43
|
+
* Uses `flushSync` to avoid issues with focus management.
|
|
44
|
+
* This ensures the popup's focus lock is fully released by the time skip links or our `onClose` try to move focus.
|
|
45
|
+
*/
|
|
46
|
+
const closePopup = useCallback(() => {
|
|
47
|
+
flushSync(() => {
|
|
48
|
+
setIsOpen(false);
|
|
49
|
+
});
|
|
50
|
+
}, []);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Restores focus to the trigger on close, if it hasn't moved to another element, such as when Esc is pressed instead of a skip link.
|
|
54
|
+
*
|
|
55
|
+
* We need this because using the standard `shouldReturnFocus` on the popup would break the skip link focus behaviour,
|
|
56
|
+
* as focus would always move back to the trigger.
|
|
57
|
+
*/
|
|
58
|
+
const onClose = useCallback(() => {
|
|
59
|
+
closePopup();
|
|
60
|
+
|
|
61
|
+
// Focus on the body implies a skip link was not clicked
|
|
62
|
+
if (document.activeElement === document.body) {
|
|
63
|
+
var _triggerRef$current;
|
|
64
|
+
(_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
65
|
+
}
|
|
66
|
+
}, [closePopup]);
|
|
67
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
68
|
+
isOpen: isOpen,
|
|
69
|
+
onClose: onClose,
|
|
70
|
+
placement: "bottom-start",
|
|
71
|
+
shouldRenderToParent: true,
|
|
72
|
+
shouldReturnFocus: false,
|
|
73
|
+
role: "dialog",
|
|
74
|
+
titleId: titleId,
|
|
75
|
+
testId: testId ? `${testId}--skip-links-container` : undefined,
|
|
76
|
+
offset: popupOffset,
|
|
77
|
+
content: () => /*#__PURE__*/React.createElement("div", {
|
|
78
|
+
className: ax([contentStyles.root])
|
|
79
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
80
|
+
"data-testid": testId ? `${testId}--skip-links-container--label` : undefined,
|
|
81
|
+
id: titleId,
|
|
82
|
+
className: ax([contentStyles.label])
|
|
83
|
+
}, title), /*#__PURE__*/React.createElement("ol", {
|
|
84
|
+
className: ax([contentStyles.skipLinkList])
|
|
85
|
+
}, links.map(({
|
|
86
|
+
id,
|
|
87
|
+
label,
|
|
88
|
+
onBeforeNavigate
|
|
89
|
+
}) => /*#__PURE__*/React.createElement(SkipLink, {
|
|
90
|
+
key: id,
|
|
91
|
+
id: id,
|
|
92
|
+
onBeforeNavigate: () => {
|
|
93
|
+
closePopup();
|
|
94
|
+
onBeforeNavigate === null || onBeforeNavigate === void 0 ? void 0 : onBeforeNavigate();
|
|
95
|
+
}
|
|
96
|
+
}, label)))),
|
|
97
|
+
trigger: triggerProps => /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: ax([triggerStyles.root, isOpen && triggerStyles.isOpen])
|
|
99
|
+
}, /*#__PURE__*/React.createElement(Button, _extends({}, triggerProps, {
|
|
100
|
+
ref: mergeRefs([triggerProps.ref, triggerRef]),
|
|
101
|
+
appearance: "primary",
|
|
102
|
+
isSelected: isOpen,
|
|
103
|
+
testId: testId ? `${testId}--skip-links-trigger` : undefined,
|
|
104
|
+
onClick: openPopup
|
|
105
|
+
}), triggerLabel))
|
|
106
|
+
});
|
|
107
|
+
}
|
|
@@ -34,6 +34,7 @@ const getByDomOrderSortFunction = () => {
|
|
|
34
34
|
export function SkipLinksProvider({
|
|
35
35
|
children,
|
|
36
36
|
label,
|
|
37
|
+
triggerLabel,
|
|
37
38
|
testId
|
|
38
39
|
}) {
|
|
39
40
|
const [links, setLinks] = useState([]);
|
|
@@ -71,6 +72,7 @@ This error will not be shown in production, and the duplicate skip link will be
|
|
|
71
72
|
value: contextValue
|
|
72
73
|
}, /*#__PURE__*/React.createElement(SkipLinksContainer, {
|
|
73
74
|
label: label,
|
|
75
|
+
triggerLabel: triggerLabel,
|
|
74
76
|
testId: testId,
|
|
75
77
|
links: links
|
|
76
78
|
}), children);
|
|
@@ -26,12 +26,12 @@ export function Root({
|
|
|
26
26
|
children,
|
|
27
27
|
xcss,
|
|
28
28
|
UNSAFE_dangerouslyHoistSlotSizes = false,
|
|
29
|
-
skipLinksLabel,
|
|
29
|
+
skipLinksLabel = fg('platform_dst_nav4_skip_link_a11y_1') ? 'Skip to' : 'Skip to:',
|
|
30
|
+
skipLinksTriggerLabel = 'Skip to',
|
|
30
31
|
testId,
|
|
31
32
|
defaultSideNavCollapsed,
|
|
32
33
|
isSideNavShortcutEnabled = false
|
|
33
34
|
}) {
|
|
34
|
-
const resolvedSkipLinksLabel = skipLinksLabel !== null && skipLinksLabel !== void 0 ? skipLinksLabel : fg('platform_dst_nav4_skip_link_a11y_1') ? 'Skip to' : 'Skip to:';
|
|
35
35
|
const ref = useRef(null);
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -62,7 +62,8 @@ This message will not be displayed in production.
|
|
|
62
62
|
}, /*#__PURE__*/React.createElement(TopNavStartProvider, null, /*#__PURE__*/React.createElement(OpenLayerObserver, null, /*#__PURE__*/React.createElement(DangerouslyHoistSlotSizes.Provider, {
|
|
63
63
|
value: UNSAFE_dangerouslyHoistSlotSizes
|
|
64
64
|
}, /*#__PURE__*/React.createElement(SkipLinksProvider, {
|
|
65
|
-
label:
|
|
65
|
+
label: skipLinksLabel,
|
|
66
|
+
triggerLabel: skipLinksTriggerLabel,
|
|
66
67
|
testId: testId
|
|
67
68
|
}, /*#__PURE__*/React.createElement("div", {
|
|
68
69
|
ref: ref,
|