@conduction/components 2.2.17 → 2.2.19
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 +6 -0
- package/lib/components/Pagination/Pagination.module.css +1 -1
- package/lib/components/card/richContentCard/RichContentCard.js +7 -7
- package/lib/components/card/richContentCard/RichContentCard.module.css +93 -103
- package/lib/components/formFields/select/select.js +28 -64
- package/lib/components/formFields/select/select.module.css +5 -0
- package/lib/components/horizontalOverflowWrapper/HorizontalOverflowWrapper.d.ts +10 -0
- package/lib/components/horizontalOverflowWrapper/HorizontalOverflowWrapper.js +36 -0
- package/lib/components/horizontalOverflowWrapper/HorizontalOverflowWrapper.module.css +41 -0
- package/lib/components/tabs/Tabs.js +8 -2
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.d.ts +9 -7
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.js +12 -23
- package/lib/components/topNav/primaryTopNav/PrimaryTopNav.module.css +10 -5
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -2
- package/package.json +1 -1
- package/src/components/Pagination/Pagination.module.css +1 -1
- package/src/components/formFields/select/select.module.css +5 -0
- package/src/components/formFields/select/select.tsx +28 -64
- package/src/components/horizontalOverflowWrapper/HorizontalOverflowWrapper.module.css +41 -0
- package/src/components/horizontalOverflowWrapper/HorizontalOverflowWrapper.tsx +80 -0
- package/src/components/tabs/Tabs.tsx +10 -2
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.module.css +10 -5
- package/src/components/topNav/primaryTopNav/PrimaryTopNav.tsx +29 -45
- package/src/index.ts +2 -2
- package/tsconfig.json +5 -16
- package/lib/components/tableWrapper/TableWrapper.d.ts +0 -4
- package/lib/components/tableWrapper/TableWrapper.js +0 -30
- package/lib/components/tableWrapper/TableWrapper.module.css +0 -67
- package/lib/components/temp/Temp.d.ts +0 -5
- package/lib/components/temp/Temp.js +0 -14
- package/src/components/tableWrapper/TableWrapper.module.css +0 -67
- package/src/components/tableWrapper/TableWrapper.tsx +0 -56
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
border-width: var(--conduction-pagination-navigation-button-border-width, var(--utrecht-button-border-width)) !important;
|
|
151
151
|
border-style: var(--conduction-pagination-navigation-button-border-style, var(--utrecht-button-border-style)) !important;
|
|
152
152
|
border-color: var(--conduction-pagination-navigation-button-border-color, var(--utrecht-button-border-color)) !important;
|
|
153
|
-
border-radius: var(--conduction-pagination-navigation-button-border-radius, var(--utrecht-button-border-radius));
|
|
153
|
+
border-radius: var(--conduction-pagination-navigation-button-border-radius, var(--utrecht-button-border-radius)) !important;
|
|
154
154
|
padding-inline-start: var(--conduction-pagination-navigation-button-padding-inline-start) !important;
|
|
155
155
|
padding-inline-end: var(--conduction-pagination-navigation-button-padding-inline-end) !important;
|
|
156
156
|
padding-block-start: var(--conduction-pagination-navigation-button-padding-block-start) !important;
|
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
|
|
13
13
|
--conduction-input-select-list-option-font-family: "Noto Sans", Arial, sans-serif;
|
|
14
14
|
/* --conduction-input-select-list-option-background-color: unset; */
|
|
15
|
+
/* --conduction-input-select-list-option-color: unset; */
|
|
16
|
+
/* --conduction-input-select-list-option-selected--background-color: unset; */
|
|
17
|
+
/* --conduction-input-select-list-option-selected-color: unset; */
|
|
18
|
+
/* --conduction-input-select-list-option-focus-background-color: unset; */
|
|
19
|
+
/* --conduction-input-select-list-option-focus-color: unset; */
|
|
15
20
|
|
|
16
21
|
/* --conduction-input-select-list-option-hover-background-color: unset; */
|
|
17
22
|
/* --conduction-input-select-list-option-hover-color: unset; */
|
|
@@ -23,10 +23,24 @@ interface ISelectProps {
|
|
|
23
23
|
|
|
24
24
|
const selectStyles: StylesConfig = {
|
|
25
25
|
menuPortal: (base) => ({ ...base, zIndex: 100 }),
|
|
26
|
-
option: (base) => ({
|
|
26
|
+
option: (base, state) => ({
|
|
27
27
|
...base,
|
|
28
28
|
fontFamily: `var(--conduction-input-select-list-option-font-family, ${base.fontFamily})`,
|
|
29
|
-
backgroundColor:
|
|
29
|
+
backgroundColor: [
|
|
30
|
+
state.isFocused
|
|
31
|
+
? `var(--conduction-input-select-list-option-focus-background-color, ${base.backgroundColor})`
|
|
32
|
+
: state.isSelected
|
|
33
|
+
? `var(--conduction-input-select-list-option-selected-background-color, ${base.backgroundColor})`
|
|
34
|
+
: `var(--conduction-input-select-list-option-background-color, ${base.backgroundColor})`,
|
|
35
|
+
],
|
|
36
|
+
|
|
37
|
+
color: [
|
|
38
|
+
state.isFocused
|
|
39
|
+
? `var(--conduction-input-select-list-option-focus-color, ${base.color})`
|
|
40
|
+
: state.isSelected
|
|
41
|
+
? `var(--conduction-input-select-list-option-selected-color, ${base.color})`
|
|
42
|
+
: `var(--conduction-input-select-list-option-color, ${base.color})`,
|
|
43
|
+
],
|
|
30
44
|
|
|
31
45
|
"&:hover": {
|
|
32
46
|
backgroundColor: `var(--conduction-input-select-list-option-hover-background-color, ${base.backgroundColor})`,
|
|
@@ -41,24 +55,16 @@ const selectStyles: StylesConfig = {
|
|
|
41
55
|
}),
|
|
42
56
|
};
|
|
43
57
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
const setAttributes = (): void => {
|
|
59
|
+
const setRoleToPresentation = (selector: string, role: string) => {
|
|
60
|
+
document.querySelectorAll(selector).forEach((element) => {
|
|
61
|
+
if (element.getAttribute("role") !== "presentation") element.setAttribute("role", role);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
50
64
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
fontFamily: `var(--conduction-input-select-list-option-hover-font-family, var(--conduction-input-select-list-option-font-family, ${base.fontFamily}))`,
|
|
55
|
-
},
|
|
56
|
-
}),
|
|
57
|
-
placeholder: (base) => ({
|
|
58
|
-
...base,
|
|
59
|
-
fontFamily: `var(--conduction-input-select-placeholder-font-family, var(--utrecht-form-input-placeholder-font-family, ${base.fontFamily}))`,
|
|
60
|
-
color: `var(--conduction-input-select-placeholder-color, var(--utrecht-form-input-placeholder-color, ${base.color}) )`,
|
|
61
|
-
}),
|
|
65
|
+
setRoleToPresentation('[id*="live-region"]', "presentation");
|
|
66
|
+
setRoleToPresentation('[class*="indicatorSeparator"]', "separator");
|
|
67
|
+
setRoleToPresentation('[class*="a11yText"]', "presentation");
|
|
62
68
|
};
|
|
63
69
|
|
|
64
70
|
export const SelectMultiple = ({
|
|
@@ -76,21 +82,7 @@ export const SelectMultiple = ({
|
|
|
76
82
|
ariaLabel,
|
|
77
83
|
}: ISelectProps & IReactHookFormProps): JSX.Element => {
|
|
78
84
|
React.useEffect(() => {
|
|
79
|
-
|
|
80
|
-
if (element?.role !== "presentation") {
|
|
81
|
-
element.setAttribute("role", "presentation");
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
document.querySelectorAll('[class*="indicatorSeparator"]').forEach((element: any) => {
|
|
85
|
-
if (element.role !== "presentation") {
|
|
86
|
-
element.setAttribute("role", "presentation");
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
document.querySelectorAll('[class*="a11yText"]').forEach((element: any) => {
|
|
90
|
-
if (element.role !== "presentation") {
|
|
91
|
-
element.setAttribute("role", "presentation");
|
|
92
|
-
}
|
|
93
|
-
});
|
|
85
|
+
setAttributes();
|
|
94
86
|
}, []);
|
|
95
87
|
return (
|
|
96
88
|
<Controller
|
|
@@ -135,21 +127,7 @@ export const SelectCreate = ({
|
|
|
135
127
|
ariaLabel,
|
|
136
128
|
}: ISelectProps & IReactHookFormProps): JSX.Element => {
|
|
137
129
|
React.useEffect(() => {
|
|
138
|
-
|
|
139
|
-
if (element.role !== "presentation") {
|
|
140
|
-
element.setAttribute("role", "presentation");
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
document.querySelectorAll('[class*="indicatorSeparator"]').forEach((element: any) => {
|
|
144
|
-
if (element.role !== "presentation") {
|
|
145
|
-
element.setAttribute("role", "presentation");
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
document.querySelectorAll('[class*="a11yText"]').forEach((element: any) => {
|
|
149
|
-
if (element.role !== "presentation") {
|
|
150
|
-
element.setAttribute("role", "presentation");
|
|
151
|
-
}
|
|
152
|
-
});
|
|
130
|
+
setAttributes();
|
|
153
131
|
}, []);
|
|
154
132
|
return (
|
|
155
133
|
<Controller
|
|
@@ -195,21 +173,7 @@ export const SelectSingle = ({
|
|
|
195
173
|
ariaLabel,
|
|
196
174
|
}: ISelectProps & IReactHookFormProps): JSX.Element => {
|
|
197
175
|
React.useEffect(() => {
|
|
198
|
-
|
|
199
|
-
if (element.role !== "presentation") {
|
|
200
|
-
element.setAttribute("role", "presentation");
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
document.querySelectorAll('[class*="indicatorSeparator"]').forEach((element: any) => {
|
|
204
|
-
if (element.role !== "presentation") {
|
|
205
|
-
element.setAttribute("role", "presentation");
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
document.querySelectorAll('[class*="a11yText"]').forEach((element: any) => {
|
|
209
|
-
if (element.role !== "presentation") {
|
|
210
|
-
element.setAttribute("role", "presentation");
|
|
211
|
-
}
|
|
212
|
-
});
|
|
176
|
+
setAttributes();
|
|
213
177
|
}, []);
|
|
214
178
|
return (
|
|
215
179
|
<Controller
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--conduction-horizontal-overflow-wrapper-background-color: unset;
|
|
3
|
+
--conduction-horizontal-overflow-wrapper-buttons-top: 12px;
|
|
4
|
+
|
|
5
|
+
--conduction-horizontal-overflow-wrapper-margin-inline-start: 8px;
|
|
6
|
+
--conduction-horizontal-overflow-wrapper-margin-inline-end: 8px;
|
|
7
|
+
--conduction-horizontal-overflow-wrapper-margin-block-start: 8px;
|
|
8
|
+
--conduction-horizontal-overflow-wrapper-margin-block-end: 8px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.container {
|
|
12
|
+
position: relative;
|
|
13
|
+
background-color: var(--conduction-horizontal-overflow-wrapper-background-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.wrapper {
|
|
17
|
+
overflow-x: scroll;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.scrollButton {
|
|
21
|
+
position: sticky;
|
|
22
|
+
top: var(--conduction-horizontal-overflow-wrapper-buttons-top);
|
|
23
|
+
|
|
24
|
+
margin-inline-start: var(--conduction-horizontal-overflow-wrapper-margin-inline-start);
|
|
25
|
+
margin-inline-end: var(--conduction-horizontal-overflow-wrapper-margin-inline-end);
|
|
26
|
+
margin-block-start: var(--conduction-horizontal-overflow-wrapper-margin-block-start);
|
|
27
|
+
margin-block-end: var(--conduction-horizontal-overflow-wrapper-margin-block-end);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.scrollButton.right {
|
|
31
|
+
left: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Hide scrollbar */
|
|
35
|
+
.wrapper::-webkit-scrollbar {
|
|
36
|
+
display: none;
|
|
37
|
+
}
|
|
38
|
+
.wrapper {
|
|
39
|
+
-ms-overflow-style: none;
|
|
40
|
+
scrollbar-width: none;
|
|
41
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as styles from "./HorizontalOverflowWrapper.module.css";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { Button } from "@utrecht/component-library-react/dist/css-module";
|
|
5
|
+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
|
+
import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
|
|
7
|
+
|
|
8
|
+
interface HorizontalOverflowWrapperProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
ariaLabels: {
|
|
11
|
+
scrollRightButton: string;
|
|
12
|
+
scrollLeftButton: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const HorizontalOverflowWrapper: React.FC<HorizontalOverflowWrapperProps> = ({ children, ariaLabels }) => {
|
|
17
|
+
const [canScrollRight, setCanScrollRight] = React.useState<boolean>(false);
|
|
18
|
+
const [canScrollLeft, setCanScrollLeft] = React.useState<boolean>(false);
|
|
19
|
+
|
|
20
|
+
const wrapperRef = React.useRef<HTMLDivElement | null>(null);
|
|
21
|
+
|
|
22
|
+
const scrollRight = (): void => {
|
|
23
|
+
wrapperRef.current?.scrollTo({
|
|
24
|
+
left: wrapperRef.current.scrollLeft + wrapperRef.current.clientWidth * 0.9,
|
|
25
|
+
behavior: "smooth",
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const scrollLeft = (): void => {
|
|
30
|
+
wrapperRef.current?.scrollTo({
|
|
31
|
+
left: wrapperRef.current.scrollLeft - wrapperRef.current.clientWidth * 0.9,
|
|
32
|
+
behavior: "smooth",
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
checkScrollDirections(); // initiate available scroll directions
|
|
38
|
+
|
|
39
|
+
window.addEventListener("resize", checkScrollDirections);
|
|
40
|
+
|
|
41
|
+
return () => window.removeEventListener("resize", checkScrollDirections);
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
const checkScrollDirections = (): void => {
|
|
45
|
+
if (!wrapperRef.current) return;
|
|
46
|
+
|
|
47
|
+
setCanScrollRight(wrapperRef.current.scrollLeft + wrapperRef.current.clientWidth < wrapperRef.current.scrollWidth);
|
|
48
|
+
setCanScrollLeft(wrapperRef.current.scrollLeft > 0);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className={styles.container}>
|
|
53
|
+
{canScrollLeft && (
|
|
54
|
+
<Button
|
|
55
|
+
className={clsx(styles.scrollButton, styles.left)}
|
|
56
|
+
onClick={scrollLeft}
|
|
57
|
+
appearance="secondary-action-button"
|
|
58
|
+
aria-label={ariaLabels.scrollLeftButton}
|
|
59
|
+
>
|
|
60
|
+
<FontAwesomeIcon icon={faChevronLeft} />
|
|
61
|
+
</Button>
|
|
62
|
+
)}
|
|
63
|
+
|
|
64
|
+
{canScrollRight && (
|
|
65
|
+
<Button
|
|
66
|
+
className={clsx(styles.scrollButton, styles.right)}
|
|
67
|
+
onClick={scrollRight}
|
|
68
|
+
appearance="secondary-action-button"
|
|
69
|
+
aria-label={ariaLabels.scrollRightButton}
|
|
70
|
+
>
|
|
71
|
+
<FontAwesomeIcon icon={faChevronRight} />
|
|
72
|
+
</Button>
|
|
73
|
+
)}
|
|
74
|
+
|
|
75
|
+
<div ref={wrapperRef} className={styles.wrapper} onScroll={checkScrollDirections}>
|
|
76
|
+
{children}
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -41,11 +41,19 @@ export const TabList: ReactTabsFunctionComponent<TabListProps> = ({ children, ..
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
const handleScrollRight = () => {
|
|
44
|
-
if (wrapperRef.current)
|
|
44
|
+
if (wrapperRef.current)
|
|
45
|
+
wrapperRef.current.scrollTo({
|
|
46
|
+
left: wrapperRef.current.scrollLeft + wrapperRef.current.clientWidth * 0.9,
|
|
47
|
+
behavior: "smooth",
|
|
48
|
+
});
|
|
45
49
|
};
|
|
46
50
|
|
|
47
51
|
const handleScrollLeft = () => {
|
|
48
|
-
if (wrapperRef.current)
|
|
52
|
+
if (wrapperRef.current)
|
|
53
|
+
wrapperRef.current.scrollTo({
|
|
54
|
+
left: wrapperRef.current.scrollLeft - wrapperRef.current.clientWidth * 0.9,
|
|
55
|
+
behavior: "smooth",
|
|
56
|
+
});
|
|
49
57
|
};
|
|
50
58
|
|
|
51
59
|
React.useEffect(() => {
|
|
@@ -116,6 +116,11 @@
|
|
|
116
116
|
}
|
|
117
117
|
.primary .link {
|
|
118
118
|
text-decoration: none;
|
|
119
|
+
text-overflow: ellipsis;
|
|
120
|
+
display: block;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
max-width: 100%;
|
|
123
|
+
white-space: wrap;
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
.primary .link:not(.currentLink) {
|
|
@@ -187,6 +192,11 @@
|
|
|
187
192
|
margin-inline-end: var(--conduction-primary-top-nav-item-icon-margin);
|
|
188
193
|
}
|
|
189
194
|
|
|
195
|
+
.li:hover .dropdown {
|
|
196
|
+
display: block;
|
|
197
|
+
z-index: 1;
|
|
198
|
+
}
|
|
199
|
+
|
|
190
200
|
@media only screen and (min-width: 992px) {
|
|
191
201
|
.container {
|
|
192
202
|
width: fit-content;
|
|
@@ -215,11 +225,6 @@
|
|
|
215
225
|
display: none;
|
|
216
226
|
}
|
|
217
227
|
|
|
218
|
-
.primary .li:hover .dropdown {
|
|
219
|
-
display: block;
|
|
220
|
-
z-index: 1;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
228
|
.mobileLink {
|
|
224
229
|
margin-block-end: unset;
|
|
225
230
|
}
|
|
@@ -5,19 +5,24 @@ import { Link } from "@utrecht/component-library-react/dist/css-module";
|
|
|
5
5
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
6
6
|
import { faBars, faChevronRight } from "@fortawesome/free-solid-svg-icons";
|
|
7
7
|
|
|
8
|
-
interface
|
|
8
|
+
interface ITopNavItemBase {
|
|
9
9
|
label: string;
|
|
10
10
|
icon?: JSX.Element;
|
|
11
11
|
current?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface ITopNavItemWithSubItems extends ITopNavItemBase {
|
|
15
|
+
handleClick?: never;
|
|
16
|
+
subItems: ITopNavItem[];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ITopNavItemWithoutSubItems extends ITopNavItemBase {
|
|
12
20
|
handleClick?: () => any;
|
|
13
|
-
subItems?:
|
|
14
|
-
label: string;
|
|
15
|
-
icon?: JSX.Element;
|
|
16
|
-
current?: boolean;
|
|
17
|
-
handleClick?: () => any;
|
|
18
|
-
}[];
|
|
21
|
+
subItems?: never;
|
|
19
22
|
}
|
|
20
23
|
|
|
24
|
+
export type ITopNavItem = ITopNavItemWithSubItems | ITopNavItemWithoutSubItems;
|
|
25
|
+
|
|
21
26
|
export interface TopNavProps {
|
|
22
27
|
items: ITopNavItem[];
|
|
23
28
|
mobileLogo?: JSX.Element;
|
|
@@ -26,30 +31,24 @@ export interface TopNavProps {
|
|
|
26
31
|
|
|
27
32
|
export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }: TopNavProps): JSX.Element => {
|
|
28
33
|
const [isOpen, setIsOpen] = React.useState<boolean>(false);
|
|
29
|
-
const [
|
|
34
|
+
const [isMobile, setIsMobile] = React.useState<boolean>(window.innerWidth < 992);
|
|
35
|
+
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
const handleResize = () => {
|
|
38
|
+
setIsMobile(window.innerWidth < 992);
|
|
39
|
+
};
|
|
30
40
|
|
|
31
|
-
|
|
32
|
-
if (handleClick) {
|
|
33
|
-
handleClick();
|
|
41
|
+
window.addEventListener("resize", handleResize);
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
43
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
44
|
+
}, []);
|
|
38
45
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
...subNavIsOpen,
|
|
42
|
-
[idx as keyof typeof subNavIsOpen]: value,
|
|
43
|
-
});
|
|
44
|
-
};
|
|
46
|
+
const handleSubItemClick = (handleClick: any) => {
|
|
47
|
+
setIsOpen(false);
|
|
45
48
|
|
|
46
|
-
|
|
49
|
+
handleClick();
|
|
50
|
+
};
|
|
47
51
|
|
|
48
|
-
React.useEffect(() => {
|
|
49
|
-
if (screenWidth > 992) {
|
|
50
|
-
setSubNavIsOpen({});
|
|
51
|
-
}
|
|
52
|
-
}, [screenWidth]);
|
|
53
52
|
return (
|
|
54
53
|
<div className={clsx(styles.container, layoutClassName && layoutClassName)}>
|
|
55
54
|
<div className={styles.menuToggleContainer}>
|
|
@@ -63,17 +62,7 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }: TopNavProp
|
|
|
63
62
|
<nav className={clsx(styles.primary, isOpen && styles.isOpen)}>
|
|
64
63
|
<ul className={styles.ul}>
|
|
65
64
|
{items.map(({ label, icon, current, handleClick, subItems }, idx) => (
|
|
66
|
-
<li
|
|
67
|
-
onClick={() =>
|
|
68
|
-
!subItems
|
|
69
|
-
? handleItemClick(handleClick)
|
|
70
|
-
: screenWidth > 992
|
|
71
|
-
? handleItemClick(handleClick)
|
|
72
|
-
: handleSubItemMenu(idx, !subNavIsOpen[idx as keyof typeof subNavIsOpen] ?? true)
|
|
73
|
-
}
|
|
74
|
-
className={clsx(styles.li, current && styles.current)}
|
|
75
|
-
key={idx}
|
|
76
|
-
>
|
|
65
|
+
<li onClick={handleClick} className={clsx(styles.li, current && styles.current)} key={idx}>
|
|
77
66
|
<Link
|
|
78
67
|
className={clsx(
|
|
79
68
|
styles.link,
|
|
@@ -84,21 +73,16 @@ export const PrimaryTopNav = ({ items, mobileLogo, layoutClassName }: TopNavProp
|
|
|
84
73
|
>
|
|
85
74
|
{icon}
|
|
86
75
|
{label}{" "}
|
|
87
|
-
{subItems &&
|
|
88
|
-
<FontAwesomeIcon
|
|
89
|
-
className={clsx(styles.toggleIcon, subNavIsOpen[idx as keyof typeof subNavIsOpen] && styles.isOpen)}
|
|
90
|
-
icon={faChevronRight}
|
|
91
|
-
/>
|
|
92
|
-
)}
|
|
76
|
+
{subItems && isMobile && <FontAwesomeIcon className={styles.toggleIcon} icon={faChevronRight} />}
|
|
93
77
|
</Link>
|
|
94
78
|
|
|
95
79
|
{subItems && (
|
|
96
|
-
<ul className={
|
|
80
|
+
<ul className={styles.dropdown}>
|
|
97
81
|
{subItems.map(({ label, icon, current, handleClick }, idx) => (
|
|
98
82
|
<li
|
|
99
83
|
key={idx}
|
|
100
84
|
className={clsx(styles.li, current && styles.current)}
|
|
101
|
-
onClick={() =>
|
|
85
|
+
onClick={() => handleSubItemClick(handleClick)}
|
|
102
86
|
>
|
|
103
87
|
<Link className={clsx(styles.link, styles.label, current && styles.currentLink)}>
|
|
104
88
|
{icon}
|
package/src/index.ts
CHANGED
|
@@ -40,7 +40,7 @@ import { CodeBlock } from "./components/codeBlock/CodeBlock";
|
|
|
40
40
|
import { ToolTip } from "./components/toolTip/ToolTip";
|
|
41
41
|
import { Pagination } from "./components/Pagination/Pagination";
|
|
42
42
|
import { Tabs, TabList, Tab, TabPanel } from "./components/tabs/Tabs";
|
|
43
|
-
import {
|
|
43
|
+
import { HorizontalOverflowWrapper } from "./components/horizontalOverflowWrapper/HorizontalOverflowWrapper";
|
|
44
44
|
|
|
45
45
|
export {
|
|
46
46
|
DownloadCard,
|
|
@@ -82,5 +82,5 @@ export {
|
|
|
82
82
|
TabList,
|
|
83
83
|
Tab,
|
|
84
84
|
TabPanel,
|
|
85
|
-
|
|
85
|
+
HorizontalOverflowWrapper,
|
|
86
86
|
};
|
package/tsconfig.json
CHANGED
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
"declaration": true,
|
|
4
4
|
"outDir": "./lib",
|
|
5
5
|
"target": "esnext",
|
|
6
|
-
"lib": [
|
|
7
|
-
"dom",
|
|
8
|
-
"esnext"
|
|
9
|
-
],
|
|
6
|
+
"lib": ["dom", "esnext"],
|
|
10
7
|
"jsx": "react-jsx",
|
|
11
8
|
"module": "esnext",
|
|
12
9
|
"moduleResolution": "node",
|
|
@@ -15,15 +12,7 @@
|
|
|
15
12
|
"strict": true,
|
|
16
13
|
"skipLibCheck": true
|
|
17
14
|
},
|
|
18
|
-
"hooks": [
|
|
19
|
-
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
"src",
|
|
23
|
-
"src/**/*.css"
|
|
24
|
-
],
|
|
25
|
-
"exclude": [
|
|
26
|
-
"node_modules",
|
|
27
|
-
"**/__tests__/*"
|
|
28
|
-
]
|
|
29
|
-
}
|
|
15
|
+
"hooks": ["copy-files"],
|
|
16
|
+
"include": ["src", "src/**/*.css"],
|
|
17
|
+
"exclude": ["node_modules", "**/__tests__/*"]
|
|
18
|
+
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React, { useState, useEffect } from "react";
|
|
3
|
-
import * as styles from "./TableWrapper.module.css";
|
|
4
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
-
import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
|
|
6
|
-
export const TableWrapper = ({ children }) => {
|
|
7
|
-
const [canScrollRight, setCanScrollRight] = useState(false);
|
|
8
|
-
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
9
|
-
const wrapperRef = React.useRef(null);
|
|
10
|
-
const handleScroll = () => {
|
|
11
|
-
if (wrapperRef.current) {
|
|
12
|
-
setCanScrollLeft(wrapperRef.current.scrollLeft > 0);
|
|
13
|
-
setCanScrollRight(wrapperRef.current.scrollWidth - wrapperRef.current.scrollLeft > wrapperRef.current.clientWidth);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
const handleScrollRight = () => {
|
|
17
|
-
if (wrapperRef.current)
|
|
18
|
-
wrapperRef.current.scrollTo({ left: wrapperRef.current.scrollWidth, behavior: "smooth" });
|
|
19
|
-
};
|
|
20
|
-
const handleScrollLeft = () => {
|
|
21
|
-
if (wrapperRef.current)
|
|
22
|
-
wrapperRef.current.scrollTo({ left: 0, behavior: "smooth" });
|
|
23
|
-
};
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (wrapperRef.current) {
|
|
26
|
-
setCanScrollRight(wrapperRef.current.scrollWidth > wrapperRef.current.clientWidth); // initiate scroll
|
|
27
|
-
}
|
|
28
|
-
}, []);
|
|
29
|
-
return (_jsx("div", { className: styles.container, children: _jsxs("div", { onScroll: handleScroll, ref: wrapperRef, className: styles.wrapper, children: [canScrollLeft && (_jsx("div", { onClick: handleScrollLeft, className: styles.scrollLeftButton, children: _jsx("div", { className: styles.scrollButton, children: _jsx(FontAwesomeIcon, { icon: faChevronLeft }) }) })), children, canScrollRight && (_jsx("div", { onClick: handleScrollRight, className: styles.scrollRightButton, children: _jsx("div", { className: styles.scrollButton, children: _jsx(FontAwesomeIcon, { icon: faChevronRight }) }) }))] }) }));
|
|
30
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--conduction-table-wrapper-scroll-button-background-color: #ffffff;
|
|
3
|
-
--conduction-table-wrapper-scroll-button-color: #000000;
|
|
4
|
-
--conduction-table-wrapper-scroll-button-padding-inline-start: 14px;
|
|
5
|
-
--conduction-table-wrapper-scroll-button-padding-inline-end: 14px;
|
|
6
|
-
/* --conduction-table-wrapper-scroll-button-padding-block-start: 10px; */
|
|
7
|
-
/* --conduction-table-wrapper-scroll-button-padding-block-end: 10px; */
|
|
8
|
-
/* --conduction-table-wrapper-scroll-button-border-color: 1px; */
|
|
9
|
-
/* --conduction-table-wrapper-scroll-button-border-color: solid; */
|
|
10
|
-
/* --conduction-table-wrapper-scroll-button-border-color: #000000; */
|
|
11
|
-
|
|
12
|
-
--conduction-table-wrapper-scroll-button-hover-background-color: #ffffff;
|
|
13
|
-
--conduction-table-wrapper-scroll-button-hover-color: #4376fc;
|
|
14
|
-
}
|
|
15
|
-
.container {
|
|
16
|
-
position: relative;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.wrapper,
|
|
20
|
-
.wrapperTouchscreen {
|
|
21
|
-
overflow-x: scroll;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.scrollRightButton,
|
|
25
|
-
.scrollLeftButton {
|
|
26
|
-
top: 0%;
|
|
27
|
-
position: absolute;
|
|
28
|
-
display: flex;
|
|
29
|
-
height: 100%;
|
|
30
|
-
background-color: var(--conduction-table-wrapper-scroll-button-background-color);
|
|
31
|
-
color: var(--conduction-table-wrapper-scroll-button-color);
|
|
32
|
-
padding-inline-start: var(--conduction-table-wrapper-scroll-button-padding-inline-start);
|
|
33
|
-
padding-inline-end: var(--conduction-table-wrapper-scroll-button-padding-inline-end);
|
|
34
|
-
padding-block-start: var(--conduction-table-wrapper-scroll-button-padding-block-start);
|
|
35
|
-
padding-block-end: var(--conduction-table-wrapper-scroll-button-padding-block-end);
|
|
36
|
-
border-width: var(--conduction-table-wrapper-scroll-button-border-width);
|
|
37
|
-
border-style: var(--conduction-table-wrapper-scroll-button-border-style);
|
|
38
|
-
border-color: var(--conduction-table-wrapper-scroll-button-border-color);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.scrollLeftButton:hover,
|
|
42
|
-
.scrollRightButton:hover {
|
|
43
|
-
background-color: var(--conduction-table-wrapper-scroll-button-hover-background-color);
|
|
44
|
-
color: var(--conduction-table-wrapper-scroll-button-hover-color);
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.scrollRightButton {
|
|
49
|
-
right: 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.scrollLeftButton {
|
|
53
|
-
left: 0;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.scrollButton {
|
|
57
|
-
align-self: center;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* Hide scrollbar */
|
|
61
|
-
.wrapper::-webkit-scrollbar {
|
|
62
|
-
display: none;
|
|
63
|
-
}
|
|
64
|
-
.wrapper {
|
|
65
|
-
-ms-overflow-style: none;
|
|
66
|
-
scrollbar-width: none;
|
|
67
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { ReactTabsFunctionComponent, TabProps, TabPanelProps, TabListProps, TabsProps } from "react-tabs";
|
|
2
|
-
export declare const Tabs: ReactTabsFunctionComponent<TabsProps>;
|
|
3
|
-
export declare const TabList: ReactTabsFunctionComponent<TabListProps>;
|
|
4
|
-
export declare const Tab: ReactTabsFunctionComponent<TabProps>;
|
|
5
|
-
export declare const TabPanel: ReactTabsFunctionComponent<TabPanelProps>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Tabs as RTabs, TabList as RTabList, Tab as RTab, TabPanel as RTabPanel, } from "react-tabs";
|
|
3
|
-
// Tabs
|
|
4
|
-
export const Tabs = ({ children, ...otherProps }) => (_jsx(RTabs, { ...otherProps, children: _jsx("h1", { children: children }) }));
|
|
5
|
-
Tabs.tabsRole = "Tabs";
|
|
6
|
-
// TabList
|
|
7
|
-
export const TabList = ({ children, ...otherProps }) => (_jsx(RTabList, { ...otherProps, children: children }));
|
|
8
|
-
TabList.tabsRole = "TabList";
|
|
9
|
-
// Tab
|
|
10
|
-
export const Tab = ({ children, ...otherProps }) => (_jsx(RTab, { ...otherProps, children: children }));
|
|
11
|
-
Tab.tabsRole = "Tab";
|
|
12
|
-
// TabPanel
|
|
13
|
-
export const TabPanel = ({ children, ...otherProps }) => (_jsx(RTabPanel, { ...otherProps, children: children }));
|
|
14
|
-
TabPanel.tabsRole = "TabPanel";
|