@conduction/components 2.2.5 → 2.2.7

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,6 +4,8 @@
4
4
 
5
5
  - **Version 2.2 (breaking changes from 2.1.x)**
6
6
 
7
+ - 2.2.7: Updated TableWrapper component and updated Tabs component.
8
+ - 2.2.6: Added TableWrapper component and updated Tabs component.
7
9
  - 2.2.5: Updated Tabs component.
8
10
  - 2.2.4: Refactor the Tooltip component to include react-tooltip version 5+.
9
11
  - 2.2.3: Added Tabs component.
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ interface TableWrapperProps {
3
+ touchScreen?: boolean;
4
+ }
5
+ export declare const TableWrapper: React.FC<{
6
+ children: React.ReactNode;
7
+ } & TableWrapperProps>;
8
+ export {};
@@ -0,0 +1,31 @@
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 clsx from "clsx";
5
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
6
+ import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
7
+ export const TableWrapper = ({ children, touchScreen, }) => {
8
+ const [canScrollRight, setCanScrollRight] = useState(false);
9
+ const [canScrollLeft, setCanScrollLeft] = useState(false);
10
+ const wrapperRef = React.useRef(null);
11
+ const handleScroll = () => {
12
+ if (wrapperRef.current) {
13
+ setCanScrollLeft(wrapperRef.current.scrollLeft > 0);
14
+ setCanScrollRight(wrapperRef.current.scrollWidth - wrapperRef.current.scrollLeft > wrapperRef.current.clientWidth);
15
+ }
16
+ };
17
+ const handleScrollRight = () => {
18
+ if (wrapperRef.current)
19
+ wrapperRef.current.scrollTo({ left: wrapperRef.current.scrollWidth, behavior: "smooth" });
20
+ };
21
+ const handleScrollLeft = () => {
22
+ if (wrapperRef.current)
23
+ wrapperRef.current.scrollTo({ left: 0, behavior: "smooth" });
24
+ };
25
+ useEffect(() => {
26
+ if (wrapperRef.current) {
27
+ setCanScrollRight(wrapperRef.current.scrollWidth > wrapperRef.current.clientWidth); // initiate scroll
28
+ }
29
+ }, []);
30
+ return (_jsx("div", { className: styles.container, children: _jsxs("div", { onScroll: handleScroll, ref: wrapperRef, className: clsx(touchScreen ? styles.wrapperTouchscreen : styles.wrapper), children: [canScrollLeft && !touchScreen && (_jsx("div", { onClick: handleScrollLeft, className: styles.scrollLeftButton, children: _jsx("div", { className: styles.scrollButton, children: _jsx(FontAwesomeIcon, { icon: faChevronLeft }) }) })), children, canScrollRight && !touchScreen && (_jsx("div", { onClick: handleScrollRight, className: styles.scrollRightButton, children: _jsx("div", { className: styles.scrollButton, children: _jsx(FontAwesomeIcon, { icon: faChevronRight }) }) }))] }) }));
31
+ };
@@ -0,0 +1,69 @@
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
+ overflow-x: scroll;
21
+ }
22
+ .wrapperTouchscreen {
23
+ overflow-x: scroll;
24
+ }
25
+
26
+ .scrollRightButton,
27
+ .scrollLeftButton {
28
+ top: 0%;
29
+ position: absolute;
30
+ display: flex;
31
+ height: 100%;
32
+ background-color: var(--conduction-table-wrapper-scroll-button-background-color);
33
+ color: var(--conduction-table-wrapper-scroll-button-color);
34
+ padding-inline-start: var(--conduction-table-wrapper-scroll-button-padding-inline-start);
35
+ padding-inline-end: var(--conduction-table-wrapper-scroll-button-padding-inline-end);
36
+ padding-block-start: var(--conduction-table-wrapper-scroll-button-padding-block-start);
37
+ padding-block-end: var(--conduction-table-wrapper-scroll-button-padding-block-end);
38
+ border-width:var(--conduction-table-wrapper-scroll-button-border-width) ;
39
+ border-style:var(--conduction-table-wrapper-scroll-button-border-style) ;
40
+ border-color:var(--conduction-table-wrapper-scroll-button-border-color) ;
41
+ }
42
+
43
+ .scrollLeftButton:hover,
44
+ .scrollRightButton:hover {
45
+ background-color: var(--conduction-table-wrapper-scroll-button-hover-background-color);
46
+ color: var(--conduction-table-wrapper-scroll-button-hover-color);
47
+ cursor: pointer;
48
+ }
49
+
50
+ .scrollRightButton {
51
+ right: 0;
52
+ }
53
+
54
+ .scrollLeftButton {
55
+ left: 0;
56
+ }
57
+
58
+ .scrollButton {
59
+ align-self: center;
60
+ }
61
+
62
+ /* Hide scrollbar */
63
+ .wrapper::-webkit-scrollbar {
64
+ display: none;
65
+ }
66
+ .wrapper {
67
+ -ms-overflow-style: none;
68
+ scrollbar-width: none;
69
+ }
@@ -1,11 +1,39 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState, useEffect } from "react";
2
3
  import * as styles from "./Tabs.module.css";
3
4
  import { Tabs as RTabs, TabList as RTabList, Tab as RTab, TabPanel as RTabPanel, } from "react-tabs";
5
+ import clsx from "clsx";
6
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
7
+ import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
4
8
  // Tabs
5
9
  export const Tabs = ({ children, ...otherProps }) => (_jsx(RTabs, { className: styles.tabs, ...otherProps, children: children }));
6
10
  Tabs.tabsRole = "Tabs";
7
11
  // TabList
8
- export const TabList = ({ children, ...otherProps }) => (_jsx(RTabList, { className: styles.tabList, ...otherProps, children: children }));
12
+ export const TabList = ({ children, ...otherProps }) => {
13
+ const [canScrollRight, setCanScrollRight] = useState(false);
14
+ const [canScrollLeft, setCanScrollLeft] = useState(false);
15
+ const wrapperRef = React.useRef(null);
16
+ const handleScroll = () => {
17
+ if (wrapperRef.current) {
18
+ setCanScrollLeft(wrapperRef.current.scrollLeft > 0);
19
+ setCanScrollRight(wrapperRef.current.scrollWidth - wrapperRef.current.scrollLeft > wrapperRef.current.clientWidth);
20
+ }
21
+ };
22
+ const handleScrollRight = () => {
23
+ if (wrapperRef.current)
24
+ wrapperRef.current.scrollTo({ left: wrapperRef.current.scrollWidth, behavior: "smooth" });
25
+ };
26
+ const handleScrollLeft = () => {
27
+ if (wrapperRef.current)
28
+ wrapperRef.current.scrollTo({ left: 0, behavior: "smooth" });
29
+ };
30
+ useEffect(() => {
31
+ if (wrapperRef.current) {
32
+ setCanScrollRight(wrapperRef.current.scrollWidth > wrapperRef.current.clientWidth); // initiate scroll
33
+ }
34
+ }, []);
35
+ return (_jsx("div", { className: styles.container, children: _jsx("div", { onScroll: handleScroll, ref: wrapperRef, className: clsx(styles.wrapper), children: _jsxs("div", { className: styles.tabListContainer, children: [canScrollLeft && (_jsx("div", { onClick: handleScrollLeft, className: clsx(canScrollLeft && styles.scrollLeftButton, styles.tabButton), children: _jsx("span", { className: styles.scrollButton, children: _jsx(FontAwesomeIcon, { icon: faChevronLeft }) }) })), _jsx(RTabList, { className: styles.tabList, ...otherProps, children: children }), canScrollRight && (_jsx("div", { onClick: handleScrollRight, className: clsx(canScrollRight && styles.scrollRightButton, styles.tabButton), children: _jsx("span", { className: styles.scrollButton, children: _jsx(FontAwesomeIcon, { icon: faChevronRight }) }) }))] }) }) }));
36
+ };
9
37
  TabList.tabsRole = "TabList";
10
38
  // Tab
11
39
  export const Tab = ({ children, ...otherProps }) => (_jsx(RTab, { className: styles.tab, ...otherProps, children: children }));
@@ -21,6 +21,14 @@
21
21
  /* --conduction-tabs-tab-letter-spacing: 0.02857em; */
22
22
  /* --conduction-tabs-tab-text-transform: uppercase; */
23
23
 
24
+ --conduction-tabs-scroll-button-background-color: #ffffff;
25
+ --conduction-tabs-scroll-button-color: #4a4a4a;
26
+ --conduction-tabs-scroll-button-hover-background-color: #ffffff;
27
+ --conduction-tabs-scroll-button-hover-color: #4376fc;
28
+ /* --conduction-tabs-scroll-button-border-width: 1px; */
29
+ /* --conduction-tabs-scroll-button-border-style: solid; */
30
+ /* --conduction-tabs-scroll-button-border-color: #4376fc; */
31
+
24
32
  --conduction-tabs-tab-selected-background-color: #ffffff;
25
33
  --conduction-tabs-tab-selected-color: #4a4a4a;
26
34
  /* --conduction-tabs-tab-selected-box-shadow: 0px 1px 0px 1px #ffffff; */
@@ -83,7 +91,45 @@
83
91
  padding-block-end: var(--conduction-tabs-tab-padding-block-end);
84
92
  padding-inline-start: var(--conduction-tabs-tab-padding-inline-start);
85
93
  padding-inline-end: var(--conduction-tabs-tab-padding-inline-end);
86
- margin-inline-end: var(--conduction-tabs-tab-margin-inline-end);
94
+ font-size: var(--conduction-tabs-tab-font-size);
95
+ font-weight: var(--conduction-tabs-tab-font-weight);
96
+ font-family: var(--conduction-tabs-tab-font-family);
97
+ min-height: var(--conduction-tabs-tab-min-height);
98
+ letter-spacing: var(--conduction-tabs-tab-letter-spacing);
99
+ text-transform: var(--conduction-tabs-tab-text-transform);
100
+ flex-shrink: 0;
101
+ }
102
+
103
+ .tabButton {
104
+ display: inline-flex;
105
+ align-items: center;
106
+ justify-content: center;
107
+ cursor: pointer;
108
+ overflow: hidden;
109
+ position: relative;
110
+ box-sizing: border-box;
111
+ text-align: center;
112
+ white-space: normal;
113
+
114
+ border-width: var(
115
+ --conduction-tabs-scroll-button-border-width,
116
+ var(--conduction-tabs-tab-border-width)
117
+ );
118
+ border-style: var(
119
+ --conduction-tabs-scroll-button-border-style,
120
+ var(--conduction-tabs-tab-border-style)
121
+ );
122
+ border-color: var(
123
+ --conduction-tabs-scroll-button-border-color,
124
+ var(--conduction-tabs-tab-border-color)
125
+ );
126
+ background-color: var(--conduction-tabs-scroll-button-background-color);
127
+ color: var(--conduction-tabs-tab-button-color);
128
+ bottom: var(--conduction-tabs-tab-bottom);
129
+ padding-block-start: var(--conduction-tabs-tab-padding-block-start);
130
+ padding-block-end: var(--conduction-tabs-tab-padding-block-end);
131
+ padding-inline-start: var(--conduction-tabs-tab-padding-inline-start);
132
+ padding-inline-end: var(--conduction-tabs-tab-padding-inline-end);
87
133
  font-size: var(--conduction-tabs-tab-font-size);
88
134
  font-weight: var(--conduction-tabs-tab-font-weight);
89
135
  font-family: var(--conduction-tabs-tab-font-family);
@@ -92,6 +138,19 @@
92
138
  text-transform: var(--conduction-tabs-tab-text-transform);
93
139
  }
94
140
 
141
+ .tabButton:hover {
142
+ background-color: var(--conduction-tabs-scroll-button-hover-background-color);
143
+ color: var(--conduction-tabs-scroll-button-hover-color);
144
+ }
145
+ .tabButton:hover > * {
146
+ background-color: var(--conduction-tabs-scroll-button-hover-background-color);
147
+ color: var(--conduction-tabs-scroll-button-hover-color);
148
+ }
149
+
150
+ .tabListContainer {
151
+ flex: 0 0 100%; /* Let it fill the entire space horizontally */
152
+ }
153
+
95
154
  /* TabSelected */
96
155
  .tab[aria-selected="true"] {
97
156
  background-color: var(--conduction-tabs-tab-selected-background-color);
@@ -126,6 +185,10 @@
126
185
  border-bottom-width: var(--conduction-tabs-tab-list-border-bottom-width);
127
186
  border-bottom-style: var(--conduction-tabs-tab-list-border-bottom-style);
128
187
  border-bottom-color: var(--conduction-tabs-tab-list-border-bottom-color);
188
+ width: max-content;
189
+ }
190
+ .tabList :not(:last-child) {
191
+ margin-inline-end: var(--conduction-tabs-tab-margin-inline-end);
129
192
  }
130
193
 
131
194
  /* TabPanel */
@@ -140,3 +203,43 @@
140
203
  border-color: var(--conduction-tabs-tab-panel-border-color);
141
204
  border-top: var(--conduction-tabs-tab-panel-border-top);
142
205
  }
206
+
207
+ .scrollButton {
208
+ background-color: var(--conduction-tabs-scroll-button-background-color);
209
+ color: var(--conduction-tabs-scroll-button-color);
210
+ }
211
+
212
+ .container {
213
+ position: relative;
214
+ }
215
+
216
+ .wrapper {
217
+ overflow-x: scroll;
218
+ display: flex;
219
+ }
220
+ .wrapperTouchscreen {
221
+ overflow-x: scroll;
222
+ }
223
+
224
+ .scrollRightButton,
225
+ .scrollLeftButton {
226
+ position: absolute;
227
+ }
228
+
229
+ .scrollRightButton {
230
+ right: 0;
231
+ }
232
+
233
+ .scrollLeftButton {
234
+ left: 0;
235
+ z-index: 1;
236
+ }
237
+
238
+ /* Hide scrollbar */
239
+ .wrapper::-webkit-scrollbar {
240
+ display: none;
241
+ }
242
+ .wrapper {
243
+ -ms-overflow-style: none;
244
+ scrollbar-width: none;
245
+ }
package/lib/index.d.ts CHANGED
@@ -23,4 +23,5 @@ import { CodeBlock } from "./components/codeBlock/CodeBlock";
23
23
  import { ToolTip } from "./components/toolTip/ToolTip";
24
24
  import { Pagination } from "./components/Pagination/Pagination";
25
25
  import { Tabs, TabList, Tab, TabPanel } from "./components/tabs/Tabs";
26
- export { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, DetailsCard, InfoCard, Container, Breadcrumbs, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile, Textarea, InputCheckbox, SelectMultiple, SelectSingle, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, PrimaryTopNav, SecondaryTopNav, Tag, NotificationPopUp, QuoteWrapper, Pagination, BadgeCounter, CodeBlock, ToolTip, Tabs, TabList, Tab, TabPanel, };
26
+ import { TableWrapper } from "./components/tableWrapper/TableWrapper";
27
+ export { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, DetailsCard, InfoCard, Container, Breadcrumbs, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile, Textarea, InputCheckbox, SelectMultiple, SelectSingle, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, PrimaryTopNav, SecondaryTopNav, Tag, NotificationPopUp, QuoteWrapper, Pagination, BadgeCounter, CodeBlock, ToolTip, Tabs, TabList, Tab, TabPanel, TableWrapper };
package/lib/index.js CHANGED
@@ -16,4 +16,5 @@ import { CodeBlock } from "./components/codeBlock/CodeBlock";
16
16
  import { ToolTip } from "./components/toolTip/ToolTip";
17
17
  import { Pagination } from "./components/Pagination/Pagination";
18
18
  import { Tabs, TabList, Tab, TabPanel } from "./components/tabs/Tabs";
19
- export { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, DetailsCard, InfoCard, Container, Breadcrumbs, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile, Textarea, InputCheckbox, SelectMultiple, SelectSingle, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, PrimaryTopNav, SecondaryTopNav, Tag, NotificationPopUp, QuoteWrapper, Pagination, BadgeCounter, CodeBlock, ToolTip, Tabs, TabList, Tab, TabPanel, };
19
+ import { TableWrapper } from "./components/tableWrapper/TableWrapper";
20
+ export { DownloadCard, HorizontalImageCard, ImageAndDetailsCard, DetailsCard, InfoCard, Container, Breadcrumbs, InputText, InputPassword, InputEmail, InputDate, InputNumber, InputFile, Textarea, InputCheckbox, SelectMultiple, SelectSingle, ImageDivider, AuthenticatedLogo, UnauthenticatedLogo, MetaIcon, PrivateRoute, PrimaryTopNav, SecondaryTopNav, Tag, NotificationPopUp, QuoteWrapper, Pagination, BadgeCounter, CodeBlock, ToolTip, Tabs, TabList, Tab, TabPanel, TableWrapper };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@conduction/components",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
4
4
  "description": "React (Gatsby) components used within the Conduction Skeleton Application (and its implementations)",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -0,0 +1,69 @@
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
+ overflow-x: scroll;
21
+ }
22
+ .wrapperTouchscreen {
23
+ overflow-x: scroll;
24
+ }
25
+
26
+ .scrollRightButton,
27
+ .scrollLeftButton {
28
+ top: 0%;
29
+ position: absolute;
30
+ display: flex;
31
+ height: 100%;
32
+ background-color: var(--conduction-table-wrapper-scroll-button-background-color);
33
+ color: var(--conduction-table-wrapper-scroll-button-color);
34
+ padding-inline-start: var(--conduction-table-wrapper-scroll-button-padding-inline-start);
35
+ padding-inline-end: var(--conduction-table-wrapper-scroll-button-padding-inline-end);
36
+ padding-block-start: var(--conduction-table-wrapper-scroll-button-padding-block-start);
37
+ padding-block-end: var(--conduction-table-wrapper-scroll-button-padding-block-end);
38
+ border-width:var(--conduction-table-wrapper-scroll-button-border-width) ;
39
+ border-style:var(--conduction-table-wrapper-scroll-button-border-style) ;
40
+ border-color:var(--conduction-table-wrapper-scroll-button-border-color) ;
41
+ }
42
+
43
+ .scrollLeftButton:hover,
44
+ .scrollRightButton:hover {
45
+ background-color: var(--conduction-table-wrapper-scroll-button-hover-background-color);
46
+ color: var(--conduction-table-wrapper-scroll-button-hover-color);
47
+ cursor: pointer;
48
+ }
49
+
50
+ .scrollRightButton {
51
+ right: 0;
52
+ }
53
+
54
+ .scrollLeftButton {
55
+ left: 0;
56
+ }
57
+
58
+ .scrollButton {
59
+ align-self: center;
60
+ }
61
+
62
+ /* Hide scrollbar */
63
+ .wrapper::-webkit-scrollbar {
64
+ display: none;
65
+ }
66
+ .wrapper {
67
+ -ms-overflow-style: none;
68
+ scrollbar-width: none;
69
+ }
@@ -0,0 +1,68 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import * as styles from "./TableWrapper.module.css";
3
+ import clsx from "clsx";
4
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
5
+ import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
6
+
7
+ interface TableWrapperProps {
8
+ touchScreen?: boolean;
9
+ }
10
+
11
+ export const TableWrapper: React.FC<{ children: React.ReactNode } & TableWrapperProps> = ({
12
+ children,
13
+ touchScreen,
14
+ }) => {
15
+ const [canScrollRight, setCanScrollRight] = useState(false);
16
+ const [canScrollLeft, setCanScrollLeft] = useState(false);
17
+
18
+ const wrapperRef = React.useRef<HTMLDivElement | null>(null);
19
+
20
+ const handleScroll = () => {
21
+ if (wrapperRef.current) {
22
+ setCanScrollLeft(wrapperRef.current.scrollLeft > 0);
23
+ setCanScrollRight(
24
+ wrapperRef.current.scrollWidth - wrapperRef.current.scrollLeft > wrapperRef.current.clientWidth,
25
+ );
26
+ }
27
+ };
28
+
29
+ const handleScrollRight = () => {
30
+ if (wrapperRef.current) wrapperRef.current.scrollTo({ left: wrapperRef.current.scrollWidth, behavior: "smooth" });
31
+ };
32
+
33
+ const handleScrollLeft = () => {
34
+ if (wrapperRef.current) wrapperRef.current.scrollTo({ left: 0, behavior: "smooth" });
35
+ };
36
+
37
+ useEffect(() => {
38
+ if (wrapperRef.current) {
39
+ setCanScrollRight(wrapperRef.current.scrollWidth > wrapperRef.current.clientWidth); // initiate scroll
40
+ }
41
+ }, []);
42
+
43
+ return (
44
+ <div className={styles.container}>
45
+ <div
46
+ onScroll={handleScroll}
47
+ ref={wrapperRef}
48
+ className={clsx(touchScreen ? styles.wrapperTouchscreen : styles.wrapper)}
49
+ >
50
+ {canScrollLeft && !touchScreen && (
51
+ <div onClick={handleScrollLeft} className={styles.scrollLeftButton}>
52
+ <div className={styles.scrollButton}>
53
+ <FontAwesomeIcon icon={faChevronLeft} />
54
+ </div>
55
+ </div>
56
+ )}
57
+ {children}
58
+ {canScrollRight && !touchScreen && (
59
+ <div onClick={handleScrollRight} className={styles.scrollRightButton}>
60
+ <div className={styles.scrollButton}>
61
+ <FontAwesomeIcon icon={faChevronRight} />
62
+ </div>
63
+ </div>
64
+ )}
65
+ </div>
66
+ </div>
67
+ );
68
+ };
@@ -21,6 +21,14 @@
21
21
  /* --conduction-tabs-tab-letter-spacing: 0.02857em; */
22
22
  /* --conduction-tabs-tab-text-transform: uppercase; */
23
23
 
24
+ --conduction-tabs-scroll-button-background-color: #ffffff;
25
+ --conduction-tabs-scroll-button-color: #4a4a4a;
26
+ --conduction-tabs-scroll-button-hover-background-color: #ffffff;
27
+ --conduction-tabs-scroll-button-hover-color: #4376fc;
28
+ /* --conduction-tabs-scroll-button-border-width: 1px; */
29
+ /* --conduction-tabs-scroll-button-border-style: solid; */
30
+ /* --conduction-tabs-scroll-button-border-color: #4376fc; */
31
+
24
32
  --conduction-tabs-tab-selected-background-color: #ffffff;
25
33
  --conduction-tabs-tab-selected-color: #4a4a4a;
26
34
  /* --conduction-tabs-tab-selected-box-shadow: 0px 1px 0px 1px #ffffff; */
@@ -83,7 +91,45 @@
83
91
  padding-block-end: var(--conduction-tabs-tab-padding-block-end);
84
92
  padding-inline-start: var(--conduction-tabs-tab-padding-inline-start);
85
93
  padding-inline-end: var(--conduction-tabs-tab-padding-inline-end);
86
- margin-inline-end: var(--conduction-tabs-tab-margin-inline-end);
94
+ font-size: var(--conduction-tabs-tab-font-size);
95
+ font-weight: var(--conduction-tabs-tab-font-weight);
96
+ font-family: var(--conduction-tabs-tab-font-family);
97
+ min-height: var(--conduction-tabs-tab-min-height);
98
+ letter-spacing: var(--conduction-tabs-tab-letter-spacing);
99
+ text-transform: var(--conduction-tabs-tab-text-transform);
100
+ flex-shrink: 0;
101
+ }
102
+
103
+ .tabButton {
104
+ display: inline-flex;
105
+ align-items: center;
106
+ justify-content: center;
107
+ cursor: pointer;
108
+ overflow: hidden;
109
+ position: relative;
110
+ box-sizing: border-box;
111
+ text-align: center;
112
+ white-space: normal;
113
+
114
+ border-width: var(
115
+ --conduction-tabs-scroll-button-border-width,
116
+ var(--conduction-tabs-tab-border-width)
117
+ );
118
+ border-style: var(
119
+ --conduction-tabs-scroll-button-border-style,
120
+ var(--conduction-tabs-tab-border-style)
121
+ );
122
+ border-color: var(
123
+ --conduction-tabs-scroll-button-border-color,
124
+ var(--conduction-tabs-tab-border-color)
125
+ );
126
+ background-color: var(--conduction-tabs-scroll-button-background-color);
127
+ color: var(--conduction-tabs-tab-button-color);
128
+ bottom: var(--conduction-tabs-tab-bottom);
129
+ padding-block-start: var(--conduction-tabs-tab-padding-block-start);
130
+ padding-block-end: var(--conduction-tabs-tab-padding-block-end);
131
+ padding-inline-start: var(--conduction-tabs-tab-padding-inline-start);
132
+ padding-inline-end: var(--conduction-tabs-tab-padding-inline-end);
87
133
  font-size: var(--conduction-tabs-tab-font-size);
88
134
  font-weight: var(--conduction-tabs-tab-font-weight);
89
135
  font-family: var(--conduction-tabs-tab-font-family);
@@ -92,6 +138,19 @@
92
138
  text-transform: var(--conduction-tabs-tab-text-transform);
93
139
  }
94
140
 
141
+ .tabButton:hover {
142
+ background-color: var(--conduction-tabs-scroll-button-hover-background-color);
143
+ color: var(--conduction-tabs-scroll-button-hover-color);
144
+ }
145
+ .tabButton:hover > * {
146
+ background-color: var(--conduction-tabs-scroll-button-hover-background-color);
147
+ color: var(--conduction-tabs-scroll-button-hover-color);
148
+ }
149
+
150
+ .tabListContainer {
151
+ flex: 0 0 100%; /* Let it fill the entire space horizontally */
152
+ }
153
+
95
154
  /* TabSelected */
96
155
  .tab[aria-selected="true"] {
97
156
  background-color: var(--conduction-tabs-tab-selected-background-color);
@@ -126,6 +185,10 @@
126
185
  border-bottom-width: var(--conduction-tabs-tab-list-border-bottom-width);
127
186
  border-bottom-style: var(--conduction-tabs-tab-list-border-bottom-style);
128
187
  border-bottom-color: var(--conduction-tabs-tab-list-border-bottom-color);
188
+ width: max-content;
189
+ }
190
+ .tabList :not(:last-child) {
191
+ margin-inline-end: var(--conduction-tabs-tab-margin-inline-end);
129
192
  }
130
193
 
131
194
  /* TabPanel */
@@ -140,3 +203,43 @@
140
203
  border-color: var(--conduction-tabs-tab-panel-border-color);
141
204
  border-top: var(--conduction-tabs-tab-panel-border-top);
142
205
  }
206
+
207
+ .scrollButton {
208
+ background-color: var(--conduction-tabs-scroll-button-background-color);
209
+ color: var(--conduction-tabs-scroll-button-color);
210
+ }
211
+
212
+ .container {
213
+ position: relative;
214
+ }
215
+
216
+ .wrapper {
217
+ overflow-x: scroll;
218
+ display: flex;
219
+ }
220
+ .wrapperTouchscreen {
221
+ overflow-x: scroll;
222
+ }
223
+
224
+ .scrollRightButton,
225
+ .scrollLeftButton {
226
+ position: absolute;
227
+ }
228
+
229
+ .scrollRightButton {
230
+ right: 0;
231
+ }
232
+
233
+ .scrollLeftButton {
234
+ left: 0;
235
+ z-index: 1;
236
+ }
237
+
238
+ /* Hide scrollbar */
239
+ .wrapper::-webkit-scrollbar {
240
+ display: none;
241
+ }
242
+ .wrapper {
243
+ -ms-overflow-style: none;
244
+ scrollbar-width: none;
245
+ }
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import React, { useState, useEffect } from "react";
2
2
  import * as styles from "./Tabs.module.css";
3
3
  import {
4
4
  Tabs as RTabs,
@@ -11,6 +11,9 @@ import {
11
11
  TabListProps,
12
12
  TabsProps,
13
13
  } from "react-tabs";
14
+ import clsx from "clsx";
15
+ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
16
+ import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
14
17
 
15
18
  // Tabs
16
19
  export const Tabs: ReactTabsFunctionComponent<TabsProps> = ({ children, ...otherProps }) => (
@@ -22,11 +25,67 @@ export const Tabs: ReactTabsFunctionComponent<TabsProps> = ({ children, ...other
22
25
  Tabs.tabsRole = "Tabs";
23
26
 
24
27
  // TabList
25
- export const TabList: ReactTabsFunctionComponent<TabListProps> = ({ children, ...otherProps }) => (
26
- <RTabList className={styles.tabList} {...otherProps}>
27
- {children}
28
- </RTabList>
29
- );
28
+ export const TabList: ReactTabsFunctionComponent<TabListProps> = ({ children, ...otherProps }) => {
29
+ const [canScrollRight, setCanScrollRight] = useState(false);
30
+ const [canScrollLeft, setCanScrollLeft] = useState(false);
31
+
32
+ const wrapperRef = React.useRef<HTMLDivElement | null>(null);
33
+
34
+ const handleScroll = () => {
35
+ if (wrapperRef.current) {
36
+ setCanScrollLeft(wrapperRef.current.scrollLeft > 0);
37
+ setCanScrollRight(
38
+ wrapperRef.current.scrollWidth - wrapperRef.current.scrollLeft > wrapperRef.current.clientWidth,
39
+ );
40
+ }
41
+ };
42
+
43
+ const handleScrollRight = () => {
44
+ if (wrapperRef.current) wrapperRef.current.scrollTo({ left: wrapperRef.current.scrollWidth, behavior: "smooth" });
45
+ };
46
+
47
+ const handleScrollLeft = () => {
48
+ if (wrapperRef.current) wrapperRef.current.scrollTo({ left: 0, behavior: "smooth" });
49
+ };
50
+
51
+ useEffect(() => {
52
+ if (wrapperRef.current) {
53
+ setCanScrollRight(wrapperRef.current.scrollWidth > wrapperRef.current.clientWidth); // initiate scroll
54
+ }
55
+ }, []);
56
+
57
+ return (
58
+ <div className={styles.container}>
59
+ <div onScroll={handleScroll} ref={wrapperRef} className={clsx(styles.wrapper)}>
60
+ <div className={styles.tabListContainer}>
61
+ {canScrollLeft && (
62
+ <div
63
+ onClick={handleScrollLeft}
64
+ className={clsx(canScrollLeft && styles.scrollLeftButton, styles.tabButton)}
65
+ >
66
+ <span className={styles.scrollButton}>
67
+ <FontAwesomeIcon icon={faChevronLeft} />
68
+ </span>
69
+ </div>
70
+ )}
71
+ <RTabList className={styles.tabList} {...otherProps}>
72
+ {children}
73
+ </RTabList>
74
+ {canScrollRight && (
75
+ <div
76
+ onClick={handleScrollRight}
77
+ className={clsx(canScrollRight && styles.scrollRightButton, styles.tabButton)}
78
+ >
79
+ <span className={styles.scrollButton}>
80
+ <FontAwesomeIcon icon={faChevronRight} />
81
+ </span>
82
+ </div>
83
+ )}
84
+ </div>
85
+ </div>
86
+ </div>
87
+ );
88
+ };
30
89
 
31
90
  TabList.tabsRole = "TabList";
32
91
 
package/src/index.ts CHANGED
@@ -30,6 +30,7 @@ import { CodeBlock } from "./components/codeBlock/CodeBlock";
30
30
  import { ToolTip } from "./components/toolTip/ToolTip";
31
31
  import { Pagination } from "./components/Pagination/Pagination";
32
32
  import { Tabs, TabList, Tab, TabPanel } from "./components/tabs/Tabs";
33
+ import { TableWrapper } from "./components/tableWrapper/TableWrapper";
33
34
 
34
35
  export {
35
36
  DownloadCard,
@@ -67,4 +68,5 @@ export {
67
68
  TabList,
68
69
  Tab,
69
70
  TabPanel,
71
+ TableWrapper
70
72
  };