@patternfly/react-core 4.254.1 → 4.255.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 +11 -0
- package/dist/esm/next/components/Dropdown/Dropdown.d.ts +6 -1
- package/dist/esm/next/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/esm/next/components/Dropdown/Dropdown.js +4 -2
- package/dist/esm/next/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/esm/next/components/Dropdown/DropdownItem.d.ts +6 -1
- package/dist/esm/next/components/Dropdown/DropdownItem.d.ts.map +1 -1
- package/dist/esm/next/components/Dropdown/DropdownItem.js +4 -2
- package/dist/esm/next/components/Dropdown/DropdownItem.js.map +1 -1
- package/dist/js/next/components/Dropdown/Dropdown.d.ts +6 -1
- package/dist/js/next/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/js/next/components/Dropdown/Dropdown.js +4 -2
- package/dist/js/next/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/js/next/components/Dropdown/DropdownItem.d.ts +6 -1
- package/dist/js/next/components/Dropdown/DropdownItem.d.ts.map +1 -1
- package/dist/js/next/components/Dropdown/DropdownItem.js +4 -2
- package/dist/js/next/components/Dropdown/DropdownItem.js.map +1 -1
- package/dist/umd/react-core.min.css +1315 -1315
- package/package.json +2 -2
- package/src/next/components/Dropdown/Dropdown.tsx +10 -2
- package/src/next/components/Dropdown/DropdownItem.tsx +16 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.255.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",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"react": "^16.8 || ^17 || ^18",
|
|
71
71
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "d37ff721bbea043cbb5c51b95829f8143d37c80c"
|
|
74
74
|
}
|
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import { Menu, MenuContent, MenuProps } from '../../../components/Menu';
|
|
4
4
|
import { Popper } from '../../../helpers/Popper/Popper';
|
|
5
|
+
import { useOUIAProps, OUIAProps } from '../../../helpers';
|
|
5
6
|
|
|
6
|
-
export interface DropdownProps extends MenuProps {
|
|
7
|
+
export interface DropdownProps extends MenuProps, OUIAProps {
|
|
7
8
|
/** Anything which can be rendered in a dropdown. */
|
|
8
9
|
children?: React.ReactNode;
|
|
9
10
|
/** Classes applied to root element of dropdown. */
|
|
@@ -25,6 +26,10 @@ export interface DropdownProps extends MenuProps {
|
|
|
25
26
|
minWidth?: string;
|
|
26
27
|
/** @hide Forwarded ref */
|
|
27
28
|
innerRef?: React.Ref<any>;
|
|
29
|
+
/** Value to overwrite the randomly generated data-ouia-component-id.*/
|
|
30
|
+
ouiaId?: number | string;
|
|
31
|
+
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */
|
|
32
|
+
ouiaSafe?: boolean;
|
|
28
33
|
}
|
|
29
34
|
|
|
30
35
|
const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
@@ -38,11 +43,14 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
|
38
43
|
isScrollable,
|
|
39
44
|
minWidth,
|
|
40
45
|
innerRef,
|
|
46
|
+
ouiaId,
|
|
47
|
+
ouiaSafe = true,
|
|
41
48
|
...props
|
|
42
49
|
}: DropdownProps) => {
|
|
43
50
|
const localMenuRef = React.useRef<HTMLDivElement>();
|
|
44
51
|
const toggleRef = React.useRef<HTMLButtonElement>();
|
|
45
52
|
const containerRef = React.useRef<HTMLDivElement>();
|
|
53
|
+
const ouiaProps = useOUIAProps(Dropdown.displayName, ouiaId, ouiaSafe);
|
|
46
54
|
|
|
47
55
|
const menuRef = (innerRef as React.RefObject<HTMLDivElement>) || localMenuRef;
|
|
48
56
|
React.useEffect(() => {
|
|
@@ -104,7 +112,7 @@ const DropdownBase: React.FunctionComponent<DropdownProps> = ({
|
|
|
104
112
|
</Menu>
|
|
105
113
|
);
|
|
106
114
|
return (
|
|
107
|
-
<div ref={containerRef}>
|
|
115
|
+
<div ref={containerRef} {...ouiaProps}>
|
|
108
116
|
<Popper
|
|
109
117
|
trigger={toggle(toggleRef)}
|
|
110
118
|
removeFindDomNode
|
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { css } from '@patternfly/react-styles';
|
|
3
3
|
import { MenuItemProps, MenuItem } from '../../../components/Menu';
|
|
4
|
+
import { useOUIAProps, OUIAProps } from '../../../helpers';
|
|
4
5
|
|
|
5
|
-
export interface DropdownItemProps extends Omit<MenuItemProps, 'ref'
|
|
6
|
+
export interface DropdownItemProps extends Omit<MenuItemProps, 'ref'>, OUIAProps {
|
|
6
7
|
/** Anything which can be rendered in a dropdown item */
|
|
7
8
|
children?: React.ReactNode;
|
|
8
9
|
/** Classes applied to root element of dropdown item */
|
|
9
10
|
className?: string;
|
|
10
11
|
/** Description of the dropdown item */
|
|
11
12
|
description?: React.ReactNode;
|
|
13
|
+
/** Value to overwrite the randomly generated data-ouia-component-id.*/
|
|
14
|
+
ouiaId?: number | string;
|
|
15
|
+
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */
|
|
16
|
+
ouiaSafe?: boolean;
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
export const DropdownItem: React.FunctionComponent<MenuItemProps> = ({
|
|
15
20
|
children,
|
|
16
21
|
className,
|
|
17
22
|
description,
|
|
23
|
+
ouiaId,
|
|
24
|
+
ouiaSafe,
|
|
18
25
|
...props
|
|
19
|
-
}: DropdownItemProps) =>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
}: DropdownItemProps) => {
|
|
27
|
+
const ouiaProps = useOUIAProps(DropdownItem.displayName, ouiaId, ouiaSafe);
|
|
28
|
+
return (
|
|
29
|
+
<MenuItem className={css(className)} description={description} {...ouiaProps} {...props}>
|
|
30
|
+
{children}
|
|
31
|
+
</MenuItem>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
24
34
|
DropdownItem.displayName = 'DropdownItem';
|