@instructure/ui-pagination 11.6.0 → 11.6.1-snapshot-129
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 +42 -296
- package/es/Pagination/{PaginationArrowButton → v1/PaginationArrowButton}/index.js +2 -2
- package/es/Pagination/{PaginationButton → v1/PaginationButton}/index.js +1 -1
- package/es/Pagination/{PaginationPageInput → v1/PaginationPageInput}/index.js +1 -1
- package/es/Pagination/{index.js → v1/index.js} +1 -1
- package/es/Pagination/v2/PaginationArrowButton/index.js +109 -0
- package/es/Pagination/v2/PaginationArrowButton/props.js +30 -0
- package/es/Pagination/v2/PaginationButton/index.js +77 -0
- package/es/Pagination/v2/PaginationButton/props.js +29 -0
- package/es/Pagination/v2/PaginationPageInput/index.js +189 -0
- package/es/Pagination/v2/PaginationPageInput/props.js +26 -0
- package/es/Pagination/v2/PaginationPageInput/styles.js +56 -0
- package/es/Pagination/v2/index.js +481 -0
- package/es/Pagination/v2/props.js +26 -0
- package/es/Pagination/v2/styles.js +58 -0
- package/es/{index.js → exports/a.js} +1 -1
- package/es/exports/b.js +24 -0
- package/lib/Pagination/{PaginationArrowButton → v1/PaginationArrowButton}/index.js +8 -8
- package/lib/Pagination/{PaginationButton → v1/PaginationButton}/index.js +2 -2
- package/lib/Pagination/{PaginationPageInput → v1/PaginationPageInput}/index.js +2 -2
- package/lib/Pagination/{index.js → v1/index.js} +6 -6
- package/lib/Pagination/v2/PaginationArrowButton/index.js +115 -0
- package/lib/Pagination/v2/PaginationArrowButton/props.js +35 -0
- package/lib/Pagination/v2/PaginationButton/index.js +83 -0
- package/lib/Pagination/v2/PaginationButton/props.js +34 -0
- package/lib/Pagination/v2/PaginationPageInput/index.js +194 -0
- package/lib/Pagination/v2/PaginationPageInput/props.js +31 -0
- package/lib/Pagination/v2/PaginationPageInput/styles.js +62 -0
- package/lib/Pagination/v2/index.js +496 -0
- package/lib/Pagination/v2/props.js +31 -0
- package/lib/Pagination/v2/styles.js +64 -0
- package/lib/{index.js → exports/a.js} +3 -3
- package/lib/exports/b.js +18 -0
- package/package.json +48 -25
- package/src/Pagination/{PaginationArrowButton → v1/PaginationArrowButton}/index.tsx +2 -2
- package/src/Pagination/{PaginationArrowButton → v1/PaginationArrowButton}/props.ts +1 -1
- package/src/Pagination/{PaginationButton → v1/PaginationButton}/index.tsx +1 -1
- package/src/Pagination/{PaginationButton → v1/PaginationButton}/props.ts +1 -1
- package/src/Pagination/{PaginationPageInput → v1/PaginationPageInput}/index.tsx +1 -1
- package/src/Pagination/{index.tsx → v1/index.tsx} +1 -1
- package/src/Pagination/v2/PaginationArrowButton/index.tsx +120 -0
- package/src/Pagination/v2/PaginationArrowButton/props.ts +74 -0
- package/src/Pagination/v2/PaginationButton/index.tsx +82 -0
- package/src/Pagination/v2/PaginationButton/props.ts +77 -0
- package/src/Pagination/v2/PaginationPageInput/index.tsx +242 -0
- package/src/Pagination/v2/PaginationPageInput/props.ts +95 -0
- package/src/Pagination/v2/PaginationPageInput/styles.ts +62 -0
- package/src/Pagination/v2/README.md +417 -0
- package/src/Pagination/v2/index.tsx +665 -0
- package/src/Pagination/v2/props.ts +245 -0
- package/src/Pagination/v2/styles.ts +64 -0
- package/src/exports/a.ts +29 -0
- package/src/exports/b.ts +29 -0
- package/tsconfig.build.json +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Pagination/v1/PaginationArrowButton/index.d.ts.map +1 -0
- package/types/Pagination/{PaginationArrowButton → v1/PaginationArrowButton}/props.d.ts +1 -1
- package/types/Pagination/v1/PaginationArrowButton/props.d.ts.map +1 -0
- package/types/Pagination/v1/PaginationButton/index.d.ts.map +1 -0
- package/types/Pagination/{PaginationButton → v1/PaginationButton}/props.d.ts +1 -1
- package/types/Pagination/v1/PaginationButton/props.d.ts.map +1 -0
- package/types/Pagination/v1/PaginationPageInput/index.d.ts.map +1 -0
- package/types/Pagination/v1/PaginationPageInput/props.d.ts.map +1 -0
- package/types/Pagination/v1/PaginationPageInput/styles.d.ts.map +1 -0
- package/types/Pagination/v1/PaginationPageInput/theme.d.ts.map +1 -0
- package/types/Pagination/v1/index.d.ts.map +1 -0
- package/types/Pagination/v1/props.d.ts.map +1 -0
- package/types/Pagination/v1/styles.d.ts.map +1 -0
- package/types/Pagination/v1/theme.d.ts.map +1 -0
- package/types/Pagination/v2/PaginationArrowButton/index.d.ts +27 -0
- package/types/Pagination/v2/PaginationArrowButton/index.d.ts.map +1 -0
- package/types/Pagination/v2/PaginationArrowButton/props.d.ts +17 -0
- package/types/Pagination/v2/PaginationArrowButton/props.d.ts.map +1 -0
- package/types/Pagination/v2/PaginationButton/index.d.ts +26 -0
- package/types/Pagination/v2/PaginationButton/index.d.ts.map +1 -0
- package/types/Pagination/v2/PaginationButton/props.d.ts +30 -0
- package/types/Pagination/v2/PaginationButton/props.d.ts.map +1 -0
- package/types/Pagination/v2/PaginationPageInput/index.d.ts +50 -0
- package/types/Pagination/v2/PaginationPageInput/index.d.ts.map +1 -0
- package/types/Pagination/v2/PaginationPageInput/props.d.ts +45 -0
- package/types/Pagination/v2/PaginationPageInput/props.d.ts.map +1 -0
- package/types/Pagination/v2/PaginationPageInput/styles.d.ts +16 -0
- package/types/Pagination/v2/PaginationPageInput/styles.d.ts.map +1 -0
- package/types/Pagination/v2/index.d.ts +106 -0
- package/types/Pagination/v2/index.d.ts.map +1 -0
- package/types/Pagination/v2/props.d.ts +138 -0
- package/types/Pagination/v2/props.d.ts.map +1 -0
- package/types/Pagination/v2/styles.d.ts +16 -0
- package/types/Pagination/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +5 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +5 -0
- package/types/exports/b.d.ts.map +1 -0
- package/src/index.ts +0 -29
- package/types/Pagination/PaginationArrowButton/index.d.ts.map +0 -1
- package/types/Pagination/PaginationArrowButton/props.d.ts.map +0 -1
- package/types/Pagination/PaginationButton/index.d.ts.map +0 -1
- package/types/Pagination/PaginationButton/props.d.ts.map +0 -1
- package/types/Pagination/PaginationPageInput/index.d.ts.map +0 -1
- package/types/Pagination/PaginationPageInput/props.d.ts.map +0 -1
- package/types/Pagination/PaginationPageInput/styles.d.ts.map +0 -1
- package/types/Pagination/PaginationPageInput/theme.d.ts.map +0 -1
- package/types/Pagination/index.d.ts.map +0 -1
- package/types/Pagination/props.d.ts.map +0 -1
- package/types/Pagination/styles.d.ts.map +0 -1
- package/types/Pagination/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -5
- package/types/index.d.ts.map +0 -1
- /package/es/Pagination/{PaginationArrowButton → v1/PaginationArrowButton}/props.js +0 -0
- /package/es/Pagination/{PaginationButton → v1/PaginationButton}/props.js +0 -0
- /package/es/Pagination/{PaginationPageInput → v1/PaginationPageInput}/props.js +0 -0
- /package/es/Pagination/{PaginationPageInput → v1/PaginationPageInput}/styles.js +0 -0
- /package/es/Pagination/{PaginationPageInput → v1/PaginationPageInput}/theme.js +0 -0
- /package/es/Pagination/{props.js → v1/props.js} +0 -0
- /package/es/Pagination/{styles.js → v1/styles.js} +0 -0
- /package/es/Pagination/{theme.js → v1/theme.js} +0 -0
- /package/lib/Pagination/{PaginationArrowButton → v1/PaginationArrowButton}/props.js +0 -0
- /package/lib/Pagination/{PaginationButton → v1/PaginationButton}/props.js +0 -0
- /package/lib/Pagination/{PaginationPageInput → v1/PaginationPageInput}/props.js +0 -0
- /package/lib/Pagination/{PaginationPageInput → v1/PaginationPageInput}/styles.js +0 -0
- /package/lib/Pagination/{PaginationPageInput → v1/PaginationPageInput}/theme.js +0 -0
- /package/lib/Pagination/{props.js → v1/props.js} +0 -0
- /package/lib/Pagination/{styles.js → v1/styles.js} +0 -0
- /package/lib/Pagination/{theme.js → v1/theme.js} +0 -0
- /package/src/Pagination/{PaginationPageInput → v1/PaginationPageInput}/props.ts +0 -0
- /package/src/Pagination/{PaginationPageInput → v1/PaginationPageInput}/styles.ts +0 -0
- /package/src/Pagination/{PaginationPageInput → v1/PaginationPageInput}/theme.ts +0 -0
- /package/src/Pagination/{README.md → v1/README.md} +0 -0
- /package/src/Pagination/{props.ts → v1/props.ts} +0 -0
- /package/src/Pagination/{styles.ts → v1/styles.ts} +0 -0
- /package/src/Pagination/{theme.ts → v1/theme.ts} +0 -0
- /package/types/Pagination/{PaginationArrowButton → v1/PaginationArrowButton}/index.d.ts +0 -0
- /package/types/Pagination/{PaginationButton → v1/PaginationButton}/index.d.ts +0 -0
- /package/types/Pagination/{PaginationPageInput → v1/PaginationPageInput}/index.d.ts +0 -0
- /package/types/Pagination/{PaginationPageInput → v1/PaginationPageInput}/props.d.ts +0 -0
- /package/types/Pagination/{PaginationPageInput → v1/PaginationPageInput}/styles.d.ts +0 -0
- /package/types/Pagination/{PaginationPageInput → v1/PaginationPageInput}/theme.d.ts +0 -0
- /package/types/Pagination/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/Pagination/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/Pagination/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/Pagination/{theme.d.ts → v1/theme.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-pagination",
|
|
3
|
-
"version": "11.6.
|
|
3
|
+
"version": "11.6.1-snapshot-129",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,29 +15,30 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.27.6",
|
|
18
|
-
"@instructure/
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/ui-
|
|
21
|
-
"@instructure/
|
|
22
|
-
"@instructure/ui-
|
|
23
|
-
"@instructure/ui-
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-portal": "11.6.
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-tooltip": "11.6.
|
|
30
|
-
"@instructure/ui-
|
|
31
|
-
"@instructure/
|
|
32
|
-
"@instructure/ui-view": "11.6.
|
|
18
|
+
"@instructure/emotion": "11.6.1-snapshot-129",
|
|
19
|
+
"@instructure/ui-a11y-content": "11.6.1-snapshot-129",
|
|
20
|
+
"@instructure/ui-buttons": "11.6.1-snapshot-129",
|
|
21
|
+
"@instructure/shared-types": "11.6.1-snapshot-129",
|
|
22
|
+
"@instructure/ui-a11y-utils": "11.6.1-snapshot-129",
|
|
23
|
+
"@instructure/ui-dom-utils": "11.6.1-snapshot-129",
|
|
24
|
+
"@instructure/ui-icons": "11.6.1-snapshot-129",
|
|
25
|
+
"@instructure/ui-portal": "11.6.1-snapshot-129",
|
|
26
|
+
"@instructure/ui-number-input": "11.6.1-snapshot-129",
|
|
27
|
+
"@instructure/ui-react-utils": "11.6.1-snapshot-129",
|
|
28
|
+
"@instructure/ui-text": "11.6.1-snapshot-129",
|
|
29
|
+
"@instructure/ui-tooltip": "11.6.1-snapshot-129",
|
|
30
|
+
"@instructure/ui-themes": "11.6.1-snapshot-129",
|
|
31
|
+
"@instructure/ui-utils": "11.6.1-snapshot-129",
|
|
32
|
+
"@instructure/ui-view": "11.6.1-snapshot-129",
|
|
33
|
+
"@instructure/uid": "11.6.1-snapshot-129"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@testing-library/jest-dom": "^6.6.3",
|
|
36
37
|
"@testing-library/react": "15.0.7",
|
|
37
38
|
"@testing-library/user-event": "^14.6.1",
|
|
38
39
|
"vitest": "^3.2.2",
|
|
39
|
-
"@instructure/ui-axe-check": "11.6.
|
|
40
|
-
"@instructure/ui-babel-preset": "11.6.
|
|
40
|
+
"@instructure/ui-axe-check": "11.6.1-snapshot-129",
|
|
41
|
+
"@instructure/ui-babel-preset": "11.6.1-snapshot-129"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
43
44
|
"react": ">=18 <=19"
|
|
@@ -47,17 +48,39 @@
|
|
|
47
48
|
},
|
|
48
49
|
"sideEffects": false,
|
|
49
50
|
"exports": {
|
|
50
|
-
".": {
|
|
51
|
-
"types": "./types/index.d.ts",
|
|
52
|
-
"import": "./es/index.js",
|
|
53
|
-
"require": "./lib/index.js",
|
|
54
|
-
"default": "./es/index.js"
|
|
55
|
-
},
|
|
56
51
|
"./lib/*": "./lib/*",
|
|
57
52
|
"./es/*": "./es/*",
|
|
58
53
|
"./types/*": "./types/*",
|
|
59
54
|
"./package.json": "./package.json",
|
|
60
|
-
"./src/*": "./src/*"
|
|
55
|
+
"./src/*": "./src/*",
|
|
56
|
+
".": {
|
|
57
|
+
"src": "./src/exports/a.ts",
|
|
58
|
+
"types": "./types/exports/a.d.ts",
|
|
59
|
+
"import": "./es/exports/a.js",
|
|
60
|
+
"require": "./lib/exports/a.js",
|
|
61
|
+
"default": "./es/exports/a.js"
|
|
62
|
+
},
|
|
63
|
+
"./v11_6": {
|
|
64
|
+
"src": "./src/exports/a.ts",
|
|
65
|
+
"types": "./types/exports/a.d.ts",
|
|
66
|
+
"import": "./es/exports/a.js",
|
|
67
|
+
"require": "./lib/exports/a.js",
|
|
68
|
+
"default": "./es/exports/a.js"
|
|
69
|
+
},
|
|
70
|
+
"./v11_7": {
|
|
71
|
+
"src": "./src/exports/b.ts",
|
|
72
|
+
"types": "./types/exports/b.d.ts",
|
|
73
|
+
"import": "./es/exports/b.js",
|
|
74
|
+
"require": "./lib/exports/b.js",
|
|
75
|
+
"default": "./es/exports/b.js"
|
|
76
|
+
},
|
|
77
|
+
"./latest": {
|
|
78
|
+
"src": "./src/exports/b.ts",
|
|
79
|
+
"types": "./types/exports/b.d.ts",
|
|
80
|
+
"import": "./es/exports/b.js",
|
|
81
|
+
"require": "./lib/exports/b.js",
|
|
82
|
+
"default": "./es/exports/b.js"
|
|
83
|
+
}
|
|
61
84
|
},
|
|
62
85
|
"scripts": {
|
|
63
86
|
"lint": "ui-scripts lint",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
|
-
import { IconButton } from '@instructure/ui-buttons'
|
|
27
|
+
import { IconButton } from '@instructure/ui-buttons/v11_6'
|
|
28
28
|
import { PresentationContent } from '@instructure/ui-a11y-content'
|
|
29
|
-
import { Tooltip } from '@instructure/ui-tooltip'
|
|
29
|
+
import { Tooltip } from '@instructure/ui-tooltip/v11_6'
|
|
30
30
|
import {
|
|
31
31
|
IconArrowOpenStartSolid,
|
|
32
32
|
IconArrowOpenEndSolid,
|
|
@@ -27,7 +27,7 @@ import type {
|
|
|
27
27
|
OtherHTMLAttributes,
|
|
28
28
|
PickPropsWithExceptions
|
|
29
29
|
} from '@instructure/shared-types'
|
|
30
|
-
import type { IconButtonProps } from '@instructure/ui-buttons'
|
|
30
|
+
import type { IconButtonProps } from '@instructure/ui-buttons/v11_6'
|
|
31
31
|
|
|
32
32
|
type PaginationArrowDirections = 'first' | 'prev' | 'next' | 'last'
|
|
33
33
|
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
|
-
import { BaseButton } from '@instructure/ui-buttons'
|
|
27
|
+
import { BaseButton } from '@instructure/ui-buttons/v11_6'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
29
|
|
|
30
30
|
import { allowedProps } from './props'
|
|
@@ -27,7 +27,7 @@ import type {
|
|
|
27
27
|
OtherHTMLAttributes,
|
|
28
28
|
PickPropsWithExceptions
|
|
29
29
|
} from '@instructure/shared-types'
|
|
30
|
-
import type { BaseButtonProps } from '@instructure/ui-buttons'
|
|
30
|
+
import type { BaseButtonProps } from '@instructure/ui-buttons/v11_6'
|
|
31
31
|
|
|
32
32
|
type PaginationPageOwnProps = {
|
|
33
33
|
/**
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
|
-
import { NumberInput } from '@instructure/ui-number-input'
|
|
28
|
+
import { NumberInput } from '@instructure/ui-number-input/v11_6'
|
|
29
29
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content'
|
|
30
30
|
|
|
31
31
|
import generateStyle from './styles'
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
ReactNode
|
|
30
30
|
} from 'react'
|
|
31
31
|
|
|
32
|
-
import { View } from '@instructure/ui-view'
|
|
32
|
+
import { View } from '@instructure/ui-view/v11_6'
|
|
33
33
|
import { omitProps, withDeterministicId } from '@instructure/ui-react-utils'
|
|
34
34
|
import { hasVisibleChildren } from '@instructure/ui-a11y-utils'
|
|
35
35
|
import { findTabbable, getActiveElement } from '@instructure/ui-dom-utils'
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { Component } from 'react'
|
|
26
|
+
|
|
27
|
+
import { IconButton } from '@instructure/ui-buttons/latest'
|
|
28
|
+
import { PresentationContent } from '@instructure/ui-a11y-content'
|
|
29
|
+
import { Tooltip } from '@instructure/ui-tooltip/latest'
|
|
30
|
+
import {
|
|
31
|
+
ChevronLeftInstUIIcon,
|
|
32
|
+
ChevronRightInstUIIcon,
|
|
33
|
+
ChevronsLeftInstUIIcon,
|
|
34
|
+
ChevronsRightInstUIIcon,
|
|
35
|
+
renderIconWithProps
|
|
36
|
+
} from '@instructure/ui-icons'
|
|
37
|
+
|
|
38
|
+
import type { PaginationNavigationProps } from './props'
|
|
39
|
+
import { allowedProps } from './props'
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
---
|
|
43
|
+
parent: Pagination
|
|
44
|
+
id: Pagination.Navigation
|
|
45
|
+
---
|
|
46
|
+
**/
|
|
47
|
+
class PaginationArrowButton extends Component<PaginationNavigationProps> {
|
|
48
|
+
static readonly componentId = 'Pagination.Navigation'
|
|
49
|
+
|
|
50
|
+
static allowedProps = allowedProps
|
|
51
|
+
|
|
52
|
+
static defaultProps = {}
|
|
53
|
+
|
|
54
|
+
ref: Element | null = null
|
|
55
|
+
|
|
56
|
+
handleRef = (el: Element | null) => {
|
|
57
|
+
this.ref = el
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
get margin() {
|
|
61
|
+
switch (this.props.direction) {
|
|
62
|
+
case 'first':
|
|
63
|
+
return '0 xx-small 0 0'
|
|
64
|
+
case 'last':
|
|
65
|
+
return '0 0 0 xx-small'
|
|
66
|
+
default:
|
|
67
|
+
return undefined
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get Icon() {
|
|
72
|
+
switch (this.props.direction) {
|
|
73
|
+
case 'first':
|
|
74
|
+
return ChevronsLeftInstUIIcon
|
|
75
|
+
case 'prev':
|
|
76
|
+
return ChevronLeftInstUIIcon
|
|
77
|
+
case 'next':
|
|
78
|
+
return ChevronRightInstUIIcon
|
|
79
|
+
case 'last':
|
|
80
|
+
return ChevronsRightInstUIIcon
|
|
81
|
+
default:
|
|
82
|
+
return null
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
renderIcon() {
|
|
87
|
+
const icon = this.Icon
|
|
88
|
+
if (!icon) return null
|
|
89
|
+
return renderIconWithProps(icon, 'md', 'actionTertiaryBaseColor')
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
render() {
|
|
93
|
+
const { label, direction, buttonRef, ...props } = this.props
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Tooltip
|
|
97
|
+
elementRef={this.handleRef}
|
|
98
|
+
on={['hover', 'focus']}
|
|
99
|
+
renderTip={<PresentationContent>{label}</PresentationContent>}
|
|
100
|
+
>
|
|
101
|
+
<IconButton
|
|
102
|
+
{...props}
|
|
103
|
+
size="small"
|
|
104
|
+
withBackground={false}
|
|
105
|
+
withBorder={false}
|
|
106
|
+
screenReaderLabel={label}
|
|
107
|
+
rel={props.href || props.to ? direction : undefined}
|
|
108
|
+
elementRef={buttonRef}
|
|
109
|
+
margin={this.margin}
|
|
110
|
+
data-cid="PaginationArrowButton"
|
|
111
|
+
>
|
|
112
|
+
{this.renderIcon()}
|
|
113
|
+
</IconButton>
|
|
114
|
+
</Tooltip>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default PaginationArrowButton
|
|
120
|
+
export { PaginationArrowButton }
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import type {
|
|
27
|
+
OtherHTMLAttributes,
|
|
28
|
+
PickPropsWithExceptions
|
|
29
|
+
} from '@instructure/shared-types'
|
|
30
|
+
import type { IconButtonProps } from '@instructure/ui-buttons/latest'
|
|
31
|
+
|
|
32
|
+
type PaginationArrowDirections = 'first' | 'prev' | 'next' | 'last'
|
|
33
|
+
|
|
34
|
+
type PaginationNavigationOwnProps = {
|
|
35
|
+
direction?: PaginationArrowDirections
|
|
36
|
+
label: string
|
|
37
|
+
buttonRef?: (element: Element | null) => void
|
|
38
|
+
onClick?: (
|
|
39
|
+
event:
|
|
40
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
41
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
42
|
+
| React.FocusEvent<HTMLInputElement>
|
|
43
|
+
) => void
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type PropKeys = keyof PaginationNavigationOwnProps
|
|
47
|
+
|
|
48
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
49
|
+
|
|
50
|
+
type PaginationNavigationProps =
|
|
51
|
+
// We pass almost all the props to IconButton
|
|
52
|
+
PickPropsWithExceptions<
|
|
53
|
+
IconButtonProps,
|
|
54
|
+
| 'size'
|
|
55
|
+
| 'withBackground'
|
|
56
|
+
| 'withBorder'
|
|
57
|
+
| 'screenReaderLabel'
|
|
58
|
+
| 'rel'
|
|
59
|
+
| 'elementRef'
|
|
60
|
+
| 'margin'
|
|
61
|
+
> &
|
|
62
|
+
PaginationNavigationOwnProps &
|
|
63
|
+
OtherHTMLAttributes<PaginationNavigationOwnProps>
|
|
64
|
+
const allowedProps: AllowedPropKeys = [
|
|
65
|
+
'direction',
|
|
66
|
+
'label',
|
|
67
|
+
'buttonRef'
|
|
68
|
+
|
|
69
|
+
// we don't want to pass onClick
|
|
70
|
+
// 'onClick'
|
|
71
|
+
]
|
|
72
|
+
|
|
73
|
+
export type { PaginationNavigationProps, PaginationArrowDirections }
|
|
74
|
+
export { allowedProps }
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { Component } from 'react'
|
|
26
|
+
|
|
27
|
+
import { BaseButton } from '@instructure/ui-buttons/latest'
|
|
28
|
+
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
+
|
|
30
|
+
import { allowedProps } from './props'
|
|
31
|
+
import type { PaginationPageProps } from './props'
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
---
|
|
35
|
+
parent: Pagination
|
|
36
|
+
id: Pagination.Page
|
|
37
|
+
---
|
|
38
|
+
**/
|
|
39
|
+
|
|
40
|
+
class PaginationButton extends Component<PaginationPageProps> {
|
|
41
|
+
static readonly componentId = 'Pagination.Page'
|
|
42
|
+
|
|
43
|
+
static allowedProps = allowedProps
|
|
44
|
+
static defaultProps = {
|
|
45
|
+
current: false
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ref: Element | null = null
|
|
49
|
+
|
|
50
|
+
handleRef = (el: Element | null) => {
|
|
51
|
+
this.ref = el
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
render() {
|
|
55
|
+
const exclude = this.props.current ? ['onClick', 'href'] : []
|
|
56
|
+
|
|
57
|
+
const props = omitProps(this.props, PaginationButton.allowedProps, exclude)
|
|
58
|
+
|
|
59
|
+
// wrapped in an unstyled <li> for better a11y
|
|
60
|
+
return (
|
|
61
|
+
<li style={{ all: 'unset' }}>
|
|
62
|
+
<BaseButton
|
|
63
|
+
color="primary"
|
|
64
|
+
data-cid="PaginationButton"
|
|
65
|
+
withBackground={this.props.current}
|
|
66
|
+
withBorder={this.props.current}
|
|
67
|
+
{...props}
|
|
68
|
+
aria-current={this.props.current ? 'page' : undefined}
|
|
69
|
+
elementRef={this.handleRef}
|
|
70
|
+
{...(this.props.screenReaderLabel
|
|
71
|
+
? { 'aria-label': this.props.screenReaderLabel }
|
|
72
|
+
: {})}
|
|
73
|
+
>
|
|
74
|
+
{this.props.children}
|
|
75
|
+
</BaseButton>
|
|
76
|
+
</li>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default PaginationButton
|
|
82
|
+
export { PaginationButton }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
import type {
|
|
27
|
+
OtherHTMLAttributes,
|
|
28
|
+
PickPropsWithExceptions
|
|
29
|
+
} from '@instructure/shared-types'
|
|
30
|
+
import type { BaseButtonProps } from '@instructure/ui-buttons/latest'
|
|
31
|
+
|
|
32
|
+
type PaginationPageOwnProps = {
|
|
33
|
+
/**
|
|
34
|
+
* Content to render as page selection
|
|
35
|
+
*/
|
|
36
|
+
children: React.ReactNode
|
|
37
|
+
/**
|
|
38
|
+
* Whether the page is currently displayed
|
|
39
|
+
*/
|
|
40
|
+
current?: boolean
|
|
41
|
+
/**
|
|
42
|
+
* Callback fired when the `Pagination.Page` is clicked.
|
|
43
|
+
*/
|
|
44
|
+
onClick?: (
|
|
45
|
+
event:
|
|
46
|
+
| React.KeyboardEvent<HTMLInputElement>
|
|
47
|
+
| React.MouseEvent<HTMLButtonElement>
|
|
48
|
+
| React.FocusEvent<HTMLInputElement>
|
|
49
|
+
) => void
|
|
50
|
+
/**
|
|
51
|
+
* The text screenreaders should say when this button is in focus (sets the
|
|
52
|
+
* `aria-label` attribute).
|
|
53
|
+
* If left undefined (default) SRs will announce text in the child node(s).
|
|
54
|
+
*/
|
|
55
|
+
screenReaderLabel?: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type PropKeys = keyof PaginationPageOwnProps
|
|
59
|
+
|
|
60
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
61
|
+
|
|
62
|
+
type PaginationPageProps =
|
|
63
|
+
// We pass almost all props to BaseButton
|
|
64
|
+
PickPropsWithExceptions<BaseButtonProps, 'aria-current' | 'elementRef'> &
|
|
65
|
+
PaginationPageOwnProps &
|
|
66
|
+
OtherHTMLAttributes<PaginationPageOwnProps>
|
|
67
|
+
|
|
68
|
+
const allowedProps: AllowedPropKeys = [
|
|
69
|
+
'children',
|
|
70
|
+
'current',
|
|
71
|
+
'screenReaderLabel'
|
|
72
|
+
// we don't want to pass onClick
|
|
73
|
+
// 'onClick'
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
export type { PaginationPageProps }
|
|
77
|
+
export { allowedProps }
|