@conduction/components 2.2.54 → 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 +219 -213
- package/lib/components/Pagination/Pagination.js +1 -1
- package/lib/components/card/cardHeader/CardHeader.module.css +54 -54
- package/lib/components/displaySwitch/DisplaySwitch.js +1 -1
- package/lib/components/formFields/select/select.js +44 -0
- package/lib/components/logo/Logo.d.ts +1 -0
- package/lib/components/logo/Logo.js +2 -2
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.module.css +315 -315
- package/package.json +50 -50
- package/src/components/Pagination/Pagination.tsx +87 -87
- package/src/components/card/cardHeader/CardHeader.module.css +54 -54
- package/src/components/displaySwitch/DisplaySwitch.tsx +49 -49
- package/src/components/formFields/select/select.tsx +49 -0
- package/src/components/horizontalOverflowWrapper/HorizontalOverflowWrapper.tsx +80 -80
- package/src/components/logo/Logo.tsx +24 -21
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css +315 -315
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.tsx +133 -133
- package/tsconfig.json +21 -21
|
@@ -36,6 +36,13 @@ const selectStyles = {
|
|
|
36
36
|
fontFamily: `var(--conduction-input-select-placeholder-font-family, var(--utrecht-form-input-placeholder-font-family, ${base.fontFamily}))`,
|
|
37
37
|
color: `var(--conduction-input-select-placeholder-color, var(--utrecht-form-input-placeholder-color, ${base.color}) )`,
|
|
38
38
|
}),
|
|
39
|
+
dropdownIndicator: (base) => ({
|
|
40
|
+
...base,
|
|
41
|
+
color: "#949494",
|
|
42
|
+
"&:hover": {
|
|
43
|
+
color: "#949494",
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
39
46
|
};
|
|
40
47
|
const setAttributes = () => {
|
|
41
48
|
const setRoleToPresentation = (selector, role) => {
|
|
@@ -47,9 +54,46 @@ const setAttributes = () => {
|
|
|
47
54
|
element.removeAttribute("aria-live");
|
|
48
55
|
});
|
|
49
56
|
};
|
|
57
|
+
const updateIndicatorAttributes = (indicator, isInteractive) => {
|
|
58
|
+
if (isInteractive) {
|
|
59
|
+
indicator.setAttribute("role", "button");
|
|
60
|
+
indicator.setAttribute("tabindex", "0");
|
|
61
|
+
indicator.setAttribute("aria-label", "Clear selection");
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
indicator.setAttribute("role", "presentation");
|
|
65
|
+
indicator.removeAttribute("tabindex");
|
|
66
|
+
indicator.removeAttribute("aria-label");
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const setAriaLabelsForIndicators = () => {
|
|
70
|
+
document.querySelectorAll('[class*="control"]').forEach((control) => {
|
|
71
|
+
const indicatorsParent = control.querySelector('[class*="indicatorSeparator"]')?.parentElement;
|
|
72
|
+
if (!indicatorsParent)
|
|
73
|
+
return;
|
|
74
|
+
const indicators = indicatorsParent.querySelectorAll('[class*="indicatorContainer"]');
|
|
75
|
+
const hasSelection = indicators.length === 2;
|
|
76
|
+
indicators.forEach((indicator, index) => {
|
|
77
|
+
const isClearButton = hasSelection && index === 0;
|
|
78
|
+
updateIndicatorAttributes(indicator, isClearButton);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
// Initial static setup
|
|
50
83
|
setRoleToPresentation('[id*="live-region"]', "presentation");
|
|
51
84
|
setRoleToPresentation('[class*="indicatorSeparator"]', "separator");
|
|
52
85
|
setRoleToPresentation('[class*="a11yText"]', "presentation");
|
|
86
|
+
// Dynamic setup after render
|
|
87
|
+
setTimeout(() => {
|
|
88
|
+
setAriaLabelsForIndicators();
|
|
89
|
+
const observer = new MutationObserver(setAriaLabelsForIndicators);
|
|
90
|
+
document.querySelectorAll('[class*="control"]').forEach((control) => {
|
|
91
|
+
const indicatorsParent = control.querySelector('[class*="indicatorSeparator"]')?.parentElement;
|
|
92
|
+
if (indicatorsParent) {
|
|
93
|
+
observer.observe(indicatorsParent, { childList: true, subtree: false });
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}, 100);
|
|
53
97
|
};
|
|
54
98
|
export const SelectMultiple = ({ id, name, options, errors, control, validation, defaultValue, disabled, hideErrorMessage, menuPlacement, placeholder, ariaLabel, }) => {
|
|
55
99
|
React.useEffect(() => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as styles from "./Logo.module.css";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
export const Logo = ({ onClick, layoutClassName, variant = "header" }) => {
|
|
4
|
+
export const Logo = ({ onClick, layoutClassName, variant = "header", ariaLabel = "logo" }) => {
|
|
5
5
|
return (_jsx("div", { className: clsx(styles.container, styles[variant], [
|
|
6
6
|
onClick && styles.clickable,
|
|
7
7
|
layoutClassName && layoutClassName,
|
|
8
|
-
]), onClick }));
|
|
8
|
+
]), role: "img", "aria-label": ariaLabel, onClick }));
|
|
9
9
|
};
|