@patternfly/react-core 4.158.1 → 4.159.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 +35 -0
- package/dist/esm/components/DragDrop/Draggable.d.ts.map +1 -1
- package/dist/esm/components/DragDrop/Draggable.js +13 -7
- package/dist/esm/components/DragDrop/Draggable.js.map +1 -1
- package/dist/esm/components/DragDrop/Droppable.d.ts.map +1 -1
- package/dist/esm/components/DragDrop/Droppable.js +3 -1
- package/dist/esm/components/DragDrop/Droppable.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts +3 -0
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectMenu.d.ts +3 -0
- package/dist/esm/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectMenu.js +4 -3
- package/dist/esm/components/Select/SelectMenu.js.map +1 -1
- package/dist/esm/components/Select/selectConstants.d.ts +4 -0
- package/dist/esm/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/esm/components/Select/selectConstants.js +5 -0
- package/dist/esm/components/Select/selectConstants.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.d.ts +20 -0
- package/dist/esm/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +44 -14
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +1 -1
- package/dist/js/components/DragDrop/Draggable.d.ts.map +1 -1
- package/dist/js/components/DragDrop/Draggable.js +13 -7
- package/dist/js/components/DragDrop/Draggable.js.map +1 -1
- package/dist/js/components/DragDrop/Droppable.d.ts.map +1 -1
- package/dist/js/components/DragDrop/Droppable.js +3 -1
- package/dist/js/components/DragDrop/Droppable.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts +3 -0
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +1 -0
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectMenu.d.ts +3 -0
- package/dist/js/components/Select/SelectMenu.d.ts.map +1 -1
- package/dist/js/components/Select/SelectMenu.js +3 -2
- package/dist/js/components/Select/SelectMenu.js.map +1 -1
- package/dist/js/components/Select/selectConstants.d.ts +4 -0
- package/dist/js/components/Select/selectConstants.d.ts.map +1 -1
- package/dist/js/components/Select/selectConstants.js +6 -1
- package/dist/js/components/Select/selectConstants.js.map +1 -1
- package/dist/js/components/Tabs/Tabs.d.ts +20 -0
- package/dist/js/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/js/components/Tabs/Tabs.js +44 -14
- package/dist/js/components/Tabs/Tabs.js.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +1 -1
- package/dist/umd/react-core.css +13638 -13562
- package/dist/umd/react-core.js +104 -49
- package/dist/umd/react-core.min.css +10666 -10590
- package/dist/umd/react-core.min.js +2 -2
- package/package.json +6 -6
- package/src/components/DragDrop/Draggable.tsx +20 -11
- package/src/components/DragDrop/Droppable.tsx +3 -1
- package/src/components/Drawer/examples/Drawer.md +0 -78
- package/src/components/Page/examples/Page.md +289 -103
- package/src/components/Select/Select.tsx +4 -1
- package/src/components/Select/SelectMenu.tsx +10 -2
- package/src/components/Select/__tests__/Generated/__snapshots__/SelectMenu.test.tsx.snap +1 -0
- package/src/components/Select/__tests__/__snapshots__/Select.test.tsx.snap +57 -0
- package/src/components/Select/selectConstants.tsx +5 -0
- package/src/components/Sidebar/examples/Sidebar.md +6 -3
- package/src/components/Tabs/Tabs.tsx +97 -13
- package/src/components/Tabs/__tests__/Generated/__snapshots__/Tabs.test.tsx.snap +4 -4
- package/src/components/Tabs/__tests__/Tabs.test.tsx +50 -0
- package/src/components/Tabs/__tests__/__snapshots__/Tabs.test.tsx.snap +276 -30
- package/src/components/Tabs/examples/Tabs.md +96 -0
- package/src/components/Wizard/WizardNavItem.tsx +1 -1
- package/src/demos/CardDemos.md +443 -0
- package/src/demos/ComposableMenu.md +125 -17
- package/src/demos/Page/Page.md +322 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.159.0",
|
|
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,16 +34,16 @@
|
|
|
34
34
|
"generate": "node scripts/copyStyles.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patternfly/react-icons": "^4.12.
|
|
38
|
-
"@patternfly/react-styles": "^4.12.
|
|
39
|
-
"@patternfly/react-tokens": "^4.13.
|
|
37
|
+
"@patternfly/react-icons": "^4.12.1",
|
|
38
|
+
"@patternfly/react-styles": "^4.12.1",
|
|
39
|
+
"@patternfly/react-tokens": "^4.13.1",
|
|
40
40
|
"focus-trap": "6.2.2",
|
|
41
41
|
"react-dropzone": "9.0.0",
|
|
42
42
|
"tippy.js": "5.1.2",
|
|
43
43
|
"tslib": "^2.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@patternfly/patternfly": "4.
|
|
46
|
+
"@patternfly/patternfly": "4.139.2",
|
|
47
47
|
"@rollup/plugin-commonjs": "^11.0.2",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^7.1.1",
|
|
49
49
|
"@rollup/plugin-replace": "^2.3.1",
|
|
@@ -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": "86e7ecb47f3d2197cb664ce7237d3a25e18f8a48"
|
|
64
64
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { css } from '@patternfly/react-styles';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop';
|
|
2
4
|
import { DroppableContext } from './DroppableContext';
|
|
3
5
|
import { DragDropContext } from './DragDrop';
|
|
4
6
|
|
|
@@ -58,7 +60,8 @@ interface DroppableItem {
|
|
|
58
60
|
// Reset per-element state
|
|
59
61
|
function resetDroppableItem(droppableItem: DroppableItem) {
|
|
60
62
|
removeBlankDiv(droppableItem.node);
|
|
61
|
-
droppableItem.node.
|
|
63
|
+
droppableItem.node.classList.remove(styles.modifiers.dragging);
|
|
64
|
+
droppableItem.node.classList.remove(styles.modifiers.dragOutside);
|
|
62
65
|
droppableItem.draggableNodes.forEach((n, i) => {
|
|
63
66
|
n.style.transform = '';
|
|
64
67
|
n.style.transition = '';
|
|
@@ -83,6 +86,7 @@ export const Draggable: React.FunctionComponent<DraggableProps> = ({
|
|
|
83
86
|
let [style, setStyle] = React.useState(styleProp);
|
|
84
87
|
/* eslint-enable prefer-const */
|
|
85
88
|
const [isDragging, setIsDragging] = React.useState(false);
|
|
89
|
+
const [isValidDrag, setIsValidDrag] = React.useState(true);
|
|
86
90
|
const { zone, droppableId } = React.useContext(DroppableContext);
|
|
87
91
|
const { onDrag, onDragMove, onDrop } = React.useContext(DragDropContext);
|
|
88
92
|
// Some state is better just to leave as vars passed around between various callbacks
|
|
@@ -151,7 +155,7 @@ export const Draggable: React.FunctionComponent<DraggableProps> = ({
|
|
|
151
155
|
const { node, rect, isDraggingHost, draggableNodes, draggableNodesRects } = droppableItem;
|
|
152
156
|
if (overlaps(ev, rect)) {
|
|
153
157
|
// Add valid dropzone style
|
|
154
|
-
node.
|
|
158
|
+
node.classList.remove(styles.modifiers.dragOutside);
|
|
155
159
|
hoveringDroppable = node;
|
|
156
160
|
// Check if we need to add a blank div row
|
|
157
161
|
if (node.getAttribute('blankDiv') !== 'true' && !isDraggingHost) {
|
|
@@ -185,17 +189,17 @@ export const Draggable: React.FunctionComponent<DraggableProps> = ({
|
|
|
185
189
|
}
|
|
186
190
|
} else {
|
|
187
191
|
resetDroppableItem(droppableItem);
|
|
188
|
-
node.
|
|
192
|
+
node.classList.add(styles.modifiers.dragging);
|
|
193
|
+
node.classList.add(styles.modifiers.dragOutside);
|
|
189
194
|
}
|
|
190
195
|
});
|
|
191
196
|
|
|
192
197
|
// Move hovering draggable and style it based on cursor position
|
|
193
198
|
setStyle({
|
|
194
199
|
...style,
|
|
195
|
-
|
|
196
|
-
transform: `translate(${ev.pageX - startX}px, ${ev.pageY - startY}px)`,
|
|
197
|
-
cursor: !hoveringDroppable && 'not-allowed'
|
|
200
|
+
transform: `translate(${ev.pageX - startX}px, ${ev.pageY - startY}px)`
|
|
198
201
|
});
|
|
202
|
+
setIsValidDrag(Boolean(hoveringDroppable));
|
|
199
203
|
|
|
200
204
|
// Iterate through sibling draggable nodes to reposition them and store correct hoveringIndex for onDrop
|
|
201
205
|
hoveringIndex = null;
|
|
@@ -241,6 +245,7 @@ export const Draggable: React.FunctionComponent<DraggableProps> = ({
|
|
|
241
245
|
const rect = dragging.getBoundingClientRect();
|
|
242
246
|
const droppableNodes = Array.from(document.querySelectorAll(`[data-pf-droppable="${zone}"]`)) as HTMLElement[];
|
|
243
247
|
const droppableItems = droppableNodes.reduce((acc, cur) => {
|
|
248
|
+
cur.classList.add(styles.modifiers.dragging);
|
|
244
249
|
const draggableNodes = Array.from(cur.querySelectorAll(`[data-pf-draggable-zone="${zone}"]`)) as HTMLElement[];
|
|
245
250
|
const isDraggingHost = cur.contains(dragging);
|
|
246
251
|
if (isDraggingHost) {
|
|
@@ -266,15 +271,14 @@ export const Draggable: React.FunctionComponent<DraggableProps> = ({
|
|
|
266
271
|
// Set initial style so future style mods take effect
|
|
267
272
|
style = {
|
|
268
273
|
...style,
|
|
269
|
-
position: 'fixed',
|
|
270
274
|
top: rect.y,
|
|
271
275
|
left: rect.x,
|
|
272
276
|
width: rect.width,
|
|
273
277
|
height: rect.height,
|
|
274
|
-
|
|
275
|
-
|
|
278
|
+
'--pf-c-draggable--m-dragging--BackgroundColor': getInheritedBackgroundColor(dragging),
|
|
279
|
+
position: 'fixed',
|
|
276
280
|
zIndex: 5000
|
|
277
|
-
};
|
|
281
|
+
} as any;
|
|
278
282
|
setStyle(style);
|
|
279
283
|
// Store event details
|
|
280
284
|
startX = ev.pageX;
|
|
@@ -292,7 +296,12 @@ export const Draggable: React.FunctionComponent<DraggableProps> = ({
|
|
|
292
296
|
const childProps = {
|
|
293
297
|
'data-pf-draggable-zone': isDragging ? null : zone,
|
|
294
298
|
draggable: true,
|
|
295
|
-
className
|
|
299
|
+
className: css(
|
|
300
|
+
styles.draggable,
|
|
301
|
+
isDragging && styles.modifiers.dragging,
|
|
302
|
+
!isValidDrag && styles.modifiers.dragOutside,
|
|
303
|
+
className
|
|
304
|
+
),
|
|
296
305
|
onDragStart,
|
|
297
306
|
onTransitionEnd,
|
|
298
307
|
style,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { css } from '@patternfly/react-styles';
|
|
3
|
+
import styles from '@patternfly/react-styles/css/components/DragDrop/drag-drop';
|
|
2
4
|
import { DroppableContext } from './DroppableContext';
|
|
3
5
|
|
|
4
6
|
interface DroppableProps extends React.HTMLProps<HTMLDivElement> {
|
|
@@ -25,7 +27,7 @@ export const Droppable: React.FunctionComponent<DroppableProps> = ({
|
|
|
25
27
|
const childProps = {
|
|
26
28
|
'data-pf-droppable': zone,
|
|
27
29
|
'data-pf-droppableid': droppableId,
|
|
28
|
-
className,
|
|
30
|
+
className: css(styles.droppable, className),
|
|
29
31
|
...props
|
|
30
32
|
};
|
|
31
33
|
|
|
@@ -624,84 +624,6 @@ class DrawerStackedContentBodyElements extends React.Component {
|
|
|
624
624
|
}
|
|
625
625
|
```
|
|
626
626
|
|
|
627
|
-
### Stacked content body elements
|
|
628
|
-
|
|
629
|
-
```js
|
|
630
|
-
import React from 'react';
|
|
631
|
-
import {
|
|
632
|
-
Drawer,
|
|
633
|
-
DrawerPanelContent,
|
|
634
|
-
DrawerContent,
|
|
635
|
-
DrawerContentBody,
|
|
636
|
-
DrawerPanelBody,
|
|
637
|
-
DrawerHead,
|
|
638
|
-
DrawerActions,
|
|
639
|
-
DrawerCloseButton,
|
|
640
|
-
Button
|
|
641
|
-
} from '@patternfly/react-core';
|
|
642
|
-
|
|
643
|
-
class DrawerStackedContentBodyElements extends React.Component {
|
|
644
|
-
constructor(props) {
|
|
645
|
-
super(props);
|
|
646
|
-
this.state = {
|
|
647
|
-
isExpanded: false
|
|
648
|
-
};
|
|
649
|
-
this.drawerRef = React.createRef();
|
|
650
|
-
|
|
651
|
-
this.onExpand = () => {
|
|
652
|
-
this.drawerRef.current && this.drawerRef.current.focus();
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
this.onClick = () => {
|
|
656
|
-
const isExpanded = !this.state.isExpanded;
|
|
657
|
-
this.setState({
|
|
658
|
-
isExpanded
|
|
659
|
-
});
|
|
660
|
-
};
|
|
661
|
-
|
|
662
|
-
this.onCloseClick = () => {
|
|
663
|
-
this.setState({
|
|
664
|
-
isExpanded: false
|
|
665
|
-
});
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
render() {
|
|
670
|
-
const { isExpanded } = this.state;
|
|
671
|
-
const panelContent = (
|
|
672
|
-
<DrawerPanelContent>
|
|
673
|
-
<DrawerHead>
|
|
674
|
-
<h3 className="pf-c-title pf-m-2xl" tabIndex={isExpanded ? 0 : -1} ref={this.drawerRef}>
|
|
675
|
-
drawer title{' '}
|
|
676
|
-
</h3>
|
|
677
|
-
<DrawerActions>
|
|
678
|
-
<DrawerCloseButton onClick={this.onCloseClick} />
|
|
679
|
-
</DrawerActions>
|
|
680
|
-
drawer-panel
|
|
681
|
-
</DrawerHead>
|
|
682
|
-
<DrawerPanelBody hasNoPadding>drawer-panel with no padding</DrawerPanelBody>
|
|
683
|
-
<DrawerPanelBody>drawer-panel</DrawerPanelBody>
|
|
684
|
-
</DrawerPanelContent>
|
|
685
|
-
);
|
|
686
|
-
|
|
687
|
-
return (
|
|
688
|
-
<React.Fragment>
|
|
689
|
-
<Button aria-expanded={isExpanded} onClick={this.onClick}>
|
|
690
|
-
Toggle drawer
|
|
691
|
-
</Button>
|
|
692
|
-
<Drawer isExpanded={isExpanded} onExpand={this.onExpand}>
|
|
693
|
-
<DrawerContent panelContent={panelContent}>
|
|
694
|
-
<DrawerContentBody>content-body</DrawerContentBody>
|
|
695
|
-
<DrawerContentBody hasPadding>content-body with padding</DrawerContentBody>
|
|
696
|
-
<DrawerContentBody>content-body</DrawerContentBody>
|
|
697
|
-
</DrawerContent>
|
|
698
|
-
</Drawer>
|
|
699
|
-
</React.Fragment>
|
|
700
|
-
);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
```
|
|
704
|
-
|
|
705
627
|
### Modified content padding
|
|
706
628
|
|
|
707
629
|
```js
|