@atlaskit/menu 2.11.0 → 2.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/menu
2
2
 
3
+ ## 2.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#128489](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/128489)
8
+ [`a88a2fe454eb9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a88a2fe454eb9) -
9
+ Updated LinkItem to not render a router link when the href is empty (e.g. href="" or
10
+ href={undefined}).
11
+
3
12
  ## 2.11.0
4
13
 
5
14
  ### Minor Changes
@@ -65,15 +65,17 @@ function (props, ref) {
65
65
  }
66
66
  var isExternal = typeof href === 'string' && IS_EXTERNAL_LINK_REGEX.test(href);
67
67
  var isNonHttpBased = typeof href === 'string' && IS_NON_HTTP_BASED.test(href);
68
+ var isEmptyHref = href == null || href === '';
68
69
 
69
70
  /**
70
71
  * Renders a router link if:
71
72
  *
72
73
  * - a link component is set in the app provider
73
74
  * - it's not an external link (starting with `http://` or `https://`)
74
- * - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
75
+ * - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.)
76
+ * - it doesn't have an empty href (e.g. href="" or href={undefined})
75
77
  */
76
- var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased;
78
+ var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
77
79
  var Component = isRouterLink && (0, _platformFeatureFlags.fg)('platform.wanjel.use-router-links-for-the-linkitem-component') ? RouterLink : 'a';
78
80
  (0, _deprecationWarning.propDeprecationWarning)("@atlaskit/menu" || '', 'cssFn', cssFn !== _noop.default, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
79
81
  );
@@ -60,15 +60,17 @@ const LinkItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(
60
60
  }
61
61
  const isExternal = typeof href === 'string' && IS_EXTERNAL_LINK_REGEX.test(href);
62
62
  const isNonHttpBased = typeof href === 'string' && IS_NON_HTTP_BASED.test(href);
63
+ const isEmptyHref = href == null || href === '';
63
64
 
64
65
  /**
65
66
  * Renders a router link if:
66
67
  *
67
68
  * - a link component is set in the app provider
68
69
  * - it's not an external link (starting with `http://` or `https://`)
69
- * - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
70
+ * - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.)
71
+ * - it doesn't have an empty href (e.g. href="" or href={undefined})
70
72
  */
71
- const isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased;
73
+ const isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
72
74
  const Component = isRouterLink && fg('platform.wanjel.use-router-links-for-the-linkitem-component') ? RouterLink : 'a';
73
75
  propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
74
76
  );
@@ -59,15 +59,17 @@ function (props, ref) {
59
59
  }
60
60
  var isExternal = typeof href === 'string' && IS_EXTERNAL_LINK_REGEX.test(href);
61
61
  var isNonHttpBased = typeof href === 'string' && IS_NON_HTTP_BASED.test(href);
62
+ var isEmptyHref = href == null || href === '';
62
63
 
63
64
  /**
64
65
  * Renders a router link if:
65
66
  *
66
67
  * - a link component is set in the app provider
67
68
  * - it's not an external link (starting with `http://` or `https://`)
68
- * - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.).
69
+ * - it's not a non-HTTP-based link (e.g. emails, phone numbers, hash links etc.)
70
+ * - it doesn't have an empty href (e.g. href="" or href={undefined})
69
71
  */
70
- var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased;
72
+ var isRouterLink = !UNSAFE_shouldDisableRouterLink && RouterLink && !isExternal && !isNonHttpBased && !isEmptyHref;
71
73
  var Component = isRouterLink && fg('platform.wanjel.use-router-links-for-the-linkitem-component') ? RouterLink : 'a';
72
74
  propDeprecationWarning("@atlaskit/menu" || '', 'cssFn', cssFn !== noop, '' // TODO: Create DAC post when primitives/xcss are available as alternatives
73
75
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/menu",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "description": "A list of options to help users navigate, or perform actions.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"