@atlaskit/atlassian-navigation 4.7.4 → 4.7.6

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,19 @@
1
1
  # @atlaskit/atlassian-navigation
2
2
 
3
+ ## 4.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.7.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`6ed7ccbb0bf44`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6ed7ccbb0bf44) -
14
+ Remove experiment behind `platform.design-system-team.navigation-v2-no-jank_5yhbd` feature flag,
15
+ keeping the old behaviour in place.
16
+
3
17
  ## 4.7.4
4
18
 
5
19
  ### Patch Changes
@@ -5,8 +5,7 @@
5
5
  "target": "es5",
6
6
  "composite": true,
7
7
  "outDir": "../dist",
8
- "rootDir": "../",
9
- "baseUrl": "../"
8
+ "rootDir": "../"
10
9
  },
11
10
  "include": [
12
11
  "../src/**/*.ts",
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = exports.AtlassianNavigation = void 0;
7
7
  var _react = require("@emotion/react");
8
8
  var _analyticsNamespacedContext = require("@atlaskit/analytics-namespaced-context");
9
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
9
  var _colors = require("@atlaskit/theme/colors");
11
10
  var _constants = require("../../common/constants");
12
11
  var _theme = require("../../theme");
13
12
  var _PrimaryItemsContainer = require("../PrimaryItemsContainer");
14
- var _PrimaryItemsContainerV = require("../PrimaryItemsContainerV2");
15
13
  /**
16
14
  * @jsxRuntime classic
17
15
  * @jsx jsx
@@ -102,15 +100,7 @@ var AtlassianNavigation = exports.AtlassianNavigation = function AtlassianNaviga
102
100
  }, (0, _react.jsx)("nav", {
103
101
  css: leftStyles,
104
102
  "aria-label": label
105
- }, AppSwitcher && (0, _react.jsx)(AppSwitcher, null), ProductHome && (0, _react.jsx)(ProductHome, null), (0, _platformFeatureFlags.fg)('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? (0, _react.jsx)(_PrimaryItemsContainerV.PrimaryItemsContainer, {
106
- testId: testId,
107
- moreLabel: moreLabel,
108
- items: primaryItems,
109
- create: create
110
- // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
111
- ,
112
- theme: theme
113
- }) : (0, _react.jsx)(_PrimaryItemsContainer.PrimaryItemsContainer, {
103
+ }, AppSwitcher && (0, _react.jsx)(AppSwitcher, null), ProductHome && (0, _react.jsx)(ProductHome, null), (0, _react.jsx)(_PrimaryItemsContainer.PrimaryItemsContainer, {
114
104
  testId: testId,
115
105
  moreLabel: moreLabel,
116
106
  items: primaryItems,
@@ -10,7 +10,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _react = require("react");
12
12
  var _react2 = require("@emotion/react");
13
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
13
  var _colors = require("@atlaskit/theme/colors");
15
14
  var _constants = require("../../common/constants");
16
15
  var _theme = require("../../theme");
@@ -96,9 +95,6 @@ var siteTitleStyles = (0, _react2.css)({
96
95
  marginInlineStart: "var(--ds-space-050, 4px)",
97
96
  paddingInlineEnd: "var(--ds-space-200, 16px)"
98
97
  });
99
- var hideSiteTitleStyles = (0, _react2.css)((0, _defineProperty2.default)({}, "@media (max-width: ".concat(_constants.PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
100
- display: 'none'
101
- }));
102
98
 
103
99
  /**
104
100
  * __Custom product home__
@@ -147,7 +143,8 @@ var CustomProductHome = function CustomProductHome(props) {
147
143
  css: [customMaxHeightStyles, productLogoStyles],
148
144
  src: logoUrl,
149
145
  alt: logoAlt,
150
- "data-testid": testId && "".concat(testId, "-logo")
146
+ "data-testid": testId && "".concat(testId, "-logo"),
147
+ "data-vc": "custom-product-home-logo"
151
148
  }), iconUrl && (0, _react2.jsx)("img", {
152
149
  style: {
153
150
  maxWidth: logoMaxWidth
@@ -155,15 +152,14 @@ var CustomProductHome = function CustomProductHome(props) {
155
152
  css: [customMaxHeightStyles, productIconStyles],
156
153
  src: iconUrl,
157
154
  alt: iconAlt,
158
- "data-testid": testId && "".concat(testId, "-icon")
155
+ "data-testid": testId && "".concat(testId, "-icon"),
156
+ "data-vc": "custom-product-home-icon"
159
157
  })), siteTitle && (0, _react2.jsx)("div", {
160
158
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
161
159
  style: {
162
160
  borderRight: theme.mode.productHome.borderRight
163
161
  },
164
- css: [siteTitleStyles,
165
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
166
- (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.navigation-v2-no-jank_5yhbd') && hideSiteTitleStyles],
162
+ css: siteTitleStyles,
167
163
  "data-testid": testId && "".concat(testId, "-site-title")
168
164
  }, siteTitle));
169
165
  };
@@ -10,7 +10,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
  var _react = require("react");
12
12
  var _react2 = require("@emotion/react");
13
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
13
  var _constants = require("../../common/constants");
15
14
  var _theme = require("../../theme");
16
15
  var _utils = require("../../utils");
@@ -111,16 +110,6 @@ var siteTitleStyles = (0, _react2.css)({
111
110
  paddingInlineEnd: "var(--ds-space-200, 16px)"
112
111
  });
113
112
 
114
- // When cleaning up feature flag, these styles can be moved into the above block
115
- var featureFlaggedSiteTitleStyles = (0, _react2.css)((0, _defineProperty2.default)({
116
- // Under the FF, we've made the site title handle it's spacing, with the
117
- // PrimaryItemsContainer not needing to worry about its paddingInlineStart.
118
- // This makes it cleaner for the title styles to appear and disappear with mq's
119
- marginInlineEnd: "var(--ds-space-100, 8px)"
120
- }, "@media (max-width: ".concat(_constants.PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
121
- display: 'none'
122
- }));
123
-
124
113
  /**
125
114
  * __Product home__
126
115
  *
@@ -183,9 +172,7 @@ var ProductHome = function ProductHome(_ref) {
183
172
  style: {
184
173
  borderRight: theme.mode.productHome.borderRight
185
174
  },
186
- css: [siteTitleStyles,
187
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
188
- (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.navigation-v2-no-jank_5yhbd') && featureFlaggedSiteTitleStyles],
175
+ css: siteTitleStyles,
189
176
  "data-testid": testId && "".concat(testId, "-site-title")
190
177
  }, siteTitle));
191
178
  };
@@ -5,12 +5,10 @@
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { NavigationAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { N30 } from '@atlaskit/theme/colors';
10
9
  import { HORIZONTAL_GLOBAL_NAV_HEIGHT } from '../../common/constants';
11
10
  import { defaultTheme, ThemeProvider } from '../../theme';
12
11
  import { PrimaryItemsContainer } from '../PrimaryItemsContainer';
13
- import { PrimaryItemsContainer as PrimaryItemsContainerV2 } from '../PrimaryItemsContainerV2';
14
12
  const containerStyles = css({
15
13
  display: 'flex',
16
14
  boxSizing: 'border-box',
@@ -94,15 +92,7 @@ export const AtlassianNavigation = props => {
94
92
  }, jsx("nav", {
95
93
  css: leftStyles,
96
94
  "aria-label": label
97
- }, AppSwitcher && jsx(AppSwitcher, null), ProductHome && jsx(ProductHome, null), fg('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? jsx(PrimaryItemsContainerV2, {
98
- testId: testId,
99
- moreLabel: moreLabel,
100
- items: primaryItems,
101
- create: create
102
- // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
103
- ,
104
- theme: theme
105
- }) : jsx(PrimaryItemsContainer, {
95
+ }, AppSwitcher && jsx(AppSwitcher, null), ProductHome && jsx(ProductHome, null), jsx(PrimaryItemsContainer, {
106
96
  testId: testId,
107
97
  moreLabel: moreLabel,
108
98
  items: primaryItems,
@@ -7,7 +7,6 @@ import { Fragment } from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, jsx } from '@emotion/react';
10
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
10
  import { B200 } from '@atlaskit/theme/colors';
12
11
  import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
13
12
  import { useTheme } from '../../theme';
@@ -94,12 +93,6 @@ const siteTitleStyles = css({
94
93
  marginInlineStart: "var(--ds-space-050, 4px)",
95
94
  paddingInlineEnd: "var(--ds-space-200, 16px)"
96
95
  });
97
- const hideSiteTitleStyles = css({
98
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
99
- [`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
100
- display: 'none'
101
- }
102
- });
103
96
 
104
97
  /**
105
98
  * __Custom product home__
@@ -158,7 +151,8 @@ const CustomProductHome = props => {
158
151
  css: [customMaxHeightStyles, productLogoStyles],
159
152
  src: logoUrl,
160
153
  alt: logoAlt,
161
- "data-testid": testId && `${testId}-logo`
154
+ "data-testid": testId && `${testId}-logo`,
155
+ "data-vc": "custom-product-home-logo"
162
156
  }), iconUrl && jsx("img", {
163
157
  style: {
164
158
  maxWidth: logoMaxWidth
@@ -166,15 +160,14 @@ const CustomProductHome = props => {
166
160
  css: [customMaxHeightStyles, productIconStyles],
167
161
  src: iconUrl,
168
162
  alt: iconAlt,
169
- "data-testid": testId && `${testId}-icon`
163
+ "data-testid": testId && `${testId}-icon`,
164
+ "data-vc": "custom-product-home-icon"
170
165
  })), siteTitle && jsx("div", {
171
166
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
172
167
  style: {
173
168
  borderRight: theme.mode.productHome.borderRight
174
169
  },
175
- css: [siteTitleStyles,
176
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
177
- getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') && hideSiteTitleStyles],
170
+ css: siteTitleStyles,
178
171
  "data-testid": testId && `${testId}-site-title`
179
172
  }, siteTitle));
180
173
  };
@@ -7,7 +7,6 @@ import { Fragment } from 'react';
7
7
 
8
8
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
9
9
  import { css, jsx } from '@emotion/react';
10
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
11
10
  import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
12
11
  import { useTheme } from '../../theme';
13
12
  import { stripEmptyProperties } from '../../utils';
@@ -109,18 +108,6 @@ const siteTitleStyles = css({
109
108
  paddingInlineEnd: "var(--ds-space-200, 16px)"
110
109
  });
111
110
 
112
- // When cleaning up feature flag, these styles can be moved into the above block
113
- const featureFlaggedSiteTitleStyles = css({
114
- // Under the FF, we've made the site title handle it's spacing, with the
115
- // PrimaryItemsContainer not needing to worry about its paddingInlineStart.
116
- // This makes it cleaner for the title styles to appear and disappear with mq's
117
- marginInlineEnd: "var(--ds-space-100, 8px)",
118
- // eslint-disable-next-line @atlaskit/design-system/no-nested-styles, @atlaskit/ui-styling-standard/no-unsafe-values, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
119
- [`@media (max-width: ${PRODUCT_HOME_BREAKPOINT - 0.1}px)`]: {
120
- display: 'none'
121
- }
122
- });
123
-
124
111
  /**
125
112
  * __Product home__
126
113
  *
@@ -192,9 +179,7 @@ const ProductHome = ({
192
179
  style: {
193
180
  borderRight: theme.mode.productHome.borderRight
194
181
  },
195
- css: [siteTitleStyles,
196
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
197
- getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') && featureFlaggedSiteTitleStyles],
182
+ css: siteTitleStyles,
198
183
  "data-testid": testId && `${testId}-site-title`
199
184
  }, siteTitle));
200
185
  };
@@ -5,12 +5,10 @@
5
5
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { NavigationAnalyticsContext } from '@atlaskit/analytics-namespaced-context';
8
- import { fg } from '@atlaskit/platform-feature-flags';
9
8
  import { N30 } from '@atlaskit/theme/colors';
10
9
  import { HORIZONTAL_GLOBAL_NAV_HEIGHT } from '../../common/constants';
11
10
  import { defaultTheme, ThemeProvider } from '../../theme';
12
11
  import { PrimaryItemsContainer } from '../PrimaryItemsContainer';
13
- import { PrimaryItemsContainer as PrimaryItemsContainerV2 } from '../PrimaryItemsContainerV2';
14
12
  var containerStyles = css({
15
13
  display: 'flex',
16
14
  boxSizing: 'border-box',
@@ -95,15 +93,7 @@ export var AtlassianNavigation = function AtlassianNavigation(props) {
95
93
  }, jsx("nav", {
96
94
  css: leftStyles,
97
95
  "aria-label": label
98
- }, AppSwitcher && jsx(AppSwitcher, null), ProductHome && jsx(ProductHome, null), fg('platform.design-system-team.navigation-v2-no-jank_5yhbd') ? jsx(PrimaryItemsContainerV2, {
99
- testId: testId,
100
- moreLabel: moreLabel,
101
- items: primaryItems,
102
- create: create
103
- // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
104
- ,
105
- theme: theme
106
- }) : jsx(PrimaryItemsContainer, {
96
+ }, AppSwitcher && jsx(AppSwitcher, null), ProductHome && jsx(ProductHome, null), jsx(PrimaryItemsContainer, {
107
97
  testId: testId,
108
98
  moreLabel: moreLabel,
109
99
  items: primaryItems,
@@ -11,7 +11,6 @@ import { Fragment } from 'react';
11
11
 
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
13
  import { css, jsx } from '@emotion/react';
14
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
14
  import { B200 } from '@atlaskit/theme/colors';
16
15
  import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
17
16
  import { useTheme } from '../../theme';
@@ -90,9 +89,6 @@ var siteTitleStyles = css({
90
89
  marginInlineStart: "var(--ds-space-050, 4px)",
91
90
  paddingInlineEnd: "var(--ds-space-200, 16px)"
92
91
  });
93
- var hideSiteTitleStyles = css(_defineProperty({}, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
94
- display: 'none'
95
- }));
96
92
 
97
93
  /**
98
94
  * __Custom product home__
@@ -141,7 +137,8 @@ var CustomProductHome = function CustomProductHome(props) {
141
137
  css: [customMaxHeightStyles, productLogoStyles],
142
138
  src: logoUrl,
143
139
  alt: logoAlt,
144
- "data-testid": testId && "".concat(testId, "-logo")
140
+ "data-testid": testId && "".concat(testId, "-logo"),
141
+ "data-vc": "custom-product-home-logo"
145
142
  }), iconUrl && jsx("img", {
146
143
  style: {
147
144
  maxWidth: logoMaxWidth
@@ -149,15 +146,14 @@ var CustomProductHome = function CustomProductHome(props) {
149
146
  css: [customMaxHeightStyles, productIconStyles],
150
147
  src: iconUrl,
151
148
  alt: iconAlt,
152
- "data-testid": testId && "".concat(testId, "-icon")
149
+ "data-testid": testId && "".concat(testId, "-icon"),
150
+ "data-vc": "custom-product-home-icon"
153
151
  })), siteTitle && jsx("div", {
154
152
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
155
153
  style: {
156
154
  borderRight: theme.mode.productHome.borderRight
157
155
  },
158
- css: [siteTitleStyles,
159
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
160
- getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') && hideSiteTitleStyles],
156
+ css: siteTitleStyles,
161
157
  "data-testid": testId && "".concat(testId, "-site-title")
162
158
  }, siteTitle));
163
159
  };
@@ -11,7 +11,6 @@ import { Fragment } from 'react';
11
11
 
12
12
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
13
13
  import { css, jsx } from '@emotion/react';
14
- import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
14
  import { PRODUCT_HOME_BREAKPOINT } from '../../common/constants';
16
15
  import { useTheme } from '../../theme';
17
16
  import { stripEmptyProperties } from '../../utils';
@@ -105,16 +104,6 @@ var siteTitleStyles = css({
105
104
  paddingInlineEnd: "var(--ds-space-200, 16px)"
106
105
  });
107
106
 
108
- // When cleaning up feature flag, these styles can be moved into the above block
109
- var featureFlaggedSiteTitleStyles = css(_defineProperty({
110
- // Under the FF, we've made the site title handle it's spacing, with the
111
- // PrimaryItemsContainer not needing to worry about its paddingInlineStart.
112
- // This makes it cleaner for the title styles to appear and disappear with mq's
113
- marginInlineEnd: "var(--ds-space-100, 8px)"
114
- }, "@media (max-width: ".concat(PRODUCT_HOME_BREAKPOINT - 0.1, "px)"), {
115
- display: 'none'
116
- }));
117
-
118
107
  /**
119
108
  * __Product home__
120
109
  *
@@ -177,9 +166,7 @@ var ProductHome = function ProductHome(_ref) {
177
166
  style: {
178
167
  borderRight: theme.mode.productHome.borderRight
179
168
  },
180
- css: [siteTitleStyles,
181
- // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
182
- getBooleanFF('platform.design-system-team.navigation-v2-no-jank_5yhbd') && featureFlaggedSiteTitleStyles],
169
+ css: siteTitleStyles,
183
170
  "data-testid": testId && "".concat(testId, "-site-title")
184
171
  }, siteTitle));
185
172
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/atlassian-navigation",
3
- "version": "4.7.4",
3
+ "version": "4.7.6",
4
4
  "description": "A horizontal navigation component for Atlassian products.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,13 +40,13 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@atlaskit/analytics-namespaced-context": "^6.12.0",
43
- "@atlaskit/button": "^20.2.0",
43
+ "@atlaskit/button": "^20.3.0",
44
44
  "@atlaskit/ds-lib": "^3.1.0",
45
- "@atlaskit/icon": "^22.22.0",
45
+ "@atlaskit/icon": "^22.24.0",
46
46
  "@atlaskit/logo": "*",
47
47
  "@atlaskit/platform-feature-flags": "^0.3.0",
48
- "@atlaskit/popup": "^1.28.0",
49
- "@atlaskit/primitives": "^12.2.0",
48
+ "@atlaskit/popup": "^1.29.0",
49
+ "@atlaskit/primitives": "^13.0.0",
50
50
  "@atlaskit/theme": "^14.0.0",
51
51
  "@atlaskit/tokens": "^2.0.0",
52
52
  "@atlaskit/tooltip": "^18.8.0",
@@ -62,7 +62,7 @@
62
62
  "devDependencies": {
63
63
  "@af/accessibility-testing": "*",
64
64
  "@af/visual-regression": "*",
65
- "@atlaskit/dropdown-menu": "^12.20.0",
65
+ "@atlaskit/dropdown-menu": "^12.22.0",
66
66
  "@atlaskit/notification-indicator": "*",
67
67
  "@atlaskit/notification-log-client": "*",
68
68
  "@atlaskit/visual-regression": "*",
@@ -98,9 +98,6 @@
98
98
  },
99
99
  "homepage": "https://atlassian.design/components/atlassian-navigation/",
100
100
  "platform-feature-flags": {
101
- "platform.design-system-team.navigation-v2-no-jank_5yhbd": {
102
- "type": "boolean"
103
- },
104
101
  "platform-component-visual-refresh": {
105
102
  "type": "boolean"
106
103
  }
@@ -1,203 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.PrimaryItemsContainer = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
- var _react = _interopRequireWildcard(require("react"));
13
- var _popup = _interopRequireDefault(require("@atlaskit/popup"));
14
- var _primitives = require("@atlaskit/primitives");
15
- var _responsive = require("@atlaskit/primitives/responsive");
16
- var _overflow = require("../../controllers/overflow");
17
- var _PrimaryDropdownButton = require("../PrimaryDropdownButton");
18
- var _xcss2;
19
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
- var containerWrapperStyles = (0, _primitives.xcss)({
22
- height: '100%'
23
- });
24
- var sharedContainerStyles = (0, _primitives.xcss)({
25
- height: '100%',
26
- alignItems: 'stretch',
27
- paddingInlineEnd: 'space.050',
28
- gap: 'space.100'
29
- });
30
- var smallContainerStyles = (0, _primitives.xcss)((0, _defineProperty2.default)({}, _responsive.media.above.sm, {
31
- display: 'none'
32
- }));
33
- var mediumContainerStyles = (0, _primitives.xcss)((_xcss2 = {
34
- display: 'none'
35
- }, (0, _defineProperty2.default)(_xcss2, _responsive.media.above.sm, {
36
- display: 'flex'
37
- }), (0, _defineProperty2.default)(_xcss2, _responsive.media.above.lg, {
38
- display: 'none'
39
- }), _xcss2));
40
- var largeContainerStyles = (0, _primitives.xcss)((0, _defineProperty2.default)({
41
- display: 'none'
42
- }, _responsive.media.above.lg, {
43
- display: 'flex'
44
- }));
45
- var overflowItemsStyles = (0, _primitives.xcss)({
46
- color: 'color.text'
47
- });
48
- var MoreItemsPopup = function MoreItemsPopup(_ref) {
49
- var moreLabel = _ref.moreLabel,
50
- testId = _ref.testId,
51
- items = _ref.items;
52
- var _useState = (0, _react.useState)(false),
53
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
54
- isMoreOpen = _useState2[0],
55
- setIsMoreOpen = _useState2[1];
56
- var onMoreClose = (0, _react.useCallback)(function () {
57
- return setIsMoreOpen(false);
58
- }, []);
59
- var onMoreClick = (0, _react.useCallback)(function () {
60
- return setIsMoreOpen(function (current) {
61
- return !current;
62
- });
63
- }, []);
64
- var openOverflowMenu = (0, _react.useCallback)(function () {
65
- return setIsMoreOpen(true);
66
- }, []);
67
- var trigger = (0, _react.useCallback)(function (triggerProps) {
68
- return /*#__PURE__*/_react.default.createElement(_PrimaryDropdownButton.PrimaryDropdownButton, (0, _extends2.default)({
69
- onClick: onMoreClick,
70
- isSelected: isMoreOpen,
71
- testId: testId ? "".concat(testId, "-overflow-menu-trigger") : 'overflow-menu-trigger'
72
- }, triggerProps), moreLabel);
73
- }, [moreLabel, onMoreClick, isMoreOpen, testId]);
74
- var content = (0, _react.useCallback)(function () {
75
- return /*#__PURE__*/_react.default.createElement(_overflow.OverflowProvider, {
76
- isVisible: false,
77
- openOverflowMenu: openOverflowMenu,
78
- closeOverflowMenu: onMoreClose
79
- }, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
80
- xcss: overflowItemsStyles
81
- }, items));
82
- }, [items, openOverflowMenu, onMoreClose]);
83
- return /*#__PURE__*/_react.default.createElement(_popup.default, {
84
- shouldRenderToParent: true,
85
- placement: "bottom-start",
86
- isOpen: isMoreOpen,
87
- onClose: onMoreClose,
88
- trigger: trigger,
89
- content: content,
90
- testId: testId ? "".concat(testId, "-overflow-menu-popup") : 'overflow-menu-popup'
91
- });
92
- };
93
-
94
- // Internal only
95
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
96
- var PrimaryItemsContainer = exports.PrimaryItemsContainer = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
97
- var moreLabel = _ref2.moreLabel,
98
- items = _ref2.items,
99
- Create = _ref2.create,
100
- theme = _ref2.theme,
101
- testId = _ref2.testId;
102
- // We render a CSS media query based nav at first to handle SSR, then use
103
- // our useMediaQuery hook once we are hydrated so there is only one set of nav items
104
- var _useState3 = (0, _react.useState)(false),
105
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
106
- isClient = _useState4[0],
107
- setIsClient = _useState4[1];
108
- (0, _react.useEffect)(function () {
109
- setIsClient(true);
110
- }, []);
111
-
112
- // Setting up our media queries to use once app is hydrated
113
- var mqSm = (0, _responsive.UNSAFE_useMediaQuery)('above.sm', function (event) {
114
- return setIsAboveSm(event.matches);
115
- });
116
- var _useState5 = (0, _react.useState)(mqSm === null || mqSm === void 0 ? void 0 : mqSm.matches),
117
- _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
118
- isAboveSm = _useState6[0],
119
- setIsAboveSm = _useState6[1];
120
- var mqLg = (0, _responsive.UNSAFE_useMediaQuery)('above.lg', function (event) {
121
- return setIsAboveLg(event.matches);
122
- });
123
- var _useState7 = (0, _react.useState)(mqLg === null || mqLg === void 0 ? void 0 : mqLg.matches),
124
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
125
- isAboveLg = _useState8[0],
126
- setIsAboveLg = _useState8[1];
127
-
128
- // Filter out any falsy items passed in
129
- var filteredItems = (0, _react.useMemo)(function () {
130
- return _react.default.Children.toArray(items).filter(function (item) {
131
- return !!item;
132
- });
133
- }, [items]);
134
- // NOTE: we could make these max items configurable in the future. For now
135
- // we are using sensible defaults. Anything over the max gets put in the
136
- // overflow menu for that screen size.
137
- // While it may be tempting to use more than 3 items for the medium nav when
138
- // you see the available space, you need to consider internationalistion.
139
- // 3 is the safe, defensive choice across many languages and scripts.
140
- var smallMaxItems = 0;
141
- var mediumMaxItems = 3;
142
- var largeMaxItems = 8;
143
-
144
- // We re-use this in both the CSS media query nav that loads in for SSR,
145
- // and the JS/hook media query nav that is used once hydrated
146
- var navItems = (0, _react.useMemo)(function () {
147
- return {
148
- small: {
149
- navBarItems: [],
150
- overflowItems: filteredItems
151
- },
152
- medium: {
153
- navBarItems: filteredItems.slice(0, mediumMaxItems),
154
- overflowItems: filteredItems.slice(mediumMaxItems, filteredItems.length)
155
- },
156
- large: {
157
- navBarItems: filteredItems.slice(0, largeMaxItems),
158
- overflowItems: filteredItems.slice(largeMaxItems, filteredItems.length)
159
- }
160
- };
161
- }, [filteredItems]);
162
- var hydratedNavItems = (0, _react.useMemo)(function () {
163
- if (isAboveLg) {
164
- return navItems.large;
165
- }
166
- if (isAboveSm && !isAboveLg) {
167
- return navItems.medium;
168
- }
169
- return navItems.small;
170
- }, [isAboveLg, isAboveSm, navItems.large, navItems.medium, navItems.small]);
171
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isClient ? /*#__PURE__*/_react.default.createElement(_primitives.Box, {
172
- role: "list",
173
- xcss: containerWrapperStyles
174
- }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
175
- testId: testId && "".concat(testId, "-primary-actions"),
176
- xcss: sharedContainerStyles
177
- }, hydratedNavItems.navBarItems, hydratedNavItems.overflowItems.length > 0 && /*#__PURE__*/_react.default.createElement(MoreItemsPopup, {
178
- moreLabel: moreLabel,
179
- items: hydratedNavItems.overflowItems,
180
- testId: testId
181
- }))) : /*#__PURE__*/_react.default.createElement(_primitives.Box, {
182
- role: "list",
183
- xcss: containerWrapperStyles
184
- }, /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
185
- xcss: [sharedContainerStyles, smallContainerStyles]
186
- }, filteredItems.length > smallMaxItems &&
187
- /*#__PURE__*/
188
- // We don't need to pass items into popup, it won't be interactive (SSR only)
189
- _react.default.createElement(MoreItemsPopup, {
190
- moreLabel: moreLabel,
191
- testId: testId
192
- })), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
193
- xcss: [sharedContainerStyles, mediumContainerStyles]
194
- }, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && /*#__PURE__*/_react.default.createElement(MoreItemsPopup, {
195
- moreLabel: moreLabel,
196
- testId: testId
197
- })), /*#__PURE__*/_react.default.createElement(_primitives.Inline, {
198
- xcss: [sharedContainerStyles, largeContainerStyles]
199
- }, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && /*#__PURE__*/_react.default.createElement(MoreItemsPopup, {
200
- moreLabel: moreLabel,
201
- testId: testId
202
- }))), Create && /*#__PURE__*/_react.default.createElement(Create, null));
203
- });
@@ -1,165 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
3
- import Popup from '@atlaskit/popup';
4
- import { Box, Inline, xcss } from '@atlaskit/primitives';
5
- import { media, UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
6
- import { OverflowProvider } from '../../controllers/overflow';
7
- import { PrimaryDropdownButton } from '../PrimaryDropdownButton';
8
- const containerWrapperStyles = xcss({
9
- height: '100%'
10
- });
11
- const sharedContainerStyles = xcss({
12
- height: '100%',
13
- alignItems: 'stretch',
14
- paddingInlineEnd: 'space.050',
15
- gap: 'space.100'
16
- });
17
- const smallContainerStyles = xcss({
18
- [media.above.sm]: {
19
- display: 'none'
20
- }
21
- });
22
- const mediumContainerStyles = xcss({
23
- display: 'none',
24
- [media.above.sm]: {
25
- display: 'flex'
26
- },
27
- [media.above.lg]: {
28
- display: 'none'
29
- }
30
- });
31
- const largeContainerStyles = xcss({
32
- display: 'none',
33
- [media.above.lg]: {
34
- display: 'flex'
35
- }
36
- });
37
- const overflowItemsStyles = xcss({
38
- color: 'color.text'
39
- });
40
- const MoreItemsPopup = ({
41
- moreLabel,
42
- testId,
43
- items
44
- }) => {
45
- const [isMoreOpen, setIsMoreOpen] = useState(false);
46
- const onMoreClose = useCallback(() => setIsMoreOpen(false), []);
47
- const onMoreClick = useCallback(() => setIsMoreOpen(current => !current), []);
48
- const openOverflowMenu = useCallback(() => setIsMoreOpen(true), []);
49
- const trigger = useCallback(triggerProps => /*#__PURE__*/React.createElement(PrimaryDropdownButton, _extends({
50
- onClick: onMoreClick,
51
- isSelected: isMoreOpen,
52
- testId: testId ? `${testId}-overflow-menu-trigger` : 'overflow-menu-trigger'
53
- }, triggerProps), moreLabel), [moreLabel, onMoreClick, isMoreOpen, testId]);
54
- const content = useCallback(() => /*#__PURE__*/React.createElement(OverflowProvider, {
55
- isVisible: false,
56
- openOverflowMenu: openOverflowMenu,
57
- closeOverflowMenu: onMoreClose
58
- }, /*#__PURE__*/React.createElement(Box, {
59
- xcss: overflowItemsStyles
60
- }, items)), [items, openOverflowMenu, onMoreClose]);
61
- return /*#__PURE__*/React.createElement(Popup, {
62
- shouldRenderToParent: true,
63
- placement: "bottom-start",
64
- isOpen: isMoreOpen,
65
- onClose: onMoreClose,
66
- trigger: trigger,
67
- content: content,
68
- testId: testId ? `${testId}-overflow-menu-popup` : 'overflow-menu-popup'
69
- });
70
- };
71
-
72
- // Internal only
73
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
74
- export const PrimaryItemsContainer = /*#__PURE__*/memo(({
75
- moreLabel,
76
- items,
77
- create: Create,
78
- theme,
79
- testId
80
- }) => {
81
- // We render a CSS media query based nav at first to handle SSR, then use
82
- // our useMediaQuery hook once we are hydrated so there is only one set of nav items
83
- const [isClient, setIsClient] = useState(false);
84
- useEffect(() => {
85
- setIsClient(true);
86
- }, []);
87
-
88
- // Setting up our media queries to use once app is hydrated
89
- const mqSm = useMediaQuery('above.sm', event => setIsAboveSm(event.matches));
90
- const [isAboveSm, setIsAboveSm] = useState(mqSm === null || mqSm === void 0 ? void 0 : mqSm.matches);
91
- const mqLg = useMediaQuery('above.lg', event => setIsAboveLg(event.matches));
92
- const [isAboveLg, setIsAboveLg] = useState(mqLg === null || mqLg === void 0 ? void 0 : mqLg.matches);
93
-
94
- // Filter out any falsy items passed in
95
- const filteredItems = useMemo(() => React.Children.toArray(items).filter(item => !!item), [items]);
96
- // NOTE: we could make these max items configurable in the future. For now
97
- // we are using sensible defaults. Anything over the max gets put in the
98
- // overflow menu for that screen size.
99
- // While it may be tempting to use more than 3 items for the medium nav when
100
- // you see the available space, you need to consider internationalistion.
101
- // 3 is the safe, defensive choice across many languages and scripts.
102
- const smallMaxItems = 0;
103
- const mediumMaxItems = 3;
104
- const largeMaxItems = 8;
105
-
106
- // We re-use this in both the CSS media query nav that loads in for SSR,
107
- // and the JS/hook media query nav that is used once hydrated
108
- const navItems = useMemo(() => {
109
- return {
110
- small: {
111
- navBarItems: [],
112
- overflowItems: filteredItems
113
- },
114
- medium: {
115
- navBarItems: filteredItems.slice(0, mediumMaxItems),
116
- overflowItems: filteredItems.slice(mediumMaxItems, filteredItems.length)
117
- },
118
- large: {
119
- navBarItems: filteredItems.slice(0, largeMaxItems),
120
- overflowItems: filteredItems.slice(largeMaxItems, filteredItems.length)
121
- }
122
- };
123
- }, [filteredItems]);
124
- const hydratedNavItems = useMemo(() => {
125
- if (isAboveLg) {
126
- return navItems.large;
127
- }
128
- if (isAboveSm && !isAboveLg) {
129
- return navItems.medium;
130
- }
131
- return navItems.small;
132
- }, [isAboveLg, isAboveSm, navItems.large, navItems.medium, navItems.small]);
133
- return /*#__PURE__*/React.createElement(React.Fragment, null, isClient ? /*#__PURE__*/React.createElement(Box, {
134
- role: "list",
135
- xcss: containerWrapperStyles
136
- }, /*#__PURE__*/React.createElement(Inline, {
137
- testId: testId && `${testId}-primary-actions`,
138
- xcss: sharedContainerStyles
139
- }, hydratedNavItems.navBarItems, hydratedNavItems.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
140
- moreLabel: moreLabel,
141
- items: hydratedNavItems.overflowItems,
142
- testId: testId
143
- }))) : /*#__PURE__*/React.createElement(Box, {
144
- role: "list",
145
- xcss: containerWrapperStyles
146
- }, /*#__PURE__*/React.createElement(Inline, {
147
- xcss: [sharedContainerStyles, smallContainerStyles]
148
- }, filteredItems.length > smallMaxItems &&
149
- /*#__PURE__*/
150
- // We don't need to pass items into popup, it won't be interactive (SSR only)
151
- React.createElement(MoreItemsPopup, {
152
- moreLabel: moreLabel,
153
- testId: testId
154
- })), /*#__PURE__*/React.createElement(Inline, {
155
- xcss: [sharedContainerStyles, mediumContainerStyles]
156
- }, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
157
- moreLabel: moreLabel,
158
- testId: testId
159
- })), /*#__PURE__*/React.createElement(Inline, {
160
- xcss: [sharedContainerStyles, largeContainerStyles]
161
- }, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
162
- moreLabel: moreLabel,
163
- testId: testId
164
- }))), Create && /*#__PURE__*/React.createElement(Create, null));
165
- });
@@ -1,193 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _xcss2;
5
- import React, { memo, useCallback, useEffect, useMemo, useState } from 'react';
6
- import Popup from '@atlaskit/popup';
7
- import { Box, Inline, xcss } from '@atlaskit/primitives';
8
- import { media, UNSAFE_useMediaQuery as useMediaQuery } from '@atlaskit/primitives/responsive';
9
- import { OverflowProvider } from '../../controllers/overflow';
10
- import { PrimaryDropdownButton } from '../PrimaryDropdownButton';
11
- var containerWrapperStyles = xcss({
12
- height: '100%'
13
- });
14
- var sharedContainerStyles = xcss({
15
- height: '100%',
16
- alignItems: 'stretch',
17
- paddingInlineEnd: 'space.050',
18
- gap: 'space.100'
19
- });
20
- var smallContainerStyles = xcss(_defineProperty({}, media.above.sm, {
21
- display: 'none'
22
- }));
23
- var mediumContainerStyles = xcss((_xcss2 = {
24
- display: 'none'
25
- }, _defineProperty(_xcss2, media.above.sm, {
26
- display: 'flex'
27
- }), _defineProperty(_xcss2, media.above.lg, {
28
- display: 'none'
29
- }), _xcss2));
30
- var largeContainerStyles = xcss(_defineProperty({
31
- display: 'none'
32
- }, media.above.lg, {
33
- display: 'flex'
34
- }));
35
- var overflowItemsStyles = xcss({
36
- color: 'color.text'
37
- });
38
- var MoreItemsPopup = function MoreItemsPopup(_ref) {
39
- var moreLabel = _ref.moreLabel,
40
- testId = _ref.testId,
41
- items = _ref.items;
42
- var _useState = useState(false),
43
- _useState2 = _slicedToArray(_useState, 2),
44
- isMoreOpen = _useState2[0],
45
- setIsMoreOpen = _useState2[1];
46
- var onMoreClose = useCallback(function () {
47
- return setIsMoreOpen(false);
48
- }, []);
49
- var onMoreClick = useCallback(function () {
50
- return setIsMoreOpen(function (current) {
51
- return !current;
52
- });
53
- }, []);
54
- var openOverflowMenu = useCallback(function () {
55
- return setIsMoreOpen(true);
56
- }, []);
57
- var trigger = useCallback(function (triggerProps) {
58
- return /*#__PURE__*/React.createElement(PrimaryDropdownButton, _extends({
59
- onClick: onMoreClick,
60
- isSelected: isMoreOpen,
61
- testId: testId ? "".concat(testId, "-overflow-menu-trigger") : 'overflow-menu-trigger'
62
- }, triggerProps), moreLabel);
63
- }, [moreLabel, onMoreClick, isMoreOpen, testId]);
64
- var content = useCallback(function () {
65
- return /*#__PURE__*/React.createElement(OverflowProvider, {
66
- isVisible: false,
67
- openOverflowMenu: openOverflowMenu,
68
- closeOverflowMenu: onMoreClose
69
- }, /*#__PURE__*/React.createElement(Box, {
70
- xcss: overflowItemsStyles
71
- }, items));
72
- }, [items, openOverflowMenu, onMoreClose]);
73
- return /*#__PURE__*/React.createElement(Popup, {
74
- shouldRenderToParent: true,
75
- placement: "bottom-start",
76
- isOpen: isMoreOpen,
77
- onClose: onMoreClose,
78
- trigger: trigger,
79
- content: content,
80
- testId: testId ? "".concat(testId, "-overflow-menu-popup") : 'overflow-menu-popup'
81
- });
82
- };
83
-
84
- // Internal only
85
- // eslint-disable-next-line @repo/internal/react/require-jsdoc
86
- export var PrimaryItemsContainer = /*#__PURE__*/memo(function (_ref2) {
87
- var moreLabel = _ref2.moreLabel,
88
- items = _ref2.items,
89
- Create = _ref2.create,
90
- theme = _ref2.theme,
91
- testId = _ref2.testId;
92
- // We render a CSS media query based nav at first to handle SSR, then use
93
- // our useMediaQuery hook once we are hydrated so there is only one set of nav items
94
- var _useState3 = useState(false),
95
- _useState4 = _slicedToArray(_useState3, 2),
96
- isClient = _useState4[0],
97
- setIsClient = _useState4[1];
98
- useEffect(function () {
99
- setIsClient(true);
100
- }, []);
101
-
102
- // Setting up our media queries to use once app is hydrated
103
- var mqSm = useMediaQuery('above.sm', function (event) {
104
- return setIsAboveSm(event.matches);
105
- });
106
- var _useState5 = useState(mqSm === null || mqSm === void 0 ? void 0 : mqSm.matches),
107
- _useState6 = _slicedToArray(_useState5, 2),
108
- isAboveSm = _useState6[0],
109
- setIsAboveSm = _useState6[1];
110
- var mqLg = useMediaQuery('above.lg', function (event) {
111
- return setIsAboveLg(event.matches);
112
- });
113
- var _useState7 = useState(mqLg === null || mqLg === void 0 ? void 0 : mqLg.matches),
114
- _useState8 = _slicedToArray(_useState7, 2),
115
- isAboveLg = _useState8[0],
116
- setIsAboveLg = _useState8[1];
117
-
118
- // Filter out any falsy items passed in
119
- var filteredItems = useMemo(function () {
120
- return React.Children.toArray(items).filter(function (item) {
121
- return !!item;
122
- });
123
- }, [items]);
124
- // NOTE: we could make these max items configurable in the future. For now
125
- // we are using sensible defaults. Anything over the max gets put in the
126
- // overflow menu for that screen size.
127
- // While it may be tempting to use more than 3 items for the medium nav when
128
- // you see the available space, you need to consider internationalistion.
129
- // 3 is the safe, defensive choice across many languages and scripts.
130
- var smallMaxItems = 0;
131
- var mediumMaxItems = 3;
132
- var largeMaxItems = 8;
133
-
134
- // We re-use this in both the CSS media query nav that loads in for SSR,
135
- // and the JS/hook media query nav that is used once hydrated
136
- var navItems = useMemo(function () {
137
- return {
138
- small: {
139
- navBarItems: [],
140
- overflowItems: filteredItems
141
- },
142
- medium: {
143
- navBarItems: filteredItems.slice(0, mediumMaxItems),
144
- overflowItems: filteredItems.slice(mediumMaxItems, filteredItems.length)
145
- },
146
- large: {
147
- navBarItems: filteredItems.slice(0, largeMaxItems),
148
- overflowItems: filteredItems.slice(largeMaxItems, filteredItems.length)
149
- }
150
- };
151
- }, [filteredItems]);
152
- var hydratedNavItems = useMemo(function () {
153
- if (isAboveLg) {
154
- return navItems.large;
155
- }
156
- if (isAboveSm && !isAboveLg) {
157
- return navItems.medium;
158
- }
159
- return navItems.small;
160
- }, [isAboveLg, isAboveSm, navItems.large, navItems.medium, navItems.small]);
161
- return /*#__PURE__*/React.createElement(React.Fragment, null, isClient ? /*#__PURE__*/React.createElement(Box, {
162
- role: "list",
163
- xcss: containerWrapperStyles
164
- }, /*#__PURE__*/React.createElement(Inline, {
165
- testId: testId && "".concat(testId, "-primary-actions"),
166
- xcss: sharedContainerStyles
167
- }, hydratedNavItems.navBarItems, hydratedNavItems.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
168
- moreLabel: moreLabel,
169
- items: hydratedNavItems.overflowItems,
170
- testId: testId
171
- }))) : /*#__PURE__*/React.createElement(Box, {
172
- role: "list",
173
- xcss: containerWrapperStyles
174
- }, /*#__PURE__*/React.createElement(Inline, {
175
- xcss: [sharedContainerStyles, smallContainerStyles]
176
- }, filteredItems.length > smallMaxItems &&
177
- /*#__PURE__*/
178
- // We don't need to pass items into popup, it won't be interactive (SSR only)
179
- React.createElement(MoreItemsPopup, {
180
- moreLabel: moreLabel,
181
- testId: testId
182
- })), /*#__PURE__*/React.createElement(Inline, {
183
- xcss: [sharedContainerStyles, mediumContainerStyles]
184
- }, navItems.medium.navBarItems, navItems.medium.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
185
- moreLabel: moreLabel,
186
- testId: testId
187
- })), /*#__PURE__*/React.createElement(Inline, {
188
- xcss: [sharedContainerStyles, largeContainerStyles]
189
- }, navItems.large.navBarItems, navItems.large.overflowItems.length > 0 && /*#__PURE__*/React.createElement(MoreItemsPopup, {
190
- moreLabel: moreLabel,
191
- testId: testId
192
- }))), Create && /*#__PURE__*/React.createElement(Create, null));
193
- });
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { type NavigationTheme } from '../../theme';
3
- import { type PrimaryItemsContainerProps } from '../PrimaryItemsContainer/types';
4
- export declare const PrimaryItemsContainer: React.MemoExoticComponent<({ moreLabel, items, create: Create, theme, testId, }: PrimaryItemsContainerProps & {
5
- theme: NavigationTheme;
6
- }) => JSX.Element>;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { type NavigationTheme } from '../../theme';
3
- import { type PrimaryItemsContainerProps } from '../PrimaryItemsContainer/types';
4
- export declare const PrimaryItemsContainer: React.MemoExoticComponent<({ moreLabel, items, create: Create, theme, testId, }: PrimaryItemsContainerProps & {
5
- theme: NavigationTheme;
6
- }) => JSX.Element>;