@atlaskit/atlassian-navigation 2.0.4 → 2.1.2
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 +21 -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 +24 -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/theme/defaultTheme.js +39 -40
- 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 +29 -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/theme/defaultTheme.js +39 -40
- 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 +25 -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/theme/defaultTheme.js +39 -40
- 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/index.d.ts +1 -1
- package/dist/types/components/Create/styles.d.ts +0 -923
- package/dist/types/components/Create/types.d.ts +5 -1
- 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/05-create.tsx +8 -0
- package/docs/99-migrating-from-navigation-next.tsx +31 -32
- package/package.json +9 -5
- 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,42 +1,98 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/core';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
import { N30A, N40A, N900 } from '@atlaskit/theme/colors';
|
|
4
|
+
import { gridSize, HORIZONTAL_GLOBAL_NAV_HEIGHT } from '../../common/constants';
|
|
5
|
+
import { defaultTheme, hexToRGBA, ThemeProvider } from '../../theme';
|
|
5
6
|
import { IconButtonSkeleton } from '../IconButton/skeleton';
|
|
6
7
|
import { PrimaryItemsContainerSkeleton } from '../PrimaryItemsContainer/skeleton';
|
|
7
8
|
import { ProductHomeSkeleton } from '../ProductHome/skeleton';
|
|
8
9
|
import { ProfileSkeleton } from '../Profile/skeleton';
|
|
9
10
|
import { SearchSkeleton } from '../Search/skeleton';
|
|
10
|
-
|
|
11
|
+
const containerStyles = css({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
boxSizing: 'border-box',
|
|
14
|
+
height: HORIZONTAL_GLOBAL_NAV_HEIGHT,
|
|
15
|
+
paddingRight: gridSize * 1.5,
|
|
16
|
+
paddingLeft: gridSize * 1.5,
|
|
17
|
+
position: 'relative',
|
|
18
|
+
alignItems: 'center',
|
|
19
|
+
justifyContent: 'space-between',
|
|
20
|
+
flexShrink: 0,
|
|
21
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
22
|
+
'[data-theme="light"] &, [data-theme="dark"] &': {
|
|
23
|
+
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-design-token-usage
|
|
24
|
+
borderBottom: `1px solid ${"var(--ds-border, #091E4224)"}`,
|
|
25
|
+
// TODO: (DSP-2087) Remove the below once tokens have launched
|
|
26
|
+
'&::after': {
|
|
27
|
+
content: 'none'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
// TODO: (DSP-2087) Remove the below once tokens have launched
|
|
31
|
+
'&::after': {
|
|
32
|
+
height: gridSize / 2,
|
|
33
|
+
position: 'absolute',
|
|
34
|
+
top: '100%',
|
|
35
|
+
right: 0,
|
|
36
|
+
left: 0,
|
|
37
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
38
|
+
background: `linear-gradient(180deg, ${N40A} 0, ${N40A} 1px, ${N30A} 1px, ${hexToRGBA( // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
|
|
39
|
+
N900, 0)} 4px)`,
|
|
40
|
+
content: '""'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const leftStyles = css({
|
|
44
|
+
display: 'flex',
|
|
45
|
+
minWidth: 0,
|
|
46
|
+
height: 'inherit',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
flexGrow: 1,
|
|
49
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
50
|
+
'& > *': {
|
|
51
|
+
flexShrink: 0
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const rightStyles = css({
|
|
55
|
+
display: 'flex',
|
|
56
|
+
alignItems: 'center',
|
|
57
|
+
flexShrink: 0,
|
|
58
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
59
|
+
'& > *': {
|
|
60
|
+
marginRight: gridSize / 2,
|
|
61
|
+
flexShrink: 0
|
|
62
|
+
}
|
|
63
|
+
});
|
|
11
64
|
export const NavigationSkeleton = ({
|
|
12
65
|
primaryItemsCount = 4,
|
|
13
66
|
secondaryItemsCount = 4,
|
|
14
67
|
theme = defaultTheme,
|
|
15
68
|
showSiteName = false,
|
|
16
|
-
shouldShowSearch = true
|
|
69
|
+
shouldShowSearch = true,
|
|
70
|
+
testId
|
|
17
71
|
}) => {
|
|
18
72
|
return jsx(ThemeProvider, {
|
|
19
73
|
value: theme
|
|
20
74
|
}, jsx("div", {
|
|
21
|
-
|
|
75
|
+
style: theme.mode.navigation,
|
|
76
|
+
css: containerStyles,
|
|
77
|
+
"data-testid": testId
|
|
22
78
|
}, jsx("div", {
|
|
23
|
-
css:
|
|
79
|
+
css: leftStyles
|
|
24
80
|
}, jsx(IconButtonSkeleton, {
|
|
25
81
|
marginLeft: 0,
|
|
26
82
|
marginRight: 5,
|
|
27
|
-
size: gridSize
|
|
83
|
+
size: gridSize * 3.25
|
|
28
84
|
}), jsx(ProductHomeSkeleton, {
|
|
29
85
|
showSiteName: showSiteName
|
|
30
86
|
}), jsx(PrimaryItemsContainerSkeleton, {
|
|
31
87
|
count: primaryItemsCount
|
|
32
88
|
})), jsx("div", {
|
|
33
|
-
css:
|
|
89
|
+
css: rightStyles
|
|
34
90
|
}, shouldShowSearch && jsx(SearchSkeleton, null), Array.from({
|
|
35
91
|
length: secondaryItemsCount
|
|
36
92
|
}, (_, index) => jsx(IconButtonSkeleton, {
|
|
37
93
|
key: index,
|
|
38
94
|
marginLeft: 0,
|
|
39
|
-
marginRight:
|
|
40
|
-
size: gridSize
|
|
95
|
+
marginRight: gridSize / 2,
|
|
96
|
+
size: gridSize * 3.25
|
|
41
97
|
})), jsx(ProfileSkeleton, null))));
|
|
42
98
|
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
import { jsx } from '@emotion/core';
|
|
3
|
-
|
|
2
|
+
import { css, jsx } from '@emotion/core';
|
|
3
|
+
const badgeContainerStyles = css({
|
|
4
|
+
position: 'absolute',
|
|
5
|
+
top: '-4px',
|
|
6
|
+
right: '-2px',
|
|
7
|
+
pointerEvents: 'none'
|
|
8
|
+
});
|
|
9
|
+
const containerStyles = css({
|
|
10
|
+
position: 'relative'
|
|
11
|
+
});
|
|
4
12
|
export const BadgeContainer = props => {
|
|
5
13
|
const {
|
|
6
14
|
id: badgeId,
|
|
@@ -8,9 +16,9 @@ export const BadgeContainer = props => {
|
|
|
8
16
|
children
|
|
9
17
|
} = props;
|
|
10
18
|
return jsx("div", {
|
|
11
|
-
css:
|
|
19
|
+
css: containerStyles
|
|
12
20
|
}, children, jsx("div", {
|
|
13
|
-
css:
|
|
21
|
+
css: badgeContainerStyles,
|
|
14
22
|
id: badgeId,
|
|
15
23
|
"aria-hidden": true
|
|
16
24
|
}, jsx(Badge, null)));
|
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Fragment } from 'react';
|
|
3
|
-
import { jsx } from '@emotion/core';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
4
|
import Button from '@atlaskit/button/custom-theme-button';
|
|
5
5
|
import AddIcon from '@atlaskit/icon/glyph/editor/add';
|
|
6
|
-
import { gridSize } from '@atlaskit/theme/constants';
|
|
7
6
|
import Tooltip from '@atlaskit/tooltip';
|
|
7
|
+
import { CREATE_BREAKPOINT, gridSize } from '../../common/constants';
|
|
8
8
|
import { useTheme } from '../../theme';
|
|
9
9
|
import { IconButton } from '../IconButton';
|
|
10
|
-
import {
|
|
11
|
-
const
|
|
10
|
+
import { getCreateButtonTheme } from './styles';
|
|
11
|
+
const wrapperStyles = css({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
15
|
+
'& [data-hide-on-smallscreens]': {
|
|
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
|
+
},
|
|
21
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
22
|
+
'& [data-hide-on-largescreens]': {
|
|
23
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
24
|
+
[`@media (min-width: ${CREATE_BREAKPOINT}px)`]: {
|
|
25
|
+
display: 'none !important'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
// eslint-disable-next-line @repo/internal/styles/no-nested-styles
|
|
29
|
+
'&&': {
|
|
30
|
+
marginLeft: gridSize * 1.5
|
|
31
|
+
}
|
|
32
|
+
});
|
|
12
33
|
|
|
13
34
|
const TooltipSwitch = ({
|
|
14
35
|
buttonTooltip,
|
|
@@ -20,6 +41,7 @@ const TooltipSwitch = ({
|
|
|
20
41
|
|
|
21
42
|
export const Create = ({
|
|
22
43
|
onClick,
|
|
44
|
+
href,
|
|
23
45
|
text,
|
|
24
46
|
buttonTooltip,
|
|
25
47
|
iconButtonTooltip,
|
|
@@ -27,21 +49,14 @@ export const Create = ({
|
|
|
27
49
|
}) => {
|
|
28
50
|
const theme = useTheme();
|
|
29
51
|
return jsx("div", {
|
|
30
|
-
css:
|
|
31
|
-
display: 'flex',
|
|
32
|
-
alignItems: 'center',
|
|
33
|
-
'&&': {
|
|
34
|
-
marginLeft: grid * 1.5
|
|
35
|
-
},
|
|
36
|
-
'& [data-hide-on-smallscreens]': createButtonCSS,
|
|
37
|
-
'& [data-hide-on-largescreens]': createIconCSS
|
|
38
|
-
},
|
|
52
|
+
css: wrapperStyles,
|
|
39
53
|
"data-testid": "create-button-wrapper"
|
|
40
54
|
}, jsx(TooltipSwitch, {
|
|
41
55
|
buttonTooltip: buttonTooltip
|
|
42
56
|
}, jsx(Button, {
|
|
43
57
|
id: "createGlobalItem",
|
|
44
58
|
onClick: onClick,
|
|
59
|
+
href: href,
|
|
45
60
|
theme: getCreateButtonTheme(theme),
|
|
46
61
|
testId: testId && `${testId}-button`,
|
|
47
62
|
"data-hide-on-smallscreens": true
|
|
@@ -52,6 +67,7 @@ export const Create = ({
|
|
|
52
67
|
label: text
|
|
53
68
|
}),
|
|
54
69
|
onClick: onClick,
|
|
70
|
+
href: href,
|
|
55
71
|
tooltip: iconButtonTooltip,
|
|
56
72
|
theme: getCreateButtonTheme(theme),
|
|
57
73
|
"aria-label": text,
|
|
@@ -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
|
})));
|