@atlaskit/navigation-system 7.1.6 → 7.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/ui/page-layout/top-nav/top-nav-start.compiled.css +1 -1
  3. package/dist/cjs/ui/page-layout/top-nav/top-nav-start.js +8 -2
  4. package/dist/cjs/ui/page-layout/top-nav/top-nav.compiled.css +1 -1
  5. package/dist/cjs/ui/page-layout/top-nav/top-nav.js +66 -7
  6. package/dist/cjs/ui/top-nav-items/themed/has-default-background-color-context.js +12 -0
  7. package/dist/cjs/ui/top-nav-items/themed/use-custom-theme.js +41 -0
  8. package/dist/es2019/ui/page-layout/top-nav/top-nav-start.compiled.css +1 -1
  9. package/dist/es2019/ui/page-layout/top-nav/top-nav-start.js +8 -2
  10. package/dist/es2019/ui/page-layout/top-nav/top-nav.compiled.css +1 -1
  11. package/dist/es2019/ui/page-layout/top-nav/top-nav.js +65 -5
  12. package/dist/es2019/ui/top-nav-items/themed/has-default-background-color-context.js +7 -0
  13. package/dist/es2019/ui/top-nav-items/themed/use-custom-theme.js +38 -0
  14. package/dist/esm/ui/page-layout/top-nav/top-nav-start.compiled.css +1 -1
  15. package/dist/esm/ui/page-layout/top-nav/top-nav-start.js +8 -2
  16. package/dist/esm/ui/page-layout/top-nav/top-nav.compiled.css +1 -1
  17. package/dist/esm/ui/page-layout/top-nav/top-nav.js +64 -5
  18. package/dist/esm/ui/top-nav-items/themed/has-default-background-color-context.js +7 -0
  19. package/dist/esm/ui/top-nav-items/themed/use-custom-theme.js +39 -0
  20. package/dist/types/ui/page-layout/top-nav/top-nav.d.ts +7 -5
  21. package/dist/types/ui/top-nav-items/themed/has-default-background-color-context.d.ts +5 -0
  22. package/dist/types/ui/top-nav-items/themed/use-custom-theme.d.ts +11 -0
  23. package/dist/types-ts4.5/ui/page-layout/top-nav/top-nav.d.ts +7 -5
  24. package/dist/types-ts4.5/ui/top-nav-items/themed/has-default-background-color-context.d.ts +5 -0
  25. package/dist/types-ts4.5/ui/top-nav-items/themed/use-custom-theme.d.ts +11 -0
  26. package/package.json +18 -14
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlassian/navigation-system
2
2
 
3
+ ## 7.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`71834d94559e2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/71834d94559e2) -
8
+ Implements custom theming support when the full height sidebar is enabled. This change is behind
9
+ the `platform_dst_nav4_custom_theming_fhs_1` feature gate.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 7.1.7
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 7.1.6
4
22
 
5
23
  ### Patch Changes
@@ -12,5 +12,5 @@
12
12
  ._vchhusvi{box-sizing:border-box}
13
13
  [dir=rtl] ._65m41mrw{--animation-direction:-1}
14
14
  @media (prefers-reduced-motion:no-preference){._10t81e03{transition-property:transform}._10t81rjc{transition-property:transform,opacity}._1xq51ytf{transition-timing-function:ease-in-out}._1xq55ucs{transition-timing-function:ease}._mjvc1efy{transform:translateX(calc(100%*var(--animation-direction)))}._bgpzidpf{opacity:0}._mjvc1p9u{transform:translateX(calc(-100%*var(--animation-direction)))}._mjvco0k7{transform:translateX(calc((-2rem + var(--ds-space-050, 4px)*-1)*var(--animation-direction)))}._mjvcyrjp{transform:translateX(calc((2rem + var(--ds-space-050, 4px))*var(--animation-direction)))}._mjvcz12g{transform:translateX(0)}._xrrpfnf5{transition-duration:.2s}._bgpzkb7n{opacity:1}}
15
- @media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._glte93mn{width:var(--n_sNvlw,100%)}._exxmutpp{padding-inline-end:var(--ds-space-150,9pt)}._4ap3vuon{background-color:var(--ds-surface,#fff)}._m7c3kb7n:after{opacity:1}}
15
+ @media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}._4ap319ly{background-color:revert}._1m5lglyw:after{display:none}._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._glte93mn{width:var(--n_sNvlw,100%)}._exxmutpp{padding-inline-end:var(--ds-space-150,9pt)}._4ap3vuon{background-color:var(--ds-surface,#fff)}._m7c3kb7n:after{opacity:1}}
16
16
  @media (prefers-reduced-motion:no-preference) and (min-width:64rem){._n8qabrmi:after{transition-property:opacity}._wc72fnf5:after{transition-duration:.2s}._j3mr1v42:after{transition-timing-function:ease-in}}
@@ -13,9 +13,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _useStableRef = _interopRequireDefault(require("@atlaskit/ds-lib/use-stable-ref"));
15
15
  var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
16
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _compiled = require("@atlaskit/primitives/compiled");
17
18
  var _topNavStartContext = require("../../../context/top-nav-start/top-nav-start-context");
18
19
  var _useIsFhsEnabled = require("../../fhs-rollout/use-is-fhs-enabled");
20
+ var _hasCustomThemeContext = require("../../top-nav-items/themed/has-custom-theme-context");
21
+ var _hasDefaultBackgroundColorContext = require("../../top-nav-items/themed/has-default-background-color-context");
19
22
  var _constants = require("../constants");
20
23
  var _useSideNavVisibility3 = require("../side-nav/use-side-nav-visibility");
21
24
  var _visibilityContext = require("../side-nav/visibility-context");
@@ -52,7 +55,8 @@ var innerStyles = {
52
55
  var wrapperStyles = {
53
56
  root: "_vchhusvi _bozgutpp _4t3i1osq _13wnh2mm _1l3vb3bt _juxdstnw _1vinidpf _1719idpf _e6znidpf _1kyhe4h9 _4cwynqa1 _435s1l7x _m7c3idpf",
54
57
  fullHeightSidebarExpanded: "_glte93mn _exxmutpp _4ap3vuon _m7c3kb7n",
55
- fullHeightSidebarBorderTransition: "_n8qabrmi _wc72fnf5 _j3mr1v42"
58
+ fullHeightSidebarBorderTransition: "_n8qabrmi _wc72fnf5 _j3mr1v42",
59
+ fullHeightSidebarCustomTheming: "_4ap319ly _1m5lglyw"
56
60
  };
57
61
 
58
62
  /**
@@ -133,8 +137,10 @@ var TopNavStartInnerFHS = /*#__PURE__*/(0, _react.forwardRef)(function TopNavSta
133
137
  isFirstRenderRef.current = false;
134
138
  }
135
139
  }, [sideNavState]);
140
+ var hasCustomTheme = (0, _hasCustomThemeContext.useHasCustomTheme)();
141
+ var hasDefaultBackgroundColor = (0, _react.useContext)(_hasDefaultBackgroundColorContext.HasDefaultBackgroundColorContext);
136
142
  return /*#__PURE__*/_react.default.createElement("div", {
137
- className: (0, _runtime.ax)([wrapperStyles.root, isExpandedOnDesktop && wrapperStyles.fullHeightSidebarExpanded, !isFirstRenderRef.current && isExpandedOnDesktop && wrapperStyles.fullHeightSidebarBorderTransition])
143
+ className: (0, _runtime.ax)([wrapperStyles.root, isExpandedOnDesktop && wrapperStyles.fullHeightSidebarExpanded, !isFirstRenderRef.current && isExpandedOnDesktop && wrapperStyles.fullHeightSidebarBorderTransition, hasCustomTheme && !hasDefaultBackgroundColor && (0, _platformFeatureFlags.fg)('platform_dst_nav4_custom_theming_fhs_1') && wrapperStyles.fullHeightSidebarCustomTheming])
138
144
  }, /*#__PURE__*/_react.default.createElement("div", {
139
145
  ref: ref,
140
146
  "data-testid": testId,
@@ -25,5 +25,5 @@
25
25
  ._vchhusvi{box-sizing:border-box}
26
26
  ._yv0e1mfv{grid-template-columns:auto 1fr auto}
27
27
  @media (min-width:48rem){._1j8b18ax{grid-template-columns:1fr minmax(min-content,max-content) 1fr}}
28
- @media (min-width:64rem){._1rqt16a9{grid-template-columns:0fr minmax(min-content,max-content) 1fr}._pdlmutpp{gap:var(--ds-space-150,9pt)}}
28
+ @media (min-width:64rem){._1m5lglyw:after{display:none}._1rqt16a9{grid-template-columns:0fr minmax(min-content,max-content) 1fr}._pdlmutpp{gap:var(--ds-space-150,9pt)}}
29
29
  @media (min-width:110.5rem){._jh1g18ax{grid-template-columns:1fr minmax(min-content,max-content) 1fr}}
@@ -5,21 +5,23 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.TopNav = TopNav;
8
+ exports.TopNav = void 0;
9
9
  require("./top-nav.compiled.css");
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var React = _react;
12
12
  var _runtime = require("@compiled/react/runtime");
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
+ var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
14
15
  var _skipLinksContext = require("../../../context/skip-links/skip-links-context");
15
16
  var _useIsFhsEnabled = require("../../fhs-rollout/use-is-fhs-enabled");
16
17
  var _hasCustomThemeContext = require("../../top-nav-items/themed/has-custom-theme-context");
18
+ var _hasDefaultBackgroundColorContext = require("../../top-nav-items/themed/has-default-background-color-context");
17
19
  var _useCustomTheme = require("../../top-nav-items/themed/use-custom-theme");
18
20
  var _constants = require("../constants");
19
21
  var _hoistSlotSizesContext = require("../hoist-slot-sizes-context");
20
22
  var _hoistUtils = require("../hoist-utils");
21
23
  var _idUtils = require("../id-utils");
22
- var _useSideNavVisibility2 = require("../side-nav/use-side-nav-visibility");
24
+ var _useSideNavVisibility3 = require("../side-nav/use-side-nav-visibility");
23
25
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
26
  /**
25
27
  * Styles for the container for the top nav items.
@@ -32,13 +34,13 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
32
34
  var styles = {
33
35
  root: "_nd5l8cbt _zulpu2gc _18zrutpp _179ria51 _1e0c11p5 _yv0e1mfv _4cvr1h6o _bfhkvuon _vchhusvi _4t3i1dgc _152t1nws _kqsw1if8 _1pbyegat _d6vu1bgi _1j8b18ax",
34
36
  fullHeightSidebar: "_18zrze3t _179rglyw _lcxv1wug _bfhkvuon _1pby11wp _aetrb3bt _18postnw _1gufidpf _1czdidpf _g0nf3tht _1beue4h9 _uaeunqa1 _1cte1l7x _pdlmutpp",
35
- fullHeightSidebarExpanded: "_1rqt16a9 _jh1g18ax"
37
+ fullHeightSidebarExpanded: "_1rqt16a9 _jh1g18ax",
38
+ fullHeightSidebarCustomTheming: "_1m5lglyw"
36
39
  };
37
-
38
40
  /**
39
41
  * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
40
42
  */
41
- function TopNav(_ref) {
43
+ function TopNavOld(_ref) {
42
44
  var children = _ref.children,
43
45
  xcss = _ref.xcss,
44
46
  heightProp = _ref.height,
@@ -56,7 +58,7 @@ function TopNav(_ref) {
56
58
  var hasIncreasedDefaultHeight = isFhsEnabled && (0, _platformFeatureFlags.fg)('platform_dst_nav4_top_nav_increase_height');
57
59
  var height = heightProp !== null && heightProp !== void 0 ? heightProp : hasIncreasedDefaultHeight ? 56 : 48;
58
60
  var customTheme = (0, _useCustomTheme.useCustomTheme)(UNSAFE_theme);
59
- var _useSideNavVisibility = (0, _useSideNavVisibility2.useSideNavVisibility)(),
61
+ var _useSideNavVisibility = (0, _useSideNavVisibility3.useSideNavVisibility)(),
60
62
  isExpandedOnDesktop = _useSideNavVisibility.isExpandedOnDesktop;
61
63
  return /*#__PURE__*/React.createElement(_hasCustomThemeContext.HasCustomThemeContext.Provider, {
62
64
  value: customTheme.isEnabled
@@ -82,4 +84,61 @@ function TopNav(_ref) {
82
84
  })
83
85
  // ------ END UNSAFE STYLES ------
84
86
  , children));
85
- }
87
+ }
88
+
89
+ /**
90
+ * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
91
+ */
92
+ function TopNavNew(_ref2) {
93
+ var children = _ref2.children,
94
+ xcss = _ref2.xcss,
95
+ heightProp = _ref2.height,
96
+ _ref2$skipLinkLabel = _ref2.skipLinkLabel,
97
+ skipLinkLabel = _ref2$skipLinkLabel === void 0 ? 'Top Bar' : _ref2$skipLinkLabel,
98
+ testId = _ref2.testId,
99
+ providedId = _ref2.id,
100
+ UNSAFE_theme = _ref2.UNSAFE_theme;
101
+ var isFhsEnabled = (0, _useIsFhsEnabled.useIsFhsEnabled)();
102
+ var dangerouslyHoistSlotSizes = (0, _react.useContext)(_hoistSlotSizesContext.DangerouslyHoistSlotSizes);
103
+ var id = (0, _idUtils.useLayoutId)({
104
+ providedId: providedId
105
+ });
106
+ (0, _skipLinksContext.useSkipLink)(id, skipLinkLabel);
107
+ var hasIncreasedDefaultHeight = isFhsEnabled && (0, _platformFeatureFlags.fg)('platform_dst_nav4_top_nav_increase_height');
108
+ var height = heightProp !== null && heightProp !== void 0 ? heightProp : hasIncreasedDefaultHeight ? 56 : 48;
109
+ var customTheme = (0, _useCustomTheme.useCustomThemeNew)(UNSAFE_theme);
110
+ var hasDefaultBackground = customTheme.isEnabled ? customTheme.hasDefaultBackground : true;
111
+ var _useSideNavVisibility2 = (0, _useSideNavVisibility3.useSideNavVisibility)(),
112
+ isExpandedOnDesktop = _useSideNavVisibility2.isExpandedOnDesktop;
113
+ return /*#__PURE__*/React.createElement(_hasCustomThemeContext.HasCustomThemeContext.Provider, {
114
+ value: customTheme.isEnabled
115
+ }, /*#__PURE__*/React.createElement(_hasDefaultBackgroundColorContext.HasDefaultBackgroundColorContext.Provider, {
116
+ value: hasDefaultBackground
117
+ }, /*#__PURE__*/React.createElement("header", {
118
+ id: id,
119
+ "data-layout-slot": true,
120
+ className: (0, _runtime.ax)([styles.root, isFhsEnabled && styles.fullHeightSidebar, isExpandedOnDesktop && isFhsEnabled && styles.fullHeightSidebarExpanded, customTheme.isEnabled && !hasDefaultBackground && (0, _platformFeatureFlags.fg)('platform_dst_nav4_custom_theming_fhs_1') && styles.fullHeightSidebarCustomTheming, xcss]),
121
+ "data-testid": testId
122
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
123
+ ,
124
+ style: customTheme.isEnabled ? customTheme.style : undefined
125
+ }, /*#__PURE__*/React.createElement(_hoistUtils.HoistCssVarToLocalGrid, {
126
+ variableName: _constants.topNavMountedVar,
127
+ value: height
128
+ }), dangerouslyHoistSlotSizes &&
129
+ /*#__PURE__*/
130
+ // ------ START UNSAFE STYLES ------
131
+ // These styles are only needed for the UNSAFE legacy use case for Jira + Confluence.
132
+ // When they aren't needed anymore we can delete them wholesale.
133
+ React.createElement(_hoistUtils.DangerouslyHoistCssVarToDocumentRoot, {
134
+ variableName: _constants.UNSAFE_topNavVar,
135
+ value: height
136
+ })
137
+ // ------ END UNSAFE STYLES ------
138
+ , children)));
139
+ }
140
+
141
+ /**
142
+ * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
143
+ */
144
+ var TopNav = exports.TopNav = (0, _platformFeatureFlagsReact.componentWithFG)('platform_dst_nav4_custom_theming_fhs_1', TopNavNew, TopNavOld);
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.HasDefaultBackgroundColorContext = void 0;
7
+ var _react = require("react");
8
+ /**
9
+ * Context to let components know if the top nav background color is the default background color,
10
+ * even while a custom theme is being applied.
11
+ */
12
+ var HasDefaultBackgroundColorContext = exports.HasDefaultBackgroundColorContext = /*#__PURE__*/(0, _react.createContext)(true);
@@ -1,11 +1,52 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.useCustomTheme = useCustomTheme;
8
+ exports.useCustomThemeNew = useCustomThemeNew;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
7
10
  var _react = require("react");
11
+ var _appProvider = require("@atlaskit/app-provider");
12
+ var _tokens = require("@atlaskit/tokens");
13
+ var _hex = require("./color-utils/formats/hex");
8
14
  var _getCustomThemeStyles = require("./get-custom-theme-styles");
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ function toRGBString(_ref) {
18
+ var r = _ref.r,
19
+ g = _ref.g,
20
+ b = _ref.b;
21
+ return "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")");
22
+ }
23
+
24
+ // TODO: Fill in the hook {description}.
25
+ /**
26
+ * {description}.
27
+ */
28
+ function useCustomThemeNew(theme) {
29
+ var value = useCustomTheme(theme);
30
+
31
+ /**
32
+ * We use the color mode to determine the default background color for the top nav.
33
+ * We need to use the hook because the user could change their color mode preference.
34
+ */
35
+ var colorMode = (0, _appProvider.useColorMode)();
36
+ var hasDefaultBackground = (0, _react.useMemo)(function () {
37
+ if (!value.isEnabled) {
38
+ return true;
39
+ }
40
+ var defaultBackground = (0, _hex.parseHex)((0, _tokens.getTokenValue)('elevation.surface', colorMode === 'light' ? '#FFFFFF' : '#1F1F21'));
41
+ return defaultBackground ? value.style.backgroundColor === toRGBString(defaultBackground) : true;
42
+ }, [value, colorMode]);
43
+ if (value.isEnabled) {
44
+ return _objectSpread(_objectSpread({}, value), {}, {
45
+ hasDefaultBackground: hasDefaultBackground
46
+ });
47
+ }
48
+ return value;
49
+ }
9
50
  /**
10
51
  * Processes the provided theme and returns theme styles if possible.
11
52
  */
@@ -12,5 +12,5 @@
12
12
  ._vchhusvi{box-sizing:border-box}
13
13
  [dir=rtl] ._65m41mrw{--animation-direction:-1}
14
14
  @media (prefers-reduced-motion:no-preference){._10t81e03{transition-property:transform}._10t81rjc{transition-property:transform,opacity}._1xq51ytf{transition-timing-function:ease-in-out}._1xq55ucs{transition-timing-function:ease}._mjvc1efy{transform:translateX(calc(100%*var(--animation-direction)))}._bgpzidpf{opacity:0}._mjvc1p9u{transform:translateX(calc(-100%*var(--animation-direction)))}._mjvco0k7{transform:translateX(calc((-2rem + var(--ds-space-050, 4px)*-1)*var(--animation-direction)))}._mjvcyrjp{transform:translateX(calc((2rem + var(--ds-space-050, 4px))*var(--animation-direction)))}._mjvcz12g{transform:translateX(0)}._xrrpfnf5{transition-duration:.2s}._bgpzkb7n{opacity:1}}
15
- @media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._glte93mn{width:var(--n_sNvlw,100%)}._exxmutpp{padding-inline-end:var(--ds-space-150,9pt)}._4ap3vuon{background-color:var(--ds-surface,#fff)}._m7c3kb7n:after{opacity:1}}
15
+ @media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}._4ap319ly{background-color:revert}._1m5lglyw:after{display:none}._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._glte93mn{width:var(--n_sNvlw,100%)}._exxmutpp{padding-inline-end:var(--ds-space-150,9pt)}._4ap3vuon{background-color:var(--ds-surface,#fff)}._m7c3kb7n:after{opacity:1}}
16
16
  @media (prefers-reduced-motion:no-preference) and (min-width:64rem){._n8qabrmi:after{transition-property:opacity}._wc72fnf5:after{transition-duration:.2s}._j3mr1v42:after{transition-timing-function:ease-in}}
@@ -4,9 +4,12 @@ import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { forwardRef, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
5
5
  import useStableRef from '@atlaskit/ds-lib/use-stable-ref';
6
6
  import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { UNSAFE_useMediaQuery } from '@atlaskit/primitives/compiled';
8
9
  import { TopNavStartAttachRef } from '../../../context/top-nav-start/top-nav-start-context';
9
10
  import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
11
+ import { useHasCustomTheme } from '../../top-nav-items/themed/has-custom-theme-context';
12
+ import { HasDefaultBackgroundColorContext } from '../../top-nav-items/themed/has-default-background-color-context';
10
13
  import { openLayerObserverTopNavStartNamespace } from '../constants';
11
14
  import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
12
15
  import { SideNavVisibilityState } from '../side-nav/visibility-context';
@@ -43,7 +46,8 @@ const innerStyles = {
43
46
  const wrapperStyles = {
44
47
  root: "_vchhusvi _bozgutpp _4t3i1osq _13wnh2mm _1l3vb3bt _juxdstnw _1vinidpf _1719idpf _e6znidpf _1kyhe4h9 _4cwynqa1 _435s1l7x _m7c3idpf",
45
48
  fullHeightSidebarExpanded: "_glte93mn _exxmutpp _4ap3vuon _m7c3kb7n",
46
- fullHeightSidebarBorderTransition: "_n8qabrmi _wc72fnf5 _j3mr1v42"
49
+ fullHeightSidebarBorderTransition: "_n8qabrmi _wc72fnf5 _j3mr1v42",
50
+ fullHeightSidebarCustomTheming: "_4ap319ly _1m5lglyw"
47
51
  };
48
52
 
49
53
  /**
@@ -127,8 +131,10 @@ const TopNavStartInnerFHS = /*#__PURE__*/forwardRef(function TopNavStartInnerFHS
127
131
  isFirstRenderRef.current = false;
128
132
  }
129
133
  }, [sideNavState]);
134
+ const hasCustomTheme = useHasCustomTheme();
135
+ const hasDefaultBackgroundColor = useContext(HasDefaultBackgroundColorContext);
130
136
  return /*#__PURE__*/React.createElement("div", {
131
- className: ax([wrapperStyles.root, isExpandedOnDesktop && wrapperStyles.fullHeightSidebarExpanded, !isFirstRenderRef.current && isExpandedOnDesktop && wrapperStyles.fullHeightSidebarBorderTransition])
137
+ className: ax([wrapperStyles.root, isExpandedOnDesktop && wrapperStyles.fullHeightSidebarExpanded, !isFirstRenderRef.current && isExpandedOnDesktop && wrapperStyles.fullHeightSidebarBorderTransition, hasCustomTheme && !hasDefaultBackgroundColor && fg('platform_dst_nav4_custom_theming_fhs_1') && wrapperStyles.fullHeightSidebarCustomTheming])
132
138
  }, /*#__PURE__*/React.createElement("div", {
133
139
  ref: ref,
134
140
  "data-testid": testId,
@@ -25,5 +25,5 @@
25
25
  ._vchhusvi{box-sizing:border-box}
26
26
  ._yv0e1mfv{grid-template-columns:auto 1fr auto}
27
27
  @media (min-width:48rem){._1j8b18ax{grid-template-columns:1fr minmax(min-content,max-content) 1fr}}
28
- @media (min-width:64rem){._1rqt16a9{grid-template-columns:0fr minmax(min-content,max-content) 1fr}._pdlmutpp{gap:var(--ds-space-150,9pt)}}
28
+ @media (min-width:64rem){._1m5lglyw:after{display:none}._1rqt16a9{grid-template-columns:0fr minmax(min-content,max-content) 1fr}._pdlmutpp{gap:var(--ds-space-150,9pt)}}
29
29
  @media (min-width:110.5rem){._jh1g18ax{grid-template-columns:1fr minmax(min-content,max-content) 1fr}}
@@ -4,10 +4,12 @@ import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useContext } from 'react';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
7
8
  import { useSkipLink } from '../../../context/skip-links/skip-links-context';
8
9
  import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
9
10
  import { HasCustomThemeContext } from '../../top-nav-items/themed/has-custom-theme-context';
10
- import { useCustomTheme } from '../../top-nav-items/themed/use-custom-theme';
11
+ import { HasDefaultBackgroundColorContext } from '../../top-nav-items/themed/has-default-background-color-context';
12
+ import { useCustomTheme, useCustomThemeNew } from '../../top-nav-items/themed/use-custom-theme';
11
13
  import { bannerMountedVar, localSlotLayers, sideNavLiveWidthVar, topNavMountedVar, UNSAFE_topNavVar } from '../constants';
12
14
  import { DangerouslyHoistSlotSizes } from '../hoist-slot-sizes-context';
13
15
  import { DangerouslyHoistCssVarToDocumentRoot, HoistCssVarToLocalGrid } from '../hoist-utils';
@@ -24,13 +26,13 @@ import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
24
26
  const styles = {
25
27
  root: "_nd5l8cbt _zulpu2gc _18zrutpp _179ria51 _1e0c11p5 _yv0e1mfv _4cvr1h6o _bfhkvuon _vchhusvi _4t3i1dgc _152t1nws _kqsw1if8 _1pbyegat _d6vu1bgi _1j8b18ax",
26
28
  fullHeightSidebar: "_18zrze3t _179rglyw _lcxv1wug _bfhkvuon _1pby11wp _aetrb3bt _18postnw _1gufidpf _1czdidpf _g0nf3tht _1beue4h9 _uaeunqa1 _1cte1l7x _pdlmutpp",
27
- fullHeightSidebarExpanded: "_1rqt16a9 _jh1g18ax"
29
+ fullHeightSidebarExpanded: "_1rqt16a9 _jh1g18ax",
30
+ fullHeightSidebarCustomTheming: "_1m5lglyw"
28
31
  };
29
-
30
32
  /**
31
33
  * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
32
34
  */
33
- export function TopNav({
35
+ function TopNavOld({
34
36
  children,
35
37
  xcss,
36
38
  height: heightProp,
@@ -75,4 +77,62 @@ export function TopNav({
75
77
  })
76
78
  // ------ END UNSAFE STYLES ------
77
79
  , children));
78
- }
80
+ }
81
+
82
+ /**
83
+ * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
84
+ */
85
+ function TopNavNew({
86
+ children,
87
+ xcss,
88
+ height: heightProp,
89
+ skipLinkLabel = 'Top Bar',
90
+ testId,
91
+ id: providedId,
92
+ UNSAFE_theme
93
+ }) {
94
+ const isFhsEnabled = useIsFhsEnabled();
95
+ const dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
96
+ const id = useLayoutId({
97
+ providedId
98
+ });
99
+ useSkipLink(id, skipLinkLabel);
100
+ const hasIncreasedDefaultHeight = isFhsEnabled && fg('platform_dst_nav4_top_nav_increase_height');
101
+ const height = heightProp !== null && heightProp !== void 0 ? heightProp : hasIncreasedDefaultHeight ? 56 : 48;
102
+ const customTheme = useCustomThemeNew(UNSAFE_theme);
103
+ const hasDefaultBackground = customTheme.isEnabled ? customTheme.hasDefaultBackground : true;
104
+ const {
105
+ isExpandedOnDesktop
106
+ } = useSideNavVisibility();
107
+ return /*#__PURE__*/React.createElement(HasCustomThemeContext.Provider, {
108
+ value: customTheme.isEnabled
109
+ }, /*#__PURE__*/React.createElement(HasDefaultBackgroundColorContext.Provider, {
110
+ value: hasDefaultBackground
111
+ }, /*#__PURE__*/React.createElement("header", {
112
+ id: id,
113
+ "data-layout-slot": true,
114
+ className: ax([styles.root, isFhsEnabled && styles.fullHeightSidebar, isExpandedOnDesktop && isFhsEnabled && styles.fullHeightSidebarExpanded, customTheme.isEnabled && !hasDefaultBackground && fg('platform_dst_nav4_custom_theming_fhs_1') && styles.fullHeightSidebarCustomTheming, xcss]),
115
+ "data-testid": testId
116
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
117
+ ,
118
+ style: customTheme.isEnabled ? customTheme.style : undefined
119
+ }, /*#__PURE__*/React.createElement(HoistCssVarToLocalGrid, {
120
+ variableName: topNavMountedVar,
121
+ value: height
122
+ }), dangerouslyHoistSlotSizes &&
123
+ /*#__PURE__*/
124
+ // ------ START UNSAFE STYLES ------
125
+ // These styles are only needed for the UNSAFE legacy use case for Jira + Confluence.
126
+ // When they aren't needed anymore we can delete them wholesale.
127
+ React.createElement(DangerouslyHoistCssVarToDocumentRoot, {
128
+ variableName: UNSAFE_topNavVar,
129
+ value: height
130
+ })
131
+ // ------ END UNSAFE STYLES ------
132
+ , children)));
133
+ }
134
+
135
+ /**
136
+ * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
137
+ */
138
+ export const TopNav = componentWithFG('platform_dst_nav4_custom_theming_fhs_1', TopNavNew, TopNavOld);
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ /**
4
+ * Context to let components know if the top nav background color is the default background color,
5
+ * even while a custom theme is being applied.
6
+ */
7
+ export const HasDefaultBackgroundColorContext = /*#__PURE__*/createContext(true);
@@ -1,5 +1,43 @@
1
1
  import { useMemo } from 'react';
2
+ import { useColorMode } from '@atlaskit/app-provider';
3
+ import { getTokenValue } from '@atlaskit/tokens';
4
+ import { parseHex } from './color-utils/formats/hex';
2
5
  import { getCustomThemeStyles } from './get-custom-theme-styles';
6
+ function toRGBString({
7
+ r,
8
+ g,
9
+ b
10
+ }) {
11
+ return `rgb(${r}, ${g}, ${b})`;
12
+ }
13
+
14
+ // TODO: Fill in the hook {description}.
15
+ /**
16
+ * {description}.
17
+ */
18
+ export function useCustomThemeNew(theme) {
19
+ const value = useCustomTheme(theme);
20
+
21
+ /**
22
+ * We use the color mode to determine the default background color for the top nav.
23
+ * We need to use the hook because the user could change their color mode preference.
24
+ */
25
+ const colorMode = useColorMode();
26
+ const hasDefaultBackground = useMemo(() => {
27
+ if (!value.isEnabled) {
28
+ return true;
29
+ }
30
+ const defaultBackground = parseHex(getTokenValue('elevation.surface', colorMode === 'light' ? '#FFFFFF' : '#1F1F21'));
31
+ return defaultBackground ? value.style.backgroundColor === toRGBString(defaultBackground) : true;
32
+ }, [value, colorMode]);
33
+ if (value.isEnabled) {
34
+ return {
35
+ ...value,
36
+ hasDefaultBackground
37
+ };
38
+ }
39
+ return value;
40
+ }
3
41
  /**
4
42
  * Processes the provided theme and returns theme styles if possible.
5
43
  */
@@ -12,5 +12,5 @@
12
12
  ._vchhusvi{box-sizing:border-box}
13
13
  [dir=rtl] ._65m41mrw{--animation-direction:-1}
14
14
  @media (prefers-reduced-motion:no-preference){._10t81e03{transition-property:transform}._10t81rjc{transition-property:transform,opacity}._1xq51ytf{transition-timing-function:ease-in-out}._1xq55ucs{transition-timing-function:ease}._mjvc1efy{transform:translateX(calc(100%*var(--animation-direction)))}._bgpzidpf{opacity:0}._mjvc1p9u{transform:translateX(calc(-100%*var(--animation-direction)))}._mjvco0k7{transform:translateX(calc((-2rem + var(--ds-space-050, 4px)*-1)*var(--animation-direction)))}._mjvcyrjp{transform:translateX(calc((2rem + var(--ds-space-050, 4px))*var(--animation-direction)))}._mjvcz12g{transform:translateX(0)}._xrrpfnf5{transition-duration:.2s}._bgpzkb7n{opacity:1}}
15
- @media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._glte93mn{width:var(--n_sNvlw,100%)}._exxmutpp{padding-inline-end:var(--ds-space-150,9pt)}._4ap3vuon{background-color:var(--ds-surface,#fff)}._m7c3kb7n:after{opacity:1}}
15
+ @media (min-width:64rem){._13wnh2mm{position:relative}._1l3vb3bt:after{content:""}._juxdstnw:after{position:absolute}._1vinidpf:after{inset-block-start:0}._1719idpf:after{inset-block-end:0}._e6znidpf:after{inset-inline-end:0}._1kyhe4h9:after{border-inline-end-width:var(--ds-border-width,1px)}._4cwynqa1:after{border-inline-end-style:solid}._435s1l7x:after{border-inline-end-color:var(--ds-border,#0b120e24)}._m7c3idpf:after{opacity:0}._15rin7od{min-width:unset}._glte1osq{width:100%}._4ap319ly{background-color:revert}._1m5lglyw:after{display:none}._glte1ris{width:max-content}._15rip2n4{min-width:330px}._1gs5usvi{box-sizing:border-box}._glte93mn{width:var(--n_sNvlw,100%)}._exxmutpp{padding-inline-end:var(--ds-space-150,9pt)}._4ap3vuon{background-color:var(--ds-surface,#fff)}._m7c3kb7n:after{opacity:1}}
16
16
  @media (prefers-reduced-motion:no-preference) and (min-width:64rem){._n8qabrmi:after{transition-property:opacity}._wc72fnf5:after{transition-duration:.2s}._j3mr1v42:after{transition-timing-function:ease-in}}
@@ -5,9 +5,12 @@ import { ax, ix } from "@compiled/react/runtime";
5
5
  import React, { forwardRef, useContext, useEffect, useLayoutEffect, useRef, useState } from 'react';
6
6
  import useStableRef from '@atlaskit/ds-lib/use-stable-ref';
7
7
  import { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer';
8
+ import { fg } from '@atlaskit/platform-feature-flags';
8
9
  import { UNSAFE_useMediaQuery } from '@atlaskit/primitives/compiled';
9
10
  import { TopNavStartAttachRef } from '../../../context/top-nav-start/top-nav-start-context';
10
11
  import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
12
+ import { useHasCustomTheme } from '../../top-nav-items/themed/has-custom-theme-context';
13
+ import { HasDefaultBackgroundColorContext } from '../../top-nav-items/themed/has-default-background-color-context';
11
14
  import { openLayerObserverTopNavStartNamespace } from '../constants';
12
15
  import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
13
16
  import { SideNavVisibilityState } from '../side-nav/visibility-context';
@@ -44,7 +47,8 @@ var innerStyles = {
44
47
  var wrapperStyles = {
45
48
  root: "_vchhusvi _bozgutpp _4t3i1osq _13wnh2mm _1l3vb3bt _juxdstnw _1vinidpf _1719idpf _e6znidpf _1kyhe4h9 _4cwynqa1 _435s1l7x _m7c3idpf",
46
49
  fullHeightSidebarExpanded: "_glte93mn _exxmutpp _4ap3vuon _m7c3kb7n",
47
- fullHeightSidebarBorderTransition: "_n8qabrmi _wc72fnf5 _j3mr1v42"
50
+ fullHeightSidebarBorderTransition: "_n8qabrmi _wc72fnf5 _j3mr1v42",
51
+ fullHeightSidebarCustomTheming: "_4ap319ly _1m5lglyw"
48
52
  };
49
53
 
50
54
  /**
@@ -125,8 +129,10 @@ var TopNavStartInnerFHS = /*#__PURE__*/forwardRef(function TopNavStartInnerFHS(_
125
129
  isFirstRenderRef.current = false;
126
130
  }
127
131
  }, [sideNavState]);
132
+ var hasCustomTheme = useHasCustomTheme();
133
+ var hasDefaultBackgroundColor = useContext(HasDefaultBackgroundColorContext);
128
134
  return /*#__PURE__*/React.createElement("div", {
129
- className: ax([wrapperStyles.root, isExpandedOnDesktop && wrapperStyles.fullHeightSidebarExpanded, !isFirstRenderRef.current && isExpandedOnDesktop && wrapperStyles.fullHeightSidebarBorderTransition])
135
+ className: ax([wrapperStyles.root, isExpandedOnDesktop && wrapperStyles.fullHeightSidebarExpanded, !isFirstRenderRef.current && isExpandedOnDesktop && wrapperStyles.fullHeightSidebarBorderTransition, hasCustomTheme && !hasDefaultBackgroundColor && fg('platform_dst_nav4_custom_theming_fhs_1') && wrapperStyles.fullHeightSidebarCustomTheming])
130
136
  }, /*#__PURE__*/React.createElement("div", {
131
137
  ref: ref,
132
138
  "data-testid": testId,
@@ -25,5 +25,5 @@
25
25
  ._vchhusvi{box-sizing:border-box}
26
26
  ._yv0e1mfv{grid-template-columns:auto 1fr auto}
27
27
  @media (min-width:48rem){._1j8b18ax{grid-template-columns:1fr minmax(min-content,max-content) 1fr}}
28
- @media (min-width:64rem){._1rqt16a9{grid-template-columns:0fr minmax(min-content,max-content) 1fr}._pdlmutpp{gap:var(--ds-space-150,9pt)}}
28
+ @media (min-width:64rem){._1m5lglyw:after{display:none}._1rqt16a9{grid-template-columns:0fr minmax(min-content,max-content) 1fr}._pdlmutpp{gap:var(--ds-space-150,9pt)}}
29
29
  @media (min-width:110.5rem){._jh1g18ax{grid-template-columns:1fr minmax(min-content,max-content) 1fr}}
@@ -4,10 +4,12 @@ import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { useContext } from 'react';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { componentWithFG } from '@atlaskit/platform-feature-flags-react';
7
8
  import { useSkipLink } from '../../../context/skip-links/skip-links-context';
8
9
  import { useIsFhsEnabled } from '../../fhs-rollout/use-is-fhs-enabled';
9
10
  import { HasCustomThemeContext } from '../../top-nav-items/themed/has-custom-theme-context';
10
- import { useCustomTheme } from '../../top-nav-items/themed/use-custom-theme';
11
+ import { HasDefaultBackgroundColorContext } from '../../top-nav-items/themed/has-default-background-color-context';
12
+ import { useCustomTheme, useCustomThemeNew } from '../../top-nav-items/themed/use-custom-theme';
11
13
  import { bannerMountedVar, localSlotLayers, sideNavLiveWidthVar, topNavMountedVar, UNSAFE_topNavVar } from '../constants';
12
14
  import { DangerouslyHoistSlotSizes } from '../hoist-slot-sizes-context';
13
15
  import { DangerouslyHoistCssVarToDocumentRoot, HoistCssVarToLocalGrid } from '../hoist-utils';
@@ -24,13 +26,13 @@ import { useSideNavVisibility } from '../side-nav/use-side-nav-visibility';
24
26
  var styles = {
25
27
  root: "_nd5l8cbt _zulpu2gc _18zrutpp _179ria51 _1e0c11p5 _yv0e1mfv _4cvr1h6o _bfhkvuon _vchhusvi _4t3i1dgc _152t1nws _kqsw1if8 _1pbyegat _d6vu1bgi _1j8b18ax",
26
28
  fullHeightSidebar: "_18zrze3t _179rglyw _lcxv1wug _bfhkvuon _1pby11wp _aetrb3bt _18postnw _1gufidpf _1czdidpf _g0nf3tht _1beue4h9 _uaeunqa1 _1cte1l7x _pdlmutpp",
27
- fullHeightSidebarExpanded: "_1rqt16a9 _jh1g18ax"
29
+ fullHeightSidebarExpanded: "_1rqt16a9 _jh1g18ax",
30
+ fullHeightSidebarCustomTheming: "_1m5lglyw"
28
31
  };
29
-
30
32
  /**
31
33
  * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
32
34
  */
33
- export function TopNav(_ref) {
35
+ function TopNavOld(_ref) {
34
36
  var children = _ref.children,
35
37
  xcss = _ref.xcss,
36
38
  heightProp = _ref.height,
@@ -74,4 +76,61 @@ export function TopNav(_ref) {
74
76
  })
75
77
  // ------ END UNSAFE STYLES ------
76
78
  , children));
77
- }
79
+ }
80
+
81
+ /**
82
+ * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
83
+ */
84
+ function TopNavNew(_ref2) {
85
+ var children = _ref2.children,
86
+ xcss = _ref2.xcss,
87
+ heightProp = _ref2.height,
88
+ _ref2$skipLinkLabel = _ref2.skipLinkLabel,
89
+ skipLinkLabel = _ref2$skipLinkLabel === void 0 ? 'Top Bar' : _ref2$skipLinkLabel,
90
+ testId = _ref2.testId,
91
+ providedId = _ref2.id,
92
+ UNSAFE_theme = _ref2.UNSAFE_theme;
93
+ var isFhsEnabled = useIsFhsEnabled();
94
+ var dangerouslyHoistSlotSizes = useContext(DangerouslyHoistSlotSizes);
95
+ var id = useLayoutId({
96
+ providedId: providedId
97
+ });
98
+ useSkipLink(id, skipLinkLabel);
99
+ var hasIncreasedDefaultHeight = isFhsEnabled && fg('platform_dst_nav4_top_nav_increase_height');
100
+ var height = heightProp !== null && heightProp !== void 0 ? heightProp : hasIncreasedDefaultHeight ? 56 : 48;
101
+ var customTheme = useCustomThemeNew(UNSAFE_theme);
102
+ var hasDefaultBackground = customTheme.isEnabled ? customTheme.hasDefaultBackground : true;
103
+ var _useSideNavVisibility2 = useSideNavVisibility(),
104
+ isExpandedOnDesktop = _useSideNavVisibility2.isExpandedOnDesktop;
105
+ return /*#__PURE__*/React.createElement(HasCustomThemeContext.Provider, {
106
+ value: customTheme.isEnabled
107
+ }, /*#__PURE__*/React.createElement(HasDefaultBackgroundColorContext.Provider, {
108
+ value: hasDefaultBackground
109
+ }, /*#__PURE__*/React.createElement("header", {
110
+ id: id,
111
+ "data-layout-slot": true,
112
+ className: ax([styles.root, isFhsEnabled && styles.fullHeightSidebar, isExpandedOnDesktop && isFhsEnabled && styles.fullHeightSidebarExpanded, customTheme.isEnabled && !hasDefaultBackground && fg('platform_dst_nav4_custom_theming_fhs_1') && styles.fullHeightSidebarCustomTheming, xcss]),
113
+ "data-testid": testId
114
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
115
+ ,
116
+ style: customTheme.isEnabled ? customTheme.style : undefined
117
+ }, /*#__PURE__*/React.createElement(HoistCssVarToLocalGrid, {
118
+ variableName: topNavMountedVar,
119
+ value: height
120
+ }), dangerouslyHoistSlotSizes &&
121
+ /*#__PURE__*/
122
+ // ------ START UNSAFE STYLES ------
123
+ // These styles are only needed for the UNSAFE legacy use case for Jira + Confluence.
124
+ // When they aren't needed anymore we can delete them wholesale.
125
+ React.createElement(DangerouslyHoistCssVarToDocumentRoot, {
126
+ variableName: UNSAFE_topNavVar,
127
+ value: height
128
+ })
129
+ // ------ END UNSAFE STYLES ------
130
+ , children)));
131
+ }
132
+
133
+ /**
134
+ * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
135
+ */
136
+ export var TopNav = componentWithFG('platform_dst_nav4_custom_theming_fhs_1', TopNavNew, TopNavOld);
@@ -0,0 +1,7 @@
1
+ import { createContext } from 'react';
2
+
3
+ /**
4
+ * Context to let components know if the top nav background color is the default background color,
5
+ * even while a custom theme is being applied.
6
+ */
7
+ export var HasDefaultBackgroundColorContext = /*#__PURE__*/createContext(true);
@@ -1,5 +1,44 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1
4
  import { useMemo } from 'react';
5
+ import { useColorMode } from '@atlaskit/app-provider';
6
+ import { getTokenValue } from '@atlaskit/tokens';
7
+ import { parseHex } from './color-utils/formats/hex';
2
8
  import { getCustomThemeStyles } from './get-custom-theme-styles';
9
+ function toRGBString(_ref) {
10
+ var r = _ref.r,
11
+ g = _ref.g,
12
+ b = _ref.b;
13
+ return "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")");
14
+ }
15
+
16
+ // TODO: Fill in the hook {description}.
17
+ /**
18
+ * {description}.
19
+ */
20
+ export function useCustomThemeNew(theme) {
21
+ var value = useCustomTheme(theme);
22
+
23
+ /**
24
+ * We use the color mode to determine the default background color for the top nav.
25
+ * We need to use the hook because the user could change their color mode preference.
26
+ */
27
+ var colorMode = useColorMode();
28
+ var hasDefaultBackground = useMemo(function () {
29
+ if (!value.isEnabled) {
30
+ return true;
31
+ }
32
+ var defaultBackground = parseHex(getTokenValue('elevation.surface', colorMode === 'light' ? '#FFFFFF' : '#1F1F21'));
33
+ return defaultBackground ? value.style.backgroundColor === toRGBString(defaultBackground) : true;
34
+ }, [value, colorMode]);
35
+ if (value.isEnabled) {
36
+ return _objectSpread(_objectSpread({}, value), {}, {
37
+ hasDefaultBackground: hasDefaultBackground
38
+ });
39
+ }
40
+ return value;
41
+ }
3
42
  /**
4
43
  * Processes the provided theme and returns theme styles if possible.
5
44
  */
@@ -1,10 +1,7 @@
1
1
  import type { StrictXCSSProp } from '@atlaskit/css';
2
2
  import { type CustomTheme } from '../../top-nav-items/themed/get-custom-theme-styles';
3
3
  import type { CommonSlotProps } from '../types';
4
- /**
5
- * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
6
- */
7
- export declare function TopNav({ children, xcss, height: heightProp, skipLinkLabel, testId, id: providedId, UNSAFE_theme, }: CommonSlotProps & {
4
+ type TopNavProps = CommonSlotProps & {
8
5
  /**
9
6
  * The content of the layout area.
10
7
  * Should include `TopNavStart`, `TopNavMiddle`, and `TopNavEnd`.
@@ -25,4 +22,9 @@ export declare function TopNav({ children, xcss, height: heightProp, skipLinkLab
25
22
  * Feature is incomplete and API is subject to change at any time
26
23
  */
27
24
  UNSAFE_theme?: CustomTheme;
28
- }): JSX.Element;
25
+ };
26
+ /**
27
+ * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
28
+ */
29
+ export declare const TopNav: (props: TopNavProps) => React.ReactNode;
30
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Context to let components know if the top nav background color is the default background color,
3
+ * even while a custom theme is being applied.
4
+ */
5
+ export declare const HasDefaultBackgroundColorContext: import('react').Context<boolean>;
@@ -1,4 +1,15 @@
1
1
  import { type CustomTheme } from './get-custom-theme-styles';
2
+ type ResultNew = {
3
+ isEnabled: false;
4
+ } | {
5
+ isEnabled: true;
6
+ style: React.CSSProperties;
7
+ hasDefaultBackground: boolean;
8
+ };
9
+ /**
10
+ * {description}.
11
+ */
12
+ export declare function useCustomThemeNew(theme: CustomTheme | undefined): ResultNew;
2
13
  type Result = {
3
14
  isEnabled: false;
4
15
  } | {
@@ -1,10 +1,7 @@
1
1
  import type { StrictXCSSProp } from '@atlaskit/css';
2
2
  import { type CustomTheme } from '../../top-nav-items/themed/get-custom-theme-styles';
3
3
  import type { CommonSlotProps } from '../types';
4
- /**
5
- * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
6
- */
7
- export declare function TopNav({ children, xcss, height: heightProp, skipLinkLabel, testId, id: providedId, UNSAFE_theme, }: CommonSlotProps & {
4
+ type TopNavProps = CommonSlotProps & {
8
5
  /**
9
6
  * The content of the layout area.
10
7
  * Should include `TopNavStart`, `TopNavMiddle`, and `TopNavEnd`.
@@ -25,4 +22,9 @@ export declare function TopNav({ children, xcss, height: heightProp, skipLinkLab
25
22
  * Feature is incomplete and API is subject to change at any time
26
23
  */
27
24
  UNSAFE_theme?: CustomTheme;
28
- }): JSX.Element;
25
+ };
26
+ /**
27
+ * The top nav layout area. It will display at the top of the screen, below the banner if one is present.
28
+ */
29
+ export declare const TopNav: (props: TopNavProps) => React.ReactNode;
30
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Context to let components know if the top nav background color is the default background color,
3
+ * even while a custom theme is being applied.
4
+ */
5
+ export declare const HasDefaultBackgroundColorContext: import('react').Context<boolean>;
@@ -1,4 +1,15 @@
1
1
  import { type CustomTheme } from './get-custom-theme-styles';
2
+ type ResultNew = {
3
+ isEnabled: false;
4
+ } | {
5
+ isEnabled: true;
6
+ style: React.CSSProperties;
7
+ hasDefaultBackground: boolean;
8
+ };
9
+ /**
10
+ * {description}.
11
+ */
12
+ export declare function useCustomThemeNew(theme: CustomTheme | undefined): ResultNew;
2
13
  type Result = {
3
14
  isEnabled: false;
4
15
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/navigation-system",
3
- "version": "7.1.6",
3
+ "version": "7.2.0",
4
4
  "description": "The latest navigation system for Atlassian apps.",
5
5
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
6
6
  "author": "Atlassian Pty Ltd",
@@ -71,19 +71,21 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@atlaskit/analytics-next": "^11.2.0",
74
+ "@atlaskit/app-provider": "^4.2.0",
74
75
  "@atlaskit/avatar": "^25.11.0",
75
- "@atlaskit/button": "^23.10.0",
76
+ "@atlaskit/button": "^23.11.0",
76
77
  "@atlaskit/css": "^0.19.0",
77
- "@atlaskit/ds-lib": "^6.0.0",
78
+ "@atlaskit/ds-lib": "^7.0.0",
78
79
  "@atlaskit/icon": "^34.0.0",
79
80
  "@atlaskit/layering": "^3.6.0",
80
- "@atlaskit/logo": "^19.10.0",
81
+ "@atlaskit/logo": "^20.0.0",
81
82
  "@atlaskit/platform-feature-flags": "^1.1.0",
83
+ "@atlaskit/platform-feature-flags-react": "^0.4.0",
82
84
  "@atlaskit/popup": "^4.16.0",
83
85
  "@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
84
86
  "@atlaskit/primitives": "^18.1.0",
85
- "@atlaskit/side-nav-items": "^1.12.0",
86
- "@atlaskit/tokens": "^11.4.0",
87
+ "@atlaskit/side-nav-items": "^1.13.0",
88
+ "@atlaskit/tokens": "^12.0.0",
87
89
  "@atlaskit/tooltip": "^21.1.0",
88
90
  "@atlaskit/visually-hidden": "^3.0.0",
89
91
  "@babel/runtime": "^7.0.0",
@@ -100,17 +102,16 @@
100
102
  "@af/accessibility-testing": "workspace:^",
101
103
  "@af/integration-testing": "workspace:^",
102
104
  "@af/visual-regression": "workspace:^",
103
- "@atlaskit/app-provider": "^4.2.0",
104
105
  "@atlaskit/badge": "^18.4.0",
105
106
  "@atlaskit/banner": "^14.0.0",
106
107
  "@atlaskit/breadcrumbs": "^16.0.0",
107
108
  "@atlaskit/dropdown-menu": "^16.8.0",
108
109
  "@atlaskit/form": "^15.5.0",
109
- "@atlaskit/heading": "^5.3.0",
110
- "@atlaskit/link": "^3.3.0",
111
- "@atlaskit/lozenge": "^13.5.0",
110
+ "@atlaskit/heading": "^5.4.0",
111
+ "@atlaskit/link": "^3.4.0",
112
+ "@atlaskit/lozenge": "^13.6.0",
112
113
  "@atlaskit/menu": "^8.4.0",
113
- "@atlaskit/modal-dialog": "^14.14.0",
114
+ "@atlaskit/modal-dialog": "^14.15.0",
114
115
  "@atlaskit/onboarding": "^14.5.0",
115
116
  "@atlaskit/page-header": "^12.1.0",
116
117
  "@atlaskit/page-layout": "^4.2.0",
@@ -118,11 +119,11 @@
118
119
  "@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.0",
119
120
  "@atlaskit/select": "^21.10.0",
120
121
  "@atlaskit/skeleton": "^2.1.0",
121
- "@atlaskit/textfield": "^8.2.0",
122
+ "@atlaskit/textfield": "^8.3.0",
122
123
  "@atlassian/feature-flags-test-utils": "^1.0.0",
123
- "@atlassian/gemini": "^1.41.0",
124
+ "@atlassian/gemini": "^1.43.0",
124
125
  "@atlassian/react-compiler-gating": "workspace:^",
125
- "@atlassian/search-dialog": "^9.20.0",
126
+ "@atlassian/search-dialog": "^9.21.0",
126
127
  "@atlassian/ssr-tests": "workspace:^",
127
128
  "@atlassian/test-utils": "^1.0.0",
128
129
  "@atlassian/testing-library": "^0.5.0",
@@ -182,6 +183,9 @@
182
183
  },
183
184
  "navx-4418-fix-effect-state-updates-in-gsn": {
184
185
  "type": "boolean"
186
+ },
187
+ "platform_dst_nav4_custom_theming_fhs_1": {
188
+ "type": "boolean"
185
189
  }
186
190
  },
187
191
  "homepage": "https://atlassian.design/components/navigation-system"