@patternfly/react-core 5.0.0-alpha.55 → 5.0.0-alpha.57
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 +11 -0
- package/dist/esm/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js +1 -1
- package/dist/esm/components/Dropdown/Dropdown.js.map +1 -1
- 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 +7 -6
- package/dist/esm/components/Menu/MenuItem.js.map +1 -1
- package/dist/esm/components/Nav/NavExpandable.d.ts +2 -2
- package/dist/esm/components/Nav/NavExpandable.d.ts.map +1 -1
- package/dist/esm/components/Nav/NavExpandable.js +4 -4
- package/dist/esm/components/Nav/NavExpandable.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.d.ts +2 -2
- package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/esm/components/Wizard/WizardNavItem.js +2 -1
- package/dist/esm/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/components/Dropdown/Dropdown.js +1 -1
- package/dist/js/components/Dropdown/Dropdown.js.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 +7 -6
- package/dist/js/components/Menu/MenuItem.js.map +1 -1
- package/dist/js/components/Nav/NavExpandable.d.ts +2 -2
- package/dist/js/components/Nav/NavExpandable.d.ts.map +1 -1
- package/dist/js/components/Nav/NavExpandable.js +4 -4
- package/dist/js/components/Nav/NavExpandable.js.map +1 -1
- package/dist/js/components/Pagination/Pagination.d.ts +2 -2
- package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.d.ts.map +1 -1
- package/dist/js/components/Wizard/WizardNavItem.js +2 -1
- package/dist/js/components/Wizard/WizardNavItem.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Dropdown/Dropdown.tsx +3 -1
- package/src/components/Menu/MenuItem.tsx +10 -7
- package/src/components/Menu/examples/Menu.md +1 -1
- package/src/components/Nav/NavExpandable.tsx +5 -5
- package/src/components/Pagination/Pagination.tsx +2 -2
- package/src/components/Wizard/WizardNavItem.tsx +2 -1
- package/src/components/Wizard/__tests__/Generated/__snapshots__/WizardNavItem.test.tsx.snap +1 -0
- package/src/components/Wizard/__tests__/__snapshots__/Wizard.test.tsx.snap +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "5.0.0-alpha.
|
|
3
|
+
"version": "5.0.0-alpha.57",
|
|
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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^17 || ^18",
|
|
71
71
|
"react-dom": "^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "7b453eda66dcf5a7ce9e9a32cc7611e153d7a726"
|
|
74
74
|
}
|
|
@@ -74,7 +74,9 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
|
74
74
|
// toggle was clicked open via keyboard, focus on first menu item
|
|
75
75
|
if (isOpen && toggleRef.current?.contains(event.target as Node) && event.detail === 0) {
|
|
76
76
|
setTimeout(() => {
|
|
77
|
-
const firstElement = menuRef?.current?.querySelector(
|
|
77
|
+
const firstElement = menuRef?.current?.querySelector(
|
|
78
|
+
'li button:not(:disabled),li input:not(:disabled),li a:not([aria-disabled="true"])'
|
|
79
|
+
);
|
|
78
80
|
firstElement && (firstElement as HTMLElement).focus();
|
|
79
81
|
}, 0);
|
|
80
82
|
}
|
|
@@ -46,7 +46,9 @@ export interface MenuItemProps extends Omit<React.HTMLProps<HTMLLIElement>, 'onC
|
|
|
46
46
|
actions?: React.ReactNode;
|
|
47
47
|
/** Description of the menu item */
|
|
48
48
|
description?: React.ReactNode;
|
|
49
|
-
/** Render external link icon
|
|
49
|
+
/** Render an external link icon on focus or hover, and set the link's
|
|
50
|
+
* "target" attribute to a value of "_blank".
|
|
51
|
+
*/
|
|
50
52
|
isExternalLink?: boolean;
|
|
51
53
|
/** Flag indicating if the option is selected */
|
|
52
54
|
isSelected?: boolean;
|
|
@@ -191,7 +193,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
191
193
|
if (flyoutVisible) {
|
|
192
194
|
const flyoutMenu = (flyoutTarget as HTMLElement).nextElementSibling;
|
|
193
195
|
const flyoutItems = Array.from(flyoutMenu.getElementsByTagName('UL')[0].children).filter(
|
|
194
|
-
el => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider'))
|
|
196
|
+
(el) => !(el.classList.contains('pf-m-disabled') || el.classList.contains('pf-c-divider'))
|
|
195
197
|
);
|
|
196
198
|
(flyoutItems[0].firstChild as HTMLElement).focus();
|
|
197
199
|
} else {
|
|
@@ -232,7 +234,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
232
234
|
let drill: (event: React.KeyboardEvent | React.MouseEvent) => void;
|
|
233
235
|
if (direction) {
|
|
234
236
|
if (direction === 'down') {
|
|
235
|
-
drill = event =>
|
|
237
|
+
drill = (event) =>
|
|
236
238
|
onDrillIn &&
|
|
237
239
|
onDrillIn(
|
|
238
240
|
event,
|
|
@@ -243,7 +245,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
243
245
|
itemId
|
|
244
246
|
);
|
|
245
247
|
} else {
|
|
246
|
-
drill = event => onDrillOut && onDrillOut(event, parentMenu, itemId);
|
|
248
|
+
drill = (event) => onDrillOut && onDrillOut(event, parentMenu, itemId);
|
|
247
249
|
}
|
|
248
250
|
}
|
|
249
251
|
let additionalProps = {} as any;
|
|
@@ -252,7 +254,8 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
252
254
|
href: to,
|
|
253
255
|
'aria-disabled': isDisabled ? true : null,
|
|
254
256
|
// prevent invalid 'disabled' attribute on <a> tags
|
|
255
|
-
disabled: null
|
|
257
|
+
disabled: null,
|
|
258
|
+
target: isExternalLink ? '_blank' : null
|
|
256
259
|
};
|
|
257
260
|
} else if (Component === 'button') {
|
|
258
261
|
additionalProps = {
|
|
@@ -317,7 +320,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
317
320
|
{...props}
|
|
318
321
|
>
|
|
319
322
|
<GenerateId>
|
|
320
|
-
{randomId => (
|
|
323
|
+
{(randomId) => (
|
|
321
324
|
<Component
|
|
322
325
|
id={id}
|
|
323
326
|
tabIndex={-1}
|
|
@@ -393,7 +396,7 @@ const MenuItemBase: React.FunctionComponent<MenuItemProps> = ({
|
|
|
393
396
|
icon="favorites"
|
|
394
397
|
isFavorited={isFavorited}
|
|
395
398
|
aria-label={isFavorited ? 'starred' : 'not starred'}
|
|
396
|
-
onClick={event => onActionClick(event, itemId)}
|
|
399
|
+
onClick={(event) => onActionClick(event, itemId)}
|
|
397
400
|
tabIndex={-1}
|
|
398
401
|
actionId="fav"
|
|
399
402
|
/>
|
|
@@ -67,7 +67,7 @@ To trigger an action when a specific item's action icon is selected, pass in the
|
|
|
67
67
|
|
|
68
68
|
### With links
|
|
69
69
|
|
|
70
|
-
Use the `to` property to add a link to a `<MenuItem>` that directs users to a new page when the item is selected. Use the `isExternalLink` property when linking to external resources. This will annotate a menu item link with an external link icon when they navigate to the link or hover over it.
|
|
70
|
+
Use the `to` property to add a link to a `<MenuItem>` that directs users to a new page when the item is selected. Use the `isExternalLink` property when linking to external resources. This will annotate a menu item link with an external link icon when they navigate to the link or hover over it, as well as add `target="_blank"` so that the link opens in a new tab or window.
|
|
71
71
|
|
|
72
72
|
```ts file="MenuWithLinks.tsx"
|
|
73
73
|
|
|
@@ -29,7 +29,7 @@ export interface NavExpandableProps
|
|
|
29
29
|
/** Identifier to use for the section aria label */
|
|
30
30
|
id?: string;
|
|
31
31
|
/** allow consumer to optionally override this callback and manage expand state externally. if passed will not call Nav's onToggle. */
|
|
32
|
-
onExpand?: (
|
|
32
|
+
onExpand?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>, val: boolean) => void;
|
|
33
33
|
/** Additional props added to the NavExpandable <button> */
|
|
34
34
|
buttonProps?: any;
|
|
35
35
|
/** Value to overwrite the randomly generated data-ouia-component-id.*/
|
|
@@ -71,7 +71,7 @@ export class NavExpandable extends React.Component<NavExpandableProps, NavExpand
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
onExpand = (
|
|
74
|
-
|
|
74
|
+
event: React.MouseEvent<HTMLButtonElement, MouseEvent>,
|
|
75
75
|
onToggle: (
|
|
76
76
|
event: React.MouseEvent<HTMLButtonElement, MouseEvent>,
|
|
77
77
|
groupId: string | number,
|
|
@@ -80,11 +80,11 @@ export class NavExpandable extends React.Component<NavExpandableProps, NavExpand
|
|
|
80
80
|
) => {
|
|
81
81
|
const { expandedState } = this.state;
|
|
82
82
|
if (this.props.onExpand) {
|
|
83
|
-
this.props.onExpand(
|
|
83
|
+
this.props.onExpand(event, !expandedState);
|
|
84
84
|
} else {
|
|
85
85
|
this.setState((prevState) => ({ expandedState: !prevState.expandedState }));
|
|
86
86
|
const { groupId } = this.props;
|
|
87
|
-
onToggle(
|
|
87
|
+
onToggle(event, groupId, !expandedState);
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
90
|
|
|
@@ -129,7 +129,7 @@ export class NavExpandable extends React.Component<NavExpandableProps, NavExpand
|
|
|
129
129
|
<button
|
|
130
130
|
className={styles.navLink}
|
|
131
131
|
id={srText ? null : this.id}
|
|
132
|
-
onClick={(
|
|
132
|
+
onClick={(event) => this.onExpand(event, context.onToggle)}
|
|
133
133
|
aria-expanded={expandedState}
|
|
134
134
|
tabIndex={isNavOpen ? null : -1}
|
|
135
135
|
{...buttonProps}
|
|
@@ -78,7 +78,7 @@ export interface PaginationTitles {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
export type OnSetPage = (
|
|
81
|
-
|
|
81
|
+
event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
82
82
|
newPage: number,
|
|
83
83
|
perPage?: number,
|
|
84
84
|
startIdx?: number,
|
|
@@ -86,7 +86,7 @@ export type OnSetPage = (
|
|
|
86
86
|
) => void;
|
|
87
87
|
|
|
88
88
|
export type OnPerPageSelect = (
|
|
89
|
-
|
|
89
|
+
event: React.MouseEvent | React.KeyboardEvent | MouseEvent,
|
|
90
90
|
newPerPage: number,
|
|
91
91
|
newPage: number,
|
|
92
92
|
startIdx?: number,
|
|
@@ -111,6 +111,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
111
111
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-7"
|
|
112
112
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
113
113
|
data-ouia-safe="true"
|
|
114
|
+
type="button"
|
|
114
115
|
>
|
|
115
116
|
A
|
|
116
117
|
</button>
|
|
@@ -125,6 +126,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
125
126
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-8"
|
|
126
127
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
127
128
|
data-ouia-safe="true"
|
|
129
|
+
type="button"
|
|
128
130
|
>
|
|
129
131
|
<span
|
|
130
132
|
class="pf-c-wizard__nav-link-text"
|
|
@@ -166,6 +168,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
166
168
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-9"
|
|
167
169
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
168
170
|
data-ouia-safe="true"
|
|
171
|
+
type="button"
|
|
169
172
|
>
|
|
170
173
|
B-1
|
|
171
174
|
</button>
|
|
@@ -179,6 +182,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
179
182
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-10"
|
|
180
183
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
181
184
|
data-ouia-safe="true"
|
|
185
|
+
type="button"
|
|
182
186
|
>
|
|
183
187
|
B-2
|
|
184
188
|
</button>
|
|
@@ -194,6 +198,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
194
198
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-11"
|
|
195
199
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
196
200
|
data-ouia-safe="true"
|
|
201
|
+
type="button"
|
|
197
202
|
>
|
|
198
203
|
C
|
|
199
204
|
</button>
|
|
@@ -207,6 +212,7 @@ exports[`Wizard Expandable Nav Wizard should match snapshot 1`] = `
|
|
|
207
212
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-12"
|
|
208
213
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
209
214
|
data-ouia-safe="true"
|
|
215
|
+
type="button"
|
|
210
216
|
>
|
|
211
217
|
D
|
|
212
218
|
</button>
|
|
@@ -381,6 +387,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
381
387
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
382
388
|
data-ouia-safe="true"
|
|
383
389
|
id="step-A"
|
|
390
|
+
type="button"
|
|
384
391
|
>
|
|
385
392
|
A
|
|
386
393
|
</button>
|
|
@@ -395,6 +402,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
395
402
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
396
403
|
data-ouia-safe="true"
|
|
397
404
|
id="step-B"
|
|
405
|
+
type="button"
|
|
398
406
|
>
|
|
399
407
|
B
|
|
400
408
|
</button>
|
|
@@ -412,6 +420,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
412
420
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
413
421
|
data-ouia-safe="true"
|
|
414
422
|
id="step-B-1"
|
|
423
|
+
type="button"
|
|
415
424
|
>
|
|
416
425
|
B-1
|
|
417
426
|
</button>
|
|
@@ -426,6 +435,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
426
435
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
427
436
|
data-ouia-safe="true"
|
|
428
437
|
id="step-B-2"
|
|
438
|
+
type="button"
|
|
429
439
|
>
|
|
430
440
|
B-2
|
|
431
441
|
</button>
|
|
@@ -442,6 +452,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
442
452
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
443
453
|
data-ouia-safe="true"
|
|
444
454
|
id="step-C"
|
|
455
|
+
type="button"
|
|
445
456
|
>
|
|
446
457
|
C
|
|
447
458
|
</button>
|
|
@@ -456,6 +467,7 @@ exports[`Wizard Wizard should match snapshot 1`] = `
|
|
|
456
467
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
457
468
|
data-ouia-safe="true"
|
|
458
469
|
id="step-D"
|
|
470
|
+
type="button"
|
|
459
471
|
>
|
|
460
472
|
D
|
|
461
473
|
</button>
|
|
@@ -586,6 +598,7 @@ exports[`Wizard bare wiz 1`] = `
|
|
|
586
598
|
data-ouia-component-id="OUIA-Generated-WizardNavItem-13"
|
|
587
599
|
data-ouia-component-type="PF4/WizardNavItem"
|
|
588
600
|
data-ouia-safe="true"
|
|
601
|
+
type="button"
|
|
589
602
|
>
|
|
590
603
|
A
|
|
591
604
|
</button>
|