@atlaskit/navigation-system 5.39.1 → 5.40.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 +13 -0
- package/dist/cjs/ui/page-layout/side-nav/side-nav.js +27 -39
- package/dist/cjs/ui/page-layout/side-nav/toggle-button.js +0 -5
- package/dist/cjs/ui/page-layout/side-nav/use-side-nav-visibility-callbacks.js +20 -49
- package/dist/es2019/ui/page-layout/side-nav/side-nav.js +27 -39
- package/dist/es2019/ui/page-layout/side-nav/toggle-button.js +0 -5
- package/dist/es2019/ui/page-layout/side-nav/use-side-nav-visibility-callbacks.js +20 -49
- package/dist/esm/ui/page-layout/side-nav/side-nav.js +27 -39
- package/dist/esm/ui/page-layout/side-nav/toggle-button.js +0 -5
- package/dist/esm/ui/page-layout/side-nav/use-side-nav-visibility-callbacks.js +20 -49
- package/dist/types/ui/page-layout/side-nav/side-nav.d.ts +0 -4
- package/dist/types-ts4.5/ui/page-layout/side-nav/side-nav.d.ts +0 -4
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 5.40.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`d181fe4b076de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d181fe4b076de) -
|
|
8
|
+
Tidies the `platform_dst_nav4_fhs_instrumentation_1` feature gate. Analytics events for
|
|
9
|
+
`sideNavMenu viewedOnLoad` + `sideNavButton hovered` + `sideNav expanded` + `sideNav collapsed`
|
|
10
|
+
are now always fired.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 5.39.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -163,7 +163,7 @@ function SideNavInternal(_ref) {
|
|
|
163
163
|
* Only firing on desktop because the nav is never open by default on mobile.
|
|
164
164
|
*/
|
|
165
165
|
(0, _react.useEffect)(function () {
|
|
166
|
-
if (initialIsExpandedOnDesktop
|
|
166
|
+
if (initialIsExpandedOnDesktop) {
|
|
167
167
|
var isDesktop = window.matchMedia('(min-width: 64rem)').matches;
|
|
168
168
|
if (isDesktop) {
|
|
169
169
|
var navigationAnalyticsEvent = createAnalyticsEvent({
|
|
@@ -368,26 +368,20 @@ function SideNavInternal(_ref) {
|
|
|
368
368
|
var handleExpand = (0, _react.useCallback)(function (_ref2) {
|
|
369
369
|
var screen = _ref2.screen,
|
|
370
370
|
trigger = _ref2.trigger;
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
onExpand === null || onExpand === void 0 || onExpand({
|
|
372
|
+
screen: screen,
|
|
373
|
+
trigger: trigger
|
|
374
|
+
});
|
|
375
|
+
var navigationAnalyticsEvent = createAnalyticsEvent({
|
|
376
|
+
source: 'topNav',
|
|
377
|
+
actionSubject: 'sideNav',
|
|
378
|
+
action: 'expanded',
|
|
379
|
+
actionSubjectId: 'sideNavMenu',
|
|
380
|
+
attributes: {
|
|
374
381
|
trigger: trigger
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
actionSubject: 'sideNav',
|
|
379
|
-
action: 'expanded',
|
|
380
|
-
actionSubjectId: 'sideNavMenu',
|
|
381
|
-
attributes: {
|
|
382
|
-
trigger: trigger
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
navigationAnalyticsEvent.fire('navigation');
|
|
386
|
-
} else {
|
|
387
|
-
onExpand === null || onExpand === void 0 || onExpand({
|
|
388
|
-
screen: screen
|
|
389
|
-
});
|
|
390
|
-
}
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
navigationAnalyticsEvent.fire('navigation');
|
|
391
385
|
|
|
392
386
|
// When the side nav gets expanded, we close the flyout to reset it.
|
|
393
387
|
// This prevents the flyout from staying open and ensures we are respecting the user's intent to expand.
|
|
@@ -396,26 +390,20 @@ function SideNavInternal(_ref) {
|
|
|
396
390
|
var handleCollapse = (0, _react.useCallback)(function (_ref3) {
|
|
397
391
|
var screen = _ref3.screen,
|
|
398
392
|
trigger = _ref3.trigger;
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
393
|
+
onCollapse === null || onCollapse === void 0 || onCollapse({
|
|
394
|
+
screen: screen,
|
|
395
|
+
trigger: trigger
|
|
396
|
+
});
|
|
397
|
+
var navigationAnalyticsEvent = createAnalyticsEvent({
|
|
398
|
+
source: 'topNav',
|
|
399
|
+
actionSubject: 'sideNav',
|
|
400
|
+
action: 'collapsed',
|
|
401
|
+
actionSubjectId: 'sideNavMenu',
|
|
402
|
+
attributes: {
|
|
402
403
|
trigger: trigger
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
actionSubject: 'sideNav',
|
|
407
|
-
action: 'collapsed',
|
|
408
|
-
actionSubjectId: 'sideNavMenu',
|
|
409
|
-
attributes: {
|
|
410
|
-
trigger: trigger
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
navigationAnalyticsEvent.fire('navigation');
|
|
414
|
-
} else {
|
|
415
|
-
onCollapse === null || onCollapse === void 0 || onCollapse({
|
|
416
|
-
screen: screen
|
|
417
|
-
});
|
|
418
|
-
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
navigationAnalyticsEvent.fire('navigation');
|
|
419
407
|
|
|
420
408
|
// When the side nav gets collapsed, we close the flyout to reset it.
|
|
421
409
|
// This prevents the flyout from staying open and ensures we are respecting the user's intent to collapse.
|
|
@@ -17,7 +17,6 @@ var _analyticsNext = require("@atlaskit/analytics-next");
|
|
|
17
17
|
var _sidebarCollapse = _interopRequireDefault(require("@atlaskit/icon/core/sidebar-collapse"));
|
|
18
18
|
var _sidebarExpand = _interopRequireDefault(require("@atlaskit/icon/core/sidebar-expand"));
|
|
19
19
|
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
20
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
20
|
var _useIsFhsEnabled = require("../../fhs-rollout/use-is-fhs-enabled");
|
|
22
21
|
var _migration = require("../../top-nav-items/themed/migration");
|
|
23
22
|
var _isSideNavShortcutEnabledContext = require("./is-side-nav-shortcut-enabled-context");
|
|
@@ -113,10 +112,6 @@ var SideNavToggleButton = exports.SideNavToggleButton = function SideNavToggleBu
|
|
|
113
112
|
}
|
|
114
113
|
}, [isFhsEnabled, isSideNavExpanded, onClick, openLayerObserver, toggleVisibility]);
|
|
115
114
|
var handlePointerEnter = (0, _react.useCallback)(function () {
|
|
116
|
-
if (!(0, _platformFeatureFlags.fg)('platform_dst_nav4_fhs_instrumentation_1')) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
115
|
// Hovers don't do anything on mobile, so not capturing
|
|
121
116
|
var isDesktop = window.matchMedia('(min-width: 64rem)').matches;
|
|
122
117
|
if (!isDesktop) {
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useSideNavVisibilityCallbacks = useSideNavVisibilityCallbacks;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _usePreviousValue = _interopRequireDefault(require("@atlaskit/ds-lib/use-previous-value"));
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
/**
|
|
12
11
|
* Calls the `onExpand` and `onCollapse` callbacks as required.
|
|
13
12
|
* This is used for both user-provided callbacks, as well as internal callbacks to respond to visibility state changes.
|
|
@@ -38,31 +37,17 @@ function useSideNavVisibilityCallbacks(_ref) {
|
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
39
|
if (isExpandedOnDesktop) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
});
|
|
47
|
-
} else {
|
|
48
|
-
var _onExpandRef$current2;
|
|
49
|
-
(_onExpandRef$current2 = onExpandRef.current) === null || _onExpandRef$current2 === void 0 || _onExpandRef$current2.call(onExpandRef, {
|
|
50
|
-
screen: 'desktop'
|
|
51
|
-
});
|
|
52
|
-
}
|
|
40
|
+
var _onExpandRef$current;
|
|
41
|
+
(_onExpandRef$current = onExpandRef.current) === null || _onExpandRef$current === void 0 || _onExpandRef$current.call(onExpandRef, {
|
|
42
|
+
screen: 'desktop',
|
|
43
|
+
trigger: lastTrigger
|
|
44
|
+
});
|
|
53
45
|
} else {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
});
|
|
60
|
-
} else {
|
|
61
|
-
var _onCollapseRef$curren2;
|
|
62
|
-
(_onCollapseRef$curren2 = onCollapseRef.current) === null || _onCollapseRef$curren2 === void 0 || _onCollapseRef$curren2.call(onCollapseRef, {
|
|
63
|
-
screen: 'desktop'
|
|
64
|
-
});
|
|
65
|
-
}
|
|
46
|
+
var _onCollapseRef$curren;
|
|
47
|
+
(_onCollapseRef$curren = onCollapseRef.current) === null || _onCollapseRef$curren === void 0 || _onCollapseRef$curren.call(onCollapseRef, {
|
|
48
|
+
screen: 'desktop',
|
|
49
|
+
trigger: lastTrigger
|
|
50
|
+
});
|
|
66
51
|
}
|
|
67
52
|
}, [previousIsExpandedOnDesktop, isExpandedOnDesktop, lastTrigger]);
|
|
68
53
|
var previousIsExpandedOnMobile = (0, _usePreviousValue.default)(isExpandedOnMobile);
|
|
@@ -78,31 +63,17 @@ function useSideNavVisibilityCallbacks(_ref) {
|
|
|
78
63
|
return;
|
|
79
64
|
}
|
|
80
65
|
if (isExpandedOnMobile) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
87
|
-
} else {
|
|
88
|
-
var _onExpandRef$current4;
|
|
89
|
-
(_onExpandRef$current4 = onExpandRef.current) === null || _onExpandRef$current4 === void 0 || _onExpandRef$current4.call(onExpandRef, {
|
|
90
|
-
screen: 'mobile'
|
|
91
|
-
});
|
|
92
|
-
}
|
|
66
|
+
var _onExpandRef$current2;
|
|
67
|
+
(_onExpandRef$current2 = onExpandRef.current) === null || _onExpandRef$current2 === void 0 || _onExpandRef$current2.call(onExpandRef, {
|
|
68
|
+
screen: 'mobile',
|
|
69
|
+
trigger: lastTrigger
|
|
70
|
+
});
|
|
93
71
|
} else {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
});
|
|
100
|
-
} else {
|
|
101
|
-
var _onCollapseRef$curren4;
|
|
102
|
-
(_onCollapseRef$curren4 = onCollapseRef.current) === null || _onCollapseRef$curren4 === void 0 || _onCollapseRef$curren4.call(onCollapseRef, {
|
|
103
|
-
screen: 'mobile'
|
|
104
|
-
});
|
|
105
|
-
}
|
|
72
|
+
var _onCollapseRef$curren2;
|
|
73
|
+
(_onCollapseRef$curren2 = onCollapseRef.current) === null || _onCollapseRef$curren2 === void 0 || _onCollapseRef$curren2.call(onCollapseRef, {
|
|
74
|
+
screen: 'mobile',
|
|
75
|
+
trigger: lastTrigger
|
|
76
|
+
});
|
|
106
77
|
}
|
|
107
78
|
}, [previousIsExpandedOnMobile, isExpandedOnMobile, lastTrigger]);
|
|
108
79
|
}
|
|
@@ -145,7 +145,7 @@ function SideNavInternal({
|
|
|
145
145
|
* Only firing on desktop because the nav is never open by default on mobile.
|
|
146
146
|
*/
|
|
147
147
|
useEffect(() => {
|
|
148
|
-
if (initialIsExpandedOnDesktop
|
|
148
|
+
if (initialIsExpandedOnDesktop) {
|
|
149
149
|
const isDesktop = window.matchMedia('(min-width: 64rem)').matches;
|
|
150
150
|
if (isDesktop) {
|
|
151
151
|
const navigationAnalyticsEvent = createAnalyticsEvent({
|
|
@@ -350,26 +350,20 @@ function SideNavInternal({
|
|
|
350
350
|
screen,
|
|
351
351
|
trigger
|
|
352
352
|
}) => {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
353
|
+
onExpand === null || onExpand === void 0 ? void 0 : onExpand({
|
|
354
|
+
screen,
|
|
355
|
+
trigger
|
|
356
|
+
});
|
|
357
|
+
const navigationAnalyticsEvent = createAnalyticsEvent({
|
|
358
|
+
source: 'topNav',
|
|
359
|
+
actionSubject: 'sideNav',
|
|
360
|
+
action: 'expanded',
|
|
361
|
+
actionSubjectId: 'sideNavMenu',
|
|
362
|
+
attributes: {
|
|
356
363
|
trigger
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
actionSubject: 'sideNav',
|
|
361
|
-
action: 'expanded',
|
|
362
|
-
actionSubjectId: 'sideNavMenu',
|
|
363
|
-
attributes: {
|
|
364
|
-
trigger
|
|
365
|
-
}
|
|
366
|
-
});
|
|
367
|
-
navigationAnalyticsEvent.fire('navigation');
|
|
368
|
-
} else {
|
|
369
|
-
onExpand === null || onExpand === void 0 ? void 0 : onExpand({
|
|
370
|
-
screen
|
|
371
|
-
});
|
|
372
|
-
}
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
navigationAnalyticsEvent.fire('navigation');
|
|
373
367
|
|
|
374
368
|
// When the side nav gets expanded, we close the flyout to reset it.
|
|
375
369
|
// This prevents the flyout from staying open and ensures we are respecting the user's intent to expand.
|
|
@@ -379,26 +373,20 @@ function SideNavInternal({
|
|
|
379
373
|
screen,
|
|
380
374
|
trigger
|
|
381
375
|
}) => {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
376
|
+
onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse({
|
|
377
|
+
screen,
|
|
378
|
+
trigger
|
|
379
|
+
});
|
|
380
|
+
const navigationAnalyticsEvent = createAnalyticsEvent({
|
|
381
|
+
source: 'topNav',
|
|
382
|
+
actionSubject: 'sideNav',
|
|
383
|
+
action: 'collapsed',
|
|
384
|
+
actionSubjectId: 'sideNavMenu',
|
|
385
|
+
attributes: {
|
|
385
386
|
trigger
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
actionSubject: 'sideNav',
|
|
390
|
-
action: 'collapsed',
|
|
391
|
-
actionSubjectId: 'sideNavMenu',
|
|
392
|
-
attributes: {
|
|
393
|
-
trigger
|
|
394
|
-
}
|
|
395
|
-
});
|
|
396
|
-
navigationAnalyticsEvent.fire('navigation');
|
|
397
|
-
} else {
|
|
398
|
-
onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse({
|
|
399
|
-
screen
|
|
400
|
-
});
|
|
401
|
-
}
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
navigationAnalyticsEvent.fire('navigation');
|
|
402
390
|
|
|
403
391
|
// When the side nav gets collapsed, we close the flyout to reset it.
|
|
404
392
|
// This prevents the flyout from staying open and ensures we are respecting the user's intent to collapse.
|
|
@@ -7,7 +7,6 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
7
7
|
import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
|
|
8
8
|
import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
|
|
9
9
|
import { useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
10
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
10
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
12
11
|
import { IconButton } from '../../top-nav-items/themed/migration';
|
|
13
12
|
import { useIsSideNavShortcutEnabled } from './is-side-nav-shortcut-enabled-context';
|
|
@@ -97,10 +96,6 @@ export const SideNavToggleButton = ({
|
|
|
97
96
|
}
|
|
98
97
|
}, [isFhsEnabled, isSideNavExpanded, onClick, openLayerObserver, toggleVisibility]);
|
|
99
98
|
const handlePointerEnter = useCallback(() => {
|
|
100
|
-
if (!fg('platform_dst_nav4_fhs_instrumentation_1')) {
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
99
|
// Hovers don't do anything on mobile, so not capturing
|
|
105
100
|
const isDesktop = window.matchMedia('(min-width: 64rem)').matches;
|
|
106
101
|
if (!isDesktop) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
/**
|
|
5
4
|
* Calls the `onExpand` and `onCollapse` callbacks as required.
|
|
6
5
|
* This is used for both user-provided callbacks, as well as internal callbacks to respond to visibility state changes.
|
|
@@ -32,31 +31,17 @@ export function useSideNavVisibilityCallbacks({
|
|
|
32
31
|
return;
|
|
33
32
|
}
|
|
34
33
|
if (isExpandedOnDesktop) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
} else {
|
|
42
|
-
var _onExpandRef$current2;
|
|
43
|
-
(_onExpandRef$current2 = onExpandRef.current) === null || _onExpandRef$current2 === void 0 ? void 0 : _onExpandRef$current2.call(onExpandRef, {
|
|
44
|
-
screen: 'desktop'
|
|
45
|
-
});
|
|
46
|
-
}
|
|
34
|
+
var _onExpandRef$current;
|
|
35
|
+
(_onExpandRef$current = onExpandRef.current) === null || _onExpandRef$current === void 0 ? void 0 : _onExpandRef$current.call(onExpandRef, {
|
|
36
|
+
screen: 'desktop',
|
|
37
|
+
trigger: lastTrigger
|
|
38
|
+
});
|
|
47
39
|
} else {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
} else {
|
|
55
|
-
var _onCollapseRef$curren2;
|
|
56
|
-
(_onCollapseRef$curren2 = onCollapseRef.current) === null || _onCollapseRef$curren2 === void 0 ? void 0 : _onCollapseRef$curren2.call(onCollapseRef, {
|
|
57
|
-
screen: 'desktop'
|
|
58
|
-
});
|
|
59
|
-
}
|
|
40
|
+
var _onCollapseRef$curren;
|
|
41
|
+
(_onCollapseRef$curren = onCollapseRef.current) === null || _onCollapseRef$curren === void 0 ? void 0 : _onCollapseRef$curren.call(onCollapseRef, {
|
|
42
|
+
screen: 'desktop',
|
|
43
|
+
trigger: lastTrigger
|
|
44
|
+
});
|
|
60
45
|
}
|
|
61
46
|
}, [previousIsExpandedOnDesktop, isExpandedOnDesktop, lastTrigger]);
|
|
62
47
|
const previousIsExpandedOnMobile = usePreviousValue(isExpandedOnMobile);
|
|
@@ -72,31 +57,17 @@ export function useSideNavVisibilityCallbacks({
|
|
|
72
57
|
return;
|
|
73
58
|
}
|
|
74
59
|
if (isExpandedOnMobile) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
81
|
-
} else {
|
|
82
|
-
var _onExpandRef$current4;
|
|
83
|
-
(_onExpandRef$current4 = onExpandRef.current) === null || _onExpandRef$current4 === void 0 ? void 0 : _onExpandRef$current4.call(onExpandRef, {
|
|
84
|
-
screen: 'mobile'
|
|
85
|
-
});
|
|
86
|
-
}
|
|
60
|
+
var _onExpandRef$current2;
|
|
61
|
+
(_onExpandRef$current2 = onExpandRef.current) === null || _onExpandRef$current2 === void 0 ? void 0 : _onExpandRef$current2.call(onExpandRef, {
|
|
62
|
+
screen: 'mobile',
|
|
63
|
+
trigger: lastTrigger
|
|
64
|
+
});
|
|
87
65
|
} else {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
94
|
-
} else {
|
|
95
|
-
var _onCollapseRef$curren4;
|
|
96
|
-
(_onCollapseRef$curren4 = onCollapseRef.current) === null || _onCollapseRef$curren4 === void 0 ? void 0 : _onCollapseRef$curren4.call(onCollapseRef, {
|
|
97
|
-
screen: 'mobile'
|
|
98
|
-
});
|
|
99
|
-
}
|
|
66
|
+
var _onCollapseRef$curren2;
|
|
67
|
+
(_onCollapseRef$curren2 = onCollapseRef.current) === null || _onCollapseRef$curren2 === void 0 ? void 0 : _onCollapseRef$curren2.call(onCollapseRef, {
|
|
68
|
+
screen: 'mobile',
|
|
69
|
+
trigger: lastTrigger
|
|
70
|
+
});
|
|
100
71
|
}
|
|
101
72
|
}, [previousIsExpandedOnMobile, isExpandedOnMobile, lastTrigger]);
|
|
102
73
|
}
|
|
@@ -153,7 +153,7 @@ function SideNavInternal(_ref) {
|
|
|
153
153
|
* Only firing on desktop because the nav is never open by default on mobile.
|
|
154
154
|
*/
|
|
155
155
|
useEffect(function () {
|
|
156
|
-
if (initialIsExpandedOnDesktop
|
|
156
|
+
if (initialIsExpandedOnDesktop) {
|
|
157
157
|
var isDesktop = window.matchMedia('(min-width: 64rem)').matches;
|
|
158
158
|
if (isDesktop) {
|
|
159
159
|
var navigationAnalyticsEvent = createAnalyticsEvent({
|
|
@@ -358,26 +358,20 @@ function SideNavInternal(_ref) {
|
|
|
358
358
|
var handleExpand = useCallback(function (_ref2) {
|
|
359
359
|
var screen = _ref2.screen,
|
|
360
360
|
trigger = _ref2.trigger;
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
onExpand === null || onExpand === void 0 || onExpand({
|
|
362
|
+
screen: screen,
|
|
363
|
+
trigger: trigger
|
|
364
|
+
});
|
|
365
|
+
var navigationAnalyticsEvent = createAnalyticsEvent({
|
|
366
|
+
source: 'topNav',
|
|
367
|
+
actionSubject: 'sideNav',
|
|
368
|
+
action: 'expanded',
|
|
369
|
+
actionSubjectId: 'sideNavMenu',
|
|
370
|
+
attributes: {
|
|
364
371
|
trigger: trigger
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
actionSubject: 'sideNav',
|
|
369
|
-
action: 'expanded',
|
|
370
|
-
actionSubjectId: 'sideNavMenu',
|
|
371
|
-
attributes: {
|
|
372
|
-
trigger: trigger
|
|
373
|
-
}
|
|
374
|
-
});
|
|
375
|
-
navigationAnalyticsEvent.fire('navigation');
|
|
376
|
-
} else {
|
|
377
|
-
onExpand === null || onExpand === void 0 || onExpand({
|
|
378
|
-
screen: screen
|
|
379
|
-
});
|
|
380
|
-
}
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
navigationAnalyticsEvent.fire('navigation');
|
|
381
375
|
|
|
382
376
|
// When the side nav gets expanded, we close the flyout to reset it.
|
|
383
377
|
// This prevents the flyout from staying open and ensures we are respecting the user's intent to expand.
|
|
@@ -386,26 +380,20 @@ function SideNavInternal(_ref) {
|
|
|
386
380
|
var handleCollapse = useCallback(function (_ref3) {
|
|
387
381
|
var screen = _ref3.screen,
|
|
388
382
|
trigger = _ref3.trigger;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
383
|
+
onCollapse === null || onCollapse === void 0 || onCollapse({
|
|
384
|
+
screen: screen,
|
|
385
|
+
trigger: trigger
|
|
386
|
+
});
|
|
387
|
+
var navigationAnalyticsEvent = createAnalyticsEvent({
|
|
388
|
+
source: 'topNav',
|
|
389
|
+
actionSubject: 'sideNav',
|
|
390
|
+
action: 'collapsed',
|
|
391
|
+
actionSubjectId: 'sideNavMenu',
|
|
392
|
+
attributes: {
|
|
392
393
|
trigger: trigger
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
actionSubject: 'sideNav',
|
|
397
|
-
action: 'collapsed',
|
|
398
|
-
actionSubjectId: 'sideNavMenu',
|
|
399
|
-
attributes: {
|
|
400
|
-
trigger: trigger
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
navigationAnalyticsEvent.fire('navigation');
|
|
404
|
-
} else {
|
|
405
|
-
onCollapse === null || onCollapse === void 0 || onCollapse({
|
|
406
|
-
screen: screen
|
|
407
|
-
});
|
|
408
|
-
}
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
navigationAnalyticsEvent.fire('navigation');
|
|
409
397
|
|
|
410
398
|
// When the side nav gets collapsed, we close the flyout to reset it.
|
|
411
399
|
// This prevents the flyout from staying open and ensures we are respecting the user's intent to collapse.
|
|
@@ -11,7 +11,6 @@ import { useAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
|
11
11
|
import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
|
|
12
12
|
import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
|
|
13
13
|
import { useOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
14
|
import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
|
|
16
15
|
import { IconButton } from '../../top-nav-items/themed/migration';
|
|
17
16
|
import { useIsSideNavShortcutEnabled } from './is-side-nav-shortcut-enabled-context';
|
|
@@ -104,10 +103,6 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
|
|
|
104
103
|
}
|
|
105
104
|
}, [isFhsEnabled, isSideNavExpanded, onClick, openLayerObserver, toggleVisibility]);
|
|
106
105
|
var handlePointerEnter = useCallback(function () {
|
|
107
|
-
if (!fg('platform_dst_nav4_fhs_instrumentation_1')) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
106
|
// Hovers don't do anything on mobile, so not capturing
|
|
112
107
|
var isDesktop = window.matchMedia('(min-width: 64rem)').matches;
|
|
113
108
|
if (!isDesktop) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
|
|
3
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
/**
|
|
5
4
|
* Calls the `onExpand` and `onCollapse` callbacks as required.
|
|
6
5
|
* This is used for both user-provided callbacks, as well as internal callbacks to respond to visibility state changes.
|
|
@@ -31,31 +30,17 @@ export function useSideNavVisibilityCallbacks(_ref) {
|
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
32
|
if (isExpandedOnDesktop) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
});
|
|
40
|
-
} else {
|
|
41
|
-
var _onExpandRef$current2;
|
|
42
|
-
(_onExpandRef$current2 = onExpandRef.current) === null || _onExpandRef$current2 === void 0 || _onExpandRef$current2.call(onExpandRef, {
|
|
43
|
-
screen: 'desktop'
|
|
44
|
-
});
|
|
45
|
-
}
|
|
33
|
+
var _onExpandRef$current;
|
|
34
|
+
(_onExpandRef$current = onExpandRef.current) === null || _onExpandRef$current === void 0 || _onExpandRef$current.call(onExpandRef, {
|
|
35
|
+
screen: 'desktop',
|
|
36
|
+
trigger: lastTrigger
|
|
37
|
+
});
|
|
46
38
|
} else {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
53
|
-
} else {
|
|
54
|
-
var _onCollapseRef$curren2;
|
|
55
|
-
(_onCollapseRef$curren2 = onCollapseRef.current) === null || _onCollapseRef$curren2 === void 0 || _onCollapseRef$curren2.call(onCollapseRef, {
|
|
56
|
-
screen: 'desktop'
|
|
57
|
-
});
|
|
58
|
-
}
|
|
39
|
+
var _onCollapseRef$curren;
|
|
40
|
+
(_onCollapseRef$curren = onCollapseRef.current) === null || _onCollapseRef$curren === void 0 || _onCollapseRef$curren.call(onCollapseRef, {
|
|
41
|
+
screen: 'desktop',
|
|
42
|
+
trigger: lastTrigger
|
|
43
|
+
});
|
|
59
44
|
}
|
|
60
45
|
}, [previousIsExpandedOnDesktop, isExpandedOnDesktop, lastTrigger]);
|
|
61
46
|
var previousIsExpandedOnMobile = usePreviousValue(isExpandedOnMobile);
|
|
@@ -71,31 +56,17 @@ export function useSideNavVisibilityCallbacks(_ref) {
|
|
|
71
56
|
return;
|
|
72
57
|
}
|
|
73
58
|
if (isExpandedOnMobile) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
} else {
|
|
81
|
-
var _onExpandRef$current4;
|
|
82
|
-
(_onExpandRef$current4 = onExpandRef.current) === null || _onExpandRef$current4 === void 0 || _onExpandRef$current4.call(onExpandRef, {
|
|
83
|
-
screen: 'mobile'
|
|
84
|
-
});
|
|
85
|
-
}
|
|
59
|
+
var _onExpandRef$current2;
|
|
60
|
+
(_onExpandRef$current2 = onExpandRef.current) === null || _onExpandRef$current2 === void 0 || _onExpandRef$current2.call(onExpandRef, {
|
|
61
|
+
screen: 'mobile',
|
|
62
|
+
trigger: lastTrigger
|
|
63
|
+
});
|
|
86
64
|
} else {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
});
|
|
93
|
-
} else {
|
|
94
|
-
var _onCollapseRef$curren4;
|
|
95
|
-
(_onCollapseRef$curren4 = onCollapseRef.current) === null || _onCollapseRef$curren4 === void 0 || _onCollapseRef$curren4.call(onCollapseRef, {
|
|
96
|
-
screen: 'mobile'
|
|
97
|
-
});
|
|
98
|
-
}
|
|
65
|
+
var _onCollapseRef$curren2;
|
|
66
|
+
(_onCollapseRef$curren2 = onCollapseRef.current) === null || _onCollapseRef$curren2 === void 0 || _onCollapseRef$curren2.call(onCollapseRef, {
|
|
67
|
+
screen: 'mobile',
|
|
68
|
+
trigger: lastTrigger
|
|
69
|
+
});
|
|
99
70
|
}
|
|
100
71
|
}, [previousIsExpandedOnMobile, isExpandedOnMobile, lastTrigger]);
|
|
101
72
|
}
|
|
@@ -49,14 +49,10 @@ type SideNavProps = CommonSlotProps & {
|
|
|
49
49
|
defaultWidth?: number;
|
|
50
50
|
/**
|
|
51
51
|
* Called when the side nav is expanded.
|
|
52
|
-
*
|
|
53
|
-
* Note: The trigger parameter is only provided when the `platform_dst_nav4_fhs_instrumentation_1` feature flag is enabled.
|
|
54
52
|
*/
|
|
55
53
|
onExpand?: VisibilityCallback;
|
|
56
54
|
/**
|
|
57
55
|
* Called when the side nav is collapsed.
|
|
58
|
-
*
|
|
59
|
-
* Note: The trigger parameter is only provided when the `platform_dst_nav4_fhs_instrumentation_1` feature flag is enabled.
|
|
60
56
|
*/
|
|
61
57
|
onCollapse?: VisibilityCallback;
|
|
62
58
|
/**
|
|
@@ -49,14 +49,10 @@ type SideNavProps = CommonSlotProps & {
|
|
|
49
49
|
defaultWidth?: number;
|
|
50
50
|
/**
|
|
51
51
|
* Called when the side nav is expanded.
|
|
52
|
-
*
|
|
53
|
-
* Note: The trigger parameter is only provided when the `platform_dst_nav4_fhs_instrumentation_1` feature flag is enabled.
|
|
54
52
|
*/
|
|
55
53
|
onExpand?: VisibilityCallback;
|
|
56
54
|
/**
|
|
57
55
|
* Called when the side nav is collapsed.
|
|
58
|
-
*
|
|
59
|
-
* Note: The trigger parameter is only provided when the `platform_dst_nav4_fhs_instrumentation_1` feature flag is enabled.
|
|
60
56
|
*/
|
|
61
57
|
onCollapse?: VisibilityCallback;
|
|
62
58
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.40.0",
|
|
4
4
|
"description": "The latest navigation system for Atlassian apps.",
|
|
5
5
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
6
6
|
"author": "Atlassian Pty Ltd",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"@atlaskit/badge": "^18.4.0",
|
|
101
101
|
"@atlaskit/banner": "^14.0.0",
|
|
102
102
|
"@atlaskit/breadcrumbs": "^15.3.0",
|
|
103
|
-
"@atlaskit/dropdown-menu": "^16.
|
|
103
|
+
"@atlaskit/dropdown-menu": "^16.5.0",
|
|
104
104
|
"@atlaskit/form": "^15.3.0",
|
|
105
105
|
"@atlaskit/heading": "^5.3.0",
|
|
106
106
|
"@atlaskit/link": "^3.3.0",
|
|
@@ -159,9 +159,6 @@
|
|
|
159
159
|
"platform_dst_nav4_side_nav_resize_tooltip_feedback": {
|
|
160
160
|
"type": "boolean"
|
|
161
161
|
},
|
|
162
|
-
"platform_dst_nav4_fhs_instrumentation_1": {
|
|
163
|
-
"type": "boolean"
|
|
164
|
-
},
|
|
165
162
|
"platform-component-visual-refresh": {
|
|
166
163
|
"type": "boolean",
|
|
167
164
|
"referenceOnly": true
|