@atlaskit/atlassian-navigation 2.5.1 → 2.6.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 +12 -0
- package/dist/cjs/components/AtlassianNavigation/index.js +11 -1
- package/dist/cjs/components/PrimaryItemsContainer/skeleton.js +2 -2
- package/dist/cjs/components/PrimaryItemsContainerV2/index.js +149 -0
- package/dist/cjs/components/ProductHome/custom-product-home.js +6 -1
- package/dist/cjs/components/ProductHome/product-home.js +7 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/AtlassianNavigation/index.js +11 -1
- package/dist/es2019/components/PrimaryItemsContainer/skeleton.js +3 -3
- package/dist/es2019/components/PrimaryItemsContainerV2/index.js +129 -0
- package/dist/es2019/components/ProductHome/custom-product-home.js +9 -1
- package/dist/es2019/components/ProductHome/product-home.js +10 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/AtlassianNavigation/index.js +11 -1
- package/dist/esm/components/PrimaryItemsContainer/skeleton.js +3 -3
- package/dist/esm/components/PrimaryItemsContainerV2/index.js +138 -0
- package/dist/esm/components/ProductHome/custom-product-home.js +6 -1
- package/dist/esm/components/ProductHome/product-home.js +7 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/components/PrimaryItemsContainer/skeleton.d.ts +2 -1
- package/dist/types/components/PrimaryItemsContainerV2/index.d.ts +8 -0
- package/dist/types-ts4.5/common/constants.d.ts +9 -0
- package/dist/types-ts4.5/common/styles.d.ts +10 -0
- package/dist/types-ts4.5/components/AppSwitcher/index.d.ts +14 -0
- package/dist/types-ts4.5/components/AppSwitcher/types.d.ts +2 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/index.d.ts +13 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/skeleton.d.ts +18 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/types.d.ts +107 -0
- package/dist/types-ts4.5/components/BadgeContainer/index.d.ts +4 -0
- package/dist/types-ts4.5/components/BadgeContainer/types.d.ts +6 -0
- package/dist/types-ts4.5/components/Create/index.d.ts +13 -0
- package/dist/types-ts4.5/components/Create/skeleton.d.ts +2 -0
- package/dist/types-ts4.5/components/Create/styles.d.ts +3 -0
- package/dist/types-ts4.5/components/Create/types.d.ts +35 -0
- package/dist/types-ts4.5/components/Help/index.d.ts +13 -0
- package/dist/types-ts4.5/components/Help/types.d.ts +9 -0
- package/dist/types-ts4.5/components/IconButton/index.d.ts +14 -0
- package/dist/types-ts4.5/components/IconButton/skeleton.d.ts +4 -0
- package/dist/types-ts4.5/components/IconButton/styles.d.ts +3 -0
- package/dist/types-ts4.5/components/IconButton/types.d.ts +100 -0
- package/dist/types-ts4.5/components/Notifications/index.d.ts +14 -0
- package/dist/types-ts4.5/components/Notifications/types.d.ts +9 -0
- package/dist/types-ts4.5/components/PrimaryButton/index.d.ts +18 -0
- package/dist/types-ts4.5/components/PrimaryButton/skeleton.d.ts +4 -0
- package/dist/types-ts4.5/components/PrimaryButton/styles.d.ts +3 -0
- package/dist/types-ts4.5/components/PrimaryButton/types.d.ts +43 -0
- package/dist/types-ts4.5/components/PrimaryDropdownButton/index.d.ts +16 -0
- package/dist/types-ts4.5/components/PrimaryDropdownButton/types.d.ts +18 -0
- package/dist/types-ts4.5/components/PrimaryItemsContainer/index.d.ts +6 -0
- package/dist/types-ts4.5/components/PrimaryItemsContainer/skeleton.d.ts +4 -0
- package/dist/types-ts4.5/components/PrimaryItemsContainer/types.d.ts +10 -0
- package/dist/types-ts4.5/components/PrimaryItemsContainerV2/index.d.ts +8 -0
- package/dist/types-ts4.5/components/ProductHome/custom-product-home.d.ts +12 -0
- package/dist/types-ts4.5/components/ProductHome/index.d.ts +2 -0
- package/dist/types-ts4.5/components/ProductHome/product-home.d.ts +15 -0
- package/dist/types-ts4.5/components/ProductHome/skeleton.d.ts +5 -0
- package/dist/types-ts4.5/components/ProductHome/types.d.ts +100 -0
- package/dist/types-ts4.5/components/ProductHome/utils.d.ts +1 -0
- package/dist/types-ts4.5/components/Profile/index.d.ts +17 -0
- package/dist/types-ts4.5/components/Profile/skeleton.d.ts +2 -0
- package/dist/types-ts4.5/components/Profile/types.d.ts +2 -0
- package/dist/types-ts4.5/components/Search/index.d.ts +12 -0
- package/dist/types-ts4.5/components/Search/skeleton.d.ts +2 -0
- package/dist/types-ts4.5/components/Search/types.d.ts +16 -0
- package/dist/types-ts4.5/components/Settings/index.d.ts +11 -0
- package/dist/types-ts4.5/components/Settings/types.d.ts +2 -0
- package/dist/types-ts4.5/components/SignIn/index.d.ts +12 -0
- package/dist/types-ts4.5/components/SignIn/skeleton.d.ts +2 -0
- package/dist/types-ts4.5/components/SignIn/types.d.ts +2 -0
- package/dist/types-ts4.5/components/SkeletonCreateButton/index.d.ts +14 -0
- package/dist/types-ts4.5/components/SkeletonCreateButton/types.d.ts +12 -0
- package/dist/types-ts4.5/components/SkeletonIconButton/index.d.ts +14 -0
- package/dist/types-ts4.5/components/SkeletonIconButton/types.d.ts +18 -0
- package/dist/types-ts4.5/components/SkeletonPrimaryButton/index.d.ts +14 -0
- package/dist/types-ts4.5/components/SkeletonPrimaryButton/types.d.ts +25 -0
- package/dist/types-ts4.5/controllers/overflow/index.d.ts +44 -0
- package/dist/types-ts4.5/controllers/overflow/types.d.ts +7 -0
- package/dist/types-ts4.5/index.d.ts +30 -0
- package/dist/types-ts4.5/skeleton-help-button.d.ts +19 -0
- package/dist/types-ts4.5/skeleton-notification-button.d.ts +19 -0
- package/dist/types-ts4.5/skeleton-settings-button.d.ts +19 -0
- package/dist/types-ts4.5/skeleton-switcher-button.d.ts +19 -0
- package/dist/types-ts4.5/skeleton.d.ts +5 -0
- package/dist/types-ts4.5/theme/default-theme.d.ts +6 -0
- package/dist/types-ts4.5/theme/index.d.ts +6 -0
- package/dist/types-ts4.5/theme/theme-generator.d.ts +3 -0
- package/dist/types-ts4.5/theme/theme-helpers.d.ts +5 -0
- package/dist/types-ts4.5/theme/theme-provider.d.ts +8 -0
- package/dist/types-ts4.5/theme/themes.d.ts +3 -0
- package/dist/types-ts4.5/theme/types.d.ts +69 -0
- package/dist/types-ts4.5/theme/use-theme.d.ts +1 -0
- package/package.json +12 -2
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
+
var _css2;
|
|
5
|
+
/** @jsx jsx */
|
|
6
|
+
import React, { memo, useCallback, useMemo, useState } from 'react';
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import Popup from '@atlaskit/popup';
|
|
9
|
+
import { UNSAFE_media as media } from '@atlaskit/primitives/responsive';
|
|
10
|
+
import { OverflowProvider } from '../../controllers/overflow';
|
|
11
|
+
import { PrimaryDropdownButton } from '../PrimaryDropdownButton';
|
|
12
|
+
var parentContainerStyles = css({
|
|
13
|
+
display: 'flex',
|
|
14
|
+
width: '100%',
|
|
15
|
+
height: '100%'
|
|
16
|
+
});
|
|
17
|
+
var basePrimaryContainerStyles = css({
|
|
18
|
+
display: 'none',
|
|
19
|
+
minWidth: 0,
|
|
20
|
+
gap: "var(--ds-space-100, 8px)"
|
|
21
|
+
});
|
|
22
|
+
var smallContainerStyles = css(_defineProperty({}, media.below.sm, {
|
|
23
|
+
display: 'flex'
|
|
24
|
+
}));
|
|
25
|
+
var mediumContainerStyles = css((_css2 = {}, _defineProperty(_css2, media.above.sm, {
|
|
26
|
+
display: 'flex'
|
|
27
|
+
}), _defineProperty(_css2, media.above.lg, {
|
|
28
|
+
display: 'none'
|
|
29
|
+
}), _css2));
|
|
30
|
+
var largeContainerStyles = css(_defineProperty({}, media.above.lg, {
|
|
31
|
+
display: 'flex'
|
|
32
|
+
}));
|
|
33
|
+
var MoreItemsPopup = function MoreItemsPopup(_ref) {
|
|
34
|
+
var moreLabel = _ref.moreLabel,
|
|
35
|
+
testId = _ref.testId,
|
|
36
|
+
items = _ref.items;
|
|
37
|
+
var _useState = useState(false),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
isMoreOpen = _useState2[0],
|
|
40
|
+
setIsMoreOpen = _useState2[1];
|
|
41
|
+
var onMoreClose = useCallback(function () {
|
|
42
|
+
return setIsMoreOpen(false);
|
|
43
|
+
}, []);
|
|
44
|
+
var onMoreClick = useCallback(function () {
|
|
45
|
+
return setIsMoreOpen(function (current) {
|
|
46
|
+
return !current;
|
|
47
|
+
});
|
|
48
|
+
}, []);
|
|
49
|
+
var openOverflowMenu = useCallback(function () {
|
|
50
|
+
return setIsMoreOpen(true);
|
|
51
|
+
}, []);
|
|
52
|
+
var trigger = useCallback(function (triggerProps) {
|
|
53
|
+
return jsx(PrimaryDropdownButton, _extends({
|
|
54
|
+
onClick: onMoreClick,
|
|
55
|
+
isSelected: isMoreOpen,
|
|
56
|
+
testId: testId ? "".concat(testId, "-overflow-menu-trigger") : 'overflow-menu-trigger'
|
|
57
|
+
}, triggerProps), moreLabel);
|
|
58
|
+
}, [moreLabel, onMoreClick, isMoreOpen, testId]);
|
|
59
|
+
var content = useCallback(function () {
|
|
60
|
+
return jsx(OverflowProvider, {
|
|
61
|
+
isVisible: false,
|
|
62
|
+
openOverflowMenu: openOverflowMenu,
|
|
63
|
+
closeOverflowMenu: onMoreClose
|
|
64
|
+
}, items);
|
|
65
|
+
}, [items, openOverflowMenu, onMoreClose]);
|
|
66
|
+
return jsx(Popup, {
|
|
67
|
+
placement: "bottom-start",
|
|
68
|
+
isOpen: isMoreOpen,
|
|
69
|
+
onClose: onMoreClose,
|
|
70
|
+
trigger: trigger,
|
|
71
|
+
content: content,
|
|
72
|
+
testId: testId ? "".concat(testId, "-overflow-menu-popup") : 'overflow-menu-popup'
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// Internal only
|
|
77
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
78
|
+
export var PrimaryItemsContainer = /*#__PURE__*/memo(function (_ref2) {
|
|
79
|
+
var moreLabel = _ref2.moreLabel,
|
|
80
|
+
items = _ref2.items,
|
|
81
|
+
Create = _ref2.create,
|
|
82
|
+
theme = _ref2.theme,
|
|
83
|
+
testId = _ref2.testId;
|
|
84
|
+
var filteredItems = useMemo(function () {
|
|
85
|
+
return React.Children.toArray(items).filter(function (item) {
|
|
86
|
+
return !!item;
|
|
87
|
+
});
|
|
88
|
+
}, [items]);
|
|
89
|
+
// NOTE: we could make these max items configurable in the future. For now
|
|
90
|
+
// we are using sensible defaults. Anything over the max gets put in the
|
|
91
|
+
// overflow menu for that screen size.
|
|
92
|
+
// While it may be tempting to use more than 3 items for the medium nav when
|
|
93
|
+
// you see the available space, you need to consider internationalistion.
|
|
94
|
+
// 3 is the safe, defensive choice across many languages and scripts.
|
|
95
|
+
var smallMaxItems = 0;
|
|
96
|
+
var mediumMaxItems = 3;
|
|
97
|
+
var largeMaxItems = 8;
|
|
98
|
+
var navItems = useMemo(function () {
|
|
99
|
+
return {
|
|
100
|
+
// For small screens, we're currently putting all items in the overflow
|
|
101
|
+
medium: {
|
|
102
|
+
navBarItems: filteredItems.slice(0, mediumMaxItems),
|
|
103
|
+
overflowItems: filteredItems.slice(mediumMaxItems, filteredItems.length)
|
|
104
|
+
},
|
|
105
|
+
large: {
|
|
106
|
+
navBarItems: filteredItems.slice(0, largeMaxItems),
|
|
107
|
+
overflowItems: filteredItems.slice(largeMaxItems, filteredItems.length)
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}, [filteredItems]);
|
|
111
|
+
return jsx("div", {
|
|
112
|
+
css: parentContainerStyles,
|
|
113
|
+
"data-testid": testId && "".concat(testId, "-primary-actions")
|
|
114
|
+
}, jsx("div", {
|
|
115
|
+
css: [basePrimaryContainerStyles, smallContainerStyles]
|
|
116
|
+
}, filteredItems.length > smallMaxItems && jsx(MoreItemsPopup
|
|
117
|
+
// NOTE: Would be nice to have a different label for small screens
|
|
118
|
+
// with i18n support (eg. swapping from 'More' to 'Menu' like
|
|
119
|
+
// Atlas does). Instead of opting for adding a new label prop right
|
|
120
|
+
// now I'm holding off until DSTRFC-016 lands.
|
|
121
|
+
, {
|
|
122
|
+
moreLabel: moreLabel,
|
|
123
|
+
items: filteredItems,
|
|
124
|
+
testId: testId
|
|
125
|
+
})), jsx("div", {
|
|
126
|
+
css: [basePrimaryContainerStyles, mediumContainerStyles]
|
|
127
|
+
}, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && jsx(MoreItemsPopup, {
|
|
128
|
+
moreLabel: moreLabel,
|
|
129
|
+
items: navItems.medium.overflowItems,
|
|
130
|
+
testId: testId
|
|
131
|
+
})), jsx("div", {
|
|
132
|
+
css: [basePrimaryContainerStyles, largeContainerStyles]
|
|
133
|
+
}, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && jsx(MoreItemsPopup, {
|
|
134
|
+
moreLabel: moreLabel,
|
|
135
|
+
items: navItems.large.overflowItems,
|
|
136
|
+
testId: testId
|
|
137
|
+
})), Create && jsx(Create, null));
|
|
138
|
+
});
|
|
@@ -6,6 +6,7 @@ var _css3;
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import { Fragment } from 'react';
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
10
11
|
import { useTheme } from '../../theme';
|
|
11
12
|
import { getTag } from './utils';
|
|
@@ -82,6 +83,10 @@ var siteTitleStyles = css({
|
|
|
82
83
|
alignItems: 'center'
|
|
83
84
|
});
|
|
84
85
|
|
|
86
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
87
|
+
var featureFlaggedHideSiteTitleStyles = getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? css(_defineProperty({}, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
|
|
88
|
+
display: 'none'
|
|
89
|
+
})) : null;
|
|
85
90
|
/**
|
|
86
91
|
* __Custom product home__
|
|
87
92
|
*
|
|
@@ -140,7 +145,7 @@ var CustomProductHome = function CustomProductHome(props) {
|
|
|
140
145
|
style: {
|
|
141
146
|
borderRight: theme.mode.productHome.borderRight
|
|
142
147
|
},
|
|
143
|
-
css: siteTitleStyles,
|
|
148
|
+
css: [siteTitleStyles, featureFlaggedHideSiteTitleStyles],
|
|
144
149
|
"data-testid": testId && "".concat(testId, "-site-title")
|
|
145
150
|
}, siteTitle));
|
|
146
151
|
};
|
|
@@ -6,6 +6,7 @@ var _css;
|
|
|
6
6
|
/** @jsx jsx */
|
|
7
7
|
import { Fragment } from 'react';
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
9
10
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
10
11
|
import { useTheme } from '../../theme';
|
|
11
12
|
import { getTag } from './utils';
|
|
@@ -96,6 +97,11 @@ var siteTitleStyles = css({
|
|
|
96
97
|
alignItems: 'center'
|
|
97
98
|
});
|
|
98
99
|
|
|
100
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
101
|
+
var featureFlaggedHideSiteTitleStyles = getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? css(_defineProperty({}, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
|
|
102
|
+
display: 'none'
|
|
103
|
+
})) : null;
|
|
104
|
+
|
|
99
105
|
/**
|
|
100
106
|
* __Product home__
|
|
101
107
|
*
|
|
@@ -163,7 +169,7 @@ var ProductHome = function ProductHome(_ref) {
|
|
|
163
169
|
style: {
|
|
164
170
|
borderRight: theme.mode.productHome.borderRight
|
|
165
171
|
},
|
|
166
|
-
css: siteTitleStyles,
|
|
172
|
+
css: [siteTitleStyles, featureFlaggedHideSiteTitleStyles],
|
|
167
173
|
"data-testid": testId && "".concat(testId, "-site-title")
|
|
168
174
|
}, siteTitle));
|
|
169
175
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { jsx } from '@emotion/react';
|
|
2
3
|
import { PrimaryItemsContainerSkeletonProps } from './types';
|
|
3
|
-
export declare const PrimaryItemsContainerSkeleton: ({ count
|
|
4
|
+
export declare const PrimaryItemsContainerSkeleton: import("react").MemoExoticComponent<({ count }: PrimaryItemsContainerSkeletonProps) => jsx.JSX.Element>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
|
+
import { NavigationTheme } from '../../theme';
|
|
5
|
+
import { PrimaryItemsContainerProps } from '../PrimaryItemsContainer/types';
|
|
6
|
+
export declare const PrimaryItemsContainer: React.MemoExoticComponent<({ moreLabel, items, create: Create, theme, testId, }: PrimaryItemsContainerProps & {
|
|
7
|
+
theme: NavigationTheme;
|
|
8
|
+
}) => jsx.JSX.Element>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const fontSize: number;
|
|
2
|
+
export declare const HORIZONTAL_GLOBAL_NAV_HEIGHT = 56;
|
|
3
|
+
export declare const PRODUCT_HOME_BREAKPOINT = 1280;
|
|
4
|
+
export declare const CREATE_BREAKPOINT = 1130;
|
|
5
|
+
export declare const varSearchFocusBorderColor = "--ds--ans--fbc";
|
|
6
|
+
export declare const varSearchHoverBackgroundColor = "--ds--ans--hbgc";
|
|
7
|
+
export declare const varSearchBackgroundColor = "--ds--ans--bgc";
|
|
8
|
+
export declare const varSearchColor = "--ds--ans--c";
|
|
9
|
+
export declare const varSearchBorderColor = "--ds--ans--bc";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AppSwitcherProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* _App switcher__
|
|
5
|
+
*
|
|
6
|
+
* An AppSwitcher button that can be passed into `AtlassianNavigation`'s
|
|
7
|
+
* `renderAppSwitcher` prop.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#app-switcher)
|
|
10
|
+
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
11
|
+
*/
|
|
12
|
+
export declare const AppSwitcher: React.ForwardRefExoticComponent<import("../IconButton/types").BaseIconButtonProps & React.RefAttributes<any>>;
|
|
13
|
+
declare const _default: (props: AppSwitcherProps) => void;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { AtlassianNavigationProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* __Atlassian navigation__
|
|
6
|
+
*
|
|
7
|
+
* The horizontal navigation component for Atlassian products.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples)
|
|
10
|
+
* - [Code](https://atlassian.design/components/atlassian-navigation/examples)
|
|
11
|
+
*/
|
|
12
|
+
export declare const AtlassianNavigation: (props: AtlassianNavigationProps) => jsx.JSX.Element;
|
|
13
|
+
export default AtlassianNavigation;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { NavigationSkeletonProps } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* __Navigation skeleton__
|
|
6
|
+
*
|
|
7
|
+
* Use loading skeletons to reduce the perceived loading time of heavier
|
|
8
|
+
* full-page experiences. This should only be used when the whole navigation is
|
|
9
|
+
* delayed; if there are only certain dynamically loaded navigation items that
|
|
10
|
+
* slow down the page, you should look into using
|
|
11
|
+
* [skeleton buttons](https://atlassian.design/components/atlassian-navigation/examples#skeleton-button)
|
|
12
|
+
* instead.
|
|
13
|
+
*
|
|
14
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#skeleton-loader)
|
|
15
|
+
* - [Code](https://atlassian.design/components/{packageName}/code)
|
|
16
|
+
*/
|
|
17
|
+
export declare const NavigationSkeleton: ({ primaryItemsCount, secondaryItemsCount, theme, showSiteName, shouldShowSearch, testId, }: NavigationSkeletonProps) => jsx.JSX.Element;
|
|
18
|
+
export default NavigationSkeleton;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { ReactNode, ReactNodeArray } from 'react';
|
|
2
|
+
import { NavigationTheme } from '../../theme';
|
|
3
|
+
export interface AtlassianNavigationProps {
|
|
4
|
+
/**
|
|
5
|
+
* Describes the specific role of this navigation component for users viewing the page with a screen
|
|
6
|
+
* reader. Differentiates from other navigation components on a page.
|
|
7
|
+
*/
|
|
8
|
+
label: string;
|
|
9
|
+
/**
|
|
10
|
+
* Slot for the primary actions.
|
|
11
|
+
*/
|
|
12
|
+
primaryItems: ReactNodeArray;
|
|
13
|
+
/**
|
|
14
|
+
* Slot for the app switcher.
|
|
15
|
+
*/
|
|
16
|
+
renderAppSwitcher?: React.ComponentType<{}>;
|
|
17
|
+
/**
|
|
18
|
+
* Slot for the create call to action button.
|
|
19
|
+
*/
|
|
20
|
+
renderCreate?: React.ComponentType<{}>;
|
|
21
|
+
/**
|
|
22
|
+
* Slot for the help button.
|
|
23
|
+
*/
|
|
24
|
+
renderHelp?: React.ComponentType<{}>;
|
|
25
|
+
/**
|
|
26
|
+
* Slot for the notification button.
|
|
27
|
+
*/
|
|
28
|
+
renderNotifications?: React.ComponentType<{}>;
|
|
29
|
+
/**
|
|
30
|
+
* Slot for the product home logo which renders a product's brand.
|
|
31
|
+
*/
|
|
32
|
+
renderProductHome: React.ComponentType<{}>;
|
|
33
|
+
/**
|
|
34
|
+
* Slot for the profile button.
|
|
35
|
+
*/
|
|
36
|
+
renderProfile?: React.ComponentType<{}>;
|
|
37
|
+
/**
|
|
38
|
+
* Slot for the search textbox.
|
|
39
|
+
*/
|
|
40
|
+
renderSearch?: React.ComponentType<{}>;
|
|
41
|
+
/**
|
|
42
|
+
* Slot for the sign in button.
|
|
43
|
+
*/
|
|
44
|
+
renderSignIn?: React.ComponentType<{}>;
|
|
45
|
+
/**
|
|
46
|
+
* Slot for the settings button.
|
|
47
|
+
*/
|
|
48
|
+
renderSettings?: React.ComponentType<{}>;
|
|
49
|
+
/**
|
|
50
|
+
* Label used for the overflow menu button tooltip.
|
|
51
|
+
*/
|
|
52
|
+
moreLabel?: ReactNode;
|
|
53
|
+
/**
|
|
54
|
+
* __Slow and discouraged custom theme API.__
|
|
55
|
+
*/
|
|
56
|
+
theme?: NavigationTheme;
|
|
57
|
+
/**
|
|
58
|
+
A `testId` prop is provided for specified elements,
|
|
59
|
+
which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
60
|
+
serving as a hook for automated tests.
|
|
61
|
+
|
|
62
|
+
Will set these elements when defined:
|
|
63
|
+
|
|
64
|
+
- Header element - `{testId}-header`
|
|
65
|
+
- Primary actions container - `{testId}-primary-actions`
|
|
66
|
+
- Secondary actions container - `{testId}-secondary-actions`
|
|
67
|
+
- Overflow menu popup - `{testId}-overflow-menu-popup`
|
|
68
|
+
- Overflow menu button - `{testId}-overflow-menu-trigger`
|
|
69
|
+
*/
|
|
70
|
+
testId?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface NavigationSkeletonProps {
|
|
73
|
+
/**
|
|
74
|
+
* How many skeleton primary items to display.
|
|
75
|
+
*/
|
|
76
|
+
primaryItemsCount?: number;
|
|
77
|
+
/**
|
|
78
|
+
* How many skeleton secondary items to display.
|
|
79
|
+
*/
|
|
80
|
+
secondaryItemsCount?: number;
|
|
81
|
+
/**
|
|
82
|
+
* Whether to display a skeleton for the site name.
|
|
83
|
+
*/
|
|
84
|
+
showSiteName?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether to display a skeleton for the search bar.
|
|
87
|
+
*/
|
|
88
|
+
shouldShowSearch?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* __Slow and discouraged custom theme API.__
|
|
91
|
+
*/
|
|
92
|
+
theme?: NavigationTheme;
|
|
93
|
+
/**
|
|
94
|
+
A `testId` prop is provided for specified elements,
|
|
95
|
+
which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
96
|
+
serving as a hook for automated tests.
|
|
97
|
+
|
|
98
|
+
Will set these elements when defined:
|
|
99
|
+
|
|
100
|
+
- Header element - `{testId}-header`
|
|
101
|
+
- Primary actions container - `{testId}-primary-actions`
|
|
102
|
+
- Secondary actions container - `{testId}-secondary-actions`
|
|
103
|
+
- Overflow menu popup - `{testId}-overflow-menu-popup`
|
|
104
|
+
- Overflow menu button - `{testId}-overflow-menu-trigger`
|
|
105
|
+
*/
|
|
106
|
+
testId?: string;
|
|
107
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react';
|
|
2
|
+
import { CreateProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* _Create__
|
|
5
|
+
*
|
|
6
|
+
* A call to action button that can be passed into `AtlassianNavigation`'s
|
|
7
|
+
* `renderCreate` prop. It is shown after all other primary buttons.
|
|
8
|
+
*
|
|
9
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#create)
|
|
10
|
+
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
11
|
+
*/
|
|
12
|
+
export declare const Create: ({ onClick, href, text, buttonTooltip, iconButtonTooltip, testId, }: CreateProps) => jsx.JSX.Element;
|
|
13
|
+
export default Create;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ThemeProps, ThemeTokens } from '@atlaskit/button/types';
|
|
2
|
+
import { NavigationTheme } from '../../theme';
|
|
3
|
+
export declare const getCreateButtonTheme: ({ mode: { create } }: NavigationTheme) => (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CreateProps {
|
|
3
|
+
/**
|
|
4
|
+
* Primary text for the call to action.
|
|
5
|
+
*/
|
|
6
|
+
text: string;
|
|
7
|
+
/**
|
|
8
|
+
* Text for the button tooltip when seen on large viewports.
|
|
9
|
+
*/
|
|
10
|
+
buttonTooltip?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Text for the icon button tooltip when seen on small viewports.
|
|
13
|
+
*/
|
|
14
|
+
iconButtonTooltip?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Click handler.
|
|
17
|
+
* See @atlaskit/analytics-next for analyticsEvent type information
|
|
18
|
+
*/
|
|
19
|
+
onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: any) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Causes the Create action to be rendered as a link. This is suitable for when the Create action is handled as a full page rather than in a modal-dialog.
|
|
22
|
+
*/
|
|
23
|
+
href?: string;
|
|
24
|
+
/**
|
|
25
|
+
* A `testId` prop is provided for specified elements,
|
|
26
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
27
|
+
* serving as a hook for automated tests.
|
|
28
|
+
*
|
|
29
|
+
* Will set these elements when defined:
|
|
30
|
+
*
|
|
31
|
+
* - Create button shown on large screen sizes - `{testId}-button`
|
|
32
|
+
* - Create icon button shown on small screen sizes - `{testId}-icon-button`
|
|
33
|
+
*/
|
|
34
|
+
testId?: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Help__
|
|
4
|
+
*
|
|
5
|
+
* A help button that can be passed into `AtlassianNavigation`'s `renderHelp` prop.
|
|
6
|
+
*
|
|
7
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#help)
|
|
8
|
+
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
9
|
+
*/
|
|
10
|
+
export declare const Help: React.ForwardRefExoticComponent<import("../IconButton/types").BaseIconButtonProps & {
|
|
11
|
+
badge?: React.ComponentType<{}> | undefined;
|
|
12
|
+
} & React.RefAttributes<any>>;
|
|
13
|
+
export default Help;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { BaseIconButtonProps } from '../IconButton/types';
|
|
3
|
+
export type HelpProps = BaseIconButtonProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Component to be used for the badge.
|
|
6
|
+
* Generally you'll want to use `NotificationIndicator` from [`@atlaskit/notification-indicator`](/packages/notifications/notification-indicator).
|
|
7
|
+
*/
|
|
8
|
+
badge?: ComponentType<{}>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Icon button__
|
|
4
|
+
*
|
|
5
|
+
* An icon button is used to create navigation items such as Help, Settings
|
|
6
|
+
* and Notifications. You can use this component to create your own items to
|
|
7
|
+
* pass into `AtlassianNavigation`'s render props, but where possible you should
|
|
8
|
+
* rely on the defaults.
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
export declare const IconButton: React.ForwardRefExoticComponent<import("./types").BaseIconButtonProps & {
|
|
12
|
+
icon: React.ReactChild | undefined;
|
|
13
|
+
theme?: ((current: (props: import("@atlaskit/button/custom-theme-button").ThemeProps) => import("@atlaskit/button/custom-theme-button").ThemeTokens, props: import("@atlaskit/button/custom-theme-button").ThemeProps) => import("@atlaskit/button/custom-theme-button").ThemeTokens) | undefined;
|
|
14
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ThemeProps, ThemeTokens } from '@atlaskit/button/types';
|
|
2
|
+
import { NavigationTheme } from '../../theme';
|
|
3
|
+
export declare const getIconButtonTheme: ({ mode: { iconButton } }: NavigationTheme) => (current: (props: ThemeProps) => ThemeTokens, props: ThemeProps) => ThemeTokens;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CustomThemeButtonProps } from '@atlaskit/button/types';
|
|
3
|
+
export type IconButtonProps = BaseIconButtonProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Icon for the button.
|
|
6
|
+
*/
|
|
7
|
+
icon: CustomThemeButtonProps['iconBefore'];
|
|
8
|
+
/**
|
|
9
|
+
* Theme for the icon button.
|
|
10
|
+
*/
|
|
11
|
+
theme?: CustomThemeButtonProps['theme'];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* We aren't inheriting the types from button here because it blows up ERT.
|
|
15
|
+
*/
|
|
16
|
+
export interface BaseIconButtonProps {
|
|
17
|
+
/**
|
|
18
|
+
* Unique id for the button.
|
|
19
|
+
*/
|
|
20
|
+
id?: string;
|
|
21
|
+
/**
|
|
22
|
+
* On click handler.
|
|
23
|
+
* Second argument is the instrumented analytics event.
|
|
24
|
+
* See @atlaskit/analytics-next for analyticsEvent type information
|
|
25
|
+
*/
|
|
26
|
+
onClick?: (event: React.MouseEvent<HTMLElement>, analyticsEvent: any) => void;
|
|
27
|
+
/**
|
|
28
|
+
* A `testId` prop is provided for specified elements,
|
|
29
|
+
* which is a unique string that appears as a data attribute `data-testid` in the rendered code,
|
|
30
|
+
* serving as a hook for automated tests
|
|
31
|
+
*/
|
|
32
|
+
testId?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Text that will be displayed in the tooltip when hovered or focused on the button.
|
|
35
|
+
*/
|
|
36
|
+
tooltip: React.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* Called when the mouse is initially clicked on the element.
|
|
39
|
+
*/
|
|
40
|
+
onMouseDown?: React.MouseEventHandler<HTMLElement>;
|
|
41
|
+
/**
|
|
42
|
+
* Called when the mouse enters the element container.
|
|
43
|
+
*/
|
|
44
|
+
onMouseEnter?: React.MouseEventHandler<HTMLElement>;
|
|
45
|
+
/**
|
|
46
|
+
* Called when the mouse leaves the element container.
|
|
47
|
+
*/
|
|
48
|
+
onMouseLeave?: React.MouseEventHandler<HTMLElement>;
|
|
49
|
+
/**
|
|
50
|
+
* Causes the button to be disabled.
|
|
51
|
+
*/
|
|
52
|
+
isDisabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* If wanting to link to another page you can define the href.
|
|
55
|
+
*/
|
|
56
|
+
href?: string;
|
|
57
|
+
/**
|
|
58
|
+
* If defining `href` you may want to define `target` as well.
|
|
59
|
+
*/
|
|
60
|
+
target?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Allows for overriding the component used to render the button.
|
|
63
|
+
*
|
|
64
|
+
* This is primarily intended for compatibility with custom
|
|
65
|
+
* routing libraries when using the `href` prop.
|
|
66
|
+
*
|
|
67
|
+
* For further usage information, refer to the [documentation for button](https://atlassian.design/components/button/code).
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```tsx
|
|
71
|
+
* <Settings
|
|
72
|
+
* component={CustomRouterLink}
|
|
73
|
+
* href="/path/to/url"
|
|
74
|
+
* />
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
component?: CustomThemeButtonProps['component'];
|
|
78
|
+
/**
|
|
79
|
+
* Handler for the mouse up event.
|
|
80
|
+
*/
|
|
81
|
+
onMouseUp?: React.MouseEventHandler<HTMLElement>;
|
|
82
|
+
/**
|
|
83
|
+
* Handler called when the button gains focus.
|
|
84
|
+
*/
|
|
85
|
+
onFocus?: React.FocusEventHandler<HTMLElement>;
|
|
86
|
+
/**
|
|
87
|
+
* Handler called when the button loses focus.
|
|
88
|
+
*/
|
|
89
|
+
onBlur?: React.FocusEventHandler<HTMLElement>;
|
|
90
|
+
/**
|
|
91
|
+
* Makes the element appear selected.
|
|
92
|
+
*/
|
|
93
|
+
isSelected?: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface IconButtonSkeletonProps {
|
|
96
|
+
className?: string;
|
|
97
|
+
marginLeft?: number;
|
|
98
|
+
marginRight?: number;
|
|
99
|
+
size?: number;
|
|
100
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __Notifications__
|
|
4
|
+
*
|
|
5
|
+
* A notifications button that can be passed into `AtlassianNavigation`'s
|
|
6
|
+
* `renderNotifications` prop.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#notifications)
|
|
9
|
+
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
10
|
+
*/
|
|
11
|
+
export declare const Notifications: React.ForwardRefExoticComponent<import("../IconButton/types").BaseIconButtonProps & {
|
|
12
|
+
badge: React.ComponentType<{}>;
|
|
13
|
+
} & React.RefAttributes<any>>;
|
|
14
|
+
export default Notifications;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { BaseIconButtonProps } from '../IconButton/types';
|
|
3
|
+
export type NotificationsProps = BaseIconButtonProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Component to be used for the badge.
|
|
6
|
+
* Generally you'll want to use `NotificationIndicator` from [`@atlaskit/notification-indicator`](/packages/notifications/notification-indicator).
|
|
7
|
+
*/
|
|
8
|
+
badge: ComponentType<{}>;
|
|
9
|
+
};
|