@madie/madie-design-system 1.0.42 → 1.0.45
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/components/Tabs/Tab.js +73 -12
- package/components/Tabs/Tabs.stories.js +93 -112
- package/components/Tabs/index.js +75 -72
- package/components/index.js +2 -0
- package/coverage/clover.xml +42 -439
- package/coverage/coverage-final.json +2 -30
- package/coverage/lcov-report/Tab.js.html +334 -0
- package/coverage/lcov-report/Tabs/Tab.js.html +343 -0
- package/coverage/lcov-report/Tabs/index.html +131 -0
- package/coverage/lcov-report/Tabs/index.js.html +388 -0
- package/coverage/lcov-report/Toast/index.html +116 -0
- package/coverage/lcov-report/Toast/index.jsx.html +430 -0
- package/coverage/lcov-report/index.html +19 -304
- package/coverage/lcov-report/index.js.html +109 -112
- package/coverage/lcov-report/react/components/Accordion/index.html +1 -1
- package/coverage/lcov-report/react/components/Accordion/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Button/index.html +1 -1
- package/coverage/lcov-report/react/components/Button/index.js.html +1 -1
- package/coverage/lcov-report/react/components/Error/Collapsible.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Error/ErrorUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Error/error.js.html +1 -1
- package/coverage/lcov-report/react/components/Error/index.html +1 -1
- package/coverage/lcov-report/react/components/Footer/FooterUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Footer/LegacyFooterUI.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Footer/footer.js.html +1 -1
- package/coverage/lcov-report/react/components/Footer/index.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/Infotip.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/InfotipIcon.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/index.html +1 -1
- package/coverage/lcov-report/react/components/Infotip/index.js.html +1 -1
- package/coverage/lcov-report/react/components/InputLabel/index.html +1 -1
- package/coverage/lcov-report/react/components/InputLabel/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieAlert/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieAlert/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDeleteDialog/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieDialog/Index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieDiscardDialog/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/MadieSpinner/index.html +1 -1
- package/coverage/lcov-report/react/components/MadieSpinner/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Pagination/index.html +1 -1
- package/coverage/lcov-report/react/components/Pagination/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Popover/index.html +1 -1
- package/coverage/lcov-report/react/components/Popover/index.js.html +1 -1
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.html +1 -1
- package/coverage/lcov-report/react/components/ReadOnlyTextField/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Select/index.html +1 -1
- package/coverage/lcov-report/react/components/Select/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tabs/Tab.js.html +334 -0
- package/coverage/lcov-report/react/components/Tabs/index.html +131 -0
- package/coverage/lcov-report/react/components/Tabs/index.js.html +382 -0
- package/coverage/lcov-report/react/components/TextArea/index.html +1 -1
- package/coverage/lcov-report/react/components/TextArea/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Textfield/index.html +1 -1
- package/coverage/lcov-report/react/components/Textfield/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Toast/index.html +1 -1
- package/coverage/lcov-report/react/components/Toast/index.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/Tooltip.jsx.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/index.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/index.js.html +1 -1
- package/coverage/lcov-report/react/components/Tooltip/position.js.html +1 -1
- package/coverage/lcov-report/react/index.html +1 -1
- package/coverage/lcov-report/react/index.js.html +1 -1
- package/coverage/lcov-report/react/lib/Chevron.jsx.html +1 -1
- package/coverage/lcov-report/react/lib/SvgComponents.jsx.html +1 -1
- package/coverage/lcov-report/react/lib/index.html +1 -1
- package/coverage/lcov.info +67 -921
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react/index.js +14 -14
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.24906d7d.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -1
- package/test/components/Tabs.test.js +293 -0
- package/test/components/TextArea.test.js +1 -1
- package/storybook-static/main.d5b28a8d.iframe.bundle.js +0 -1
package/components/Tabs/Tab.js
CHANGED
|
@@ -2,25 +2,86 @@ import React from "react";
|
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { Tab as MuiTab } from "@mui/material";
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const typeA = {
|
|
6
|
+
color: "#fff",
|
|
7
|
+
borderRadius: "4px 4px 0px 0px !important",
|
|
8
|
+
backgroundColor: "#003366",
|
|
9
|
+
"&:hover":{
|
|
10
|
+
background: "#001F3D"
|
|
11
|
+
},
|
|
12
|
+
"&:focus":{
|
|
13
|
+
background: "#125496",
|
|
14
|
+
boxShadow: "0px 0px 0px 4px #CBE4FF",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const typeB = {
|
|
18
|
+
color: "#515151",
|
|
19
|
+
"&:hover":{
|
|
20
|
+
background: "#F2F9FF",
|
|
21
|
+
color: "#242424"
|
|
22
|
+
},
|
|
23
|
+
"&:focus":{
|
|
24
|
+
boxShadow: "0px 0px 0px 4px #CBE4FF",
|
|
25
|
+
background: "#fff"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const typeC = {
|
|
29
|
+
color: "#333",
|
|
30
|
+
background: "#EDEDED",
|
|
31
|
+
"&:hover":{
|
|
32
|
+
background: "#FAFAFA",
|
|
33
|
+
color: "#515151"
|
|
34
|
+
},
|
|
35
|
+
"&:focus":{
|
|
36
|
+
boxShadow: "0px 0px 0px 4px #CBE4FF",
|
|
37
|
+
background: "#fff"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const Tab = ({ type, orientation, size, ...rest }) => {
|
|
43
|
+
const baseStyle = {
|
|
44
|
+
height: size === 'standard' ? '48px' : '60px',
|
|
45
|
+
fontFamily: "Rubik, sans serif",
|
|
46
|
+
fontWeight: 400,
|
|
47
|
+
padding: size === 'standard' ? "14.5px 24.5px" : "20.5px 24px",
|
|
48
|
+
textTransform: "none",
|
|
49
|
+
fontSize: "16px",
|
|
50
|
+
alignItems: orientation === 'vertical' && "flex-start",
|
|
51
|
+
'& .Mui-disabled': {
|
|
52
|
+
background: "#DDDDDD",
|
|
53
|
+
color: "#717171"
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
const style = ((type) => {
|
|
57
|
+
if (type === "A") {
|
|
58
|
+
return { ...baseStyle, ...typeA}
|
|
59
|
+
}
|
|
60
|
+
if (type === "B" || type === "D") {
|
|
61
|
+
return { ...baseStyle, ...typeB, }
|
|
62
|
+
}
|
|
63
|
+
if (type === "C") {
|
|
64
|
+
return { ...baseStyle, ...typeC}
|
|
65
|
+
}
|
|
66
|
+
})(type)
|
|
6
67
|
return (
|
|
7
|
-
<MuiTab
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onClick={(e) => {
|
|
11
|
-
e.preventDefault();
|
|
12
|
-
if (window.history && href) {
|
|
13
|
-
window.history.replaceState({}, document.title, href);
|
|
14
|
-
}
|
|
15
|
-
}}
|
|
16
|
-
className="qpp-c-tabs__item"
|
|
68
|
+
<MuiTab
|
|
69
|
+
tabIndex={0}
|
|
70
|
+
sx={style}
|
|
17
71
|
{...rest}
|
|
18
72
|
/>
|
|
19
73
|
);
|
|
20
74
|
};
|
|
21
75
|
|
|
22
76
|
Tab.propTypes = {
|
|
23
|
-
|
|
77
|
+
orientation: PropTypes.string,
|
|
78
|
+
type: PropTypes.oneOf(["A", "B", "C", "D"]),
|
|
79
|
+
size: PropTypes.oneOf(["standard", "large"]),
|
|
80
|
+
};
|
|
81
|
+
Tab.defaultProps = {
|
|
82
|
+
type: "A",
|
|
83
|
+
size: "standard",
|
|
84
|
+
onChange: null,
|
|
24
85
|
};
|
|
25
86
|
|
|
26
87
|
export default Tab;
|
|
@@ -2,8 +2,8 @@ import React, { useState } from "react";
|
|
|
2
2
|
import { withKnobs } from "@storybook/addon-knobs";
|
|
3
3
|
|
|
4
4
|
import Tabs from "./index";
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import Tab from './Tab';
|
|
6
|
+
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: "Tabs",
|
|
@@ -11,120 +11,101 @@ export default {
|
|
|
11
11
|
decorators: [withKnobs],
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
<Tabs>
|
|
18
|
-
<TabPanel
|
|
19
|
-
id="summary"
|
|
20
|
-
tab="Summary"
|
|
21
|
-
className="my-summary-class"
|
|
22
|
-
>
|
|
23
|
-
The Bill of Rights is the first ten amendments to the United
|
|
24
|
-
States Constitution.
|
|
25
|
-
</TabPanel>
|
|
26
|
-
<TabPanel id="preamble" tab="Preamble">
|
|
27
|
-
We the People of the United States, in Order to form a more
|
|
28
|
-
perfect Union, establish Justice, insure domestic
|
|
29
|
-
Tranquility, provide for the common defence, promote the
|
|
30
|
-
general Welfare, and secure the Blessings of Liberty to
|
|
31
|
-
ourselves and our Posterity, do ordain and establish this
|
|
32
|
-
Constitution for the United States of America.
|
|
33
|
-
</TabPanel>
|
|
34
|
-
<TabPanel id="amendments" tab="Amendments">
|
|
35
|
-
<h2 className="ds-h4">Bill of Rights</h2>
|
|
36
|
-
<ol className="ds-c-list">
|
|
37
|
-
<li>Freedoms, Petitions, Assembly</li>
|
|
38
|
-
<li>Right to bear arms</li>
|
|
39
|
-
<li>Quartering of soldiers</li>
|
|
40
|
-
<li>Search and arrest</li>
|
|
41
|
-
<li>Rights in criminal cases</li>
|
|
42
|
-
<li>Right to a fair trial</li>
|
|
43
|
-
<li>Rights in civil cases</li>
|
|
44
|
-
<li>Bail, fines, punishment</li>
|
|
45
|
-
<li>Rights retained by the People</li>
|
|
46
|
-
<li>States’ rights</li>
|
|
47
|
-
</ol>
|
|
14
|
+
export const TypeA = () => {
|
|
15
|
+
// state, setState
|
|
16
|
+
const [selected, setSelected] = useState(1)
|
|
48
17
|
|
|
49
|
-
<h2 className="ds-h4">Later Amendments</h2>
|
|
50
|
-
<ol className="ds-c-list" start="11">
|
|
51
|
-
<li>Lawsuits against states</li>
|
|
52
|
-
<li>Presidential elections</li>
|
|
53
|
-
<li>Abolition of slavery</li>
|
|
54
|
-
<li>Civil rights</li>
|
|
55
|
-
<li>Black suffrage</li>
|
|
56
|
-
<li>Income taxes</li>
|
|
57
|
-
<li>Senatorial elections</li>
|
|
58
|
-
<li>Prohibition of liquor</li>
|
|
59
|
-
<li>Women’s suffrage</li>
|
|
60
|
-
<li>Terms of office</li>
|
|
61
|
-
<li>Repeal of Prohibition</li>
|
|
62
|
-
<li>Term Limits for the Presidency</li>
|
|
63
|
-
<li>Washington, D.C., suffrage</li>
|
|
64
|
-
<li>Abolition of poll taxes</li>
|
|
65
|
-
<li>Presidential succession</li>
|
|
66
|
-
<li>18-year-old suffrage</li>
|
|
67
|
-
<li>Congressional pay raises</li>
|
|
68
|
-
</ol>
|
|
69
18
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
number of the counting shall be three
|
|
76
|
-
</li>
|
|
77
|
-
<li>Four shalt thou not count</li>
|
|
78
|
-
<li>
|
|
79
|
-
Neither shalt thou count two, excepting that thou
|
|
80
|
-
then proceedeth to three
|
|
81
|
-
</li>
|
|
82
|
-
<li>Five is right out</li>
|
|
83
|
-
</ol>
|
|
84
|
-
</TabPanel>
|
|
85
|
-
<TabPanel id="disabled" tab="Disabled" disabled>
|
|
86
|
-
You should not see this.
|
|
87
|
-
</TabPanel>
|
|
88
|
-
</Tabs>
|
|
89
|
-
</div>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
19
|
+
const handleChange = (e,v) => {
|
|
20
|
+
// 1,2,3
|
|
21
|
+
setSelected(v);
|
|
22
|
+
};
|
|
23
|
+
|
|
92
24
|
|
|
93
|
-
export const ControlledTabs = () => {
|
|
94
|
-
const [selectedId, setSelectedId] = useState("preamble");
|
|
95
25
|
return (
|
|
96
|
-
<div
|
|
97
|
-
<
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
</
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
26
|
+
<div style={{margin: "25px"}}>
|
|
27
|
+
<div style={{ width: "fit-content"}}>
|
|
28
|
+
Standard: A
|
|
29
|
+
<Tabs type="A" size="standard" value={selected} onChange={handleChange}>
|
|
30
|
+
<Tab type="A" size="standard" label="Item One" value={1}/>
|
|
31
|
+
<Tab type="A" size="standard" label="Item Two" value={2}/>
|
|
32
|
+
<Tab type="A" size="standard" label="Item Three" value={3}/>
|
|
33
|
+
<Tab type="A" size="standard" label="disabled" value={4} disabled/>
|
|
34
|
+
</Tabs>
|
|
35
|
+
</div>
|
|
36
|
+
<div style={{ width: "fit-content"}}>
|
|
37
|
+
Large: A
|
|
38
|
+
<Tabs type="A" size="large" value={selected} onChange={handleChange}>
|
|
39
|
+
<Tab type="A" size="large" label="Item One" value={1}/>
|
|
40
|
+
<Tab type="A" size="large" label="Item Two" value={2}/>
|
|
41
|
+
<Tab type="A" size="large" label="Item Three" value={3}/>
|
|
42
|
+
<Tab type="A" size="large" label="disabled" value={4} disabled/>
|
|
43
|
+
</Tabs>
|
|
44
|
+
</div>
|
|
45
|
+
<div style={{ width: "fit-content"}}>
|
|
46
|
+
Standard: B
|
|
47
|
+
<Tabs type="B" size="standard" value={selected} onChange={handleChange}>
|
|
48
|
+
<Tab type="B" size="standard" label="Item One" value={1} />
|
|
49
|
+
<Tab type="B" size="standard" label="Item Two" value={2} />
|
|
50
|
+
<Tab type="B" size="standard" label="Item Three" value={3} />
|
|
51
|
+
<Tab type="B" size="standard" label="disabled" value={4} disabled/>
|
|
52
|
+
</Tabs>
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<div style={{ width: "fit-content"}}>
|
|
56
|
+
Large: B
|
|
57
|
+
<Tabs type="B" size="large" value={selected} onChange={handleChange}>
|
|
58
|
+
<Tab type="B" size="large" label="Item One" value={1} />
|
|
59
|
+
<Tab type="B" size="large" label="Item Two" value={2} />
|
|
60
|
+
<Tab type="B" size="large" label="Item Three" value={3} />
|
|
61
|
+
<Tab type="B" size="large" label="disabled" value={4} disabled/>
|
|
62
|
+
</Tabs>
|
|
63
|
+
</div>
|
|
64
|
+
<div style={{ width: "fit-content"}}>
|
|
65
|
+
Standard: C
|
|
66
|
+
<Tabs type="C" value={selected} onChange={handleChange}>
|
|
67
|
+
<Tab type="C" size="standard" label="Item One" value={1} />
|
|
68
|
+
<Tab type="C" size="standard" label="Item Two" value={2} />
|
|
69
|
+
<Tab type="C" size="standard" label="Item Three"value={3} />
|
|
70
|
+
<Tab type="C" size="standard" label="disabled" value={4} disabled/>
|
|
71
|
+
</Tabs>
|
|
72
|
+
</div>
|
|
73
|
+
<div style={{ width: "fit-content" }}>
|
|
74
|
+
Large: C
|
|
75
|
+
<Tabs type="C" value={selected} onChange={handleChange}>
|
|
76
|
+
<Tab type="C" size="large" label="Item One" value={1} />
|
|
77
|
+
<Tab type="C" size="large" label="Item Two" value={2} />
|
|
78
|
+
<Tab type="C" size="large" label="Item Three"value={3} />
|
|
79
|
+
<Tab type="C" size="large" label="disabled" value={4} disabled/>
|
|
80
|
+
</Tabs>
|
|
81
|
+
</div>
|
|
82
|
+
<div>
|
|
83
|
+
Vertical Standard: C
|
|
84
|
+
<Tabs type="C" value={selected} onChange={handleChange} orientation="vertical">
|
|
85
|
+
<Tab type="C" size="standard" label="Item One" value={1} orientation="vertical"/>
|
|
86
|
+
<Tab type="C" size="standard" label="Item Two" value={2} orientation="vertical"/>
|
|
87
|
+
<Tab type="C" size="standard" label="Item Three"value={3} orientation="vertical"/>
|
|
88
|
+
<Tab type="C" size="standard" label="disabled" value={4} disabled orientation="vertical"/>
|
|
89
|
+
</Tabs>
|
|
90
|
+
</div>
|
|
91
|
+
<div style={{ width: "fit-content"}}>
|
|
92
|
+
Standard: D
|
|
93
|
+
<Tabs type="D" value={selected} onChange={handleChange}>
|
|
94
|
+
<Tab type="D" size="standard" label="Item One" value={1} />
|
|
95
|
+
<Tab type="D" size="standard" label="Item Two" value={2} />
|
|
96
|
+
<Tab type="D" size="standard" label="Item Three"value={3} />
|
|
97
|
+
<Tab type="D" size="standard" label="disabled" value={4} disabled/>
|
|
98
|
+
</Tabs>
|
|
99
|
+
</div>
|
|
100
|
+
<div style={{ width: "fit-content" }}>
|
|
101
|
+
Large: D
|
|
102
|
+
<Tabs type="D" value={selected} onChange={handleChange}>
|
|
103
|
+
<Tab type="D" size="large" label="Item One" value={1} />
|
|
104
|
+
<Tab type="D" size="large" label="Item Two" value={2} />
|
|
105
|
+
<Tab type="D" size="large" label="Item Three"value={3} />
|
|
106
|
+
<Tab type="D" size="large" label="disabled" value={4} disabled/>
|
|
107
|
+
</Tabs>
|
|
108
|
+
</div>
|
|
128
109
|
</div>
|
|
129
110
|
);
|
|
130
111
|
};
|
package/components/Tabs/index.js
CHANGED
|
@@ -1,87 +1,88 @@
|
|
|
1
|
-
import React, { useEffect, useState } from "react";
|
|
2
1
|
import PropTypes from "prop-types";
|
|
3
2
|
import { Tabs as MuiTabs } from "@mui/material";
|
|
4
|
-
import
|
|
5
|
-
import LinkTab from "./Tab";
|
|
3
|
+
import React from "react";
|
|
6
4
|
|
|
7
|
-
const
|
|
5
|
+
const typeA = {
|
|
6
|
+
"& .MuiTabs-flexContainer": {
|
|
7
|
+
columnGap: "4px !important",
|
|
8
|
+
},
|
|
9
|
+
"& .MuiTabs-indicator": {
|
|
10
|
+
display: "none !important"
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const typeB = {
|
|
15
|
+
backgroundColor: "#FFF",
|
|
16
|
+
color: "#515151",
|
|
17
|
+
"& .MuiTabs-indicator": {
|
|
18
|
+
backgroundColor:"#209FA6",
|
|
19
|
+
height: "6px"
|
|
20
|
+
},
|
|
21
|
+
};
|
|
8
22
|
|
|
9
|
-
const
|
|
10
|
-
|
|
23
|
+
const typeC = {
|
|
24
|
+
color:"333",
|
|
25
|
+
"& .MuiTabs-indicator": {
|
|
26
|
+
backgroundColor:"#209FA6",
|
|
27
|
+
height: "100%",
|
|
28
|
+
width: "6px !important",
|
|
29
|
+
left: 0,
|
|
30
|
+
},
|
|
11
31
|
};
|
|
12
32
|
|
|
33
|
+
const typeD = {
|
|
34
|
+
backgroundColor: "#FFF",
|
|
35
|
+
color: "#515151",
|
|
36
|
+
"& .MuiTabs-indicator": {
|
|
37
|
+
backgroundColor:"#209FA6",
|
|
38
|
+
height: "6px",
|
|
39
|
+
top: 0
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
|
|
13
43
|
const Tabs = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
defaultSelectedId,
|
|
18
|
-
ariaLabel,
|
|
44
|
+
type,
|
|
45
|
+
size,
|
|
46
|
+
...rest
|
|
19
47
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
48
|
+
const baseStyle = {
|
|
49
|
+
outline: "none",
|
|
50
|
+
fontFamily: "Rubik, sans Sarif",
|
|
51
|
+
fontWeight: 400,
|
|
52
|
+
lineHeight: 19,
|
|
53
|
+
backgroundColor: "transparent",
|
|
54
|
+
"& .Mui-selected": {
|
|
55
|
+
outline: "none",
|
|
56
|
+
fontWeight: 500,
|
|
57
|
+
color: "#333 !important",
|
|
58
|
+
backgroundColor: "#fff",
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
const style = ((type) => {
|
|
62
|
+
if (type === "A") {
|
|
63
|
+
return { ...baseStyle, ...typeA}
|
|
25
64
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (!children) return null;
|
|
29
|
-
|
|
30
|
-
const handleChange = (event, newValue) => {
|
|
31
|
-
if (onChange) {
|
|
32
|
-
onChange(tabList[newValue]?.id, event);
|
|
65
|
+
if (type === "B") {
|
|
66
|
+
return { ...baseStyle, ...typeB}
|
|
33
67
|
}
|
|
34
|
-
if (
|
|
35
|
-
|
|
68
|
+
if (type === "C") {
|
|
69
|
+
return { ...baseStyle, ...typeC}
|
|
36
70
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const panels = getPanelChildren(children);
|
|
49
|
-
|
|
50
|
-
const tabList = panels.map((panel) => {
|
|
51
|
-
const { id, tab, tabHref, disabled } = panel?.props || {};
|
|
52
|
-
return { tab, tabHref, disabled, id };
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
const foundIndex = tabList.findIndex(({ id }) => id === value);
|
|
56
|
-
|
|
57
|
-
const tabIndex = foundIndex >= 0 ? foundIndex : 0;
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<>
|
|
61
|
-
<div className="qpp-c-tabs qpp-c-tabs--mui">
|
|
62
|
-
<MuiTabs
|
|
63
|
-
value={tabIndex}
|
|
64
|
-
onChange={handleChange}
|
|
65
|
-
aria-label={ariaLabel}
|
|
66
|
-
>
|
|
67
|
-
{tabList.map(({ tab, tabHref, disabled, id }, index) => (
|
|
68
|
-
<LinkTab
|
|
69
|
-
index={index}
|
|
70
|
-
key={`link-tab-${tab}`}
|
|
71
|
-
label={tab}
|
|
72
|
-
href={tabHref}
|
|
73
|
-
disabled={disabled}
|
|
74
|
-
id={`qpp-c-tabs__item--${id}`}
|
|
75
|
-
/>
|
|
76
|
-
))}
|
|
77
|
-
</MuiTabs>
|
|
78
|
-
</div>
|
|
79
|
-
{renderChildren()}
|
|
80
|
-
</>
|
|
81
|
-
);
|
|
82
|
-
};
|
|
71
|
+
if (type === "D") {
|
|
72
|
+
return { ...baseStyle, ...typeD}
|
|
73
|
+
}
|
|
74
|
+
})(type)
|
|
75
|
+
return (<MuiTabs
|
|
76
|
+
disableRipple
|
|
77
|
+
sx={style}
|
|
78
|
+
{...rest}
|
|
79
|
+
/>)
|
|
80
|
+
}
|
|
83
81
|
|
|
84
82
|
Tabs.propTypes = {
|
|
83
|
+
orientatin: PropTypes.string,
|
|
84
|
+
type: PropTypes.oneOf(["A", "B", "C", "D"]),
|
|
85
|
+
size: PropTypes.oneOf(["standard", "large"]),
|
|
85
86
|
ariaLabel: PropTypes.string,
|
|
86
87
|
selected: PropTypes.string,
|
|
87
88
|
defaultSelectedId: PropTypes.string,
|
|
@@ -90,7 +91,9 @@ Tabs.propTypes = {
|
|
|
90
91
|
};
|
|
91
92
|
|
|
92
93
|
Tabs.defaultProps = {
|
|
93
|
-
|
|
94
|
+
orientation: "horizontal",
|
|
95
|
+
type: "A",
|
|
96
|
+
size: "standard",
|
|
94
97
|
selected: null,
|
|
95
98
|
defaultSelectedId: null,
|
|
96
99
|
onChange: null,
|
package/components/index.js
CHANGED
|
@@ -22,6 +22,7 @@ import Select from "./Select";
|
|
|
22
22
|
import Spinner from "./UnwrappedSpinner";
|
|
23
23
|
import TabPanel from "./Tabs/TabPanel";
|
|
24
24
|
import Tabs from "./Tabs/index";
|
|
25
|
+
import Tab from "./Tabs/Tab";
|
|
25
26
|
import TextField from "./TextField";
|
|
26
27
|
import TextArea from './TextArea';
|
|
27
28
|
import Tooltip from "./Tooltip";
|
|
@@ -141,6 +142,7 @@ export {
|
|
|
141
142
|
Spinner,
|
|
142
143
|
TabPanel,
|
|
143
144
|
Tabs,
|
|
145
|
+
Tab,
|
|
144
146
|
TextButton,
|
|
145
147
|
TextInput,
|
|
146
148
|
TextField,
|