@patternfly/react-drag-drop 5.0.0-alpha.0 → 5.2.0-prerelease.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 +10 -0
- package/LICENSE +21 -0
- package/dist/cjs.tsbuildinfo +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/next/components/DragDrop/DragButton.d.ts.map +1 -0
- package/dist/esm/{components → next/components}/DragDrop/DragButton.js +3 -2
- package/dist/esm/next/components/DragDrop/DragButton.js.map +1 -0
- package/dist/esm/{components → next/components}/DragDrop/DragDropSort.d.ts +12 -11
- package/dist/esm/next/components/DragDrop/DragDropSort.d.ts.map +1 -0
- package/dist/esm/next/components/DragDrop/DragDropSort.js +70 -0
- package/dist/esm/next/components/DragDrop/DragDropSort.js.map +1 -0
- package/dist/esm/next/components/DragDrop/DragDropUtil.d.ts +10 -0
- package/dist/esm/next/components/DragDrop/DragDropUtil.d.ts.map +1 -0
- package/dist/esm/next/components/DragDrop/DragDropUtil.js +2 -0
- package/dist/esm/next/components/DragDrop/DragDropUtil.js.map +1 -0
- package/dist/{js → esm/next}/components/DragDrop/Draggable.d.ts +2 -4
- package/dist/esm/next/components/DragDrop/Draggable.d.ts.map +1 -0
- package/dist/esm/{components → next/components}/DragDrop/Draggable.js +4 -4
- package/dist/esm/next/components/DragDrop/Draggable.js.map +1 -0
- package/dist/{js → esm/next}/components/DragDrop/DraggableDataListItem.d.ts +1 -3
- package/dist/esm/next/components/DragDrop/DraggableDataListItem.d.ts.map +1 -0
- package/dist/esm/{components → next/components}/DragDrop/DraggableDataListItem.js +4 -3
- package/dist/esm/next/components/DragDrop/DraggableDataListItem.js.map +1 -0
- package/dist/esm/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.d.ts +1 -5
- package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +1 -0
- package/dist/esm/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.js +7 -5
- package/dist/esm/next/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -0
- package/dist/esm/next/components/DragDrop/Droppable.d.ts.map +1 -0
- package/dist/esm/next/components/DragDrop/Droppable.js.map +1 -0
- package/dist/esm/next/components/DragDrop/DroppableContext.d.ts.map +1 -0
- package/dist/esm/next/components/DragDrop/DroppableContext.js.map +1 -0
- package/dist/esm/next/components/DragDrop/index.d.ts +3 -0
- package/dist/esm/next/components/DragDrop/index.d.ts.map +1 -0
- package/dist/esm/next/components/DragDrop/index.js +3 -0
- package/dist/esm/next/components/DragDrop/index.js.map +1 -0
- package/dist/esm/next/components/index.d.ts.map +1 -0
- package/dist/esm/next/components/index.js.map +1 -0
- package/dist/esm/next/index.d.ts +2 -0
- package/dist/esm/next/index.d.ts.map +1 -0
- package/dist/esm/next/index.js +2 -0
- package/dist/esm/next/index.js.map +1 -0
- package/dist/esm.tsbuildinfo +1 -1
- package/dist/js/index.d.ts +1 -1
- package/dist/js/index.d.ts.map +1 -1
- package/dist/js/index.js +1 -1
- package/dist/js/index.js.map +1 -1
- package/dist/js/next/components/DragDrop/DragButton.d.ts.map +1 -0
- package/dist/js/{components → next/components}/DragDrop/DragButton.js +2 -1
- package/dist/js/next/components/DragDrop/DragButton.js.map +1 -0
- package/dist/js/{components → next/components}/DragDrop/DragDropSort.d.ts +12 -11
- package/dist/js/next/components/DragDrop/DragDropSort.d.ts.map +1 -0
- package/dist/js/next/components/DragDrop/DragDropSort.js +74 -0
- package/dist/js/next/components/DragDrop/DragDropSort.js.map +1 -0
- package/dist/js/next/components/DragDrop/DragDropUtil.d.ts +10 -0
- package/dist/js/next/components/DragDrop/DragDropUtil.d.ts.map +1 -0
- package/dist/js/next/components/DragDrop/DragDropUtil.js +3 -0
- package/dist/js/next/components/DragDrop/DragDropUtil.js.map +1 -0
- package/dist/{esm → js/next}/components/DragDrop/Draggable.d.ts +2 -4
- package/dist/js/next/components/DragDrop/Draggable.d.ts.map +1 -0
- package/dist/js/{components → next/components}/DragDrop/Draggable.js +3 -3
- package/dist/js/next/components/DragDrop/Draggable.js.map +1 -0
- package/dist/{esm → js/next}/components/DragDrop/DraggableDataListItem.d.ts +1 -3
- package/dist/js/next/components/DragDrop/DraggableDataListItem.d.ts.map +1 -0
- package/dist/js/{components → next/components}/DragDrop/DraggableDataListItem.js +3 -2
- package/dist/js/next/components/DragDrop/DraggableDataListItem.js.map +1 -0
- package/dist/js/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.d.ts +1 -5
- package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +1 -0
- package/dist/js/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.js +7 -5
- package/dist/js/next/components/DragDrop/DraggableDualListSelectorListItem.js.map +1 -0
- package/dist/js/next/components/DragDrop/Droppable.d.ts.map +1 -0
- package/dist/js/next/components/DragDrop/Droppable.js.map +1 -0
- package/dist/js/next/components/DragDrop/DroppableContext.d.ts.map +1 -0
- package/dist/js/next/components/DragDrop/DroppableContext.js.map +1 -0
- package/dist/js/next/components/DragDrop/index.d.ts +3 -0
- package/dist/js/next/components/DragDrop/index.d.ts.map +1 -0
- package/dist/js/{components → next/components}/DragDrop/index.js +1 -0
- package/dist/js/next/components/DragDrop/index.js.map +1 -0
- package/dist/js/next/components/index.d.ts.map +1 -0
- package/dist/js/next/components/index.js.map +1 -0
- package/dist/js/next/index.d.ts +2 -0
- package/dist/js/next/index.d.ts.map +1 -0
- package/dist/js/next/index.js +5 -0
- package/dist/js/next/index.js.map +1 -0
- package/package.json +10 -10
- package/src/index.ts +1 -1
- package/src/{components → next/components}/DragDrop/DragButton.tsx +6 -1
- package/src/next/components/DragDrop/DragDropSort.tsx +174 -0
- package/src/next/components/DragDrop/DragDropUtil.tsx +8 -0
- package/src/{components → next/components}/DragDrop/Draggable.tsx +10 -7
- package/src/{components → next/components}/DragDrop/DraggableDataListItem.tsx +15 -5
- package/src/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.tsx +14 -11
- package/src/{components → next/components}/DragDrop/__tests__/DragDrop.test.tsx +1 -1
- package/src/{components → next/components}/DragDrop/__tests__/__snapshots__/DragDrop.test.tsx.snap +31 -29
- package/src/next/components/DragDrop/examples/BasicSorting.tsx +19 -0
- package/src/next/components/DragDrop/examples/BasicSortingWithDragButton.tsx +20 -0
- package/src/{components → next/components}/DragDrop/examples/DataListDraggable.tsx +11 -19
- package/src/next/components/DragDrop/examples/DragDrop.md +32 -0
- package/src/next/components/DragDrop/examples/DragDropDemos.md +37 -0
- package/src/{components → next/components}/DragDrop/examples/DualListSelectorDraggable.tsx +52 -72
- package/src/{components → next/components}/DragDrop/index.ts +1 -0
- package/src/next/index.ts +1 -0
- package/dist/esm/components/DragDrop/DragButton.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/DragButton.js.map +0 -1
- package/dist/esm/components/DragDrop/DragDropSort.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/DragDropSort.js +0 -45
- package/dist/esm/components/DragDrop/DragDropSort.js.map +0 -1
- package/dist/esm/components/DragDrop/Draggable.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/Draggable.js.map +0 -1
- package/dist/esm/components/DragDrop/DraggableDataListItem.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/DraggableDataListItem.js.map +0 -1
- package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/DraggableDualListSelectorListItem.js.map +0 -1
- package/dist/esm/components/DragDrop/Droppable.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/Droppable.js.map +0 -1
- package/dist/esm/components/DragDrop/DroppableContext.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/DroppableContext.js.map +0 -1
- package/dist/esm/components/DragDrop/index.d.ts +0 -2
- package/dist/esm/components/DragDrop/index.d.ts.map +0 -1
- package/dist/esm/components/DragDrop/index.js +0 -2
- package/dist/esm/components/DragDrop/index.js.map +0 -1
- package/dist/esm/components/index.d.ts.map +0 -1
- package/dist/esm/components/index.js.map +0 -1
- package/dist/js/components/DragDrop/DragButton.d.ts.map +0 -1
- package/dist/js/components/DragDrop/DragButton.js.map +0 -1
- package/dist/js/components/DragDrop/DragDropSort.d.ts.map +0 -1
- package/dist/js/components/DragDrop/DragDropSort.js +0 -50
- package/dist/js/components/DragDrop/DragDropSort.js.map +0 -1
- package/dist/js/components/DragDrop/Draggable.d.ts.map +0 -1
- package/dist/js/components/DragDrop/Draggable.js.map +0 -1
- package/dist/js/components/DragDrop/DraggableDataListItem.d.ts.map +0 -1
- package/dist/js/components/DragDrop/DraggableDataListItem.js.map +0 -1
- package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.d.ts.map +0 -1
- package/dist/js/components/DragDrop/DraggableDualListSelectorListItem.js.map +0 -1
- package/dist/js/components/DragDrop/Droppable.d.ts.map +0 -1
- package/dist/js/components/DragDrop/Droppable.js.map +0 -1
- package/dist/js/components/DragDrop/DroppableContext.d.ts.map +0 -1
- package/dist/js/components/DragDrop/DroppableContext.js.map +0 -1
- package/dist/js/components/DragDrop/index.d.ts +0 -2
- package/dist/js/components/DragDrop/index.d.ts.map +0 -1
- package/dist/js/components/DragDrop/index.js.map +0 -1
- package/dist/js/components/index.d.ts.map +0 -1
- package/dist/js/components/index.js.map +0 -1
- package/src/components/DragDrop/DragDropSort.tsx +0 -123
- package/src/components/DragDrop/examples/BasicSorting.tsx +0 -24
- package/src/components/DragDrop/examples/BasicSortingWithDragButton.tsx +0 -25
- package/src/components/DragDrop/examples/DragDrop.md +0 -57
- /package/dist/esm/{components → next/components}/DragDrop/DragButton.d.ts +0 -0
- /package/dist/esm/{components → next/components}/DragDrop/Droppable.d.ts +0 -0
- /package/dist/esm/{components → next/components}/DragDrop/Droppable.js +0 -0
- /package/dist/esm/{components → next/components}/DragDrop/DroppableContext.d.ts +0 -0
- /package/dist/esm/{components → next/components}/DragDrop/DroppableContext.js +0 -0
- /package/dist/esm/{components → next/components}/index.d.ts +0 -0
- /package/dist/esm/{components → next/components}/index.js +0 -0
- /package/dist/js/{components → next/components}/DragDrop/DragButton.d.ts +0 -0
- /package/dist/js/{components → next/components}/DragDrop/Droppable.d.ts +0 -0
- /package/dist/js/{components → next/components}/DragDrop/Droppable.js +0 -0
- /package/dist/js/{components → next/components}/DragDrop/DroppableContext.d.ts +0 -0
- /package/dist/js/{components → next/components}/DragDrop/DroppableContext.js +0 -0
- /package/dist/js/{components → next/components}/index.d.ts +0 -0
- /package/dist/js/{components → next/components}/index.js +0 -0
- /package/src/{components → next/components}/DragDrop/Droppable.tsx +0 -0
- /package/src/{components → next/components}/DragDrop/DroppableContext.ts +0 -0
- /package/src/{components → next/components}/index.ts +0 -0
package/dist/js/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './next';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/js/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
package/dist/js/index.js
CHANGED
package/dist/js/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragButton.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,eAAgB,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IACzE,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uBAAuB;IACvB,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAU/D,CAAC"}
|
|
@@ -5,10 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const React = tslib_1.__importStar(require("react"));
|
|
6
6
|
const react_styles_1 = require("@patternfly/react-styles");
|
|
7
7
|
const data_list_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/DataList/data-list"));
|
|
8
|
+
const button_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Button/button"));
|
|
8
9
|
const grip_vertical_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/grip-vertical-icon'));
|
|
9
10
|
const DragButton = (_a) => {
|
|
10
11
|
var { className } = _a, props = tslib_1.__rest(_a, ["className"]);
|
|
11
|
-
return (React.createElement("button", Object.assign({ className: (0, react_styles_1.css)(className,
|
|
12
|
+
return (React.createElement("button", Object.assign({ className: (0, react_styles_1.css)(className, button_1.default.button, button_1.default.modifiers.plain), "aria-label": "Drag button" }, props),
|
|
12
13
|
React.createElement("span", { className: (0, react_styles_1.css)(data_list_1.default.dataListItemDraggableIcon) },
|
|
13
14
|
React.createElement(grip_vertical_icon_1.default, null))));
|
|
14
15
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragButton.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragButton.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2DAA+C;AAC/C,mHAA0F;AAC1F,2GAAiF;AACjF,0HAAyF;AAWlF,MAAM,UAAU,GAA6C,CAAC,EAAwC,EAAE,EAAE;QAA5C,EAAE,SAAS,OAA6B,EAAxB,KAAK,sBAArB,aAAuB,CAAF;IAAwB,OAAA,CAChH,8CACE,SAAS,EAAE,IAAA,kBAAG,EAAC,SAAS,EAAE,gBAAY,CAAC,MAAM,EAAE,gBAAY,CAAC,SAAS,CAAC,KAAK,CAAC,gBACjE,aAAa,IACpB,KAAK;QAET,8BAAM,SAAS,EAAE,IAAA,kBAAG,EAAC,mBAAgB,CAAC,yBAAyB,CAAC;YAC9D,oBAAC,4BAAgB,OAAG,CACf,CACA,CACV,CAAA;CAAA,CAAC;AAVW,QAAA,UAAU,cAUrB;AACF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { DndContextProps } from '@dnd-kit/core';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
props?: any;
|
|
10
|
-
}
|
|
2
|
+
import { DndContextProps, DragEndEvent, DragStartEvent } from '@dnd-kit/core';
|
|
3
|
+
import { DraggableObject } from './DragDropUtil';
|
|
4
|
+
export declare type DragDropSortDragEndEvent = DragEndEvent;
|
|
5
|
+
export declare type DragDropSortDragStartEvent = DragStartEvent;
|
|
6
|
+
/**
|
|
7
|
+
* DragDropSortProps extends dnd-kit's props which may be viewed at https://docs.dndkit.com/api-documentation/context-provider#props.
|
|
8
|
+
*/
|
|
11
9
|
export interface DragDropSortProps extends DndContextProps {
|
|
10
|
+
/** Custom defined content wrapper for draggable items. By default, draggable items are wrapped in a styled div.
|
|
11
|
+
* Intended to be a 'DataList' or 'DualListSelectorList' without children. */
|
|
12
|
+
children?: React.ReactElement;
|
|
12
13
|
/** Sorted array of draggable objects */
|
|
13
14
|
items: DraggableObject[];
|
|
14
15
|
/** Callback when user drops a draggable object */
|
|
15
|
-
onDrop: (items: DraggableObject[], oldIndex?: number, newIndex?: number) => void;
|
|
16
|
+
onDrop: (event: DragDropSortDragEndEvent, items: DraggableObject[], oldIndex?: number, newIndex?: number) => void;
|
|
16
17
|
/** Callback when use begins dragging a draggable object */
|
|
17
|
-
onDrag?: (oldIndex: number) => void;
|
|
18
|
+
onDrag?: (event: DragDropSortDragStartEvent, oldIndex: number) => void;
|
|
18
19
|
/** The variant determines which component wraps the draggable object.
|
|
19
20
|
* Default and defaultWithHandle varaints wrap the draggable object in a div.
|
|
20
21
|
* DataList vairant wraps the draggable object in a DataListItem
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropSort.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropSort.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAIL,eAAe,EAKf,YAAY,EACZ,cAAc,EACf,MAAM,eAAe,CAAC;AAUvB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGjD,oBAAY,wBAAwB,GAAG,YAAY,CAAC;AACpD,oBAAY,0BAA0B,GAAG,cAAc,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD;iFAC6E;IAC7E,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC9B,wCAAwC;IACxC,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,kDAAkD;IAClD,MAAM,EAAE,CAAC,KAAK,EAAE,wBAAwB,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClH,2DAA2D;IAC3D,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACvE;;;;;SAKK;IACL,OAAO,CAAC,EAAE,SAAS,GAAG,mBAAmB,GAAG,UAAU,GAAG,sBAAsB,GAAG,iBAAiB,CAAC;CACrG;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAyHnE,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DragDropSort = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = tslib_1.__importStar(require("react"));
|
|
6
|
+
const react_styles_1 = require("@patternfly/react-styles");
|
|
7
|
+
const core_1 = require("@dnd-kit/core");
|
|
8
|
+
const sortable_1 = require("@dnd-kit/sortable");
|
|
9
|
+
const Draggable_1 = require("./Draggable");
|
|
10
|
+
const DraggableDataListItem_1 = require("./DraggableDataListItem");
|
|
11
|
+
const DraggableDualListSelectorListItem_1 = require("./DraggableDualListSelectorListItem");
|
|
12
|
+
const drag_drop_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/DragDrop/drag-drop"));
|
|
13
|
+
const DragDropSort = (_a) => {
|
|
14
|
+
var { items, onDrop = () => { }, onDrag = () => { }, variant = 'default', children } = _a, props = tslib_1.__rest(_a, ["items", "onDrop", "onDrag", "variant", "children"]);
|
|
15
|
+
const [activeId, setActiveId] = React.useState(null);
|
|
16
|
+
const itemIds = React.useMemo(() => (items ? Array.from(items, (item) => item.id) : []), [items]);
|
|
17
|
+
const getItemById = (id) => items.find((item) => item.id === id);
|
|
18
|
+
const sensors = (0, core_1.useSensors)((0, core_1.useSensor)(core_1.PointerSensor), (0, core_1.useSensor)(core_1.KeyboardSensor, {
|
|
19
|
+
coordinateGetter: sortable_1.sortableKeyboardCoordinates
|
|
20
|
+
}));
|
|
21
|
+
const handleDragEnd = (event) => {
|
|
22
|
+
const { active, over } = event;
|
|
23
|
+
const oldIndex = itemIds.indexOf(active.id);
|
|
24
|
+
const newIndex = itemIds.indexOf(over.id);
|
|
25
|
+
const newItems = (0, sortable_1.arrayMove)(items, oldIndex, newIndex);
|
|
26
|
+
onDrop(event, newItems, oldIndex, newIndex);
|
|
27
|
+
setActiveId(null);
|
|
28
|
+
};
|
|
29
|
+
const handleDragStart = (event) => {
|
|
30
|
+
setActiveId(event.active.id);
|
|
31
|
+
onDrag(event, itemIds.indexOf(event.active.id));
|
|
32
|
+
};
|
|
33
|
+
const getDragOverlay = () => {
|
|
34
|
+
if (!activeId) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const item = getItemById(activeId);
|
|
38
|
+
let content;
|
|
39
|
+
switch (variant) {
|
|
40
|
+
case 'DualListSelectorList':
|
|
41
|
+
content = (React.createElement(DraggableDualListSelectorListItem_1.DraggableDualListSelectorListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
42
|
+
break;
|
|
43
|
+
case 'DataList':
|
|
44
|
+
content = (React.createElement(DraggableDataListItem_1.DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
content = (React.createElement(Draggable_1.Draggable, Object.assign({ useDragButton: variant === 'defaultWithHandle', key: item.id, id: item.id }, item.props), item.content));
|
|
48
|
+
}
|
|
49
|
+
return (React.createElement("div", { className: (0, react_styles_1.css)(drag_drop_1.default.draggable, drag_drop_1.default.modifiers.dragging), style: {
|
|
50
|
+
'--pf-v5-c-draggable--m-dragging--BackgroundColor': 'var(--pf-v5-global--BackgroundColor--100)'
|
|
51
|
+
} }, content));
|
|
52
|
+
};
|
|
53
|
+
const renderedChildren = (React.createElement(sortable_1.SortableContext, { items: itemIds, strategy: sortable_1.verticalListSortingStrategy, id: "droppable" },
|
|
54
|
+
items.map((item) => {
|
|
55
|
+
switch (variant) {
|
|
56
|
+
case 'DualListSelectorList':
|
|
57
|
+
return (React.createElement(DraggableDualListSelectorListItem_1.DraggableDualListSelectorListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
58
|
+
case 'DataList':
|
|
59
|
+
return (React.createElement(DraggableDataListItem_1.DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
60
|
+
default:
|
|
61
|
+
return (React.createElement(Draggable_1.Draggable, Object.assign({ useDragButton: variant === 'defaultWithHandle', key: item.id, id: item.id }, item.props), item.content));
|
|
62
|
+
}
|
|
63
|
+
}),
|
|
64
|
+
React.createElement(core_1.DragOverlay, null, activeId && getDragOverlay())));
|
|
65
|
+
return (React.createElement(core_1.DndContext, Object.assign({ sensors: sensors, collisionDetection: core_1.closestCenter, onDragEnd: handleDragEnd, onDragStart: handleDragStart }, props),
|
|
66
|
+
children &&
|
|
67
|
+
React.cloneElement(children, {
|
|
68
|
+
children: renderedChildren
|
|
69
|
+
}),
|
|
70
|
+
!children && React.createElement("div", null, renderedChildren)));
|
|
71
|
+
};
|
|
72
|
+
exports.DragDropSort = DragDropSort;
|
|
73
|
+
exports.DragDropSort.displayName = 'DragDropSort';
|
|
74
|
+
//# sourceMappingURL=DragDropSort.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropSort.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropSort.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2DAA+C;AAC/C,wCAWuB;AACvB,gDAK2B;AAC3B,2CAAwC;AACxC,mEAAgE;AAChE,2FAAwF;AAExF,mHAAgF;AA2BzE,MAAM,YAAY,GAA+C,CAAC,EAOrD,EAAE,EAAE;QAPiD,EACvE,KAAK,EACL,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,EACjB,MAAM,GAAG,GAAG,EAAE,GAAE,CAAC,EACjB,OAAO,GAAG,SAAS,EACnB,QAAQ,OAEU,EADf,KAAK,sBAN+D,oDAOxE,CADS;IAER,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAS,IAAI,CAAC,CAAC;IAC7D,MAAM,OAAO,GAAG,KAAK,C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Unique id of the draggable object */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Content rendered in the draggable object */
|
|
6
|
+
content: React.ReactNode;
|
|
7
|
+
/** Props spread to the rendered wrapper of the draggable object */
|
|
8
|
+
props?: any;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=DragDropUtil.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropUtil.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropUtil.tsx"],"names":[],"mappings":";AAAA,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,mEAAmE;IACnE,KAAK,CAAC,EAAE,GAAG,CAAC;CACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragDropUtil.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DragDropUtil.tsx"],"names":[],"mappings":""}
|
|
@@ -2,13 +2,11 @@ import * as React from 'react';
|
|
|
2
2
|
export interface DraggableProps extends React.HTMLProps<HTMLDivElement> {
|
|
3
3
|
/** Content rendered inside DragDrop */
|
|
4
4
|
children?: React.ReactNode;
|
|
5
|
-
/** Don't wrap the component in a div. Requires passing a single child. */
|
|
6
|
-
hasNoWrapper?: boolean;
|
|
7
5
|
/** Class to add to outer div */
|
|
8
6
|
className?: string;
|
|
9
|
-
/** */
|
|
7
|
+
/** @hide Id of the sortable context. */
|
|
10
8
|
id?: string;
|
|
11
|
-
/** */
|
|
9
|
+
/** Flag indicating the draggable element should include a drag button. */
|
|
12
10
|
useDragButton?: boolean;
|
|
13
11
|
}
|
|
14
12
|
export declare const Draggable: React.FunctionComponent<DraggableProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Draggable.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Draggable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IACrE,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAsC7D,CAAC"}
|
|
@@ -10,16 +10,16 @@ const drag_drop_1 = tslib_1.__importDefault(require("@patternfly/react-styles/cs
|
|
|
10
10
|
const DragButton_1 = require("./DragButton");
|
|
11
11
|
const Draggable = (_a) => {
|
|
12
12
|
var { children, id, className, useDragButton = false } = _a, props = tslib_1.__rest(_a, ["children", "id", "className", "useDragButton"]);
|
|
13
|
-
const { attributes, listeners, setNodeRef, transform, transition } = (0, sortable_1.useSortable)({
|
|
13
|
+
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = (0, sortable_1.useSortable)({
|
|
14
14
|
id
|
|
15
15
|
});
|
|
16
16
|
const style = {
|
|
17
17
|
transform: utilities_1.CSS.Transform.toString(transform),
|
|
18
18
|
transition
|
|
19
19
|
};
|
|
20
|
-
return useDragButton ? (React.createElement("div", Object.assign({ className: (0, react_styles_1.css)(drag_drop_1.default.
|
|
20
|
+
return useDragButton ? (React.createElement("div", Object.assign({ className: (0, react_styles_1.css)(isDragging && drag_drop_1.default.droppable, isDragging && drag_drop_1.default.modifiers.dragging, className), ref: setNodeRef, style: style }, props),
|
|
21
21
|
React.createElement(DragButton_1.DragButton, Object.assign({}, attributes, listeners)),
|
|
22
|
-
children)) : (React.createElement("div", Object.assign({ className: (0, react_styles_1.css)(drag_drop_1.default.
|
|
22
|
+
children)) : (React.createElement("div", Object.assign({ className: (0, react_styles_1.css)(isDragging && drag_drop_1.default.droppable, isDragging && drag_drop_1.default.modifiers.dragging, className), ref: setNodeRef, style: style }, listeners, attributes, props), children));
|
|
23
23
|
};
|
|
24
24
|
exports.Draggable = Draggable;
|
|
25
25
|
exports.Draggable.displayName = 'Draggable';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Draggable.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Draggable.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,gDAAgD;AAChD,kDAAyC;AACzC,2DAA+C;AAC/C,mHAAgF;AAChF,6CAA0C;AAanC,MAAM,SAAS,GAA4C,CAAC,EAMlD,EAAE,EAAE;QAN8C,EACjE,QAAQ,EACR,EAAE,EACF,SAAS,EACT,aAAa,GAAG,KAAK,OAEN,EADZ,KAAK,sBALyD,gDAMlE,CADS;IAER,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAA,sBAAW,EAAC;QAC3F,EAAE;KACH,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,eAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,UAAU;KACX,CAAC;IAEF,OAAO,aAAa,CAAC,CAAC,CAAC,CACrB,2CACE,SAAS,EAAE,IAAA,kBAAG,EAAC,UAAU,IAAI,mBAAM,CAAC,SAAS,EAAE,UAAU,IAAI,mBAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClG,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,IACR,KAAK;QAET,oBAAC,uBAAU,oBAAK,UAAU,EAAM,SAAS,EAAI;QAC5C,QAAQ,CACL,CACP,CAAC,CAAC,CAAC,CACF,2CACE,SAAS,EAAE,IAAA,kBAAG,EAAC,UAAU,IAAI,mBAAM,CAAC,SAAS,EAAE,UAAU,IAAI,mBAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,EAClG,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK,IACR,SAAS,EACT,UAAU,EACV,KAAK,GAER,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AAtCW,QAAA,SAAS,aAsCpB;AACF,iBAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -6,11 +6,9 @@ export interface DraggableDataListItemObject {
|
|
|
6
6
|
export interface DraggableDataListItemProps extends React.HTMLProps<HTMLLIElement> {
|
|
7
7
|
/** Content rendered inside DragDrop */
|
|
8
8
|
children?: React.ReactNode;
|
|
9
|
-
/** Don't wrap the component in a div. Requires passing a single child. */
|
|
10
|
-
hasNoWrapper?: boolean;
|
|
11
9
|
/** Class to add to outer div */
|
|
12
10
|
className?: string;
|
|
13
|
-
/** */
|
|
11
|
+
/** @hide Id of the sortable context. */
|
|
14
12
|
id?: string;
|
|
15
13
|
}
|
|
16
14
|
export declare const DraggableDataListItem: React.FunctionComponent<DraggableDataListItemProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraggableDataListItem.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDataListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,2BAA2B;IAC1C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA2B,SAAQ,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAChF,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,iBAAiB,CAAC,0BAA0B,CAoCrF,CAAC"}
|
|
@@ -7,18 +7,19 @@ const sortable_1 = require("@dnd-kit/sortable");
|
|
|
7
7
|
const utilities_1 = require("@dnd-kit/utilities");
|
|
8
8
|
const react_styles_1 = require("@patternfly/react-styles");
|
|
9
9
|
const data_list_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/DataList/data-list"));
|
|
10
|
+
const drag_drop_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/DragDrop/drag-drop"));
|
|
10
11
|
const DragButton_1 = require("./DragButton");
|
|
11
12
|
const react_core_1 = require("@patternfly/react-core");
|
|
12
13
|
const DraggableDataListItem = (_a) => {
|
|
13
14
|
var { children, id, className } = _a, props = tslib_1.__rest(_a, ["children", "id", "className"]);
|
|
14
|
-
const { attributes, listeners, setNodeRef, transform, transition } = (0, sortable_1.useSortable)({
|
|
15
|
+
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = (0, sortable_1.useSortable)({
|
|
15
16
|
id
|
|
16
17
|
});
|
|
17
18
|
const style = {
|
|
18
19
|
transform: utilities_1.CSS.Transform.toString(transform),
|
|
19
20
|
transition
|
|
20
21
|
};
|
|
21
|
-
return (React.createElement("li", Object.assign({ id: id, className: (0, react_styles_1.css)(data_list_1.default.dataListItem, className) }, props, { ref: setNodeRef, style: style }),
|
|
22
|
+
return (React.createElement("li", Object.assign({ id: id, className: (0, react_styles_1.css)(data_list_1.default.dataListItem, isDragging && drag_drop_1.default.droppable, isDragging && drag_drop_1.default.modifiers.dragging, className) }, props, { ref: setNodeRef, style: style }),
|
|
22
23
|
React.createElement(react_core_1.DataListItemRow, null,
|
|
23
24
|
React.createElement(react_core_1.DataListControl, null,
|
|
24
25
|
React.createElement(DragButton_1.DragButton, Object.assign({ className: (0, react_styles_1.css)(data_list_1.default.dataListItemDraggableButton) }, attributes, listeners))),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraggableDataListItem.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDataListItem.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,gDAAgD;AAChD,kDAAyC;AACzC,2DAA+C;AAC/C,mHAAgF;AAChF,mHAAoF;AACpF,6CAA0C;AAC1C,uDAA0E;AAgBnE,MAAM,qBAAqB,GAAwD,CAAC,EAK9D,EAAE,EAAE;QAL0D,EACzF,QAAQ,EACR,EAAE,EACF,SAAS,OAEkB,EADxB,KAAK,sBAJiF,+BAK1F,CADS;IAER,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAA,sBAAW,EAAC;QAC3F,EAAE;KACH,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,eAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC5C,UAAU;KACX,CAAC;IAEF,OAAO,CACL,0CACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,IAAA,kBAAG,EACZ,mBAAM,CAAC,YAAY,EACnB,UAAU,IAAI,mBAAU,CAAC,SAAS,EAClC,UAAU,IAAI,mBAAU,CAAC,SAAS,CAAC,QAAQ,EAC3C,SAAS,CACV,IACG,KAAK,IACT,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,KAAK;QAEZ,oBAAC,4BAAe;YACd,oBAAC,4BAAe;gBACd,oBAAC,uBAAU,kBAAC,SAAS,EAAE,IAAA,kBAAG,EAAC,mBAAM,CAAC,2BAA2B,CAAC,IAAM,UAAU,EAAM,SAAS,EAAI,CACjF;YACjB,QAAQ,CACO,CACf,CACN,CAAC;AACJ,CAAC,CAAC;AApCW,QAAA,qBAAqB,yBAoChC;AACF,6BAAqB,CAAC,WAAW,GAAG,uBAAuB,CAAC"}
|
package/dist/js/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.d.ts
RENAMED
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export interface DraggableObject {
|
|
3
|
-
id?: string;
|
|
4
|
-
content?: React.ReactNode;
|
|
5
|
-
}
|
|
6
2
|
export interface DraggableDualListSelectorListItemProps extends React.HTMLProps<HTMLLIElement> {
|
|
7
3
|
/** Content rendered inside DragDrop */
|
|
8
4
|
children?: React.ReactNode;
|
|
@@ -10,7 +6,7 @@ export interface DraggableDualListSelectorListItemProps extends React.HTMLProps<
|
|
|
10
6
|
hasNoWrapper?: boolean;
|
|
11
7
|
/** Class to add to outer div */
|
|
12
8
|
className?: string;
|
|
13
|
-
/** */
|
|
9
|
+
/** @hide Id of the sortable context */
|
|
14
10
|
id?: string;
|
|
15
11
|
/** Flag indicating the list item is currently selected. */
|
|
16
12
|
isSelected?: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraggableDualListSelectorListItem.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDualListSelectorListItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,sCAAuC,SAAQ,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;IAC5F,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uCAAuC;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kDAAkD;IAClD,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACtG,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IAC1C,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,iCAAiC,EAAE,KAAK,CAAC,iBAAiB,CAAC,sCAAsC,CA6D7G,CAAC"}
|
package/dist/js/{components → next/components}/DragDrop/DraggableDualListSelectorListItem.js
RENAMED
|
@@ -7,19 +7,21 @@ const sortable_1 = require("@dnd-kit/sortable");
|
|
|
7
7
|
const utilities_1 = require("@dnd-kit/utilities");
|
|
8
8
|
const react_styles_1 = require("@patternfly/react-styles");
|
|
9
9
|
const dual_list_selector_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/DualListSelector/dual-list-selector"));
|
|
10
|
+
const drag_drop_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/DragDrop/drag-drop"));
|
|
10
11
|
const DragButton_1 = require("./DragButton");
|
|
11
|
-
const
|
|
12
|
+
const DualListSelector_1 = require('@patternfly/react-core/dist/js/components/DualListSelector');
|
|
12
13
|
const DraggableDualListSelectorListItem = (_a) => {
|
|
13
14
|
var { children, id, className, orderIndex, isSelected, onOptionSelect } = _a, props = tslib_1.__rest(_a, ["children", "id", "className", "orderIndex", "isSelected", "onOptionSelect"]);
|
|
14
|
-
const { attributes, listeners, setNodeRef, transform, transition } = (0, sortable_1.useSortable)({
|
|
15
|
-
id
|
|
15
|
+
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = (0, sortable_1.useSortable)({
|
|
16
|
+
id,
|
|
17
|
+
animateLayoutChanges: () => false
|
|
16
18
|
});
|
|
17
|
-
const { setFocusedOption } = React.useContext(
|
|
19
|
+
const { setFocusedOption } = React.useContext(DualListSelector_1.DualListSelectorListContext);
|
|
18
20
|
const style = {
|
|
19
21
|
transform: utilities_1.CSS.Transform.toString(transform),
|
|
20
22
|
transition
|
|
21
23
|
};
|
|
22
|
-
return (React.createElement("li", Object.assign({ className: (0, react_styles_1.css)(dual_list_selector_1.default.dualListSelectorListItem, className), key: orderIndex, id: id, ref: setNodeRef, style: style }
|
|
24
|
+
return (React.createElement("li", Object.assign({ className: (0, react_styles_1.css)(dual_list_selector_1.default.dualListSelectorListItem, isDragging && drag_drop_1.default.droppable, isDragging && drag_drop_1.default.modifiers.dragging, className), key: orderIndex, id: id, role: "presentation" }, props, { ref: setNodeRef, style: style }),
|
|
23
25
|
React.createElement("div", { className: (0, react_styles_1.css)(dual_list_selector_1.default.dualListSelectorListItemRow, isSelected && dual_list_selector_1.default.modifiers.selected) },
|
|
24
26
|
React.createElement(DragButton_1.DragButton, Object.assign({ className: (0, react_styles_1.css)(dual_list_selector_1.default.dualListSelectorDraggable) }, attributes, listeners)),
|
|
25
27
|
React.createElement("span", { className: (0, react_styles_1.css)(dual_list_selector_1.default.dualListSelectorItem), onKeyDown: (e) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DraggableDualListSelectorListItem.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DraggableDualListSelectorListItem.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,gDAAgD;AAChD,kDAAyC;AACzC,2DAA+C;AAC/C,6IAAiG;AACjG,mHAAoF;AACpF,6CAA0C;AAC1C,iGAA0G;AAuBnG,MAAM,iCAAiC,GAAoE,CAAC,EAQ1E,EAAE,EAAE;QARsE,EACjH,QAAQ,EACR,EAAE,EACF,SAAS,EACT,UAAU,EACV,UAAU,EACV,cAAc,OAEyB,EADpC,KAAK,sBAPyG,6EAQlH,CADS;IAER,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,IAAA,sBAAW,EAAC;QAC3F,EAAE;QACF,oBAAoB,EAAE,GAAG,EAAE,CAAC,KAAK;KAClC,CAAC,CAAC;IAEH,MAAM,EAAE,gBAAgB,EAAE,GAAG,KAAK,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EZ,8BAAM,SAAS,EAAE,IAAA,kBAAG,EAAC,4BAAM,CAAC,wBAAwB,CAAC;oBACnD,8BAAM,SAAS,EAAE,IAAA,kBAAG,EAAC,4BAAM,CAAC,wBAAwB,CAAC,IAAG,QAAQ,CAAQ,CACnE,CACF,CACH,CACH,CACN,CAAC;AACJ,CAAC,CAAC;AA7DW,QAAA,iCAAiC,qCA6D5C;AACF,yCAAiC,CAAC,WAAW,GAAG,mCAAmC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Droppable.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Droppable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,UAAU,cAAe,SAAQ,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC;IAC9D,uCAAuC;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sHAAsH;IACtH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,cAAc,CAS7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Droppable.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/Droppable.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,wCAA6C;AAetC,MAAM,SAAS,GAA4C,CAAC,EAAsC,EAAE,EAAE;QAA1C,EAAE,QAAQ,OAA4B,EAAvB,KAAK,sBAApB,YAAsB,CAAF;IACrF,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,mBAAY,EAAC,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAEtD,OAAO,CACL,2CAAK,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,IAAM,KAAK,GAC1C,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AATW,QAAA,SAAS,aASpB;AACF,iBAAS,CAAC,WAAW,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DroppableContext.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DroppableContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,eAAO,MAAM,gBAAgB;;;EAG3B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DroppableContext.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/DroppableContext.ts"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAElB,QAAA,gBAAgB,GAAG,KAAK,CAAC,aAAa,CAAC;IAClD,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,oBAAoB;CAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/next/components/DragDrop/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,yDAA+B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/next/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/next/components/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/next/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/next/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-drag-drop",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0-prerelease.0",
|
|
4
4
|
"description": "PatternFly drag and drop solution",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
11
|
-
"tag": "alpha"
|
|
10
|
+
"access": "public"
|
|
12
11
|
},
|
|
13
12
|
"patternfly:src": "src/",
|
|
14
13
|
"repository": {
|
|
@@ -30,21 +29,22 @@
|
|
|
30
29
|
"clean": "rimraf dist"
|
|
31
30
|
},
|
|
32
31
|
"dependencies": {
|
|
33
|
-
"@dnd-kit/core": "^6.0.
|
|
32
|
+
"@dnd-kit/core": "^6.0.8",
|
|
34
33
|
"@dnd-kit/modifiers": "^6.0.1",
|
|
35
34
|
"@dnd-kit/sortable": "^7.0.2",
|
|
36
|
-
"@patternfly/react-core": "^5.
|
|
37
|
-
"@patternfly/react-icons": "^5.
|
|
38
|
-
"@patternfly/react-styles": "^5.
|
|
35
|
+
"@patternfly/react-core": "^5.2.0-prerelease.42",
|
|
36
|
+
"@patternfly/react-icons": "^5.2.0-prerelease.9",
|
|
37
|
+
"@patternfly/react-styles": "^5.2.0-prerelease.6",
|
|
39
38
|
"memoize-one": "^5.1.0",
|
|
40
39
|
"resize-observer-polyfill": "^1.5.1"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
|
-
"react": "^
|
|
44
|
-
"react-dom": "^
|
|
42
|
+
"react": "^17 || ^18",
|
|
43
|
+
"react-dom": "^17 || ^18"
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"rimraf": "^2.6.2",
|
|
48
47
|
"typescript": "^4.7.4"
|
|
49
|
-
}
|
|
48
|
+
},
|
|
49
|
+
"gitHead": "f4175ffc4c4db378d9512951f02e115128b675cb"
|
|
50
50
|
}
|
package/src/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './
|
|
1
|
+
export * from './next';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import dragButtonStyles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
4
|
+
import buttonStyles from '@patternfly/react-styles/css/components/Button/button';
|
|
4
5
|
import GripVerticalIcon from '@patternfly/react-icons/dist/esm/icons/grip-vertical-icon';
|
|
5
6
|
|
|
6
7
|
export interface DragButtonProps extends React.HTMLProps<HTMLButtonElement> {
|
|
@@ -13,7 +14,11 @@ export interface DragButtonProps extends React.HTMLProps<HTMLButtonElement> {
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export const DragButton: React.FunctionComponent<DragButtonProps> = ({ className, ...props }: DragButtonProps) => (
|
|
16
|
-
<button
|
|
17
|
+
<button
|
|
18
|
+
className={css(className, buttonStyles.button, buttonStyles.modifiers.plain)}
|
|
19
|
+
aria-label="Drag button"
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
17
22
|
<span className={css(dragButtonStyles.dataListItemDraggableIcon)}>
|
|
18
23
|
<GripVerticalIcon />
|
|
19
24
|
</span>
|