@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
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DragDropSort, DraggableObject } from '@patternfly/react-drag-drop';
|
|
3
|
-
|
|
4
|
-
export const BasicSorting: React.FunctionComponent = () => {
|
|
5
|
-
const [items, setItems] = React.useState<DraggableObject[]>([
|
|
6
|
-
{ id: '1', content: 'one' },
|
|
7
|
-
{ id: '2', content: 'two' },
|
|
8
|
-
{ id: '3', content: 'three' }
|
|
9
|
-
]);
|
|
10
|
-
const [dragging, setDragging] = React.useState(false);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<div className={`pf-c-droppable ${dragging ? 'pf-m-dragging' : ''}`}>
|
|
14
|
-
<DragDropSort
|
|
15
|
-
items={items}
|
|
16
|
-
onDrop={newItems => {
|
|
17
|
-
setItems(newItems);
|
|
18
|
-
setDragging(false);
|
|
19
|
-
}}
|
|
20
|
-
onDrag={() => setDragging(true)}
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DragDropSort, DraggableObject } from '@patternfly/react-drag-drop';
|
|
3
|
-
|
|
4
|
-
export const BasicSortingWithDragButton: React.FunctionComponent = () => {
|
|
5
|
-
const [items, setItems] = React.useState<DraggableObject[]>([
|
|
6
|
-
{ id: '1', content: 'one' },
|
|
7
|
-
{ id: '2', content: 'two' },
|
|
8
|
-
{ id: '3', content: 'three' }
|
|
9
|
-
]);
|
|
10
|
-
const [dragging, setDragging] = React.useState(false);
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<div className={`pf-c-droppable ${dragging ? 'pf-m-dragging' : ''}`}>
|
|
14
|
-
<DragDropSort
|
|
15
|
-
items={items}
|
|
16
|
-
variant="defaultWithHandle"
|
|
17
|
-
onDrop={newItems => {
|
|
18
|
-
setItems(newItems);
|
|
19
|
-
setDragging(false);
|
|
20
|
-
}}
|
|
21
|
-
onDrag={() => setDragging(true)}
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: Drag and drop
|
|
3
|
-
section: components
|
|
4
|
-
cssPrefix: pf-c-drag-drop
|
|
5
|
-
propComponents: [
|
|
6
|
-
DragDropSort,
|
|
7
|
-
DraggableObject
|
|
8
|
-
]
|
|
9
|
-
hideNavItem: true
|
|
10
|
-
---
|
|
11
|
-
Note: DragDrop lives in its own package at @patternfly/react-drag-drop!'
|
|
12
|
-
|
|
13
|
-
import AngleDoubleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-left-icon';
|
|
14
|
-
import AngleLeftIcon from '@patternfly/react-icons/dist/esm/icons/angle-left-icon';
|
|
15
|
-
import AngleDoubleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-double-right-icon';
|
|
16
|
-
import AngleRightIcon from '@patternfly/react-icons/dist/esm/icons/angle-right-icon';
|
|
17
|
-
import PficonSortCommonAscIcon from '@patternfly/react-icons/dist/esm/icons/pficon-sort-common-asc-icon';
|
|
18
|
-
|
|
19
|
-
import { DragDropSort, DraggableObject } from '@patternfly/react-drag-drop';
|
|
20
|
-
|
|
21
|
-
## Sorting examples
|
|
22
|
-
### Basic drag and drop sorting
|
|
23
|
-
```ts isBeta file="./BasicSorting.tsx"
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### Basic drag and drop sorting with drag button
|
|
27
|
-
|
|
28
|
-
```ts isBeta file="./BasicSortingWithDragButton.tsx"
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Drag and drop sortable data list
|
|
32
|
-
|
|
33
|
-
Draggable data lists used to have their own HTML5-based API for drag and drop, which wasn't able to fulfill requirements such as custom styling on items being dragged. So we wrote generic `DragDrop`, `Draggable`, and `Droppable` components for this purpose. Use those new components instead of the deprecated (and buggy!) HTML5-based API.
|
|
34
|
-
|
|
35
|
-
Note: Keyboard accessibility and screen reader accessibility for the `DragDrop` component are still in development.
|
|
36
|
-
|
|
37
|
-
```ts isBeta file="./DataListDraggable.tsx"
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
### Drag and drop sortable dual list selector
|
|
41
|
-
|
|
42
|
-
This example only allows reordering the contents of the "chosen" pane with drag and drop. To make a pane able to be reordered:
|
|
43
|
-
|
|
44
|
-
- wrap the `DualListSelectorPane` in a `DragDropSort` component
|
|
45
|
-
- wrap the `DualListSelectorList` in a `Droppable` component
|
|
46
|
-
- wrap the `DualListSelectorListItem` components in a `Draggable` component
|
|
47
|
-
- define an `onDrop` callback which reorders the sortable options.
|
|
48
|
-
- The `onDrop` function provides the starting location and destination location for a dragged item. It should return
|
|
49
|
-
true to enable the 'drop' animation in the new location and false to enable the 'drop' animation back to the item's
|
|
50
|
-
old position.
|
|
51
|
-
- define an `onDrag` callback which ensures that the drag event will not cross hairs with the `onOptionSelect` click
|
|
52
|
-
event set on the option. Note: the `ignoreNextOptionSelect` state value is used to prevent selection while dragging.
|
|
53
|
-
|
|
54
|
-
Note: Keyboard accessibility and screen reader accessibility for the `DragDropSort` component are still in development.
|
|
55
|
-
|
|
56
|
-
```ts file="./DualListSelectorDraggable.tsx"
|
|
57
|
-
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|