@atlaskit/atlassian-navigation 2.1.0 → 2.1.1
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 +7 -0
- package/dist/cjs/common/constants.js +10 -1
- package/dist/cjs/components/AtlassianNavigation/index.js +61 -5
- package/dist/cjs/components/AtlassianNavigation/skeleton.js +67 -10
- package/dist/cjs/components/BadgeContainer/index.js +12 -4
- package/dist/cjs/components/Create/index.js +21 -12
- package/dist/cjs/components/Create/skeleton.js +21 -6
- package/dist/cjs/components/Create/styles.js +1 -25
- package/dist/cjs/components/IconButton/skeleton.js +31 -5
- package/dist/cjs/components/IconButton/styles.js +2 -32
- package/dist/cjs/components/PrimaryButton/index.js +35 -1
- package/dist/cjs/components/PrimaryButton/skeleton.js +15 -5
- package/dist/cjs/components/PrimaryButton/styles.js +2 -58
- package/dist/cjs/components/PrimaryDropdownButton/index.js +6 -3
- package/dist/cjs/components/PrimaryItemsContainer/index.js +26 -4
- package/dist/cjs/components/PrimaryItemsContainer/skeleton.js +8 -3
- package/dist/cjs/components/ProductHome/custom-product-home.js +104 -6
- package/dist/cjs/components/ProductHome/product-home.js +104 -6
- package/dist/cjs/components/ProductHome/skeleton.js +117 -6
- package/dist/cjs/components/Search/index.js +50 -6
- package/dist/cjs/components/Search/skeleton.js +29 -7
- package/dist/cjs/components/SkeletonCreateButton/index.js +23 -5
- package/dist/cjs/components/SkeletonIconButton/index.js +30 -5
- package/dist/cjs/components/SkeletonPrimaryButton/index.js +79 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/common/constants.js +4 -0
- package/dist/es2019/components/AtlassianNavigation/index.js +61 -6
- package/dist/es2019/components/AtlassianNavigation/skeleton.js +67 -11
- package/dist/es2019/components/BadgeContainer/index.js +12 -4
- package/dist/es2019/components/Create/index.js +26 -13
- package/dist/es2019/components/Create/skeleton.js +20 -6
- package/dist/es2019/components/Create/styles.js +0 -15
- package/dist/es2019/components/IconButton/skeleton.js +23 -5
- package/dist/es2019/components/IconButton/styles.js +1 -23
- package/dist/es2019/components/PrimaryButton/index.js +35 -3
- package/dist/es2019/components/PrimaryButton/skeleton.js +14 -5
- package/dist/es2019/components/PrimaryButton/styles.js +1 -46
- package/dist/es2019/components/PrimaryDropdownButton/index.js +7 -3
- package/dist/es2019/components/PrimaryItemsContainer/index.js +25 -4
- package/dist/es2019/components/PrimaryItemsContainer/skeleton.js +7 -3
- package/dist/es2019/components/ProductHome/custom-product-home.js +119 -6
- package/dist/es2019/components/ProductHome/product-home.js +119 -6
- package/dist/es2019/components/ProductHome/skeleton.js +129 -6
- package/dist/es2019/components/Search/index.js +47 -6
- package/dist/es2019/components/Search/skeleton.js +30 -7
- package/dist/es2019/components/SkeletonCreateButton/index.js +23 -3
- package/dist/es2019/components/SkeletonIconButton/index.js +30 -3
- package/dist/es2019/components/SkeletonPrimaryButton/index.js +74 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/common/constants.js +4 -0
- package/dist/esm/components/AtlassianNavigation/index.js +61 -6
- package/dist/esm/components/AtlassianNavigation/skeleton.js +67 -11
- package/dist/esm/components/BadgeContainer/index.js +12 -4
- package/dist/esm/components/Create/index.js +22 -13
- package/dist/esm/components/Create/skeleton.js +19 -6
- package/dist/esm/components/Create/styles.js +0 -15
- package/dist/esm/components/IconButton/skeleton.js +29 -5
- package/dist/esm/components/IconButton/styles.js +0 -22
- package/dist/esm/components/PrimaryButton/index.js +35 -3
- package/dist/esm/components/PrimaryButton/skeleton.js +14 -5
- package/dist/esm/components/PrimaryButton/styles.js +0 -44
- package/dist/esm/components/PrimaryDropdownButton/index.js +7 -3
- package/dist/esm/components/PrimaryItemsContainer/index.js +25 -4
- package/dist/esm/components/PrimaryItemsContainer/skeleton.js +7 -3
- package/dist/esm/components/ProductHome/custom-product-home.js +102 -6
- package/dist/esm/components/ProductHome/product-home.js +102 -6
- package/dist/esm/components/ProductHome/skeleton.js +117 -6
- package/dist/esm/components/Search/index.js +48 -6
- package/dist/esm/components/Search/skeleton.js +27 -7
- package/dist/esm/components/SkeletonCreateButton/index.js +23 -3
- package/dist/esm/components/SkeletonIconButton/index.js +30 -3
- package/dist/esm/components/SkeletonPrimaryButton/index.js +80 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/common/constants.d.ts +3 -0
- package/dist/types/common/styles.d.ts +143 -143
- package/dist/types/components/AtlassianNavigation/skeleton.d.ts +1 -1
- package/dist/types/components/AtlassianNavigation/types.d.ts +1 -0
- package/dist/types/components/Create/styles.d.ts +0 -923
- package/dist/types/components/IconButton/skeleton.d.ts +1 -1
- package/dist/types/components/IconButton/styles.d.ts +0 -915
- package/dist/types/components/PrimaryButton/index.d.ts +1 -1
- package/dist/types/components/PrimaryButton/skeleton.d.ts +1 -0
- package/dist/types/components/PrimaryButton/styles.d.ts +0 -917
- package/dist/types/components/PrimaryDropdownButton/index.d.ts +1 -1
- package/docs/99-migrating-from-navigation-next.tsx +31 -32
- package/package.json +7 -3
- package/dist/cjs/components/AtlassianNavigation/styles.js +0 -82
- package/dist/cjs/components/BadgeContainer/styles.js +0 -17
- package/dist/cjs/components/PrimaryDropdownButton/styles.js +0 -13
- package/dist/cjs/components/PrimaryItemsContainer/styles.js +0 -42
- package/dist/cjs/components/ProductHome/styles.js +0 -152
- package/dist/cjs/components/Search/styles.js +0 -70
- package/dist/cjs/components/SkeletonCreateButton/styles.js +0 -39
- package/dist/cjs/components/SkeletonIconButton/styles.js +0 -46
- package/dist/cjs/components/SkeletonPrimaryButton/styles.js +0 -74
- package/dist/es2019/components/AtlassianNavigation/styles.js +0 -60
- package/dist/es2019/components/BadgeContainer/styles.js +0 -9
- package/dist/es2019/components/PrimaryDropdownButton/styles.js +0 -6
- package/dist/es2019/components/PrimaryItemsContainer/styles.js +0 -30
- package/dist/es2019/components/ProductHome/styles.js +0 -117
- package/dist/es2019/components/Search/styles.js +0 -43
- package/dist/es2019/components/SkeletonCreateButton/styles.js +0 -25
- package/dist/es2019/components/SkeletonIconButton/styles.js +0 -32
- package/dist/es2019/components/SkeletonPrimaryButton/styles.js +0 -60
- package/dist/esm/components/AtlassianNavigation/styles.js +0 -64
- package/dist/esm/components/BadgeContainer/styles.js +0 -9
- package/dist/esm/components/PrimaryDropdownButton/styles.js +0 -6
- package/dist/esm/components/PrimaryItemsContainer/styles.js +0 -29
- package/dist/esm/components/ProductHome/styles.js +0 -114
- package/dist/esm/components/Search/styles.js +0 -47
- package/dist/esm/components/SkeletonCreateButton/styles.js +0 -28
- package/dist/esm/components/SkeletonIconButton/styles.js +0 -35
- package/dist/esm/components/SkeletonPrimaryButton/styles.js +0 -63
- package/dist/types/components/AtlassianNavigation/styles.d.ts +0 -22
- package/dist/types/components/BadgeContainer/styles.d.ts +0 -9
- package/dist/types/components/PrimaryDropdownButton/styles.d.ts +0 -5
- package/dist/types/components/PrimaryItemsContainer/styles.d.ts +0 -9
- package/dist/types/components/ProductHome/styles.d.ts +0 -2791
- package/dist/types/components/Search/styles.d.ts +0 -1842
- package/dist/types/components/SkeletonCreateButton/styles.d.ts +0 -4
- package/dist/types/components/SkeletonIconButton/styles.d.ts +0 -4
- package/dist/types/components/SkeletonPrimaryButton/styles.d.ts +0 -4
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/core';
|
|
4
|
-
import { gridSize } from '
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { CREATE_BREAKPOINT, gridSize } from '../../common/constants';
|
|
5
5
|
import { useTheme } from '../../theme';
|
|
6
6
|
import { IconButtonSkeleton } from '../IconButton/skeleton';
|
|
7
|
-
|
|
7
|
+
const buttonHeight = gridSize * 4;
|
|
8
|
+
const skeletonStyles = css({
|
|
9
|
+
width: 68,
|
|
10
|
+
height: buttonHeight,
|
|
11
|
+
marginLeft: 12,
|
|
12
|
+
borderRadius: 3,
|
|
13
|
+
opacity: 0.15
|
|
14
|
+
});
|
|
15
|
+
const mobileStyles = css({
|
|
16
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
17
|
+
[`@media (max-width: ${CREATE_BREAKPOINT - 1}px)`]: {
|
|
18
|
+
display: 'none !important'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
8
21
|
export const CreateSkeleton = () => {
|
|
9
22
|
const theme = useTheme();
|
|
10
23
|
return jsx(Fragment, null, jsx("div", {
|
|
11
|
-
|
|
24
|
+
style: theme.mode.skeleton,
|
|
25
|
+
css: [skeletonStyles, mobileStyles]
|
|
12
26
|
}), jsx(IconButtonSkeleton, {
|
|
13
|
-
css:
|
|
14
|
-
size: gridSize
|
|
27
|
+
css: mobileStyles,
|
|
28
|
+
size: gridSize * 3.25
|
|
15
29
|
}));
|
|
16
30
|
};
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
|
|
2
|
-
import { actionSectionDesktopCSS, actionSectionMobileCSS, skeletonCSS } from '../../common/styles';
|
|
3
|
-
const gridSize = gridSizeFn();
|
|
4
|
-
const buttonHeight = gridSize * 4;
|
|
5
|
-
export const createButtonCSS = actionSectionDesktopCSS;
|
|
6
|
-
export const createButtonSkeletonCSS = theme => ({
|
|
7
|
-
height: `${buttonHeight}px`,
|
|
8
|
-
width: '68px',
|
|
9
|
-
borderRadius: '3px',
|
|
10
|
-
marginLeft: 12,
|
|
11
|
-
...createButtonCSS,
|
|
12
|
-
...skeletonCSS(theme)
|
|
13
|
-
});
|
|
14
|
-
export const createIconCSS = actionSectionMobileCSS;
|
|
15
|
-
export const createIconSkeletonCSS = createIconCSS;
|
|
16
1
|
export const getCreateButtonTheme = ({
|
|
17
2
|
mode: {
|
|
18
3
|
create
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/core';
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { gridSize } from '../../common/constants';
|
|
3
4
|
import { useTheme } from '../../theme';
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
const buttonHeight = gridSize * 4;
|
|
6
|
+
const skeletonStyles = css({
|
|
7
|
+
borderRadius: '50%',
|
|
8
|
+
opacity: 0.15
|
|
9
|
+
});
|
|
10
|
+
export const IconButtonSkeleton = ({
|
|
11
|
+
className,
|
|
12
|
+
marginLeft,
|
|
13
|
+
marginRight,
|
|
14
|
+
size
|
|
15
|
+
}) => {
|
|
6
16
|
const theme = useTheme();
|
|
17
|
+
const dynamicStyles = {
|
|
18
|
+
marginLeft: typeof marginLeft === 'number' ? marginLeft : gridSize / 2,
|
|
19
|
+
marginRight: typeof marginRight === 'number' ? marginRight : 0,
|
|
20
|
+
width: typeof size === 'number' ? size : buttonHeight,
|
|
21
|
+
height: typeof size === 'number' ? size : buttonHeight,
|
|
22
|
+
...theme.mode.skeleton
|
|
23
|
+
};
|
|
7
24
|
return jsx("div", {
|
|
8
|
-
className:
|
|
9
|
-
|
|
25
|
+
className: className,
|
|
26
|
+
style: dynamicStyles,
|
|
27
|
+
css: skeletonStyles
|
|
10
28
|
});
|
|
11
29
|
};
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
|
|
2
|
-
import { skeletonCSS } from '../../common/styles';
|
|
3
|
-
const gridSize = gridSizeFn();
|
|
4
|
-
export const margin = {
|
|
5
|
-
left: gridSize / 2
|
|
6
|
-
};
|
|
7
|
-
export const padding = {
|
|
8
|
-
all: gridSize / 2
|
|
9
|
-
};
|
|
10
1
|
export const getIconButtonTheme = ({
|
|
11
2
|
mode: {
|
|
12
3
|
iconButton
|
|
@@ -41,17 +32,4 @@ export const getIconButtonTheme = ({
|
|
|
41
32
|
},
|
|
42
33
|
spinnerStyles
|
|
43
34
|
};
|
|
44
|
-
};
|
|
45
|
-
const buttonHeight = gridSize * 4;
|
|
46
|
-
export const iconButtonSkeletonCSS = (theme, {
|
|
47
|
-
marginLeft,
|
|
48
|
-
marginRight,
|
|
49
|
-
size
|
|
50
|
-
}) => ({
|
|
51
|
-
borderRadius: '50%',
|
|
52
|
-
marginLeft: typeof marginLeft === 'number' ? marginLeft : margin.left,
|
|
53
|
-
marginRight: typeof marginRight === 'number' ? marginRight : 0,
|
|
54
|
-
width: typeof size === 'number' ? size : buttonHeight,
|
|
55
|
-
height: typeof size === 'number' ? size : buttonHeight,
|
|
56
|
-
...skeletonCSS(theme)
|
|
57
|
-
});
|
|
35
|
+
};
|
|
@@ -2,11 +2,39 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
6
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
7
7
|
import Tooltip from '@atlaskit/tooltip';
|
|
8
|
+
import { gridSize } from '../../common/constants';
|
|
8
9
|
import { useTheme } from '../../theme';
|
|
9
|
-
import { getPrimaryButtonTheme
|
|
10
|
+
import { getPrimaryButtonTheme } from './styles';
|
|
11
|
+
const VAR_BUTTON_SELECTED_COLOR = '--button-selected-color';
|
|
12
|
+
const VAR_BUTTON_SELECTED_BORDER_COLOR = '--button-selected-border-color';
|
|
13
|
+
const buttonBaseStyles = css({
|
|
14
|
+
display: 'flex',
|
|
15
|
+
height: '100%',
|
|
16
|
+
position: 'relative',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
flexDirection: 'column'
|
|
20
|
+
});
|
|
21
|
+
const buttonHighlightedStyles = css({
|
|
22
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
23
|
+
'&& > *': {
|
|
24
|
+
color: `var(${VAR_BUTTON_SELECTED_COLOR})`
|
|
25
|
+
},
|
|
26
|
+
'&:after': {
|
|
27
|
+
height: 3,
|
|
28
|
+
position: 'absolute',
|
|
29
|
+
right: gridSize / 2,
|
|
30
|
+
bottom: 0,
|
|
31
|
+
left: gridSize / 2,
|
|
32
|
+
backgroundColor: `var(${VAR_BUTTON_SELECTED_BORDER_COLOR})`,
|
|
33
|
+
borderTopLeftRadius: 1,
|
|
34
|
+
borderTopRightRadius: 1,
|
|
35
|
+
content: '""'
|
|
36
|
+
}
|
|
37
|
+
});
|
|
10
38
|
export const PrimaryButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
11
39
|
const {
|
|
12
40
|
children,
|
|
@@ -18,7 +46,11 @@ export const PrimaryButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
18
46
|
} = props;
|
|
19
47
|
const theme = useTheme();
|
|
20
48
|
const button = jsx("div", {
|
|
21
|
-
|
|
49
|
+
style: {
|
|
50
|
+
[VAR_BUTTON_SELECTED_COLOR]: theme.mode.primaryButton.selected.color,
|
|
51
|
+
[VAR_BUTTON_SELECTED_BORDER_COLOR]: theme.mode.primaryButton.selected.borderColor
|
|
52
|
+
},
|
|
53
|
+
css: [buttonBaseStyles, isHighlighted && buttonHighlightedStyles]
|
|
22
54
|
}, jsx(Button, _extends({
|
|
23
55
|
appearance: "primary",
|
|
24
56
|
testId: testId,
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
|
-
import { jsx } from '@emotion/core';
|
|
4
|
+
import { css, jsx } from '@emotion/core';
|
|
5
|
+
import { buttonHeight, gridSize } from '../../common/constants';
|
|
5
6
|
import { useTheme } from '../../theme';
|
|
6
|
-
|
|
7
|
+
const paddingAll = gridSize / 2;
|
|
8
|
+
const skeletonStyles = css({
|
|
9
|
+
display: 'inline-flex',
|
|
10
|
+
width: '68px',
|
|
11
|
+
height: `${buttonHeight - paddingAll * 2.5}px`,
|
|
12
|
+
borderRadius: `${gridSize / 2}px`,
|
|
13
|
+
opacity: 0.15
|
|
14
|
+
});
|
|
7
15
|
export const PrimaryButtonSkeleton = props => {
|
|
8
16
|
const theme = useTheme();
|
|
9
|
-
return jsx("div", _extends({
|
|
10
|
-
|
|
11
|
-
|
|
17
|
+
return jsx("div", _extends({
|
|
18
|
+
style: theme.mode.skeleton,
|
|
19
|
+
css: skeletonStyles
|
|
20
|
+
}, props));
|
|
12
21
|
};
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
|
|
2
|
-
import { skeletonCSS } from '../../common/styles';
|
|
3
|
-
const gridSize = gridSizeFn();
|
|
4
|
-
export const buttonHeight = gridSize * 4;
|
|
5
|
-
export const margin = {
|
|
6
|
-
left: gridSize / 2
|
|
7
|
-
};
|
|
8
|
-
export const padding = {
|
|
9
|
-
all: gridSize / 2
|
|
10
|
-
};
|
|
11
1
|
export const getPrimaryButtonTheme = ({
|
|
12
2
|
mode: {
|
|
13
3
|
primaryButton
|
|
@@ -37,39 +27,4 @@ export const getPrimaryButtonTheme = ({
|
|
|
37
27
|
},
|
|
38
28
|
spinnerStyles
|
|
39
29
|
};
|
|
40
|
-
};
|
|
41
|
-
export const primaryButtonSkeletonCSS = theme => ({
|
|
42
|
-
borderRadius: `${gridSize / 2}px`,
|
|
43
|
-
display: 'inline-flex',
|
|
44
|
-
height: `${buttonHeight - padding.all * 2.5}px`,
|
|
45
|
-
width: '68px',
|
|
46
|
-
...skeletonCSS(theme)
|
|
47
|
-
});
|
|
48
|
-
export const isHighlightedCSS = ({
|
|
49
|
-
mode: {
|
|
50
|
-
primaryButton
|
|
51
|
-
}
|
|
52
|
-
}, isHighlighted) => ({
|
|
53
|
-
display: 'flex',
|
|
54
|
-
flexDirection: 'column',
|
|
55
|
-
justifyContent: 'center',
|
|
56
|
-
alignItems: 'center',
|
|
57
|
-
height: '100%',
|
|
58
|
-
position: 'relative',
|
|
59
|
-
...(isHighlighted && {
|
|
60
|
-
'&& > *': {
|
|
61
|
-
color: primaryButton.selected.color
|
|
62
|
-
},
|
|
63
|
-
'&:after': {
|
|
64
|
-
position: 'absolute',
|
|
65
|
-
bottom: 0,
|
|
66
|
-
left: gridSize / 2,
|
|
67
|
-
right: gridSize / 2,
|
|
68
|
-
content: '""',
|
|
69
|
-
height: 3,
|
|
70
|
-
backgroundColor: primaryButton.selected.borderColor,
|
|
71
|
-
borderTopLeftRadius: 1,
|
|
72
|
-
borderTopRightRadius: 1
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
});
|
|
30
|
+
};
|
|
@@ -2,14 +2,18 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
6
|
import ChevronIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
7
7
|
import { PrimaryButton } from '../PrimaryButton';
|
|
8
|
-
|
|
8
|
+
const chevronIconStyles = css({
|
|
9
|
+
marginRight: '-8px',
|
|
10
|
+
marginLeft: '-8px',
|
|
11
|
+
opacity: 0.51
|
|
12
|
+
});
|
|
9
13
|
export const PrimaryDropdownButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
10
14
|
return jsx(PrimaryButton, _extends({
|
|
11
15
|
iconAfter: jsx("span", {
|
|
12
|
-
css:
|
|
16
|
+
css: chevronIconStyles
|
|
13
17
|
}, jsx(ChevronIcon, {
|
|
14
18
|
label: ""
|
|
15
19
|
})),
|
|
@@ -2,12 +2,33 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { useCallback, useState } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
6
|
import Popup from '@atlaskit/popup';
|
|
7
7
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
8
|
+
import { gridSize } from '../../common/constants';
|
|
8
9
|
import { OverflowProvider, useOverflowController } from '../../controllers/overflow';
|
|
9
10
|
import { PrimaryDropdownButton } from '../PrimaryDropdownButton';
|
|
10
|
-
|
|
11
|
+
const containerStyles = css({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
height: '100%',
|
|
14
|
+
position: 'relative',
|
|
15
|
+
alignItems: 'stretch',
|
|
16
|
+
flexBasis: 0,
|
|
17
|
+
flexGrow: 1,
|
|
18
|
+
flexShrink: 0,
|
|
19
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
20
|
+
'& > *': {
|
|
21
|
+
margin: `0 ${gridSize / 2}px`,
|
|
22
|
+
flexShrink: 0
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const widthObserverContainerStyles = css({
|
|
26
|
+
width: '100%',
|
|
27
|
+
minWidth: '1px',
|
|
28
|
+
margin: '0px',
|
|
29
|
+
position: 'relative',
|
|
30
|
+
flexShrink: 1
|
|
31
|
+
});
|
|
11
32
|
export const PrimaryItemsContainer = ({
|
|
12
33
|
moreLabel,
|
|
13
34
|
items,
|
|
@@ -44,7 +65,7 @@ export const PrimaryItemsContainer = ({
|
|
|
44
65
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
66
|
[overflowItems.length, openOverflowMenu, onMoreClose]);
|
|
46
67
|
return jsx("div", {
|
|
47
|
-
css:
|
|
68
|
+
css: containerStyles,
|
|
48
69
|
"data-testid": testId && `${testId}-primary-actions`
|
|
49
70
|
}, jsx(OverflowProvider, {
|
|
50
71
|
isVisible: true,
|
|
@@ -58,7 +79,7 @@ export const PrimaryItemsContainer = ({
|
|
|
58
79
|
trigger: trigger,
|
|
59
80
|
testId: testId ? `${testId}-overflow-menu-popup` : 'overflow-menu-popup'
|
|
60
81
|
}), Create && jsx(Create, null), jsx("div", {
|
|
61
|
-
|
|
82
|
+
css: widthObserverContainerStyles
|
|
62
83
|
}, jsx(WidthObserver, {
|
|
63
84
|
offscreen: true,
|
|
64
85
|
setWidth: updateWidth
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/core';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { gridSize } from '../../common/constants';
|
|
4
5
|
import { PrimaryButtonSkeleton } from '../PrimaryButton/skeleton';
|
|
5
|
-
|
|
6
|
+
const primaryButtonSkeletonStyles = css({
|
|
7
|
+
marginRight: gridSize * 1.5,
|
|
8
|
+
marginLeft: gridSize * 1.5
|
|
9
|
+
});
|
|
6
10
|
export const PrimaryItemsContainerSkeleton = ({
|
|
7
11
|
count
|
|
8
12
|
}) => jsx(Fragment, null, Array.from({
|
|
9
13
|
length: count
|
|
10
14
|
}, (_, index) => jsx(PrimaryButtonSkeleton, {
|
|
11
15
|
key: index,
|
|
12
|
-
css:
|
|
16
|
+
css: primaryButtonSkeletonStyles
|
|
13
17
|
})));
|
|
@@ -2,10 +2,101 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import { Fragment } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/core';
|
|
5
|
+
import { css, jsx } from '@emotion/core';
|
|
6
|
+
import { gridSize, PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
|
|
6
7
|
import { useTheme } from '../../theme';
|
|
7
|
-
import { customProductIconCSS, customProductLogoCSS, productHomeButtonCSS, siteTitleCSS } from './styles';
|
|
8
8
|
import { getTag } from './utils';
|
|
9
|
+
const VAR_LOGO_MAX_WIDTH = '--logo-max-width';
|
|
10
|
+
const VAR_PRODUCT_HOME_COLOR_ACTIVE = '--product-home-color-active';
|
|
11
|
+
const VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE = '--product-home-bg-color-active';
|
|
12
|
+
const VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE = '--product-home-box-shadow-active';
|
|
13
|
+
const VAR_PRODUCT_HOME_COLOR_FOCUS = '--product-home-color-focus';
|
|
14
|
+
const VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS = '--product-home-bg-color-focus';
|
|
15
|
+
const VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS = '--product-home-box-shadow-focus';
|
|
16
|
+
const VAR_PRODUCT_HOME_COLOR_HOVER = '--product-home-color-hover';
|
|
17
|
+
const VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER = '--product-home-bg-color-hover';
|
|
18
|
+
const VAR_PRODUCT_HOME_BOX_SHADOW_HOVER = '--product-home-box-shadow-hover';
|
|
19
|
+
const productLogoStyles = css({
|
|
20
|
+
// Ensure anything passed into
|
|
21
|
+
// productHome is aligned correctly
|
|
22
|
+
display: 'flex',
|
|
23
|
+
maxWidth: `var(${VAR_LOGO_MAX_WIDTH})`,
|
|
24
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
25
|
+
'& > *': {
|
|
26
|
+
maxHeight: 24
|
|
27
|
+
},
|
|
28
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
29
|
+
[`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
|
|
30
|
+
display: 'none'
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const customMaxHeightStyles = css({
|
|
34
|
+
maxHeight: 28
|
|
35
|
+
});
|
|
36
|
+
const productIconStyles = css({
|
|
37
|
+
// Ensure anything passed into
|
|
38
|
+
// productHome is aligned correctly
|
|
39
|
+
display: 'flex',
|
|
40
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
41
|
+
'& > *': {
|
|
42
|
+
maxHeight: 24
|
|
43
|
+
},
|
|
44
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
45
|
+
[`@media (min-width: ${PRODUCT_HOME_BREAKPOINT}px)`]: {
|
|
46
|
+
display: 'none'
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const productHomeButtonStyles = css({
|
|
50
|
+
display: 'flex',
|
|
51
|
+
padding: gridSize / 2,
|
|
52
|
+
alignItems: 'center',
|
|
53
|
+
background: 'none',
|
|
54
|
+
border: 0,
|
|
55
|
+
borderRadius: 3,
|
|
56
|
+
color: 'inherit',
|
|
57
|
+
cursor: 'pointer',
|
|
58
|
+
'&::-moz-focus-inner': {
|
|
59
|
+
border: 0
|
|
60
|
+
},
|
|
61
|
+
'&:first-of-type': {
|
|
62
|
+
marginLeft: 0
|
|
63
|
+
},
|
|
64
|
+
'&:hover': {
|
|
65
|
+
backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER})`,
|
|
66
|
+
boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_HOVER})`,
|
|
67
|
+
color: `var(${VAR_PRODUCT_HOME_COLOR_HOVER})`
|
|
68
|
+
},
|
|
69
|
+
'&:active': {
|
|
70
|
+
backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE})`,
|
|
71
|
+
boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE})`,
|
|
72
|
+
color: `var(${VAR_PRODUCT_HOME_COLOR_ACTIVE})`
|
|
73
|
+
},
|
|
74
|
+
'&:focus': {
|
|
75
|
+
backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS})`,
|
|
76
|
+
boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS})`,
|
|
77
|
+
color: `var(${VAR_PRODUCT_HOME_COLOR_FOCUS})`,
|
|
78
|
+
outline: 0
|
|
79
|
+
},
|
|
80
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
81
|
+
'div&': {
|
|
82
|
+
pointerEvents: 'none'
|
|
83
|
+
},
|
|
84
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
85
|
+
[`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
|
|
86
|
+
margin: `0 ${gridSize}px`
|
|
87
|
+
},
|
|
88
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
89
|
+
[`@media (min-width: ${PRODUCT_HOME_BREAKPOINT}px)`]: {
|
|
90
|
+
margin: `0 ${gridSize * 2}px`
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
const siteTitleStyles = css({
|
|
94
|
+
display: 'flex',
|
|
95
|
+
marginRight: gridSize / 2,
|
|
96
|
+
marginLeft: gridSize * 0.5,
|
|
97
|
+
paddingRight: gridSize * 2,
|
|
98
|
+
alignItems: 'center'
|
|
99
|
+
});
|
|
9
100
|
|
|
10
101
|
const CustomProductHome = props => {
|
|
11
102
|
const {
|
|
@@ -22,6 +113,7 @@ const CustomProductHome = props => {
|
|
|
22
113
|
...rest
|
|
23
114
|
} = props;
|
|
24
115
|
const theme = useTheme();
|
|
116
|
+
const primaryButton = theme.mode.primaryButton;
|
|
25
117
|
const Tag = getTag(onClick, href);
|
|
26
118
|
|
|
27
119
|
const preventFocusRing = event => {
|
|
@@ -29,24 +121,45 @@ const CustomProductHome = props => {
|
|
|
29
121
|
onMouseDown && onMouseDown(event);
|
|
30
122
|
};
|
|
31
123
|
|
|
124
|
+
const productHomeButtonDynamicStyles = {
|
|
125
|
+
[VAR_PRODUCT_HOME_COLOR_ACTIVE]: primaryButton.active.color,
|
|
126
|
+
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE]: primaryButton.active.backgroundColor,
|
|
127
|
+
[VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE]: primaryButton.active.boxShadow,
|
|
128
|
+
[VAR_PRODUCT_HOME_COLOR_FOCUS]: primaryButton.focus.color,
|
|
129
|
+
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS]: primaryButton.focus.backgroundColor,
|
|
130
|
+
[VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS]: primaryButton.focus.boxShadow,
|
|
131
|
+
[VAR_PRODUCT_HOME_COLOR_HOVER]: primaryButton.hover.color,
|
|
132
|
+
[VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER]: primaryButton.hover.backgroundColor,
|
|
133
|
+
[VAR_PRODUCT_HOME_BOX_SHADOW_HOVER]: primaryButton.hover.boxShadow
|
|
134
|
+
};
|
|
32
135
|
return jsx(Fragment, null, jsx(Tag, _extends({
|
|
33
136
|
href: href,
|
|
34
|
-
|
|
137
|
+
style: productHomeButtonDynamicStyles,
|
|
138
|
+
css: productHomeButtonStyles,
|
|
35
139
|
onClick: onClick,
|
|
36
140
|
onMouseDown: preventFocusRing,
|
|
37
141
|
"data-testid": testId && `${testId}-container`
|
|
38
142
|
}, rest), logoUrl && jsx("img", {
|
|
39
|
-
|
|
143
|
+
style: {
|
|
144
|
+
[VAR_LOGO_MAX_WIDTH]: logoMaxWidth
|
|
145
|
+
},
|
|
146
|
+
css: [customMaxHeightStyles, productLogoStyles],
|
|
40
147
|
src: logoUrl,
|
|
41
148
|
alt: logoAlt,
|
|
42
149
|
"data-testid": testId && `${testId}-logo`
|
|
43
150
|
}), iconUrl && jsx("img", {
|
|
44
|
-
|
|
151
|
+
style: {
|
|
152
|
+
[VAR_LOGO_MAX_WIDTH]: logoMaxWidth
|
|
153
|
+
},
|
|
154
|
+
css: [customMaxHeightStyles, productIconStyles],
|
|
45
155
|
src: iconUrl,
|
|
46
156
|
alt: iconAlt,
|
|
47
157
|
"data-testid": testId && `${testId}-icon`
|
|
48
158
|
})), siteTitle && jsx("div", {
|
|
49
|
-
|
|
159
|
+
style: {
|
|
160
|
+
borderRight: theme.mode.productHome.borderRight
|
|
161
|
+
},
|
|
162
|
+
css: siteTitleStyles,
|
|
50
163
|
"data-testid": testId && `${testId}-site-title`
|
|
51
164
|
}, siteTitle));
|
|
52
165
|
};
|