@conduction/components 2.2.55 → 2.2.56
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/README.md
CHANGED
|
@@ -4,10 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
- **Version 2.2 (breaking changes from 2.1.x)**
|
|
6
6
|
|
|
7
|
+
- 2.2.56: Fixed WCAG issue in Pagination by adding aria labels to buttons
|
|
7
8
|
- 2.2.55:
|
|
8
9
|
- Updated Logo to accept aria-label for accessibility.
|
|
9
10
|
- Fixed bug in DisplaySwitch where layoutClassName is added even when empty.
|
|
10
11
|
- Fixed color of the Select dropdown icon to be WCAG-AA compliant.
|
|
12
|
+
- Added more WCAG roles and support to Select box.
|
|
11
13
|
- 2.2.54: Updated CardHeader to allow padding-block-end on title.
|
|
12
14
|
- 2.2.53: Updated Pagination and PrimaryTopNav components to allow text-decorations and border-bottoms.
|
|
13
15
|
- 2.2.52: Added hover filter to Logo component.
|
|
@@ -31,5 +31,5 @@ export const Pagination = ({ totalPages, currentPage, setCurrentPage, ariaLabels
|
|
|
31
31
|
};
|
|
32
32
|
setRoleToPresentation('ul[role*="list"][class*="Pagination"]');
|
|
33
33
|
}, [ariaLabels.pagination]);
|
|
34
|
-
return (_jsx(ReactPaginate, { className: clsx(styles.container, layoutClassName && layoutClassName), disabledClassName: styles.disabled, activeClassName: styles.currentPage, onPageChange: (e) => setCurrentPage(e.selected + 1), forcePage: currentPage - 1, pageRangeDisplayed: 3, pageCount: totalPages, disableInitialCallback: true, marginPagesDisplayed: 2, breakLabel: "...", nextClassName: styles.next, previousClassName: styles.previous, nextAriaLabel: ariaLabels.nextPage, previousAriaLabel: ariaLabels.previousPage, ariaLabelBuilder: (currentPage) => `${ariaLabels.page} ${currentPage}`, nextLabel: _jsx(Button, { tabIndex: -1, className: styles.button, children: _jsx(FontAwesomeIcon, { icon: faChevronRight }) }), previousLabel: _jsx(Button, { tabIndex: -1, className: styles.button, children: _jsx(FontAwesomeIcon, { icon: faChevronLeft }) }) }));
|
|
34
|
+
return (_jsx(ReactPaginate, { className: clsx(styles.container, layoutClassName && layoutClassName), disabledClassName: styles.disabled, activeClassName: styles.currentPage, onPageChange: (e) => setCurrentPage(e.selected + 1), forcePage: currentPage - 1, pageRangeDisplayed: 3, pageCount: totalPages, disableInitialCallback: true, marginPagesDisplayed: 2, breakLabel: "...", nextClassName: styles.next, previousClassName: styles.previous, nextAriaLabel: ariaLabels.nextPage, previousAriaLabel: ariaLabels.previousPage, ariaLabelBuilder: (currentPage) => `${ariaLabels.page} ${currentPage}`, nextLabel: _jsx(Button, { tabIndex: -1, className: styles.button, "aria-label": ariaLabels.nextPage, children: _jsx(FontAwesomeIcon, { icon: faChevronRight }) }), previousLabel: _jsx(Button, { tabIndex: -1, className: styles.button, "aria-label": ariaLabels.previousPage, children: _jsx(FontAwesomeIcon, { icon: faChevronLeft }) }) }));
|
|
35
35
|
};
|
package/package.json
CHANGED
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import * as styles from "./Pagination.module.css";
|
|
3
|
-
import clsx from "clsx";
|
|
4
|
-
|
|
5
|
-
import ReactPaginate from "react-paginate";
|
|
6
|
-
import { Button } from "@utrecht/component-library-react";
|
|
7
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
8
|
-
import { faChevronRight, faChevronLeft } from "@fortawesome/free-solid-svg-icons";
|
|
9
|
-
|
|
10
|
-
interface PaginationProps {
|
|
11
|
-
totalPages: number;
|
|
12
|
-
currentPage: number;
|
|
13
|
-
setCurrentPage: React.Dispatch<React.SetStateAction<number>>;
|
|
14
|
-
ariaLabels: {
|
|
15
|
-
pagination: string;
|
|
16
|
-
nextPage: string;
|
|
17
|
-
previousPage: string;
|
|
18
|
-
page: string;
|
|
19
|
-
};
|
|
20
|
-
layoutClassName?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const Pagination: React.FC<PaginationProps> = ({
|
|
24
|
-
totalPages,
|
|
25
|
-
currentPage,
|
|
26
|
-
setCurrentPage,
|
|
27
|
-
ariaLabels,
|
|
28
|
-
layoutClassName,
|
|
29
|
-
}) => {
|
|
30
|
-
if (totalPages < 1) return <></>; // no pages available
|
|
31
|
-
|
|
32
|
-
const setAttributes = (): void => {
|
|
33
|
-
const setRoleToPresentation = (selector: string) => {
|
|
34
|
-
document.querySelectorAll(selector).forEach((element) => {
|
|
35
|
-
if (element.getAttribute("role") !== "list") element.setAttribute("role", "list");
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
setRoleToPresentation('ul[role*="navigation"][class*="Pagination"][aria-label="Pagination"]');
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
React.useEffect(() => {
|
|
43
|
-
setAttributes();
|
|
44
|
-
}, []);
|
|
45
|
-
|
|
46
|
-
React.useEffect(() => {
|
|
47
|
-
const setRoleToPresentation = (selector: string) => {
|
|
48
|
-
document.querySelectorAll(selector).forEach((element) => {
|
|
49
|
-
if (element.getAttribute("aria-label") !== ariaLabels.pagination) {
|
|
50
|
-
element.setAttribute("aria-label", ariaLabels.pagination);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
setRoleToPresentation('ul[role*="list"][class*="Pagination"]');
|
|
56
|
-
}, [ariaLabels.pagination]);
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<ReactPaginate
|
|
60
|
-
className={clsx(styles.container, layoutClassName && layoutClassName)}
|
|
61
|
-
disabledClassName={styles.disabled}
|
|
62
|
-
activeClassName={styles.currentPage}
|
|
63
|
-
onPageChange={(e: any) => setCurrentPage(e.selected + 1)}
|
|
64
|
-
forcePage={currentPage - 1}
|
|
65
|
-
pageRangeDisplayed={3}
|
|
66
|
-
pageCount={totalPages}
|
|
67
|
-
disableInitialCallback
|
|
68
|
-
marginPagesDisplayed={2}
|
|
69
|
-
breakLabel="..."
|
|
70
|
-
nextClassName={styles.next}
|
|
71
|
-
previousClassName={styles.previous}
|
|
72
|
-
nextAriaLabel={ariaLabels.nextPage}
|
|
73
|
-
previousAriaLabel={ariaLabels.previousPage}
|
|
74
|
-
ariaLabelBuilder={(currentPage) => `${ariaLabels.page} ${currentPage}`}
|
|
75
|
-
nextLabel={
|
|
76
|
-
<Button tabIndex={-1} className={styles.button}>
|
|
77
|
-
<FontAwesomeIcon icon={faChevronRight} />
|
|
78
|
-
</Button>
|
|
79
|
-
}
|
|
80
|
-
previousLabel={
|
|
81
|
-
<Button tabIndex={-1} className={styles.button}>
|
|
82
|
-
<FontAwesomeIcon icon={faChevronLeft} />
|
|
83
|
-
</Button>
|
|
84
|
-
}
|
|
85
|
-
/>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as styles from "./Pagination.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
|
|
5
|
+
import ReactPaginate from "react-paginate";
|
|
6
|
+
import { Button } from "@utrecht/component-library-react";
|
|
7
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
8
|
+
import { faChevronRight, faChevronLeft } from "@fortawesome/free-solid-svg-icons";
|
|
9
|
+
|
|
10
|
+
interface PaginationProps {
|
|
11
|
+
totalPages: number;
|
|
12
|
+
currentPage: number;
|
|
13
|
+
setCurrentPage: React.Dispatch<React.SetStateAction<number>>;
|
|
14
|
+
ariaLabels: {
|
|
15
|
+
pagination: string;
|
|
16
|
+
nextPage: string;
|
|
17
|
+
previousPage: string;
|
|
18
|
+
page: string;
|
|
19
|
+
};
|
|
20
|
+
layoutClassName?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Pagination: React.FC<PaginationProps> = ({
|
|
24
|
+
totalPages,
|
|
25
|
+
currentPage,
|
|
26
|
+
setCurrentPage,
|
|
27
|
+
ariaLabels,
|
|
28
|
+
layoutClassName,
|
|
29
|
+
}) => {
|
|
30
|
+
if (totalPages < 1) return <></>; // no pages available
|
|
31
|
+
|
|
32
|
+
const setAttributes = (): void => {
|
|
33
|
+
const setRoleToPresentation = (selector: string) => {
|
|
34
|
+
document.querySelectorAll(selector).forEach((element) => {
|
|
35
|
+
if (element.getAttribute("role") !== "list") element.setAttribute("role", "list");
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
setRoleToPresentation('ul[role*="navigation"][class*="Pagination"][aria-label="Pagination"]');
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
setAttributes();
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
const setRoleToPresentation = (selector: string) => {
|
|
48
|
+
document.querySelectorAll(selector).forEach((element) => {
|
|
49
|
+
if (element.getAttribute("aria-label") !== ariaLabels.pagination) {
|
|
50
|
+
element.setAttribute("aria-label", ariaLabels.pagination);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
setRoleToPresentation('ul[role*="list"][class*="Pagination"]');
|
|
56
|
+
}, [ariaLabels.pagination]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ReactPaginate
|
|
60
|
+
className={clsx(styles.container, layoutClassName && layoutClassName)}
|
|
61
|
+
disabledClassName={styles.disabled}
|
|
62
|
+
activeClassName={styles.currentPage}
|
|
63
|
+
onPageChange={(e: any) => setCurrentPage(e.selected + 1)}
|
|
64
|
+
forcePage={currentPage - 1}
|
|
65
|
+
pageRangeDisplayed={3}
|
|
66
|
+
pageCount={totalPages}
|
|
67
|
+
disableInitialCallback
|
|
68
|
+
marginPagesDisplayed={2}
|
|
69
|
+
breakLabel="..."
|
|
70
|
+
nextClassName={styles.next}
|
|
71
|
+
previousClassName={styles.previous}
|
|
72
|
+
nextAriaLabel={ariaLabels.nextPage}
|
|
73
|
+
previousAriaLabel={ariaLabels.previousPage}
|
|
74
|
+
ariaLabelBuilder={(currentPage) => `${ariaLabels.page} ${currentPage}`}
|
|
75
|
+
nextLabel={
|
|
76
|
+
<Button tabIndex={-1} className={styles.button} aria-label={ariaLabels.nextPage}>
|
|
77
|
+
<FontAwesomeIcon icon={faChevronRight} />
|
|
78
|
+
</Button>
|
|
79
|
+
}
|
|
80
|
+
previousLabel={
|
|
81
|
+
<Button tabIndex={-1} className={styles.button} aria-label={ariaLabels.previousPage}>
|
|
82
|
+
<FontAwesomeIcon icon={faChevronLeft} />
|
|
83
|
+
</Button>
|
|
84
|
+
}
|
|
85
|
+
/>
|
|
86
|
+
);
|
|
87
|
+
};
|