@availity/mui-tabs 0.1.9 → 0.2.0

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 CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.2.0](https://github.com/Availity/element/compare/@availity/mui-tabs@0.1.10...@availity/mui-tabs@0.2.0) (2025-02-04)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `mui-divider` updated to version `0.1.10`
10
+
11
+ ### Features
12
+
13
+ * configure package.json to allow esm to be used ([5a5393d](https://github.com/Availity/element/commit/5a5393de761f52608e714dd94a05106937dd95db))
14
+
15
+ ## [0.1.10](https://github.com/Availity/element/compare/@availity/mui-tabs@0.1.9...@availity/mui-tabs@0.1.10) (2024-10-31)
16
+
17
+ ### Dependency Updates
18
+
19
+ * `mui-divider` updated to version `0.1.9`
5
20
  ## [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
21
 
7
22
  ### Dependency Updates
package/README.md CHANGED
@@ -12,7 +12,7 @@ This package extends the MUI Tabs component: [MUI Tabs Docs](https://mui.com/com
12
12
 
13
13
  Live demo and documentation in our [Storybook](https://availity.github.io/element/?path=/docs/components-tabs-introduction--docs)
14
14
 
15
- Availity standards for design and usage can be found in the [Availity Design Guide](https://zeroheight.com/2e36e50c7)
15
+ Availity standards for design and usage can be found in the [Availity Design Guide](https://design.availity.com/2e36e50c7)
16
16
 
17
17
  ## Installation
18
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@availity/mui-tabs",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Availity MUI Tabs Component - part of the @availity/element design system",
5
5
  "keywords": [
6
6
  "react",
@@ -23,6 +23,14 @@
23
23
  "main": "./dist/index.js",
24
24
  "module": "./dist/index.mjs",
25
25
  "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ "./package.json": "./package.json",
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.mjs",
31
+ "require": "./dist/index.js"
32
+ }
33
+ },
26
34
  "scripts": {
27
35
  "build": "tsup src/index.ts --format esm,cjs --dts",
28
36
  "dev": "tsup src/index.ts --format esm,cjs --watch --dts",
@@ -35,7 +43,7 @@
35
43
  "@mui/lab": "^5.0.0-alpha.147"
36
44
  },
37
45
  "devDependencies": {
38
- "@availity/mui-divider": "^0.3.7",
46
+ "@availity/mui-divider": "^0.5.0",
39
47
  "@mui/material": "^5.15.15",
40
48
  "react": "18.2.0",
41
49
  "react-dom": "18.2.0",
@@ -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 Tabs> = {
10
+ const meta: Meta<typeof Tab> = {
11
11
  title: 'Components/Tabs/Tab',
12
- component: Tabs,
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} value={value}>
28
- <TabList onChange={handleChange} aria-label="lab API tabs example">
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
  };
@@ -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
- interface TabPanelProps {
28
- children?: React.ReactNode;
29
- index: number;
30
- value: number;
31
- }
32
- const [value, setValue] = useState(0);
33
-
34
- const handleChange = (event: React.SyntheticEvent, newValue: number) => {
35
- setValue(newValue);
36
- };
37
- function CustomTabPanel(props: TabPanelProps) {
38
- const { value, index, ...other } = props;
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
- return (
41
- <div
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={handleChange} {...args}>
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
  };