@atlaskit/side-nav-items 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @atlaskit/side-nav-items
2
2
 
3
+ ## 1.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`20e1df968ddc7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/20e1df968ddc7) -
8
+ Clean up feature gate platform-dst-buttonmenuitem-selected-state-support
9
+
3
10
  ## 1.4.1
4
11
 
5
12
  ### Patch Changes
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.ButtonMenuItem = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
9
  var _menuItem = require("./menu-item");
11
10
  var _menuListItem = require("./menu-list-item");
12
11
  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); }
@@ -51,10 +50,10 @@ var ButtonMenuItem = exports.ButtonMenuItem = /*#__PURE__*/(0, _react.forwardRef
51
50
  actions: isDisabled ? undefined : actions,
52
51
  actionsOnHover: isDisabled ? undefined : actionsOnHover,
53
52
  onClick: onClick,
54
- ariaControls: (0, _platformFeatureFlags.fg)('platform-dst-buttonmenuitem-selected-state-support') ? ariaControls : undefined,
55
- ariaExpanded: (0, _platformFeatureFlags.fg)('platform-dst-buttonmenuitem-selected-state-support') ? ariaExpanded : undefined,
56
- ariaHasPopup: (0, _platformFeatureFlags.fg)('platform-dst-buttonmenuitem-selected-state-support') ? ariaHasPopup : undefined,
57
- isSelected: (0, _platformFeatureFlags.fg)('platform-dst-buttonmenuitem-selected-state-support') ? isSelected : undefined,
53
+ ariaControls: ariaControls,
54
+ ariaExpanded: ariaExpanded,
55
+ ariaHasPopup: ariaHasPopup,
56
+ isSelected: isSelected,
58
57
  ref: forwardedRef,
59
58
  visualContentRef: visualContentRef,
60
59
  interactionName: interactionName,
@@ -13,7 +13,6 @@ var _runtime = require("@compiled/react/runtime");
13
13
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
15
  var _reactDom = require("react-dom");
16
- var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
17
16
  var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
18
17
  var _pointerOutsideOfPreview = require("@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview");
19
18
  var _setCustomNativeDragPreview = require("@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview");
@@ -54,7 +53,12 @@ function useMenuItemDragAndDrop(_ref) {
54
53
  return;
55
54
  }
56
55
  var element = getDraggableElement();
57
- (0, _tinyInvariant.default)(element, "draggableAnchorRef or draggableButtonRef not set");
56
+
57
+ // Some elements may initially want to use DnD, then decide not to render.
58
+ // In that case, we don't want to throw an error.
59
+ if (!element) {
60
+ return;
61
+ }
58
62
  return (0, _adapter.draggable)({
59
63
  element: element,
60
64
  getInitialData: draggableArgs.getInitialData,
@@ -105,7 +109,12 @@ function useMenuItemDragAndDrop(_ref) {
105
109
  // Using this element in our `canDrop` check
106
110
  var draggableElement = getDraggableElement();
107
111
  var dropTarget = dropTargetRef.current;
108
- (0, _tinyInvariant.default)(dropTarget, "dropTargetRef was not set");
112
+
113
+ // Some elements may initially want to use DnD, then decide not to render.
114
+ // In that case, we don't want to throw an error
115
+ if (!dropTarget) {
116
+ return;
117
+ }
109
118
  return (0, _adapter.dropTargetForElements)({
110
119
  element: dropTarget,
111
120
  // cannot drop on self
@@ -1,5 +1,4 @@
1
1
  import React, { forwardRef } from 'react';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { MenuItemBase } from './menu-item';
4
3
  import { MenuListItem } from './menu-list-item';
5
4
  /**
@@ -44,10 +43,10 @@ export const ButtonMenuItem = /*#__PURE__*/forwardRef(({
44
43
  actions: isDisabled ? undefined : actions,
45
44
  actionsOnHover: isDisabled ? undefined : actionsOnHover,
46
45
  onClick: onClick,
47
- ariaControls: fg('platform-dst-buttonmenuitem-selected-state-support') ? ariaControls : undefined,
48
- ariaExpanded: fg('platform-dst-buttonmenuitem-selected-state-support') ? ariaExpanded : undefined,
49
- ariaHasPopup: fg('platform-dst-buttonmenuitem-selected-state-support') ? ariaHasPopup : undefined,
50
- isSelected: fg('platform-dst-buttonmenuitem-selected-state-support') ? isSelected : undefined,
46
+ ariaControls: ariaControls,
47
+ ariaExpanded: ariaExpanded,
48
+ ariaHasPopup: ariaHasPopup,
49
+ isSelected: isSelected,
51
50
  ref: forwardedRef,
52
51
  visualContentRef: visualContentRef,
53
52
  interactionName: interactionName,
@@ -3,7 +3,6 @@ import * as React from 'react';
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
- import invariant from 'tiny-invariant';
7
6
  import { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
8
7
  import { pointerOutsideOfPreview } from '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview';
9
8
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
@@ -39,7 +38,12 @@ export function useMenuItemDragAndDrop({
39
38
  return;
40
39
  }
41
40
  const element = getDraggableElement();
42
- invariant(element, `draggableAnchorRef or draggableButtonRef not set`);
41
+
42
+ // Some elements may initially want to use DnD, then decide not to render.
43
+ // In that case, we don't want to throw an error.
44
+ if (!element) {
45
+ return;
46
+ }
43
47
  return draggable({
44
48
  element,
45
49
  getInitialData: draggableArgs.getInitialData,
@@ -92,7 +96,12 @@ export function useMenuItemDragAndDrop({
92
96
  // Using this element in our `canDrop` check
93
97
  const draggableElement = getDraggableElement();
94
98
  const dropTarget = dropTargetRef.current;
95
- invariant(dropTarget, `dropTargetRef was not set`);
99
+
100
+ // Some elements may initially want to use DnD, then decide not to render.
101
+ // In that case, we don't want to throw an error
102
+ if (!dropTarget) {
103
+ return;
104
+ }
96
105
  return dropTargetForElements({
97
106
  element: dropTarget,
98
107
  // cannot drop on self
@@ -1,5 +1,4 @@
1
1
  import React, { forwardRef } from 'react';
2
- import { fg } from '@atlaskit/platform-feature-flags';
3
2
  import { MenuItemBase } from './menu-item';
4
3
  import { MenuListItem } from './menu-list-item';
5
4
  /**
@@ -43,10 +42,10 @@ export var ButtonMenuItem = /*#__PURE__*/forwardRef(function (_ref, forwardedRef
43
42
  actions: isDisabled ? undefined : actions,
44
43
  actionsOnHover: isDisabled ? undefined : actionsOnHover,
45
44
  onClick: onClick,
46
- ariaControls: fg('platform-dst-buttonmenuitem-selected-state-support') ? ariaControls : undefined,
47
- ariaExpanded: fg('platform-dst-buttonmenuitem-selected-state-support') ? ariaExpanded : undefined,
48
- ariaHasPopup: fg('platform-dst-buttonmenuitem-selected-state-support') ? ariaHasPopup : undefined,
49
- isSelected: fg('platform-dst-buttonmenuitem-selected-state-support') ? isSelected : undefined,
45
+ ariaControls: ariaControls,
46
+ ariaExpanded: ariaExpanded,
47
+ ariaHasPopup: ariaHasPopup,
48
+ isSelected: isSelected,
50
49
  ref: forwardedRef,
51
50
  visualContentRef: visualContentRef,
52
51
  interactionName: interactionName,
@@ -7,7 +7,6 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
7
7
  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; }
8
8
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
9
9
  import { createPortal } from 'react-dom';
10
- import invariant from 'tiny-invariant';
11
10
  import { draggable, dropTargetForElements } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
12
11
  import { pointerOutsideOfPreview } from '@atlaskit/pragmatic-drag-and-drop/element/pointer-outside-of-preview';
13
12
  import { setCustomNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/set-custom-native-drag-preview';
@@ -45,7 +44,12 @@ export function useMenuItemDragAndDrop(_ref) {
45
44
  return;
46
45
  }
47
46
  var element = getDraggableElement();
48
- invariant(element, "draggableAnchorRef or draggableButtonRef not set");
47
+
48
+ // Some elements may initially want to use DnD, then decide not to render.
49
+ // In that case, we don't want to throw an error.
50
+ if (!element) {
51
+ return;
52
+ }
49
53
  return draggable({
50
54
  element: element,
51
55
  getInitialData: draggableArgs.getInitialData,
@@ -96,7 +100,12 @@ export function useMenuItemDragAndDrop(_ref) {
96
100
  // Using this element in our `canDrop` check
97
101
  var draggableElement = getDraggableElement();
98
102
  var dropTarget = dropTargetRef.current;
99
- invariant(dropTarget, "dropTargetRef was not set");
103
+
104
+ // Some elements may initially want to use DnD, then decide not to render.
105
+ // In that case, we don't want to throw an error
106
+ if (!dropTarget) {
107
+ return;
108
+ }
100
109
  return dropTargetForElements({
101
110
  element: dropTarget,
102
111
  // cannot drop on self
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/side-nav-items",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Menu items and elements for the navigation side nav area.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -57,10 +57,10 @@
57
57
  "@af/integration-testing": "workspace:^",
58
58
  "@af/visual-regression": "workspace:^",
59
59
  "@atlaskit/app-provider": "^4.0.0",
60
- "@atlaskit/lozenge": "^13.3.0",
60
+ "@atlaskit/lozenge": "^13.4.0",
61
61
  "@atlaskit/navigation-system": "^5.32.0",
62
62
  "@atlaskit/ssr": "workspace:^",
63
- "@atlassian/a11y-jest-testing": "^0.8.0",
63
+ "@atlassian/a11y-jest-testing": "^0.9.0",
64
64
  "@atlassian/feature-flags-test-utils": "^1.0.0",
65
65
  "@atlassian/testing-library": "^0.4.0",
66
66
  "@testing-library/react": "^16.3.0",
@@ -103,9 +103,6 @@
103
103
  }
104
104
  },
105
105
  "platform-feature-flags": {
106
- "platform-dst-buttonmenuitem-selected-state-support": {
107
- "type": "boolean"
108
- },
109
106
  "platform-dst-shape-theme-default": {
110
107
  "type": "boolean"
111
108
  },