@atlaskit/atlassian-navigation 1.1.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/atlassian-navigation
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c9986657899`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c9986657899) - Instrumented atlassian-navigation with the new theming package, @atlaskit/tokens.
8
+
9
+ New tokens will be visible only in applications configured to use the new Tokens API (currently in alpha). These changes are intended to be interoperable with the legacy theme implementation. Legacy dark mode users should expect no visual or breaking changes.
10
+
11
+ ### Patch Changes
12
+
13
+ - [`f791fab1bfa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f791fab1bfa) - Added missing `components` and `onBlur` props to the props type used by secondary actions. These were already available but were not documented.
14
+ - Updated dependencies
15
+
3
16
  ## 1.1.3
4
17
 
5
18
  ### Patch Changes
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.bottomShadow = exports.rightCSS = exports.leftCSS = exports.containerCSS = void 0;
8
+ exports.rightCSS = exports.leftCSS = exports.containerCSS = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
@@ -13,6 +13,8 @@ var _colors = require("@atlaskit/theme/colors");
13
13
 
14
14
  var _constants = require("@atlaskit/theme/constants");
15
15
 
16
+ var _tokens = require("@atlaskit/tokens");
17
+
16
18
  var _constants2 = require("../../common/constants");
17
19
 
18
20
  var _theme = require("../../theme");
@@ -25,7 +27,7 @@ var gridSize = (0, _constants.gridSize)();
25
27
 
26
28
  var containerCSS = function containerCSS(_ref) {
27
29
  var navigation = _ref.mode.navigation;
28
- return _objectSpread(_objectSpread({
30
+ return _objectSpread({
29
31
  alignItems: 'center',
30
32
  boxSizing: 'border-box',
31
33
  display: 'flex',
@@ -34,8 +36,28 @@ var containerCSS = function containerCSS(_ref) {
34
36
  paddingLeft: gridSize * 1.5,
35
37
  paddingRight: gridSize * 1.5,
36
38
  height: _constants2.HORIZONTAL_GLOBAL_NAV_HEIGHT,
37
- position: 'relative'
38
- }, bottomShadow), navigation);
39
+ position: 'relative',
40
+ '[data-theme="light"] &, [data-theme="dark"] &': {
41
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
42
+ borderBottom: "1px solid ".concat((0, _tokens.token)('color.border.neutral')),
43
+ // TODO: (DSP-2087) Remove the below once tokens have launched
44
+ '&::after': {
45
+ content: 'none'
46
+ }
47
+ },
48
+ // TODO: (DSP-2087) Remove the below once tokens have launched
49
+ '&::after': {
50
+ content: '""',
51
+ position: 'absolute',
52
+ left: 0,
53
+ right: 0,
54
+ top: '100%',
55
+ height: gridSize / 2,
56
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
57
+ background: "linear-gradient(180deg, ".concat(_colors.N40A, " 0, ").concat(_colors.N40A, " 1px, ").concat(_colors.N30A, " 1px, ").concat((0, _theme.hexToRGBA)( // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
58
+ _colors.N900, 0), " 4px)")
59
+ }
60
+ }, navigation);
39
61
  };
40
62
 
41
63
  exports.containerCSS = containerCSS;
@@ -59,16 +81,4 @@ var rightCSS = {
59
81
  marginRight: gridSize / 2
60
82
  }
61
83
  };
62
- exports.rightCSS = rightCSS;
63
- var bottomShadow = {
64
- '&::after': {
65
- content: '""',
66
- position: 'absolute',
67
- left: 0,
68
- right: 0,
69
- top: '100%',
70
- height: gridSize / 2,
71
- background: "linear-gradient(180deg, ".concat(_colors.N40A, " 0, ").concat(_colors.N40A, " 1px, ").concat(_colors.N30A, " 1px, ").concat((0, _theme.hexToRGBA)(_colors.N900, 0), " 4px)")
72
- }
73
- };
74
- exports.bottomShadow = bottomShadow;
84
+ exports.rightCSS = rightCSS;
@@ -45,13 +45,13 @@ var getIconButtonTheme = function getIconButtonTheme(_ref) {
45
45
  }, iconButton.default), {}, {
46
46
  ':hover': iconButton.hover,
47
47
  ':focus': iconButton.focus,
48
- // :active doesn't work in FF, becasue we do a
48
+ // :active doesn't work in FF, because we do a
49
49
  // e.preventDefault() on mouse down in Button.
50
50
  // '&&' is required to add more CSS specificity
51
51
  // && it not a valid CSSObject property
52
52
  // @ts-ignore
53
53
  '&&': _objectSpread({}, props.state === 'active' && iconButton.active)
54
- }, props.state === 'selected' && iconButton.active), {}, {
54
+ }, props.state === 'selected' && iconButton.selected), {}, {
55
55
  '> span': {
56
56
  margin: 0
57
57
  }
@@ -37,14 +37,14 @@ var getPrimaryButtonTheme = function getPrimaryButtonTheme(_ref) {
37
37
  spinnerStyles = _current.spinnerStyles;
38
38
 
39
39
  return {
40
- buttonStyles: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, buttonStyles), primaryButton.default), props.isSelected && primaryButton.active), {}, {
40
+ buttonStyles: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, buttonStyles), primaryButton.default), props.isSelected && primaryButton.selected), {}, {
41
41
  fontWeight: 500,
42
42
  padding: '0 4px',
43
43
  marginLeft: 0,
44
44
  marginRight: 0,
45
45
  ':hover': primaryButton.hover,
46
46
  ':focus': primaryButton.focus,
47
- // :active doesn't work in FF, becasue we do a
47
+ // :active doesn't work in FF, because we do a
48
48
  // e.preventDefault() on mouse down in Button.
49
49
  // '&&' is required to add more CSS specificity
50
50
  // && it not a valid CSSObject property
@@ -7,8 +7,6 @@ exports.primaryButtonSkeletonCSS = exports.widthObserverContainerStyle = exports
7
7
 
8
8
  var _constants = require("@atlaskit/theme/constants");
9
9
 
10
- var _theme = require("../../theme");
11
-
12
10
  var margin = "0 ".concat((0, _constants.gridSize)() / 2, "px");
13
11
 
14
12
  var containerCSS = function containerCSS(_ref) {
@@ -32,7 +30,7 @@ var containerCSS = function containerCSS(_ref) {
32
30
  right: 0,
33
31
  height: '100%',
34
32
  width: "".concat((0, _constants.gridSize)() * 3, "px"),
35
- background: "linear-gradient(90deg, ".concat((0, _theme.hexToRGBA)(navigation.backgroundColor, 0), " 0%, ").concat((0, _theme.hexToRGBA)(navigation.backgroundColor, 0.7), " 50%, ").concat((0, _theme.hexToRGBA)(navigation.backgroundColor, 1), " 100%)")
33
+ background: "linear-gradient(90deg, transparent 0%, ".concat(navigation.backgroundColor, " 100%)")
36
34
  }
37
35
  };
38
36
  };
@@ -7,30 +7,32 @@ exports.default = exports.DEFAULT_THEME_NAME = void 0;
7
7
 
8
8
  var _colors = require("@atlaskit/theme/colors");
9
9
 
10
+ var _tokens = require("@atlaskit/tokens");
11
+
10
12
  var _themeHelpers = require("./themeHelpers");
11
13
 
12
14
  var defaultTheme = {
13
15
  mode: {
14
16
  create: {
15
17
  active: {
16
- color: _colors.N0,
17
- backgroundColor: (0, _themeHelpers.hexToRGBA)(_colors.B400, 0.8),
18
- boxShadow: '0 0 0 2px transparent'
18
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0),
19
+ backgroundColor: (0, _tokens.token)('color.background.boldBrand.pressed', (0, _themeHelpers.hexToRGBA)(_colors.B400, 0.8)),
20
+ boxShadow: ''
19
21
  },
20
22
  default: {
21
- color: _colors.N0,
22
- backgroundColor: _colors.B400,
23
- boxShadow: '0 0 0 2px transparent'
23
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0),
24
+ backgroundColor: (0, _tokens.token)('color.background.boldBrand.resting', _colors.B400),
25
+ boxShadow: ''
24
26
  },
25
27
  focus: {
26
- color: _colors.N0,
27
- backgroundColor: _colors.B400,
28
- boxShadow: '0 0 0 2px rgb(128,169,230)'
28
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0),
29
+ backgroundColor: (0, _tokens.token)('color.background.boldBrand.resting', _colors.B400),
30
+ boxShadow: "0 0 0 2px ".concat((0, _tokens.token)('color.border.focus', 'rgb(128,169,230)'))
29
31
  },
30
32
  hover: {
31
- color: _colors.N0,
32
- backgroundColor: (0, _themeHelpers.hexToRGBA)(_colors.B400, 0.9),
33
- boxShadow: '0 0 0 2px transparent'
33
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0),
34
+ backgroundColor: (0, _tokens.token)('color.background.boldBrand.hover', (0, _themeHelpers.hexToRGBA)(_colors.B400, 0.9)),
35
+ boxShadow: ''
34
36
  },
35
37
  selected: {
36
38
  color: '',
@@ -40,88 +42,92 @@ var defaultTheme = {
40
42
  },
41
43
  iconButton: {
42
44
  active: {
43
- color: _colors.B400,
44
- backgroundColor: (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.6),
45
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.B400),
46
+ backgroundColor: (0, _tokens.token)('color.background.subtleNeutral.pressed', (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.6)),
45
47
  boxShadow: ''
46
48
  },
47
49
  default: {
48
- color: _colors.N600,
50
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.N600),
49
51
  backgroundColor: 'transparent',
50
52
  boxShadow: ''
51
53
  },
52
54
  focus: {
53
- color: _colors.N600,
54
- backgroundColor: (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.5),
55
- boxShadow: "0 0 0 2px ".concat(_colors.B200)
55
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.N600),
56
+ backgroundColor: (0, _tokens.token)('color.background.subtleBrand.hover', (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.5)),
57
+ boxShadow: "0 0 0 2px ".concat((0, _tokens.token)('color.border.focus', _colors.B200))
56
58
  },
57
59
  hover: {
58
- color: _colors.B400,
59
- backgroundColor: (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.9),
60
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.B400),
61
+ backgroundColor: (0, _tokens.token)('color.background.subtleNeutral.hover', (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.9)),
60
62
  boxShadow: ''
61
63
  },
62
64
  selected: {
63
- color: '',
64
- backgroundColor: '',
65
+ color: (0, _tokens.token)('color.text.selected', ''),
66
+ backgroundColor: (0, _tokens.token)('color.background.selected.resting', ''),
65
67
  boxShadow: ''
66
68
  }
67
69
  },
68
70
  navigation: {
69
- backgroundColor: _colors.N0,
70
- color: _colors.N200
71
+ backgroundColor: (0, _tokens.token)('color.background.default', _colors.N0),
72
+ color: (0, _tokens.token)('color.text.lowEmphasis', _colors.N200)
71
73
  },
72
74
  productHome: {
73
- backgroundColor: _colors.B400,
74
- color: _colors.N700,
75
- borderRight: "1px solid ".concat((0, _themeHelpers.hexToRGBA)(_colors.N200, 0.3)),
75
+ backgroundColor: (0, _tokens.token)('color.text.brand', _colors.B400),
76
+ color: (0, _tokens.token)('color.text.highEmphasis', _colors.N700),
77
+ borderRight: "1px solid ".concat((0, _tokens.token)('color.border.neutral', (0, _themeHelpers.hexToRGBA)(_colors.N200, 0.3))),
78
+ // TODO: (DSP-1256) These colors should be moved into the Logo package
79
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
76
80
  iconGradientStart: _colors.B400,
81
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
77
82
  iconGradientStop: _colors.B200,
83
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
78
84
  iconColor: _colors.B200
79
85
  },
80
86
  primaryButton: {
81
87
  active: {
82
- color: _colors.B400,
83
- backgroundColor: (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.7),
84
- boxShadow: '0 0 0 2px transparent'
88
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.B400),
89
+ backgroundColor: (0, _tokens.token)('color.background.subtleNeutral.pressed', (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.7)),
90
+ boxShadow: ''
85
91
  },
86
92
  default: {
87
- color: _colors.N600,
93
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.N600),
88
94
  backgroundColor: 'transparent',
89
- boxShadow: '0 0 0 2px transparent'
95
+ boxShadow: ''
90
96
  },
91
97
  focus: {
92
- color: _colors.N600,
98
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.N600),
93
99
  backgroundColor: '',
94
- boxShadow: "0 0 0 2px ".concat(_colors.B200)
100
+ boxShadow: "0 0 0 2px ".concat((0, _tokens.token)('color.border.focus', _colors.B200))
95
101
  },
96
102
  hover: {
97
- color: _colors.B400,
98
- backgroundColor: (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.9),
99
- boxShadow: '0 0 0 2px transparent'
103
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.B400),
104
+ backgroundColor: (0, _tokens.token)('color.background.subtleNeutral.hover', (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.9)),
105
+ boxShadow: ''
100
106
  },
101
107
  selected: {
102
- color: _colors.B400,
103
- backgroundColor: '',
108
+ color: (0, _tokens.token)('color.text.mediumEmphasis', _colors.B400),
109
+ backgroundColor: (0, _tokens.token)('color.background.selected.resting', ''),
104
110
  boxShadow: '',
105
- borderColor: _colors.B400,
106
- bordorBottom: "4px solid ".concat(_colors.B400)
111
+ borderColor: (0, _tokens.token)('color.iconBorder.brand', _colors.B400),
112
+ bordorBottom: "4px solid ".concat((0, _tokens.token)('color.iconBorder.brand', _colors.B400))
107
113
  }
108
114
  },
109
115
  search: {
110
116
  default: {
111
- backgroundColor: _colors.N0,
112
- color: _colors.N200,
113
- borderColor: _colors.N40
117
+ backgroundColor: (0, _tokens.token)('color.background.default', _colors.N0),
118
+ color: (0, _tokens.token)('color.text.lowEmphasis', _colors.N200),
119
+ borderColor: (0, _tokens.token)('color.border.neutral', _colors.N40)
114
120
  },
115
121
  focus: {
116
- borderColor: _colors.B200
122
+ borderColor: (0, _tokens.token)('color.border.focus', _colors.B200)
117
123
  },
118
124
  hover: {
119
- color: _colors.B400,
120
- backgroundColor: (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.9)
125
+ color: (0, _tokens.token)('color.text.brand', _colors.B400),
126
+ backgroundColor: (0, _tokens.token)('color.background.default', (0, _themeHelpers.hexToRGBA)(_colors.B50, 0.9))
121
127
  }
122
128
  },
123
129
  skeleton: {
124
- backgroundColor: _colors.N20,
130
+ backgroundColor: (0, _tokens.token)('color.background.subtleNeutral.resting', _colors.N20),
125
131
  opacity: 1
126
132
  }
127
133
  }
@@ -13,7 +13,9 @@ var _themeGenerator = require("./themeGenerator");
13
13
 
14
14
  var atlassianTheme = (0, _themeGenerator.generateTheme)({
15
15
  name: _defaultTheme.DEFAULT_THEME_NAME,
16
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
16
17
  backgroundColor: _colors.N0,
18
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
17
19
  highlightColor: _colors.B400
18
20
  });
19
21
  exports.atlassianTheme = atlassianTheme;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/atlassian-navigation",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,5 +1,6 @@
1
1
  import { N30A, N40A, N900 } from '@atlaskit/theme/colors';
2
2
  import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
3
+ import { token } from '@atlaskit/tokens';
3
4
  import { HORIZONTAL_GLOBAL_NAV_HEIGHT } from '../../common/constants';
4
5
  import { hexToRGBA } from '../../theme';
5
6
  const gridSize = gridSizeFn();
@@ -17,7 +18,26 @@ export const containerCSS = ({
17
18
  paddingRight: gridSize * 1.5,
18
19
  height: HORIZONTAL_GLOBAL_NAV_HEIGHT,
19
20
  position: 'relative',
20
- ...bottomShadow,
21
+ '[data-theme="light"] &, [data-theme="dark"] &': {
22
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
23
+ borderBottom: `1px solid ${token('color.border.neutral')}`,
24
+ // TODO: (DSP-2087) Remove the below once tokens have launched
25
+ '&::after': {
26
+ content: 'none'
27
+ }
28
+ },
29
+ // TODO: (DSP-2087) Remove the below once tokens have launched
30
+ '&::after': {
31
+ content: '""',
32
+ position: 'absolute',
33
+ left: 0,
34
+ right: 0,
35
+ top: '100%',
36
+ height: gridSize / 2,
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
+ },
21
41
  ...navigation
22
42
  });
23
43
  export const leftCSS = {
@@ -38,15 +58,4 @@ export const rightCSS = {
38
58
  flexShrink: 0,
39
59
  marginRight: gridSize / 2
40
60
  }
41
- };
42
- export const bottomShadow = {
43
- '&::after': {
44
- content: '""',
45
- position: 'absolute',
46
- left: 0,
47
- right: 0,
48
- top: '100%',
49
- height: gridSize / 2,
50
- background: `linear-gradient(180deg, ${N40A} 0, ${N40A} 1px, ${N30A} 1px, ${hexToRGBA(N900, 0)} 4px)`
51
- }
52
61
  };
@@ -27,14 +27,14 @@ export const getIconButtonTheme = ({
27
27
  ...iconButton.default,
28
28
  ':hover': iconButton.hover,
29
29
  ':focus': iconButton.focus,
30
- // :active doesn't work in FF, becasue we do a
30
+ // :active doesn't work in FF, because we do a
31
31
  // e.preventDefault() on mouse down in Button.
32
32
  // '&&' is required to add more CSS specificity
33
33
  // && it not a valid CSSObject property
34
34
  // @ts-ignore
35
35
  '&&': { ...(props.state === 'active' && iconButton.active)
36
36
  },
37
- ...(props.state === 'selected' && iconButton.active),
37
+ ...(props.state === 'selected' && iconButton.selected),
38
38
  '> span': {
39
39
  margin: 0
40
40
  }
@@ -20,14 +20,14 @@ export const getPrimaryButtonTheme = ({
20
20
  return {
21
21
  buttonStyles: { ...buttonStyles,
22
22
  ...primaryButton.default,
23
- ...(props.isSelected && primaryButton.active),
23
+ ...(props.isSelected && primaryButton.selected),
24
24
  fontWeight: 500,
25
25
  padding: '0 4px',
26
26
  marginLeft: 0,
27
27
  marginRight: 0,
28
28
  ':hover': primaryButton.hover,
29
29
  ':focus': primaryButton.focus,
30
- // :active doesn't work in FF, becasue we do a
30
+ // :active doesn't work in FF, because we do a
31
31
  // e.preventDefault() on mouse down in Button.
32
32
  // '&&' is required to add more CSS specificity
33
33
  // && it not a valid CSSObject property
@@ -1,5 +1,4 @@
1
1
  import { gridSize } from '@atlaskit/theme/constants';
2
- import { hexToRGBA } from '../../theme';
3
2
  const margin = `0 ${gridSize() / 2}px`;
4
3
  export const containerCSS = ({
5
4
  mode: {
@@ -24,7 +23,7 @@ export const containerCSS = ({
24
23
  right: 0,
25
24
  height: '100%',
26
25
  width: `${gridSize() * 3}px`,
27
- background: `linear-gradient(90deg, ${hexToRGBA(navigation.backgroundColor, 0)} 0%, ${hexToRGBA(navigation.backgroundColor, 0.7)} 50%, ${hexToRGBA(navigation.backgroundColor, 1)} 100%)`
26
+ background: `linear-gradient(90deg, transparent 0%, ${navigation.backgroundColor} 100%)`
28
27
  }
29
28
  });
30
29
  export const widthObserverContainerStyle = {
@@ -1,27 +1,28 @@
1
1
  import { B200, B400, B50, N0, N20, N200, N40, N600, N700 } from '@atlaskit/theme/colors';
2
+ import { token } from '@atlaskit/tokens';
2
3
  import { hexToRGBA } from './themeHelpers';
3
4
  const defaultTheme = {
4
5
  mode: {
5
6
  create: {
6
7
  active: {
7
- color: N0,
8
- backgroundColor: hexToRGBA(B400, 0.8),
9
- boxShadow: '0 0 0 2px transparent'
8
+ color: token('color.text.onBold', N0),
9
+ backgroundColor: token('color.background.boldBrand.pressed', hexToRGBA(B400, 0.8)),
10
+ boxShadow: ''
10
11
  },
11
12
  default: {
12
- color: N0,
13
- backgroundColor: B400,
14
- boxShadow: '0 0 0 2px transparent'
13
+ color: token('color.text.onBold', N0),
14
+ backgroundColor: token('color.background.boldBrand.resting', B400),
15
+ boxShadow: ''
15
16
  },
16
17
  focus: {
17
- color: N0,
18
- backgroundColor: B400,
19
- boxShadow: '0 0 0 2px rgb(128,169,230)'
18
+ color: token('color.text.onBold', N0),
19
+ backgroundColor: token('color.background.boldBrand.resting', B400),
20
+ boxShadow: `0 0 0 2px ${token('color.border.focus', 'rgb(128,169,230)')}`
20
21
  },
21
22
  hover: {
22
- color: N0,
23
- backgroundColor: hexToRGBA(B400, 0.9),
24
- boxShadow: '0 0 0 2px transparent'
23
+ color: token('color.text.onBold', N0),
24
+ backgroundColor: token('color.background.boldBrand.hover', hexToRGBA(B400, 0.9)),
25
+ boxShadow: ''
25
26
  },
26
27
  selected: {
27
28
  color: '',
@@ -31,88 +32,92 @@ const defaultTheme = {
31
32
  },
32
33
  iconButton: {
33
34
  active: {
34
- color: B400,
35
- backgroundColor: hexToRGBA(B50, 0.6),
35
+ color: token('color.text.mediumEmphasis', B400),
36
+ backgroundColor: token('color.background.subtleNeutral.pressed', hexToRGBA(B50, 0.6)),
36
37
  boxShadow: ''
37
38
  },
38
39
  default: {
39
- color: N600,
40
+ color: token('color.text.mediumEmphasis', N600),
40
41
  backgroundColor: 'transparent',
41
42
  boxShadow: ''
42
43
  },
43
44
  focus: {
44
- color: N600,
45
- backgroundColor: hexToRGBA(B50, 0.5),
46
- boxShadow: `0 0 0 2px ${B200}`
45
+ color: token('color.text.mediumEmphasis', N600),
46
+ backgroundColor: token('color.background.subtleBrand.hover', hexToRGBA(B50, 0.5)),
47
+ boxShadow: `0 0 0 2px ${token('color.border.focus', B200)}`
47
48
  },
48
49
  hover: {
49
- color: B400,
50
- backgroundColor: hexToRGBA(B50, 0.9),
50
+ color: token('color.text.mediumEmphasis', B400),
51
+ backgroundColor: token('color.background.subtleNeutral.hover', hexToRGBA(B50, 0.9)),
51
52
  boxShadow: ''
52
53
  },
53
54
  selected: {
54
- color: '',
55
- backgroundColor: '',
55
+ color: token('color.text.selected', ''),
56
+ backgroundColor: token('color.background.selected.resting', ''),
56
57
  boxShadow: ''
57
58
  }
58
59
  },
59
60
  navigation: {
60
- backgroundColor: N0,
61
- color: N200
61
+ backgroundColor: token('color.background.default', N0),
62
+ color: token('color.text.lowEmphasis', N200)
62
63
  },
63
64
  productHome: {
64
- backgroundColor: B400,
65
- color: N700,
66
- borderRight: `1px solid ${hexToRGBA(N200, 0.3)}`,
65
+ backgroundColor: token('color.text.brand', B400),
66
+ color: token('color.text.highEmphasis', N700),
67
+ borderRight: `1px solid ${token('color.border.neutral', hexToRGBA(N200, 0.3))}`,
68
+ // TODO: (DSP-1256) These colors should be moved into the Logo package
69
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
67
70
  iconGradientStart: B400,
71
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
68
72
  iconGradientStop: B200,
73
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
69
74
  iconColor: B200
70
75
  },
71
76
  primaryButton: {
72
77
  active: {
73
- color: B400,
74
- backgroundColor: hexToRGBA(B50, 0.7),
75
- boxShadow: '0 0 0 2px transparent'
78
+ color: token('color.text.mediumEmphasis', B400),
79
+ backgroundColor: token('color.background.subtleNeutral.pressed', hexToRGBA(B50, 0.7)),
80
+ boxShadow: ''
76
81
  },
77
82
  default: {
78
- color: N600,
83
+ color: token('color.text.mediumEmphasis', N600),
79
84
  backgroundColor: 'transparent',
80
- boxShadow: '0 0 0 2px transparent'
85
+ boxShadow: ''
81
86
  },
82
87
  focus: {
83
- color: N600,
88
+ color: token('color.text.mediumEmphasis', N600),
84
89
  backgroundColor: '',
85
- boxShadow: `0 0 0 2px ${B200}`
90
+ boxShadow: `0 0 0 2px ${token('color.border.focus', B200)}`
86
91
  },
87
92
  hover: {
88
- color: B400,
89
- backgroundColor: hexToRGBA(B50, 0.9),
90
- boxShadow: '0 0 0 2px transparent'
93
+ color: token('color.text.mediumEmphasis', B400),
94
+ backgroundColor: token('color.background.subtleNeutral.hover', hexToRGBA(B50, 0.9)),
95
+ boxShadow: ''
91
96
  },
92
97
  selected: {
93
- color: B400,
94
- backgroundColor: '',
98
+ color: token('color.text.mediumEmphasis', B400),
99
+ backgroundColor: token('color.background.selected.resting', ''),
95
100
  boxShadow: '',
96
- borderColor: B400,
97
- bordorBottom: `4px solid ${B400}`
101
+ borderColor: token('color.iconBorder.brand', B400),
102
+ bordorBottom: `4px solid ${token('color.iconBorder.brand', B400)}`
98
103
  }
99
104
  },
100
105
  search: {
101
106
  default: {
102
- backgroundColor: N0,
103
- color: N200,
104
- borderColor: N40
107
+ backgroundColor: token('color.background.default', N0),
108
+ color: token('color.text.lowEmphasis', N200),
109
+ borderColor: token('color.border.neutral', N40)
105
110
  },
106
111
  focus: {
107
- borderColor: B200
112
+ borderColor: token('color.border.focus', B200)
108
113
  },
109
114
  hover: {
110
- color: B400,
111
- backgroundColor: hexToRGBA(B50, 0.9)
115
+ color: token('color.text.brand', B400),
116
+ backgroundColor: token('color.background.default', hexToRGBA(B50, 0.9))
112
117
  }
113
118
  },
114
119
  skeleton: {
115
- backgroundColor: N20,
120
+ backgroundColor: token('color.background.subtleNeutral.resting', N20),
116
121
  opacity: 1
117
122
  }
118
123
  }
@@ -3,7 +3,9 @@ import { DEFAULT_THEME_NAME } from './defaultTheme';
3
3
  import { generateTheme } from './themeGenerator';
4
4
  export const atlassianTheme = generateTheme({
5
5
  name: DEFAULT_THEME_NAME,
6
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
6
7
  backgroundColor: N0,
8
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
7
9
  highlightColor: B400
8
10
  });
9
11
  export const defaultTheme = atlassianTheme;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/atlassian-navigation",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -6,12 +6,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
 
7
7
  import { N30A, N40A, N900 } from '@atlaskit/theme/colors';
8
8
  import { gridSize as gridSizeFn } from '@atlaskit/theme/constants';
9
+ import { token } from '@atlaskit/tokens';
9
10
  import { HORIZONTAL_GLOBAL_NAV_HEIGHT } from '../../common/constants';
10
11
  import { hexToRGBA } from '../../theme';
11
12
  var gridSize = gridSizeFn();
12
13
  export var containerCSS = function containerCSS(_ref) {
13
14
  var navigation = _ref.mode.navigation;
14
- return _objectSpread(_objectSpread({
15
+ return _objectSpread({
15
16
  alignItems: 'center',
16
17
  boxSizing: 'border-box',
17
18
  display: 'flex',
@@ -20,8 +21,28 @@ export var containerCSS = function containerCSS(_ref) {
20
21
  paddingLeft: gridSize * 1.5,
21
22
  paddingRight: gridSize * 1.5,
22
23
  height: HORIZONTAL_GLOBAL_NAV_HEIGHT,
23
- position: 'relative'
24
- }, bottomShadow), navigation);
24
+ position: 'relative',
25
+ '[data-theme="light"] &, [data-theme="dark"] &': {
26
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
27
+ borderBottom: "1px solid ".concat(token('color.border.neutral')),
28
+ // TODO: (DSP-2087) Remove the below once tokens have launched
29
+ '&::after': {
30
+ content: 'none'
31
+ }
32
+ },
33
+ // TODO: (DSP-2087) Remove the below once tokens have launched
34
+ '&::after': {
35
+ content: '""',
36
+ position: 'absolute',
37
+ left: 0,
38
+ right: 0,
39
+ top: '100%',
40
+ height: gridSize / 2,
41
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
42
+ background: "linear-gradient(180deg, ".concat(N40A, " 0, ").concat(N40A, " 1px, ").concat(N30A, " 1px, ").concat(hexToRGBA( // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
43
+ N900, 0), " 4px)")
44
+ }
45
+ }, navigation);
25
46
  };
26
47
  export var leftCSS = {
27
48
  alignItems: 'center',
@@ -41,15 +62,4 @@ export var rightCSS = {
41
62
  flexShrink: 0,
42
63
  marginRight: gridSize / 2
43
64
  }
44
- };
45
- export var bottomShadow = {
46
- '&::after': {
47
- content: '""',
48
- position: 'absolute',
49
- left: 0,
50
- right: 0,
51
- top: '100%',
52
- height: gridSize / 2,
53
- background: "linear-gradient(180deg, ".concat(N40A, " 0, ").concat(N40A, " 1px, ").concat(N30A, " 1px, ").concat(hexToRGBA(N900, 0), " 4px)")
54
- }
55
65
  };
@@ -31,13 +31,13 @@ export var getIconButtonTheme = function getIconButtonTheme(_ref) {
31
31
  }, iconButton.default), {}, {
32
32
  ':hover': iconButton.hover,
33
33
  ':focus': iconButton.focus,
34
- // :active doesn't work in FF, becasue we do a
34
+ // :active doesn't work in FF, because we do a
35
35
  // e.preventDefault() on mouse down in Button.
36
36
  // '&&' is required to add more CSS specificity
37
37
  // && it not a valid CSSObject property
38
38
  // @ts-ignore
39
39
  '&&': _objectSpread({}, props.state === 'active' && iconButton.active)
40
- }, props.state === 'selected' && iconButton.active), {}, {
40
+ }, props.state === 'selected' && iconButton.selected), {}, {
41
41
  '> span': {
42
42
  margin: 0
43
43
  }
@@ -22,14 +22,14 @@ export var getPrimaryButtonTheme = function getPrimaryButtonTheme(_ref) {
22
22
  spinnerStyles = _current.spinnerStyles;
23
23
 
24
24
  return {
25
- buttonStyles: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, buttonStyles), primaryButton.default), props.isSelected && primaryButton.active), {}, {
25
+ buttonStyles: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, buttonStyles), primaryButton.default), props.isSelected && primaryButton.selected), {}, {
26
26
  fontWeight: 500,
27
27
  padding: '0 4px',
28
28
  marginLeft: 0,
29
29
  marginRight: 0,
30
30
  ':hover': primaryButton.hover,
31
31
  ':focus': primaryButton.focus,
32
- // :active doesn't work in FF, becasue we do a
32
+ // :active doesn't work in FF, because we do a
33
33
  // e.preventDefault() on mouse down in Button.
34
34
  // '&&' is required to add more CSS specificity
35
35
  // && it not a valid CSSObject property
@@ -1,5 +1,4 @@
1
1
  import { gridSize } from '@atlaskit/theme/constants';
2
- import { hexToRGBA } from '../../theme';
3
2
  var margin = "0 ".concat(gridSize() / 2, "px");
4
3
  export var containerCSS = function containerCSS(_ref) {
5
4
  var navigation = _ref.mode.navigation;
@@ -22,7 +21,7 @@ export var containerCSS = function containerCSS(_ref) {
22
21
  right: 0,
23
22
  height: '100%',
24
23
  width: "".concat(gridSize() * 3, "px"),
25
- background: "linear-gradient(90deg, ".concat(hexToRGBA(navigation.backgroundColor, 0), " 0%, ").concat(hexToRGBA(navigation.backgroundColor, 0.7), " 50%, ").concat(hexToRGBA(navigation.backgroundColor, 1), " 100%)")
24
+ background: "linear-gradient(90deg, transparent 0%, ".concat(navigation.backgroundColor, " 100%)")
26
25
  }
27
26
  };
28
27
  };
@@ -1,27 +1,28 @@
1
1
  import { B200, B400, B50, N0, N20, N200, N40, N600, N700 } from '@atlaskit/theme/colors';
2
+ import { token } from '@atlaskit/tokens';
2
3
  import { hexToRGBA } from './themeHelpers';
3
4
  var defaultTheme = {
4
5
  mode: {
5
6
  create: {
6
7
  active: {
7
- color: N0,
8
- backgroundColor: hexToRGBA(B400, 0.8),
9
- boxShadow: '0 0 0 2px transparent'
8
+ color: token('color.text.onBold', N0),
9
+ backgroundColor: token('color.background.boldBrand.pressed', hexToRGBA(B400, 0.8)),
10
+ boxShadow: ''
10
11
  },
11
12
  default: {
12
- color: N0,
13
- backgroundColor: B400,
14
- boxShadow: '0 0 0 2px transparent'
13
+ color: token('color.text.onBold', N0),
14
+ backgroundColor: token('color.background.boldBrand.resting', B400),
15
+ boxShadow: ''
15
16
  },
16
17
  focus: {
17
- color: N0,
18
- backgroundColor: B400,
19
- boxShadow: '0 0 0 2px rgb(128,169,230)'
18
+ color: token('color.text.onBold', N0),
19
+ backgroundColor: token('color.background.boldBrand.resting', B400),
20
+ boxShadow: "0 0 0 2px ".concat(token('color.border.focus', 'rgb(128,169,230)'))
20
21
  },
21
22
  hover: {
22
- color: N0,
23
- backgroundColor: hexToRGBA(B400, 0.9),
24
- boxShadow: '0 0 0 2px transparent'
23
+ color: token('color.text.onBold', N0),
24
+ backgroundColor: token('color.background.boldBrand.hover', hexToRGBA(B400, 0.9)),
25
+ boxShadow: ''
25
26
  },
26
27
  selected: {
27
28
  color: '',
@@ -31,88 +32,92 @@ var defaultTheme = {
31
32
  },
32
33
  iconButton: {
33
34
  active: {
34
- color: B400,
35
- backgroundColor: hexToRGBA(B50, 0.6),
35
+ color: token('color.text.mediumEmphasis', B400),
36
+ backgroundColor: token('color.background.subtleNeutral.pressed', hexToRGBA(B50, 0.6)),
36
37
  boxShadow: ''
37
38
  },
38
39
  default: {
39
- color: N600,
40
+ color: token('color.text.mediumEmphasis', N600),
40
41
  backgroundColor: 'transparent',
41
42
  boxShadow: ''
42
43
  },
43
44
  focus: {
44
- color: N600,
45
- backgroundColor: hexToRGBA(B50, 0.5),
46
- boxShadow: "0 0 0 2px ".concat(B200)
45
+ color: token('color.text.mediumEmphasis', N600),
46
+ backgroundColor: token('color.background.subtleBrand.hover', hexToRGBA(B50, 0.5)),
47
+ boxShadow: "0 0 0 2px ".concat(token('color.border.focus', B200))
47
48
  },
48
49
  hover: {
49
- color: B400,
50
- backgroundColor: hexToRGBA(B50, 0.9),
50
+ color: token('color.text.mediumEmphasis', B400),
51
+ backgroundColor: token('color.background.subtleNeutral.hover', hexToRGBA(B50, 0.9)),
51
52
  boxShadow: ''
52
53
  },
53
54
  selected: {
54
- color: '',
55
- backgroundColor: '',
55
+ color: token('color.text.selected', ''),
56
+ backgroundColor: token('color.background.selected.resting', ''),
56
57
  boxShadow: ''
57
58
  }
58
59
  },
59
60
  navigation: {
60
- backgroundColor: N0,
61
- color: N200
61
+ backgroundColor: token('color.background.default', N0),
62
+ color: token('color.text.lowEmphasis', N200)
62
63
  },
63
64
  productHome: {
64
- backgroundColor: B400,
65
- color: N700,
66
- borderRight: "1px solid ".concat(hexToRGBA(N200, 0.3)),
65
+ backgroundColor: token('color.text.brand', B400),
66
+ color: token('color.text.highEmphasis', N700),
67
+ borderRight: "1px solid ".concat(token('color.border.neutral', hexToRGBA(N200, 0.3))),
68
+ // TODO: (DSP-1256) These colors should be moved into the Logo package
69
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
67
70
  iconGradientStart: B400,
71
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
68
72
  iconGradientStop: B200,
73
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
69
74
  iconColor: B200
70
75
  },
71
76
  primaryButton: {
72
77
  active: {
73
- color: B400,
74
- backgroundColor: hexToRGBA(B50, 0.7),
75
- boxShadow: '0 0 0 2px transparent'
78
+ color: token('color.text.mediumEmphasis', B400),
79
+ backgroundColor: token('color.background.subtleNeutral.pressed', hexToRGBA(B50, 0.7)),
80
+ boxShadow: ''
76
81
  },
77
82
  default: {
78
- color: N600,
83
+ color: token('color.text.mediumEmphasis', N600),
79
84
  backgroundColor: 'transparent',
80
- boxShadow: '0 0 0 2px transparent'
85
+ boxShadow: ''
81
86
  },
82
87
  focus: {
83
- color: N600,
88
+ color: token('color.text.mediumEmphasis', N600),
84
89
  backgroundColor: '',
85
- boxShadow: "0 0 0 2px ".concat(B200)
90
+ boxShadow: "0 0 0 2px ".concat(token('color.border.focus', B200))
86
91
  },
87
92
  hover: {
88
- color: B400,
89
- backgroundColor: hexToRGBA(B50, 0.9),
90
- boxShadow: '0 0 0 2px transparent'
93
+ color: token('color.text.mediumEmphasis', B400),
94
+ backgroundColor: token('color.background.subtleNeutral.hover', hexToRGBA(B50, 0.9)),
95
+ boxShadow: ''
91
96
  },
92
97
  selected: {
93
- color: B400,
94
- backgroundColor: '',
98
+ color: token('color.text.mediumEmphasis', B400),
99
+ backgroundColor: token('color.background.selected.resting', ''),
95
100
  boxShadow: '',
96
- borderColor: B400,
97
- bordorBottom: "4px solid ".concat(B400)
101
+ borderColor: token('color.iconBorder.brand', B400),
102
+ bordorBottom: "4px solid ".concat(token('color.iconBorder.brand', B400))
98
103
  }
99
104
  },
100
105
  search: {
101
106
  default: {
102
- backgroundColor: N0,
103
- color: N200,
104
- borderColor: N40
107
+ backgroundColor: token('color.background.default', N0),
108
+ color: token('color.text.lowEmphasis', N200),
109
+ borderColor: token('color.border.neutral', N40)
105
110
  },
106
111
  focus: {
107
- borderColor: B200
112
+ borderColor: token('color.border.focus', B200)
108
113
  },
109
114
  hover: {
110
- color: B400,
111
- backgroundColor: hexToRGBA(B50, 0.9)
115
+ color: token('color.text.brand', B400),
116
+ backgroundColor: token('color.background.default', hexToRGBA(B50, 0.9))
112
117
  }
113
118
  },
114
119
  skeleton: {
115
- backgroundColor: N20,
120
+ backgroundColor: token('color.background.subtleNeutral.resting', N20),
116
121
  opacity: 1
117
122
  }
118
123
  }
@@ -3,7 +3,9 @@ import { DEFAULT_THEME_NAME } from './defaultTheme';
3
3
  import { generateTheme } from './themeGenerator';
4
4
  export var atlassianTheme = generateTheme({
5
5
  name: DEFAULT_THEME_NAME,
6
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
6
7
  backgroundColor: N0,
8
+ // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
7
9
  highlightColor: B400
8
10
  });
9
11
  export var defaultTheme = atlassianTheme;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/atlassian-navigation",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -20,14 +20,3 @@ export declare const rightCSS: {
20
20
  marginRight: number;
21
21
  };
22
22
  };
23
- export declare const bottomShadow: {
24
- '&::after': {
25
- content: string;
26
- position: string;
27
- left: number;
28
- right: number;
29
- top: string;
30
- height: number;
31
- background: string;
32
- };
33
- };
@@ -58,6 +58,23 @@ export interface BaseIconButtonProps {
58
58
  * If defining `href` you may want to define `target` as well.
59
59
  */
60
60
  target?: string;
61
+ /**
62
+ * Allows for overriding the component used to render the button.
63
+ *
64
+ * This is primarily intended for compatibility with custom
65
+ * routing libraries when using the `href` prop.
66
+ *
67
+ * For further usage information, refer to the [documentation for button](https://atlassian.design/components/button/code).
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * <Settings
72
+ * component={CustomRouterLink}
73
+ * href="/path/to/url"
74
+ * />
75
+ * ```
76
+ */
77
+ component?: CustomThemeButtonProps['component'];
61
78
  /**
62
79
  * Handler for the mouse up event.
63
80
  */
@@ -66,6 +83,10 @@ export interface BaseIconButtonProps {
66
83
  * Handler called when the button gains focus.
67
84
  */
68
85
  onFocus?: React.FocusEventHandler<HTMLElement>;
86
+ /**
87
+ * Handler called when the button loses focus.
88
+ */
89
+ onBlur?: React.FocusEventHandler<HTMLElement>;
69
90
  /**
70
91
  * Makes the element appear selected.
71
92
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/atlassian-navigation",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "description": "A horizontal navigation component for Atlassian products.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,6 +29,7 @@
29
29
  "@atlaskit/logo": "*",
30
30
  "@atlaskit/popup": "^1.1.0",
31
31
  "@atlaskit/theme": "^12.0.0",
32
+ "@atlaskit/tokens": "^0.3.0",
32
33
  "@atlaskit/tooltip": "^17.5.0",
33
34
  "@atlaskit/width-detector": "^3.0.0",
34
35
  "@babel/runtime": "^7.0.0",
@@ -65,18 +66,10 @@
65
66
  "import-structure": "atlassian-conventions"
66
67
  },
67
68
  "@repo/internal": {
68
- "ui-components": [
69
- "lite-mode"
70
- ],
71
- "analytics": [
72
- "analytics-next"
73
- ],
74
- "theming": [
75
- "new-theming-api"
76
- ],
77
- "deprecation": [
78
- "no-deprecated-imports"
79
- ]
69
+ "ui-components": "lite-mode",
70
+ "analytics": "analytics-next",
71
+ "theming": "tokens",
72
+ "deprecation": "no-deprecated-imports"
80
73
  }
81
74
  },
82
75
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"