@conduction/components 2.2.44 → 2.2.46
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 +2 -0
- package/lib/components/Pagination/Pagination.d.ts +1 -0
- package/lib/components/Pagination/Pagination.js +23 -0
- package/lib/components/formFields/select/select.js +3 -0
- package/lib/components/tabs/Tabs.module.css +1 -1
- package/package.json +1 -1
- package/src/components/Pagination/Pagination.tsx +27 -0
- package/src/components/formFields/select/select.tsx +3 -0
- package/src/components/tabs/Tabs.module.css +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
- **Version 2.2 (breaking changes from 2.1.x)**
|
|
6
6
|
|
|
7
|
+
- 2.2.46: Fixed minor css parse error.
|
|
8
|
+
- 2.2.45: Updated Pagination and select to ensure more WCAG compliancy.
|
|
7
9
|
- 2.2.44: Updated PrimaryTopNav to allow font-weight.
|
|
8
10
|
- 2.2.43: Updated DownloadCard to allow size as string.
|
|
9
11
|
- 2.2.42:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import * as styles from "./Pagination.module.css";
|
|
3
4
|
import clsx from "clsx";
|
|
4
5
|
import ReactPaginate from "react-paginate";
|
|
@@ -8,5 +9,27 @@ import { faChevronRight, faChevronLeft } from "@fortawesome/free-solid-svg-icons
|
|
|
8
9
|
export const Pagination = ({ totalPages, currentPage, setCurrentPage, ariaLabels, layoutClassName, }) => {
|
|
9
10
|
if (totalPages < 1)
|
|
10
11
|
return _jsx(_Fragment, {}); // no pages available
|
|
12
|
+
const setAttributes = () => {
|
|
13
|
+
const setRoleToPresentation = (selector) => {
|
|
14
|
+
document.querySelectorAll(selector).forEach((element) => {
|
|
15
|
+
if (element.getAttribute("role") !== "list")
|
|
16
|
+
element.setAttribute("role", "list");
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
setRoleToPresentation('ul[role*="navigation"][class*="Pagination"][aria-label="Pagination"]');
|
|
20
|
+
};
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
setAttributes();
|
|
23
|
+
}, []);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
const setRoleToPresentation = (selector) => {
|
|
26
|
+
document.querySelectorAll(selector).forEach((element) => {
|
|
27
|
+
if (element.getAttribute("aria-label") !== ariaLabels.pagination) {
|
|
28
|
+
element.setAttribute("aria-label", ariaLabels.pagination);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
setRoleToPresentation('ul[role*="list"][class*="Pagination"]');
|
|
33
|
+
}, [ariaLabels.pagination]);
|
|
11
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 }) }) }));
|
|
12
35
|
};
|
|
@@ -42,6 +42,9 @@ const setAttributes = () => {
|
|
|
42
42
|
document.querySelectorAll(selector).forEach((element) => {
|
|
43
43
|
if (element.getAttribute("role") !== "presentation")
|
|
44
44
|
element.setAttribute("role", role);
|
|
45
|
+
element.removeAttribute("aria-relevant");
|
|
46
|
+
element.removeAttribute("aria-atomic");
|
|
47
|
+
element.removeAttribute("aria-live");
|
|
45
48
|
});
|
|
46
49
|
};
|
|
47
50
|
setRoleToPresentation('[id*="live-region"]', "presentation");
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
--conduction-tabs-tab-padding-inline-start: var(--skeleton-size-sm);
|
|
15
15
|
--conduction-tabs-tab-padding-inline-end: var(--skeleton-size-sm);
|
|
16
16
|
/* --conduction-tabs-tab-margin-inline-end: var(--skeleton-size-xs); */
|
|
17
|
-
--conduction-tabs-tab-font-size: var(--skeleton-font-size-sm
|
|
17
|
+
--conduction-tabs-tab-font-size: var(--skeleton-font-size-sm);
|
|
18
18
|
--conduction-tabs-tab-font-weight: var(--skeleton-font-weight-normal);
|
|
19
19
|
--conduction-tabs-tab-font-family: "Noto Sans", Arial, sans-serif;
|
|
20
20
|
--conduction-tabs-tab-max-width: unset;
|
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ interface PaginationProps {
|
|
|
12
12
|
currentPage: number;
|
|
13
13
|
setCurrentPage: React.Dispatch<React.SetStateAction<number>>;
|
|
14
14
|
ariaLabels: {
|
|
15
|
+
pagination: string;
|
|
15
16
|
nextPage: string;
|
|
16
17
|
previousPage: string;
|
|
17
18
|
page: string;
|
|
@@ -28,6 +29,32 @@ export const Pagination: React.FC<PaginationProps> = ({
|
|
|
28
29
|
}) => {
|
|
29
30
|
if (totalPages < 1) return <></>; // no pages available
|
|
30
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
|
+
|
|
31
58
|
return (
|
|
32
59
|
<ReactPaginate
|
|
33
60
|
className={clsx(styles.container, layoutClassName && layoutClassName)}
|
|
@@ -62,6 +62,9 @@ const setAttributes = (): void => {
|
|
|
62
62
|
const setRoleToPresentation = (selector: string, role: string) => {
|
|
63
63
|
document.querySelectorAll(selector).forEach((element) => {
|
|
64
64
|
if (element.getAttribute("role") !== "presentation") element.setAttribute("role", role);
|
|
65
|
+
element.removeAttribute("aria-relevant");
|
|
66
|
+
element.removeAttribute("aria-atomic");
|
|
67
|
+
element.removeAttribute("aria-live");
|
|
65
68
|
});
|
|
66
69
|
};
|
|
67
70
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
--conduction-tabs-tab-padding-inline-start: var(--skeleton-size-sm);
|
|
15
15
|
--conduction-tabs-tab-padding-inline-end: var(--skeleton-size-sm);
|
|
16
16
|
/* --conduction-tabs-tab-margin-inline-end: var(--skeleton-size-xs); */
|
|
17
|
-
--conduction-tabs-tab-font-size: var(--skeleton-font-size-sm
|
|
17
|
+
--conduction-tabs-tab-font-size: var(--skeleton-font-size-sm);
|
|
18
18
|
--conduction-tabs-tab-font-weight: var(--skeleton-font-weight-normal);
|
|
19
19
|
--conduction-tabs-tab-font-family: "Noto Sans", Arial, sans-serif;
|
|
20
20
|
--conduction-tabs-tab-max-width: unset;
|