-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
4,313 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files": [ | ||
{ | ||
"path": "./dist/index.js", | ||
"maxSize": "2 kB" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# @availity/mui-icon | ||
|
||
> Availity MUI Icon component to be used with @availity/element design system. | ||
[](https://www.npmjs.com/package/@availity/mui-icon) | ||
[](https://www.npmjs.com/package/@availity/mui-icon) | ||
[](https://github.com/Availity/availity-react/blob/master/packages/mui-icon/package.json) | ||
|
||
- ⚠️ _needs component theme added to @availity/theme_ | ||
- ⚠️ _needs UI Team Verification (must conform to [Availity's Figma Design Standards](https://www.figma.com/file/bf6l79hehcKdRjb5Kzq1De/Element--MUI-%F0%9F%9A%A7?node-id=4662%3A14&t=QMqHeT6daeqXbjBR-1) - private link)_ | ||
|
||
## Documentation | ||
|
||
This package extends the MUI SvgIcon component([MUI Icon Docs](https://mui.com/components/icons/)) to wrap UX Approved Font Awesome Icons. | ||
|
||
Live demo and documentation in our [Storybook](https://availity.github.io/element/?path=/docs/components-icon-introduction--docs) | ||
|
||
Availity standards for design and usage can be found in the [Availity Design Guide](https://zeroheight.com/2e36e50c7) | ||
|
||
## Installation | ||
|
||
### Import Through @availity/element (Recommended) | ||
|
||
#### NPM | ||
|
||
```bash | ||
npm install @availity/element | ||
``` | ||
|
||
#### Yarn | ||
|
||
```bash | ||
yarn add @availity/element | ||
``` | ||
|
||
### Direct Import | ||
|
||
#### NPM | ||
|
||
```bash | ||
npm install @availity/mui-icon | ||
``` | ||
|
||
#### Yarn | ||
|
||
```bash | ||
yarn add @availity/mui-icon | ||
``` | ||
|
||
### Usage | ||
|
||
#### Import through @availity/element | ||
|
||
```tsx | ||
import { HomeIcon } from '@availity/element'; | ||
``` | ||
|
||
#### Direct import | ||
|
||
```tsx | ||
import { HomeIcon } from '@availity/mui-icon'; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"files": [ | ||
{ | ||
"path": "./dist/index.js", | ||
"maxSize": "10 kB" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Markdown } from '@storybook/blocks'; | ||
import { Meta } from '@storybook/addon-docs'; | ||
import ReadMe from './README.md?raw'; | ||
|
||
<Meta title="Components/Icon/Introduction" /> | ||
|
||
<Markdown>{ReadMe}</Markdown> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const global = require('../../jest.config.global'); | ||
|
||
module.exports = { | ||
...global, | ||
displayName: 'icon', | ||
coverageDirectory: '../../coverage/icon', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{ | ||
"name": "@availity/mui-icon", | ||
"version": "0.0.0", | ||
"description": "Availity MUI Icon Component - part of the @availity/element design system", | ||
"keywords": [ | ||
"react", | ||
"typescript", | ||
"availity", | ||
"mui" | ||
], | ||
"homepage": "https://availity.github.io/element/?path=/docs/components-icon-introduction--docs", | ||
"bugs": { | ||
"url": "https://github.com/Availity/element/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/Availity/element.git", | ||
"directory": "packages/icon" | ||
}, | ||
"license": "MIT", | ||
"author": "Availity Developers <[email protected]>", | ||
"browser": "./dist/index.js", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsup src/index.ts --format esm,cjs --dts", | ||
"dev": "tsup src/index.ts --format esm,cjs --watch --dts", | ||
"clean": "rm -rf dist", | ||
"clean:nm": "rm -rf node_modules", | ||
"bundlesize": "bundlesize", | ||
"publish": "yarn npm publish --tolerate-republish --access public", | ||
"publish:canary": "yarn npm publish --access public --tag canary" | ||
}, | ||
"dependencies": { | ||
"@fortawesome/free-regular-svg-icons": "^6.3.0", | ||
"@fortawesome/free-solid-svg-icons": "^6.3.0" | ||
}, | ||
"devDependencies": { | ||
"@mui/material": "^5.11.9", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"tsup": "^5.12.7", | ||
"typescript": "^4.6.4" | ||
}, | ||
"peerDependencies": { | ||
"@mui/material": "^5.11.9", | ||
"react": ">=16.3.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "mui-icon", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "packages/icon/src", | ||
"projectType": "library", | ||
"tags": [], | ||
"targets": { | ||
"lint": { | ||
"executor": "@nrwl/linter:eslint", | ||
"options": { | ||
"eslintConfig": ".eslintrc.json", | ||
"lintFilePatterns": ["packages/icon/**/*.{js,ts}"], | ||
"silent": false, | ||
"fix": false, | ||
"cache": true, | ||
"cacheLocation": "./node_modules/.cache/icon/.eslintcache", | ||
"maxWarnings": -1, | ||
"quiet": false, | ||
"noEslintrc": false, | ||
"hasTypeAwareRules": true, | ||
"cacheStrategy": "metadata" | ||
} | ||
}, | ||
"test": { | ||
"executor": "@nrwl/jest:jest", | ||
"outputs": ["coverage/icon"], | ||
"options": { | ||
"jestConfig": "packages/icon/jest.config.js", | ||
"passWithNoTests": true | ||
} | ||
}, | ||
"version": { | ||
"executor": "@jscutlery/semver:version", | ||
"options": { | ||
"preset": "conventional", | ||
"commitMessageFormat": "chore(${projectName}): release version ${version} [skip ci]", | ||
"tagPrefix": "@availity/${projectName}@" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export * from './lib/Icons/Actions'; | ||
export * from './lib/Icons/Common'; | ||
export * from './lib/Icons/Files'; | ||
export * from './lib/Icons/Form'; | ||
export * from './lib/Icons/Navigation'; | ||
export * from './lib/Icons/Payment'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { render } from '@testing-library/react'; | ||
import { faHome } from '@fortawesome/free-solid-svg-icons/faHome'; | ||
import { FaSvgIcon } from './FaSvgIcon'; | ||
|
||
describe('FaSvgIcon', () => { | ||
test('should render FaSvgIcon successfully', () => { | ||
const { getByTestId } = render(<FaSvgIcon icon={faHome} data-testid='home-icon'/>); | ||
expect(getByTestId('home-icon')).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// FontAwesomeSvgIcon example from mui docs https://github.com/mui/material-ui/blob/master/docs/data/material/components/icons/FontAwesomeSvgIconDemo.js | ||
|
||
import * as React from 'react'; | ||
import { IconDefinition } from '@fortawesome/free-solid-svg-icons'; | ||
import { SvgIcon, SvgIconProps } from '@mui/material'; | ||
|
||
export interface FaSvgIconProps extends SvgIconProps { | ||
/** Font Awesome Svg */ | ||
icon: IconDefinition | ||
} | ||
|
||
export const FaSvgIcon = React.forwardRef<SVGSVGElement, FaSvgIconProps>((props, ref) => { | ||
const { icon, ...svgProps } = props; | ||
|
||
const { | ||
icon: [width, height, , , svgPathData], | ||
} = icon; | ||
|
||
return ( | ||
<SvgIcon ref={ref} viewBox={`0 0 ${width} ${height}`} {...svgProps}> | ||
{typeof svgPathData === 'string' ? ( | ||
<path d={svgPathData} /> | ||
) : ( | ||
/** | ||
* A multi-path Font Awesome icon seems to imply a duotune icon. | ||
* Only available in Pro which we wouldn't publicly export regardless. | ||
*/ | ||
null | ||
)} | ||
</SvgIcon> | ||
); | ||
}); |
Oops, something went wrong.