@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.
Files changed (128) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/common/constants.js +10 -1
  3. package/dist/cjs/components/AtlassianNavigation/index.js +61 -5
  4. package/dist/cjs/components/AtlassianNavigation/skeleton.js +67 -10
  5. package/dist/cjs/components/BadgeContainer/index.js +12 -4
  6. package/dist/cjs/components/Create/index.js +24 -12
  7. package/dist/cjs/components/Create/skeleton.js +21 -6
  8. package/dist/cjs/components/Create/styles.js +1 -25
  9. package/dist/cjs/components/IconButton/skeleton.js +31 -5
  10. package/dist/cjs/components/IconButton/styles.js +2 -32
  11. package/dist/cjs/components/PrimaryButton/index.js +35 -1
  12. package/dist/cjs/components/PrimaryButton/skeleton.js +15 -5
  13. package/dist/cjs/components/PrimaryButton/styles.js +2 -58
  14. package/dist/cjs/components/PrimaryDropdownButton/index.js +6 -3
  15. package/dist/cjs/components/PrimaryItemsContainer/index.js +26 -4
  16. package/dist/cjs/components/PrimaryItemsContainer/skeleton.js +8 -3
  17. package/dist/cjs/components/ProductHome/custom-product-home.js +104 -6
  18. package/dist/cjs/components/ProductHome/product-home.js +104 -6
  19. package/dist/cjs/components/ProductHome/skeleton.js +117 -6
  20. package/dist/cjs/components/Search/index.js +50 -6
  21. package/dist/cjs/components/Search/skeleton.js +29 -7
  22. package/dist/cjs/components/SkeletonCreateButton/index.js +23 -5
  23. package/dist/cjs/components/SkeletonIconButton/index.js +30 -5
  24. package/dist/cjs/components/SkeletonPrimaryButton/index.js +79 -3
  25. package/dist/cjs/theme/defaultTheme.js +39 -40
  26. package/dist/cjs/version.json +1 -1
  27. package/dist/es2019/common/constants.js +4 -0
  28. package/dist/es2019/components/AtlassianNavigation/index.js +61 -6
  29. package/dist/es2019/components/AtlassianNavigation/skeleton.js +67 -11
  30. package/dist/es2019/components/BadgeContainer/index.js +12 -4
  31. package/dist/es2019/components/Create/index.js +29 -13
  32. package/dist/es2019/components/Create/skeleton.js +20 -6
  33. package/dist/es2019/components/Create/styles.js +0 -15
  34. package/dist/es2019/components/IconButton/skeleton.js +23 -5
  35. package/dist/es2019/components/IconButton/styles.js +1 -23
  36. package/dist/es2019/components/PrimaryButton/index.js +35 -3
  37. package/dist/es2019/components/PrimaryButton/skeleton.js +14 -5
  38. package/dist/es2019/components/PrimaryButton/styles.js +1 -46
  39. package/dist/es2019/components/PrimaryDropdownButton/index.js +7 -3
  40. package/dist/es2019/components/PrimaryItemsContainer/index.js +25 -4
  41. package/dist/es2019/components/PrimaryItemsContainer/skeleton.js +7 -3
  42. package/dist/es2019/components/ProductHome/custom-product-home.js +119 -6
  43. package/dist/es2019/components/ProductHome/product-home.js +119 -6
  44. package/dist/es2019/components/ProductHome/skeleton.js +129 -6
  45. package/dist/es2019/components/Search/index.js +47 -6
  46. package/dist/es2019/components/Search/skeleton.js +30 -7
  47. package/dist/es2019/components/SkeletonCreateButton/index.js +23 -3
  48. package/dist/es2019/components/SkeletonIconButton/index.js +30 -3
  49. package/dist/es2019/components/SkeletonPrimaryButton/index.js +74 -3
  50. package/dist/es2019/theme/defaultTheme.js +39 -40
  51. package/dist/es2019/version.json +1 -1
  52. package/dist/esm/common/constants.js +4 -0
  53. package/dist/esm/components/AtlassianNavigation/index.js +61 -6
  54. package/dist/esm/components/AtlassianNavigation/skeleton.js +67 -11
  55. package/dist/esm/components/BadgeContainer/index.js +12 -4
  56. package/dist/esm/components/Create/index.js +25 -13
  57. package/dist/esm/components/Create/skeleton.js +19 -6
  58. package/dist/esm/components/Create/styles.js +0 -15
  59. package/dist/esm/components/IconButton/skeleton.js +29 -5
  60. package/dist/esm/components/IconButton/styles.js +0 -22
  61. package/dist/esm/components/PrimaryButton/index.js +35 -3
  62. package/dist/esm/components/PrimaryButton/skeleton.js +14 -5
  63. package/dist/esm/components/PrimaryButton/styles.js +0 -44
  64. package/dist/esm/components/PrimaryDropdownButton/index.js +7 -3
  65. package/dist/esm/components/PrimaryItemsContainer/index.js +25 -4
  66. package/dist/esm/components/PrimaryItemsContainer/skeleton.js +7 -3
  67. package/dist/esm/components/ProductHome/custom-product-home.js +102 -6
  68. package/dist/esm/components/ProductHome/product-home.js +102 -6
  69. package/dist/esm/components/ProductHome/skeleton.js +117 -6
  70. package/dist/esm/components/Search/index.js +48 -6
  71. package/dist/esm/components/Search/skeleton.js +27 -7
  72. package/dist/esm/components/SkeletonCreateButton/index.js +23 -3
  73. package/dist/esm/components/SkeletonIconButton/index.js +30 -3
  74. package/dist/esm/components/SkeletonPrimaryButton/index.js +80 -3
  75. package/dist/esm/theme/defaultTheme.js +39 -40
  76. package/dist/esm/version.json +1 -1
  77. package/dist/types/common/constants.d.ts +3 -0
  78. package/dist/types/common/styles.d.ts +143 -143
  79. package/dist/types/components/AtlassianNavigation/skeleton.d.ts +1 -1
  80. package/dist/types/components/AtlassianNavigation/types.d.ts +1 -0
  81. package/dist/types/components/Create/index.d.ts +1 -1
  82. package/dist/types/components/Create/styles.d.ts +0 -923
  83. package/dist/types/components/Create/types.d.ts +5 -1
  84. package/dist/types/components/IconButton/skeleton.d.ts +1 -1
  85. package/dist/types/components/IconButton/styles.d.ts +0 -915
  86. package/dist/types/components/PrimaryButton/index.d.ts +1 -1
  87. package/dist/types/components/PrimaryButton/skeleton.d.ts +1 -0
  88. package/dist/types/components/PrimaryButton/styles.d.ts +0 -917
  89. package/dist/types/components/PrimaryDropdownButton/index.d.ts +1 -1
  90. package/docs/05-create.tsx +8 -0
  91. package/docs/99-migrating-from-navigation-next.tsx +31 -32
  92. package/package.json +9 -5
  93. package/dist/cjs/components/AtlassianNavigation/styles.js +0 -82
  94. package/dist/cjs/components/BadgeContainer/styles.js +0 -17
  95. package/dist/cjs/components/PrimaryDropdownButton/styles.js +0 -13
  96. package/dist/cjs/components/PrimaryItemsContainer/styles.js +0 -42
  97. package/dist/cjs/components/ProductHome/styles.js +0 -152
  98. package/dist/cjs/components/Search/styles.js +0 -70
  99. package/dist/cjs/components/SkeletonCreateButton/styles.js +0 -39
  100. package/dist/cjs/components/SkeletonIconButton/styles.js +0 -46
  101. package/dist/cjs/components/SkeletonPrimaryButton/styles.js +0 -74
  102. package/dist/es2019/components/AtlassianNavigation/styles.js +0 -60
  103. package/dist/es2019/components/BadgeContainer/styles.js +0 -9
  104. package/dist/es2019/components/PrimaryDropdownButton/styles.js +0 -6
  105. package/dist/es2019/components/PrimaryItemsContainer/styles.js +0 -30
  106. package/dist/es2019/components/ProductHome/styles.js +0 -117
  107. package/dist/es2019/components/Search/styles.js +0 -43
  108. package/dist/es2019/components/SkeletonCreateButton/styles.js +0 -25
  109. package/dist/es2019/components/SkeletonIconButton/styles.js +0 -32
  110. package/dist/es2019/components/SkeletonPrimaryButton/styles.js +0 -60
  111. package/dist/esm/components/AtlassianNavigation/styles.js +0 -64
  112. package/dist/esm/components/BadgeContainer/styles.js +0 -9
  113. package/dist/esm/components/PrimaryDropdownButton/styles.js +0 -6
  114. package/dist/esm/components/PrimaryItemsContainer/styles.js +0 -29
  115. package/dist/esm/components/ProductHome/styles.js +0 -114
  116. package/dist/esm/components/Search/styles.js +0 -47
  117. package/dist/esm/components/SkeletonCreateButton/styles.js +0 -28
  118. package/dist/esm/components/SkeletonIconButton/styles.js +0 -35
  119. package/dist/esm/components/SkeletonPrimaryButton/styles.js +0 -63
  120. package/dist/types/components/AtlassianNavigation/styles.d.ts +0 -22
  121. package/dist/types/components/BadgeContainer/styles.d.ts +0 -9
  122. package/dist/types/components/PrimaryDropdownButton/styles.d.ts +0 -5
  123. package/dist/types/components/PrimaryItemsContainer/styles.d.ts +0 -9
  124. package/dist/types/components/ProductHome/styles.d.ts +0 -2791
  125. package/dist/types/components/Search/styles.d.ts +0 -1842
  126. package/dist/types/components/SkeletonCreateButton/styles.d.ts +0 -4
  127. package/dist/types/components/SkeletonIconButton/styles.d.ts +0 -4
  128. package/dist/types/components/SkeletonPrimaryButton/styles.d.ts +0 -4
@@ -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
- css: productHomeButtonCSS(theme),
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
- css: customProductLogoCSS(logoMaxWidth),
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
- css: customProductIconCSS,
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
- css: siteTitleCSS(theme),
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
  };
@@ -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 { productHomeButtonCSS, productIconCSS, productLogoCSS, 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 productHomeButtonStyles = css({
20
+ display: 'flex',
21
+ padding: gridSize / 2,
22
+ alignItems: 'center',
23
+ background: 'none',
24
+ border: 0,
25
+ borderRadius: 3,
26
+ color: 'inherit',
27
+ cursor: 'pointer',
28
+ '&::-moz-focus-inner': {
29
+ border: 0
30
+ },
31
+ '&:first-of-type': {
32
+ marginLeft: 0
33
+ },
34
+ '&:hover': {
35
+ backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER})`,
36
+ boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_HOVER})`,
37
+ color: `var(${VAR_PRODUCT_HOME_COLOR_HOVER})`
38
+ },
39
+ '&:active': {
40
+ backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE})`,
41
+ boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE})`,
42
+ color: `var(${VAR_PRODUCT_HOME_COLOR_ACTIVE})`
43
+ },
44
+ '&:focus': {
45
+ backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS})`,
46
+ boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS})`,
47
+ color: `var(${VAR_PRODUCT_HOME_COLOR_FOCUS})`,
48
+ outline: 0
49
+ },
50
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
51
+ 'div&': {
52
+ pointerEvents: 'none'
53
+ },
54
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
55
+ [`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
56
+ margin: `0 ${gridSize}px`
57
+ },
58
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
59
+ [`@media (min-width: ${PRODUCT_HOME_BREAKPOINT}px)`]: {
60
+ margin: `0 ${gridSize * 2}px`
61
+ }
62
+ });
63
+ const productLogoStyles = css({
64
+ // Ensure anything passed into
65
+ // productHome is aligned correctly
66
+ display: 'flex',
67
+ maxWidth: `var(${VAR_LOGO_MAX_WIDTH})`,
68
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
69
+ '& > *': {
70
+ maxHeight: 24
71
+ },
72
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
73
+ [`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
74
+ display: 'none'
75
+ }
76
+ });
77
+ const customMaxHeightStyles = css({
78
+ maxHeight: 28
79
+ });
80
+ const productIconStyles = css({
81
+ // Ensure anything passed into
82
+ // productHome is aligned correctly
83
+ display: 'flex',
84
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
85
+ '& > *': {
86
+ maxHeight: 24
87
+ },
88
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
89
+ [`@media (min-width: ${PRODUCT_HOME_BREAKPOINT}px)`]: {
90
+ display: 'none'
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 ProductHome = ({
11
102
  icon: Icon,
@@ -19,6 +110,7 @@ const ProductHome = ({
19
110
  ...rest
20
111
  }) => {
21
112
  const theme = useTheme();
113
+ const primaryButton = theme.mode.primaryButton;
22
114
  const {
23
115
  iconColor = 'inherit',
24
116
  iconGradientStart = 'inherit',
@@ -32,14 +124,29 @@ const ProductHome = ({
32
124
  onMouseDown && onMouseDown(e);
33
125
  };
34
126
 
127
+ const productHomeButtonDynamicStyles = {
128
+ [VAR_PRODUCT_HOME_COLOR_ACTIVE]: primaryButton.active.color,
129
+ [VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE]: primaryButton.active.backgroundColor,
130
+ [VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE]: primaryButton.active.boxShadow,
131
+ [VAR_PRODUCT_HOME_COLOR_FOCUS]: primaryButton.focus.color,
132
+ [VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS]: primaryButton.focus.backgroundColor,
133
+ [VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS]: primaryButton.focus.boxShadow,
134
+ [VAR_PRODUCT_HOME_COLOR_HOVER]: primaryButton.hover.color,
135
+ [VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER]: primaryButton.hover.backgroundColor,
136
+ [VAR_PRODUCT_HOME_BOX_SHADOW_HOVER]: primaryButton.hover.boxShadow
137
+ };
35
138
  return jsx(Fragment, null, jsx(Tag, _extends({
36
- css: productHomeButtonCSS(theme),
139
+ style: productHomeButtonDynamicStyles,
140
+ css: productHomeButtonStyles,
37
141
  href: href,
38
142
  onClick: onClick,
39
143
  onMouseDown: preventFocusRing,
40
144
  "data-testid": testId && `${testId}-container`
41
145
  }, rest), jsx("div", {
42
- css: productLogoCSS(logoMaxWidth),
146
+ style: {
147
+ [VAR_LOGO_MAX_WIDTH]: logoMaxWidth
148
+ },
149
+ css: [customMaxHeightStyles, productLogoStyles],
43
150
  "data-testid": testId && `${testId}-logo`
44
151
  }, jsx(Logo, {
45
152
  iconGradientStart: iconGradientStart,
@@ -47,14 +154,20 @@ const ProductHome = ({
47
154
  iconColor: iconColor,
48
155
  textColor: textColor
49
156
  })), jsx("div", {
50
- css: productIconCSS,
157
+ style: {
158
+ [VAR_LOGO_MAX_WIDTH]: logoMaxWidth
159
+ },
160
+ css: [customMaxHeightStyles, productIconStyles],
51
161
  "data-testid": testId && `${testId}-icon`
52
162
  }, jsx(Icon, {
53
163
  iconGradientStart: iconGradientStart,
54
164
  iconGradientStop: iconGradientStop,
55
165
  iconColor: iconColor
56
166
  }))), siteTitle && jsx("div", {
57
- css: siteTitleCSS(theme),
167
+ style: {
168
+ borderRight: theme.mode.productHome.borderRight
169
+ },
170
+ css: siteTitleStyles,
58
171
  "data-testid": testId && `${testId}-site-title`
59
172
  }, siteTitle));
60
173
  };
@@ -1,19 +1,142 @@
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, PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
4
5
  import { useTheme } from '../../theme';
5
- import { productHomeButtonSkeletonCSS, productIconSkeletonCSS, productLogoSkeletonCSS, siteTitleSkeletonCSS } from './styles';
6
+ const VAR_PRODUCT_HOME_COLOR_ACTIVE = '--product-home-color-active';
7
+ const VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE = '--product-home-bg-color-active';
8
+ const VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE = '--product-home-box-shadow-active';
9
+ const VAR_PRODUCT_HOME_COLOR_FOCUS = '--product-home-color-focus';
10
+ const VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS = '--product-home-bg-color-focus';
11
+ const VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS = '--product-home-box-shadow-focus';
12
+ const VAR_PRODUCT_HOME_COLOR_HOVER = '--product-home-color-hover';
13
+ const VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER = '--product-home-bg-color-hover';
14
+ const VAR_PRODUCT_HOME_BOX_SHADOW_HOVER = '--product-home-box-shadow-hover';
15
+ const VAR_SITE_TITLE_BG_COLOR_AFTER = '--site-title-bg-color-after';
16
+ const productHomeButtonStyles = css({
17
+ display: 'flex',
18
+ padding: gridSize / 2,
19
+ alignItems: 'center',
20
+ background: 'none',
21
+ border: 0,
22
+ borderRadius: 3,
23
+ color: 'inherit',
24
+ cursor: 'pointer',
25
+ '&::-moz-focus-inner': {
26
+ border: 0
27
+ },
28
+ '&:first-of-type': {
29
+ marginLeft: 0
30
+ },
31
+ '&:active': {
32
+ backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE})`,
33
+ boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE})`,
34
+ color: `var(${VAR_PRODUCT_HOME_COLOR_ACTIVE})`
35
+ },
36
+ '&:focus': {
37
+ backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS})`,
38
+ boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS})`,
39
+ color: `var(${VAR_PRODUCT_HOME_COLOR_FOCUS})`,
40
+ outline: 0
41
+ },
42
+ '&:hover': {
43
+ backgroundColor: `var(${VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER})`,
44
+ boxShadow: `var(${VAR_PRODUCT_HOME_BOX_SHADOW_HOVER})`,
45
+ color: `var(${VAR_PRODUCT_HOME_COLOR_HOVER})`
46
+ },
47
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
48
+ 'div&': {
49
+ pointerEvents: 'none'
50
+ },
51
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
52
+ [`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
53
+ margin: `0 ${gridSize}px`
54
+ },
55
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
56
+ [`@media (min-width: ${PRODUCT_HOME_BREAKPOINT}px)`]: {
57
+ margin: `0 ${gridSize * 2}px`
58
+ }
59
+ });
60
+ const productLogoStyles = css({
61
+ display: 'flex',
62
+ width: 120,
63
+ maxWidth: 120,
64
+ height: 24,
65
+ maxHeight: 28,
66
+ opacity: 0.15,
67
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
68
+ '& > *': {
69
+ maxHeight: 24
70
+ },
71
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
72
+ [`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
73
+ display: 'none'
74
+ }
75
+ });
76
+ const productIconStyles = css({
77
+ display: 'flex',
78
+ width: 28,
79
+ height: 28,
80
+ borderRadius: '50%',
81
+ opacity: 0.15,
82
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
83
+ '& > *': {
84
+ maxHeight: 24
85
+ },
86
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
87
+ [`@media (min-width: ${PRODUCT_HOME_BREAKPOINT}px)`]: {
88
+ display: 'none'
89
+ }
90
+ });
91
+ const siteTitleStyles = css({
92
+ display: 'flex',
93
+ width: gridSize * 5,
94
+ marginRight: gridSize / 2,
95
+ marginLeft: gridSize * 0.5,
96
+ paddingRight: gridSize * 2,
97
+ alignItems: 'center',
98
+ backgroundColor: 'transparent',
99
+ '&:after': {
100
+ width: '100%',
101
+ height: 14,
102
+ backgroundColor: `var(${VAR_SITE_TITLE_BG_COLOR_AFTER})`,
103
+ borderRadius: 4,
104
+ content: '""'
105
+ }
106
+ });
6
107
  export const ProductHomeSkeleton = ({
7
108
  showSiteName
8
109
  }) => {
9
110
  const theme = useTheme();
111
+ const primaryButton = theme.mode.primaryButton;
112
+ const productHomeButtonDynamicStyles = {
113
+ [VAR_PRODUCT_HOME_COLOR_ACTIVE]: primaryButton.active.color,
114
+ [VAR_PRODUCT_HOME_BACKGROUND_COLOR_ACTIVE]: primaryButton.active.backgroundColor,
115
+ [VAR_PRODUCT_HOME_BOX_SHADOW_ACTIVE]: primaryButton.active.boxShadow,
116
+ [VAR_PRODUCT_HOME_COLOR_FOCUS]: primaryButton.focus.color,
117
+ [VAR_PRODUCT_HOME_BACKGROUND_COLOR_FOCUS]: primaryButton.focus.backgroundColor,
118
+ [VAR_PRODUCT_HOME_BOX_SHADOW_FOCUS]: primaryButton.focus.boxShadow,
119
+ [VAR_PRODUCT_HOME_COLOR_HOVER]: primaryButton.hover.color,
120
+ [VAR_PRODUCT_HOME_BACKGROUND_COLOR_HOVER]: primaryButton.hover.backgroundColor,
121
+ [VAR_PRODUCT_HOME_BOX_SHADOW_HOVER]: primaryButton.hover.boxShadow,
122
+ [VAR_SITE_TITLE_BG_COLOR_AFTER]: theme.mode.skeleton.backgroundColor
123
+ };
124
+ const siteTitleDynamicStyles = {
125
+ borderRight: theme.mode.productHome.borderRight,
126
+ opacity: theme.mode.skeleton.opacity,
127
+ [VAR_SITE_TITLE_BG_COLOR_AFTER]: theme.mode.skeleton.backgroundColor
128
+ };
10
129
  return jsx(Fragment, null, jsx("div", {
11
- css: productHomeButtonSkeletonCSS(theme)
130
+ style: productHomeButtonDynamicStyles,
131
+ css: productHomeButtonStyles
12
132
  }, jsx("div", {
13
- css: productLogoSkeletonCSS(theme)
133
+ style: theme.mode.skeleton,
134
+ css: productLogoStyles
14
135
  }), jsx("div", {
15
- css: productIconSkeletonCSS(theme)
136
+ style: theme.mode.skeleton,
137
+ css: productIconStyles
16
138
  })), showSiteName && jsx("div", {
17
- css: siteTitleSkeletonCSS(theme)
139
+ style: siteTitleDynamicStyles,
140
+ css: siteTitleStyles
18
141
  }));
19
142
  };
@@ -2,11 +2,47 @@ 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
6
  import SearchIcon from '@atlaskit/icon/glyph/search';
7
+ import { CREATE_BREAKPOINT, fontSize, gridSize } from '../../common/constants';
7
8
  import { useTheme } from '../../theme';
8
9
  import { IconButton } from '../IconButton';
9
- import { searchIconCSS, searchInputContainerCSS, searchInputCSS, searchInputIconCSS } from './styles';
10
+ const searchInputContainerStyles = css({
11
+ marginRight: gridSize,
12
+ marginLeft: 20,
13
+ position: 'relative',
14
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
15
+ [`@media (max-width: ${CREATE_BREAKPOINT - 1}px)`]: {
16
+ display: 'none !important'
17
+ }
18
+ });
19
+ const searchInputIconStyles = css({
20
+ width: '20px',
21
+ height: '20px',
22
+ position: 'absolute',
23
+ top: '5px',
24
+ left: '10px',
25
+ pointerEvents: 'none'
26
+ });
27
+ const searchInputStyles = css({
28
+ boxSizing: 'border-box',
29
+ width: '220px',
30
+ height: `${gridSize * 4}px`,
31
+ padding: `0 ${gridSize}px 0 40px`,
32
+ border: '2px solid',
33
+ borderRadius: 6,
34
+ fontSize: `${fontSize}px`,
35
+ outline: 'none',
36
+ '::placeholder': {
37
+ color: 'inherit'
38
+ }
39
+ });
40
+ const searchIconStyles = css({
41
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
42
+ [`@media (min-width: ${CREATE_BREAKPOINT}px)`]: {
43
+ display: 'none !important'
44
+ }
45
+ });
10
46
 
11
47
  const SearchComponent = props => {
12
48
  const {
@@ -16,6 +52,7 @@ const SearchComponent = props => {
16
52
  value
17
53
  } = props;
18
54
  const theme = useTheme();
55
+ const search = theme.mode.search;
19
56
 
20
57
  const onChange = (...args) => {
21
58
  // @ts-ignore
@@ -27,15 +64,19 @@ const SearchComponent = props => {
27
64
  onClick && onClick(...args);
28
65
  };
29
66
 
67
+ const searchInputDynamicStyles = { ...search.default,
68
+ ':focus': search.focus
69
+ };
30
70
  return jsx("div", {
31
- css: searchInputContainerCSS,
71
+ css: searchInputContainerStyles,
32
72
  role: "search"
33
73
  }, jsx("div", {
34
- css: searchInputIconCSS
74
+ css: searchInputIconStyles
35
75
  }, jsx(SearchIcon, {
36
76
  label: ""
37
77
  })), jsx("input", {
38
- css: searchInputCSS(theme),
78
+ style: searchInputDynamicStyles,
79
+ css: searchInputStyles,
39
80
  "aria-label": label,
40
81
  placeholder: placeholder,
41
82
  onChange: onChange,
@@ -58,7 +99,7 @@ export const Search = props => {
58
99
  label: label,
59
100
  value: value || ''
60
101
  }), jsx(IconButton, _extends({
61
- css: searchIconCSS,
102
+ css: searchIconStyles,
62
103
  icon: jsx(SearchIcon, {
63
104
  label: label
64
105
  }),
@@ -1,19 +1,42 @@
1
1
  /** @jsx jsx */
2
2
  import { Fragment } from 'react';
3
- import { jsx } from '@emotion/core';
4
- import { gridSize } from '@atlaskit/theme/constants';
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
- import { searchIconSkeletonCSS, searchInputContainerCSS, searchInputSkeletonCSS } from './styles';
7
+ const searchInputContainerStyles = css({
8
+ marginRight: gridSize,
9
+ marginLeft: 20,
10
+ position: 'relative',
11
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
12
+ [`@media (max-width: ${CREATE_BREAKPOINT - 1}px)`]: {
13
+ display: 'none !important'
14
+ }
15
+ });
16
+ const searchInputSkeletonStyles = css({
17
+ boxSizing: 'border-box',
18
+ width: '220px',
19
+ height: `${gridSize * 4}px`,
20
+ padding: `0 ${gridSize}px 0 40px`,
21
+ borderRadius: 6,
22
+ opacity: 0.15
23
+ });
24
+ const searchIconStyles = css({
25
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
26
+ [`@media (min-width: ${CREATE_BREAKPOINT}px)`]: {
27
+ display: 'none !important'
28
+ }
29
+ });
8
30
  export const SearchSkeleton = () => {
9
31
  const theme = useTheme();
10
32
  return jsx(Fragment, null, jsx("div", {
11
- css: searchInputContainerCSS
33
+ css: searchInputContainerStyles
12
34
  }, jsx("div", {
13
- css: searchInputSkeletonCSS(theme)
35
+ style: theme.mode.skeleton,
36
+ css: searchInputSkeletonStyles
14
37
  })), jsx(IconButtonSkeleton, {
15
- css: searchIconSkeletonCSS,
38
+ css: searchIconStyles,
16
39
  marginRight: 5,
17
- size: gridSize() * 3.25
40
+ size: gridSize * 3.25
18
41
  }));
19
42
  };
@@ -1,14 +1,34 @@
1
1
  /** @jsx jsx */
2
- import { jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/core';
3
3
  import { useTheme } from '../../theme';
4
- import skeletonCreateButtonCSS from './styles';
4
+ const skeletonCreateButtonStyles = css({
5
+ height: 32,
6
+ padding: '0 12px',
7
+ alignSelf: 'center',
8
+ border: 0,
9
+ borderRadius: 3,
10
+ fontSize: 14,
11
+ fontWeight: 500,
12
+ lineHeight: 1,
13
+ pointerEvents: 'none',
14
+ ':focus, :active, :hover': {
15
+ appearance: 'none',
16
+ border: 0,
17
+ outline: 0
18
+ },
19
+ // eslint-disable-next-line @repo/internal/styles/no-nested-styles
20
+ '&&': {
21
+ marginLeft: 12
22
+ }
23
+ });
5
24
  export const SkeletonCreateButton = ({
6
25
  text,
7
26
  testId
8
27
  }) => {
9
28
  const theme = useTheme();
10
29
  return jsx("button", {
11
- css: skeletonCreateButtonCSS(theme),
30
+ style: theme.mode.create.default,
31
+ css: skeletonCreateButtonStyles,
12
32
  "data-testid": testId
13
33
  }, text);
14
34
  };