@patternfly/react-core 4.208.0 → 4.208.3
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 +24 -0
- package/dist/umd/react-core.min.css +93 -93
- package/package.json +5 -5
- package/src/components/DragDrop/examples/DragDrop.md +22 -154
- package/src/components/DragDrop/examples/DragDropBasic.tsx +53 -0
- package/src/components/DragDrop/examples/DragDropMultipleLists.tsx +98 -0
- package/src/components/Wizard/examples/Wizard.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 4.208.3 (2022-05-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @patternfly/react-core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 4.208.2 (2022-05-03)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @patternfly/react-core
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## 4.208.1 (2022-05-03)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @patternfly/react-core
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# 4.208.0 (2022-05-02)
|
|
7
31
|
|
|
8
32
|
|
|
@@ -19757,6 +19757,99 @@ svg.pf-c-spinner.pf-m-xl {
|
|
|
19757
19757
|
margin-left: var(--pf-c-toggle-group__icon--text--MarginLeft);
|
|
19758
19758
|
}
|
|
19759
19759
|
|
|
19760
|
+
.pf-c-tooltip {
|
|
19761
|
+
--pf-c-tooltip--MaxWidth: 18.75rem;
|
|
19762
|
+
--pf-c-tooltip--BoxShadow: var(--pf-global--BoxShadow--md);
|
|
19763
|
+
--pf-c-tooltip__content--PaddingTop: var(--pf-global--spacer--sm);
|
|
19764
|
+
--pf-c-tooltip__content--PaddingRight: var(--pf-global--spacer--sm);
|
|
19765
|
+
--pf-c-tooltip__content--PaddingBottom: var(--pf-global--spacer--sm);
|
|
19766
|
+
--pf-c-tooltip__content--PaddingLeft: var(--pf-global--spacer--sm);
|
|
19767
|
+
--pf-c-tooltip__content--Color: var(--pf-global--Color--light-100);
|
|
19768
|
+
--pf-c-tooltip__content--BackgroundColor: var(--pf-global--BackgroundColor--dark-100);
|
|
19769
|
+
--pf-c-tooltip__content--FontSize: var(--pf-global--FontSize--sm);
|
|
19770
|
+
--pf-c-tooltip__arrow--Width: 0.5rem;
|
|
19771
|
+
--pf-c-tooltip__arrow--Height: 0.5rem;
|
|
19772
|
+
--pf-c-tooltip__arrow--m-top--TranslateX: -50%;
|
|
19773
|
+
--pf-c-tooltip__arrow--m-top--TranslateY: 50%;
|
|
19774
|
+
--pf-c-tooltip__arrow--m-top--Rotate: 45deg;
|
|
19775
|
+
--pf-c-tooltip__arrow--m-right--TranslateX: -50%;
|
|
19776
|
+
--pf-c-tooltip__arrow--m-right--TranslateY: -50%;
|
|
19777
|
+
--pf-c-tooltip__arrow--m-right--Rotate: 45deg;
|
|
19778
|
+
--pf-c-tooltip__arrow--m-bottom--TranslateX: -50%;
|
|
19779
|
+
--pf-c-tooltip__arrow--m-bottom--TranslateY: -50%;
|
|
19780
|
+
--pf-c-tooltip__arrow--m-bottom--Rotate: 45deg;
|
|
19781
|
+
--pf-c-tooltip__arrow--m-left--TranslateX: 50%;
|
|
19782
|
+
--pf-c-tooltip__arrow--m-left--TranslateY: -50%;
|
|
19783
|
+
--pf-c-tooltip__arrow--m-left--Rotate: 45deg;
|
|
19784
|
+
position: relative;
|
|
19785
|
+
max-width: var(--pf-c-tooltip--MaxWidth);
|
|
19786
|
+
box-shadow: var(--pf-c-tooltip--BoxShadow);
|
|
19787
|
+
}
|
|
19788
|
+
|
|
19789
|
+
.pf-c-tooltip.pf-m-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-top-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-top-right .pf-c-tooltip__arrow {
|
|
19790
|
+
bottom: 0;
|
|
19791
|
+
left: 50%;
|
|
19792
|
+
transform: translateX(var(--pf-c-tooltip__arrow--m-top--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-top--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-top--Rotate));
|
|
19793
|
+
}
|
|
19794
|
+
|
|
19795
|
+
.pf-c-tooltip.pf-m-bottom .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-right .pf-c-tooltip__arrow {
|
|
19796
|
+
top: 0;
|
|
19797
|
+
left: 50%;
|
|
19798
|
+
transform: translateX(var(--pf-c-tooltip__arrow--m-bottom--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-bottom--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-bottom--Rotate));
|
|
19799
|
+
}
|
|
19800
|
+
|
|
19801
|
+
.pf-c-tooltip.pf-m-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-left-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-left-bottom .pf-c-tooltip__arrow {
|
|
19802
|
+
top: 50%;
|
|
19803
|
+
right: 0;
|
|
19804
|
+
transform: translateX(var(--pf-c-tooltip__arrow--m-left--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-left--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-left--Rotate));
|
|
19805
|
+
}
|
|
19806
|
+
|
|
19807
|
+
.pf-c-tooltip.pf-m-right .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-bottom .pf-c-tooltip__arrow {
|
|
19808
|
+
top: 50%;
|
|
19809
|
+
left: 0;
|
|
19810
|
+
transform: translateX(var(--pf-c-tooltip__arrow--m-right--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-right--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-right--Rotate));
|
|
19811
|
+
}
|
|
19812
|
+
|
|
19813
|
+
.pf-c-tooltip.pf-m-left-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-top .pf-c-tooltip__arrow {
|
|
19814
|
+
top: var(--pf-c-tooltip__arrow--Height);
|
|
19815
|
+
}
|
|
19816
|
+
|
|
19817
|
+
.pf-c-tooltip.pf-m-left-bottom .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-bottom .pf-c-tooltip__arrow {
|
|
19818
|
+
top: auto;
|
|
19819
|
+
bottom: 0;
|
|
19820
|
+
}
|
|
19821
|
+
|
|
19822
|
+
.pf-c-tooltip.pf-m-top-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-left .pf-c-tooltip__arrow {
|
|
19823
|
+
left: var(--pf-c-tooltip__arrow--Width);
|
|
19824
|
+
}
|
|
19825
|
+
|
|
19826
|
+
.pf-c-tooltip.pf-m-top-right .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-right .pf-c-tooltip__arrow {
|
|
19827
|
+
right: 0;
|
|
19828
|
+
left: auto;
|
|
19829
|
+
}
|
|
19830
|
+
|
|
19831
|
+
.pf-c-tooltip__content {
|
|
19832
|
+
position: relative;
|
|
19833
|
+
padding: var(--pf-c-tooltip__content--PaddingTop) var(--pf-c-tooltip__content--PaddingRight) var(--pf-c-tooltip__content--PaddingBottom) var(--pf-c-tooltip__content--PaddingLeft);
|
|
19834
|
+
font-size: var(--pf-c-tooltip__content--FontSize);
|
|
19835
|
+
color: var(--pf-c-tooltip__content--Color);
|
|
19836
|
+
text-align: center;
|
|
19837
|
+
word-break: break-word;
|
|
19838
|
+
background-color: var(--pf-c-tooltip__content--BackgroundColor);
|
|
19839
|
+
}
|
|
19840
|
+
|
|
19841
|
+
.pf-c-tooltip__content.pf-m-text-align-left {
|
|
19842
|
+
text-align: left;
|
|
19843
|
+
}
|
|
19844
|
+
|
|
19845
|
+
.pf-c-tooltip__arrow {
|
|
19846
|
+
position: absolute;
|
|
19847
|
+
width: var(--pf-c-tooltip__arrow--Width);
|
|
19848
|
+
height: var(--pf-c-tooltip__arrow--Height);
|
|
19849
|
+
pointer-events: none;
|
|
19850
|
+
background-color: var(--pf-c-tooltip__content--BackgroundColor);
|
|
19851
|
+
}
|
|
19852
|
+
|
|
19760
19853
|
.pf-c-toolbar__content-section, .pf-c-toolbar__content, .pf-c-toolbar__item, .pf-c-toolbar__group {
|
|
19761
19854
|
--pf-hidden-visible--visible--Visibility: visible;
|
|
19762
19855
|
--pf-hidden-visible--hidden--Display: none;
|
|
@@ -21138,99 +21231,6 @@ svg.pf-c-spinner.pf-m-xl {
|
|
|
21138
21231
|
--pf-c-toolbar--spacer: 0;
|
|
21139
21232
|
}
|
|
21140
21233
|
|
|
21141
|
-
.pf-c-tooltip {
|
|
21142
|
-
--pf-c-tooltip--MaxWidth: 18.75rem;
|
|
21143
|
-
--pf-c-tooltip--BoxShadow: var(--pf-global--BoxShadow--md);
|
|
21144
|
-
--pf-c-tooltip__content--PaddingTop: var(--pf-global--spacer--sm);
|
|
21145
|
-
--pf-c-tooltip__content--PaddingRight: var(--pf-global--spacer--sm);
|
|
21146
|
-
--pf-c-tooltip__content--PaddingBottom: var(--pf-global--spacer--sm);
|
|
21147
|
-
--pf-c-tooltip__content--PaddingLeft: var(--pf-global--spacer--sm);
|
|
21148
|
-
--pf-c-tooltip__content--Color: var(--pf-global--Color--light-100);
|
|
21149
|
-
--pf-c-tooltip__content--BackgroundColor: var(--pf-global--BackgroundColor--dark-100);
|
|
21150
|
-
--pf-c-tooltip__content--FontSize: var(--pf-global--FontSize--sm);
|
|
21151
|
-
--pf-c-tooltip__arrow--Width: 0.5rem;
|
|
21152
|
-
--pf-c-tooltip__arrow--Height: 0.5rem;
|
|
21153
|
-
--pf-c-tooltip__arrow--m-top--TranslateX: -50%;
|
|
21154
|
-
--pf-c-tooltip__arrow--m-top--TranslateY: 50%;
|
|
21155
|
-
--pf-c-tooltip__arrow--m-top--Rotate: 45deg;
|
|
21156
|
-
--pf-c-tooltip__arrow--m-right--TranslateX: -50%;
|
|
21157
|
-
--pf-c-tooltip__arrow--m-right--TranslateY: -50%;
|
|
21158
|
-
--pf-c-tooltip__arrow--m-right--Rotate: 45deg;
|
|
21159
|
-
--pf-c-tooltip__arrow--m-bottom--TranslateX: -50%;
|
|
21160
|
-
--pf-c-tooltip__arrow--m-bottom--TranslateY: -50%;
|
|
21161
|
-
--pf-c-tooltip__arrow--m-bottom--Rotate: 45deg;
|
|
21162
|
-
--pf-c-tooltip__arrow--m-left--TranslateX: 50%;
|
|
21163
|
-
--pf-c-tooltip__arrow--m-left--TranslateY: -50%;
|
|
21164
|
-
--pf-c-tooltip__arrow--m-left--Rotate: 45deg;
|
|
21165
|
-
position: relative;
|
|
21166
|
-
max-width: var(--pf-c-tooltip--MaxWidth);
|
|
21167
|
-
box-shadow: var(--pf-c-tooltip--BoxShadow);
|
|
21168
|
-
}
|
|
21169
|
-
|
|
21170
|
-
.pf-c-tooltip.pf-m-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-top-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-top-right .pf-c-tooltip__arrow {
|
|
21171
|
-
bottom: 0;
|
|
21172
|
-
left: 50%;
|
|
21173
|
-
transform: translateX(var(--pf-c-tooltip__arrow--m-top--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-top--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-top--Rotate));
|
|
21174
|
-
}
|
|
21175
|
-
|
|
21176
|
-
.pf-c-tooltip.pf-m-bottom .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-right .pf-c-tooltip__arrow {
|
|
21177
|
-
top: 0;
|
|
21178
|
-
left: 50%;
|
|
21179
|
-
transform: translateX(var(--pf-c-tooltip__arrow--m-bottom--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-bottom--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-bottom--Rotate));
|
|
21180
|
-
}
|
|
21181
|
-
|
|
21182
|
-
.pf-c-tooltip.pf-m-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-left-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-left-bottom .pf-c-tooltip__arrow {
|
|
21183
|
-
top: 50%;
|
|
21184
|
-
right: 0;
|
|
21185
|
-
transform: translateX(var(--pf-c-tooltip__arrow--m-left--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-left--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-left--Rotate));
|
|
21186
|
-
}
|
|
21187
|
-
|
|
21188
|
-
.pf-c-tooltip.pf-m-right .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-bottom .pf-c-tooltip__arrow {
|
|
21189
|
-
top: 50%;
|
|
21190
|
-
left: 0;
|
|
21191
|
-
transform: translateX(var(--pf-c-tooltip__arrow--m-right--TranslateX)) translateY(var(--pf-c-tooltip__arrow--m-right--TranslateY)) rotate(var(--pf-c-tooltip__arrow--m-right--Rotate));
|
|
21192
|
-
}
|
|
21193
|
-
|
|
21194
|
-
.pf-c-tooltip.pf-m-left-top .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-top .pf-c-tooltip__arrow {
|
|
21195
|
-
top: var(--pf-c-tooltip__arrow--Height);
|
|
21196
|
-
}
|
|
21197
|
-
|
|
21198
|
-
.pf-c-tooltip.pf-m-left-bottom .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-right-bottom .pf-c-tooltip__arrow {
|
|
21199
|
-
top: auto;
|
|
21200
|
-
bottom: 0;
|
|
21201
|
-
}
|
|
21202
|
-
|
|
21203
|
-
.pf-c-tooltip.pf-m-top-left .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-left .pf-c-tooltip__arrow {
|
|
21204
|
-
left: var(--pf-c-tooltip__arrow--Width);
|
|
21205
|
-
}
|
|
21206
|
-
|
|
21207
|
-
.pf-c-tooltip.pf-m-top-right .pf-c-tooltip__arrow, .pf-c-tooltip.pf-m-bottom-right .pf-c-tooltip__arrow {
|
|
21208
|
-
right: 0;
|
|
21209
|
-
left: auto;
|
|
21210
|
-
}
|
|
21211
|
-
|
|
21212
|
-
.pf-c-tooltip__content {
|
|
21213
|
-
position: relative;
|
|
21214
|
-
padding: var(--pf-c-tooltip__content--PaddingTop) var(--pf-c-tooltip__content--PaddingRight) var(--pf-c-tooltip__content--PaddingBottom) var(--pf-c-tooltip__content--PaddingLeft);
|
|
21215
|
-
font-size: var(--pf-c-tooltip__content--FontSize);
|
|
21216
|
-
color: var(--pf-c-tooltip__content--Color);
|
|
21217
|
-
text-align: center;
|
|
21218
|
-
word-break: break-word;
|
|
21219
|
-
background-color: var(--pf-c-tooltip__content--BackgroundColor);
|
|
21220
|
-
}
|
|
21221
|
-
|
|
21222
|
-
.pf-c-tooltip__content.pf-m-text-align-left {
|
|
21223
|
-
text-align: left;
|
|
21224
|
-
}
|
|
21225
|
-
|
|
21226
|
-
.pf-c-tooltip__arrow {
|
|
21227
|
-
position: absolute;
|
|
21228
|
-
width: var(--pf-c-tooltip__arrow--Width);
|
|
21229
|
-
height: var(--pf-c-tooltip__arrow--Height);
|
|
21230
|
-
pointer-events: none;
|
|
21231
|
-
background-color: var(--pf-c-tooltip__content--BackgroundColor);
|
|
21232
|
-
}
|
|
21233
|
-
|
|
21234
21234
|
.pf-c-number-input .pf-c-form-control {
|
|
21235
21235
|
appearance: textfield;
|
|
21236
21236
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.208.
|
|
3
|
+
"version": "4.208.3",
|
|
4
4
|
"description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
|
|
5
5
|
"main": "dist/js/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.59.
|
|
38
|
-
"@patternfly/react-styles": "^4.58.
|
|
39
|
-
"@patternfly/react-tokens": "^4.60.
|
|
37
|
+
"@patternfly/react-icons": "^4.59.3",
|
|
38
|
+
"@patternfly/react-styles": "^4.58.3",
|
|
39
|
+
"@patternfly/react-tokens": "^4.60.3",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
61
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "30d9c6403ae0d3660eb0389fcae95e6e72a41d9e"
|
|
64
64
|
}
|
|
@@ -1,175 +1,43 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: Drag and drop
|
|
3
3
|
section: components
|
|
4
|
-
propComponents: [
|
|
5
|
-
DragDrop,
|
|
6
|
-
Draggable,
|
|
7
|
-
Droppable,
|
|
8
|
-
DraggableItemPosition
|
|
9
|
-
]
|
|
4
|
+
propComponents: [DragDrop, Draggable, Droppable, DraggableItemPosition]
|
|
10
5
|
beta: true
|
|
11
6
|
---
|
|
12
7
|
|
|
13
|
-
You can use `DragDrop` to move items in or between lists. `DragDrop`
|
|
8
|
+
You can use the `DragDrop` component to move items in or between lists. The `DragDrop` component should contain `Droppable` components which contain `Draggable` components.
|
|
14
9
|
|
|
15
|
-
```
|
|
10
|
+
```ts noLive
|
|
16
11
|
import React from 'react';
|
|
17
12
|
import { DragDrop, Draggable, Droppable } from '@patternfly/react-core';
|
|
18
13
|
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
You can have as many Draggables as you like
|
|
26
|
-
</
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
</
|
|
14
|
+
const DragDropCodeSample: React.FunctionComponent = () => (
|
|
15
|
+
<DragDrop>
|
|
16
|
+
{' '}
|
|
17
|
+
{/* DragDrop houses the context for dragging and dropping */}
|
|
18
|
+
<Droppable>
|
|
19
|
+
<Draggable>You can put anything here! It will be wrapped in a styled div.</Draggable>
|
|
20
|
+
<Draggable>You can have as many Draggables as you like.</Draggable>
|
|
21
|
+
</Droppable>
|
|
22
|
+
<Droppable>
|
|
23
|
+
{' '}
|
|
24
|
+
{/* You can also have many droppables! */}
|
|
25
|
+
<Draggable />
|
|
26
|
+
</Droppable>
|
|
27
|
+
</DragDrop>
|
|
28
|
+
);
|
|
32
29
|
```
|
|
30
|
+
|
|
33
31
|
Note: Keyboard accessibility and screen reader accessibility are still in development.
|
|
34
32
|
|
|
35
33
|
## Examples
|
|
36
|
-
### Basic
|
|
37
|
-
|
|
38
|
-
```js
|
|
39
|
-
import React from 'react';
|
|
40
|
-
import { DragDrop, Draggable, Droppable } from '@patternfly/react-core';
|
|
41
|
-
|
|
42
|
-
const getItems = count =>
|
|
43
|
-
Array.from({ length: count }, (v, k) => k).map(k => ({
|
|
44
|
-
id: `item-${k}`,
|
|
45
|
-
content: `item ${k} `.repeat(k === 4 ? 20 : 1)
|
|
46
|
-
}));
|
|
47
|
-
|
|
48
|
-
const reorder = (list, startIndex, endIndex) => {
|
|
49
|
-
const result = Array.from(list);
|
|
50
|
-
const [removed] = result.splice(startIndex, 1);
|
|
51
|
-
result.splice(endIndex, 0, removed);
|
|
52
|
-
return result;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
Basic = () => {
|
|
56
|
-
const [items, setItems] = React.useState(getItems(10));
|
|
57
|
-
|
|
58
|
-
function onDrop(source, dest) {
|
|
59
|
-
if (dest) {
|
|
60
|
-
const newItems = reorder(
|
|
61
|
-
items,
|
|
62
|
-
source.index,
|
|
63
|
-
dest.index
|
|
64
|
-
);
|
|
65
|
-
setItems(newItems);
|
|
66
34
|
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
35
|
+
### Basic
|
|
71
36
|
|
|
72
|
-
|
|
73
|
-
<DragDrop onDrop={onDrop}>
|
|
74
|
-
<Droppable>
|
|
75
|
-
{items.map(({ id, content }, i) =>
|
|
76
|
-
<Draggable key={i} style={{ padding: '8px' }}>
|
|
77
|
-
{content}
|
|
78
|
-
</Draggable>
|
|
79
|
-
)}
|
|
80
|
-
</Droppable>
|
|
81
|
-
</DragDrop>
|
|
82
|
-
);
|
|
83
|
-
}
|
|
37
|
+
```ts file="./DragDropBasic.tsx"
|
|
84
38
|
```
|
|
85
39
|
|
|
86
40
|
### Multiple lists
|
|
87
41
|
|
|
88
|
-
```
|
|
89
|
-
import React from 'react';
|
|
90
|
-
import { DragDrop, Draggable, Droppable, Split, SplitItem } from '@patternfly/react-core';
|
|
91
|
-
|
|
92
|
-
const getItems = (count, start) =>
|
|
93
|
-
Array.from({ length: count }, (v, k) => k).map(k => ({
|
|
94
|
-
id: `item-${k + start}`,
|
|
95
|
-
content: `item ${k + start} `.repeat(k === 4 ? 20 : 1)
|
|
96
|
-
}));
|
|
97
|
-
|
|
98
|
-
const reorder = (list, startIndex, endIndex) => {
|
|
99
|
-
const result = Array.from(list);
|
|
100
|
-
const [removed] = result.splice(startIndex, 1);
|
|
101
|
-
result.splice(endIndex, 0, removed);
|
|
102
|
-
return result;
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const move = (source, destination, sourceIndex, destIndex) => {
|
|
106
|
-
const sourceClone = Array.from(source);
|
|
107
|
-
const destClone = Array.from(destination);
|
|
108
|
-
const [removed] = sourceClone.splice(sourceIndex, 1);
|
|
109
|
-
destClone.splice(destIndex, 0, removed);
|
|
110
|
-
return [sourceClone, destClone];
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
MultiList = () => {
|
|
114
|
-
const [items, setItems] = React.useState({
|
|
115
|
-
items1: getItems(10, 0),
|
|
116
|
-
items2: getItems(5, 10)
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
function onDrop(source, dest) {
|
|
120
|
-
console.log(source, dest);
|
|
121
|
-
if (dest) {
|
|
122
|
-
if (source.droppableId === dest.droppableId) {
|
|
123
|
-
const newItems = reorder(
|
|
124
|
-
source.droppableId === 'items1' ? items.items1 : items.items2,
|
|
125
|
-
source.index,
|
|
126
|
-
dest.index
|
|
127
|
-
);
|
|
128
|
-
if (source.droppableId === 'items1') {
|
|
129
|
-
setItems({
|
|
130
|
-
items1: newItems,
|
|
131
|
-
items2: items.items2
|
|
132
|
-
});
|
|
133
|
-
} else {
|
|
134
|
-
setItems({
|
|
135
|
-
items1: items.items1,
|
|
136
|
-
items2: newItems
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
} else {
|
|
140
|
-
const [newItems1, newItems2] = move(
|
|
141
|
-
source.droppableId === 'items1' ? items.items1 : items.items2,
|
|
142
|
-
dest.droppableId === 'items1' ? items.items1 : items.items2,
|
|
143
|
-
source.index,
|
|
144
|
-
dest.index
|
|
145
|
-
);
|
|
146
|
-
setItems({
|
|
147
|
-
items1: source.droppableId === 'items1' ? newItems1 : newItems2,
|
|
148
|
-
items2: dest.droppableId === 'items1' ? newItems1 : newItems2
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
return (
|
|
157
|
-
<DragDrop onDrop={onDrop}>
|
|
158
|
-
<Split hasGutter>
|
|
159
|
-
{Object.entries(items).map(([key, subitems]) =>
|
|
160
|
-
<SplitItem key={key} style={{ flex: 1 }}>
|
|
161
|
-
<Droppable zone="multizone" droppableId={key}>
|
|
162
|
-
{subitems.map(({ id, content }, i) =>
|
|
163
|
-
<Draggable key={id} style={{ padding: '8px' }}>
|
|
164
|
-
{content}
|
|
165
|
-
</Draggable>
|
|
166
|
-
)}
|
|
167
|
-
</Droppable>
|
|
168
|
-
</SplitItem>
|
|
169
|
-
)}
|
|
170
|
-
</Split>
|
|
171
|
-
</DragDrop>
|
|
172
|
-
);
|
|
173
|
-
}
|
|
42
|
+
```ts file="./DragDropMultipleLists.tsx"
|
|
174
43
|
```
|
|
175
|
-
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DragDrop, Draggable, Droppable } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
interface ItemType {
|
|
5
|
+
id: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface SourceType {
|
|
10
|
+
droppableId: string;
|
|
11
|
+
index: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface DestinationType extends SourceType {}
|
|
15
|
+
|
|
16
|
+
const getItems = (count: number) =>
|
|
17
|
+
Array.from({ length: count }, (_, idx) => idx).map(idx => ({
|
|
18
|
+
id: `item-${idx}`,
|
|
19
|
+
content: `item ${idx} `.repeat(idx === 4 ? 20 : 1)
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
const reorder = (list: ItemType[], startIndex: number, endIndex: number) => {
|
|
23
|
+
const result = list;
|
|
24
|
+
const [removed] = result.splice(startIndex, 1);
|
|
25
|
+
result.splice(endIndex, 0, removed);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const DragDropBasic: React.FunctionComponent = () => {
|
|
30
|
+
const [items, setItems] = React.useState(getItems(10));
|
|
31
|
+
|
|
32
|
+
function onDrop(source: SourceType, dest: DestinationType) {
|
|
33
|
+
if (dest) {
|
|
34
|
+
const newItems = reorder(items, source.index, dest.index);
|
|
35
|
+
setItems(newItems);
|
|
36
|
+
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<DragDrop onDrop={onDrop}>
|
|
44
|
+
<Droppable>
|
|
45
|
+
{items.map(({ content }, i) => (
|
|
46
|
+
<Draggable key={i} style={{ padding: '8px' }}>
|
|
47
|
+
{content}
|
|
48
|
+
</Draggable>
|
|
49
|
+
))}
|
|
50
|
+
</Droppable>
|
|
51
|
+
</DragDrop>
|
|
52
|
+
);
|
|
53
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DragDrop, Draggable, Droppable, Split, SplitItem } from '@patternfly/react-core';
|
|
3
|
+
|
|
4
|
+
interface ItemType {
|
|
5
|
+
id: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface SourceType {
|
|
10
|
+
droppableId: string;
|
|
11
|
+
index: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface DestinationType extends SourceType {}
|
|
15
|
+
|
|
16
|
+
const getItems = (count: number, startIndex: number) =>
|
|
17
|
+
Array.from({ length: count }, (_, idx) => idx + startIndex).map(idx => ({
|
|
18
|
+
id: `item-${idx}`,
|
|
19
|
+
content: `item ${idx} `.repeat(idx === 4 ? 20 : 1)
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
const reorder = (list: ItemType[], startIndex: number, endIndex: number) => {
|
|
23
|
+
const result = list;
|
|
24
|
+
const [removed] = result.splice(startIndex, 1);
|
|
25
|
+
result.splice(endIndex, 0, removed);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const move = (source: ItemType[], destination: ItemType[], sourceIndex: number, destIndex: number) => {
|
|
30
|
+
const sourceClone = source;
|
|
31
|
+
const destClone = destination;
|
|
32
|
+
const [removed] = sourceClone.splice(sourceIndex, 1);
|
|
33
|
+
destClone.splice(destIndex, 0, removed);
|
|
34
|
+
return [sourceClone, destClone];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const DragDropMultipleLists: React.FunctionComponent = () => {
|
|
38
|
+
const [items, setItems] = React.useState({
|
|
39
|
+
items1: getItems(10, 0),
|
|
40
|
+
items2: getItems(5, 10)
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function onDrop(source: SourceType, dest: DestinationType) {
|
|
44
|
+
// eslint-disable-next-line no-console
|
|
45
|
+
console.log(source, dest);
|
|
46
|
+
if (dest) {
|
|
47
|
+
if (source.droppableId === dest.droppableId) {
|
|
48
|
+
const newItems = reorder(
|
|
49
|
+
source.droppableId === 'items1' ? items.items1 : items.items2,
|
|
50
|
+
source.index,
|
|
51
|
+
dest.index
|
|
52
|
+
);
|
|
53
|
+
if (source.droppableId === 'items1') {
|
|
54
|
+
setItems({
|
|
55
|
+
items1: newItems,
|
|
56
|
+
items2: items.items2
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
setItems({
|
|
60
|
+
items1: items.items1,
|
|
61
|
+
items2: newItems
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
const [newItems1, newItems2] = move(
|
|
66
|
+
source.droppableId === 'items1' ? items.items1 : items.items2,
|
|
67
|
+
dest.droppableId === 'items1' ? items.items1 : items.items2,
|
|
68
|
+
source.index,
|
|
69
|
+
dest.index
|
|
70
|
+
);
|
|
71
|
+
setItems({
|
|
72
|
+
items1: source.droppableId === 'items1' ? newItems1 : newItems2,
|
|
73
|
+
items2: dest.droppableId === 'items1' ? newItems1 : newItems2
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<DragDrop onDrop={onDrop}>
|
|
83
|
+
<Split hasGutter>
|
|
84
|
+
{Object.entries(items).map(([key, subitems]) => (
|
|
85
|
+
<SplitItem key={key} style={{ flex: 1 }}>
|
|
86
|
+
<Droppable zone="multizone" droppableId={key}>
|
|
87
|
+
{subitems.map(({ id, content }) => (
|
|
88
|
+
<Draggable key={id} style={{ padding: '8px' }}>
|
|
89
|
+
{content}
|
|
90
|
+
</Draggable>
|
|
91
|
+
))}
|
|
92
|
+
</Droppable>
|
|
93
|
+
</SplitItem>
|
|
94
|
+
))}
|
|
95
|
+
</Split>
|
|
96
|
+
</DragDrop>
|
|
97
|
+
);
|
|
98
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
id: Wizard
|
|
3
3
|
section: components
|
|
4
4
|
cssPrefix: pf-c-wizard
|
|
5
|
-
propComponents: ['Wizard', 'WizardNav', 'WizardNavItem', 'WizardHeader', 'WizardBody', 'WizardFooter', 'WizardToggle']
|
|
5
|
+
propComponents: ['Wizard', 'WizardNav', 'WizardNavItem', 'WizardHeader', 'WizardBody', 'WizardFooter', 'WizardToggle', 'WizardStep']
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
import { Button, Wizard, WizardFooter, WizardContextConsumer, ModalVariant, Alert, EmptyState, EmptyStateIcon, EmptyStateBody, EmptyStateSecondaryActions, Title, Progress } from '@patternfly/react-core';
|