@instructure/ui-pagination 8.13.1-snapshot.9 → 8.14.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.
Files changed (65) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/es/Pagination/PaginationArrowButton/index.js +36 -4
  3. package/es/Pagination/PaginationArrowButton/props.js +6 -3
  4. package/es/Pagination/PaginationButton/props.js +9 -2
  5. package/es/Pagination/PaginationLocator.js +4 -0
  6. package/es/Pagination/PaginationPageInput/PaginationPageInputLocator.js +35 -0
  7. package/es/Pagination/PaginationPageInput/index.js +208 -0
  8. package/es/Pagination/PaginationPageInput/props.js +35 -0
  9. package/es/Pagination/PaginationPageInput/styles.js +55 -0
  10. package/es/Pagination/PaginationPageInput/theme.js +40 -0
  11. package/es/Pagination/index.js +178 -52
  12. package/es/Pagination/props.js +32 -2
  13. package/lib/Pagination/PaginationArrowButton/index.js +39 -3
  14. package/lib/Pagination/PaginationArrowButton/props.js +6 -3
  15. package/lib/Pagination/PaginationButton/props.js +9 -2
  16. package/lib/Pagination/PaginationLocator.js +5 -0
  17. package/lib/Pagination/PaginationPageInput/PaginationPageInputLocator.js +46 -0
  18. package/lib/Pagination/PaginationPageInput/index.js +202 -0
  19. package/lib/Pagination/PaginationPageInput/props.js +46 -0
  20. package/lib/Pagination/PaginationPageInput/styles.js +63 -0
  21. package/lib/Pagination/PaginationPageInput/theme.js +48 -0
  22. package/lib/Pagination/index.js +179 -52
  23. package/lib/Pagination/props.js +32 -2
  24. package/package.json +23 -22
  25. package/src/Pagination/PaginationArrowButton/index.tsx +32 -4
  26. package/src/Pagination/PaginationArrowButton/props.ts +22 -6
  27. package/src/Pagination/PaginationButton/props.ts +18 -2
  28. package/src/Pagination/PaginationLocator.ts +5 -1
  29. package/src/Pagination/PaginationPageInput/PaginationPageInputLocator.ts +42 -0
  30. package/src/Pagination/PaginationPageInput/index.tsx +242 -0
  31. package/src/Pagination/PaginationPageInput/props.ts +112 -0
  32. package/src/Pagination/PaginationPageInput/styles.ts +60 -0
  33. package/src/Pagination/PaginationPageInput/theme.ts +46 -0
  34. package/src/Pagination/README.md +116 -0
  35. package/src/Pagination/index.tsx +213 -80
  36. package/src/Pagination/props.ts +53 -4
  37. package/tsconfig.build.json +26 -2
  38. package/tsconfig.build.tsbuildinfo +1 -0
  39. package/types/Pagination/PaginationArrowButton/PaginationArrowButtonLocator.d.ts +57 -56
  40. package/types/Pagination/PaginationArrowButton/PaginationArrowButtonLocator.d.ts.map +1 -1
  41. package/types/Pagination/PaginationArrowButton/index.d.ts +9 -4
  42. package/types/Pagination/PaginationArrowButton/index.d.ts.map +1 -1
  43. package/types/Pagination/PaginationArrowButton/props.d.ts +5 -3
  44. package/types/Pagination/PaginationArrowButton/props.d.ts.map +1 -1
  45. package/types/Pagination/PaginationButton/index.d.ts +2 -0
  46. package/types/Pagination/PaginationButton/index.d.ts.map +1 -1
  47. package/types/Pagination/PaginationButton/props.d.ts +1 -0
  48. package/types/Pagination/PaginationButton/props.d.ts.map +1 -1
  49. package/types/Pagination/PaginationLocator.d.ts +944 -234
  50. package/types/Pagination/PaginationLocator.d.ts.map +1 -1
  51. package/types/Pagination/PaginationPageInput/PaginationPageInputLocator.d.ts +581 -0
  52. package/types/Pagination/PaginationPageInput/PaginationPageInputLocator.d.ts.map +1 -0
  53. package/types/Pagination/PaginationPageInput/index.d.ts +63 -0
  54. package/types/Pagination/PaginationPageInput/index.d.ts.map +1 -0
  55. package/types/Pagination/PaginationPageInput/props.d.ts +46 -0
  56. package/types/Pagination/PaginationPageInput/props.d.ts.map +1 -0
  57. package/types/Pagination/PaginationPageInput/styles.d.ts +15 -0
  58. package/types/Pagination/PaginationPageInput/styles.d.ts.map +1 -0
  59. package/types/Pagination/PaginationPageInput/theme.d.ts +10 -0
  60. package/types/Pagination/PaginationPageInput/theme.d.ts.map +1 -0
  61. package/types/Pagination/index.d.ts +50 -14
  62. package/types/Pagination/index.d.ts.map +1 -1
  63. package/types/Pagination/props.d.ts +13 -3
  64. package/types/Pagination/props.d.ts.map +1 -1
  65. package/LICENSE.md +0 -27
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaginationPageInputLocator.d.ts","sourceRoot":"","sources":["../../../src/Pagination/PaginationPageInput/PaginationPageInputLocator.ts"],"names":[],"mappings":"AA+BA,eAAO,MAAM,0BAA0B;;6BAKd,GAAG,EAAE;yCAEO,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAFjB,GAAG,EAAE;yCAEO,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAFjB,GAAG,EAAE;yCAEO,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAFjB,GAAG,EAAE;yCAEO,GAAG,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6BAFjB,GAAG,EAAE;yCAEO,GAAG,EAAE;;qKAGzC,CAAA"}
@@ -0,0 +1,63 @@
1
+ /** @jsx jsx */
2
+ import React, { Component } from 'react';
3
+ import { jsx } from '@instructure/emotion';
4
+ import type { PaginationPageInputProps, PaginationPageInputState } from './props';
5
+ /**
6
+ ---
7
+ parent: Pagination
8
+ id: Pagination.PageInput
9
+ ---
10
+ @tsProps
11
+ **/
12
+ declare class PaginationPageInput extends Component<PaginationPageInputProps, PaginationPageInputState> {
13
+ static readonly componentId = "Pagination.PageInput";
14
+ static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
15
+ numberOfPages: number;
16
+ currentPageIndex: number;
17
+ onChange: (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement, MouseEvent> | React.FocusEvent<HTMLInputElement, Element>, pageIndex: number) => void;
18
+ screenReaderLabel: (currentPage: number, numberOfPages: number) => string;
19
+ label?: ((numberOfPages: number) => React.ReactNode) | undefined;
20
+ disabled?: boolean | undefined;
21
+ inputRef?: ((element: Element | null) => void) | undefined;
22
+ }>;
23
+ static allowedProps: readonly (keyof {
24
+ numberOfPages: number;
25
+ currentPageIndex: number;
26
+ onChange: (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement, MouseEvent> | React.FocusEvent<HTMLInputElement, Element>, pageIndex: number) => void;
27
+ screenReaderLabel: (currentPage: number, numberOfPages: number) => string;
28
+ label?: ((numberOfPages: number) => React.ReactNode) | undefined;
29
+ disabled?: boolean | undefined;
30
+ inputRef?: ((element: Element | null) => void) | undefined;
31
+ })[];
32
+ static defaultProps: {
33
+ disabled: boolean;
34
+ };
35
+ ref: HTMLSpanElement | null;
36
+ _inputRef: HTMLInputElement | null;
37
+ constructor(props: PaginationPageInputProps);
38
+ get currentPage(): number;
39
+ get initialState(): {
40
+ number: number;
41
+ value: string;
42
+ };
43
+ get MIN(): number;
44
+ get MAX(): number;
45
+ componentDidMount(): void;
46
+ componentDidUpdate(prevProps: PaginationPageInputProps): void;
47
+ resetInitialState(): void;
48
+ handleRef: (el: HTMLSpanElement | null) => void;
49
+ handleInputRef: (el: HTMLInputElement | null) => void;
50
+ handleChange: (_event: React.ChangeEvent<HTMLInputElement>, value: string) => void;
51
+ handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>): void;
52
+ handleDecrement: (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement>) => void;
53
+ handleIncrement: (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement>) => void;
54
+ handleBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
55
+ getNumberWithinRange(n: number): number;
56
+ setNewPage(event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement> | React.FocusEvent<HTMLInputElement>, n: number): void;
57
+ renderLabel(): jsx.JSX.Element | null;
58
+ renderScreenReaderLabel(): jsx.JSX.Element;
59
+ render(): jsx.JSX.Element;
60
+ }
61
+ export default PaginationPageInput;
62
+ export { PaginationPageInput };
63
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Pagination/PaginationPageInput/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AAEf,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGxC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAQrD,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,SAAS,CAAA;AAEhB;;;;;;GAMG;AACH,cAEM,mBAAoB,SAAQ,SAAS,CACzC,wBAAwB,EACxB,wBAAwB,CACzB;IACC,MAAM,CAAC,QAAQ,CAAC,WAAW,0BAAyB;IAEpD,MAAM,CAAC,SAAS;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;MAElB;IAED,GAAG,EAAE,eAAe,GAAG,IAAI,CAAO;IAClC,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAO;gBAE7B,KAAK,EAAE,wBAAwB;IAM3C,IAAI,WAAW,WAEd;IAED,IAAI,YAAY;;;MAKf;IAED,IAAI,GAAG,WAEN;IAED,IAAI,GAAG,WAEN;IAED,iBAAiB;IAIjB,kBAAkB,CAAC,SAAS,EAAE,wBAAwB;IAUtD,iBAAiB;IAIjB,SAAS,OAAQ,eAAe,GAAG,IAAI,UAEtC;IAED,cAAc,OAAQ,gBAAgB,GAAG,IAAI,UAM5C;IAED,YAAY,WACF,MAAM,WAAW,CAAC,gBAAgB,CAAC,SACpC,MAAM,UAad;IAED,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC;IAgB1D,eAAe,UAET,mBAAmB,CAAC,gBAAgB,CAAC,GACrC,gBAAgB,CAAC,iBAAiB,CAAC,UAGxC;IAED,eAAe,UAET,mBAAmB,CAAC,gBAAgB,CAAC,GACrC,gBAAgB,CAAC,iBAAiB,CAAC,UAGxC;IAED,UAAU,UAAW,gBAAgB,CAAC,gBAAgB,CAAC,UAEtD;IAED,oBAAoB,CAAC,CAAC,EAAE,MAAM;IAM9B,UAAU,CACR,KAAK,EACD,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,GACrC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GACnC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,EACtC,CAAC,EAAE,MAAM;IAYX,WAAW;IAQX,uBAAuB;IASvB,MAAM;CAyBP;AAED,eAAe,mBAAmB,CAAA;AAClC,OAAO,EAAE,mBAAmB,EAAE,CAAA"}
@@ -0,0 +1,46 @@
1
+ import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
2
+ import type { PaginationPageInputTheme, PropValidators } from '@instructure/shared-types';
3
+ import React from 'react';
4
+ declare type PaginationPageInputOwnProps = {
5
+ /**
6
+ * The number of pages in total
7
+ */
8
+ numberOfPages: number;
9
+ /**
10
+ * The index of the current page
11
+ */
12
+ currentPageIndex: number;
13
+ /**
14
+ * Fires when a new page index is selected
15
+ */
16
+ onChange: (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement> | React.FocusEvent<HTMLInputElement>, pageIndex: number) => void;
17
+ /**
18
+ * ScreenReaderLabel for number input
19
+ */
20
+ screenReaderLabel: (currentPage: number, numberOfPages: number) => string;
21
+ /**
22
+ * Label for number input
23
+ */
24
+ label?: (numberOfPages: number) => React.ReactNode;
25
+ /**
26
+ * Disables interaction with the input
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * provides a reference to the underlying html root element
31
+ */
32
+ inputRef?: (element: Element | null) => void;
33
+ };
34
+ declare type PropKeys = keyof PaginationPageInputOwnProps;
35
+ declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
36
+ declare type PaginationPageInputProps = PaginationPageInputOwnProps & WithStyleProps<PaginationPageInputTheme, PaginationPageInputStyle>;
37
+ declare type PaginationPageInputStyle = ComponentStyle<'paginationPageInput' | 'numberInput' | 'inputLabel'>;
38
+ declare type PaginationPageInputState = {
39
+ number: number;
40
+ value: string;
41
+ };
42
+ declare const propTypes: PropValidators<PropKeys>;
43
+ declare const allowedProps: AllowedPropKeys;
44
+ export type { PaginationPageInputProps, PaginationPageInputStyle, PaginationPageInputState };
45
+ export { propTypes, allowedProps };
46
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../src/Pagination/PaginationPageInput/props.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,KAAK,EACV,wBAAwB,EACxB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,aAAK,2BAA2B,GAAG;IACjC;;OAEG;IACH,aAAa,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,QAAQ,EAAE,CACR,KAAK,EACD,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,GACrC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GACnC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,EACtC,SAAS,EAAE,MAAM,KACd,IAAI,CAAA;IACT;;OAEG;IACH,iBAAiB,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,MAAM,CAAA;IACzE;;OAEG;IACH,KAAK,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAA;IAClD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,CAAA;CAC7C,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,2BAA2B,CAAA;AAEjD,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,wBAAwB,GAAG,2BAA2B,GACzD,cAAc,CAAC,wBAAwB,EAAE,wBAAwB,CAAC,CAAA;AAEpE,aAAK,wBAAwB,GAAG,cAAc,CAC5C,qBAAqB,GAAG,aAAa,GAAG,YAAY,CACrD,CAAA;AAED,aAAK,wBAAwB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAQvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAQnB,CAAA;AAED,YAAY,EACV,wBAAwB,EACxB,wBAAwB,EACxB,wBAAwB,EACzB,CAAA;AACD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { PaginationPageInputTheme } from '@instructure/shared-types';
2
+ import type { PaginationPageInputStyle } from './props';
3
+ /**
4
+ * ---
5
+ * private: true
6
+ * ---
7
+ * Generates the style object from the theme and provided additional information
8
+ * @param {Object} componentTheme The theme variable object.
9
+ * @param {Object} props the props of the component, the style is applied to
10
+ * @param {Object} state the state of the component, the style is applied to
11
+ * @return {Object} The final style object, which will be used in the component
12
+ */
13
+ declare const generateStyle: (componentTheme: PaginationPageInputTheme) => PaginationPageInputStyle;
14
+ export default generateStyle;
15
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/Pagination/PaginationPageInput/styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAEvD;;;;;;;;;GASG;AACH,QAAA,MAAM,aAAa,mBACD,wBAAwB,KACvC,wBAkBF,CAAA;AAED,eAAe,aAAa,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { Theme } from '@instructure/ui-themes';
2
+ import type { PaginationPageInputTheme } from '@instructure/shared-types';
3
+ /**
4
+ * Generates the theme object for the component from the theme and provided additional information
5
+ * @param {Object} theme The actual theme object.
6
+ * @return {Object} The final theme object with the overrides and component variables
7
+ */
8
+ declare const generateComponentTheme: (theme: Theme) => PaginationPageInputTheme;
9
+ export default generateComponentTheme;
10
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/Pagination/PaginationPageInput/theme.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEzE;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,UAAW,KAAK,KAAG,wBAW9C,CAAA;AAED,eAAe,sBAAsB,CAAA"}
@@ -3,7 +3,15 @@ import React, { Component } from 'react';
3
3
  import { jsx } from '@instructure/emotion';
4
4
  import { PaginationButton } from './PaginationButton';
5
5
  import { PaginationArrowButton } from './PaginationArrowButton';
6
- import type { PaginationProps } from './props';
6
+ import type { PaginationPageProps } from './PaginationButton/props';
7
+ import type { PaginationArrowDirections } from './PaginationArrowButton/props';
8
+ import type { PaginationProps, PaginationSnapshot } from './props';
9
+ declare type ArrowConfig = {
10
+ pageIndex: number;
11
+ label: string;
12
+ shouldEnableIcon: boolean;
13
+ handleButtonRef: (el: HTMLButtonElement) => void;
14
+ };
7
15
  /**
8
16
  ---
9
17
  category: components
@@ -12,24 +20,36 @@ category: components
12
20
  declare class Pagination extends Component<PaginationProps> {
13
21
  static readonly componentId = "Pagination";
14
22
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
15
- children?: React.ReactNode;
23
+ children?: React.ReactElement<PaginationPageProps, string | React.JSXElementConstructor<any>> | React.ReactElement<PaginationPageProps, string | React.JSXElementConstructor<any>>[] | undefined;
16
24
  disabled?: boolean | undefined;
25
+ withFirstAndLastButton?: boolean | undefined;
26
+ showDisabledButtons?: boolean | undefined;
17
27
  label?: React.ReactNode;
18
28
  labelNext?: string | undefined;
19
29
  labelPrev?: string | undefined;
20
- variant?: "full" | "compact" | undefined;
30
+ labelFirst?: string | undefined;
31
+ labelLast?: string | undefined;
32
+ labelNumberInput?: ((numberOfPages: number) => React.ReactNode) | undefined;
33
+ screenReaderLabelNumberInput?: ((currentPage: number, numberOfPages: number) => string) | undefined;
34
+ variant?: "input" | "compact" | "full" | undefined;
21
35
  margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
22
36
  as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
23
37
  elementRef?: ((element: Element | null) => void) | undefined;
24
38
  shouldHandleFocus?: boolean | undefined;
25
39
  }>;
26
40
  static allowedProps: readonly (keyof {
27
- children?: React.ReactNode;
41
+ children?: React.ReactElement<PaginationPageProps, string | React.JSXElementConstructor<any>> | React.ReactElement<PaginationPageProps, string | React.JSXElementConstructor<any>>[] | undefined;
28
42
  disabled?: boolean | undefined;
43
+ withFirstAndLastButton?: boolean | undefined;
44
+ showDisabledButtons?: boolean | undefined;
29
45
  label?: React.ReactNode;
30
46
  labelNext?: string | undefined;
31
47
  labelPrev?: string | undefined;
32
- variant?: "full" | "compact" | undefined;
48
+ labelFirst?: string | undefined;
49
+ labelLast?: string | undefined;
50
+ labelNumberInput?: ((numberOfPages: number) => React.ReactNode) | undefined;
51
+ screenReaderLabelNumberInput?: ((currentPage: number, numberOfPages: number) => string) | undefined;
52
+ variant?: "input" | "compact" | "full" | undefined;
33
53
  margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
34
54
  as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
35
55
  elementRef?: ((element: Element | null) => void) | undefined;
@@ -38,28 +58,44 @@ declare class Pagination extends Component<PaginationProps> {
38
58
  static defaultProps: {
39
59
  children: null;
40
60
  disabled: boolean;
61
+ withFirstAndLastButton: boolean;
62
+ showDisabledButtons: boolean;
41
63
  variant: string;
42
64
  as: string;
43
65
  elementRef: (el: any) => void;
66
+ labelNumberInput: (numberOfPages: number) => string;
67
+ screenReaderLabelNumberInput: (currentPage: number, numberOfPages: number) => string;
44
68
  shouldHandleFocus: boolean;
45
69
  };
46
70
  static Page: typeof PaginationButton;
47
71
  static Navigation: typeof PaginationArrowButton;
72
+ _labelId: string;
48
73
  ref: Element | null;
74
+ _inputRef: Element | null;
75
+ _firstButton: HTMLButtonElement | null;
76
+ _prevButton: HTMLButtonElement | null;
77
+ _nextButton: HTMLButtonElement | null;
78
+ _lastButton: HTMLButtonElement | null;
49
79
  constructor(...args: any[]);
50
80
  get _root(): Element | null;
51
- getSnapshotBeforeUpdate(): {
52
- prevButtonFocused: boolean;
53
- nextButtonFocused: boolean;
54
- };
81
+ get inputMode(): boolean;
82
+ get childPages(): React.ReactElement<PaginationPageProps, string | React.JSXElementConstructor<any>>[];
83
+ get withFirstAndLastButton(): boolean | undefined;
84
+ get showDisabledButtons(): boolean | undefined;
85
+ getSnapshotBeforeUpdate(): PaginationSnapshot;
55
86
  componentDidMount(): void;
56
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
87
+ componentDidUpdate(prevProps: PaginationProps, _prevState: unknown, snapshot: PaginationSnapshot): void;
88
+ focusElementAfterUpdate(snapshot: PaginationSnapshot): void;
57
89
  get compactView(): boolean;
58
- transferDisabledPropToChildren(children: any): any;
59
- handleElementRef: (el: any) => void;
90
+ transferDisabledPropToChildren(children: PaginationProps['children']): React.ReactElement<PaginationPageProps, string | React.JSXElementConstructor<any>> | React.ReactElement<PaginationPageProps, string | React.JSXElementConstructor<any>>[] | undefined;
91
+ handleElementRef: (el: Element | null) => void;
92
+ handleInputRef: (el: Element | null) => void;
60
93
  renderLabel(): jsx.JSX.Element;
61
- renderPages(currentPageIndex: any): jsx.JSX.Element;
62
- renderArrowButton(label: any, direction: any, currentPageIndex: any): jsx.JSX.Element;
94
+ renderPageInput(currentPageIndex: number): jsx.JSX.Element;
95
+ handleInputChange(event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement> | React.FocusEvent<HTMLInputElement>, pageIndex: number): void;
96
+ renderPages(currentPageIndex: number): jsx.JSX.Element;
97
+ getArrowVariant(direction: PaginationArrowDirections, currentPageIndex: number, pagesCount: number): ArrowConfig;
98
+ renderArrowButton(direction: PaginationArrowDirections, currentPageIndex: number): jsx.JSX.Element | null;
63
99
  render(): jsx.JSX.Element | null;
64
100
  }
65
101
  export default Pagination;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Pagination/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQxC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,qBAAqB,EAAE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AAU,EAAE,OAAO,EACnB,QAAQ,EAAE,kBAAkB;IAc9B,uBAAuB,CAAC,QAAQ,EAAE,kBAAkB;IAyBpD,IAAI,WAAW,YAEd;IAED,8BAA8B,CAAC,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC;IAQpE,gBAAgB,OAAQ,OAAO,GAAG,IAAI,UAOrC;IAED,cAAc,OAAQ,OAAO,GAAG,IAAI,UAEnC;IAED,WAAW;IAgBX,eAAe,CAAC,gBAAgB,EAAE,MAAM;IAcxC,iBAAiB,CACf,KAAK,EACD,KAAK,CAAC,aAAa,CAAC,gBAAgB,CAAC,GACrC,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GACnC,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,EACtC,SAAS,EAAE,MAAM;IAKnB,WAAW,CAAC,gBAAgB,EAAE,MAAM;IA0CpC,eAAe,CACb,SAAS,EAAE,yBAAyB,EACpC,gBAAgB,EAAE,MAAM,EACxB,UAAU,EAAE,MAAM,GACjB,WAAW;IAyCd,iBAAiB,CACf,SAAS,EAAE,yBAAyB,EACpC,gBAAgB,EAAE,MAAM;IAqC1B,MAAM;CAuCP;AAED,eAAe,UAAU,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAA"}
@@ -1,13 +1,20 @@
1
1
  import React from 'react';
2
2
  import type { Spacing, WithStyleProps, ComponentStyle } from '@instructure/emotion';
3
3
  import type { AsElementType, OtherHTMLAttributes, PropValidators } from '@instructure/shared-types';
4
+ import type { PaginationPageProps } from './PaginationButton/props';
4
5
  declare type PaginationOwnProps = {
5
- children?: React.ReactNode;
6
+ children?: React.ReactElement<PaginationPageProps> | React.ReactElement<PaginationPageProps>[];
6
7
  disabled?: boolean;
8
+ withFirstAndLastButton?: boolean;
9
+ showDisabledButtons?: boolean;
7
10
  label?: React.ReactNode;
8
11
  labelNext?: string;
9
12
  labelPrev?: string;
10
- variant?: 'full' | 'compact';
13
+ labelFirst?: string;
14
+ labelLast?: string;
15
+ labelNumberInput?: (numberOfPages: number) => React.ReactNode;
16
+ screenReaderLabelNumberInput?: (currentPage: number, numberOfPages: number) => string;
17
+ variant?: 'full' | 'compact' | 'input';
11
18
  margin?: Spacing;
12
19
  as?: AsElementType;
13
20
  elementRef?: (element: Element | null) => void;
@@ -19,6 +26,9 @@ declare type PaginationProps = PaginationOwnProps & WithStyleProps<null, Paginat
19
26
  declare type PaginationStyle = ComponentStyle<'pagination' | 'pages'>;
20
27
  declare const propTypes: PropValidators<PropKeys>;
21
28
  declare const allowedProps: AllowedPropKeys;
22
- export type { PaginationProps, PaginationStyle };
29
+ declare type PaginationSnapshot = {
30
+ lastFocusedButton?: HTMLButtonElement;
31
+ };
32
+ export type { PaginationProps, PaginationStyle, PaginationSnapshot };
23
33
  export { propTypes, allowedProps };
24
34
  //# sourceMappingURL=props.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Pagination/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAA;AAC7B,OAAO,KAAK,EACV,aAAa,EACb,mBAAmB,EACnB,cAAc,EACf,MAAM,2BAA2B,CAAA;AAElC,aAAK,kBAAkB,GAAG;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,EAAE,CAAC,EAAE,aAAa,CAAA;IAClB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,GAA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License (MIT)
3
- category: Getting Started
4
- order: 9
5
- ---
6
-
7
- # The MIT License (MIT)
8
-
9
- Copyright (c) 2015 Instructure, Inc.
10
-
11
- **Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions.**
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.