@patternfly/react-core 6.3.0 → 6.3.1-prerelease.1
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 +13 -0
- package/components/package.json +1 -1
- package/deprecated/package.json +1 -1
- package/dist/dynamic/components/AboutModal/package.json +1 -1
- package/dist/dynamic/components/Accordion/package.json +1 -1
- package/dist/dynamic/components/ActionList/package.json +1 -1
- package/dist/dynamic/components/Alert/package.json +1 -1
- package/dist/dynamic/components/Avatar/package.json +1 -1
- package/dist/dynamic/components/BackToTop/package.json +1 -1
- package/dist/dynamic/components/Backdrop/package.json +1 -1
- package/dist/dynamic/components/BackgroundImage/package.json +1 -1
- package/dist/dynamic/components/Badge/package.json +1 -1
- package/dist/dynamic/components/Banner/package.json +1 -1
- package/dist/dynamic/components/Brand/package.json +1 -1
- package/dist/dynamic/components/Breadcrumb/package.json +1 -1
- package/dist/dynamic/components/Button/package.json +1 -1
- package/dist/dynamic/components/CalendarMonth/package.json +1 -1
- package/dist/dynamic/components/Card/package.json +1 -1
- package/dist/dynamic/components/Checkbox/package.json +1 -1
- package/dist/dynamic/components/ClipboardCopy/package.json +1 -1
- package/dist/dynamic/components/CodeBlock/package.json +1 -1
- package/dist/dynamic/components/Content/package.json +1 -1
- package/dist/dynamic/components/DataList/package.json +1 -1
- package/dist/dynamic/components/DatePicker/package.json +1 -1
- package/dist/dynamic/components/DescriptionList/package.json +1 -1
- package/dist/dynamic/components/Divider/package.json +1 -1
- package/dist/dynamic/components/Drawer/package.json +1 -1
- package/dist/dynamic/components/Dropdown/package.json +1 -1
- package/dist/dynamic/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/components/EmptyState/package.json +1 -1
- package/dist/dynamic/components/ExpandableSection/package.json +1 -1
- package/dist/dynamic/components/FileUpload/package.json +1 -1
- package/dist/dynamic/components/Form/package.json +1 -1
- package/dist/dynamic/components/FormSelect/package.json +1 -1
- package/dist/dynamic/components/HelperText/package.json +1 -1
- package/dist/dynamic/components/Hint/package.json +1 -1
- package/dist/dynamic/components/Icon/package.json +1 -1
- package/dist/dynamic/components/InputGroup/package.json +1 -1
- package/dist/dynamic/components/JumpLinks/package.json +1 -1
- package/dist/dynamic/components/Label/package.json +1 -1
- package/dist/dynamic/components/List/package.json +1 -1
- package/dist/dynamic/components/LoginPage/package.json +1 -1
- package/dist/dynamic/components/Masthead/package.json +1 -1
- package/dist/dynamic/components/Menu/package.json +1 -1
- package/dist/dynamic/components/MenuToggle/package.json +1 -1
- package/dist/dynamic/components/Modal/package.json +1 -1
- package/dist/dynamic/components/MultipleFileUpload/package.json +1 -1
- package/dist/dynamic/components/Nav/package.json +1 -1
- package/dist/dynamic/components/NotificationBadge/package.json +1 -1
- package/dist/dynamic/components/NotificationDrawer/package.json +1 -1
- package/dist/dynamic/components/NumberInput/package.json +1 -1
- package/dist/dynamic/components/OverflowMenu/package.json +1 -1
- package/dist/dynamic/components/Page/package.json +1 -1
- package/dist/dynamic/components/Pagination/package.json +1 -1
- package/dist/dynamic/components/Panel/package.json +1 -1
- package/dist/dynamic/components/Popover/package.json +1 -1
- package/dist/dynamic/components/Progress/package.json +1 -1
- package/dist/dynamic/components/ProgressStepper/package.json +1 -1
- package/dist/dynamic/components/Radio/package.json +1 -1
- package/dist/dynamic/components/SearchInput/package.json +1 -1
- package/dist/dynamic/components/Select/package.json +1 -1
- package/dist/dynamic/components/Sidebar/package.json +1 -1
- package/dist/dynamic/components/SimpleList/package.json +1 -1
- package/dist/dynamic/components/Skeleton/package.json +1 -1
- package/dist/dynamic/components/SkipToContent/package.json +1 -1
- package/dist/dynamic/components/Slider/package.json +1 -1
- package/dist/dynamic/components/Spinner/package.json +1 -1
- package/dist/dynamic/components/Switch/package.json +1 -1
- package/dist/dynamic/components/Tabs/package.json +1 -1
- package/dist/dynamic/components/TextArea/package.json +1 -1
- package/dist/dynamic/components/TextInput/package.json +1 -1
- package/dist/dynamic/components/TextInputGroup/package.json +1 -1
- package/dist/dynamic/components/TimePicker/package.json +1 -1
- package/dist/dynamic/components/Timestamp/package.json +1 -1
- package/dist/dynamic/components/Title/package.json +1 -1
- package/dist/dynamic/components/ToggleGroup/package.json +1 -1
- package/dist/dynamic/components/Toolbar/package.json +1 -1
- package/dist/dynamic/components/Tooltip/package.json +1 -1
- package/dist/dynamic/components/TreeView/package.json +1 -1
- package/dist/dynamic/components/Truncate/package.json +1 -1
- package/dist/dynamic/components/Wizard/hooks/package.json +1 -1
- package/dist/dynamic/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/Chip/package.json +1 -1
- package/dist/dynamic/deprecated/components/DragDrop/package.json +1 -1
- package/dist/dynamic/deprecated/components/DualListSelector/package.json +1 -1
- package/dist/dynamic/deprecated/components/Modal/package.json +1 -1
- package/dist/dynamic/deprecated/components/Tile/package.json +1 -1
- package/dist/dynamic/deprecated/components/Wizard/package.json +1 -1
- package/dist/dynamic/deprecated/components/package.json +1 -1
- package/dist/dynamic/helpers/FocusTrap/FocusTrap/package.json +1 -1
- package/dist/dynamic/helpers/GenerateId/GenerateId/package.json +1 -1
- package/dist/dynamic/helpers/KeyboardHandler/package.json +1 -1
- package/dist/dynamic/helpers/OUIA/ouia/package.json +1 -1
- package/dist/dynamic/helpers/Popper/Popper/package.json +1 -1
- package/dist/dynamic/helpers/constants/package.json +1 -1
- package/dist/dynamic/helpers/datetimeUtils/package.json +1 -1
- package/dist/dynamic/helpers/fileUtils/package.json +1 -1
- package/dist/dynamic/helpers/htmlConstants/package.json +1 -1
- package/dist/dynamic/helpers/package.json +1 -1
- package/dist/dynamic/helpers/resizeObserver/package.json +1 -1
- package/dist/dynamic/helpers/typeUtils/package.json +1 -1
- package/dist/dynamic/helpers/useInterval/package.json +1 -1
- package/dist/dynamic/helpers/useIsomorphicLayout/package.json +1 -1
- package/dist/dynamic/helpers/useUnmountEffect/package.json +1 -1
- package/dist/dynamic/helpers/util/package.json +1 -1
- package/dist/dynamic/layouts/Bullseye/package.json +1 -1
- package/dist/dynamic/layouts/Flex/package.json +1 -1
- package/dist/dynamic/layouts/Gallery/package.json +1 -1
- package/dist/dynamic/layouts/Grid/package.json +1 -1
- package/dist/dynamic/layouts/Level/package.json +1 -1
- package/dist/dynamic/layouts/Split/package.json +1 -1
- package/dist/dynamic/layouts/Stack/package.json +1 -1
- package/dist/dynamic/styles/package.json +1 -1
- package/dist/esm/components/Card/Card.d.ts +3 -1
- package/dist/esm/components/Card/Card.d.ts.map +1 -1
- package/dist/esm/components/Card/Card.js +5 -4
- package/dist/esm/components/Card/Card.js.map +1 -1
- package/dist/esm/components/Page/PageToggleButton.d.ts +2 -0
- package/dist/esm/components/Page/PageToggleButton.d.ts.map +1 -1
- package/dist/esm/components/Page/PageToggleButton.js +4 -2
- package/dist/esm/components/Page/PageToggleButton.js.map +1 -1
- package/dist/esm/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/esm/components/TextArea/TextArea.js +4 -3
- package/dist/esm/components/TextArea/TextArea.js.map +1 -1
- package/dist/js/components/Card/Card.d.ts +3 -1
- package/dist/js/components/Card/Card.d.ts.map +1 -1
- package/dist/js/components/Card/Card.js +4 -4
- package/dist/js/components/Card/Card.js.map +1 -1
- package/dist/js/components/Page/PageToggleButton.d.ts +2 -0
- package/dist/js/components/Page/PageToggleButton.d.ts.map +1 -1
- package/dist/js/components/Page/PageToggleButton.js +4 -2
- package/dist/js/components/Page/PageToggleButton.js.map +1 -1
- package/dist/js/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/js/components/TextArea/TextArea.js +4 -3
- package/dist/js/components/TextArea/TextArea.js.map +1 -1
- package/dist/umd/assets/{output-BvTy70LD.css → output-CqyiGvp-.css} +17951 -17951
- package/dist/umd/react-core.min.js +1 -1
- package/helpers/package.json +1 -1
- package/layouts/package.json +1 -1
- package/next/package.json +1 -1
- package/package.json +2 -2
- package/src/components/Card/Card.tsx +9 -3
- package/src/components/Card/__tests__/Card.test.tsx +11 -0
- package/src/components/Page/PageToggleButton.tsx +7 -0
- package/src/components/Page/__tests__/PageToggleButton.test.tsx +74 -0
- package/src/components/TextArea/TextArea.tsx +5 -3
- package/src/components/TextArea/__tests__/__snapshots__/TextArea.test.tsx.snap +1 -1
package/helpers/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.3.
|
|
1
|
+
{"name":"@patternfly/react-core-helpers","main":"../dist/js/helpers/index.js","module":"../dist/esm/helpers/index.js","typings":"../dist/esm/helpers/index.d.ts","version":"6.3.1-prerelease.0","private":true}
|
package/layouts/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.3.
|
|
1
|
+
{"name":"@patternfly/react-core-layouts","main":"../dist/js/layouts/index.js","module":"../dist/esm/layouts/index.js","typings":"../dist/esm/layouts/index.d.ts","version":"6.3.1-prerelease.0","private":true}
|
package/next/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.3.
|
|
1
|
+
{"name":"@patternfly/react-core-next","main":"../dist/js/next/index.js","module":"../dist/esm/next/index.js","typings":"../dist/esm/next/index.d.ts","version":"6.3.1-prerelease.0","private":true}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.1-prerelease.1",
|
|
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",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"react": "^17 || ^18 || ^19",
|
|
64
64
|
"react-dom": "^17 || ^18 || ^19"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "bc7a24267c0b8aff6f4ce5fd085aa6f01d5878bb"
|
|
67
67
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext } from 'react';
|
|
1
|
+
import { createContext, forwardRef } from 'react';
|
|
2
2
|
import styles from '@patternfly/react-styles/css/components/Card/card';
|
|
3
3
|
import { css } from '@patternfly/react-styles';
|
|
4
4
|
import { useOUIAProps, OUIAProps } from '../../helpers';
|
|
@@ -42,6 +42,8 @@ export interface CardProps extends React.HTMLProps<HTMLElement>, OUIAProps {
|
|
|
42
42
|
ouiaId?: number | string;
|
|
43
43
|
/** 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. */
|
|
44
44
|
ouiaSafe?: boolean;
|
|
45
|
+
/** @hide Forwarded ref */
|
|
46
|
+
innerRef?: React.Ref<any>;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
interface CardContextProps {
|
|
@@ -64,7 +66,7 @@ export const CardContext = createContext<Partial<CardContextProps>>({
|
|
|
64
66
|
isDisabled: false
|
|
65
67
|
});
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
const CardBase: React.FunctionComponent<CardProps> = ({
|
|
68
70
|
children,
|
|
69
71
|
id = '',
|
|
70
72
|
className,
|
|
@@ -82,7 +84,7 @@ export const Card: React.FunctionComponent<CardProps> = ({
|
|
|
82
84
|
variant = 'default',
|
|
83
85
|
ouiaId,
|
|
84
86
|
ouiaSafe = true,
|
|
85
|
-
|
|
87
|
+
innerRef,
|
|
86
88
|
...props
|
|
87
89
|
}: CardProps) => {
|
|
88
90
|
const Component = component as any;
|
|
@@ -127,6 +129,7 @@ export const Card: React.FunctionComponent<CardProps> = ({
|
|
|
127
129
|
}}
|
|
128
130
|
>
|
|
129
131
|
<Component
|
|
132
|
+
ref={innerRef}
|
|
130
133
|
id={id}
|
|
131
134
|
className={css(
|
|
132
135
|
styles.card,
|
|
@@ -148,4 +151,7 @@ export const Card: React.FunctionComponent<CardProps> = ({
|
|
|
148
151
|
</CardContext.Provider>
|
|
149
152
|
);
|
|
150
153
|
};
|
|
154
|
+
|
|
155
|
+
export const Card = forwardRef((props: CardProps, ref: React.Ref<any>) => <CardBase {...props} innerRef={ref} />);
|
|
156
|
+
|
|
151
157
|
Card.displayName = 'Card';
|
|
@@ -2,6 +2,7 @@ import { render, screen } from '@testing-library/react';
|
|
|
2
2
|
import '@testing-library/jest-dom';
|
|
3
3
|
|
|
4
4
|
import { Card } from '../Card';
|
|
5
|
+
import { createRef } from 'react';
|
|
5
6
|
|
|
6
7
|
describe('Card', () => {
|
|
7
8
|
test('renders with PatternFly Core styles', () => {
|
|
@@ -91,4 +92,14 @@ describe('Card', () => {
|
|
|
91
92
|
const card = screen.getByText('secondary card');
|
|
92
93
|
expect(card).toHaveClass('pf-m-secondary');
|
|
93
94
|
});
|
|
95
|
+
|
|
96
|
+
test('ref is added to the root element', () => {
|
|
97
|
+
const ref = createRef<HTMLTextAreaElement>();
|
|
98
|
+
render(
|
|
99
|
+
<Card ref={ref} tabIndex={-1}>
|
|
100
|
+
card
|
|
101
|
+
</Card>
|
|
102
|
+
);
|
|
103
|
+
expect(ref.current).toBe(screen.getByText('card'));
|
|
104
|
+
});
|
|
94
105
|
});
|
|
@@ -14,6 +14,8 @@ export interface PageToggleButtonProps extends ButtonProps {
|
|
|
14
14
|
'aria-label'?: string;
|
|
15
15
|
/** Flag indicating whether the hamburger button variation with animations should be used. */
|
|
16
16
|
isHamburgerButton?: boolean;
|
|
17
|
+
/** IsHamburgerButton must be true for hamburgerVariant to be have an effect. Adjusts and animates the hamburger icon to indicate what will happen upon clicking the button. */
|
|
18
|
+
hamburgerVariant?: 'expand' | 'collapse';
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
export const PageToggleButton: React.FunctionComponent<PageToggleButtonProps> = ({
|
|
@@ -23,6 +25,7 @@ export const PageToggleButton: React.FunctionComponent<PageToggleButtonProps> =
|
|
|
23
25
|
id = 'nav-toggle',
|
|
24
26
|
'aria-label': ariaLabel = 'Side navigation toggle',
|
|
25
27
|
isHamburgerButton,
|
|
28
|
+
hamburgerVariant,
|
|
26
29
|
...props
|
|
27
30
|
}: PageToggleButtonProps) => (
|
|
28
31
|
<PageContextConsumer>
|
|
@@ -42,6 +45,10 @@ export const PageToggleButton: React.FunctionComponent<PageToggleButtonProps> =
|
|
|
42
45
|
aria-expanded={sidebarOpen ? 'true' : 'false'}
|
|
43
46
|
variant={ButtonVariant.plain}
|
|
44
47
|
isHamburger={isHamburgerButton}
|
|
48
|
+
hamburgerVariant={hamburgerVariant}
|
|
49
|
+
{...(isHamburgerButton && {
|
|
50
|
+
isExpanded: sidebarOpen
|
|
51
|
+
})}
|
|
45
52
|
{...props}
|
|
46
53
|
>
|
|
47
54
|
{!isHamburgerButton && children}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { render, screen } from '@testing-library/react';
|
|
2
|
+
import { PageToggleButton } from '../PageToggleButton';
|
|
3
|
+
import { PageContextProvider } from '../PageContext';
|
|
4
|
+
|
|
5
|
+
test('Renders without children', () => {
|
|
6
|
+
render(
|
|
7
|
+
<div data-testid="container">
|
|
8
|
+
<PageToggleButton />
|
|
9
|
+
</div>
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
expect(screen.getByTestId('container').firstChild).toBeVisible();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test('Renders with children', () => {
|
|
16
|
+
render(<PageToggleButton>Test</PageToggleButton>);
|
|
17
|
+
|
|
18
|
+
expect(screen.getByText('Test')).toBeVisible();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
test('Throws console error when isHamburger is true and isSidebarOpen is not passed', () => {
|
|
22
|
+
const consoleError = jest.spyOn(console, 'error').mockImplementation();
|
|
23
|
+
|
|
24
|
+
render(<PageToggleButton isHamburger aria-label="Test" />);
|
|
25
|
+
|
|
26
|
+
expect(consoleError).toHaveBeenCalledWith(
|
|
27
|
+
'Button: when the isHamburger property is passed in, you must also pass in a boolean value to the isExpanded property. It is expected that a hamburger button controls the expansion of other content.'
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test('Does not throw console error when isHamburger is true and isSidebarOpen is false', () => {
|
|
32
|
+
const consoleError = jest.spyOn(console, 'error').mockImplementation();
|
|
33
|
+
|
|
34
|
+
render(<PageToggleButton isSidebarOpen={false} isHamburger aria-label="Test" />);
|
|
35
|
+
|
|
36
|
+
expect(consoleError).not.toHaveBeenCalledWith(
|
|
37
|
+
'Button: when the isHamburger property is passed in, you must also pass in a boolean value to the isExpanded property. It is expected that a hamburger button controls the expansion of other content..'
|
|
38
|
+
);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('Does not throw console error when isHamburger is true and isSidebarOpen is true', () => {
|
|
42
|
+
const consoleError = jest.spyOn(console, 'error').mockImplementation();
|
|
43
|
+
|
|
44
|
+
render(<PageToggleButton isSidebarOpen isHamburger aria-label="Test" />);
|
|
45
|
+
|
|
46
|
+
expect(consoleError).not.toHaveBeenCalledWith(
|
|
47
|
+
'Button: when the isHamburger property is passed in, you must also pass in a boolean value to the isExpanded property. It is expected that a hamburger button controls the expansion of other content..'
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// assisted by AI/Cursor
|
|
52
|
+
test('Does not throw console error when isHamburger is true, isSidebarOpen is not passed, but managedIsSidebarOpen is true', () => {
|
|
53
|
+
const consoleError = jest.spyOn(console, 'error').mockImplementation();
|
|
54
|
+
|
|
55
|
+
const mockPageContext = {
|
|
56
|
+
isManagedSidebar: true,
|
|
57
|
+
onSidebarToggle: () => null,
|
|
58
|
+
isSidebarOpen: true, // managedIsSidebarOpen is true
|
|
59
|
+
width: 1024,
|
|
60
|
+
height: 768,
|
|
61
|
+
getBreakpoint: () => 'lg' as const,
|
|
62
|
+
getVerticalBreakpoint: () => 'lg' as const
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
render(
|
|
66
|
+
<PageContextProvider value={mockPageContext}>
|
|
67
|
+
<PageToggleButton isHamburger aria-label="Test" />
|
|
68
|
+
</PageContextProvider>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
expect(consoleError).not.toHaveBeenCalledWith(
|
|
72
|
+
'Button: when the isHamburger property is passed in, you must also pass in a boolean value to the isExpanded property. It is expected that a hamburger button controls the expansion of other content..'
|
|
73
|
+
);
|
|
74
|
+
});
|
|
@@ -62,13 +62,15 @@ class TextAreaBase extends Component<TextAreaProps> {
|
|
|
62
62
|
const parent = field.parentElement;
|
|
63
63
|
parent.style.setProperty('height', 'inherit');
|
|
64
64
|
const computed = window.getComputedStyle(field);
|
|
65
|
+
const parentComputed = window.getComputedStyle(parent);
|
|
65
66
|
// Calculate the height
|
|
66
67
|
const height =
|
|
67
68
|
parseInt(computed.getPropertyValue('border-top-width')) +
|
|
68
|
-
parseInt(computed.getPropertyValue('padding-top')) +
|
|
69
69
|
field.scrollHeight +
|
|
70
|
-
parseInt(computed.getPropertyValue('
|
|
71
|
-
parseInt(
|
|
70
|
+
parseInt(computed.getPropertyValue('border-bottom-width')) +
|
|
71
|
+
parseInt(parentComputed.getPropertyValue('padding-top')) +
|
|
72
|
+
parseInt(parentComputed.getPropertyValue('padding-bottom'));
|
|
73
|
+
|
|
72
74
|
parent.style.setProperty('height', `${height}px`);
|
|
73
75
|
};
|
|
74
76
|
|