@availity/mui-transitions 0.1.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 +10 -0
- package/README.md +61 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +44 -0
- package/dist/index.mjs +11 -0
- package/introduction.stories.mdx +7 -0
- package/jest.config.js +7 -0
- package/package.json +48 -0
- package/project.json +42 -0
- package/src/index.ts +1 -0
- package/src/lib/Collapse.stories.tsx +105 -0
- package/src/lib/Collapse.test.tsx +9 -0
- package/src/lib/Collapse.tsx +7 -0
- package/tsconfig.json +5 -0
- package/tsconfig.spec.json +10 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
## 0.1.0 (2024-02-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **mui-transitions:** add collapse ([b368bf7](https://github.com/Availity/element/commit/b368bf73810b50e710f1dc6698932c9ee1cc5ffc))
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @availity/mui-transitions
|
|
2
|
+
|
|
3
|
+
> Availity MUI transition components to be used with @availity/element design system.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@availity/mui-transitions)
|
|
6
|
+
[](https://www.npmjs.com/package/@availity/mui-transitions)
|
|
7
|
+
[](https://github.com/Availity/element/blob/main/packages/mui-transitions/package.json)
|
|
8
|
+
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
This package extends the MUI transition components: [MUI Transitions Docs](https://mui.com/components/transitions/)
|
|
12
|
+
|
|
13
|
+
Live demo and documentation in our [Storybook](https://availity.github.io/element/?path=/docs/components-transitions-introduction--docs)
|
|
14
|
+
|
|
15
|
+
Availity standards for design and usage can be found in the [Availity Design Guide](https://zeroheight.com/2e36e50c7)
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
### Import Through @availity/element (Recommended)
|
|
20
|
+
|
|
21
|
+
#### NPM
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @availity/element
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
#### Yarn
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
yarn add @availity/element
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Direct Import
|
|
34
|
+
|
|
35
|
+
#### NPM
|
|
36
|
+
|
|
37
|
+
_This package has a few peer dependencies. Add `@mui/material` & `@emotion/react` to your project if not already installed._
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install @availity/mui-transitions
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Yarn
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
yarn add @availity/mui-transitions
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Usage
|
|
50
|
+
|
|
51
|
+
#### Import through @availity/element
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Collapse } from '@availity/element';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Direct import
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { Collapse } from '@availity/mui-transitions';
|
|
61
|
+
```
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// src/index.ts
|
|
27
|
+
var src_exports = {};
|
|
28
|
+
__export(src_exports, {
|
|
29
|
+
Collapse: () => Collapse
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(src_exports);
|
|
32
|
+
|
|
33
|
+
// src/lib/Collapse.tsx
|
|
34
|
+
var import_Collapse = __toESM(require("@mui/material/Collapse"));
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var Collapse = (props) => {
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Collapse.default, {
|
|
38
|
+
...props
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
Collapse
|
|
44
|
+
});
|
package/dist/index.mjs
ADDED
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@availity/mui-transitions",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Availity MUI Transitions Component - part of the @availity/element design system",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"typescript",
|
|
8
|
+
"availity",
|
|
9
|
+
"mui"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://availity.github.io/element/?path=/docs/components-transitions-introduction--docs",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Availity/element/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/Availity/element.git",
|
|
18
|
+
"directory": "packages/transitions"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Availity Developers <AVOSS@availity.com>",
|
|
22
|
+
"browser": "./dist/index.js",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"module": "./dist/index.mjs",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
28
|
+
"dev": "tsup src/index.ts --format esm,cjs --watch --dts",
|
|
29
|
+
"clean": "rm -rf dist",
|
|
30
|
+
"clean:nm": "rm -rf node_modules",
|
|
31
|
+
"publish": "yarn npm publish --tolerate-republish --access public",
|
|
32
|
+
"publish:canary": "yarn npm publish --access public --tag canary"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@mui/material": "^5.11.9",
|
|
36
|
+
"react": "18.2.0",
|
|
37
|
+
"react-dom": "18.2.0",
|
|
38
|
+
"tsup": "^5.12.7",
|
|
39
|
+
"typescript": "^4.6.4"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@mui/material": "^5.11.9",
|
|
43
|
+
"react": ">=16.3.0"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
}
|
|
48
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mui-transitions",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "packages/transitions/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"lint": {
|
|
9
|
+
"executor": "@nrwl/linter:eslint",
|
|
10
|
+
"options": {
|
|
11
|
+
"eslintConfig": ".eslintrc.json",
|
|
12
|
+
"lintFilePatterns": ["packages/transitions/**/*.{js,ts}"],
|
|
13
|
+
"silent": false,
|
|
14
|
+
"fix": false,
|
|
15
|
+
"cache": true,
|
|
16
|
+
"cacheLocation": "./node_modules/.cache/transitions/.eslintcache",
|
|
17
|
+
"maxWarnings": -1,
|
|
18
|
+
"quiet": false,
|
|
19
|
+
"noEslintrc": false,
|
|
20
|
+
"hasTypeAwareRules": true,
|
|
21
|
+
"cacheStrategy": "metadata"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"test": {
|
|
25
|
+
"executor": "@nrwl/jest:jest",
|
|
26
|
+
"outputs": ["coverage/transitions"],
|
|
27
|
+
"options": {
|
|
28
|
+
"jestConfig": "packages/transitions/jest.config.js",
|
|
29
|
+
"passWithNoTests": true
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"version": {
|
|
33
|
+
"executor": "@jscutlery/semver:version",
|
|
34
|
+
"options": {
|
|
35
|
+
"preset": "conventional",
|
|
36
|
+
"commitMessageFormat": "chore(${projectName}): release version ${version} [skip ci]",
|
|
37
|
+
"tagPrefix": "@availity/${projectName}@",
|
|
38
|
+
"trackDeps": true
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/Collapse';
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Each exported component in the package should have its own stories file
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { Collapse, CollapseProps } from './Collapse';
|
|
6
|
+
import Switch from '@mui/material/Switch/Switch';
|
|
7
|
+
import FormControlLabel from '@mui/material/FormControlLabel/FormControlLabel';
|
|
8
|
+
import Box from '@mui/material/Box/Box';
|
|
9
|
+
import Paper from '@mui/material/Paper/Paper';
|
|
10
|
+
import visuallyHidden from '@mui/utils/visuallyHidden';
|
|
11
|
+
import Table from '@mui/material/Table/Table';
|
|
12
|
+
import TableHead from '@mui/material/TableHead/TableHead';
|
|
13
|
+
import TableRow from '@mui/material/TableRow/TableRow';
|
|
14
|
+
import TableCell from '@mui/material/TableCell/TableCell';
|
|
15
|
+
import TableBody from '@mui/material/TableBody/TableBody';
|
|
16
|
+
import Alert from '@mui/material/Alert/Alert';
|
|
17
|
+
|
|
18
|
+
/** Expand from the start edge of the child element. */
|
|
19
|
+
const meta: Meta<typeof Collapse> = {
|
|
20
|
+
title: 'Components/Transitions/Collapse',
|
|
21
|
+
component: Collapse,
|
|
22
|
+
tags: ['autodocs'],
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default meta;
|
|
26
|
+
|
|
27
|
+
export const _Collapse: StoryObj<typeof Collapse> = {
|
|
28
|
+
render: (args: CollapseProps) => {
|
|
29
|
+
const [visible, setVisible] = useState(true);
|
|
30
|
+
|
|
31
|
+
const onClose = () => {
|
|
32
|
+
setVisible(false);
|
|
33
|
+
setTimeout(() => setVisible(true), 1000);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Collapse in={visible} {...args}>
|
|
38
|
+
<Alert onClose={onClose}>Dismissable Alert</Alert>
|
|
39
|
+
</Collapse>
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const _Options: StoryObj<typeof Collapse> = {
|
|
45
|
+
render: () => {
|
|
46
|
+
const [checked, setChecked] = useState(true);
|
|
47
|
+
|
|
48
|
+
const handleChange = () => {
|
|
49
|
+
setChecked((prev) => !prev);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const background = <Paper sx={{ m: 1, width: 100, height: 100, bgcolor: 'grey.200' }} elevation={4} />;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<Box>
|
|
56
|
+
<FormControlLabel control={<Switch checked={checked} onChange={handleChange} />} label="Show" />
|
|
57
|
+
<Table role="presentation" sx={{ width: 250 }}>
|
|
58
|
+
<TableHead>
|
|
59
|
+
<TableRow>
|
|
60
|
+
<TableCell>
|
|
61
|
+
<Box sx={visuallyHidden}>Orientation</Box>
|
|
62
|
+
</TableCell>
|
|
63
|
+
<TableCell>
|
|
64
|
+
<Box sx={{ width: 120 }}>collapsedSize 0</Box>
|
|
65
|
+
</TableCell>
|
|
66
|
+
<TableCell>
|
|
67
|
+
<Box sx={{ width: 120 }}>collapsedSize 40</Box>
|
|
68
|
+
</TableCell>
|
|
69
|
+
</TableRow>
|
|
70
|
+
</TableHead>
|
|
71
|
+
<TableBody>
|
|
72
|
+
<TableRow sx={{ verticalAlign: 'top' }}>
|
|
73
|
+
<TableCell>
|
|
74
|
+
<Box sx={{ height: 120 }}>Vertical</Box>
|
|
75
|
+
</TableCell>
|
|
76
|
+
<TableCell>
|
|
77
|
+
<Collapse in={checked}>{background}</Collapse>
|
|
78
|
+
</TableCell>
|
|
79
|
+
<TableCell>
|
|
80
|
+
<Collapse in={checked} collapsedSize={40}>
|
|
81
|
+
{background}
|
|
82
|
+
</Collapse>
|
|
83
|
+
</TableCell>
|
|
84
|
+
</TableRow>
|
|
85
|
+
<TableRow sx={{ verticalAlign: 'top' }}>
|
|
86
|
+
<TableCell>
|
|
87
|
+
<Box sx={{ height: 120 }}>Horizontal</Box>
|
|
88
|
+
</TableCell>
|
|
89
|
+
<TableCell>
|
|
90
|
+
<Collapse orientation="horizontal" in={checked}>
|
|
91
|
+
{background}
|
|
92
|
+
</Collapse>
|
|
93
|
+
</TableCell>
|
|
94
|
+
<TableCell>
|
|
95
|
+
<Collapse orientation="horizontal" in={checked} collapsedSize={40}>
|
|
96
|
+
{background}
|
|
97
|
+
</Collapse>
|
|
98
|
+
</TableCell>
|
|
99
|
+
</TableRow>
|
|
100
|
+
</TableBody>
|
|
101
|
+
</Table>
|
|
102
|
+
</Box>
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { Collapse } from './Collapse';
|
|
3
|
+
|
|
4
|
+
describe('Collapse', () => {
|
|
5
|
+
test('should render successfully', () => {
|
|
6
|
+
const { getByText } = render(<Collapse>Test</Collapse>);
|
|
7
|
+
expect(getByText('Test')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"types": ["jest", "node", "@testing-library/jest-dom"],
|
|
7
|
+
"allowJs": true
|
|
8
|
+
},
|
|
9
|
+
"include": ["**/*.test.js", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"]
|
|
10
|
+
}
|