@patternfly/react-core 4.266.0 → 4.266.2
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 +19 -0
- package/dist/esm/components/Pagination/Pagination.d.ts +12 -2
- package/dist/esm/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +3 -2
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Sidebar/SidebarPanel.d.ts +9 -0
- package/dist/esm/components/Sidebar/SidebarPanel.d.ts.map +1 -1
- package/dist/esm/components/Sidebar/SidebarPanel.js +10 -0
- package/dist/esm/components/Sidebar/SidebarPanel.js.map +1 -1
- package/dist/js/components/Pagination/Pagination.d.ts +12 -2
- package/dist/js/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/js/components/Pagination/Pagination.js +3 -2
- package/dist/js/components/Pagination/Pagination.js.map +1 -1
- package/dist/js/components/Sidebar/SidebarPanel.d.ts +9 -0
- package/dist/js/components/Sidebar/SidebarPanel.d.ts.map +1 -1
- package/dist/js/components/Sidebar/SidebarPanel.js +11 -1
- package/dist/js/components/Sidebar/SidebarPanel.js.map +1 -1
- package/dist/umd/react-core.min.js +1 -1
- package/package.json +2 -2
- package/src/components/Pagination/Pagination.tsx +17 -2
- package/src/components/Pagination/__tests__/Pagination.test.tsx +21 -0
- package/src/components/Pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +1266 -0
- package/src/components/Pagination/examples/Pagination.md +5 -0
- package/src/components/Pagination/examples/PaginationInset.tsx +37 -0
- package/src/components/Pagination/examples/PaginationSticky.tsx +47 -55
- package/src/components/Panel/__tests__/Panel.test.tsx +96 -58
- package/src/components/Panel/__tests__/PanelFooter.test.tsx +42 -0
- package/src/components/Panel/__tests__/PanelHeader.test.tsx +42 -0
- package/src/components/Panel/__tests__/PanelMain.test.tsx +48 -0
- package/src/components/Panel/__tests__/PanelMainBody.test.tsx +42 -0
- package/src/components/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +2 -82
- package/src/components/Panel/__tests__/__snapshots__/PanelFooter.test.tsx.snap +11 -0
- package/src/components/Panel/__tests__/__snapshots__/PanelHeader.test.tsx.snap +11 -0
- package/src/components/Panel/__tests__/__snapshots__/PanelMain.test.tsx.snap +11 -0
- package/src/components/Panel/__tests__/__snapshots__/PanelMainBody.test.tsx.snap +11 -0
- package/src/components/Sidebar/SidebarPanel.tsx +10 -0
- package/src/components/Sidebar/__tests__/Sidebar.test.tsx +72 -0
- package/src/components/Sidebar/__tests__/SidebarContent.test.tsx +38 -0
- package/src/components/Sidebar/__tests__/SidebarPanel.test.tsx +75 -0
- package/src/components/Sidebar/__tests__/__snapshots__/Sidebar.test.tsx.snap +15 -0
- package/src/components/Sidebar/__tests__/__snapshots__/SidebarContent.test.tsx.snap +11 -0
- package/src/components/Sidebar/__tests__/__snapshots__/SidebarPanel.test.tsx.snap +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/react-core",
|
|
3
|
-
"version": "4.266.
|
|
3
|
+
"version": "4.266.2",
|
|
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",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"react": "^16.8 || ^17 || ^18",
|
|
78
78
|
"react-dom": "^16.8 || ^17 || ^18"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "08cb2ff73fe6b884d8a0688dc568a9837d435145"
|
|
81
81
|
}
|
|
@@ -6,9 +6,9 @@ import { css } from '@patternfly/react-styles';
|
|
|
6
6
|
import { fillTemplate } from '../../helpers';
|
|
7
7
|
import { Navigation } from './Navigation';
|
|
8
8
|
import { PaginationOptionsMenu } from './PaginationOptionsMenu';
|
|
9
|
-
import { getOUIAProps, OUIAProps, getDefaultOUIAId } from '../../helpers';
|
|
9
|
+
import { getOUIAProps, OUIAProps, getDefaultOUIAId, PickOptional } from '../../helpers';
|
|
10
|
+
import { formatBreakpointMods } from '../../helpers/util';
|
|
10
11
|
import widthChars from '@patternfly/react-tokens/dist/esm/c_pagination__nav_page_select_c_form_control_width_chars';
|
|
11
|
-
import { PickOptional } from '../../helpers';
|
|
12
12
|
|
|
13
13
|
export enum PaginationVariant {
|
|
14
14
|
bottom = 'bottom',
|
|
@@ -109,6 +109,17 @@ export interface PaginationProps extends React.HTMLProps<HTMLDivElement>, OUIAPr
|
|
|
109
109
|
dropDirection?: 'up' | 'down';
|
|
110
110
|
/** Page to start at. */
|
|
111
111
|
firstPage?: number;
|
|
112
|
+
/** @beta Flag indicating that pagination should use page insets. */
|
|
113
|
+
usePageInsets?: boolean;
|
|
114
|
+
/** @beta Insets at various breakpoints. */
|
|
115
|
+
inset?: {
|
|
116
|
+
default?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
|
|
117
|
+
sm?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
|
|
118
|
+
md?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
|
|
119
|
+
lg?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
|
|
120
|
+
xl?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
|
|
121
|
+
'2xl'?: 'insetNone' | 'insetSm' | 'insetMd' | 'insetLg' | 'insetXl' | 'inset2xl';
|
|
122
|
+
};
|
|
112
123
|
/** Flag indicating if pagination is compact. */
|
|
113
124
|
isCompact?: boolean;
|
|
114
125
|
/** Flag indicating if pagination is disabled. */
|
|
@@ -275,6 +286,8 @@ export class Pagination extends React.Component<PaginationProps, { ouiaStateId:
|
|
|
275
286
|
ouiaId,
|
|
276
287
|
ouiaSafe,
|
|
277
288
|
perPageComponent,
|
|
289
|
+
usePageInsets,
|
|
290
|
+
inset,
|
|
278
291
|
...props
|
|
279
292
|
} = this.props;
|
|
280
293
|
const dropDirection = dropDirectionProp || (variant === 'bottom' && !isStatic ? 'up' : 'down');
|
|
@@ -313,6 +326,8 @@ export class Pagination extends React.Component<PaginationProps, { ouiaStateId:
|
|
|
313
326
|
className={css(
|
|
314
327
|
styles.pagination,
|
|
315
328
|
variant === PaginationVariant.bottom && styles.modifiers.bottom,
|
|
329
|
+
usePageInsets && styles.modifiers.pageInsets,
|
|
330
|
+
formatBreakpointMods(inset, styles),
|
|
316
331
|
isCompact && styles.modifiers.compact,
|
|
317
332
|
isStatic && styles.modifiers.static,
|
|
318
333
|
isSticky && styles.modifiers.sticky,
|
|
@@ -119,6 +119,11 @@ describe('Pagination', () => {
|
|
|
119
119
|
rerender(<Pagination titles={{optionsToggle: "test label"}} perPageComponent="button" itemCount={20} />);
|
|
120
120
|
expect(screen.getByLabelText("test label")).toHaveAttribute("id", id);
|
|
121
121
|
});
|
|
122
|
+
|
|
123
|
+
test('page insets', () => {
|
|
124
|
+
render(<Pagination data-testid="pagination-insets" usePageInsets />);
|
|
125
|
+
expect(screen.getByTestId('pagination-insets')).toHaveClass('pf-m-page-insets');
|
|
126
|
+
});
|
|
122
127
|
});
|
|
123
128
|
|
|
124
129
|
describe('API', () => {
|
|
@@ -327,5 +332,21 @@ describe('Pagination', () => {
|
|
|
327
332
|
expect(onPerPage).not.toHaveBeenCalled();
|
|
328
333
|
});
|
|
329
334
|
});
|
|
335
|
+
|
|
336
|
+
Object.values(['insetNone', 'insetSm', 'insetMd', 'insetLg', 'insetXl', 'inset2xl'] as [
|
|
337
|
+
'insetNone',
|
|
338
|
+
'insetSm',
|
|
339
|
+
'insetMd',
|
|
340
|
+
'insetLg',
|
|
341
|
+
'insetXl',
|
|
342
|
+
'inset2xl'
|
|
343
|
+
]).forEach(inset => {
|
|
344
|
+
test(`verify ${inset} inset breakpoints`, () => {
|
|
345
|
+
const { asFragment } = render(
|
|
346
|
+
<Pagination inset={{ default: inset, sm: inset, md: inset, lg: inset, xl: inset, '2xl': inset }}>test</Pagination>
|
|
347
|
+
);
|
|
348
|
+
expect(asFragment()).toMatchSnapshot();
|
|
349
|
+
});
|
|
350
|
+
});
|
|
330
351
|
});
|
|
331
352
|
});
|