diff --git a/package.json b/package.json index 4cc7f23974933..2a52266dfced0 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "@elastic/datemath": "5.0.3", "@elastic/elasticsearch": "npm:@elastic/elasticsearch@8.9.0", "@elastic/ems-client": "8.4.0", - "@elastic/eui": "85.1.0", + "@elastic/eui": "86.0.0", "@elastic/filesaver": "1.1.2", "@elastic/node-crypto": "1.2.1", "@elastic/numeral": "^2.5.1", @@ -123,6 +123,7 @@ "@hapi/hoek": "^9.2.1", "@hapi/inert": "^6.0.4", "@hapi/wreck": "^17.1.0", + "@hello-pangea/dnd": "^16.3.0", "@juggle/resize-observer": "^3.4.0", "@kbn/aad-fixtures-plugin": "link:x-pack/test/alerting_api_integration/common/plugins/aad", "@kbn/ace": "link:packages/kbn-ace", @@ -824,6 +825,7 @@ "copy-to-clipboard": "^3.0.8", "core-js": "^3.31.0", "cronstrue": "^1.51.0", + "css-box-model": "^1.2.1", "cuid": "^2.1.8", "cytoscape": "^3.10.0", "cytoscape-dagre": "^2.2.2", @@ -943,7 +945,6 @@ "re2": "1.20.1", "react": "^17.0.2", "react-ace": "^7.0.5", - "react-beautiful-dnd": "^13.1.0", "react-color": "^2.13.8", "react-dom": "^17.0.2", "react-dropzone": "^4.2.9", @@ -1329,7 +1330,6 @@ "@types/prop-types": "^15.7.5", "@types/rbush": "^3.0.0", "@types/react": "^17.0.45", - "@types/react-beautiful-dnd": "^13.0.0", "@types/react-dom": "^17.0.17", "@types/react-grid-layout": "^1.3.2", "@types/react-intl": "^2.3.15", diff --git a/packages/core/integrations/core-integrations-browser-internal/src/styles/disable_animations.css b/packages/core/integrations/core-integrations-browser-internal/src/styles/disable_animations.css index 55cd2018bfcfd..649a646f917ea 100644 --- a/packages/core/integrations/core-integrations-browser-internal/src/styles/disable_animations.css +++ b/packages/core/integrations/core-integrations-browser-internal/src/styles/disable_animations.css @@ -1,5 +1,5 @@ /** - * `react-beautiful-dnd` relies on `transition` for functionality + * `@hello-pangea/dnd` relies on `transition` for functionality * https://github.com/elastic/kibana/issues/95133 */ *:not(.essentialAnimation):not([data-rbd-draggable-context-id]):not([data-rbd-droppable-context-id]), diff --git a/packages/kbn-securitysolution-t-grid/src/utils/drag_and_drop/index.ts b/packages/kbn-securitysolution-t-grid/src/utils/drag_and_drop/index.ts index 91b2e88d97358..a50d251886a91 100644 --- a/packages/kbn-securitysolution-t-grid/src/utils/drag_and_drop/index.ts +++ b/packages/kbn-securitysolution-t-grid/src/utils/drag_and_drop/index.ts @@ -6,7 +6,7 @@ * Side Public License, v 1. */ -import type { DropResult } from 'react-beautiful-dnd'; +import type { DropResult } from '@hello-pangea/dnd'; export const draggableIdPrefix = 'draggableId'; diff --git a/packages/kbn-ui-shared-deps-npm/BUILD.bazel b/packages/kbn-ui-shared-deps-npm/BUILD.bazel index 3b6cf5f0dfeda..61569ac39c41d 100644 --- a/packages/kbn-ui-shared-deps-npm/BUILD.bazel +++ b/packages/kbn-ui-shared-deps-npm/BUILD.bazel @@ -24,6 +24,8 @@ SRCS = glob( # deps needed when importing this module from another location RUNTIME_DEPS = [ + "@npm//babel-loader", + "@npm//@babel/plugin-proposal-optional-chaining", "@npm//loader-utils", "@npm//val-loader", "//packages/kbn-repo-info", @@ -40,6 +42,7 @@ RUNTIME_DEPS = [ "@npm//@elastic/numeral", "@npm//@emotion/cache", "@npm//@emotion/react", + "@npm//@hello-pangea/dnd", "@npm//@tanstack/react-query", "@npm//@tanstack/react-query-devtools", "@npm//classnames", @@ -49,7 +52,6 @@ RUNTIME_DEPS = [ "@npm//lodash", "@npm//moment-timezone", "@npm//react-ace", - "@npm//react-beautiful-dnd", "@npm//react-dom", "@npm//react-router-dom", "@npm//react-router-dom-v5-compat", diff --git a/packages/kbn-ui-shared-deps-npm/webpack.config.js b/packages/kbn-ui-shared-deps-npm/webpack.config.js index 6aa06bfd40977..21eb15d016f7b 100644 --- a/packages/kbn-ui-shared-deps-npm/webpack.config.js +++ b/packages/kbn-ui-shared-deps-npm/webpack.config.js @@ -83,6 +83,7 @@ module.exports = (_, argv) => { '@elastic/numeral', '@emotion/cache', '@emotion/react', + '@hello-pangea/dnd/dist/dnd.js', '@tanstack/react-query', '@tanstack/react-query-devtools', 'classnames', @@ -96,7 +97,6 @@ module.exports = (_, argv) => { 'moment-timezone/data/packed/latest.json', 'moment', 'react-ace', - 'react-beautiful-dnd', 'react-dom', 'react-dom/server', 'react-router-dom', @@ -138,6 +138,19 @@ module.exports = (_, argv) => { }, ], }, + // @hello-pangea/dnd emits optional chaining that confuses webpack. + // We need to transform it using babel before going further + { + test: /@hello-pangea\/dnd\/dist\/dnd\.js$/, + use: [ + { + loader: 'babel-loader', + options: { + plugins: [require.resolve('@babel/plugin-proposal-optional-chaining')], + }, + }, + ], + }, { test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader'], diff --git a/packages/kbn-ui-shared-deps-src/src/definitions.js b/packages/kbn-ui-shared-deps-src/src/definitions.js index 33ab7601dc86a..08e5355a3f444 100644 --- a/packages/kbn-ui-shared-deps-src/src/definitions.js +++ b/packages/kbn-ui-shared-deps-src/src/definitions.js @@ -72,7 +72,7 @@ const externals = { '@elastic/eui/dist/eui_charts_theme': '__kbnSharedDeps__.ElasticEuiChartsTheme', // transient dep of eui - 'react-beautiful-dnd': '__kbnSharedDeps__.ReactBeautifulDnD', + '@hello-pangea/dnd': '__kbnSharedDeps__.HelloPangeaDnd', lodash: '__kbnSharedDeps__.Lodash', 'lodash/fp': '__kbnSharedDeps__.LodashFp', fflate: '__kbnSharedDeps__.Fflate', diff --git a/packages/kbn-ui-shared-deps-src/src/entry.js b/packages/kbn-ui-shared-deps-src/src/entry.js index bb77344c5b0c7..ac203abadb39a 100644 --- a/packages/kbn-ui-shared-deps-src/src/entry.js +++ b/packages/kbn-ui-shared-deps-src/src/entry.js @@ -46,7 +46,7 @@ export const ElasticEuiLibServices = require('@elastic/eui/optimize/es/services' export const ElasticEuiLibServicesFormat = require('@elastic/eui/optimize/es/services/format'); export const ElasticEuiChartsTheme = require('@elastic/eui/dist/eui_charts_theme'); export const KbnDatemath = require('@kbn/datemath'); -export const ReactBeautifulDnD = require('react-beautiful-dnd'); +export const HelloPangeaDnd = require('@hello-pangea/dnd/dist/dnd'); export const Lodash = require('lodash'); export const LodashFp = require('lodash/fp'); diff --git a/packages/kbn-visualization-ui-components/components/drag_drop_bucket/types.ts b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/types.ts index 2185b15a264ff..fa63682a05c32 100644 --- a/packages/kbn-visualization-ui-components/components/drag_drop_bucket/types.ts +++ b/packages/kbn-visualization-ui-components/components/drag_drop_bucket/types.ts @@ -7,7 +7,7 @@ */ import React from 'react'; -import type { DraggableProvided } from 'react-beautiful-dnd'; +import type { DraggableProvided } from '@hello-pangea/dnd'; export interface BucketContainerProps { children: React.ReactNode; diff --git a/packages/shared-ux/markdown/impl/__snapshots__/markdown.test.tsx.snap b/packages/shared-ux/markdown/impl/__snapshots__/markdown.test.tsx.snap index 11550b77fa169..08642cface949 100644 --- a/packages/shared-ux/markdown/impl/__snapshots__/markdown.test.tsx.snap +++ b/packages/shared-ux/markdown/impl/__snapshots__/markdown.test.tsx.snap @@ -209,7 +209,7 @@ exports[`shared ux markdown component renders for editor 1`] = ` id="generated-id" placeholder="" rows="6" - style="height:100%;max-height:" + style="height:100%" />
diff --git a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/droppable_wrapper.tsx b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/droppable_wrapper.tsx index dc3c963a8adfb..d0b1ce4eca211 100644 --- a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/droppable_wrapper.tsx +++ b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/droppable_wrapper.tsx @@ -7,8 +7,8 @@ import { rgba } from 'polished'; import React, { useCallback } from 'react'; -import type { DraggableChildrenFn } from 'react-beautiful-dnd'; -import { Droppable } from 'react-beautiful-dnd'; +import type { DraggableChildrenFn } from '@hello-pangea/dnd'; +import { Droppable } from '@hello-pangea/dnd'; import styled from 'styled-components'; interface Props { diff --git a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/helpers.test.ts b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/helpers.test.ts index a91eb66a83c55..e65bc6a1e431a 100644 --- a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/helpers.test.ts +++ b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/helpers.test.ts @@ -6,7 +6,7 @@ */ import { omit } from 'lodash/fp'; -import type { DropResult } from 'react-beautiful-dnd'; +import type { DropResult } from '@hello-pangea/dnd'; import type { IdToDataProvider } from '../../store/drag_and_drop/model'; @@ -86,6 +86,7 @@ describe('helpers', () => { source: { index: 0, droppableId: getDroppableId('2119990039033485') }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(true); }); @@ -99,6 +100,7 @@ describe('helpers', () => { source: { index: 0, droppableId: `${droppableIdPrefix}.somethingElse.2119990039033485` }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -197,6 +199,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(true); }); @@ -216,6 +219,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -237,6 +241,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(true); }); @@ -244,7 +249,7 @@ describe('helpers', () => { test('it returns false when the destination is undefined', () => { expect( destinationIsTimelineProviders({ - destination: undefined, + destination: null, draggableId: getDraggableId('685260508808089'), reason: 'DROP', source: { @@ -253,6 +258,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -272,6 +278,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -293,6 +300,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(true); }); @@ -300,7 +308,7 @@ describe('helpers', () => { test('it returns returns false when the destination is undefined', () => { expect( destinationIsTimelineColumns({ - destination: undefined, + destination: null, draggableId: getDraggableFieldId({ contextId: 'test', fieldId: 'event.action' }), reason: 'DROP', source: { @@ -309,6 +317,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -328,6 +337,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -349,6 +359,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(true); }); @@ -356,7 +367,7 @@ describe('helpers', () => { test('it returns false when the destination is undefined', () => { expect( destinationIsTimelineButton({ - destination: undefined, + destination: null, draggableId: getDraggableId('685260508808089'), reason: 'DROP', source: { @@ -365,6 +376,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -384,6 +396,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -404,6 +417,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }); const expected = '2119990039033485'; @@ -426,6 +440,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }); const expected = 'event.action'; @@ -449,6 +464,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(true); }); @@ -468,6 +484,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -475,7 +492,7 @@ describe('helpers', () => { test('it returns false when the draggable is NOT content', () => { expect( providerWasDroppedOnTimeline({ - destination: undefined, + destination: null, draggableId: `${draggableIdPrefix}.timeline.timeline.dataProvider.685260508808089`, reason: 'DROP', source: { @@ -484,6 +501,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -497,6 +515,7 @@ describe('helpers', () => { source: { index: 0, droppableId: `${droppableIdPrefix}.somethingElse.2119990039033485` }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -516,6 +535,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -537,6 +557,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(true); }); @@ -556,6 +577,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -575,6 +597,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -594,6 +617,7 @@ describe('helpers', () => { }, type: 'DEFAULT', mode: 'FLUID', + combine: null, }) ).toEqual(false); }); @@ -777,6 +801,7 @@ describe('helpers', () => { reason: 'DROP', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.0' }, type: 'DEFAULT', + combine: null, }; expect(sourceAndDestinationAreSameTimelineProviders(result)).toBe(true); @@ -791,6 +816,7 @@ describe('helpers', () => { reason: 'DROP', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.1' }, type: 'DEFAULT', + combine: null, }; expect(sourceAndDestinationAreSameTimelineProviders(result)).toBe(true); @@ -798,12 +824,14 @@ describe('helpers', () => { test('it returns false when destination is undefined', () => { const result: DropResult = { + destination: null, draggableId: 'draggableId.timelineProviders.timeline-1.group.0.port-default-draggable-netflow-renderer-timeline-1-Ib4zD3IBbNV0npT21btr-Ib4zD3IBbNV0npT21btr-source_port-57828', mode: 'FLUID', reason: 'DROP', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.1' }, type: 'DEFAULT', + combine: null, }; expect(sourceAndDestinationAreSameTimelineProviders(result)).toBe(false); @@ -818,6 +846,7 @@ describe('helpers', () => { reason: 'DROP', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-2.group.0' }, type: 'DEFAULT', + combine: null, }; expect(sourceAndDestinationAreSameTimelineProviders(result)).toBe(false); @@ -832,6 +861,7 @@ describe('helpers', () => { reason: 'DROP', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.0' }, type: 'DEFAULT', + combine: null, }; expect(sourceAndDestinationAreSameTimelineProviders(result)).toBe(false); @@ -846,6 +876,7 @@ describe('helpers', () => { reason: 'DROP', source: { index: 0, droppableId: 'droppableId.otherProviders.timeline-1.group.0' }, type: 'DEFAULT', + combine: null, }; expect(sourceAndDestinationAreSameTimelineProviders(result)).toBe(false); @@ -862,6 +893,7 @@ describe('helpers', () => { reason: 'DROP', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.0' }, type: 'DEFAULT', + combine: null, }; expect(userIsReArrangingProviders(result)).toBe(true); @@ -876,6 +908,7 @@ describe('helpers', () => { reason: 'DROP', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.0' }, type: 'DEFAULT', + combine: null, }; expect(userIsReArrangingProviders(result)).toBe(false); @@ -890,6 +923,7 @@ describe('helpers', () => { reason: 'CANCEL', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.0' }, type: 'DEFAULT', + combine: null, }; expect(userIsReArrangingProviders(result)).toBe(false); @@ -904,6 +938,7 @@ describe('helpers', () => { reason: 'CANCEL', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.0' }, type: 'DEFAULT', + combine: null, }; expect(userIsReArrangingProviders(result)).toBe(false); @@ -911,12 +946,14 @@ describe('helpers', () => { test('it returns false when reason IS DROP, but destination is undefined', () => { const result: DropResult = { + destination: null, draggableId: 'draggableId.timelineProviders.timeline-1.group.0.port-default-draggable-netflow-renderer-timeline-1-Ib4zD3IBbNV0npT21btr-Ib4zD3IBbNV0npT21btr-source_port-57828', mode: 'FLUID', reason: 'DROP', source: { index: 0, droppableId: 'droppableId.timelineProviders.timeline-1.group.1' }, type: 'DEFAULT', + combine: null, }; expect(userIsReArrangingProviders(result)).toBe(false); @@ -931,6 +968,7 @@ describe('helpers', () => { reason: 'DROP', source: { index: 0, droppableId: 'droppableId.content.hosts-table-hostName-ENDPOINT-W-0-01' }, type: 'DEFAULT', + combine: null, }; test('it dispatches the expected UPDATE_PROVIDERS action when the provider to add exists in the `dataProviders` collection of `id -> `DataProvider`', () => { diff --git a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/helpers.ts b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/helpers.ts index e98e9afebb0a2..ae0a417e5e32a 100644 --- a/x-pack/plugins/security_solution/public/common/components/drag_and_drop/helpers.ts +++ b/x-pack/plugins/security_solution/public/common/components/drag_and_drop/helpers.ts @@ -5,7 +5,7 @@ * 2.0. */ import { isString, keyBy } from 'lodash/fp'; -import type { DropResult } from 'react-beautiful-dnd'; +import type { DropResult } from '@hello-pangea/dnd'; import type { Dispatch } from 'redux'; import type { ActionCreator } from 'typescript-fsa'; diff --git a/x-pack/plugins/security_solution/public/common/components/hover_actions/index.tsx b/x-pack/plugins/security_solution/public/common/components/hover_actions/index.tsx index 07c1b360394e3..16ed7f95b87c6 100644 --- a/x-pack/plugins/security_solution/public/common/components/hover_actions/index.tsx +++ b/x-pack/plugins/security_solution/public/common/components/hover_actions/index.tsx @@ -7,7 +7,7 @@ import { EuiFocusTrap, EuiScreenReaderOnly } from '@elastic/eui'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import type { DraggableId } from 'react-beautiful-dnd'; +import type { DraggableId } from '@hello-pangea/dnd'; import styled from 'styled-components'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx index 9aa2e27d0716a..4acebe2d3a12c 100644 --- a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx +++ b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_action_items.tsx @@ -7,7 +7,7 @@ import { EuiContextMenuItem } from '@elastic/eui'; import React, { useCallback, useMemo } from 'react'; -import type { DraggableId } from 'react-beautiful-dnd'; +import type { DraggableId } from '@hello-pangea/dnd'; import { isEmpty } from 'lodash'; diff --git a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_actions.tsx b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_actions.tsx index 8da15356b1bcc..324f5af4e16e7 100644 --- a/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_actions.tsx +++ b/x-pack/plugins/security_solution/public/common/components/hover_actions/use_hover_actions.tsx @@ -6,7 +6,7 @@ */ import React, { useCallback, useMemo, useState, useRef, useContext } from 'react'; -import type { DraggableProvided, DraggableStateSnapshot } from 'react-beautiful-dnd'; +import type { DraggableProvided, DraggableStateSnapshot } from '@hello-pangea/dnd'; import { TimelineContext } from '../../../timelines/components/timeline'; import { HoverActions } from '.'; @@ -102,7 +102,16 @@ export const useHoverActions = ({