@atlaskit/atlassian-navigation 2.6.14 → 2.6.16

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 (63) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/components/AtlassianNavigation/index.js +3 -3
  3. package/dist/cjs/components/AtlassianNavigation/skeleton.js +3 -3
  4. package/dist/cjs/components/Create/index.js +3 -3
  5. package/dist/cjs/components/PrimaryButton/index.js +1 -1
  6. package/dist/cjs/components/PrimaryDropdownButton/index.js +5 -5
  7. package/dist/cjs/components/PrimaryItemsContainer/index.js +1 -1
  8. package/dist/cjs/components/PrimaryItemsContainerV2/index.js +83 -43
  9. package/dist/cjs/components/ProductHome/custom-product-home.js +1 -1
  10. package/dist/cjs/components/ProductHome/product-home.js +14 -6
  11. package/dist/cjs/components/ProductHome/skeleton.js +3 -3
  12. package/dist/cjs/components/SkeletonCreateButton/index.js +1 -1
  13. package/dist/cjs/components/SkeletonIconButton/index.js +2 -2
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/components/AtlassianNavigation/index.js +3 -3
  16. package/dist/es2019/components/AtlassianNavigation/skeleton.js +3 -3
  17. package/dist/es2019/components/Create/index.js +5 -5
  18. package/dist/es2019/components/Create/skeleton.js +1 -1
  19. package/dist/es2019/components/PrimaryButton/index.js +1 -1
  20. package/dist/es2019/components/PrimaryDropdownButton/index.js +6 -6
  21. package/dist/es2019/components/PrimaryItemsContainer/index.js +1 -1
  22. package/dist/es2019/components/PrimaryItemsContainerV2/index.js +68 -44
  23. package/dist/es2019/components/ProductHome/custom-product-home.js +6 -6
  24. package/dist/es2019/components/ProductHome/product-home.js +18 -11
  25. package/dist/es2019/components/ProductHome/skeleton.js +7 -7
  26. package/dist/es2019/components/Search/index.js +2 -2
  27. package/dist/es2019/components/Search/skeleton.js +2 -2
  28. package/dist/es2019/components/SkeletonCreateButton/index.js +1 -1
  29. package/dist/es2019/components/SkeletonIconButton/index.js +2 -2
  30. package/dist/es2019/version.json +1 -1
  31. package/dist/esm/components/AtlassianNavigation/index.js +3 -3
  32. package/dist/esm/components/AtlassianNavigation/skeleton.js +3 -3
  33. package/dist/esm/components/Create/index.js +3 -3
  34. package/dist/esm/components/PrimaryButton/index.js +1 -1
  35. package/dist/esm/components/PrimaryDropdownButton/index.js +6 -6
  36. package/dist/esm/components/PrimaryItemsContainer/index.js +1 -1
  37. package/dist/esm/components/PrimaryItemsContainerV2/index.js +85 -45
  38. package/dist/esm/components/ProductHome/custom-product-home.js +1 -1
  39. package/dist/esm/components/ProductHome/product-home.js +14 -6
  40. package/dist/esm/components/ProductHome/skeleton.js +3 -3
  41. package/dist/esm/components/SkeletonCreateButton/index.js +1 -1
  42. package/dist/esm/components/SkeletonIconButton/index.js +2 -2
  43. package/dist/esm/version.json +1 -1
  44. package/dist/types/components/PrimaryItemsContainerV2/index.d.ts +1 -3
  45. package/dist/types-ts4.5/components/PrimaryItemsContainerV2/index.d.ts +1 -3
  46. package/package.json +3 -3
  47. package/tmp/api-report-tmp.d.ts +325 -0
  48. package/__perf__/default.tsx +0 -14
  49. package/docs/01-intro.tsx +0 -46
  50. package/docs/02-atlassian-navigation.tsx +0 -38
  51. package/docs/03-product-home.tsx +0 -73
  52. package/docs/04-app-switcher.tsx +0 -29
  53. package/docs/05-create.tsx +0 -37
  54. package/docs/06-primary-actions.tsx +0 -64
  55. package/docs/07-secondary-actions.tsx +0 -206
  56. package/docs/96-skeleton-buttons.tsx +0 -88
  57. package/docs/97-theming.tsx +0 -45
  58. package/docs/98-overflow-menu.tsx +0 -49
  59. package/docs/99-migrating-from-navigation-next.tsx +0 -52
  60. package/docs/ert/skeleton-create-button.tsx +0 -3
  61. package/docs/ert/skeleton-icon-button.tsx +0 -3
  62. package/docs/ert/skeleton-primary-button.tsx +0 -3
  63. package/docs/ert/skeleton-switcher-button.tsx +0 -3
@@ -1,33 +1,32 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _css2;
5
- /** @jsx jsx */
6
- import React, { memo, useCallback, useMemo, useState } from 'react';
7
- import { css, jsx } from '@emotion/react';
4
+ var _xcss2;
5
+ import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
8
6
  import Popup from '@atlaskit/popup';
9
- import { media, UNSAFE_media } from '@atlaskit/primitives/responsive';
7
+ import { Inline, xcss } from '@atlaskit/primitives';
8
+ import { media, UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
10
9
  import { OverflowProvider } from '../../controllers/overflow';
11
10
  import { PrimaryDropdownButton } from '../PrimaryDropdownButton';
12
- var parentContainerStyles = css({
13
- display: 'flex',
14
- width: '100%',
15
- height: '100%'
11
+ var sharedContainerStyles = xcss({
12
+ height: '100%',
13
+ alignItems: 'stretch',
14
+ paddingInlineEnd: 'space.050',
15
+ gap: 'space.100'
16
16
  });
17
- var basePrimaryContainerStyles = css({
18
- display: 'none',
19
- minWidth: 0,
20
- gap: "var(--ds-space-100, 8px)"
21
- });
22
- var smallContainerStyles = css(_defineProperty({}, UNSAFE_media.below.sm, {
23
- display: 'flex'
17
+ var smallContainerStyles = xcss(_defineProperty({}, media.above.sm, {
18
+ display: 'none'
24
19
  }));
25
- var mediumContainerStyles = css((_css2 = {}, _defineProperty(_css2, media.above.sm, {
20
+ var mediumContainerStyles = xcss((_xcss2 = {
21
+ display: 'none'
22
+ }, _defineProperty(_xcss2, media.above.sm, {
26
23
  display: 'flex'
27
- }), _defineProperty(_css2, media.above.lg, {
24
+ }), _defineProperty(_xcss2, media.above.lg, {
28
25
  display: 'none'
29
- }), _css2));
30
- var largeContainerStyles = css(_defineProperty({}, media.above.lg, {
26
+ }), _xcss2));
27
+ var largeContainerStyles = xcss(_defineProperty({
28
+ display: 'none'
29
+ }, media.above.lg, {
31
30
  display: 'flex'
32
31
  }));
33
32
  var MoreItemsPopup = function MoreItemsPopup(_ref) {
@@ -50,20 +49,20 @@ var MoreItemsPopup = function MoreItemsPopup(_ref) {
50
49
  return setIsMoreOpen(true);
51
50
  }, []);
52
51
  var trigger = useCallback(function (triggerProps) {
53
- return jsx(PrimaryDropdownButton, _extends({
52
+ return /*#__PURE__*/React.createElement(PrimaryDropdownButton, _extends({
54
53
  onClick: onMoreClick,
55
54
  isSelected: isMoreOpen,
56
55
  testId: testId ? "".concat(testId, "-overflow-menu-trigger") : 'overflow-menu-trigger'
57
56
  }, triggerProps), moreLabel);
58
57
  }, [moreLabel, onMoreClick, isMoreOpen, testId]);
59
58
  var content = useCallback(function () {
60
- return jsx(OverflowProvider, {
59
+ return /*#__PURE__*/React.createElement(OverflowProvider, {
61
60
  isVisible: false,
62
61
  openOverflowMenu: openOverflowMenu,
63
62
  closeOverflowMenu: onMoreClose
64
63
  }, items);
65
64
  }, [items, openOverflowMenu, onMoreClose]);
66
- return jsx(Popup, {
65
+ return /*#__PURE__*/React.createElement(Popup, {
67
66
  placement: "bottom-start",
68
67
  isOpen: isMoreOpen,
69
68
  onClose: onMoreClose,
@@ -81,6 +80,33 @@ export var PrimaryItemsContainer = /*#__PURE__*/memo(function (_ref2) {
81
80
  Create = _ref2.create,
82
81
  theme = _ref2.theme,
83
82
  testId = _ref2.testId;
83
+ // We render a CSS media query based nav at first to handle SSR, then use
84
+ // our useMediaQuery hook once we are hydrated so there is only one set of nav items
85
+ var _useState3 = useState(false),
86
+ _useState4 = _slicedToArray(_useState3, 2),
87
+ isClient = _useState4[0],
88
+ setIsClient = _useState4[1];
89
+ useEffect(function () {
90
+ setIsClient(true);
91
+ }, []);
92
+
93
+ // Setting up our media queries to use once app is hydrated
94
+ var mqSm = useMediaQuery('above.sm', function (event) {
95
+ return setIsAboveSm(event.matches);
96
+ });
97
+ var _useState5 = useState(mqSm === null || mqSm === void 0 ? void 0 : mqSm.matches),
98
+ _useState6 = _slicedToArray(_useState5, 2),
99
+ isAboveSm = _useState6[0],
100
+ setIsAboveSm = _useState6[1];
101
+ var mqLg = useMediaQuery('above.lg', function (event) {
102
+ return setIsAboveLg(event.matches);
103
+ });
104
+ var _useState7 = useState(mqLg === null || mqLg === void 0 ? void 0 : mqLg.matches),
105
+ _useState8 = _slicedToArray(_useState7, 2),
106
+ isAboveLg = _useState8[0],
107
+ setIsAboveLg = _useState8[1];
108
+
109
+ // Filter out any falsy items passed in
84
110
  var filteredItems = useMemo(function () {
85
111
  return React.Children.toArray(items).filter(function (item) {
86
112
  return !!item;
@@ -95,9 +121,15 @@ export var PrimaryItemsContainer = /*#__PURE__*/memo(function (_ref2) {
95
121
  var smallMaxItems = 0;
96
122
  var mediumMaxItems = 3;
97
123
  var largeMaxItems = 8;
124
+
125
+ // We re-use this in both the CSS media query nav that loads in for SSR,
126
+ // and the JS/hook media query nav that is used once hydrated
98
127
  var navItems = useMemo(function () {
99
128
  return {
100
- // For small screens, we're currently putting all items in the overflow
129
+ small: {
130
+ navBarItems: [],
131
+ overflowItems: filteredItems
132
+ },
101
133
  medium: {
102
134
  navBarItems: filteredItems.slice(0, mediumMaxItems),
103
135
  overflowItems: filteredItems.slice(mediumMaxItems, filteredItems.length)
@@ -108,31 +140,39 @@ export var PrimaryItemsContainer = /*#__PURE__*/memo(function (_ref2) {
108
140
  }
109
141
  };
110
142
  }, [filteredItems]);
111
- return jsx("div", {
112
- css: parentContainerStyles,
113
- "data-testid": testId && "".concat(testId, "-primary-actions")
114
- }, jsx("div", {
115
- css: [basePrimaryContainerStyles, smallContainerStyles]
116
- }, filteredItems.length > smallMaxItems && jsx(MoreItemsPopup
117
- // NOTE: Would be nice to have a different label for small screens
118
- // with i18n support (eg. swapping from 'More' to 'Menu' like
119
- // Atlas does). Instead of opting for adding a new label prop right
120
- // now I'm holding off until DSTRFC-016 lands.
121
- , {
143
+ var hydratedNavItems = useMemo(function () {
144
+ if (isAboveLg) {
145
+ return navItems.large;
146
+ }
147
+ if (isAboveSm && !isAboveLg) {
148
+ return navItems.medium;
149
+ }
150
+ return navItems.small;
151
+ }, [isAboveLg, isAboveSm, navItems.large, navItems.medium, navItems.small]);
152
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isClient ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
153
+ testId: testId && "".concat(testId, "-primary-actions"),
154
+ xcss: sharedContainerStyles
155
+ }, hydratedNavItems.navBarItems, hydratedNavItems.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
156
+ moreLabel: moreLabel,
157
+ items: hydratedNavItems.overflowItems,
158
+ testId: testId
159
+ }))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Inline, {
160
+ xcss: [sharedContainerStyles, smallContainerStyles]
161
+ }, filteredItems.length > smallMaxItems &&
162
+ /*#__PURE__*/
163
+ // We don't need to pass items into popup, it won't be interactive (SSR only)
164
+ React.createElement(MoreItemsPopup, {
122
165
  moreLabel: moreLabel,
123
- items: filteredItems,
124
166
  testId: testId
125
- })), jsx("div", {
126
- css: [basePrimaryContainerStyles, mediumContainerStyles]
127
- }, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && jsx(MoreItemsPopup, {
167
+ })), /*#__PURE__*/React.createElement(Inline, {
168
+ xcss: [sharedContainerStyles, mediumContainerStyles]
169
+ }, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
128
170
  moreLabel: moreLabel,
129
- items: navItems.medium.overflowItems,
130
171
  testId: testId
131
- })), jsx("div", {
132
- css: [basePrimaryContainerStyles, largeContainerStyles]
133
- }, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && jsx(MoreItemsPopup, {
172
+ })), /*#__PURE__*/React.createElement(Inline, {
173
+ xcss: [sharedContainerStyles, largeContainerStyles]
174
+ }, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
134
175
  moreLabel: moreLabel,
135
- items: navItems.large.overflowItems,
136
176
  testId: testId
137
- })), Create && jsx(Create, null));
177
+ }))), Create && /*#__PURE__*/React.createElement(Create, null));
138
178
  });
@@ -67,7 +67,7 @@ var productHomeButtonStyles = css((_css3 = {
67
67
  color: "var(".concat(VAR_PRODUCT_HOME_COLOR_FOCUS, ")"),
68
68
  outline: "2px solid ".concat("var(--ds-border-focused, ".concat(B200, ")"))
69
69
  },
70
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
70
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
71
71
  'div&': {
72
72
  pointerEvents: 'none'
73
73
  }
@@ -50,7 +50,7 @@ var productHomeButtonStyles = css((_css = {
50
50
  color: "var(".concat(VAR_PRODUCT_HOME_COLOR_FOCUS, ")"),
51
51
  outline: "var(--ds-border-width-outline, 2px)".concat(" solid ", "var(--ds-border-focused, #4C9AFF)")
52
52
  },
53
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
53
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
54
54
  'div&': {
55
55
  pointerEvents: 'none'
56
56
  }
@@ -64,11 +64,11 @@ var productLogoStyles = css(_defineProperty({
64
64
  // productHome is aligned correctly
65
65
  display: 'flex',
66
66
  maxWidth: "var(".concat(VAR_LOGO_MAX_WIDTH, ")"),
67
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
67
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
68
68
  '& > *': {
69
69
  maxHeight: 24
70
70
  },
71
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
71
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
72
72
  '& > span > svg': {
73
73
  maxWidth: "var(".concat(VAR_LOGO_MAX_WIDTH, ")")
74
74
  }
@@ -82,7 +82,7 @@ var productIconStyles = css(_defineProperty({
82
82
  // Ensure anything passed into
83
83
  // productHome is aligned correctly
84
84
  display: 'flex',
85
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
85
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
86
86
  '& > *': {
87
87
  maxHeight: 24
88
88
  }
@@ -91,12 +91,20 @@ var productIconStyles = css(_defineProperty({
91
91
  }));
92
92
  var siteTitleStyles = css({
93
93
  display: 'flex',
94
+ // Overridden in PFF styles applied below; consolidate in FF cleanup
94
95
  marginRight: "var(--ds-space-050, 4px)",
95
96
  marginLeft: "var(--ds-space-050, 4px)",
96
97
  paddingRight: "var(--ds-space-200, 16px)",
97
98
  alignItems: 'center'
98
99
  });
99
- var hideSiteTitleStyles = css(_defineProperty({}, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
100
+
101
+ // When cleaning up feature flag, these styles can be moved into the above block
102
+ var featureFlaggedSiteTitleStyles = css(_defineProperty({
103
+ // Under the FF, we've made the site title handle it's spacing, with the
104
+ // PrimaryItemsContainer not needing to worry about its paddingInlineStart.
105
+ // This makes it cleaner for the title styles to appear and disappear with mq's
106
+ marginRight: "var(--ds-space-100, 8px)"
107
+ }, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
100
108
  display: 'none'
101
109
  }));
102
110
 
@@ -167,7 +175,7 @@ var ProductHome = function ProductHome(_ref) {
167
175
  style: {
168
176
  borderRight: theme.mode.productHome.borderRight
169
177
  },
170
- css: [siteTitleStyles, getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') && hideSiteTitleStyles],
178
+ css: [siteTitleStyles, getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') && featureFlaggedSiteTitleStyles],
171
179
  "data-testid": testId && "".concat(testId, "-site-title")
172
180
  }, siteTitle));
173
181
  };
@@ -47,7 +47,7 @@ var productHomeButtonStyles = css((_css = {
47
47
  boxShadow: "var(".concat(VAR_PRODUCT_HOME_BOX_SHADOW_HOVER, ")"),
48
48
  color: "var(".concat(VAR_PRODUCT_HOME_COLOR_HOVER, ")")
49
49
  },
50
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
50
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
51
51
  'div&': {
52
52
  pointerEvents: 'none'
53
53
  }
@@ -63,7 +63,7 @@ var productLogoStyles = css(_defineProperty({
63
63
  height: 24,
64
64
  maxHeight: 28,
65
65
  opacity: 0.15,
66
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
66
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
67
67
  '& > *': {
68
68
  maxHeight: 24
69
69
  }
@@ -76,7 +76,7 @@ var productIconStyles = css(_defineProperty({
76
76
  height: 28,
77
77
  borderRadius: "var(--ds-border-radius-circle, 50%)",
78
78
  opacity: 0.15,
79
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
79
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
80
80
  '& > *': {
81
81
  maxHeight: 24
82
82
  }
@@ -16,7 +16,7 @@ var skeletonCreateButtonStyles = css({
16
16
  border: 0,
17
17
  outline: 0
18
18
  },
19
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
19
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
20
20
  '&&': {
21
21
  marginLeft: "var(--ds-space-150, 12px)"
22
22
  }
@@ -16,11 +16,11 @@ var skeletonIconButtonStyles = css({
16
16
  '&:only-of-type': {
17
17
  marginRight: 0
18
18
  },
19
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
19
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
20
20
  '& > span': {
21
21
  lineHeight: 'normal'
22
22
  },
23
- // eslint-disable-next-line @repo/internal/styles/no-nested-styles
23
+ // eslint-disable-next-line @atlaskit/design-system/no-nested-styles
24
24
  '& > img': {
25
25
  width: 24,
26
26
  height: 24,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/atlassian-navigation",
3
- "version": "2.6.14",
3
+ "version": "2.6.16",
4
4
  "sideEffects": false
5
5
  }
@@ -1,8 +1,6 @@
1
- /** @jsx jsx */
2
1
  import React from 'react';
3
- import { jsx } from '@emotion/react';
4
2
  import { NavigationTheme } from '../../theme';
5
3
  import { PrimaryItemsContainerProps } from '../PrimaryItemsContainer/types';
6
4
  export declare const PrimaryItemsContainer: React.MemoExoticComponent<({ moreLabel, items, create: Create, theme, testId, }: PrimaryItemsContainerProps & {
7
5
  theme: NavigationTheme;
8
- }) => jsx.JSX.Element>;
6
+ }) => JSX.Element>;
@@ -1,8 +1,6 @@
1
- /** @jsx jsx */
2
1
  import React from 'react';
3
- import { jsx } from '@emotion/react';
4
2
  import { NavigationTheme } from '../../theme';
5
3
  import { PrimaryItemsContainerProps } from '../PrimaryItemsContainer/types';
6
4
  export declare const PrimaryItemsContainer: React.MemoExoticComponent<({ moreLabel, items, create: Create, theme, testId, }: PrimaryItemsContainerProps & {
7
5
  theme: NavigationTheme;
8
- }) => jsx.JSX.Element>;
6
+ }) => JSX.Element>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/atlassian-navigation",
3
- "version": "2.6.14",
3
+ "version": "2.6.16",
4
4
  "description": "A horizontal navigation component for Atlassian products.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -23,7 +23,7 @@
23
23
  "sideEffects": false,
24
24
  "atlaskit:src": "src/index.tsx",
25
25
  "atlassian": {
26
- "team": "Design System Team",
26
+ "team": "Design System Pyxis",
27
27
  "deprecatedAutoEntryPoints": true,
28
28
  "releaseModel": "continuous",
29
29
  "website": {
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/icon": "^21.12.0",
39
39
  "@atlaskit/logo": "*",
40
40
  "@atlaskit/platform-feature-flags": "^0.2.0",
41
- "@atlaskit/popup": "^1.8.0",
41
+ "@atlaskit/popup": "^1.9.0",
42
42
  "@atlaskit/primitives": "^1.0.0",
43
43
  "@atlaskit/theme": "^12.5.0",
44
44
  "@atlaskit/tokens": "^1.13.0",