@atlaskit/atlassian-navigation 5.7.2 → 5.7.4
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/afm-cc/tsconfig.json +0 -1
- package/afm-products/tsconfig.json +0 -1
- package/dist/cjs/common/constants.js +3 -0
- package/dist/cjs/components/AppSwitcher/app-switcher-nav4.js +61 -0
- package/dist/cjs/components/AppSwitcher/app-switcher.js +79 -0
- package/dist/cjs/components/AppSwitcher/index.js +1 -119
- package/dist/cjs/components/AtlassianNavigation/index.js +6 -0
- package/dist/cjs/components/AtlassianNavigation/skeleton.js +2 -0
- package/dist/cjs/components/Create/index.js +2 -0
- package/dist/cjs/components/Help/index.js +2 -0
- package/dist/cjs/components/IconButton/index.js +1 -0
- package/dist/cjs/components/Notifications/index.js +2 -0
- package/dist/cjs/components/PrimaryButton/index.js +2 -0
- package/dist/cjs/components/PrimaryDropdownButton/index.js +2 -0
- package/dist/cjs/components/PrimaryItemsContainer/index.js +5 -4
- package/dist/cjs/components/ProductHome/app-home.js +180 -0
- package/dist/cjs/components/ProductHome/custom-product-home.js +2 -0
- package/dist/cjs/components/ProductHome/product-home.js +21 -110
- package/dist/cjs/components/Profile/index.js +2 -0
- package/dist/cjs/components/Profile/profile.js +74 -0
- package/dist/cjs/components/Search/index.js +2 -0
- package/dist/cjs/components/Settings/index.js +2 -0
- package/dist/cjs/components/SignIn/index.js +2 -0
- package/dist/cjs/controllers/overflow/index.js +2 -0
- package/dist/cjs/controllers/overflow/overflow-context.js +16 -0
- package/dist/cjs/controllers/overflow/overflow-provider.js +27 -0
- package/dist/cjs/controllers/overflow/use-overflow-controller.js +111 -0
- package/dist/cjs/controllers/overflow/use-overflow-status.js +20 -0
- package/dist/cjs/entry-points/app-switcher.js +4 -3
- package/dist/cjs/entry-points/overflow.js +2 -2
- package/dist/cjs/entry-points/profile.js +2 -2
- package/dist/cjs/entry-points/skeleton-help-button.js +2 -1
- package/dist/cjs/index.js +8 -7
- package/dist/cjs/nav4-skeleton-help-button.js +33 -0
- package/dist/cjs/skeleton-help-button.js +1 -24
- package/dist/cjs/skeleton-switcher-button.js +6 -0
- package/dist/cjs/theme/atlassian-theme.js +3 -0
- package/dist/cjs/theme/convert-hex-shorthand.js +47 -0
- package/dist/cjs/theme/default-theme-brand-refresh.js +10 -0
- package/dist/cjs/theme/default-theme.js +1 -2
- package/dist/cjs/theme/generate-text-color.js +13 -0
- package/dist/cjs/theme/get-contrast-color.js +12 -0
- package/dist/cjs/theme/hex-to-rgba.js +18 -0
- package/dist/cjs/theme/index.js +2 -2
- package/dist/cjs/theme/theme-generator.js +22 -13
- package/dist/cjs/theme/theme-provider.js +2 -0
- package/dist/cjs/theme/themes.js +3 -0
- package/dist/es2019/common/constants.js +3 -0
- package/dist/es2019/components/AppSwitcher/app-switcher-nav4.js +52 -0
- package/dist/es2019/components/AppSwitcher/app-switcher.js +70 -0
- package/dist/es2019/components/AppSwitcher/index.js +0 -116
- package/dist/es2019/components/AtlassianNavigation/index.js +6 -0
- package/dist/es2019/components/AtlassianNavigation/skeleton.js +2 -0
- package/dist/es2019/components/Create/index.js +2 -0
- package/dist/es2019/components/Help/index.js +2 -0
- package/dist/es2019/components/IconButton/index.js +1 -0
- package/dist/es2019/components/Notifications/index.js +2 -0
- package/dist/es2019/components/PrimaryButton/index.js +2 -0
- package/dist/es2019/components/PrimaryDropdownButton/index.js +2 -0
- package/dist/es2019/components/PrimaryItemsContainer/index.js +2 -1
- package/dist/es2019/components/ProductHome/app-home.js +185 -0
- package/dist/es2019/components/ProductHome/custom-product-home.js +2 -0
- package/dist/es2019/components/ProductHome/product-home.js +5 -110
- package/dist/es2019/components/Profile/index.js +2 -0
- package/dist/es2019/components/Profile/profile.js +65 -0
- package/dist/es2019/components/Search/index.js +2 -0
- package/dist/es2019/components/Settings/index.js +2 -0
- package/dist/es2019/components/SignIn/index.js +2 -0
- package/dist/es2019/controllers/overflow/index.js +2 -0
- package/dist/es2019/controllers/overflow/overflow-context.js +8 -0
- package/dist/es2019/controllers/overflow/overflow-provider.js +18 -0
- package/dist/es2019/controllers/overflow/use-overflow-controller.js +89 -0
- package/dist/es2019/controllers/overflow/use-overflow-status.js +13 -0
- package/dist/es2019/entry-points/app-switcher.js +2 -1
- package/dist/es2019/entry-points/overflow.js +1 -1
- package/dist/es2019/entry-points/profile.js +1 -1
- package/dist/es2019/entry-points/skeleton-help-button.js +2 -1
- package/dist/es2019/index.js +4 -3
- package/dist/es2019/nav4-skeleton-help-button.js +24 -0
- package/dist/es2019/skeleton-help-button.js +1 -22
- package/dist/es2019/skeleton-switcher-button.js +7 -0
- package/dist/es2019/theme/atlassian-theme.js +3 -0
- package/dist/es2019/theme/convert-hex-shorthand.js +27 -0
- package/dist/es2019/theme/default-theme-brand-refresh.js +3 -0
- package/dist/es2019/theme/default-theme.js +0 -1
- package/dist/es2019/theme/generate-text-color.js +6 -0
- package/dist/es2019/theme/get-contrast-color.js +3 -0
- package/dist/es2019/theme/hex-to-rgba.js +8 -0
- package/dist/es2019/theme/index.js +1 -1
- package/dist/es2019/theme/theme-generator.js +11 -2
- package/dist/es2019/theme/theme-provider.js +2 -0
- package/dist/es2019/theme/themes.js +3 -0
- package/dist/esm/common/constants.js +3 -0
- package/dist/esm/components/AppSwitcher/app-switcher-nav4.js +52 -0
- package/dist/esm/components/AppSwitcher/app-switcher.js +70 -0
- package/dist/esm/components/AppSwitcher/index.js +0 -115
- package/dist/esm/components/AtlassianNavigation/index.js +6 -0
- package/dist/esm/components/AtlassianNavigation/skeleton.js +2 -0
- package/dist/esm/components/Create/index.js +2 -0
- package/dist/esm/components/Help/index.js +2 -0
- package/dist/esm/components/IconButton/index.js +1 -0
- package/dist/esm/components/Notifications/index.js +2 -0
- package/dist/esm/components/PrimaryButton/index.js +2 -0
- package/dist/esm/components/PrimaryDropdownButton/index.js +2 -0
- package/dist/esm/components/PrimaryItemsContainer/index.js +2 -1
- package/dist/esm/components/ProductHome/app-home.js +172 -0
- package/dist/esm/components/ProductHome/custom-product-home.js +2 -0
- package/dist/esm/components/ProductHome/product-home.js +16 -110
- package/dist/esm/components/Profile/index.js +2 -0
- package/dist/esm/components/Profile/profile.js +65 -0
- package/dist/esm/components/Search/index.js +2 -0
- package/dist/esm/components/Settings/index.js +2 -0
- package/dist/esm/components/SignIn/index.js +2 -0
- package/dist/esm/controllers/overflow/index.js +2 -0
- package/dist/esm/controllers/overflow/overflow-context.js +8 -0
- package/dist/esm/controllers/overflow/overflow-provider.js +19 -0
- package/dist/esm/controllers/overflow/use-overflow-controller.js +103 -0
- package/dist/esm/controllers/overflow/use-overflow-status.js +15 -0
- package/dist/esm/entry-points/app-switcher.js +2 -1
- package/dist/esm/entry-points/overflow.js +1 -1
- package/dist/esm/entry-points/profile.js +1 -1
- package/dist/esm/entry-points/skeleton-help-button.js +2 -1
- package/dist/esm/index.js +4 -3
- package/dist/esm/nav4-skeleton-help-button.js +26 -0
- package/dist/esm/skeleton-help-button.js +0 -23
- package/dist/esm/skeleton-switcher-button.js +7 -0
- package/dist/esm/theme/atlassian-theme.js +3 -0
- package/dist/esm/theme/convert-hex-shorthand.js +40 -0
- package/dist/esm/theme/default-theme-brand-refresh.js +3 -0
- package/dist/esm/theme/default-theme.js +0 -1
- package/dist/esm/theme/generate-text-color.js +6 -0
- package/dist/esm/theme/get-contrast-color.js +5 -0
- package/dist/esm/theme/hex-to-rgba.js +11 -0
- package/dist/esm/theme/index.js +1 -1
- package/dist/esm/theme/theme-generator.js +11 -2
- package/dist/esm/theme/theme-provider.js +2 -0
- package/dist/esm/theme/themes.js +3 -0
- package/dist/types/common/constants.d.ts +3 -0
- package/dist/types/components/AppSwitcher/app-switcher-nav4.d.ts +6 -0
- package/dist/types/components/AppSwitcher/app-switcher.d.ts +14 -0
- package/dist/types/components/AppSwitcher/index.d.ts +0 -12
- package/dist/types/components/AppSwitcher/types.d.ts +3 -0
- package/dist/types/components/AtlassianNavigation/index.d.ts +2 -0
- package/dist/types/components/AtlassianNavigation/skeleton.d.ts +2 -0
- package/dist/types/components/AtlassianNavigation/types.d.ts +6 -0
- package/dist/types/components/Create/index.d.ts +2 -0
- package/dist/types/components/Help/index.d.ts +2 -0
- package/dist/types/components/IconButton/index.d.ts +1 -0
- package/dist/types/components/Notifications/index.d.ts +2 -0
- package/dist/types/components/PrimaryButton/index.d.ts +2 -0
- package/dist/types/components/PrimaryDropdownButton/index.d.ts +2 -0
- package/dist/types/components/ProductHome/app-home.d.ts +20 -0
- package/dist/types/components/ProductHome/custom-product-home.d.ts +2 -0
- package/dist/types/components/ProductHome/product-home.d.ts +4 -13
- package/dist/types/components/Profile/index.d.ts +2 -0
- package/dist/types/components/Profile/profile.d.ts +14 -0
- package/dist/types/components/Profile/types.d.ts +3 -0
- package/dist/types/components/Search/index.d.ts +2 -0
- package/dist/types/components/Search/types.d.ts +3 -0
- package/dist/types/components/Settings/index.d.ts +2 -0
- package/dist/types/components/Settings/types.d.ts +3 -0
- package/dist/types/components/SignIn/index.d.ts +2 -0
- package/dist/types/components/SignIn/types.d.ts +3 -0
- package/dist/types/components/SkeletonCreateButton/types.d.ts +3 -0
- package/dist/types/components/SkeletonIconButton/types.d.ts +3 -0
- package/dist/types/components/SkeletonPrimaryButton/types.d.ts +3 -0
- package/dist/types/controllers/overflow/index.d.ts +2 -0
- package/dist/types/controllers/overflow/overflow-context.d.ts +17 -0
- package/dist/types/controllers/overflow/overflow-provider.d.ts +3 -0
- package/dist/types/controllers/overflow/use-overflow-controller.d.ts +7 -0
- package/dist/types/controllers/overflow/use-overflow-status.d.ts +11 -0
- package/dist/types/entry-points/app-switcher.d.ts +2 -1
- package/dist/types/entry-points/overflow.d.ts +1 -1
- package/dist/types/entry-points/profile.d.ts +1 -1
- package/dist/types/entry-points/skeleton-help-button.d.ts +2 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/nav4-skeleton-help-button.d.ts +8 -0
- package/dist/types/skeleton-help-button.d.ts +0 -6
- package/dist/types/skeleton-switcher-button.d.ts +5 -0
- package/dist/types/theme/atlassian-theme.d.ts +3 -0
- package/dist/types/theme/convert-hex-shorthand.d.ts +1 -0
- package/dist/types/theme/default-theme-brand-refresh.d.ts +1 -0
- package/dist/types/theme/default-theme.d.ts +0 -1
- package/dist/types/theme/generate-text-color.d.ts +1 -0
- package/dist/types/theme/get-contrast-color.d.ts +1 -0
- package/dist/types/theme/hex-to-rgba.d.ts +1 -0
- package/dist/types/theme/index.d.ts +1 -1
- package/dist/types/theme/theme-generator.d.ts +5 -0
- package/dist/types/theme/theme-provider.d.ts +2 -0
- package/dist/types/theme/themes.d.ts +3 -0
- package/dist/types/theme/types.d.ts +30 -0
- package/dist/types-ts4.5/common/constants.d.ts +3 -0
- package/dist/types-ts4.5/components/AppSwitcher/app-switcher-nav4.d.ts +6 -0
- package/dist/types-ts4.5/components/AppSwitcher/app-switcher.d.ts +14 -0
- package/dist/types-ts4.5/components/AppSwitcher/index.d.ts +0 -12
- package/dist/types-ts4.5/components/AppSwitcher/types.d.ts +3 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/index.d.ts +2 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/skeleton.d.ts +2 -0
- package/dist/types-ts4.5/components/AtlassianNavigation/types.d.ts +6 -0
- package/dist/types-ts4.5/components/Create/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Help/index.d.ts +2 -0
- package/dist/types-ts4.5/components/IconButton/index.d.ts +1 -0
- package/dist/types-ts4.5/components/Notifications/index.d.ts +2 -0
- package/dist/types-ts4.5/components/PrimaryButton/index.d.ts +2 -0
- package/dist/types-ts4.5/components/PrimaryDropdownButton/index.d.ts +2 -0
- package/dist/types-ts4.5/components/ProductHome/app-home.d.ts +20 -0
- package/dist/types-ts4.5/components/ProductHome/custom-product-home.d.ts +2 -0
- package/dist/types-ts4.5/components/ProductHome/product-home.d.ts +4 -13
- package/dist/types-ts4.5/components/Profile/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Profile/profile.d.ts +14 -0
- package/dist/types-ts4.5/components/Profile/types.d.ts +3 -0
- package/dist/types-ts4.5/components/Search/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Search/types.d.ts +3 -0
- package/dist/types-ts4.5/components/Settings/index.d.ts +2 -0
- package/dist/types-ts4.5/components/Settings/types.d.ts +3 -0
- package/dist/types-ts4.5/components/SignIn/index.d.ts +2 -0
- package/dist/types-ts4.5/components/SignIn/types.d.ts +3 -0
- package/dist/types-ts4.5/components/SkeletonCreateButton/types.d.ts +3 -0
- package/dist/types-ts4.5/components/SkeletonIconButton/types.d.ts +3 -0
- package/dist/types-ts4.5/components/SkeletonPrimaryButton/types.d.ts +3 -0
- package/dist/types-ts4.5/controllers/overflow/index.d.ts +2 -0
- package/dist/types-ts4.5/controllers/overflow/overflow-context.d.ts +17 -0
- package/dist/types-ts4.5/controllers/overflow/overflow-provider.d.ts +3 -0
- package/dist/types-ts4.5/controllers/overflow/use-overflow-controller.d.ts +7 -0
- package/dist/types-ts4.5/controllers/overflow/use-overflow-status.d.ts +11 -0
- package/dist/types-ts4.5/entry-points/app-switcher.d.ts +2 -1
- package/dist/types-ts4.5/entry-points/overflow.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/profile.d.ts +1 -1
- package/dist/types-ts4.5/entry-points/skeleton-help-button.d.ts +2 -1
- package/dist/types-ts4.5/index.d.ts +4 -3
- package/dist/types-ts4.5/nav4-skeleton-help-button.d.ts +8 -0
- package/dist/types-ts4.5/skeleton-help-button.d.ts +0 -6
- package/dist/types-ts4.5/skeleton-switcher-button.d.ts +5 -0
- package/dist/types-ts4.5/theme/atlassian-theme.d.ts +3 -0
- package/dist/types-ts4.5/theme/convert-hex-shorthand.d.ts +1 -0
- package/dist/types-ts4.5/theme/default-theme-brand-refresh.d.ts +1 -0
- package/dist/types-ts4.5/theme/default-theme.d.ts +0 -1
- package/dist/types-ts4.5/theme/generate-text-color.d.ts +1 -0
- package/dist/types-ts4.5/theme/get-contrast-color.d.ts +1 -0
- package/dist/types-ts4.5/theme/hex-to-rgba.d.ts +1 -0
- package/dist/types-ts4.5/theme/index.d.ts +1 -1
- package/dist/types-ts4.5/theme/theme-generator.d.ts +5 -0
- package/dist/types-ts4.5/theme/theme-provider.d.ts +2 -0
- package/dist/types-ts4.5/theme/themes.d.ts +3 -0
- package/dist/types-ts4.5/theme/types.d.ts +30 -0
- package/package.json +10 -10
- package/afm-jira/tsconfig.json +0 -64
- /package/dist/cjs/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
- /package/dist/cjs/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
- /package/dist/es2019/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
- /package/dist/es2019/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
- /package/dist/esm/components/AppSwitcher/{index.compiled.css → app-switcher.compiled.css} +0 -0
- /package/dist/esm/{skeleton-help-button.compiled.css → nav4-skeleton-help-button.compiled.css} +0 -0
|
@@ -51,6 +51,8 @@ const buttonHighlightedStyles = css({
|
|
|
51
51
|
*
|
|
52
52
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#dropdown-menu)
|
|
53
53
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
54
|
+
*
|
|
55
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
54
56
|
*/
|
|
55
57
|
export const PrimaryButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
56
58
|
const {
|
|
@@ -21,6 +21,8 @@ const buttonNoOpStyle = css({
|
|
|
21
21
|
*
|
|
22
22
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#button)
|
|
23
23
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
24
|
+
*
|
|
25
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
24
26
|
*/
|
|
25
27
|
export const PrimaryDropdownButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
26
28
|
const {
|
|
@@ -9,7 +9,8 @@ import React, { useCallback, useState } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import Popup from '@atlaskit/popup';
|
|
11
11
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
12
|
-
import { OverflowProvider
|
|
12
|
+
import { OverflowProvider } from '../../controllers/overflow/overflow-provider';
|
|
13
|
+
import { useOverflowController } from '../../controllers/overflow/use-overflow-controller';
|
|
13
14
|
import { PrimaryDropdownButton } from '../PrimaryDropdownButton';
|
|
14
15
|
const containerStyles = css({
|
|
15
16
|
display: 'flex',
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
* @jsx jsx
|
|
5
|
+
*/
|
|
6
|
+
import React, { Fragment } from 'react';
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
10
|
+
import { Inline, Text } from '@atlaskit/primitives/compiled';
|
|
11
|
+
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
12
|
+
import { useTheme } from '../../theme';
|
|
13
|
+
import { stripEmptyProperties } from '../../utils';
|
|
14
|
+
import { getTag } from './utils';
|
|
15
|
+
const VAR_PRODUCT_HOME_COLOR_ACTIVE = '--product-home-color-active';
|
|
16
|
+
const VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE = '--product-home-bg-color-active';
|
|
17
|
+
const VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE = '--product-home-box-shadow-active';
|
|
18
|
+
const VAR_PRODUCT_HOME_COLOR_FOCUS = '--product-home-color-focus';
|
|
19
|
+
const VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS = '--product-home-bg-color-focus';
|
|
20
|
+
const VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS = '--product-home-box-shadow-focus';
|
|
21
|
+
const VAR_PRODUCT_HOME_COLOR_HOVER = '--product-home-color-hover';
|
|
22
|
+
const VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER = '--product-home-bg-color-hover';
|
|
23
|
+
const VAR_PRODUCT_HOME_BOX_SHADOW_HOVER = '--product-home-box-shadow-hover';
|
|
24
|
+
const productHomeButtonStyles = css({
|
|
25
|
+
display: 'flex',
|
|
26
|
+
padding: "var(--ds-space-050, 4px)",
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
background: 'none',
|
|
29
|
+
border: 0,
|
|
30
|
+
borderRadius: "var(--ds-radius-small, 3px)",
|
|
31
|
+
color: 'inherit',
|
|
32
|
+
cursor: 'pointer',
|
|
33
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
34
|
+
'&::-moz-focus-inner': {
|
|
35
|
+
border: 0
|
|
36
|
+
},
|
|
37
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
38
|
+
'&:first-of-type': {
|
|
39
|
+
marginInlineStart: 0
|
|
40
|
+
},
|
|
41
|
+
'&:hover': {
|
|
42
|
+
backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER})`,
|
|
43
|
+
boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_HOVER})`,
|
|
44
|
+
color: `var(${VAR_PRODUCT_HOME_COLOR_HOVER})`
|
|
45
|
+
},
|
|
46
|
+
'&:active': {
|
|
47
|
+
backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE})`,
|
|
48
|
+
boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE})`,
|
|
49
|
+
color: `var(${VAR_PRODUCT_HOME_COLOR_ACTIVE})`
|
|
50
|
+
},
|
|
51
|
+
'&:focus-visible': {
|
|
52
|
+
backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS})`,
|
|
53
|
+
color: `var(${VAR_PRODUCT_HOME_COLOR_FOCUS})`,
|
|
54
|
+
outline: `${"var(--ds-border-width-focused, 2px)"} solid ${"var(--ds-border-focused, #4688EC)"}`
|
|
55
|
+
},
|
|
56
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
57
|
+
'div&': {
|
|
58
|
+
pointerEvents: 'none'
|
|
59
|
+
},
|
|
60
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
61
|
+
[`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
|
|
62
|
+
margin: `0 ${"var(--ds-space-100, 8px)"}`
|
|
63
|
+
},
|
|
64
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
65
|
+
[`@media (min-width: ${PRODUCT_HOME_BREAKPOINT}px)`]: {
|
|
66
|
+
margin: `0 ${"var(--ds-space-200, 16px)"}`
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
const appHomeIconStyles = css({
|
|
70
|
+
borderRadius: '10px'
|
|
71
|
+
});
|
|
72
|
+
const appIconStyles = css({
|
|
73
|
+
display: 'flex',
|
|
74
|
+
maxWidth: 24
|
|
75
|
+
});
|
|
76
|
+
const appLogoTextStyles = css({
|
|
77
|
+
// Logo text should never wrap or overflow
|
|
78
|
+
width: 'max-content',
|
|
79
|
+
paddingInlineEnd: "var(--ds-space-025, 2px)",
|
|
80
|
+
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
81
|
+
[`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
|
|
82
|
+
display: 'none'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const siteTitleStyles = css({
|
|
86
|
+
display: 'flex',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
marginInlineEnd: "var(--ds-space-050, 4px)",
|
|
89
|
+
marginInlineStart: "var(--ds-space-050, 4px)",
|
|
90
|
+
paddingInlineEnd: "var(--ds-space-200, 16px)"
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* __App home__
|
|
95
|
+
*
|
|
96
|
+
* A variant of the ProductHome component designed for use with the updated app logos.
|
|
97
|
+
*
|
|
98
|
+
* Takes an icon, displayed at all viewport sizes, and a product name, which is
|
|
99
|
+
* displayed only at larger viewport sizes.
|
|
100
|
+
*
|
|
101
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#app-product-home)
|
|
102
|
+
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
103
|
+
*
|
|
104
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
105
|
+
*/
|
|
106
|
+
export const AppHome = ({
|
|
107
|
+
'aria-label': ariaLabel,
|
|
108
|
+
href,
|
|
109
|
+
name,
|
|
110
|
+
icon: Icon,
|
|
111
|
+
onClick,
|
|
112
|
+
onMouseDown,
|
|
113
|
+
siteTitle,
|
|
114
|
+
testId,
|
|
115
|
+
...rest
|
|
116
|
+
}) => {
|
|
117
|
+
const theme = useTheme();
|
|
118
|
+
const primaryButton = theme.mode.primaryButton;
|
|
119
|
+
// After the brand refresh, iconColor and textColor should be set to 'undefined' to allow the original
|
|
120
|
+
// multi-color logo tile colors to be visible, rather than a hardcoded blue.
|
|
121
|
+
let {
|
|
122
|
+
iconColor = undefined,
|
|
123
|
+
textColor = undefined
|
|
124
|
+
} = theme.mode.productHome;
|
|
125
|
+
|
|
126
|
+
// The default theme is set at module scope and immediately used in context.
|
|
127
|
+
// To allow the feature flag to switch the logo color at runtime, we also detect the original hardcoded
|
|
128
|
+
// values and override them to undefined.
|
|
129
|
+
if (iconColor === '#357DE8' && textColor === "var(--ds-text, #292A2E)") {
|
|
130
|
+
iconColor = undefined;
|
|
131
|
+
textColor = undefined;
|
|
132
|
+
}
|
|
133
|
+
const Tag = getTag(onClick, href);
|
|
134
|
+
const preventFocusRing = e => {
|
|
135
|
+
e.preventDefault();
|
|
136
|
+
onMouseDown && onMouseDown(e);
|
|
137
|
+
};
|
|
138
|
+
const productHomeButtonDynamicStyles = stripEmptyProperties({
|
|
139
|
+
[VAR_PRODUCT_HOME_COLOR_ACTIVE]: primaryButton.active.color,
|
|
140
|
+
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE]: primaryButton.active.backgroundColor,
|
|
141
|
+
[VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE]: primaryButton.active.boxShadow,
|
|
142
|
+
[VAR_PRODUCT_HOME_COLOR_FOCUS]: primaryButton.focus.color,
|
|
143
|
+
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS]: primaryButton.focus.backgroundColor,
|
|
144
|
+
[VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS]: primaryButton.focus.boxShadow,
|
|
145
|
+
[VAR_PRODUCT_HOME_COLOR_HOVER]: primaryButton.hover.color,
|
|
146
|
+
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER]: primaryButton.hover.backgroundColor,
|
|
147
|
+
[VAR_PRODUCT_HOME_BOX_SHADOW_HOVER]: primaryButton.hover.boxShadow
|
|
148
|
+
});
|
|
149
|
+
return jsx(Fragment, null, jsx(Tag
|
|
150
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
151
|
+
, _extends({
|
|
152
|
+
style: productHomeButtonDynamicStyles,
|
|
153
|
+
css: [productHomeButtonStyles, appHomeIconStyles],
|
|
154
|
+
href: href,
|
|
155
|
+
onClick: onClick,
|
|
156
|
+
onMouseDown: preventFocusRing,
|
|
157
|
+
"data-testid": testId && `${testId}-container`,
|
|
158
|
+
"aria-label": ariaLabel
|
|
159
|
+
// Made all props explicit, leaving just in case
|
|
160
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
161
|
+
}, rest), jsx(Inline, {
|
|
162
|
+
space: "space.075",
|
|
163
|
+
alignBlock: "center"
|
|
164
|
+
}, jsx("div", {
|
|
165
|
+
css: [appIconStyles],
|
|
166
|
+
"data-testid": testId && `${testId}-icon`
|
|
167
|
+
}, jsx(Icon, {
|
|
168
|
+
iconColor: iconColor,
|
|
169
|
+
shouldUseNewLogoDesign: true,
|
|
170
|
+
size: "small",
|
|
171
|
+
appearance: "brand"
|
|
172
|
+
})), jsx("span", {
|
|
173
|
+
css: appLogoTextStyles
|
|
174
|
+
}, jsx(Text, {
|
|
175
|
+
"aria-hidden": true,
|
|
176
|
+
color: "inherit",
|
|
177
|
+
weight: "semibold"
|
|
178
|
+
}, name)))), siteTitle && jsx("div", {
|
|
179
|
+
style: {
|
|
180
|
+
borderRight: theme.mode.productHome.borderRight
|
|
181
|
+
},
|
|
182
|
+
css: siteTitleStyles,
|
|
183
|
+
"data-testid": testId && `${testId}-site-title`
|
|
184
|
+
}, siteTitle));
|
|
185
|
+
};
|
|
@@ -100,6 +100,8 @@ const siteTitleStyles = css({
|
|
|
100
100
|
*
|
|
101
101
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#custom-product-home)
|
|
102
102
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
103
|
+
*
|
|
104
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
103
105
|
*/
|
|
104
106
|
const CustomProductHome = props => {
|
|
105
107
|
const {
|
|
@@ -9,7 +9,7 @@ import React, { Fragment } from 'react';
|
|
|
9
9
|
import { css, jsx } from '@emotion/react';
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
14
14
|
import { useTheme } from '../../theme';
|
|
15
15
|
import { stripEmptyProperties } from '../../utils';
|
|
@@ -103,22 +103,6 @@ const productIconStyles = css({
|
|
|
103
103
|
display: 'none'
|
|
104
104
|
}
|
|
105
105
|
});
|
|
106
|
-
const appHomeIconStyles = css({
|
|
107
|
-
borderRadius: '10px'
|
|
108
|
-
});
|
|
109
|
-
const appIconStyles = css({
|
|
110
|
-
display: 'flex',
|
|
111
|
-
maxWidth: 24
|
|
112
|
-
});
|
|
113
|
-
const appLogoTextStyles = css({
|
|
114
|
-
// Logo text should never wrap or overflow
|
|
115
|
-
width: 'max-content',
|
|
116
|
-
paddingInlineEnd: "var(--ds-space-025, 2px)",
|
|
117
|
-
// eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
118
|
-
[`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
|
|
119
|
-
display: 'none'
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
106
|
const siteTitleStyles = css({
|
|
123
107
|
display: 'flex',
|
|
124
108
|
alignItems: 'center',
|
|
@@ -127,98 +111,6 @@ const siteTitleStyles = css({
|
|
|
127
111
|
paddingInlineEnd: "var(--ds-space-200, 16px)"
|
|
128
112
|
});
|
|
129
113
|
|
|
130
|
-
/**
|
|
131
|
-
* __App home__
|
|
132
|
-
*
|
|
133
|
-
* A variant of the ProductHome component designed for use with the updated app logos.
|
|
134
|
-
*
|
|
135
|
-
* Takes an icon, displayed at all viewport sizes, and a product name, which is
|
|
136
|
-
* displayed only at larger viewport sizes.
|
|
137
|
-
*
|
|
138
|
-
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#app-product-home)
|
|
139
|
-
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
140
|
-
*/
|
|
141
|
-
export const AppHome = ({
|
|
142
|
-
'aria-label': ariaLabel,
|
|
143
|
-
href,
|
|
144
|
-
name,
|
|
145
|
-
icon: Icon,
|
|
146
|
-
onClick,
|
|
147
|
-
onMouseDown,
|
|
148
|
-
siteTitle,
|
|
149
|
-
testId,
|
|
150
|
-
...rest
|
|
151
|
-
}) => {
|
|
152
|
-
const theme = useTheme();
|
|
153
|
-
const primaryButton = theme.mode.primaryButton;
|
|
154
|
-
// After the brand refresh, iconColor and textColor should be set to 'undefined' to allow the original
|
|
155
|
-
// multi-color logo tile colors to be visible, rather than a hardcoded blue.
|
|
156
|
-
let {
|
|
157
|
-
iconColor = undefined,
|
|
158
|
-
textColor = undefined
|
|
159
|
-
} = theme.mode.productHome;
|
|
160
|
-
|
|
161
|
-
// The default theme is set at module scope and immediately used in context.
|
|
162
|
-
// To allow the feature flag to switch the logo color at runtime, we also detect the original hardcoded
|
|
163
|
-
// values and override them to undefined.
|
|
164
|
-
if (iconColor === '#357DE8' && textColor === "var(--ds-text, #292A2E)") {
|
|
165
|
-
iconColor = undefined;
|
|
166
|
-
textColor = undefined;
|
|
167
|
-
}
|
|
168
|
-
const Tag = getTag(onClick, href);
|
|
169
|
-
const preventFocusRing = e => {
|
|
170
|
-
e.preventDefault();
|
|
171
|
-
onMouseDown && onMouseDown(e);
|
|
172
|
-
};
|
|
173
|
-
const productHomeButtonDynamicStyles = stripEmptyProperties({
|
|
174
|
-
[VAR_PRODUCT_HOME_COLOR_ACTIVE]: primaryButton.active.color,
|
|
175
|
-
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE]: primaryButton.active.backgroundColor,
|
|
176
|
-
[VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE]: primaryButton.active.boxShadow,
|
|
177
|
-
[VAR_PRODUCT_HOME_COLOR_FOCUS]: primaryButton.focus.color,
|
|
178
|
-
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS]: primaryButton.focus.backgroundColor,
|
|
179
|
-
[VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS]: primaryButton.focus.boxShadow,
|
|
180
|
-
[VAR_PRODUCT_HOME_COLOR_HOVER]: primaryButton.hover.color,
|
|
181
|
-
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER]: primaryButton.hover.backgroundColor,
|
|
182
|
-
[VAR_PRODUCT_HOME_BOX_SHADOW_HOVER]: primaryButton.hover.boxShadow
|
|
183
|
-
});
|
|
184
|
-
return jsx(Fragment, null, jsx(Tag
|
|
185
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
186
|
-
, _extends({
|
|
187
|
-
style: productHomeButtonDynamicStyles,
|
|
188
|
-
css: [productHomeButtonStyles, appHomeIconStyles],
|
|
189
|
-
href: href,
|
|
190
|
-
onClick: onClick,
|
|
191
|
-
onMouseDown: preventFocusRing,
|
|
192
|
-
"data-testid": testId && `${testId}-container`,
|
|
193
|
-
"aria-label": ariaLabel
|
|
194
|
-
// Made all props explicit, leaving just in case
|
|
195
|
-
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
196
|
-
}, rest), jsx(Inline, {
|
|
197
|
-
space: "space.075",
|
|
198
|
-
alignBlock: "center"
|
|
199
|
-
}, jsx("div", {
|
|
200
|
-
css: [appIconStyles],
|
|
201
|
-
"data-testid": testId && `${testId}-icon`
|
|
202
|
-
}, jsx(Icon, {
|
|
203
|
-
iconColor: iconColor,
|
|
204
|
-
shouldUseNewLogoDesign: true,
|
|
205
|
-
size: "small",
|
|
206
|
-
appearance: "brand"
|
|
207
|
-
})), jsx("span", {
|
|
208
|
-
css: appLogoTextStyles
|
|
209
|
-
}, jsx(Text, {
|
|
210
|
-
"aria-hidden": true,
|
|
211
|
-
color: "inherit",
|
|
212
|
-
weight: "semibold"
|
|
213
|
-
}, name)))), siteTitle && jsx("div", {
|
|
214
|
-
style: {
|
|
215
|
-
borderRight: theme.mode.productHome.borderRight
|
|
216
|
-
},
|
|
217
|
-
css: siteTitleStyles,
|
|
218
|
-
"data-testid": testId && `${testId}-site-title`
|
|
219
|
-
}, siteTitle));
|
|
220
|
-
};
|
|
221
|
-
|
|
222
114
|
/**
|
|
223
115
|
* __Product home__
|
|
224
116
|
*
|
|
@@ -229,6 +121,8 @@ export const AppHome = ({
|
|
|
229
121
|
*
|
|
230
122
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#product-home)
|
|
231
123
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
124
|
+
*
|
|
125
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
232
126
|
*/
|
|
233
127
|
const ProductHome = ({
|
|
234
128
|
'aria-label': ariaLabel,
|
|
@@ -309,4 +203,5 @@ const ProductHome = ({
|
|
|
309
203
|
"data-testid": testId && `${testId}-site-title`
|
|
310
204
|
}, siteTitle));
|
|
311
205
|
};
|
|
312
|
-
export default ProductHome;
|
|
206
|
+
export default ProductHome;
|
|
207
|
+
export { AppHome } from './app-home';
|
|
@@ -9,6 +9,8 @@ import { IconButton } from '../IconButton';
|
|
|
9
9
|
*
|
|
10
10
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#profile)
|
|
11
11
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
12
|
+
*
|
|
13
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
12
14
|
*/
|
|
13
15
|
export const Profile = /*#__PURE__*/forwardRef((props, ref) => {
|
|
14
16
|
const {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { IconButton } from '../IconButton';
|
|
4
|
+
/**
|
|
5
|
+
* __Profile__
|
|
6
|
+
*
|
|
7
|
+
* A profile button which takes an icon/avatar component can be that can be
|
|
8
|
+
* passed into `AtlassianNavigation`'s `renderProfile` prop.
|
|
9
|
+
*
|
|
10
|
+
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#profile)
|
|
11
|
+
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
12
|
+
*
|
|
13
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
14
|
+
*/
|
|
15
|
+
export const Profile = /*#__PURE__*/forwardRef((props, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
component,
|
|
18
|
+
href,
|
|
19
|
+
icon,
|
|
20
|
+
id,
|
|
21
|
+
isDisabled,
|
|
22
|
+
isSelected,
|
|
23
|
+
label: labelProp,
|
|
24
|
+
onBlur,
|
|
25
|
+
onClick,
|
|
26
|
+
onFocus,
|
|
27
|
+
onMouseDown,
|
|
28
|
+
onMouseEnter,
|
|
29
|
+
onMouseLeave,
|
|
30
|
+
onMouseUp,
|
|
31
|
+
target,
|
|
32
|
+
testId,
|
|
33
|
+
theme,
|
|
34
|
+
tooltip,
|
|
35
|
+
...rest
|
|
36
|
+
} = props;
|
|
37
|
+
const label = labelProp || (typeof tooltip === 'string' ? tooltip : 'Your profile and settings');
|
|
38
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
39
|
+
role: "listitem"
|
|
40
|
+
}, /*#__PURE__*/React.createElement(IconButton, _extends({
|
|
41
|
+
component: component,
|
|
42
|
+
href: href,
|
|
43
|
+
icon: icon,
|
|
44
|
+
id: id,
|
|
45
|
+
isDisabled: isDisabled,
|
|
46
|
+
isSelected: isSelected,
|
|
47
|
+
label: label,
|
|
48
|
+
onBlur: onBlur,
|
|
49
|
+
onClick: onClick,
|
|
50
|
+
onFocus: onFocus,
|
|
51
|
+
onMouseDown: onMouseDown,
|
|
52
|
+
onMouseEnter: onMouseEnter,
|
|
53
|
+
onMouseLeave: onMouseLeave,
|
|
54
|
+
onMouseUp: onMouseUp,
|
|
55
|
+
ref: ref,
|
|
56
|
+
target: target,
|
|
57
|
+
testId: testId
|
|
58
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
59
|
+
,
|
|
60
|
+
theme: theme,
|
|
61
|
+
tooltip: tooltip,
|
|
62
|
+
isTooltipAnnouncementDisabled: true
|
|
63
|
+
// These are mostly explicit, leaving it in just in case
|
|
64
|
+
}, rest)));
|
|
65
|
+
});
|
|
@@ -124,6 +124,8 @@ const SearchComponent = props => {
|
|
|
124
124
|
*
|
|
125
125
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#search)
|
|
126
126
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
127
|
+
*
|
|
128
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
127
129
|
*/
|
|
128
130
|
export const Search = props => {
|
|
129
131
|
const {
|
|
@@ -17,6 +17,8 @@ const iconSpacingStyles = {
|
|
|
17
17
|
*
|
|
18
18
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#settings)
|
|
19
19
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
20
|
+
*
|
|
21
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
20
22
|
*/
|
|
21
23
|
export const Settings = /*#__PURE__*/forwardRef((props, ref) => {
|
|
22
24
|
const {
|
|
@@ -17,6 +17,8 @@ const iconSpacingStyles = {
|
|
|
17
17
|
*
|
|
18
18
|
* - [Examples](https://atlassian.design/components/atlassian-navigation/examples#sign-in)
|
|
19
19
|
* - [Code](https://atlassian.design/components/atlassian-navigation/code)
|
|
20
|
+
*
|
|
21
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
20
22
|
*/
|
|
21
23
|
export const SignIn = props => {
|
|
22
24
|
const {
|
|
@@ -46,6 +46,8 @@ export const OverflowProvider = ({
|
|
|
46
46
|
* Returns the current context value for the nearest OverflowProvider.
|
|
47
47
|
*
|
|
48
48
|
* - [Example](https://atlassian.design/components/atlassian-navigation/examples#responsive)
|
|
49
|
+
*
|
|
50
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
49
51
|
*/
|
|
50
52
|
export const useOverflowStatus = () => useContext(OverflowContext);
|
|
51
53
|
export const useOverflowController = nodes => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable @repo/internal/react/require-jsdoc */
|
|
2
|
+
import { createContext } from 'react';
|
|
3
|
+
import noop from '@atlaskit/ds-lib/noop';
|
|
4
|
+
export const OverflowContext = /*#__PURE__*/createContext({
|
|
5
|
+
isVisible: true,
|
|
6
|
+
openOverflowMenu: noop,
|
|
7
|
+
closeOverflowMenu: noop
|
|
8
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { OverflowContext } from './overflow-context';
|
|
3
|
+
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
4
|
+
export const OverflowProvider = ({
|
|
5
|
+
children,
|
|
6
|
+
isVisible,
|
|
7
|
+
openOverflowMenu,
|
|
8
|
+
closeOverflowMenu
|
|
9
|
+
}) => {
|
|
10
|
+
const value = useMemo(() => ({
|
|
11
|
+
isVisible,
|
|
12
|
+
openOverflowMenu,
|
|
13
|
+
closeOverflowMenu
|
|
14
|
+
}), [isVisible, openOverflowMenu, closeOverflowMenu]);
|
|
15
|
+
return /*#__PURE__*/React.createElement(OverflowContext.Provider, {
|
|
16
|
+
value: value
|
|
17
|
+
}, children);
|
|
18
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
4
|
+
|
|
5
|
+
import throttle from 'lodash/throttle';
|
|
6
|
+
const THROTTLE_INTERVAL = 16 * 4;
|
|
7
|
+
const ITEM_APPROX_MINWIDTH = 70;
|
|
8
|
+
const calculateHash = (w, n) => w + '#' + n;
|
|
9
|
+
const updateHashRef = (currentRef, value) => {
|
|
10
|
+
currentRef.unshift(value);
|
|
11
|
+
currentRef.length = 3;
|
|
12
|
+
};
|
|
13
|
+
export const useOverflowController = nodes => {
|
|
14
|
+
const items = React.Children.toArray(nodes);
|
|
15
|
+
const [width, setWidth] = useState(9999);
|
|
16
|
+
const [itemsLimit, setItemsLimit] = useState(items.length);
|
|
17
|
+
const [forceEffectValue, triggerForceEffect] = useState({});
|
|
18
|
+
// Storing items approximate width so we can try expanding when there is enough room
|
|
19
|
+
const itemsWidths = useRef([]).current;
|
|
20
|
+
// Storing a couple of width + items count in order to stabilize
|
|
21
|
+
const hashRef = useRef([]);
|
|
22
|
+
|
|
23
|
+
// AFP-2511 TODO: Fix automatic suppressions below
|
|
24
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
25
|
+
const throttleSetWidth = useCallback(throttle(setWidth, THROTTLE_INTERVAL), [setWidth]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
const lastItemWidth = itemsWidths[itemsLimit] || 0;
|
|
28
|
+
const wasJustLimited = lastItemWidth < 0;
|
|
29
|
+
const currentHash = calculateHash(width, itemsLimit);
|
|
30
|
+
if (hashRef.current[0] === currentHash) {
|
|
31
|
+
// After removing an item, if width has not changed yet we schedule a force update
|
|
32
|
+
// to handle case where removing an item does not actually trigger width change
|
|
33
|
+
const t = setTimeout(() => {
|
|
34
|
+
updateHashRef(hashRef.current, '');
|
|
35
|
+
triggerForceEffect({});
|
|
36
|
+
}, THROTTLE_INTERVAL * 1.5);
|
|
37
|
+
return () => clearTimeout(t);
|
|
38
|
+
}
|
|
39
|
+
if (wasJustLimited) {
|
|
40
|
+
// Width was updated either via resize or after changing the limit
|
|
41
|
+
// we cap the width between ITEM_APPROX_MINWIDTH and 2*ITEM_APPROX_MINWIDTH
|
|
42
|
+
// because width is throttled as when fast expanding/resizing partialWidth
|
|
43
|
+
// will not be reliable (edge case)
|
|
44
|
+
const partialWidth = Math.max(Math.min(width + lastItemWidth, ITEM_APPROX_MINWIDTH * 2), ITEM_APPROX_MINWIDTH);
|
|
45
|
+
itemsWidths[itemsLimit] = partialWidth;
|
|
46
|
+
}
|
|
47
|
+
if (width < ITEM_APPROX_MINWIDTH * 0.9 && itemsLimit) {
|
|
48
|
+
// If current width is less than an item approx width we remove an item
|
|
49
|
+
// marking the width as negative so we will calculate it on width update
|
|
50
|
+
// plus we set the hash to stabilise and not removing more than one element
|
|
51
|
+
// until we are sure width was updated
|
|
52
|
+
const nextHash = calculateHash(width, itemsLimit - 1);
|
|
53
|
+
if (hashRef.current.indexOf(nextHash) === -1) {
|
|
54
|
+
setItemsLimit(itemsLimit - 1);
|
|
55
|
+
itemsWidths[itemsLimit - 1] = -(width || 1);
|
|
56
|
+
updateHashRef(hashRef.current, nextHash);
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* This is not necessarily equal to `lastItemWidth` because the
|
|
63
|
+
* ```js
|
|
64
|
+
* if (wasJustLimited) {}
|
|
65
|
+
* ```
|
|
66
|
+
* branch above modifies `itemsWidths`.
|
|
67
|
+
*
|
|
68
|
+
* Using `lastItemWidth` here can cause collapsing behavior to fail,
|
|
69
|
+
* such as the issue reported in DSP-7329.
|
|
70
|
+
*/
|
|
71
|
+
const currentLastItemWidth = itemsWidths[itemsLimit] || 0;
|
|
72
|
+
if (width - currentLastItemWidth > ITEM_APPROX_MINWIDTH * 1.1 && itemsLimit < items.length) {
|
|
73
|
+
// If we have enough room to accomodate next item width we increase the limit
|
|
74
|
+
// unless it has been recently removed
|
|
75
|
+
const nextHash = calculateHash(width, itemsLimit + 1);
|
|
76
|
+
if (hashRef.current.indexOf(nextHash) === -1) {
|
|
77
|
+
setItemsLimit(itemsLimit + 1);
|
|
78
|
+
updateHashRef(hashRef.current, nextHash);
|
|
79
|
+
}
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
return;
|
|
83
|
+
}, [width, hashRef, itemsLimit, itemsWidths, forceEffectValue, items.length]);
|
|
84
|
+
return {
|
|
85
|
+
visibleItems: items.slice(0, itemsLimit),
|
|
86
|
+
overflowItems: items.slice(itemsLimit),
|
|
87
|
+
updateWidth: throttleSetWidth
|
|
88
|
+
};
|
|
89
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import { OverflowContext } from './overflow-context';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* __useOverFlowStatus__
|
|
6
|
+
*
|
|
7
|
+
* Returns the current context value for the nearest OverflowProvider.
|
|
8
|
+
*
|
|
9
|
+
* - [Example](https://atlassian.design/components/atlassian-navigation/examples#responsive)
|
|
10
|
+
*
|
|
11
|
+
* @deprecated `@atlaskit/atlassian-navigation` is deprecated. Use `@atlaskit/navigation-system` instead.
|
|
12
|
+
*/
|
|
13
|
+
export const useOverflowStatus = () => useContext(OverflowContext);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { AppSwitcher
|
|
1
|
+
export { AppSwitcher } from '../components/AppSwitcher/app-switcher';
|
|
2
|
+
export { AppSwitcherNav4 } from '../components/AppSwitcher/app-switcher-nav4';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useOverflowStatus } from '../controllers/overflow/
|
|
1
|
+
export { useOverflowStatus } from '../controllers/overflow/use-overflow-status';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Profile } from '../components/Profile/
|
|
1
|
+
export { Profile } from '../components/Profile/profile';
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { Nav4SkeletonHelpButton
|
|
1
|
+
export { Nav4SkeletonHelpButton } from '../nav4-skeleton-help-button';
|
|
2
|
+
export { SkeletonHelpButton } from '../skeleton-help-button';
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { AtlassianNavigation } from './components/AtlassianNavigation';
|
|
2
|
-
export { AppSwitcher
|
|
2
|
+
export { AppSwitcher } from './components/AppSwitcher/app-switcher';
|
|
3
|
+
export { AppSwitcherNav4 } from './components/AppSwitcher/app-switcher-nav4';
|
|
3
4
|
export { Create } from './components/Create';
|
|
4
5
|
export { Help } from './components/Help';
|
|
5
6
|
export { Notifications } from './components/Notifications';
|
|
@@ -7,10 +8,10 @@ export { PrimaryButton } from './components/PrimaryButton';
|
|
|
7
8
|
export { PrimaryDropdownButton } from './components/PrimaryDropdownButton';
|
|
8
9
|
export { IconButton } from './components/IconButton';
|
|
9
10
|
export { CustomProductHome, ProductHome, AppHome } from './components/ProductHome';
|
|
10
|
-
export { Profile } from './components/Profile';
|
|
11
|
+
export { Profile } from './components/Profile/profile';
|
|
11
12
|
export { Search } from './components/Search';
|
|
12
13
|
export { Settings } from './components/Settings';
|
|
13
14
|
export { SignIn } from './components/SignIn';
|
|
14
|
-
export { useOverflowStatus } from './controllers/overflow';
|
|
15
|
+
export { useOverflowStatus } from './controllers/overflow/use-overflow-status';
|
|
15
16
|
export { HORIZONTAL_GLOBAL_NAV_HEIGHT } from './common/constants';
|
|
16
17
|
export { atlassianTheme, generateTheme, ThemeProvider } from './theme';
|