@patternfly/react-drag-drop 6.0.0-alpha.40 → 6.0.0-alpha.42
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/dist/cjs.tsbuildinfo +1 -1
- package/dist/esm/components/DragDrop/DragDropSort.d.ts +2 -2
- package/dist/esm/components/DragDrop/DragDropSort.d.ts.map +1 -1
- package/dist/esm/components/DragDrop/DragDropSort.js +2 -2
- package/dist/esm/components/DragDrop/DragDropSort.js.map +1 -1
- package/dist/esm.tsbuildinfo +1 -1
- package/dist/js/components/DragDrop/DragDropSort.d.ts +2 -2
- package/dist/js/components/DragDrop/DragDropSort.d.ts.map +1 -1
- package/dist/js/components/DragDrop/DragDropSort.js +2 -2
- package/dist/js/components/DragDrop/DragDropSort.js.map +1 -1
- package/package.json +5 -5
- package/src/components/DragDrop/DragDropSort.tsx +4 -4
- package/src/components/DragDrop/__tests__/__snapshots__/DragDrop.test.tsx.snap +81 -15
- package/src/components/DragDrop/examples/BasicSortingWithDragButton.tsx +0 -1
- package/src/components/DragDrop/examples/DragDrop.md +0 -6
- package/src/components/DragDrop/examples/BasicSorting.tsx +0 -19
|
@@ -24,12 +24,12 @@ export interface DragDropSortProps extends DndContextProps {
|
|
|
24
24
|
/** Callback when use begins dragging a draggable object */
|
|
25
25
|
onDrag?: (event: DragDropSortDragStartEvent, oldIndex: number) => void;
|
|
26
26
|
/** The variant determines which component wraps the draggable object.
|
|
27
|
-
* Default
|
|
27
|
+
* Default variant wraps the draggable object in a div.
|
|
28
28
|
* DataList vairant wraps the draggable object in a DataListItem
|
|
29
29
|
* DualListSelectorList variant wraps the draggable objects in a DualListSelectorListItem and a div.pf-c-dual-list-selector__item-text element
|
|
30
30
|
* TableComposable variant wraps the draggable objects in TODO
|
|
31
31
|
* */
|
|
32
|
-
variant?: 'default' | '
|
|
32
|
+
variant?: 'default' | 'DataList' | 'DualListSelectorList' | 'TableComposable';
|
|
33
33
|
}
|
|
34
34
|
export declare const DragDropSort: React.FunctionComponent<DragDropSortProps>;
|
|
35
35
|
//# sourceMappingURL=DragDropSort.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropSort.d.ts","sourceRoot":"","sources":["../../../../src/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;AAYvB,oBAAY,wBAAwB,GAAG,YAAY,CAAC;AACpD,oBAAY,0BAA0B,GAAG,cAAc,CAAC;AAExD,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;AAED;;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,
|
|
1
|
+
{"version":3,"file":"DragDropSort.d.ts","sourceRoot":"","sources":["../../../../src/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;AAYvB,oBAAY,wBAAwB,GAAG,YAAY,CAAC;AACpD,oBAAY,0BAA0B,GAAG,cAAc,CAAC;AAExD,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;AAED;;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,UAAU,GAAG,sBAAsB,GAAG,iBAAiB,CAAC;CAC/E;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAyHnE,CAAC"}
|
|
@@ -44,7 +44,7 @@ const DragDropSort = (_a) => {
|
|
|
44
44
|
content = (React.createElement(DraggableDataListItem_1.DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
45
45
|
break;
|
|
46
46
|
default:
|
|
47
|
-
content = (React.createElement(Draggable_1.Draggable, Object.assign({ useDragButton: variant === '
|
|
47
|
+
content = (React.createElement(Draggable_1.Draggable, Object.assign({ useDragButton: variant === 'default', key: item.id, id: item.id }, item.props), item.content));
|
|
48
48
|
}
|
|
49
49
|
return (React.createElement("div", { className: (0, react_styles_1.css)(drag_drop_1.default.draggable, drag_drop_1.default.modifiers.dragging), style: {
|
|
50
50
|
'--pf-v6-c-draggable--m-dragging--BackgroundColor': 'var(--pf-v6-global--BackgroundColor--100)'
|
|
@@ -58,7 +58,7 @@ const DragDropSort = (_a) => {
|
|
|
58
58
|
case 'DataList':
|
|
59
59
|
return (React.createElement(DraggableDataListItem_1.DraggableDataListItem, Object.assign({ key: item.id, id: item.id }, item.props), item.content));
|
|
60
60
|
default:
|
|
61
|
-
return (React.createElement(Draggable_1.Draggable, Object.assign({ useDragButton: variant === '
|
|
61
|
+
return (React.createElement(Draggable_1.Draggable, Object.assign({ useDragButton: variant === 'default', key: item.id, id: item.id }, item.props), item.content));
|
|
62
62
|
}
|
|
63
63
|
}),
|
|
64
64
|
React.createElement(core_1.DragOverlay, null, activeId && getDragOverlay())));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragDropSort.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragDropSort.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2DAA+C;AAC/C,wCAWuB;AACvB,gDAK2B;AAC3B,2CAAwC;AACxC,mEAAgE;AAChE,2FAAwF;AACxF,mHAAgF;AAoCzE,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,CAAC,OAAO,CAAC,GAAG,EAA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name": "@patternfly/react-drag-drop",
|
|
3
|
-
"version": "6.0.0-alpha.
|
|
3
|
+
"version": "6.0.0-alpha.42",
|
|
4
4
|
"description": "PatternFly drag and drop solution",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
"@dnd-kit/core": "^6.0.8",
|
|
33
33
|
"@dnd-kit/modifiers": "^6.0.1",
|
|
34
34
|
"@dnd-kit/sortable": "^7.0.2",
|
|
35
|
-
"@patternfly/react-core": "^6.0.0-alpha.
|
|
36
|
-
"@patternfly/react-icons": "^6.0.0-alpha.
|
|
37
|
-
"@patternfly/react-styles": "^6.0.0-alpha.
|
|
35
|
+
"@patternfly/react-core": "^6.0.0-alpha.60",
|
|
36
|
+
"@patternfly/react-icons": "^6.0.0-alpha.22",
|
|
37
|
+
"@patternfly/react-styles": "^6.0.0-alpha.22",
|
|
38
38
|
"memoize-one": "^5.1.0",
|
|
39
39
|
"resize-observer-polyfill": "^1.5.1"
|
|
40
40
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"rimraf": "^2.6.2",
|
|
47
47
|
"typescript": "^4.7.4"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a104a4b6124ea9ba1a0581bd983c6c48471fd8cd"
|
|
50
50
|
}
|
|
@@ -49,12 +49,12 @@ export interface DragDropSortProps extends DndContextProps {
|
|
|
49
49
|
/** Callback when use begins dragging a draggable object */
|
|
50
50
|
onDrag?: (event: DragDropSortDragStartEvent, oldIndex: number) => void;
|
|
51
51
|
/** The variant determines which component wraps the draggable object.
|
|
52
|
-
* Default
|
|
52
|
+
* Default variant wraps the draggable object in a div.
|
|
53
53
|
* DataList vairant wraps the draggable object in a DataListItem
|
|
54
54
|
* DualListSelectorList variant wraps the draggable objects in a DualListSelectorListItem and a div.pf-c-dual-list-selector__item-text element
|
|
55
55
|
* TableComposable variant wraps the draggable objects in TODO
|
|
56
56
|
* */
|
|
57
|
-
variant?: 'default' | '
|
|
57
|
+
variant?: 'default' | 'DataList' | 'DualListSelectorList' | 'TableComposable';
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
export const DragDropSort: React.FunctionComponent<DragDropSortProps> = ({
|
|
@@ -115,7 +115,7 @@ export const DragDropSort: React.FunctionComponent<DragDropSortProps> = ({
|
|
|
115
115
|
break;
|
|
116
116
|
default:
|
|
117
117
|
content = (
|
|
118
|
-
<Draggable useDragButton={variant === '
|
|
118
|
+
<Draggable useDragButton={variant === 'default'} key={item.id} id={item.id} {...item.props}>
|
|
119
119
|
{item.content}
|
|
120
120
|
</Draggable>
|
|
121
121
|
);
|
|
@@ -153,7 +153,7 @@ export const DragDropSort: React.FunctionComponent<DragDropSortProps> = ({
|
|
|
153
153
|
);
|
|
154
154
|
default:
|
|
155
155
|
return (
|
|
156
|
-
<Draggable useDragButton={variant === '
|
|
156
|
+
<Draggable useDragButton={variant === 'default'} key={item.id} id={item.id} {...item.props}>
|
|
157
157
|
{item.content}
|
|
158
158
|
</Draggable>
|
|
159
159
|
);
|
|
@@ -7,33 +7,99 @@ exports[`renders some divs 1`] = `
|
|
|
7
7
|
>
|
|
8
8
|
<div>
|
|
9
9
|
<div
|
|
10
|
-
aria-describedby="DndDescribedBy-0"
|
|
11
|
-
aria-disabled="false"
|
|
12
|
-
aria-roledescription="sortable"
|
|
13
10
|
class=""
|
|
14
|
-
role="button"
|
|
15
|
-
tabindex="0"
|
|
16
11
|
>
|
|
12
|
+
<button
|
|
13
|
+
aria-describedby="DndDescribedBy-0"
|
|
14
|
+
aria-disabled="false"
|
|
15
|
+
aria-label="Drag button"
|
|
16
|
+
aria-roledescription="sortable"
|
|
17
|
+
class="pf-v6-c-button pf-m-plain"
|
|
18
|
+
role="button"
|
|
19
|
+
tabindex="0"
|
|
20
|
+
>
|
|
21
|
+
<span
|
|
22
|
+
class="pf-v6-c-data-list__item-draggable-icon"
|
|
23
|
+
>
|
|
24
|
+
<svg
|
|
25
|
+
aria-hidden="true"
|
|
26
|
+
class="pf-v6-svg"
|
|
27
|
+
fill="currentColor"
|
|
28
|
+
height="1em"
|
|
29
|
+
role="img"
|
|
30
|
+
viewBox="0 0 320 512"
|
|
31
|
+
width="1em"
|
|
32
|
+
>
|
|
33
|
+
<path
|
|
34
|
+
d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"
|
|
35
|
+
/>
|
|
36
|
+
</svg>
|
|
37
|
+
</span>
|
|
38
|
+
</button>
|
|
17
39
|
one
|
|
18
40
|
</div>
|
|
19
41
|
<div
|
|
20
|
-
aria-describedby="DndDescribedBy-0"
|
|
21
|
-
aria-disabled="false"
|
|
22
|
-
aria-roledescription="sortable"
|
|
23
42
|
class=""
|
|
24
|
-
role="button"
|
|
25
|
-
tabindex="0"
|
|
26
43
|
>
|
|
44
|
+
<button
|
|
45
|
+
aria-describedby="DndDescribedBy-0"
|
|
46
|
+
aria-disabled="false"
|
|
47
|
+
aria-label="Drag button"
|
|
48
|
+
aria-roledescription="sortable"
|
|
49
|
+
class="pf-v6-c-button pf-m-plain"
|
|
50
|
+
role="button"
|
|
51
|
+
tabindex="0"
|
|
52
|
+
>
|
|
53
|
+
<span
|
|
54
|
+
class="pf-v6-c-data-list__item-draggable-icon"
|
|
55
|
+
>
|
|
56
|
+
<svg
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
class="pf-v6-svg"
|
|
59
|
+
fill="currentColor"
|
|
60
|
+
height="1em"
|
|
61
|
+
role="img"
|
|
62
|
+
viewBox="0 0 320 512"
|
|
63
|
+
width="1em"
|
|
64
|
+
>
|
|
65
|
+
<path
|
|
66
|
+
d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"
|
|
67
|
+
/>
|
|
68
|
+
</svg>
|
|
69
|
+
</span>
|
|
70
|
+
</button>
|
|
27
71
|
two
|
|
28
72
|
</div>
|
|
29
73
|
<div
|
|
30
|
-
aria-describedby="DndDescribedBy-0"
|
|
31
|
-
aria-disabled="false"
|
|
32
|
-
aria-roledescription="sortable"
|
|
33
74
|
class=""
|
|
34
|
-
role="button"
|
|
35
|
-
tabindex="0"
|
|
36
75
|
>
|
|
76
|
+
<button
|
|
77
|
+
aria-describedby="DndDescribedBy-0"
|
|
78
|
+
aria-disabled="false"
|
|
79
|
+
aria-label="Drag button"
|
|
80
|
+
aria-roledescription="sortable"
|
|
81
|
+
class="pf-v6-c-button pf-m-plain"
|
|
82
|
+
role="button"
|
|
83
|
+
tabindex="0"
|
|
84
|
+
>
|
|
85
|
+
<span
|
|
86
|
+
class="pf-v6-c-data-list__item-draggable-icon"
|
|
87
|
+
>
|
|
88
|
+
<svg
|
|
89
|
+
aria-hidden="true"
|
|
90
|
+
class="pf-v6-svg"
|
|
91
|
+
fill="currentColor"
|
|
92
|
+
height="1em"
|
|
93
|
+
role="img"
|
|
94
|
+
viewBox="0 0 320 512"
|
|
95
|
+
width="1em"
|
|
96
|
+
>
|
|
97
|
+
<path
|
|
98
|
+
d="M96 32H32C14.33 32 0 46.33 0 64v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160H32c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zM288 32h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32V64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32zm0 160h-64c-17.67 0-32 14.33-32 32v64c0 17.67 14.33 32 32 32h64c17.67 0 32-14.33 32-32v-64c0-17.67-14.33-32-32-32z"
|
|
99
|
+
/>
|
|
100
|
+
</svg>
|
|
101
|
+
</span>
|
|
102
|
+
</button>
|
|
37
103
|
three
|
|
38
104
|
</div>
|
|
39
105
|
</div>
|
|
@@ -21,12 +21,6 @@ import { DragDropSort } from '@patternfly/react-drag-drop';
|
|
|
21
21
|
|
|
22
22
|
### Basic drag and drop sorting
|
|
23
23
|
|
|
24
|
-
```ts file="./BasicSorting.tsx"
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Basic drag and drop sorting with drag button
|
|
29
|
-
|
|
30
24
|
```ts file="./BasicSortingWithDragButton.tsx"
|
|
31
25
|
|
|
32
26
|
```
|
|
@@ -1,19 +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: 'basic-1', content: 'one' },
|
|
7
|
-
{ id: 'basic-2', content: 'two' },
|
|
8
|
-
{ id: 'basic-3', content: 'three' }
|
|
9
|
-
]);
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<DragDropSort
|
|
13
|
-
items={items}
|
|
14
|
-
onDrop={(_, newItems) => {
|
|
15
|
-
setItems(newItems);
|
|
16
|
-
}}
|
|
17
|
-
/>
|
|
18
|
-
);
|
|
19
|
-
};
|