@availity/mui-dialog 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 +20 -0
- package/README.md +61 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +93 -0
- package/dist/index.mjs +56 -0
- package/introduction.mdx +7 -0
- package/jest.config.js +7 -0
- package/package.json +50 -0
- package/project.json +42 -0
- package/src/index.ts +5 -0
- package/src/lib/Dialog.stories.tsx +60 -0
- package/src/lib/Dialog.test.tsx +9 -0
- package/src/lib/Dialog.tsx +12 -0
- package/src/lib/DialogActions.stories.tsx +24 -0
- package/src/lib/DialogActions.test.tsx +9 -0
- package/src/lib/DialogActions.tsx +9 -0
- package/src/lib/DialogContent.stories.tsx +18 -0
- package/src/lib/DialogContent.test.tsx +9 -0
- package/src/lib/DialogContent.tsx +9 -0
- package/src/lib/DialogContentText.stories.tsx +18 -0
- package/src/lib/DialogContentText.test.tsx +9 -0
- package/src/lib/DialogContentText.tsx +11 -0
- package/src/lib/DialogTitle.stories.tsx +18 -0
- package/src/lib/DialogTitle.test.tsx +9 -0
- package/src/lib/DialogTitle.tsx +9 -0
- package/tsconfig.json +5 -0
- package/tsconfig.spec.json +10 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
|
+
|
|
5
|
+
## 0.1.0 (2024-02-08)
|
|
6
|
+
|
|
7
|
+
### Dependency Updates
|
|
8
|
+
|
|
9
|
+
* `mui-button` updated to version `0.6.1`
|
|
10
|
+
* `mui-layout` updated to version `0.1.3`
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* add dialog component ([ff151f0](https://github.com/Availity/element/commit/ff151f02d90114615f9beb635bea69989aa9a117))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **mui-dialog:** add tests ([765b491](https://github.com/Availity/element/commit/765b491bc5402c468a6ce5f9468e690ee884b816))
|
|
20
|
+
* **mui-dialog:** add tests ([9396041](https://github.com/Availity/element/commit/93960416de25782f9f535cc2d99ac50672812706))
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# @availity/mui-dialog
|
|
2
|
+
|
|
3
|
+
> Availity MUI Dialog component to be used with @availity/element design system.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@availity/mui-dialog)
|
|
6
|
+
[](https://www.npmjs.com/package/@availity/mui-dialog)
|
|
7
|
+
[](https://github.com/Availity/element/blob/main/packages/mui-dialog/package.json)
|
|
8
|
+
|
|
9
|
+
## Documentation
|
|
10
|
+
|
|
11
|
+
This package extends the MUI Dialog component: [MUI Dialog Docs](https://mui.com/components/dialog/)
|
|
12
|
+
|
|
13
|
+
Live demo and documentation in our [Storybook](https://availity.github.io/element/?path=/docs/components-dialog-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-dialog
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Yarn
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
yarn add @availity/mui-dialog
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Usage
|
|
50
|
+
|
|
51
|
+
#### Import through @availity/element
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Dialog } from '@availity/element';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Direct import
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
import { Dialog } from '@availity/mui-dialog';
|
|
61
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { DialogProps as DialogProps$1 } from '@mui/material/Dialog';
|
|
2
|
+
import { DialogActionsProps as DialogActionsProps$1 } from '@mui/material/DialogActions';
|
|
3
|
+
import { DialogContentProps as DialogContentProps$1 } from '@mui/material/DialogContent';
|
|
4
|
+
import { DialogContentTextProps as DialogContentTextProps$1 } from '@mui/material/DialogContentText';
|
|
5
|
+
import { DialogTitleProps as DialogTitleProps$1 } from '@mui/material/DialogTitle';
|
|
6
|
+
|
|
7
|
+
type DialogProps = Omit<DialogProps$1, 'BackdropComponent' | 'BackdropProps' | 'PaperComponent' | 'PaperProps' | 'TransitionComponent' | 'TransitionProps'> & {
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
};
|
|
10
|
+
declare const Dialog: ({ children, ...rest }: DialogProps) => JSX.Element;
|
|
11
|
+
|
|
12
|
+
interface DialogActionsProps extends DialogActionsProps$1 {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
declare const DialogActions: ({ children, ...rest }: DialogActionsProps) => JSX.Element;
|
|
16
|
+
|
|
17
|
+
interface DialogContentProps extends DialogContentProps$1 {
|
|
18
|
+
children?: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const DialogContent: ({ children, ...rest }: DialogContentProps) => JSX.Element;
|
|
21
|
+
|
|
22
|
+
interface DialogContentTextProps extends DialogContentTextProps$1 {
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare const DialogContentText: ({ children, ...rest }: DialogContentTextProps) => JSX.Element;
|
|
26
|
+
|
|
27
|
+
interface DialogTitleProps extends DialogTitleProps$1 {
|
|
28
|
+
children?: React.ReactNode;
|
|
29
|
+
}
|
|
30
|
+
declare const DialogTitle: ({ children, ...rest }: DialogTitleProps) => JSX.Element;
|
|
31
|
+
|
|
32
|
+
export { Dialog, DialogActions, DialogActionsProps, DialogContent, DialogContentProps, DialogContentText, DialogContentTextProps, DialogProps, DialogTitle, DialogTitleProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
Dialog: () => Dialog,
|
|
30
|
+
DialogActions: () => DialogActions,
|
|
31
|
+
DialogContent: () => DialogContent,
|
|
32
|
+
DialogContentText: () => DialogContentText,
|
|
33
|
+
DialogTitle: () => DialogTitle
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
|
|
37
|
+
// src/lib/Dialog.tsx
|
|
38
|
+
var import_Dialog = __toESM(require("@mui/material/Dialog"));
|
|
39
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
40
|
+
var Dialog = ({ children, ...rest }) => {
|
|
41
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Dialog.default, {
|
|
42
|
+
...rest,
|
|
43
|
+
children
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// src/lib/DialogActions.tsx
|
|
48
|
+
var import_DialogActions = __toESM(require("@mui/material/DialogActions"));
|
|
49
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
50
|
+
var DialogActions = ({ children, ...rest }) => {
|
|
51
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DialogActions.default, {
|
|
52
|
+
...rest,
|
|
53
|
+
children
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// src/lib/DialogContent.tsx
|
|
58
|
+
var import_DialogContent = __toESM(require("@mui/material/DialogContent"));
|
|
59
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
60
|
+
var DialogContent = ({ children, ...rest }) => {
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DialogContent.default, {
|
|
62
|
+
...rest,
|
|
63
|
+
children
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// src/lib/DialogContentText.tsx
|
|
68
|
+
var import_DialogContentText = __toESM(require("@mui/material/DialogContentText"));
|
|
69
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
70
|
+
var DialogContentText = ({ children, ...rest }) => {
|
|
71
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DialogContentText.default, {
|
|
72
|
+
...rest,
|
|
73
|
+
children
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// src/lib/DialogTitle.tsx
|
|
78
|
+
var import_DialogTitle = __toESM(require("@mui/material/DialogTitle"));
|
|
79
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
80
|
+
var DialogTitle = ({ children, ...rest }) => {
|
|
81
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DialogTitle.default, {
|
|
82
|
+
...rest,
|
|
83
|
+
children
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
Dialog,
|
|
89
|
+
DialogActions,
|
|
90
|
+
DialogContent,
|
|
91
|
+
DialogContentText,
|
|
92
|
+
DialogTitle
|
|
93
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// src/lib/Dialog.tsx
|
|
2
|
+
import MuiDialog from "@mui/material/Dialog";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
var Dialog = ({ children, ...rest }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(MuiDialog, {
|
|
6
|
+
...rest,
|
|
7
|
+
children
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// src/lib/DialogActions.tsx
|
|
12
|
+
import MuiDialogActions from "@mui/material/DialogActions";
|
|
13
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
14
|
+
var DialogActions = ({ children, ...rest }) => {
|
|
15
|
+
return /* @__PURE__ */ jsx2(MuiDialogActions, {
|
|
16
|
+
...rest,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// src/lib/DialogContent.tsx
|
|
22
|
+
import MuiDialogContent from "@mui/material/DialogContent";
|
|
23
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
24
|
+
var DialogContent = ({ children, ...rest }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx3(MuiDialogContent, {
|
|
26
|
+
...rest,
|
|
27
|
+
children
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/lib/DialogContentText.tsx
|
|
32
|
+
import MuiDialogContentText from "@mui/material/DialogContentText";
|
|
33
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
34
|
+
var DialogContentText = ({ children, ...rest }) => {
|
|
35
|
+
return /* @__PURE__ */ jsx4(MuiDialogContentText, {
|
|
36
|
+
...rest,
|
|
37
|
+
children
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/lib/DialogTitle.tsx
|
|
42
|
+
import MuiDialogTitle from "@mui/material/DialogTitle";
|
|
43
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
44
|
+
var DialogTitle = ({ children, ...rest }) => {
|
|
45
|
+
return /* @__PURE__ */ jsx5(MuiDialogTitle, {
|
|
46
|
+
...rest,
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
Dialog,
|
|
52
|
+
DialogActions,
|
|
53
|
+
DialogContent,
|
|
54
|
+
DialogContentText,
|
|
55
|
+
DialogTitle
|
|
56
|
+
};
|
package/introduction.mdx
ADDED
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@availity/mui-dialog",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Availity MUI Dialog 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-dialog-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/dialog"
|
|
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
|
+
"@availity/mui-button": "0.6.1",
|
|
36
|
+
"@availity/mui-layout": "0.1.3",
|
|
37
|
+
"@mui/material": "^5.11.9",
|
|
38
|
+
"react": "18.2.0",
|
|
39
|
+
"react-dom": "18.2.0",
|
|
40
|
+
"tsup": "^5.12.7",
|
|
41
|
+
"typescript": "^4.6.4"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"@mui/material": "^5.11.9",
|
|
45
|
+
"react": ">=16.3.0"
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
}
|
|
50
|
+
}
|
package/project.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mui-dialog",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "packages/dialog/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"targets": {
|
|
8
|
+
"lint": {
|
|
9
|
+
"executor": "@nrwl/linter:eslint",
|
|
10
|
+
"options": {
|
|
11
|
+
"eslintConfig": ".eslintrc.json",
|
|
12
|
+
"lintFilePatterns": ["packages/dialog/**/*.{js,ts}"],
|
|
13
|
+
"silent": false,
|
|
14
|
+
"fix": false,
|
|
15
|
+
"cache": true,
|
|
16
|
+
"cacheLocation": "./node_modules/.cache/dialog/.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/dialog"],
|
|
27
|
+
"options": {
|
|
28
|
+
"jestConfig": "packages/dialog/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,60 @@
|
|
|
1
|
+
// Each exported component in the package should have its own stories file
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
+
import { Button } from '@availity/mui-button';
|
|
5
|
+
|
|
6
|
+
import { Dialog, DialogProps } from './Dialog';
|
|
7
|
+
import { DialogActions } from './DialogActions';
|
|
8
|
+
import { DialogContent } from './DialogContent';
|
|
9
|
+
import { DialogContentText } from './DialogContentText';
|
|
10
|
+
import { DialogTitle } from './DialogTitle';
|
|
11
|
+
|
|
12
|
+
const meta: Meta<typeof Dialog> = {
|
|
13
|
+
title: 'Components/Dialog/Dialog',
|
|
14
|
+
component: Dialog,
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
export const _Dialog: StoryObj<typeof Dialog> = {
|
|
21
|
+
render: (args: DialogProps) => {
|
|
22
|
+
const [open, setOpen] = useState(args.open);
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
setOpen(args.open);
|
|
26
|
+
}, [args.open]);
|
|
27
|
+
|
|
28
|
+
const handleOpen = () => {
|
|
29
|
+
setOpen(true);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const handleClose = () => {
|
|
33
|
+
setOpen(false);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<Button onClick={handleOpen}>Open Dialog</Button>
|
|
39
|
+
<Dialog open={open} onClose={handleClose}>
|
|
40
|
+
<DialogTitle id="alert-dialog-title">Availity Dialog</DialogTitle>
|
|
41
|
+
<DialogContent>
|
|
42
|
+
<DialogContentText>{args.children}</DialogContentText>
|
|
43
|
+
</DialogContent>
|
|
44
|
+
<DialogActions>
|
|
45
|
+
<Button onClick={handleClose} color="secondary">
|
|
46
|
+
Disagree
|
|
47
|
+
</Button>
|
|
48
|
+
<Button onClick={handleClose} autoFocus>
|
|
49
|
+
Agree
|
|
50
|
+
</Button>
|
|
51
|
+
</DialogActions>
|
|
52
|
+
</Dialog>
|
|
53
|
+
</>
|
|
54
|
+
);
|
|
55
|
+
},
|
|
56
|
+
args: {
|
|
57
|
+
children: 'Here is some text in the dialog box.',
|
|
58
|
+
open: false,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { Dialog } from './Dialog';
|
|
3
|
+
|
|
4
|
+
describe('Dialog', () => {
|
|
5
|
+
test('should render successfully', () => {
|
|
6
|
+
const { getByText } = render(<Dialog open>Test</Dialog>);
|
|
7
|
+
expect(getByText('Test')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import MuiDialog, { DialogProps as MuiDialogProps } from '@mui/material/Dialog';
|
|
2
|
+
|
|
3
|
+
export type DialogProps = Omit<
|
|
4
|
+
MuiDialogProps,
|
|
5
|
+
'BackdropComponent' | 'BackdropProps' | 'PaperComponent' | 'PaperProps' | 'TransitionComponent' | 'TransitionProps'
|
|
6
|
+
> & {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Dialog = ({ children, ...rest }: DialogProps): JSX.Element => {
|
|
11
|
+
return <MuiDialog {...rest}>{children}</MuiDialog>;
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Box } from '@availity/mui-layout';
|
|
3
|
+
import { Button } from '@availity/mui-button';
|
|
4
|
+
|
|
5
|
+
import { DialogActions, DialogActionsProps } from './DialogActions';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof DialogActions> = {
|
|
8
|
+
title: 'Components/Dialog/DialogActions',
|
|
9
|
+
component: DialogActions,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
export const _DialogActions: StoryObj<typeof DialogActions> = {
|
|
16
|
+
render: (args: DialogActionsProps) => (
|
|
17
|
+
<Box sx={{ maxWidth: '250px' }}>
|
|
18
|
+
<DialogActions {...args}>
|
|
19
|
+
<Button>Action Button</Button>
|
|
20
|
+
</DialogActions>
|
|
21
|
+
</Box>
|
|
22
|
+
),
|
|
23
|
+
args: {},
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { DialogActions } from './DialogActions';
|
|
3
|
+
|
|
4
|
+
describe('DialogActions', () => {
|
|
5
|
+
test('should render successfully', () => {
|
|
6
|
+
const { getByText } = render(<DialogActions>Test</DialogActions>);
|
|
7
|
+
expect(getByText('Test')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import MuiDialogActions, { DialogActionsProps as MuiDialogActionsProps } from '@mui/material/DialogActions';
|
|
2
|
+
|
|
3
|
+
export interface DialogActionsProps extends MuiDialogActionsProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const DialogActions = ({ children, ...rest }: DialogActionsProps): JSX.Element => {
|
|
8
|
+
return <MuiDialogActions {...rest}>{children}</MuiDialogActions>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { DialogContent, DialogContentProps } from './DialogContent';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof DialogContent> = {
|
|
6
|
+
title: 'Components/Dialog/DialogContent',
|
|
7
|
+
component: DialogContent,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
export const _DialogContent: StoryObj<typeof DialogContent> = {
|
|
14
|
+
render: (args: DialogContentProps) => <DialogContent {...args} />,
|
|
15
|
+
args: {
|
|
16
|
+
children: 'Modal Content Body',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { DialogContent } from './DialogContent';
|
|
3
|
+
|
|
4
|
+
describe('DialogContent', () => {
|
|
5
|
+
test('should render successfully', () => {
|
|
6
|
+
const { getByText } = render(<DialogContent>Test</DialogContent>);
|
|
7
|
+
expect(getByText('Test')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import MuiDialogContent, { DialogContentProps as MuiDialogContentProps } from '@mui/material/DialogContent';
|
|
2
|
+
|
|
3
|
+
export interface DialogContentProps extends MuiDialogContentProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const DialogContent = ({ children, ...rest }: DialogContentProps): JSX.Element => {
|
|
8
|
+
return <MuiDialogContent {...rest}>{children}</MuiDialogContent>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { DialogContentText, DialogContentTextProps } from './DialogContentText';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof DialogContentText> = {
|
|
6
|
+
title: 'Components/Dialog/DialogContentText',
|
|
7
|
+
component: DialogContentText,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
export const _DialogContentText: StoryObj<typeof DialogContentText> = {
|
|
14
|
+
render: (args: DialogContentTextProps) => <DialogContentText {...args} />,
|
|
15
|
+
args: {
|
|
16
|
+
children: 'Modal Content Body',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { DialogContentText } from './DialogContentText';
|
|
3
|
+
|
|
4
|
+
describe('DialogContentText', () => {
|
|
5
|
+
test('should render successfully', () => {
|
|
6
|
+
const { getByText } = render(<DialogContentText>Test</DialogContentText>);
|
|
7
|
+
expect(getByText('Test')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import MuiDialogContentText, {
|
|
2
|
+
DialogContentTextProps as MuiDialogContentTextProps,
|
|
3
|
+
} from '@mui/material/DialogContentText';
|
|
4
|
+
|
|
5
|
+
export interface DialogContentTextProps extends MuiDialogContentTextProps {
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const DialogContentText = ({ children, ...rest }: DialogContentTextProps): JSX.Element => {
|
|
10
|
+
return <MuiDialogContentText {...rest}>{children}</MuiDialogContentText>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { DialogTitle, DialogTitleProps } from './DialogTitle';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof DialogTitle> = {
|
|
6
|
+
title: 'Components/Dialog/DialogTitle',
|
|
7
|
+
component: DialogTitle,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
export const _DialogTitle: StoryObj<typeof DialogTitle> = {
|
|
14
|
+
render: (args: DialogTitleProps) => <DialogTitle {...args} />,
|
|
15
|
+
args: {
|
|
16
|
+
children: 'Modal Title',
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { render } from '@testing-library/react';
|
|
2
|
+
import { DialogTitle } from './DialogTitle';
|
|
3
|
+
|
|
4
|
+
describe('DialogTitle', () => {
|
|
5
|
+
test('should render successfully', () => {
|
|
6
|
+
const { getByText } = render(<DialogTitle>Test</DialogTitle>);
|
|
7
|
+
expect(getByText('Test')).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import MuiDialogTitle, { DialogTitleProps as MuiDialogTitleProps } from '@mui/material/DialogTitle';
|
|
2
|
+
|
|
3
|
+
export interface DialogTitleProps extends MuiDialogTitleProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export const DialogTitle = ({ children, ...rest }: DialogTitleProps): JSX.Element => {
|
|
8
|
+
return <MuiDialogTitle {...rest}>{children}</MuiDialogTitle>;
|
|
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
|
+
}
|