@atlaskit/pagination 14.3.1 → 14.3.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/pagination
2
2
 
3
+ ## 14.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
8
+
3
9
  ## 14.3.1
4
10
 
5
11
  ### Patch Changes
@@ -28,7 +28,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
28
28
  var analyticsAttributes = {
29
29
  componentName: 'pagination',
30
30
  packageName: "@atlaskit/pagination",
31
- packageVersion: "14.3.1"
31
+ packageVersion: "14.3.2"
32
32
  };
33
33
  function InnerPagination(_ref, ref) {
34
34
  var _ref$components = _ref.components,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.3.1",
3
+ "version": "14.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -14,7 +14,7 @@ import collapseRange from './internal/utils/collapse-range';
14
14
  const analyticsAttributes = {
15
15
  componentName: 'pagination',
16
16
  packageName: "@atlaskit/pagination",
17
- packageVersion: "14.3.1"
17
+ packageVersion: "14.3.2"
18
18
  };
19
19
  function InnerPagination({
20
20
  components = emptyObject,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.3.1",
3
+ "version": "14.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -18,7 +18,7 @@ import collapseRange from './internal/utils/collapse-range';
18
18
  var analyticsAttributes = {
19
19
  componentName: 'pagination',
20
20
  packageName: "@atlaskit/pagination",
21
- packageVersion: "14.3.1"
21
+ packageVersion: "14.3.2"
22
22
  };
23
23
  function InnerPagination(_ref, ref) {
24
24
  var _ref$components = _ref.components,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.3.1",
3
+ "version": "14.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export type { PaginationPropTypes } from '../types';
@@ -0,0 +1,2 @@
1
+ export { default } from './pagination';
2
+ export type { PaginationPropTypes } from './types';
@@ -0,0 +1,20 @@
1
+ import React, { ReactElement, SyntheticEvent } from 'react';
2
+ export type NavigatorProps<T> = {
3
+ /**
4
+ * This will be passed in as aria-label to button. This is what screen reader will read
5
+ */
6
+ 'aria-label'?: string;
7
+ /**
8
+ * Is the navigator disabled
9
+ */
10
+ isDisabled?: boolean;
11
+ iconBefore: ReactElement;
12
+ pages: T[];
13
+ testId?: string;
14
+ /**
15
+ * This function is called with the when user clicks on navigator
16
+ */
17
+ onClick?: (event: SyntheticEvent) => void;
18
+ component?: React.ElementType<any>;
19
+ };
20
+ export default function Navigator<T>(props: NavigatorProps<T>): JSX.Element;
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ import { ButtonProps } from '@atlaskit/button/standard-button';
3
+ import type { Appearance } from '@atlaskit/button/types';
4
+ type Diff<T, U> = T extends U ? never : T;
5
+ type PageProps = Diff<ButtonProps, {
6
+ appearance?: Appearance;
7
+ autoFocus: boolean;
8
+ isDisabled: boolean;
9
+ isLoading: boolean;
10
+ spacing: 'compact' | 'default' | 'none';
11
+ shouldFitContainer: boolean;
12
+ type: 'button' | 'submit';
13
+ }> & {
14
+ page?: any;
15
+ };
16
+ export default function Page(props: PageProps): JSX.Element;
17
+ export {};
@@ -0,0 +1,6 @@
1
+ import { ReactElement } from 'react';
2
+ export type EllipsisProp = {
3
+ key: string;
4
+ testId?: string;
5
+ };
6
+ export default function renderEllipsis({ key, testId, }: EllipsisProp): ReactElement;
@@ -0,0 +1 @@
1
+ export declare const emptyObject: {};
@@ -0,0 +1,10 @@
1
+ import { ReactElement } from 'react';
2
+ declare const collapseRange: <T>(pages: T[], current: number, { max, ellipsis, transform, }: {
3
+ max: number;
4
+ ellipsis: (arg: {
5
+ key: string;
6
+ testId: string;
7
+ }) => ReactElement;
8
+ transform: (page: T, index: number, testId?: string) => ReactElement;
9
+ }, testId?: string) => ReactElement[];
10
+ export default collapseRange;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { PaginationPropTypes } from './types';
3
+ declare function InnerPagination<T>({ components, defaultSelectedIndex, selectedIndex, label, previousLabel, nextLabel, style, max, onChange, pages, getPageLabel, renderEllipsis, analyticsContext, testId, }: PaginationPropTypes<T>, ref: React.Ref<HTMLDivElement>): JSX.Element;
4
+ declare const _default: typeof InnerPagination;
5
+ export default _default;
@@ -0,0 +1,75 @@
1
+ import type { CSSProperties, ReactElement, SyntheticEvent } from 'react';
2
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ export interface PaginationPropTypes<T = unknown> {
4
+ /**
5
+ * Replace the built-in Page, Previous, Next and/ or Ellipsis component
6
+ */
7
+ components?: {
8
+ Page?: React.ElementType;
9
+ Previous?: React.ElementType;
10
+ Next?: React.ElementType;
11
+ };
12
+ /**
13
+ * Index of the page to be selected by default
14
+ */
15
+ defaultSelectedIndex?: number;
16
+ /**
17
+ * Helper function to get text displayed on the page button. It is helpful in scenarios when page the page passed in is an object
18
+ */
19
+ getPageLabel?: (page: T, pageIndex: number) => number | string;
20
+ /**
21
+ * The aria-label for the pagination wrapper
22
+ */
23
+ label?: string;
24
+ /**
25
+ * The aria-label for the next button
26
+ */
27
+ nextLabel?: string;
28
+ /**
29
+ * The aria-label for the previous button
30
+ */
31
+ previousLabel?: string;
32
+ /**
33
+ * Style to spread on the container element
34
+ */
35
+ style?: CSSProperties;
36
+ /**
37
+ * Maximum number of pages to be displayed in the pagination
38
+ */
39
+ max?: number;
40
+ /**
41
+ * The onChange handler which is called when the page is changed
42
+ */
43
+ onChange?: (event: SyntheticEvent, page: T, analyticsEvent?: UIAnalyticsEvent) => void;
44
+ /**
45
+ * Array of the pages to display
46
+ */
47
+ pages: T[];
48
+ /**
49
+ * Index of the selected page. This will make this pagination controlled
50
+ */
51
+ selectedIndex?: number;
52
+ /**
53
+ * The react Node returned from the function is rendered instead of the default ellipsis node
54
+ */
55
+ renderEllipsis?: (arg: {
56
+ key: string;
57
+ }) => ReactElement;
58
+ /**
59
+ * Additional information to be included in the `context` of analytics events
60
+ */
61
+ analyticsContext?: Record<string, any>;
62
+ /**
63
+ * A `testId` prop is provided for specified elements,
64
+ * which is a unique string that appears as a data attribute `data-testid`
65
+ * in the rendered code, serving as a hook for automated tests.
66
+ *
67
+ * Will set data-testid on these elements when defined:
68
+ * - Pagination nav wrapper - {testId}
69
+ * - Page - {testId}--page-{page index}
70
+ * - Current page - {testId}--current-page-{page index}
71
+ * - Left navigator - {testId}--left-navigator
72
+ * - Right navigator - {testId}--right-navigator
73
+ */
74
+ testId?: string;
75
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/pagination",
3
- "version": "14.3.1",
3
+ "version": "14.3.2",
4
4
  "description": "Pagination allows you to divide large amounts of content into smaller chunks across multiple pages.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"