@availity/mui-tabs 0.1.9 → 0.1.10
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/CHANGELOG.md +5 -0
- package/package.json +2 -2
- package/src/lib/Tab.stories.tsx +2 -2
- package/src/lib/TabContext.stories.tsx +6 -9
- package/src/lib/Tabs.stories.tsx +60 -33
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.1.10](https://github.com/Availity/element/compare/@availity/mui-tabs@0.1.9...@availity/mui-tabs@0.1.10) (2024-10-31)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `mui-divider` updated to version `0.1.9`
|
|
5
10
|
## [0.1.9](https://github.com/Availity/element/compare/@availity/mui-tabs@0.1.8...@availity/mui-tabs@0.1.9) (2024-04-19)
|
|
6
11
|
|
|
7
12
|
### Dependency Updates
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/mui-tabs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Availity MUI Tabs Component - part of the @availity/element design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@mui/lab": "^5.0.0-alpha.147"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@availity/mui-divider": "^0.
|
|
38
|
+
"@availity/mui-divider": "^0.4.0",
|
|
39
39
|
"@mui/material": "^5.15.15",
|
|
40
40
|
"react": "18.2.0",
|
|
41
41
|
"react-dom": "18.2.0",
|
package/src/lib/Tab.stories.tsx
CHANGED
|
@@ -7,9 +7,9 @@ import Typography from '@mui/material/Typography';
|
|
|
7
7
|
import { Tabs } from './Tabs';
|
|
8
8
|
import { Tab, TabProps } from './Tab';
|
|
9
9
|
|
|
10
|
-
const meta: Meta<typeof
|
|
10
|
+
const meta: Meta<typeof Tab> = {
|
|
11
11
|
title: 'Components/Tabs/Tab',
|
|
12
|
-
component:
|
|
12
|
+
component: Tab,
|
|
13
13
|
tags: ['autodocs'],
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
1
2
|
// Each exported component in the package should have its own stories file
|
|
2
3
|
|
|
3
|
-
import { useState } from 'react';
|
|
4
4
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
5
|
import { TabContext, TabContextProps } from './TabContext';
|
|
6
6
|
import { Divider } from '@availity/mui-divider';
|
|
@@ -18,14 +18,9 @@ export default meta;
|
|
|
18
18
|
|
|
19
19
|
export const _TabContext: StoryObj<typeof TabContext> = {
|
|
20
20
|
render: (args: TabContextProps) => {
|
|
21
|
-
const [value, setValue] = useState('1');
|
|
22
|
-
|
|
23
|
-
const handleChange = (event: React.SyntheticEvent, newValue: string) => {
|
|
24
|
-
setValue(newValue);
|
|
25
|
-
};
|
|
26
21
|
return (
|
|
27
|
-
<TabContext {...args}
|
|
28
|
-
<TabList onChange={
|
|
22
|
+
<TabContext {...args}>
|
|
23
|
+
<TabList onChange={() => {}} aria-label="lab API tabs example">
|
|
29
24
|
<Tab label="Item One" value="1" />
|
|
30
25
|
<Tab label="Item Two" value="2" />
|
|
31
26
|
<Tab label="Item Three" value="3" />
|
|
@@ -37,5 +32,7 @@ export const _TabContext: StoryObj<typeof TabContext> = {
|
|
|
37
32
|
</TabContext>
|
|
38
33
|
);
|
|
39
34
|
},
|
|
40
|
-
args: {
|
|
35
|
+
args: {
|
|
36
|
+
value: '1',
|
|
37
|
+
},
|
|
41
38
|
};
|
package/src/lib/Tabs.stories.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
1
2
|
// Each exported component in the package should have its own stories file
|
|
2
3
|
|
|
3
|
-
import { useState } from 'react';
|
|
4
4
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
5
|
import Box from '@mui/material/Box';
|
|
6
6
|
import Typography from '@mui/material/Typography';
|
|
@@ -22,48 +22,75 @@ function a11yProps(index: number) {
|
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
interface TabPanelProps {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
index: number;
|
|
28
|
+
value: number;
|
|
29
|
+
}
|
|
30
|
+
function CustomTabPanel(props: TabPanelProps) {
|
|
31
|
+
const { value, index, ...other } = props;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<div
|
|
35
|
+
role="tabpanel"
|
|
36
|
+
hidden={value !== index}
|
|
37
|
+
id={`simple-tabpanel-${index}`}
|
|
38
|
+
aria-labelledby={`simple-tab-${index}`}
|
|
39
|
+
{...other}
|
|
40
|
+
>
|
|
41
|
+
{value === index && (
|
|
42
|
+
<Box sx={{ p: 3 }}>
|
|
43
|
+
<Typography>Hello from panel {index}</Typography>
|
|
44
|
+
</Box>
|
|
45
|
+
)}
|
|
46
|
+
</div>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
25
50
|
export const _Tabs: StoryObj<typeof Tabs> = {
|
|
26
51
|
render: (args: TabsProps) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
<Tabs value={args.value} onChange={() => {}} {...args}>
|
|
55
|
+
<Tab label="Item One" {...a11yProps(0)} />
|
|
56
|
+
<Tab label="Item Two" {...a11yProps(1)} />
|
|
57
|
+
<Tab label="Item Three" {...a11yProps(2)} disabled />
|
|
58
|
+
</Tabs>
|
|
59
|
+
<CustomTabPanel value={args.value} index={0} />
|
|
60
|
+
<CustomTabPanel value={args.value} index={1} />
|
|
61
|
+
<CustomTabPanel value={args.value} index={2} />
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
args: {
|
|
66
|
+
value: 0,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
39
69
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
role="tabpanel"
|
|
43
|
-
hidden={value !== index}
|
|
44
|
-
id={`simple-tabpanel-${index}`}
|
|
45
|
-
aria-labelledby={`simple-tab-${index}`}
|
|
46
|
-
{...other}
|
|
47
|
-
>
|
|
48
|
-
{value === index && (
|
|
49
|
-
<Box sx={{ p: 3 }}>
|
|
50
|
-
<Typography>Hello from panel {index}</Typography>
|
|
51
|
-
</Box>
|
|
52
|
-
)}
|
|
53
|
-
</div>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
70
|
+
export const _TabsScrollable: StoryObj<typeof Tabs> = {
|
|
71
|
+
render: (args: TabsProps) => {
|
|
56
72
|
return (
|
|
57
73
|
<>
|
|
58
|
-
<Tabs value={value} onChange={
|
|
74
|
+
<Tabs value={args.value} onChange={() => {}} {...args}>
|
|
59
75
|
<Tab label="Item One" {...a11yProps(0)} />
|
|
60
76
|
<Tab label="Item Two" {...a11yProps(1)} />
|
|
61
77
|
<Tab label="Item Three" {...a11yProps(2)} disabled />
|
|
78
|
+
<Tab label="Item Four" {...a11yProps(3)} disabled />
|
|
79
|
+
<Tab label="Item Five" {...a11yProps(4)} disabled />
|
|
80
|
+
<Tab label="Item Six" {...a11yProps(5)} disabled />
|
|
81
|
+
<Tab label="Item Seven" {...a11yProps(6)} disabled />
|
|
82
|
+
<Tab label="Item Eight" {...a11yProps(7)} disabled />
|
|
83
|
+
<Tab label="Item Nine" {...a11yProps(8)} disabled />
|
|
84
|
+
<Tab label="Item Ten" {...a11yProps(9)} disabled />
|
|
62
85
|
</Tabs>
|
|
63
|
-
<CustomTabPanel value={value} index={0} />
|
|
64
|
-
<CustomTabPanel value={value} index={1} />
|
|
65
|
-
<CustomTabPanel value={value} index={2} />
|
|
86
|
+
<CustomTabPanel value={args.value} index={0} />
|
|
87
|
+
<CustomTabPanel value={args.value} index={1} />
|
|
88
|
+
<CustomTabPanel value={args.value} index={2} />
|
|
66
89
|
</>
|
|
67
90
|
);
|
|
68
91
|
},
|
|
92
|
+
args: {
|
|
93
|
+
value: 0,
|
|
94
|
+
variant: 'scrollable',
|
|
95
|
+
},
|
|
69
96
|
};
|