@patternfly/react-core 4.208.1 → 4.208.4

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 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.4 (2022-05-03)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-core
9
+
10
+
11
+
12
+
13
+
14
+ ## 4.208.3 (2022-05-03)
15
+
16
+ **Note:** Version bump only for package @patternfly/react-core
17
+
18
+
19
+
20
+
21
+
22
+ ## 4.208.2 (2022-05-03)
23
+
24
+ **Note:** Version bump only for package @patternfly/react-core
25
+
26
+
27
+
28
+
29
+
6
30
  ## 4.208.1 (2022-05-03)
7
31
 
8
32
  **Note:** Version bump only for package @patternfly/react-core
package/README.md CHANGED
@@ -47,8 +47,7 @@ export default <Button variant="primary">Button</Button>;
47
47
  All component documentation is available on [PatternFly.org](https://www.patternfly.org/v4/components/about-modal).
48
48
 
49
49
  #### Advanced usage
50
- 1. [Applying Overpass font](../../ADVANCED-USAGE-README.md#Applying-Overpass-font)
51
- 2. [Tree shaking](../../ADVANCED-USAGE-README.md#Tree-shaking)
50
+ 1. [Applying Overpass font](https://github.com/patternfly/patternfly-react/blob/main/ADVANCED-USAGE-README.md#Applying-Overpass-font)
52
51
 
53
52
  ### Contribution guidelines
54
53
  All React contributors must first be [PatternFly community contributors](https://www.patternfly.org/v4/contribute/about). If you are already a PatternFly community contributor, check out the [React contribution guidelines](https://github.com/patternfly/patternfly-react/tree/main/CONTRIBUTING.md) to make React contributions.
@@ -26001,21 +26001,6 @@ svg.pf-c-spinner.pf-m-xl {
26001
26001
  margin-right: var(--pf-l-level--m-gutter--MarginRight);
26002
26002
  }
26003
26003
 
26004
- .pf-l-stack {
26005
- --pf-l-stack--m-gutter--MarginBottom: var(--pf-global--gutter);
26006
- display: flex;
26007
- flex-direction: column;
26008
- height: 100%;
26009
- }
26010
-
26011
- .pf-l-stack__item.pf-m-fill {
26012
- flex-grow: 1;
26013
- }
26014
-
26015
- .pf-l-stack.pf-m-gutter > *:not(:last-child) {
26016
- margin-bottom: var(--pf-l-stack--m-gutter--MarginBottom);
26017
- }
26018
-
26019
26004
  .pf-l-split {
26020
26005
  --pf-l-split--m-gutter--MarginRight: var(--pf-global--gutter);
26021
26006
  display: flex;
@@ -26035,6 +26020,21 @@ svg.pf-c-spinner.pf-m-xl {
26035
26020
  margin-right: var(--pf-l-split--m-gutter--MarginRight);
26036
26021
  }
26037
26022
 
26023
+ .pf-l-stack {
26024
+ --pf-l-stack--m-gutter--MarginBottom: var(--pf-global--gutter);
26025
+ display: flex;
26026
+ flex-direction: column;
26027
+ height: 100%;
26028
+ }
26029
+
26030
+ .pf-l-stack__item.pf-m-fill {
26031
+ flex-grow: 1;
26032
+ }
26033
+
26034
+ .pf-l-stack.pf-m-gutter > *:not(:last-child) {
26035
+ margin-bottom: var(--pf-l-stack--m-gutter--MarginBottom);
26036
+ }
26037
+
26038
26038
  .pf-c-alert-group {
26039
26039
  --pf-c-alert-group__item--MarginTop: var(--pf-global--spacer--sm);
26040
26040
  --pf-c-alert-group--m-toast--Top: var(--pf-global--spacer--2xl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.208.1",
3
+ "version": "4.208.4",
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.1",
38
- "@patternfly/react-styles": "^4.58.1",
39
- "@patternfly/react-tokens": "^4.60.1",
37
+ "@patternfly/react-icons": "^4.59.4",
38
+ "@patternfly/react-styles": "^4.58.4",
39
+ "@patternfly/react-tokens": "^4.60.4",
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": "5daa1759676939afef88d0f21e5e014fb6900743"
63
+ "gitHead": "d882694edb3866d1afc0719f75d16d3d2528a876"
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`s should contain `Droppable`s which contain `Draggable`s.
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
- ```js noLive
10
+ ```ts noLive
16
11
  import React from 'react';
17
12
  import { DragDrop, Draggable, Droppable } from '@patternfly/react-core';
18
13
 
19
- <DragDrop> {/* DragDrop houses the context for dragging and dropping */}
20
- <Droppable>
21
- <Draggable>
22
- You can put anything here! It will be wrapped in a styled div.
23
- </Draggable>
24
- <Draggable>
25
- You can have as many Draggables as you like.
26
- </Draggable>
27
- </Droppable>
28
- <Droppable> {/* You can also have many droppables! */}
29
- <Draggable />
30
- </Droppable>
31
- </DragDrop>
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
- return true;
68
- }
69
- return false;
70
- }
35
+ ### Basic
71
36
 
72
- return (
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
- ```js
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';