@availity/mui-popper 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,14 @@
1
+ # Changelog
2
+
3
+ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
+
5
+ ## 0.1.0 (2023-12-12)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `mui-layout` updated to version `0.1.3`
10
+ * `mui-button` updated to version `0.6.0`
11
+
12
+ ### Features
13
+
14
+ * **mui-popper:** initial commit ([b70ee38](https://github.com/Availity/element/commit/b70ee382304605f43480c48dee5855aada32f267))
package/README.md ADDED
@@ -0,0 +1,61 @@
1
+ # @availity/mui-popper
2
+
3
+ > Availity MUI Popper component to be used with @availity/element design system.
4
+
5
+ [![Version](https://img.shields.io/npm/v/@availity/mui-popper.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/mui-popper)
6
+ [![NPM Downloads](https://img.shields.io/npm/dt/@availity/mui-popper.svg?style=for-the-badge)](https://www.npmjs.com/package/@availity/mui-popper)
7
+ [![Dependency Status](https://img.shields.io/librariesio/release/npm/@availity/mui-popper?style=for-the-badge)](https://github.com/Availity/element/blob/main/packages/mui-popper/package.json)
8
+
9
+ ## Documentation
10
+
11
+ This package extends the MUI Popper component: [MUI Popper Docs](https://mui.com/components/popper/)
12
+
13
+ Live demo and documentation in our [Storybook](https://availity.github.io/element/?path=/docs/components-popper-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-popper
41
+ ```
42
+
43
+ #### Yarn
44
+
45
+ ```bash
46
+ yarn add @availity/mui-popper
47
+ ```
48
+
49
+ ### Usage
50
+
51
+ #### Import through @availity/element
52
+
53
+ ```tsx
54
+ import { Popper } from '@availity/element';
55
+ ```
56
+
57
+ #### Direct import
58
+
59
+ ```tsx
60
+ import { Popper } from '@availity/mui-popper';
61
+ ```
@@ -0,0 +1,6 @@
1
+ import { PopperProps as PopperProps$1 } from '@mui/material';
2
+
3
+ type PopperProps = PopperProps$1;
4
+ declare const Popper: ({ children, ...rest }: PopperProps) => JSX.Element;
5
+
6
+ export { Popper, PopperProps };
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ Popper: () => Popper
24
+ });
25
+ module.exports = __toCommonJS(src_exports);
26
+
27
+ // src/lib/Popper.tsx
28
+ var import_material = require("@mui/material");
29
+ var import_jsx_runtime = require("react/jsx-runtime");
30
+ var Popper = ({ children, ...rest }) => {
31
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_material.Popper, {
32
+ ...rest,
33
+ children
34
+ });
35
+ };
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ Popper
39
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,12 @@
1
+ // src/lib/Popper.tsx
2
+ import { Popper as MuiPopper } from "@mui/material";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var Popper = ({ children, ...rest }) => {
5
+ return /* @__PURE__ */ jsx(MuiPopper, {
6
+ ...rest,
7
+ children
8
+ });
9
+ };
10
+ export {
11
+ Popper
12
+ };
@@ -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/Popper/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: 'popper',
6
+ coverageDirectory: '../../coverage/popper',
7
+ };
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@availity/mui-popper",
3
+ "version": "0.1.0",
4
+ "description": "Availity MUI Popper 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-popper-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/popper"
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-popper",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/popper/src",
5
+ "projectType": "library",
6
+ "tags": [],
7
+ "targets": {
8
+ "lint": {
9
+ "executor": "@nrwl/linter:eslint",
10
+ "options": {
11
+ "eslintConfig": ".eslintrc.json",
12
+ "lintFilePatterns": ["packages/popper/**/*.{js,ts}"],
13
+ "silent": false,
14
+ "fix": false,
15
+ "cache": true,
16
+ "cacheLocation": "./node_modules/.cache/popper/.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/popper"],
27
+ "options": {
28
+ "jestConfig": "packages/popper/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/Popper';
@@ -0,0 +1,42 @@
1
+ // Each exported component in the package should have its own stories file
2
+
3
+ import { useState } from 'react';
4
+ import { Box } from '@availity/mui-layout';
5
+ import { Button } from '@availity/mui-button';
6
+ import type { Meta, StoryObj } from '@storybook/react';
7
+ import { Popper, PopperProps } from './Popper';
8
+
9
+ const meta: Meta<typeof Popper> = {
10
+ title: 'Components/Popper/Popper',
11
+ component: Popper,
12
+ tags: ['autodocs'],
13
+ };
14
+
15
+ export default meta;
16
+
17
+ export const _Popper: StoryObj<typeof Popper> = {
18
+ render: () => {
19
+ const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
20
+
21
+ const handleClick = (event: React.MouseEvent<HTMLElement>) => {
22
+ setAnchorEl(anchorEl ? null : event.currentTarget);
23
+ };
24
+
25
+ const open = Boolean(anchorEl);
26
+ const id = open ? 'simple-popper' : undefined;
27
+
28
+ return (
29
+ <div>
30
+ <Button aria-describedby={id} type="button" onClick={handleClick}>
31
+ Toggle Popper
32
+ </Button>
33
+ <Popper id={id} open={open} anchorEl={anchorEl}>
34
+ <Box sx={{ border: 1, p: 1, bgcolor: 'background.paper' }}>The content of the Popper.</Box>
35
+ </Popper>
36
+ </div>
37
+ );
38
+ },
39
+ args: {
40
+ children: 'This text is a child of Popper',
41
+ },
42
+ };
@@ -0,0 +1,14 @@
1
+ import { render } from '@testing-library/react';
2
+ import { Popper } from './Popper';
3
+
4
+ describe('Popper', () => {
5
+ test('should render successfully', () => {
6
+ const { getByText } = render(<Popper open>Test</Popper>);
7
+ expect(getByText('Test')).toBeTruthy();
8
+ });
9
+
10
+ test('should hide successfully', () => {
11
+ const { queryByText } = render(<Popper open={false}>Test</Popper>);
12
+ expect(queryByText('Test')).not.toBeInTheDocument();
13
+ });
14
+ });
@@ -0,0 +1,7 @@
1
+ import { Popper as MuiPopper, PopperProps as MuiPopperProps } from '@mui/material';
2
+
3
+ export type PopperProps = MuiPopperProps;
4
+
5
+ export const Popper = ({ children, ...rest }: PopperProps): JSX.Element => {
6
+ return <MuiPopper {...rest}>{children}</MuiPopper>;
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
+ }