@patternfly/react-core 4.227.6 → 4.227.9
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/esm/components/Menu/MenuItem.d.ts +3 -1
- package/dist/esm/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/esm/components/Menu/MenuItem.js +2 -2
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts +6 -12
- package/dist/esm/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/esm/components/MenuToggle/MenuToggle.js +12 -8
- package/dist/esm/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/esm/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroup.js +2 -2
- package/dist/esm/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts +1 -1
- package/dist/esm/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.d.ts +3 -1
- package/dist/js/components/Menu/MenuItem.d.ts.map +1 -1
- package/dist/js/components/Menu/MenuItem.js +2 -2
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.d.ts +6 -12
- package/dist/js/components/MenuToggle/MenuToggle.d.ts.map +1 -1
- package/dist/js/components/MenuToggle/MenuToggle.js +12 -8
- package/dist/js/components/MenuToggle/MenuToggle.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts +2 -0
- package/dist/js/components/TextInputGroup/TextInputGroup.d.ts.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroup.js +2 -2
- package/dist/js/components/TextInputGroup/TextInputGroup.js.map +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts +1 -1
- package/dist/js/components/TextInputGroup/TextInputGroupMain.d.ts.map +1 -1
- package/dist/umd/react-core.css +46 -49
- package/dist/umd/react-core.js +17 -12
- package/dist/umd/react-core.min.css +84 -87
- package/dist/umd/react-core.min.js +5 -5
- package/package.json +6 -6
- package/src/components/Menu/MenuItem.tsx +4 -0
- package/src/components/MenuToggle/MenuToggle.tsx +63 -25
- package/src/components/Page/examples/Page.md +10 -615
- package/src/components/Page/examples/PageCenteredSection.tsx +76 -0
- package/src/components/Page/examples/PageGroupSection.tsx +106 -0
- package/src/components/Page/examples/PageHorizontalNav.tsx +43 -0
- package/src/components/Page/examples/PageMainSectionPadding.tsx +72 -0
- package/src/components/Page/examples/PageTertiaryNav.tsx +42 -0
- package/src/components/Page/examples/PageUncontrolledNav.tsx +53 -0
- package/src/components/Page/examples/PageVerticalNav.tsx +65 -0
- package/src/components/Page/examples/PageVerticalNavUsingPageHeaderComponent.tsx +44 -0
- package/src/components/Page/examples/PageWithOrWithoutFill.tsx +67 -0
- package/src/components/Pagination/examples/Pagination.md +8 -355
- package/src/components/Pagination/examples/PaginationBottom.tsx +33 -0
- package/src/components/Pagination/examples/PaginationCompact.tsx +33 -0
- package/src/components/Pagination/examples/PaginationDisabled.tsx +33 -0
- package/src/components/Pagination/examples/PaginationIndeterminate.tsx +40 -0
- package/src/components/Pagination/examples/PaginationNoItems.tsx +32 -0
- package/src/components/Pagination/examples/PaginationOnePage.tsx +32 -0
- package/src/components/Pagination/examples/PaginationSticky.tsx +81 -0
- package/src/components/Pagination/examples/PaginationTop.tsx +32 -0
- package/src/components/Switch/examples/Switch.md +6 -153
- package/src/components/Switch/examples/SwitchBasic.tsx +20 -0
- package/src/components/Switch/examples/SwitchCheckedWithLabel.tsx +22 -0
- package/src/components/Switch/examples/SwitchDisabled.tsx +28 -0
- package/src/components/Switch/examples/SwitchReversed.tsx +21 -0
- package/src/components/Switch/examples/SwitchUncontrolled.tsx +14 -0
- package/src/components/Switch/examples/SwitchWithoutLabel.tsx +12 -0
- package/src/components/TextInputGroup/TextInputGroup.tsx +9 -1
- package/src/components/TextInputGroup/TextInputGroupMain.tsx +1 -1
- package/src/demos/ComposableMenu/ComposableMenu.md +8 -0
- package/src/demos/ComposableMenu/examples/ComposableTypeaheadSelect.tsx +196 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.227.
|
|
3
|
+
"version": "4.227.9",
|
|
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.78.
|
|
38
|
-
"@patternfly/react-styles": "^4.77.
|
|
39
|
-
"@patternfly/react-tokens": "^4.79.
|
|
37
|
+
"@patternfly/react-icons": "^4.78.9",
|
|
38
|
+
"@patternfly/react-styles": "^4.77.9",
|
|
39
|
+
"@patternfly/react-tokens": "^4.79.9",
|
|
40
40
|
"focus-trap": "6.9.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.205.1",
|
|
47
47
|
"@rollup/plugin-commonjs": "^21.0.0",
|
|
48
48
|
"@rollup/plugin-node-resolve": "^13.0.0",
|
|
49
49
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -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": "997f82511b3461fe6b960fc9412b17ee94864352"
|
|
64
64
|
}
|
|
@@ -50,6 +50,8 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onC
|
|
|
50
50
|
isExternalLink?: boolean;
|
|
51
51
|
/** Flag indicating if the option is selected */
|
|
52
52
|
isSelected?: boolean;
|
|
53
|
+
/** Flag indicating the item is focused */
|
|
54
|
+
isFocused?: boolean;
|
|
53
55
|
/** @beta Flyout menu */
|
|
54
56
|
flyoutMenu?: React.ReactElement;
|
|
55
57
|
/** @beta Callback function when mouse leaves trigger */
|
|
@@ -88,6 +90,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
88
90
|
isDisabled = false,
|
|
89
91
|
isExternalLink = false,
|
|
90
92
|
isSelected = null,
|
|
93
|
+
isFocused,
|
|
91
94
|
icon,
|
|
92
95
|
actions,
|
|
93
96
|
onShowFlyout,
|
|
@@ -290,6 +293,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
290
293
|
_isOnPath && styles.modifiers.currentPath,
|
|
291
294
|
isLoadButton && styles.modifiers.load,
|
|
292
295
|
isLoading && styles.modifiers.loading,
|
|
296
|
+
isFocused && styles.modifiers.focus,
|
|
293
297
|
className
|
|
294
298
|
)}
|
|
295
299
|
onMouseOver={onMouseOver}
|
|
@@ -4,8 +4,10 @@ import { css } from '@patternfly/react-styles';
|
|
|
4
4
|
import CaretDownIcon from '@patternfly/react-icons/dist/esm/icons/caret-down-icon';
|
|
5
5
|
import { BadgeProps } from '../Badge';
|
|
6
6
|
|
|
7
|
+
export type MenuToggleElement = HTMLDivElement | HTMLButtonElement;
|
|
8
|
+
|
|
7
9
|
export interface MenuToggleProps
|
|
8
|
-
extends Omit<React.DetailedHTMLProps<React.
|
|
10
|
+
extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<MenuToggleElement>, MenuToggleElement>, 'ref'> {
|
|
9
11
|
/** Content rendered inside the toggle */
|
|
10
12
|
children?: React.ReactNode;
|
|
11
13
|
/** Additional classes added to the toggle */
|
|
@@ -19,18 +21,18 @@ export interface MenuToggleProps
|
|
|
19
21
|
/** Flag indicating the toggle takes up the full width of its parent */
|
|
20
22
|
isFullWidth?: boolean;
|
|
21
23
|
/** Variant styles of the menu toggle */
|
|
22
|
-
variant?: 'default' | 'plain' | 'primary' | 'plainText' | 'secondary';
|
|
24
|
+
variant?: 'default' | 'plain' | 'primary' | 'plainText' | 'secondary' | 'typeahead';
|
|
23
25
|
/** Optional icon rendered inside the toggle, before the children content */
|
|
24
26
|
icon?: React.ReactNode;
|
|
25
27
|
/** Optional badge rendered inside the toggle, after the children content */
|
|
26
28
|
badge?: BadgeProps | React.ReactNode;
|
|
27
29
|
/** Forwarded ref */
|
|
28
|
-
innerRef?: React.Ref<
|
|
30
|
+
innerRef?: React.Ref<MenuToggleElement>;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
export class MenuToggleBase extends React.Component<MenuToggleProps> {
|
|
32
34
|
displayName = 'MenuToggleBase';
|
|
33
|
-
static defaultProps = {
|
|
35
|
+
static defaultProps: MenuToggleProps = {
|
|
34
36
|
className: '',
|
|
35
37
|
isExpanded: false,
|
|
36
38
|
isDisabled: false,
|
|
@@ -51,24 +53,63 @@ export class MenuToggleBase extends React.Component<MenuToggleProps> {
|
|
|
51
53
|
isFullWidth,
|
|
52
54
|
variant,
|
|
53
55
|
innerRef,
|
|
54
|
-
|
|
56
|
+
onClick,
|
|
57
|
+
'aria-label': ariaLabel,
|
|
58
|
+
...otherProps
|
|
55
59
|
} = this.props;
|
|
56
|
-
|
|
57
60
|
const isPlain = variant === 'plain';
|
|
58
61
|
const isPlainText = variant === 'plainText';
|
|
62
|
+
const isTypeahead = variant === 'typeahead';
|
|
63
|
+
const toggleControls = (
|
|
64
|
+
<span className={css(styles.menuToggleControls)}>
|
|
65
|
+
<span className={css(styles.menuToggleToggleIcon)}>
|
|
66
|
+
<CaretDownIcon aria-hidden />
|
|
67
|
+
</span>
|
|
68
|
+
</span>
|
|
69
|
+
);
|
|
59
70
|
|
|
60
71
|
const content = (
|
|
61
|
-
|
|
72
|
+
<>
|
|
62
73
|
{icon && <span className={css(styles.menuToggleIcon)}>{icon}</span>}
|
|
63
|
-
<span className="pf-c-menu-toggle__text">{children}</span>
|
|
64
|
-
{badge && <span className={css(styles.menuToggleCount)}>{badge
|
|
65
|
-
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
{isTypeahead ? children : <span className="pf-c-menu-toggle__text">{children}</span>}
|
|
75
|
+
{badge && <span className={css(styles.menuToggleCount)}>{badge}</span>}
|
|
76
|
+
{isTypeahead ? (
|
|
77
|
+
<button
|
|
78
|
+
type="button"
|
|
79
|
+
className={css(styles.menuToggleButton)}
|
|
80
|
+
aria-expanded={isExpanded}
|
|
81
|
+
onClick={onClick}
|
|
82
|
+
aria-label="Menu toggle"
|
|
83
|
+
>
|
|
84
|
+
{toggleControls}
|
|
85
|
+
</button>
|
|
86
|
+
) : (
|
|
87
|
+
toggleControls
|
|
88
|
+
)}
|
|
89
|
+
</>
|
|
71
90
|
);
|
|
91
|
+
|
|
92
|
+
const componentProps = {
|
|
93
|
+
className: css(
|
|
94
|
+
styles.menuToggle,
|
|
95
|
+
isExpanded && styles.modifiers.expanded,
|
|
96
|
+
variant === 'primary' && styles.modifiers.primary,
|
|
97
|
+
(isPlain || isPlainText) && styles.modifiers.plain,
|
|
98
|
+
isPlainText && styles.modifiers.text,
|
|
99
|
+
isFullHeight && styles.modifiers.fullHeight,
|
|
100
|
+
isTypeahead && styles.modifiers.typeahead,
|
|
101
|
+
isFullWidth && styles.modifiers.fullWidth,
|
|
102
|
+
className
|
|
103
|
+
),
|
|
104
|
+
children: isPlain ? children : content,
|
|
105
|
+
...(isDisabled && { disabled: true }),
|
|
106
|
+
...otherProps
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
if (isTypeahead) {
|
|
110
|
+
return <div ref={innerRef as React.Ref<HTMLDivElement>} {...componentProps} />;
|
|
111
|
+
}
|
|
112
|
+
|
|
72
113
|
return (
|
|
73
114
|
<button
|
|
74
115
|
className={css(
|
|
@@ -82,21 +123,18 @@ export class MenuToggleBase extends React.Component<MenuToggleProps> {
|
|
|
82
123
|
isFullWidth && styles.modifiers.fullWidth,
|
|
83
124
|
className
|
|
84
125
|
)}
|
|
126
|
+
ref={innerRef as React.Ref<HTMLButtonElement>}
|
|
85
127
|
type="button"
|
|
86
|
-
aria-
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
{...
|
|
90
|
-
|
|
91
|
-
>
|
|
92
|
-
{isPlain && children}
|
|
93
|
-
{!isPlain && content}
|
|
94
|
-
</button>
|
|
128
|
+
aria-label={ariaLabel}
|
|
129
|
+
aria-expanded={isExpanded}
|
|
130
|
+
onClick={onClick}
|
|
131
|
+
{...componentProps}
|
|
132
|
+
/>
|
|
95
133
|
);
|
|
96
134
|
}
|
|
97
135
|
}
|
|
98
136
|
|
|
99
|
-
export const MenuToggle = React.forwardRef((props: MenuToggleProps, ref: React.Ref<
|
|
137
|
+
export const MenuToggle = React.forwardRef((props: MenuToggleProps, ref: React.Ref<MenuToggleElement>) => (
|
|
100
138
|
<MenuToggleBase innerRef={ref} {...props} />
|
|
101
139
|
));
|
|
102
140
|
|