@patternfly/react-drag-drop 6.0.0-alpha.88 → 6.0.0-prerelease.1
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 +7 -0
- package/dist/cjs.tsbuildinfo +1 -1
- package/dist/esm/components/DragDrop/DragButton.d.ts +5 -1
- package/dist/esm/components/DragDrop/DragButton.d.ts.map +1 -1
- package/dist/esm/components/DragDrop/DragButton.js +4 -5
- package/dist/esm/components/DragDrop/DragButton.js.map +1 -1
- package/dist/esm.tsbuildinfo +1 -1
- package/dist/js/components/DragDrop/DragButton.d.ts +5 -1
- package/dist/js/components/DragDrop/DragButton.d.ts.map +1 -1
- package/dist/js/components/DragDrop/DragButton.js +4 -5
- package/dist/js/components/DragDrop/DragButton.js.map +1 -1
- package/package.json +6 -6
- package/src/components/DragDrop/DragButton.tsx +23 -11
- package/src/components/DragDrop/__tests__/__snapshots__/DragDrop.test.tsx.snap +63 -39
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export interface DragButtonProps extends React.HTMLProps<HTMLButtonElement> {
|
|
2
|
+
export interface DragButtonProps extends Omit<React.HTMLProps<HTMLButtonElement>, 'size'> {
|
|
3
3
|
/** Additional classes added to the drag button */
|
|
4
4
|
className?: string;
|
|
5
5
|
/** Sets button type */
|
|
6
6
|
type?: 'button' | 'submit' | 'reset';
|
|
7
7
|
/** Flag indicating if drag is disabled for the item */
|
|
8
8
|
isDisabled?: boolean;
|
|
9
|
+
/** Accessible name of the drag button. */
|
|
10
|
+
'aria-label'?: string;
|
|
11
|
+
/** Id or list of id's that label the drag button. */
|
|
12
|
+
'aria-labelledby'?: string;
|
|
9
13
|
}
|
|
10
14
|
export declare const DragButton: React.FunctionComponent<DragButtonProps>;
|
|
11
15
|
//# sourceMappingURL=DragButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragButton.d.ts","sourceRoot":"","sources":["../../../../src/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;
|
|
1
|
+
{"version":3,"file":"DragButton.d.ts","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACvF,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;IACrB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAkB/D,CAAC"}
|
|
@@ -4,14 +4,13 @@ exports.DragButton = void 0;
|
|
|
4
4
|
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
|
+
const react_core_1 = require("@patternfly/react-core");
|
|
7
8
|
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"));
|
|
9
9
|
const grip_vertical_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/grip-vertical-icon'));
|
|
10
10
|
const DragButton = (_a) => {
|
|
11
|
-
var { className } = _a, props = tslib_1.__rest(_a, ["className"]);
|
|
12
|
-
return (React.createElement(
|
|
13
|
-
|
|
14
|
-
React.createElement(grip_vertical_icon_1.default, null))));
|
|
11
|
+
var { className, 'aria-label': ariaLabel = 'Drag button', 'aria-labelledby': ariaLabelledby } = _a, props = tslib_1.__rest(_a, ["className", 'aria-label', 'aria-labelledby']);
|
|
12
|
+
return (React.createElement(react_core_1.Button, Object.assign({ variant: "plain", className: (0, react_styles_1.css)(className), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, icon: React.createElement("span", { className: (0, react_styles_1.css)(data_list_1.default.dataListItemDraggableIcon) },
|
|
13
|
+
React.createElement(grip_vertical_icon_1.default, null)) }, props)));
|
|
15
14
|
};
|
|
16
15
|
exports.DragButton = DragButton;
|
|
17
16
|
exports.DragButton.displayName = 'DragButton';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragButton.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragButton.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2DAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"DragButton.js","sourceRoot":"","sources":["../../../../src/components/DragDrop/DragButton.tsx"],"names":[],"mappings":";;;;AAAA,qDAA+B;AAC/B,2DAA+C;AAC/C,uDAAgD;AAChD,mHAA0F;;AAgBnF,MAAM,UAAU,GAA6C,CAAC,EAKnD,EAAE,EAAE;QAL+C,EACnE,SAAS,EACT,YAAY,EAAE,SAAS,GAAG,aAAa,EACvC,iBAAiB,EAAE,cAAc,OAEjB,EADb,KAAK,sBAJ2D,8CAKpE,CADS;IACa,OAAA,CACrB,oBAAC,mBAAM,kBACL,OAAO,EAAC,OAAO,EACf,SAAS,EAAE,IAAA,kBAAG,EAAC,SAAS,CAAC,gBACb,SAAS,qBACJ,cAAc,EAC/B,IAAI,EACF,8BAAM,SAAS,EAAE,IAAA,kBAAG,EAAC,mBAAgB,CAAC,yBAAyB,CAAC;YAC9D,oBAAC,4BAAgB,OAAG,CACf,IAEL,KAAK,EACT,CACH,CAAA;CAAA,CAAC;AAlBW,QAAA,UAAU,cAkBrB;AACF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-drag-drop",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-prerelease.1",
|
|
4
4
|
"description": "PatternFly drag and drop solution",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
"clean": "rimraf dist"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@dnd-kit/core": "^6.0
|
|
32
|
+
"@dnd-kit/core": "^6.1.0",
|
|
33
33
|
"@dnd-kit/modifiers": "^6.0.1",
|
|
34
34
|
"@dnd-kit/sortable": "^7.0.2",
|
|
35
|
-
"@patternfly/react-core": "^6.0.0-
|
|
36
|
-
"@patternfly/react-icons": "^6.0.0-
|
|
37
|
-
"@patternfly/react-styles": "^6.0.0-
|
|
35
|
+
"@patternfly/react-core": "^6.0.0-prerelease.1",
|
|
36
|
+
"@patternfly/react-icons": "^6.0.0-prerelease.1",
|
|
37
|
+
"@patternfly/react-styles": "^6.0.0-prerelease.1",
|
|
38
38
|
"resize-observer-polyfill": "^1.5.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": "^17 || ^18",
|
|
42
42
|
"react-dom": "^17 || ^18"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "a2d8b200096bfd32dc19df52ac084fd68ae0b26f"
|
|
45
45
|
}
|
|
@@ -1,27 +1,39 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
|
+
import { Button } from '@patternfly/react-core';
|
|
3
4
|
import dragButtonStyles from '@patternfly/react-styles/css/components/DataList/data-list';
|
|
4
|
-
import buttonStyles from '@patternfly/react-styles/css/components/Button/button';
|
|
5
5
|
import GripVerticalIcon from '@patternfly/react-icons/dist/esm/icons/grip-vertical-icon';
|
|
6
6
|
|
|
7
|
-
export interface DragButtonProps extends React.HTMLProps<HTMLButtonElement> {
|
|
7
|
+
export interface DragButtonProps extends Omit<React.HTMLProps<HTMLButtonElement>, 'size'> {
|
|
8
8
|
/** Additional classes added to the drag button */
|
|
9
9
|
className?: string;
|
|
10
10
|
/** Sets button type */
|
|
11
11
|
type?: 'button' | 'submit' | 'reset';
|
|
12
12
|
/** Flag indicating if drag is disabled for the item */
|
|
13
13
|
isDisabled?: boolean;
|
|
14
|
+
/** Accessible name of the drag button. */
|
|
15
|
+
'aria-label'?: string;
|
|
16
|
+
/** Id or list of id's that label the drag button. */
|
|
17
|
+
'aria-labelledby'?: string;
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
export const DragButton: React.FunctionComponent<DragButtonProps> = ({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
export const DragButton: React.FunctionComponent<DragButtonProps> = ({
|
|
21
|
+
className,
|
|
22
|
+
'aria-label': ariaLabel = 'Drag button',
|
|
23
|
+
'aria-labelledby': ariaLabelledby,
|
|
24
|
+
...props
|
|
25
|
+
}: DragButtonProps) => (
|
|
26
|
+
<Button
|
|
27
|
+
variant="plain"
|
|
28
|
+
className={css(className)}
|
|
29
|
+
aria-label={ariaLabel}
|
|
30
|
+
aria-labelledby={ariaLabelledby}
|
|
31
|
+
icon={
|
|
32
|
+
<span className={css(dragButtonStyles.dataListItemDraggableIcon)}>
|
|
33
|
+
<GripVerticalIcon />
|
|
34
|
+
</span>
|
|
35
|
+
}
|
|
20
36
|
{...props}
|
|
21
|
-
|
|
22
|
-
<span className={css(dragButtonStyles.dataListItemDraggableIcon)}>
|
|
23
|
-
<GripVerticalIcon />
|
|
24
|
-
</span>
|
|
25
|
-
</button>
|
|
37
|
+
/>
|
|
26
38
|
);
|
|
27
39
|
DragButton.displayName = 'DragButton';
|
|
@@ -15,25 +15,33 @@ exports[`renders some divs 1`] = `
|
|
|
15
15
|
aria-label="Drag button"
|
|
16
16
|
aria-roledescription="sortable"
|
|
17
17
|
class="pf-v6-c-button pf-m-plain"
|
|
18
|
+
data-ouia-component-id="OUIA-Generated-Button-plain-1"
|
|
19
|
+
data-ouia-component-type="PF6/Button"
|
|
20
|
+
data-ouia-safe="true"
|
|
18
21
|
role="button"
|
|
19
22
|
tabindex="0"
|
|
23
|
+
type="button"
|
|
20
24
|
>
|
|
21
25
|
<span
|
|
22
|
-
class="pf-v6-c-
|
|
26
|
+
class="pf-v6-c-button__icon"
|
|
23
27
|
>
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
class="pf-v6-svg"
|
|
27
|
-
fill="currentColor"
|
|
28
|
-
height="1em"
|
|
29
|
-
role="img"
|
|
30
|
-
viewBox="0 0 320 512"
|
|
31
|
-
width="1em"
|
|
28
|
+
<span
|
|
29
|
+
class="pf-v6-c-data-list__item-draggable-icon"
|
|
32
30
|
>
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
<svg
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
class="pf-v6-svg"
|
|
34
|
+
fill="currentColor"
|
|
35
|
+
height="1em"
|
|
36
|
+
role="img"
|
|
37
|
+
viewBox="0 0 320 512"
|
|
38
|
+
width="1em"
|
|
39
|
+
>
|
|
40
|
+
<path
|
|
41
|
+
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"
|
|
42
|
+
/>
|
|
43
|
+
</svg>
|
|
44
|
+
</span>
|
|
37
45
|
</span>
|
|
38
46
|
</button>
|
|
39
47
|
one
|
|
@@ -47,25 +55,33 @@ exports[`renders some divs 1`] = `
|
|
|
47
55
|
aria-label="Drag button"
|
|
48
56
|
aria-roledescription="sortable"
|
|
49
57
|
class="pf-v6-c-button pf-m-plain"
|
|
58
|
+
data-ouia-component-id="OUIA-Generated-Button-plain-2"
|
|
59
|
+
data-ouia-component-type="PF6/Button"
|
|
60
|
+
data-ouia-safe="true"
|
|
50
61
|
role="button"
|
|
51
62
|
tabindex="0"
|
|
63
|
+
type="button"
|
|
52
64
|
>
|
|
53
65
|
<span
|
|
54
|
-
class="pf-v6-c-
|
|
66
|
+
class="pf-v6-c-button__icon"
|
|
55
67
|
>
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
class="pf-v6-svg"
|
|
59
|
-
fill="currentColor"
|
|
60
|
-
height="1em"
|
|
61
|
-
role="img"
|
|
62
|
-
viewBox="0 0 320 512"
|
|
63
|
-
width="1em"
|
|
68
|
+
<span
|
|
69
|
+
class="pf-v6-c-data-list__item-draggable-icon"
|
|
64
70
|
>
|
|
65
|
-
<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
<svg
|
|
72
|
+
aria-hidden="true"
|
|
73
|
+
class="pf-v6-svg"
|
|
74
|
+
fill="currentColor"
|
|
75
|
+
height="1em"
|
|
76
|
+
role="img"
|
|
77
|
+
viewBox="0 0 320 512"
|
|
78
|
+
width="1em"
|
|
79
|
+
>
|
|
80
|
+
<path
|
|
81
|
+
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"
|
|
82
|
+
/>
|
|
83
|
+
</svg>
|
|
84
|
+
</span>
|
|
69
85
|
</span>
|
|
70
86
|
</button>
|
|
71
87
|
two
|
|
@@ -79,25 +95,33 @@ exports[`renders some divs 1`] = `
|
|
|
79
95
|
aria-label="Drag button"
|
|
80
96
|
aria-roledescription="sortable"
|
|
81
97
|
class="pf-v6-c-button pf-m-plain"
|
|
98
|
+
data-ouia-component-id="OUIA-Generated-Button-plain-3"
|
|
99
|
+
data-ouia-component-type="PF6/Button"
|
|
100
|
+
data-ouia-safe="true"
|
|
82
101
|
role="button"
|
|
83
102
|
tabindex="0"
|
|
103
|
+
type="button"
|
|
84
104
|
>
|
|
85
105
|
<span
|
|
86
|
-
class="pf-v6-c-
|
|
106
|
+
class="pf-v6-c-button__icon"
|
|
87
107
|
>
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
class="pf-v6-svg"
|
|
91
|
-
fill="currentColor"
|
|
92
|
-
height="1em"
|
|
93
|
-
role="img"
|
|
94
|
-
viewBox="0 0 320 512"
|
|
95
|
-
width="1em"
|
|
108
|
+
<span
|
|
109
|
+
class="pf-v6-c-data-list__item-draggable-icon"
|
|
96
110
|
>
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
111
|
+
<svg
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
class="pf-v6-svg"
|
|
114
|
+
fill="currentColor"
|
|
115
|
+
height="1em"
|
|
116
|
+
role="img"
|
|
117
|
+
viewBox="0 0 320 512"
|
|
118
|
+
width="1em"
|
|
119
|
+
>
|
|
120
|
+
<path
|
|
121
|
+
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"
|
|
122
|
+
/>
|
|
123
|
+
</svg>
|
|
124
|
+
</span>
|
|
101
125
|
</span>
|
|
102
126
|
</button>
|
|
103
127
|
three
|