@availity/mui-tabs 0.1.8 → 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 +10 -0
- package/dist/index.d.mts +30 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +50 -34
- package/dist/index.mjs +45 -30
- package/jest.config.js +10 -0
- package/package.json +5 -5
- package/project.json +8 -9
- 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,16 @@
|
|
|
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`
|
|
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)
|
|
11
|
+
|
|
12
|
+
### Dependency Updates
|
|
13
|
+
|
|
14
|
+
* `mui-divider` updated to version `0.1.8`
|
|
5
15
|
## [0.1.8](https://github.com/Availity/element/compare/@availity/mui-tabs@0.1.7...@availity/mui-tabs@0.1.8) (2024-04-04)
|
|
6
16
|
|
|
7
17
|
### Dependency Updates
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TabProps as TabProps$1 } from '@mui/material/Tab';
|
|
2
|
+
import { TabContextProps as TabContextProps$1 } from '@mui/lab/TabContext';
|
|
3
|
+
import { TabListProps as TabListProps$1 } from '@mui/lab/TabList';
|
|
4
|
+
import { TabPanelProps as TabPanelProps$1 } from '@mui/lab/TabPanel';
|
|
5
|
+
import { TabsProps as TabsProps$1 } from '@mui/material/Tabs';
|
|
6
|
+
|
|
7
|
+
type TabProps = Omit<TabProps$1, 'centerRipple' | 'disableFocusRipple' | 'disableRipple' | 'disableTouchRipple' | 'focusRipple' | 'icon' | 'iconPosition' | 'TouchRippleProps'>;
|
|
8
|
+
declare const Tab: (props: TabProps) => JSX.Element;
|
|
9
|
+
|
|
10
|
+
interface TabContextProps extends TabContextProps$1 {
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare const TabContext: ({ children, ...rest }: TabContextProps) => JSX.Element;
|
|
14
|
+
|
|
15
|
+
interface TabListProps extends Omit<TabListProps$1, 'centered' | 'centerRipple' | 'focusRipple' | 'orientation' | 'TouchRippleProps' | 'touchRippleRef'> {
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
declare const TabList: ({ children, ...rest }: TabListProps) => JSX.Element;
|
|
19
|
+
|
|
20
|
+
interface TabPanelProps extends TabPanelProps$1 {
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
declare const TabPanel: ({ children, ...rest }: TabPanelProps) => JSX.Element;
|
|
24
|
+
|
|
25
|
+
interface TabsProps extends Omit<TabsProps$1, 'centered' | 'centerRipple' | 'focusRipple' | 'orientation' | 'TouchRippleProps' | 'touchRippleRef'> {
|
|
26
|
+
children?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
declare const Tabs: ({ children, ...rest }: TabsProps) => JSX.Element;
|
|
29
|
+
|
|
30
|
+
export { Tab, TabContext, type TabContextProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,4 +27,4 @@ interface TabsProps extends Omit<TabsProps$1, 'centered' | 'centerRipple' | 'foc
|
|
|
27
27
|
}
|
|
28
28
|
declare const Tabs: ({ children, ...rest }: TabsProps) => JSX.Element;
|
|
29
29
|
|
|
30
|
-
export { Tab, TabContext, TabContextProps, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, Tabs, TabsProps };
|
|
30
|
+
export { Tab, TabContext, type TabContextProps, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
|
+
var __defProps = Object.defineProperties;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
9
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
10
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
+
var __spreadValues = (a, b) => {
|
|
14
|
+
for (var prop in b || (b = {}))
|
|
15
|
+
if (__hasOwnProp.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
if (__getOwnPropSymbols)
|
|
18
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
+
if (__propIsEnum.call(b, prop))
|
|
20
|
+
__defNormalProp(a, prop, b[prop]);
|
|
21
|
+
}
|
|
22
|
+
return a;
|
|
23
|
+
};
|
|
24
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
8
37
|
var __export = (target, all) => {
|
|
9
38
|
for (var name in all)
|
|
10
39
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -18,6 +47,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
47
|
return to;
|
|
19
48
|
};
|
|
20
49
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
54
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
55
|
mod
|
|
23
56
|
));
|
|
@@ -38,56 +71,39 @@ module.exports = __toCommonJS(src_exports);
|
|
|
38
71
|
var import_Tab = __toESM(require("@mui/material/Tab"));
|
|
39
72
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
73
|
var Tab = (props) => {
|
|
41
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Tab.default, {
|
|
42
|
-
...props,
|
|
43
|
-
disableRipple: true,
|
|
44
|
-
disableFocusRipple: true,
|
|
45
|
-
disableTouchRipple: true
|
|
46
|
-
});
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Tab.default, __spreadProps(__spreadValues({}, props), { disableRipple: true, disableFocusRipple: true, disableTouchRipple: true }));
|
|
47
75
|
};
|
|
48
76
|
|
|
49
77
|
// src/lib/TabContext.tsx
|
|
50
78
|
var import_TabContext = __toESM(require("@mui/lab/TabContext"));
|
|
51
|
-
var
|
|
52
|
-
var TabContext = (
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
children
|
|
56
|
-
});
|
|
79
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
80
|
+
var TabContext = (_a) => {
|
|
81
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_TabContext.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
57
83
|
};
|
|
58
84
|
|
|
59
85
|
// src/lib/TabList.tsx
|
|
60
86
|
var import_TabList = __toESM(require("@mui/lab/TabList"));
|
|
61
|
-
var
|
|
62
|
-
var TabList = (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
orientation: "horizontal",
|
|
66
|
-
centered: false,
|
|
67
|
-
children
|
|
68
|
-
});
|
|
87
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
88
|
+
var TabList = (_a) => {
|
|
89
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
90
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_TabList.default, __spreadProps(__spreadValues({}, rest), { orientation: "horizontal", centered: false, children }));
|
|
69
91
|
};
|
|
70
92
|
|
|
71
93
|
// src/lib/TabPanel.tsx
|
|
72
94
|
var import_TabPanel = __toESM(require("@mui/lab/TabPanel"));
|
|
73
|
-
var
|
|
74
|
-
var TabPanel = (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
children
|
|
78
|
-
});
|
|
95
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
96
|
+
var TabPanel = (_a) => {
|
|
97
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_TabPanel.default, __spreadProps(__spreadValues({}, rest), { children }));
|
|
79
99
|
};
|
|
80
100
|
|
|
81
101
|
// src/lib/Tabs.tsx
|
|
82
102
|
var import_Tabs = __toESM(require("@mui/material/Tabs"));
|
|
83
|
-
var
|
|
84
|
-
var Tabs = (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
orientation: "horizontal",
|
|
88
|
-
centered: false,
|
|
89
|
-
children
|
|
90
|
-
});
|
|
103
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
104
|
+
var Tabs = (_a) => {
|
|
105
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_Tabs.default, __spreadProps(__spreadValues({}, rest), { orientation: "horizontal", centered: false, children }));
|
|
91
107
|
};
|
|
92
108
|
// Annotate the CommonJS export names for ESM import in node:
|
|
93
109
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -1,57 +1,72 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
|
|
1
33
|
// src/lib/Tab.tsx
|
|
2
34
|
import { default as MuiTab } from "@mui/material/Tab";
|
|
3
35
|
import { jsx } from "react/jsx-runtime";
|
|
4
36
|
var Tab = (props) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(MuiTab, {
|
|
6
|
-
...props,
|
|
7
|
-
disableRipple: true,
|
|
8
|
-
disableFocusRipple: true,
|
|
9
|
-
disableTouchRipple: true
|
|
10
|
-
});
|
|
37
|
+
return /* @__PURE__ */ jsx(MuiTab, __spreadProps(__spreadValues({}, props), { disableRipple: true, disableFocusRipple: true, disableTouchRipple: true }));
|
|
11
38
|
};
|
|
12
39
|
|
|
13
40
|
// src/lib/TabContext.tsx
|
|
14
41
|
import { default as MuiTabContext } from "@mui/lab/TabContext";
|
|
15
42
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
16
|
-
var TabContext = (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
children
|
|
20
|
-
});
|
|
43
|
+
var TabContext = (_a) => {
|
|
44
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
45
|
+
return /* @__PURE__ */ jsx2(MuiTabContext, __spreadProps(__spreadValues({}, rest), { children }));
|
|
21
46
|
};
|
|
22
47
|
|
|
23
48
|
// src/lib/TabList.tsx
|
|
24
49
|
import { default as MuiTabList } from "@mui/lab/TabList";
|
|
25
50
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
26
|
-
var TabList = (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
orientation: "horizontal",
|
|
30
|
-
centered: false,
|
|
31
|
-
children
|
|
32
|
-
});
|
|
51
|
+
var TabList = (_a) => {
|
|
52
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
53
|
+
return /* @__PURE__ */ jsx3(MuiTabList, __spreadProps(__spreadValues({}, rest), { orientation: "horizontal", centered: false, children }));
|
|
33
54
|
};
|
|
34
55
|
|
|
35
56
|
// src/lib/TabPanel.tsx
|
|
36
57
|
import { default as MuiTabPanel } from "@mui/lab/TabPanel";
|
|
37
58
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
38
|
-
var TabPanel = (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
children
|
|
42
|
-
});
|
|
59
|
+
var TabPanel = (_a) => {
|
|
60
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
61
|
+
return /* @__PURE__ */ jsx4(MuiTabPanel, __spreadProps(__spreadValues({}, rest), { children }));
|
|
43
62
|
};
|
|
44
63
|
|
|
45
64
|
// src/lib/Tabs.tsx
|
|
46
65
|
import { default as MuiTabs } from "@mui/material/Tabs";
|
|
47
66
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
48
|
-
var Tabs = (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
orientation: "horizontal",
|
|
52
|
-
centered: false,
|
|
53
|
-
children
|
|
54
|
-
});
|
|
67
|
+
var Tabs = (_a) => {
|
|
68
|
+
var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
|
|
69
|
+
return /* @__PURE__ */ jsx5(MuiTabs, __spreadProps(__spreadValues({}, rest), { orientation: "horizontal", centered: false, children }));
|
|
55
70
|
};
|
|
56
71
|
export {
|
|
57
72
|
Tab,
|
package/jest.config.js
CHANGED
|
@@ -4,4 +4,14 @@ module.exports = {
|
|
|
4
4
|
...global,
|
|
5
5
|
displayName: 'tabs',
|
|
6
6
|
coverageDirectory: '../../coverage/tabs',
|
|
7
|
+
/* TODO: Update to latest Jest snapshotFormat
|
|
8
|
+
* By default Nx has kept the older style of Jest Snapshot formats
|
|
9
|
+
* to prevent breaking of any existing tests with snapshots.
|
|
10
|
+
* It's recommend you update to the latest format.
|
|
11
|
+
* You can do this by removing snapshotFormat property
|
|
12
|
+
* and running tests with --update-snapshot flag.
|
|
13
|
+
* Example: From within the project directory, run "nx test --update-snapshot"
|
|
14
|
+
* More info: https://jestjs.io/docs/upgrading-to-jest29#snapshot-format
|
|
15
|
+
*/
|
|
16
|
+
snapshotFormat: { escapeString: true, printBasicPrototype: true },
|
|
7
17
|
};
|
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,12 +35,12 @@
|
|
|
35
35
|
"@mui/lab": "^5.0.0-alpha.147"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@availity/mui-divider": "^0.
|
|
39
|
-
"@mui/material": "^5.
|
|
38
|
+
"@availity/mui-divider": "^0.4.0",
|
|
39
|
+
"@mui/material": "^5.15.15",
|
|
40
40
|
"react": "18.2.0",
|
|
41
41
|
"react-dom": "18.2.0",
|
|
42
|
-
"tsup": "^
|
|
43
|
-
"typescript": "^4.
|
|
42
|
+
"tsup": "^8.0.2",
|
|
43
|
+
"typescript": "^5.4.5"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@mui/material": "^5.11.9",
|
package/project.json
CHANGED
|
@@ -6,10 +6,9 @@
|
|
|
6
6
|
"tags": [],
|
|
7
7
|
"targets": {
|
|
8
8
|
"lint": {
|
|
9
|
-
"executor": "@
|
|
9
|
+
"executor": "@nx/eslint:lint",
|
|
10
10
|
"options": {
|
|
11
11
|
"eslintConfig": ".eslintrc.json",
|
|
12
|
-
"lintFilePatterns": ["packages/tabs/**/*.{js,ts}"],
|
|
13
12
|
"silent": false,
|
|
14
13
|
"fix": false,
|
|
15
14
|
"cache": true,
|
|
@@ -22,20 +21,20 @@
|
|
|
22
21
|
}
|
|
23
22
|
},
|
|
24
23
|
"test": {
|
|
25
|
-
"executor": "@
|
|
26
|
-
"outputs": ["coverage/tabs"],
|
|
24
|
+
"executor": "@nx/jest:jest",
|
|
25
|
+
"outputs": ["{workspaceRoot}/coverage/tabs"],
|
|
27
26
|
"options": {
|
|
28
|
-
"jestConfig": "packages/tabs/jest.config.js"
|
|
29
|
-
"passWithNoTests": true
|
|
27
|
+
"jestConfig": "packages/tabs/jest.config.js"
|
|
30
28
|
}
|
|
31
29
|
},
|
|
32
30
|
"version": {
|
|
33
31
|
"executor": "@jscutlery/semver:version",
|
|
34
32
|
"options": {
|
|
35
33
|
"preset": "conventional",
|
|
36
|
-
"commitMessageFormat": "chore(
|
|
37
|
-
"tagPrefix": "@availity
|
|
38
|
-
"trackDeps": true
|
|
34
|
+
"commitMessageFormat": "chore({projectName}): release version ${version} [skip ci]",
|
|
35
|
+
"tagPrefix": "@availity/{projectName}@",
|
|
36
|
+
"trackDeps": true,
|
|
37
|
+
"skipCommitTypes": ["docs"]
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
}
|
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
|
};
|