@availity/mui-tabs 0.1.0 → 0.1.2
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 +14 -0
- package/dist/index.d.ts +21 -2
- package/dist/index.js +56 -2
- package/dist/index.mjs +52 -2
- package/package.json +1 -1
- package/src/index.ts +4 -0
- package/src/lib/Tab.stories.tsx +35 -5
- package/src/lib/TabList.stories.tsx +4 -0
- package/src/lib/Tabs.stories.tsx +35 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [0.1.2](https://github.com/Availity/element/compare/@availity/mui-tabs@0.1.1...@availity/mui-tabs@0.1.2) (2023-08-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **mui-tabs:** export subcomponents ([f06759f](https://github.com/Availity/element/commit/f06759fa83a32aa8f7f549fa0011ab4fe183e77a))
|
|
11
|
+
|
|
12
|
+
## [0.1.1](https://github.com/Availity/element/compare/@availity/mui-tabs@0.1.0...@availity/mui-tabs@0.1.1) (2023-08-16)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **mui-tabs:** fix invalid ARIA attributes in Tab stories ([483b1ad](https://github.com/Availity/element/commit/483b1ad0fd30025cbce96e03dec0e496467f75ef))
|
|
18
|
+
|
|
5
19
|
## 0.1.0 (2023-07-14)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
import { TabsProps as TabsProps$1 } from '@mui/material';
|
|
1
|
+
import { TabProps as TabProps$1, TabsProps as TabsProps$1 } from '@mui/material';
|
|
2
|
+
import { TabContextProps as TabContextProps$1, TabListProps as TabListProps$1, TabPanelProps as TabPanelProps$1 } from '@mui/lab';
|
|
3
|
+
|
|
4
|
+
type TabProps = Omit<TabProps$1, 'centerRipple' | 'disableFocusRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'icon' | 'iconPosition' | 'TouchRippleProps'>;
|
|
5
|
+
declare const Tab: (props: TabProps) => JSX.Element;
|
|
6
|
+
|
|
7
|
+
interface TabContextProps extends TabContextProps$1 {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
declare const TabContext: ({ children, ...rest }: TabContextProps) => JSX.Element;
|
|
11
|
+
|
|
12
|
+
interface TabListProps extends Omit<TabListProps$1, 'centered' | 'centerRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'orientation' | 'TouchRippleProps' | 'touchRippleRef'> {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const TabList: ({ children, ...rest }: TabListProps) => JSX.Element;
|
|
16
|
+
|
|
17
|
+
interface TabPanelProps extends TabPanelProps$1 {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const TabPanel: ({ children, ...rest }: TabPanelProps) => JSX.Element;
|
|
2
21
|
|
|
3
22
|
interface TabsProps extends Omit<TabsProps$1, 'centered' | 'centerRipple' | 'disableFocusRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'orientation' | 'TouchRippleProps' | 'touchRippleRef'> {
|
|
4
23
|
children?: React.ReactNode;
|
|
5
24
|
}
|
|
6
25
|
declare const Tabs: ({ children, ...rest }: TabsProps) => JSX.Element;
|
|
7
26
|
|
|
8
|
-
export { Tabs, TabsProps };
|
|
27
|
+
export { Tab, TabContext, TabContextProps, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, Tabs, TabsProps };
|
package/dist/index.js
CHANGED
|
@@ -20,15 +20,65 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
Tab: () => Tab,
|
|
24
|
+
TabContext: () => TabContext,
|
|
25
|
+
TabList: () => TabList,
|
|
26
|
+
TabPanel: () => TabPanel,
|
|
23
27
|
Tabs: () => Tabs
|
|
24
28
|
});
|
|
25
29
|
module.exports = __toCommonJS(src_exports);
|
|
26
30
|
|
|
27
|
-
// src/lib/
|
|
31
|
+
// src/lib/Tab.tsx
|
|
28
32
|
var import_material = require("@mui/material");
|
|
29
33
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var Tab = (props) => {
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Tab, {
|
|
36
|
+
...props,
|
|
37
|
+
disableRipple: true,
|
|
38
|
+
disableFocusRipple: true,
|
|
39
|
+
disableTouchRipple: true
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
// src/lib/TabContext.tsx
|
|
44
|
+
var import_lab = require("@mui/lab");
|
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
+
var TabContext = ({ children, ...rest }) => {
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lab.TabContext, {
|
|
48
|
+
...rest,
|
|
49
|
+
children
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/lib/TabList.tsx
|
|
54
|
+
var import_lab2 = require("@mui/lab");
|
|
55
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
|
+
var TabList = ({ children, ...rest }) => {
|
|
57
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lab2.TabList, {
|
|
58
|
+
...rest,
|
|
59
|
+
disableRipple: true,
|
|
60
|
+
disableTouchRipple: true,
|
|
61
|
+
orientation: "horizontal",
|
|
62
|
+
centered: false,
|
|
63
|
+
children
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// src/lib/TabPanel.tsx
|
|
68
|
+
var import_lab3 = require("@mui/lab");
|
|
69
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
70
|
+
var TabPanel = ({ children, ...rest }) => {
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lab3.TabPanel, {
|
|
72
|
+
...rest,
|
|
73
|
+
children
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/lib/Tabs.tsx
|
|
78
|
+
var import_material2 = require("@mui/material");
|
|
79
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
30
80
|
var Tabs = ({ children, ...rest }) => {
|
|
31
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material2.Tabs, {
|
|
32
82
|
...rest,
|
|
33
83
|
disableRipple: true,
|
|
34
84
|
disableTouchRipple: true,
|
|
@@ -39,5 +89,9 @@ var Tabs = ({ children, ...rest }) => {
|
|
|
39
89
|
};
|
|
40
90
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
91
|
0 && (module.exports = {
|
|
92
|
+
Tab,
|
|
93
|
+
TabContext,
|
|
94
|
+
TabList,
|
|
95
|
+
TabPanel,
|
|
42
96
|
Tabs
|
|
43
97
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,54 @@
|
|
|
1
|
+
// src/lib/Tab.tsx
|
|
2
|
+
import { Tab as MuiTab } from "@mui/material";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var Tab = (props) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(MuiTab, {
|
|
6
|
+
...props,
|
|
7
|
+
disableRipple: true,
|
|
8
|
+
disableFocusRipple: true,
|
|
9
|
+
disableTouchRipple: true
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/lib/TabContext.tsx
|
|
14
|
+
import { TabContext as MuiTabContext } from "@mui/lab";
|
|
15
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
16
|
+
var TabContext = ({ children, ...rest }) => {
|
|
17
|
+
return /* @__PURE__ */ jsx2(MuiTabContext, {
|
|
18
|
+
...rest,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// src/lib/TabList.tsx
|
|
24
|
+
import { TabList as MuiTabList } from "@mui/lab";
|
|
25
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
26
|
+
var TabList = ({ children, ...rest }) => {
|
|
27
|
+
return /* @__PURE__ */ jsx3(MuiTabList, {
|
|
28
|
+
...rest,
|
|
29
|
+
disableRipple: true,
|
|
30
|
+
disableTouchRipple: true,
|
|
31
|
+
orientation: "horizontal",
|
|
32
|
+
centered: false,
|
|
33
|
+
children
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/lib/TabPanel.tsx
|
|
38
|
+
import { TabPanel as MuiTabPanel } from "@mui/lab";
|
|
39
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
40
|
+
var TabPanel = ({ children, ...rest }) => {
|
|
41
|
+
return /* @__PURE__ */ jsx4(MuiTabPanel, {
|
|
42
|
+
...rest,
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
1
47
|
// src/lib/Tabs.tsx
|
|
2
48
|
import { Tabs as MuiTabs } from "@mui/material";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
49
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
4
50
|
var Tabs = ({ children, ...rest }) => {
|
|
5
|
-
return /* @__PURE__ */
|
|
51
|
+
return /* @__PURE__ */ jsx5(MuiTabs, {
|
|
6
52
|
...rest,
|
|
7
53
|
disableRipple: true,
|
|
8
54
|
disableTouchRipple: true,
|
|
@@ -12,5 +58,9 @@ var Tabs = ({ children, ...rest }) => {
|
|
|
12
58
|
});
|
|
13
59
|
};
|
|
14
60
|
export {
|
|
61
|
+
Tab,
|
|
62
|
+
TabContext,
|
|
63
|
+
TabList,
|
|
64
|
+
TabPanel,
|
|
15
65
|
Tabs
|
|
16
66
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/lib/Tab.stories.tsx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Box, Typography } from '@mui/material';
|
|
5
6
|
import { Tabs } from './Tabs';
|
|
6
7
|
import { Tab, TabProps } from './Tab';
|
|
7
8
|
|
|
@@ -22,17 +23,46 @@ function a11yProps(index: number) {
|
|
|
22
23
|
|
|
23
24
|
export const _Tab: StoryObj<typeof Tab> = {
|
|
24
25
|
render: (args: TabProps) => {
|
|
26
|
+
interface TabPanelProps {
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
index: number;
|
|
29
|
+
value: number;
|
|
30
|
+
}
|
|
25
31
|
const [value, setValue] = useState(0);
|
|
26
32
|
|
|
27
33
|
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
|
|
28
34
|
setValue(newValue);
|
|
29
35
|
};
|
|
36
|
+
function CustomTabPanel(props: TabPanelProps) {
|
|
37
|
+
const { value, index, ...other } = props;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
role="tabpanel"
|
|
42
|
+
hidden={value !== index}
|
|
43
|
+
id={`simple-tabpanel-${index}`}
|
|
44
|
+
aria-labelledby={`simple-tab-${index}`}
|
|
45
|
+
{...other}
|
|
46
|
+
>
|
|
47
|
+
{value === index && (
|
|
48
|
+
<Box sx={{ p: 3 }}>
|
|
49
|
+
<Typography>Hello from panel {index}</Typography>
|
|
50
|
+
</Box>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
30
55
|
return (
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
56
|
+
<>
|
|
57
|
+
<Tabs value={value} onChange={handleChange}>
|
|
58
|
+
<Tab label="Item One" {...args} {...a11yProps(0)} />
|
|
59
|
+
<Tab label="Item Two" {...args} {...a11yProps(1)} />
|
|
60
|
+
<Tab label="Item Three" {...args} {...a11yProps(2)} disabled />
|
|
61
|
+
</Tabs>
|
|
62
|
+
<CustomTabPanel value={value} index={0} />
|
|
63
|
+
<CustomTabPanel value={value} index={1} />
|
|
64
|
+
<CustomTabPanel value={value} index={2} />
|
|
65
|
+
</>
|
|
36
66
|
);
|
|
37
67
|
},
|
|
38
68
|
args: {},
|
|
@@ -5,6 +5,7 @@ import type { Meta, StoryObj } from '@storybook/react';
|
|
|
5
5
|
import { TabList, TabListProps } from './TabList';
|
|
6
6
|
import { Tab } from './Tab';
|
|
7
7
|
import { TabContext } from './TabContext';
|
|
8
|
+
import { TabPanel } from './TabPanel';
|
|
8
9
|
|
|
9
10
|
const meta: Meta<typeof TabList> = {
|
|
10
11
|
title: 'Components/Tabs/TabList',
|
|
@@ -28,6 +29,9 @@ export const _TabList: StoryObj<typeof TabList> = {
|
|
|
28
29
|
<Tab label="Item Two" value="2" />
|
|
29
30
|
<Tab label="Item Three" value="3" />
|
|
30
31
|
</TabList>
|
|
32
|
+
<TabPanel value="1" children={`Hello from Panel ${value}`} />
|
|
33
|
+
<TabPanel value="2" children={`Hello from Panel ${value}`} />
|
|
34
|
+
<TabPanel value="3" children={`Hello from Panel ${value}`} />
|
|
31
35
|
</TabContext>
|
|
32
36
|
);
|
|
33
37
|
},
|
package/src/lib/Tabs.stories.tsx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Box, Typography } from '@mui/material';
|
|
5
6
|
import { Tabs, TabsProps } from './Tabs';
|
|
6
7
|
import { Tab } from './Tab';
|
|
7
8
|
|
|
@@ -22,17 +23,46 @@ function a11yProps(index: number) {
|
|
|
22
23
|
|
|
23
24
|
export const _Tabs: StoryObj<typeof Tabs> = {
|
|
24
25
|
render: (args: TabsProps) => {
|
|
26
|
+
interface TabPanelProps {
|
|
27
|
+
children?: React.ReactNode;
|
|
28
|
+
index: number;
|
|
29
|
+
value: number;
|
|
30
|
+
}
|
|
25
31
|
const [value, setValue] = useState(0);
|
|
26
32
|
|
|
27
33
|
const handleChange = (event: React.SyntheticEvent, newValue: number) => {
|
|
28
34
|
setValue(newValue);
|
|
29
35
|
};
|
|
36
|
+
function CustomTabPanel(props: TabPanelProps) {
|
|
37
|
+
const { value, index, ...other } = props;
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
role="tabpanel"
|
|
42
|
+
hidden={value !== index}
|
|
43
|
+
id={`simple-tabpanel-${index}`}
|
|
44
|
+
aria-labelledby={`simple-tab-${index}`}
|
|
45
|
+
{...other}
|
|
46
|
+
>
|
|
47
|
+
{value === index && (
|
|
48
|
+
<Box sx={{ p: 3 }}>
|
|
49
|
+
<Typography>Hello from panel {index}</Typography>
|
|
50
|
+
</Box>
|
|
51
|
+
)}
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
30
55
|
return (
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
56
|
+
<>
|
|
57
|
+
<Tabs value={value} onChange={handleChange} {...args}>
|
|
58
|
+
<Tab label="Item One" {...a11yProps(0)} />
|
|
59
|
+
<Tab label="Item Two" {...a11yProps(1)} />
|
|
60
|
+
<Tab label="Item Three" {...a11yProps(2)} disabled />
|
|
61
|
+
</Tabs>
|
|
62
|
+
<CustomTabPanel value={value} index={0} />
|
|
63
|
+
<CustomTabPanel value={value} index={1} />
|
|
64
|
+
<CustomTabPanel value={value} index={2} />
|
|
65
|
+
</>
|
|
36
66
|
);
|
|
37
67
|
},
|
|
38
68
|
};
|