@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 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
+ [![Version](https://img.shields.io/npm/v/@availity/mui-transitions.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/mui-transitions)
6
+ [![NPM Downloads](https://img.shields.io/npm/dt/@availity/mui-transitions.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/mui-transitions)
7
+ [![Dependency Status](https://img.shields.io/librariesio/release/npm/@availity/mui-transitions?style=for-the-badge)](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
+ ```
@@ -0,0 +1,6 @@
1
+ import { CollapseProps as CollapseProps$1 } from '@mui/material/Collapse';
2
+
3
+ type CollapseProps = CollapseProps$1;
4
+ declare const Collapse: (props: CollapseProps) => JSX.Element;
5
+
6
+ export { Collapse, CollapseProps };
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
@@ -0,0 +1,11 @@
1
+ // src/lib/Collapse.tsx
2
+ import MuiCollapse from "@mui/material/Collapse";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var Collapse = (props) => {
5
+ return /* @__PURE__ */ jsx(MuiCollapse, {
6
+ ...props
7
+ });
8
+ };
9
+ export {
10
+ Collapse
11
+ };
@@ -0,0 +1,7 @@
1
+ import { Markdown } from '@storybook/blocks';
2
+ import { Meta } from '@storybook/addon-docs';
3
+ import ReadMe from './README.md?raw';
4
+
5
+ <Meta title="Components/Transitions/Introduction" />
6
+
7
+ <Markdown>{ReadMe}</Markdown>
package/jest.config.js ADDED
@@ -0,0 +1,7 @@
1
+ const global = require('../../jest.config.global');
2
+
3
+ module.exports = {
4
+ ...global,
5
+ displayName: 'transitions',
6
+ coverageDirectory: '../../coverage/transitions',
7
+ };
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
+ });
@@ -0,0 +1,7 @@
1
+ import MuiCollapse, { CollapseProps as MuiCollapseProps } from '@mui/material/Collapse';
2
+
3
+ export type CollapseProps = MuiCollapseProps;
4
+
5
+ export const Collapse = (props: CollapseProps): JSX.Element => {
6
+ return <MuiCollapse {...props} />;
7
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "include": ["."],
4
+ "exclude": ["dist", "build", "node_modules"]
5
+ }
@@ -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
+ }