@patternfly/react-core 4.266.1 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.266.1",
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": "e8e88bf93618d03c99fd94996f0e7db9de6400cd"
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
  });