├── .npmignore ├── .eslintignore ├── src ├── components │ ├── Card │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── Card.d.ts │ │ ├── Card.js │ │ └── cardStyle.js │ ├── Button │ │ ├── index.js │ │ ├── index.d.ts │ │ └── Button.d.ts │ ├── SideMenu │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── SideMenu.d.ts │ │ └── sideMenuStyle.js │ ├── DateTime │ │ ├── index.js │ │ ├── index.d.ts │ │ └── dateTimeStyle.js │ ├── IconCard │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── iconCardStyle.js │ │ └── IconCard.d.ts │ ├── NavPills │ │ ├── index.js │ │ └── index.d.ts │ ├── Tooltip │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── Tooltip.js │ │ └── Tooltip.d.ts │ ├── AddButton │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── AddButton.js │ │ └── AddButton.d.ts │ ├── CardTitle │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── CardTitle.d.ts │ │ ├── cardTitleStyle.js │ │ └── CardTitle.js │ ├── ChartCard │ │ ├── index.js │ │ ├── index.d.ts │ │ └── ChartCard.d.ts │ ├── EditButton │ │ ├── index.js │ │ ├── index.d.ts │ │ └── EditButton.js │ ├── IconButton │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── iconButtonStyle.js │ │ ├── IconButton.js │ │ └── IconButton.d.ts │ ├── ImageCard │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── ImageCard.d.ts │ │ ├── ImageCard.js │ │ └── imageCardStyle.js │ ├── NotFound │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── NotFound.js │ │ └── NotFound.d.ts │ ├── Pagination │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── paginationStyle.js │ │ └── PaginationActions.js │ ├── SaveButton │ │ ├── index.js │ │ ├── index.d.ts │ │ └── SaveButton.js │ ├── StatsCard │ │ ├── index.js │ │ ├── index.d.ts │ │ └── StatsCard.d.ts │ ├── Typography │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── typographyStyle.js │ │ └── Typography.d.ts │ ├── Accordion │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── Accordion.d.ts │ │ └── accordionStyle.js │ ├── Forbidden │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── forbiddenStyle.js │ │ ├── Forbidden.d.ts │ │ └── Forbidden.js │ ├── Autocomplete │ │ ├── index.js │ │ ├── index.d.ts │ │ └── autocompleteStyle.js │ ├── BackToButton │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── BackToButton.js │ │ └── BackToButton.d.ts │ ├── CancelButton │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── CancelButton.js │ │ └── CancelButton.d.ts │ ├── Charts │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── components │ │ │ ├── ChartMix.js │ │ │ ├── ChartBar.js │ │ │ └── ChartLine.js │ │ └── ChartFactory.d.ts │ ├── CustomDialog │ │ ├── index.js │ │ ├── index.d.ts │ │ └── customDialogStyle.js │ ├── DeleteButton │ │ ├── index.js │ │ ├── index.d.ts │ │ ├── DeleteButton.d.ts │ │ └── DeleteButton.js │ ├── DynamicInput │ │ ├── index.js │ │ ├── index.d.ts │ │ └── DynamicInput.d.ts │ ├── RegularCard │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── regularCardStyle.js │ │ └── RegularCard.d.ts │ ├── SimpleSlider │ │ ├── index.js │ │ ├── index.d.ts │ │ └── simpleSliderStyle.js │ ├── Toast │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── toastStyle.js │ │ ├── ToastContainer.d.ts │ │ ├── Toast.js │ │ └── ToastContainer.js │ ├── UploadButton │ │ ├── index.js │ │ ├── index.d.ts │ │ └── UploadButton.js │ ├── UpwardButton │ │ ├── index.js │ │ ├── index.d.ts │ │ └── UpwardButton.js │ ├── DialogDisplay │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── dialogDisplayStyle.js │ │ └── DialogDisplay.d.ts │ ├── ExpandingText │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── ExpandingText.d.ts │ │ └── ExpandingText.js │ ├── FakeText │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── LoadingFakeText.d.ts │ │ └── LoadingFakeText.js │ ├── PasswordField │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── PasswordField.d.ts │ │ └── PasswordField.js │ ├── CustomTextField │ │ ├── index.js │ │ ├── index.d.ts │ │ └── textFieldStyle.js │ ├── DownloadButton │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── DownloadButton.js │ │ └── DownloadButton.d.ts │ ├── DownwardButton │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── DownwardButton.js │ │ └── DownwardButton.d.ts │ ├── TemplateEditor │ │ ├── index.d.ts │ │ ├── index.js │ │ └── TemplateEditor.d.ts │ ├── FileUploadButton │ │ ├── index.d.ts │ │ ├── index.js │ │ └── FileUploadButton.d.ts │ ├── IconCollapseCard │ │ ├── index.d.ts │ │ ├── index.js │ │ └── iconCollapseCardStyle.js │ ├── CustomLinearProgress │ │ ├── index.d.ts │ │ ├── index.js │ │ ├── CustomLinearProgress.d.ts │ │ ├── CustomLinearProgress.js │ │ └── customLinearProgressStyle.js │ ├── CheckInternetConnection │ │ ├── index.js │ │ └── CheckInternetConnection.js │ └── themes │ │ └── index.js ├── assets │ └── img │ │ └── defaultLogo.png └── utils │ └── constants.js ├── babel.config.cjs ├── __tests__ ├── Toast │ ├── __snapshots__ │ │ └── Toast.test.js.snap │ └── Toast.test.js ├── NotFound │ ├── __snapshots__ │ │ └── NotFound.test.js.snap │ └── NotFound.test.js ├── FakeText │ ├── FakeText.test.js │ └── __snapshots__ │ │ └── FakeText.test.js.snap ├── Typography │ └── Typography.test.js ├── Tooltip │ ├── Tooltip.test.js │ └── __snapshots__ │ │ └── Tooltip.test.js.snap ├── SideMenu │ ├── SideMenu.test.js │ └── __snapshots__ │ │ └── SideMenu.test.js.snap ├── CustomLinearProgress │ ├── CustomLinearProgress.test.js │ └── __snapshots__ │ │ └── CustomLinearProgress.test.js.snap ├── FileUploadButton │ ├── FileUploadButton.test.js │ └── __snapshots__ │ │ └── FileUploadButton.test.js.snap ├── IconButton │ ├── IconButton.test.js │ └── __snapshots__ │ │ └── IconButton.test.js.snap ├── Forbidden │ └── Forbidden.test.js ├── BackToButton │ └── BackToButton.test.js ├── CancelButton │ └── CancelButton.test.js ├── RegularCard │ ├── RegularCard.test.js │ └── __snapshots__ │ │ └── RegularCard.test.js.snap ├── EditButton │ └── EditButton.test.js ├── Pagination │ └── Pagination.test.js ├── StatsCard │ ├── StatsCard.test.js │ └── __snapshots__ │ │ └── StatsCard.test.js.snap ├── ExpandingText │ ├── __snapshots__ │ │ └── ExpandingText.test.js.snap │ └── ExpandingText.test.js ├── ImageCard │ └── ImageCard.test.js ├── DialogDisplay │ └── DialogDisplay.test.js ├── SimpleSlider │ └── SimpleSlider.test.js ├── PasswordField │ └── PasswordField.test.js ├── IconCollapseCard │ └── IconCollapseCard.test.js ├── SaveButton │ └── SaveButton.test.js ├── NavPills │ └── NavPills.test.js ├── UploadButton │ └── UploadButton.test.js ├── UpwardButton │ └── UpwardButton.test.js ├── IconCard │ └── IconCard.test.js ├── AddButton │ └── AddButton.test.js ├── CustomTextField │ └── CustomTextField.test.js ├── Card │ └── Card.test.js ├── DownloadButton │ └── DownloadButton.test.js ├── CardTitle │ └── CardTitle.test.js ├── DownwardButton │ └── DownwardButton.test.js ├── DeleteButton │ └── DeleteButton.test.js ├── Datetime │ └── Datetime.test.js ├── Accordion │ └── Accordion.test.js └── Button │ └── Button.test.js ├── .editorconfig ├── .prettier.json ├── setupTests.js ├── .vscode ├── settings.json └── launch.json ├── .github ├── release-drafter.yml ├── workflows │ └── release-drafter.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── LICENSE └── .eslintrc.json /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | src/ 3 | components/ 4 | rollup.config.mjs -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/ 2 | dist/ 3 | node_modules/ 4 | .snapshots/ 5 | *.min.js -------------------------------------------------------------------------------- /src/components/Card/index.js: -------------------------------------------------------------------------------- 1 | import Card from "./Card"; 2 | export default Card; -------------------------------------------------------------------------------- /src/components/Button/index.js: -------------------------------------------------------------------------------- 1 | import Button from "./Button"; 2 | export default Button; -------------------------------------------------------------------------------- /src/components/Card/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Card'; 2 | export * from './Card'; -------------------------------------------------------------------------------- /src/components/SideMenu/index.js: -------------------------------------------------------------------------------- 1 | import SideMenu from './SideMenu' 2 | export default SideMenu -------------------------------------------------------------------------------- /src/components/Button/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Button'; 2 | export * from './Button'; -------------------------------------------------------------------------------- /src/components/DateTime/index.js: -------------------------------------------------------------------------------- 1 | import DateTime from "./DateTime"; 2 | export default DateTime; -------------------------------------------------------------------------------- /src/components/IconCard/index.js: -------------------------------------------------------------------------------- 1 | import IconCard from "./IconCard"; 2 | export default IconCard; -------------------------------------------------------------------------------- /src/components/NavPills/index.js: -------------------------------------------------------------------------------- 1 | import NavPills from "./NavPills"; 2 | export default NavPills; -------------------------------------------------------------------------------- /src/components/Tooltip/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Tooltip' 2 | export * from './Tooltip' -------------------------------------------------------------------------------- /src/components/Tooltip/index.js: -------------------------------------------------------------------------------- 1 | import Tooltip from "./Tooltip"; 2 | export default Tooltip; 3 | -------------------------------------------------------------------------------- /src/components/AddButton/index.js: -------------------------------------------------------------------------------- 1 | import AddButton from "./AddButton"; 2 | export default AddButton; -------------------------------------------------------------------------------- /src/components/CardTitle/index.js: -------------------------------------------------------------------------------- 1 | import CardTitle from "./CardTitle"; 2 | export default CardTitle; -------------------------------------------------------------------------------- /src/components/ChartCard/index.js: -------------------------------------------------------------------------------- 1 | import ChartCard from "./ChartCard"; 2 | export default ChartCard; -------------------------------------------------------------------------------- /src/components/DateTime/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DateTime'; 2 | export * from './DateTime'; -------------------------------------------------------------------------------- /src/components/EditButton/index.js: -------------------------------------------------------------------------------- 1 | import EditButton from "./EditButton"; 2 | export default EditButton; -------------------------------------------------------------------------------- /src/components/IconButton/index.js: -------------------------------------------------------------------------------- 1 | import IconButton from "./IconButton"; 2 | export default IconButton; -------------------------------------------------------------------------------- /src/components/IconCard/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './IconCard'; 2 | export * from './IconCard'; -------------------------------------------------------------------------------- /src/components/ImageCard/index.js: -------------------------------------------------------------------------------- 1 | import ImageCard from "./ImageCard"; 2 | export default ImageCard; -------------------------------------------------------------------------------- /src/components/NavPills/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './NavPills'; 2 | export * from './NavPills'; -------------------------------------------------------------------------------- /src/components/NotFound/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './NotFound'; 2 | export * from './NotFound'; -------------------------------------------------------------------------------- /src/components/NotFound/index.js: -------------------------------------------------------------------------------- 1 | import NotFound from "./NotFound"; 2 | export default NotFound; 3 | -------------------------------------------------------------------------------- /src/components/Pagination/index.js: -------------------------------------------------------------------------------- 1 | import Pagination from "./Pagination"; 2 | export default Pagination; -------------------------------------------------------------------------------- /src/components/SaveButton/index.js: -------------------------------------------------------------------------------- 1 | import SaveButton from "./SaveButton"; 2 | export default SaveButton; -------------------------------------------------------------------------------- /src/components/SideMenu/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './SideMenu' 2 | export * from './SideMenu' -------------------------------------------------------------------------------- /src/components/StatsCard/index.js: -------------------------------------------------------------------------------- 1 | import StatsCard from "./StatsCard"; 2 | export default StatsCard; -------------------------------------------------------------------------------- /src/components/Typography/index.js: -------------------------------------------------------------------------------- 1 | import Typography from './Typography'; 2 | export default Typography; -------------------------------------------------------------------------------- /babel.config.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['@babel/preset-env', '@babel/preset-react'], 3 | }; -------------------------------------------------------------------------------- /src/components/Accordion/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Accordion'; 2 | export * from './Accordion'; -------------------------------------------------------------------------------- /src/components/Accordion/index.js: -------------------------------------------------------------------------------- 1 | import Accordion from "./Accordion"; 2 | export default Accordion; 3 | -------------------------------------------------------------------------------- /src/components/AddButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './AddButton'; 2 | export * from './AddButton'; -------------------------------------------------------------------------------- /src/components/CardTitle/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CardTitle'; 2 | export * from './CardTitle'; -------------------------------------------------------------------------------- /src/components/ChartCard/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ChartCard'; 2 | export * from './ChartCard'; -------------------------------------------------------------------------------- /src/components/Forbidden/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Forbidden'; 2 | export * from './Forbidden'; -------------------------------------------------------------------------------- /src/components/Forbidden/index.js: -------------------------------------------------------------------------------- 1 | import Forbidden from "./Forbidden"; 2 | export default Forbidden; 3 | -------------------------------------------------------------------------------- /src/components/ImageCard/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ImageCard'; 2 | export * from './ImageCard'; -------------------------------------------------------------------------------- /src/components/StatsCard/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './StatsCard'; 2 | export * from './StatsCard'; -------------------------------------------------------------------------------- /src/components/Autocomplete/index.js: -------------------------------------------------------------------------------- 1 | import Autocomplete from "./Autocomplete"; 2 | export default Autocomplete; -------------------------------------------------------------------------------- /src/components/BackToButton/index.js: -------------------------------------------------------------------------------- 1 | import BackToButton from "./BackToButton"; 2 | export default BackToButton; -------------------------------------------------------------------------------- /src/components/CancelButton/index.js: -------------------------------------------------------------------------------- 1 | import CancelButton from "./CancelButton"; 2 | export default CancelButton; -------------------------------------------------------------------------------- /src/components/Charts/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ChartFactory'; 2 | export * from './ChartFactory'; -------------------------------------------------------------------------------- /src/components/Charts/index.js: -------------------------------------------------------------------------------- 1 | import ChartFactory from "./ChartFactory"; 2 | export default ChartFactory; 3 | -------------------------------------------------------------------------------- /src/components/CustomDialog/index.js: -------------------------------------------------------------------------------- 1 | import CustomDialog from "./CustomDialog"; 2 | export default CustomDialog; -------------------------------------------------------------------------------- /src/components/DeleteButton/index.js: -------------------------------------------------------------------------------- 1 | import DeleteButton from "./DeleteButton"; 2 | export default DeleteButton; -------------------------------------------------------------------------------- /src/components/DynamicInput/index.js: -------------------------------------------------------------------------------- 1 | import DynamicInput from "./DynamicInput"; 2 | export default DynamicInput; -------------------------------------------------------------------------------- /src/components/EditButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './EditButton'; 2 | export * from './EditButton'; -------------------------------------------------------------------------------- /src/components/IconButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './IconButton'; 2 | export * from './IconButton'; -------------------------------------------------------------------------------- /src/components/Pagination/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Pagination'; 2 | export * from './Pagination'; -------------------------------------------------------------------------------- /src/components/RegularCard/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './RegularCard'; 2 | export * from './RegularCard'; -------------------------------------------------------------------------------- /src/components/RegularCard/index.js: -------------------------------------------------------------------------------- 1 | import RegularCard from "./RegularCard"; 2 | export default RegularCard; 3 | -------------------------------------------------------------------------------- /src/components/SaveButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './SaveButton'; 2 | export * from './SaveButton'; -------------------------------------------------------------------------------- /src/components/SimpleSlider/index.js: -------------------------------------------------------------------------------- 1 | import SimpleSlider from "./SimpleSlider"; 2 | export default SimpleSlider; -------------------------------------------------------------------------------- /src/components/Toast/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ToastContainer'; 2 | export * from './ToastContainer'; -------------------------------------------------------------------------------- /src/components/Typography/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Typography'; 2 | export * from './Typography'; -------------------------------------------------------------------------------- /src/components/UploadButton/index.js: -------------------------------------------------------------------------------- 1 | import UploadButton from "./UploadButton"; 2 | export default UploadButton; -------------------------------------------------------------------------------- /src/components/UpwardButton/index.js: -------------------------------------------------------------------------------- 1 | import UpwardButton from "./UpwardButton"; 2 | export default UpwardButton; -------------------------------------------------------------------------------- /src/components/Autocomplete/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './Autocomplete'; 2 | export * from './Autocomplete'; -------------------------------------------------------------------------------- /src/components/BackToButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './BackToButton'; 2 | export * from './BackToButton'; -------------------------------------------------------------------------------- /src/components/CancelButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CancelButton'; 2 | export * from './CancelButton'; -------------------------------------------------------------------------------- /src/components/CustomDialog/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CustomDialog'; 2 | export * from './CustomDialog'; -------------------------------------------------------------------------------- /src/components/DeleteButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DeleteButton'; 2 | export * from './DeleteButton'; -------------------------------------------------------------------------------- /src/components/DialogDisplay/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DialogDisplay'; 2 | export * from './DialogDisplay'; -------------------------------------------------------------------------------- /src/components/DialogDisplay/index.js: -------------------------------------------------------------------------------- 1 | import DialogDisplay from "./DialogDisplay"; 2 | export default DialogDisplay; -------------------------------------------------------------------------------- /src/components/DynamicInput/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DynamicInput'; 2 | export * from './DynamicInput'; -------------------------------------------------------------------------------- /src/components/ExpandingText/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './ExpandingText'; 2 | export * from './ExpandingText'; -------------------------------------------------------------------------------- /src/components/FakeText/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './LoadingFakeText'; 2 | export * from './LoadingFakeText'; -------------------------------------------------------------------------------- /src/components/PasswordField/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './PasswordField'; 2 | export * from './PasswordField'; -------------------------------------------------------------------------------- /src/components/PasswordField/index.js: -------------------------------------------------------------------------------- 1 | import PasswordField from "./PasswordField"; 2 | export default PasswordField; -------------------------------------------------------------------------------- /src/components/SimpleSlider/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './SimpleSlider'; 2 | export * from './SimpleSlider'; -------------------------------------------------------------------------------- /src/components/UploadButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './UploadButton'; 2 | export * from './UploadButton'; -------------------------------------------------------------------------------- /src/components/UpwardButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './UpwardButton'; 2 | export * from './UpwardButton'; -------------------------------------------------------------------------------- /src/components/CustomTextField/index.js: -------------------------------------------------------------------------------- 1 | import CustomTextField from "./CustomTextField"; 2 | export default CustomTextField; -------------------------------------------------------------------------------- /src/components/DownloadButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DownloadButton'; 2 | export * from './DownloadButton'; -------------------------------------------------------------------------------- /src/components/DownloadButton/index.js: -------------------------------------------------------------------------------- 1 | import DownloadButton from "./DownloadButton"; 2 | export default DownloadButton; -------------------------------------------------------------------------------- /src/components/DownwardButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './DownwardButton'; 2 | export * from './DownwardButton'; -------------------------------------------------------------------------------- /src/components/DownwardButton/index.js: -------------------------------------------------------------------------------- 1 | import DownwardButton from "./DownwardButton"; 2 | export default DownwardButton; -------------------------------------------------------------------------------- /src/components/ExpandingText/index.js: -------------------------------------------------------------------------------- 1 | import ExpandingText from "./ExpandingText"; 2 | export default ExpandingText; 3 | -------------------------------------------------------------------------------- /src/components/FakeText/index.js: -------------------------------------------------------------------------------- 1 | import LoadingFakeText from "./LoadingFakeText"; 2 | export default LoadingFakeText; 3 | -------------------------------------------------------------------------------- /src/components/TemplateEditor/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './TemplateEditor'; 2 | export * from './TemplateEditor'; -------------------------------------------------------------------------------- /src/components/TemplateEditor/index.js: -------------------------------------------------------------------------------- 1 | import TemplateEditor from "./TemplateEditor"; 2 | export default TemplateEditor; -------------------------------------------------------------------------------- /src/components/CustomTextField/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CustomTextField'; 2 | export * from './CustomTextField'; -------------------------------------------------------------------------------- /src/components/FileUploadButton/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './FileUploadButton'; 2 | export * from './FileUploadButton'; -------------------------------------------------------------------------------- /src/components/FileUploadButton/index.js: -------------------------------------------------------------------------------- 1 | import FileUploadButton from "./FileUploadButton"; 2 | export default FileUploadButton; -------------------------------------------------------------------------------- /src/components/IconCollapseCard/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './IconCollapseCard'; 2 | export * from './IconCollapseCard'; -------------------------------------------------------------------------------- /src/components/IconCollapseCard/index.js: -------------------------------------------------------------------------------- 1 | import IconCollapseCard from "./IconCollapseCard"; 2 | export default IconCollapseCard; -------------------------------------------------------------------------------- /src/assets/img/defaultLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/osstotalsoft/rocket-webapp-components/HEAD/src/assets/img/defaultLogo.png -------------------------------------------------------------------------------- /src/components/CustomLinearProgress/index.d.ts: -------------------------------------------------------------------------------- 1 | export { default } from './CustomLinearProgress'; 2 | export * from './CustomLinearProgress'; -------------------------------------------------------------------------------- /src/components/CustomLinearProgress/index.js: -------------------------------------------------------------------------------- 1 | import CustomLinearProgress from "./CustomLinearProgress"; 2 | export default CustomLinearProgress; -------------------------------------------------------------------------------- /src/components/CheckInternetConnection/index.js: -------------------------------------------------------------------------------- 1 | import CheckInternetConnection from "./CheckInternetConnection"; 2 | export default CheckInternetConnection; -------------------------------------------------------------------------------- /src/components/Toast/index.js: -------------------------------------------------------------------------------- 1 | import { useToast } from "./Toast"; 2 | import ToastContainer from "./ToastContainer"; 3 | export { useToast, ToastContainer }; -------------------------------------------------------------------------------- /src/utils/constants.js: -------------------------------------------------------------------------------- 1 | export const emptyArray = [] 2 | export const emptyObject = {} 3 | export const emptyString = '' 4 | export const emptyFunction = () => {} 5 | -------------------------------------------------------------------------------- /__tests__/Toast/__snapshots__/Toast.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ToastContainer Snapshot 1`] = ` 4 |
7 | `; 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.prettier.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 140, 3 | "tabWidth": 2, 4 | "singleQuote": true, 5 | "semi": false, 6 | "jsxSingleQuote": true, 7 | "trailingComma": "none", 8 | "arrowParens": "avoid" 9 | } 10 | -------------------------------------------------------------------------------- /setupTests.js: -------------------------------------------------------------------------------- 1 | import { configure } from 'enzyme' 2 | import Adapter from 'enzyme-adapter-react-16' 3 | import 'regenerator-runtime/runtime' 4 | import '@testing-library/jest-dom' 5 | 6 | configure({ adapter: new Adapter() }) -------------------------------------------------------------------------------- /__tests__/NotFound/__snapshots__/NotFound.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Render NotFound render correctly NotFound component 1`] = ` 4 |
7 | `; 8 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "javascript.validate.enable": false, 3 | "javascript.format.enable": true, 4 | "typescript.format.enable": false, 5 | "editor.defaultFormatter": "esbenp.prettier-vscode", 6 | "[javascript]": { 7 | "editor.defaultFormatter": "esbenp.prettier-vscode" 8 | } 9 | } -------------------------------------------------------------------------------- /src/components/CheckInternetConnection/CheckInternetConnection.js: -------------------------------------------------------------------------------- 1 | import 'offline-js/offline.min.js'; 2 | import 'offline-js/themes/offline-theme-chrome.css'; 3 | import 'offline-js/themes/offline-language-english.css'; 4 | 5 | const CheckInternetConnection = () => null 6 | 7 | export default CheckInternetConnection; -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: v$NEXT_PATCH_VERSION 2 | tag-template: v$NEXT_PATCH_VERSION 3 | categories: 4 | - title: 🚀 Features 5 | label: feature 6 | - title: 🐛 Bug Fixes 7 | label: fix 8 | - title: 🛠️ Maintenance 9 | label: chore 10 | change-template: '- $TITLE @$AUTHOR (#$NUMBER)' 11 | template: | 12 | ## Changes 13 | $CHANGES -------------------------------------------------------------------------------- /src/components/Forbidden/forbiddenStyle.js: -------------------------------------------------------------------------------- 1 | const forbiddenStyle = () => { 2 | return { 3 | cardStyle: { 4 | backgroundColor: "#f44336", 5 | padding: "6px 16px", 6 | textAlign: "center", 7 | marginTop: '50px' 8 | }, 9 | textStyle: { 10 | color: "#fff" 11 | } 12 | } 13 | } 14 | 15 | export default forbiddenStyle; -------------------------------------------------------------------------------- /__tests__/Toast/Toast.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import ToastContainer from "../../components/Toast/ToastContainer"; 4 | 5 | describe("ToastContainer", () => { 6 | it("Snapshot", () => { 7 | const component = renderer.create(); 8 | 9 | const json = component.toJSON(); 10 | expect(json).toMatchSnapshot(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/components/NotFound/NotFound.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import Card from "../Card"; 4 | 5 | const NotFound = ({ title }) => { 6 | return {title}; 7 | }; 8 | 9 | NotFound.propTypes = { 10 | /** 11 | * The message to be displayed when this component is rendered 12 | */ 13 | title: PropTypes.string 14 | }; 15 | 16 | export default NotFound; 17 | -------------------------------------------------------------------------------- /__tests__/NotFound/NotFound.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import NotFound from "../../components/NotFound/NotFound"; 4 | 5 | describe("Render NotFound", () => { 6 | it("render correctly NotFound component", () => { 7 | const component = renderer.create(); 8 | 9 | const json = component.toJSON(); 10 | expect(json).toMatchSnapshot(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # See https://help.github.com/ignore-files/ for more about ignoring files. 3 | 4 | # dependencies 5 | node_modules 6 | 7 | # builds 8 | build 9 | dist 10 | .rpt2_cache 11 | 12 | # misc 13 | .DS_Store 14 | .env 15 | .env.local 16 | .env.development.local 17 | .env.test.local 18 | .env.production.local 19 | 20 | npm-debug.log* 21 | yarn-debug.log* 22 | yarn-error.log* 23 | example/package-lock.json 24 | 25 | .bit 26 | coverage -------------------------------------------------------------------------------- /__tests__/FakeText/FakeText.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import renderer from 'react-test-renderer'; 3 | import LoadingFakeText from '../../components/FakeText/LoadingFakeText'; 4 | 5 | describe('LoadingFakeText', () => { 6 | it('snapshot', () => { 7 | const component = renderer.create(); 8 | 9 | const json = component.toJSON(); 10 | expect(json).toMatchSnapshot(); 11 | }); 12 | }); -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | workflow_dispatch: 8 | inputs: 9 | 10 | jobs: 11 | update_release_draft: 12 | runs-on: ubuntu-latest 13 | steps: 14 | # Drafts your next Release notes as Pull Requests are merged into "master" 15 | - uses: release-drafter/release-drafter@v5 16 | env: 17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 18 | -------------------------------------------------------------------------------- /src/components/Tooltip/Tooltip.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import { Tooltip as BaseTooltip } from "@material-ui/core"; 4 | 5 | const Tooltip = ({ children, ...rest }) => { 6 | return ( 7 | 8 | {children} 9 | 10 | ); 11 | }; 12 | 13 | Tooltip.propTypes = { 14 | /** 15 | * The component(s) wrapped 16 | */ 17 | children: PropTypes.node 18 | }; 19 | 20 | export default Tooltip; 21 | -------------------------------------------------------------------------------- /src/components/themes/index.js: -------------------------------------------------------------------------------- 1 | import defaultTheme from "./defaultTheme"; 2 | import blueTheme from "./blueTheme"; 3 | import greenTheme from "./greenTheme"; 4 | import lightBlueTheme from "./lightBlueTheme"; 5 | import orangeTheme from "./orangeTheme"; 6 | import redTheme from "./redTheme"; 7 | import vividOrangeTheme from "./vividOrangeTheme"; 8 | 9 | export { 10 | defaultTheme, 11 | blueTheme, 12 | greenTheme, 13 | lightBlueTheme, 14 | orangeTheme, 15 | redTheme, 16 | vividOrangeTheme 17 | }; 18 | -------------------------------------------------------------------------------- /src/components/Typography/typographyStyle.js: -------------------------------------------------------------------------------- 1 | const typographyStyle = theme => ({ 2 | defaultFont: { 3 | fontFamily: theme.typography.fontFamily, 4 | textTransform: "none" 5 | } 6 | }); 7 | 8 | export const emphasisType = { 9 | bold: { fontWeight: "bold" }, 10 | italic: { fontStyle: "italic" }, 11 | overline: { textDecoration: "overline" }, 12 | "line-through": { textDecoration: "line-through" }, 13 | underline: { textDecoration: "underline" } 14 | }; 15 | 16 | export default typographyStyle; 17 | -------------------------------------------------------------------------------- /__tests__/Typography/Typography.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Typography from "../../components/Typography/Typography"; 3 | import { mount } from "enzyme"; 4 | 5 | describe("Typography", () => { 6 | test("variant property should be equal to the default value provided", () => { 7 | const wrapper = mount( 8 | 9 | Text to be displayed 10 | 11 | ); 12 | 13 | expect(wrapper.props().variant).toBe("inherit"); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /__tests__/Tooltip/Tooltip.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import Tooltip from "../../components/Tooltip/Tooltip"; 4 | import Button from "../../components/Button/Button"; 5 | 6 | describe("Tooltip", () => { 7 | it("Snapshot", () => { 8 | const component = renderer.create( 9 | 10 | 11 | 12 | ); 13 | 14 | const json = component.toJSON(); 15 | expect(json).toMatchSnapshot(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /src/components/NotFound/NotFound.d.ts: -------------------------------------------------------------------------------- 1 | export interface NotFoundProps { 2 | 3 | /** 4 | * The message to be displayed when this component is rendered 5 | */ 6 | title?: string; 7 | 8 | /** 9 | * Demos: 10 | * 11 | * - https://bit.dev/totalsoft_oss/react-mui/not-found 12 | * 13 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/NotFound/NotFound.js 14 | */ 15 | } 16 | 17 | export default function NotFound(props: NotFoundProps): JSX.Element; -------------------------------------------------------------------------------- /__tests__/SideMenu/SideMenu.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import SideMenu from "../../components/SideMenu/SideMenu"; 4 | import MenuOpenIcon from '@material-ui/icons/MenuOpen'; 5 | 6 | describe("SideMenu", () => { 7 | it("Snapshot", () => { 8 | const component = renderer.create( 9 | 13 | ); 14 | 15 | const json = component.toJSON(); 16 | expect(json).toMatchSnapshot(); 17 | }); 18 | }); 19 | -------------------------------------------------------------------------------- /src/components/Forbidden/Forbidden.d.ts: -------------------------------------------------------------------------------- 1 | export interface ForbiddenProps { 2 | 3 | /** 4 | * @default "Not allowed to see this page!" 5 | * Text to be displayed 6 | */ 7 | forbiddenText?: string; 8 | /** 9 | * Demos: 10 | * 11 | * - https://bit.dev/totalsoft_oss/react-mui/forbidden 12 | * 13 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/Forbidden/Forbidden.js 14 | */ 15 | } 16 | 17 | export default function Forbidden(props: ForbiddenProps): JSX.Element; -------------------------------------------------------------------------------- /__tests__/CustomLinearProgress/CustomLinearProgress.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import renderer from 'react-test-renderer'; 3 | import CustomLinearProgress from '../../components/CustomLinearProgress/CustomLinearProgress'; 4 | 5 | describe('CustomLinearProgress', () => { 6 | it('snapshot', () => { 7 | const component = renderer.create(); 12 | 13 | const json = component.toJSON(); 14 | expect(json).toMatchSnapshot(); 15 | }); 16 | }); -------------------------------------------------------------------------------- /__tests__/FileUploadButton/FileUploadButton.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import FileUploadButton from "../../components/FileUploadButton/FileUploadButton"; 4 | 5 | describe("FileUploadButton", () => { 6 | it("Snapshot", () => { 7 | const component = renderer.create( 8 | 14 | ); 15 | 16 | const json = component.toJSON(); 17 | expect(json).toMatchSnapshot(); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /__tests__/IconButton/IconButton.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import IconButton from "../../components/IconButton/IconButton"; 4 | import { Clear } from "@material-ui/icons"; 5 | 6 | describe("IconButton", () => { 7 | it("render correctly IconButton component", () => { 8 | const component = renderer.create( 9 | 10 | 11 | 12 | ); 13 | 14 | const json = component.toJSON(); 15 | expect(json).toMatchSnapshot(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /__tests__/Forbidden/Forbidden.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import Forbidden from "../../components/Forbidden/Forbidden"; 3 | import { mount } from 'enzyme'; 4 | import { Card } from "@material-ui/core"; 5 | import Typography from "../../components/Typography"; 6 | 7 | describe("Forbidden", () => { 8 | it("classes cardHeader, cardAvatar should be present", () => { 9 | const wrapper = mount(); 10 | 11 | expect(wrapper.find(Card).props().className).toContain('cardStyle') 12 | expect(wrapper.find(Card).find(Typography).props().className).toContain('textStyle') 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/components/SimpleSlider/simpleSliderStyle.js: -------------------------------------------------------------------------------- 1 | const simpleSliderStyles = { 2 | sliderRoot: { 3 | top: "-1px", 4 | margin: 0, 5 | padding: 0 6 | }, 7 | sliderTrackError: { 8 | backgroundColor: "red" 9 | }, 10 | sliderThumb: { 11 | zIndex: 0, 12 | }, 13 | disabledText: { 14 | opacity: 0.6 15 | }, 16 | //fix for mobile horizontal scroll 17 | formControl: { 18 | overflow: "visible" 19 | }, 20 | sliderLimits: { 21 | display: "flex", 22 | justifyContent: "space-between" 23 | } 24 | }; 25 | 26 | export default simpleSliderStyles -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Debug Jest Tests", 6 | "args": [ 7 | "test", 8 | "${fileBasenameNoExtension}", 9 | "--runInBand", 10 | "--no-cache", 11 | "--watchAll" 12 | ], 13 | "type": "node", 14 | "request": "launch", 15 | "runtimeArgs": [ 16 | "--inspect-brk", 17 | "${workspaceRoot}/node_modules/jest/bin/jest.js", 18 | "--runInBand" 19 | ], 20 | "console": "integratedTerminal", 21 | "internalConsoleOptions": "neverOpen", 22 | "port": 9229 23 | } 24 | ] 25 | } -------------------------------------------------------------------------------- /__tests__/BackToButton/BackToButton.test.js: -------------------------------------------------------------------------------- 1 | import { mount } from 'enzyme'; 2 | import React from 'react'; 3 | import BackToButton from '../../components/BackToButton/BackToButton'; 4 | 5 | describe('BackToButton', () => { 6 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 7 | 8 | const wrapper = mount(); 11 | 12 | expect(wrapper.props().color).toBe('theme'); 13 | expect(wrapper.props().fontSize).toBe('small'); 14 | expect(wrapper.props().size).toBe('medium'); 15 | }); 16 | }); -------------------------------------------------------------------------------- /__tests__/CancelButton/CancelButton.test.js: -------------------------------------------------------------------------------- 1 | import { mount } from 'enzyme'; 2 | import React from 'react'; 3 | import CancelButton from '../../components/CancelButton/CancelButton'; 4 | 5 | describe('CancelButton', () => { 6 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 7 | 8 | const wrapper = mount(); 11 | 12 | expect(wrapper.props().color).toBe('theme'); 13 | expect(wrapper.props().fontSize).toBe('small'); 14 | expect(wrapper.props().size).toBe('medium'); 15 | }); 16 | }); -------------------------------------------------------------------------------- /__tests__/RegularCard/RegularCard.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import RegularCard from "../../components/RegularCard/RegularCard"; 4 | 5 | describe("RegularCard", () => { 6 | it("Snapshot", () => { 7 | const component = renderer.create( 8 | 16 | ); 17 | 18 | const json = component.toJSON(); 19 | expect(json).toMatchSnapshot(); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /__tests__/EditButton/EditButton.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import EditButton from '../../components/EditButton/EditButton'; 3 | import { mount } from 'enzyme'; 4 | 5 | describe('EditButton', () => { 6 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 7 | 8 | const wrapper = mount( { }} 11 | >); 12 | 13 | expect(wrapper.props().color).toBe('theme'); 14 | expect(wrapper.props().fontSize).toBe('medium'); 15 | expect(wrapper.props().size).toBe('medium'); 16 | }); 17 | }); -------------------------------------------------------------------------------- /__tests__/Pagination/Pagination.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import Pagination from "../../components/Pagination/Pagination"; 4 | 5 | describe("Pagination", () => { 6 | it("Snapshot", () => { 7 | const component = renderer.create( 8 | { }} 13 | onPageChange={() => { }} 14 | onRefresh={() => { }} 15 | loading={false} 16 | /> 17 | ); 18 | 19 | const json = component.toJSON(); 20 | expect(json).toMatchSnapshot(); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behaviour** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /src/components/CardTitle/CardTitle.d.ts: -------------------------------------------------------------------------------- 1 | import { BoxProps } from "@material-ui/core"; 2 | 3 | export interface CardTitleProps extends BoxProps { 4 | /** 5 | * The title of card. 6 | */ 7 | title?: string; 8 | /** 9 | * The actions(made of array of buttons) of card. 10 | */ 11 | actions: React.ReactNode[] 12 | } 13 | /** 14 | * 15 | * Demos: 16 | * 17 | * - https://bit.dev/totalsoft_oss/react-mui/card-title 18 | * 19 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/CardTitle/CardTitle.js 20 | */ 21 | export default function CardTitle(props: CardTitleProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/CardTitle/cardTitleStyle.js: -------------------------------------------------------------------------------- 1 | import styles from "../../assets/jss/styles"; 2 | import defaultTheme from "../themes/defaultTheme"; 3 | 4 | const cardTitleStyle = theme => { 5 | const { defaultFont } = styles(theme); 6 | 7 | return { 8 | defaultFont, 9 | cardTitle: { 10 | ...(theme.header?.title || defaultTheme?.header?.title), 11 | display: "flex", 12 | flexGrow: 1, 13 | padding: "5px" 14 | }, 15 | container: { 16 | display: "flex", 17 | width: "100%", 18 | flexWrap: "wrap", 19 | alignItems: "center", 20 | justifyContent: "flex-end" 21 | } 22 | }; 23 | }; 24 | 25 | export default cardTitleStyle; 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/components/FakeText/LoadingFakeText.d.ts: -------------------------------------------------------------------------------- 1 | import { PaperProps } from "@material-ui/core/Paper"; 2 | 3 | export interface LoadingFakeTextProps extends PaperProps { 4 | /** 5 | * The number of lines appearing. 6 | */ 7 | lines?: number; 8 | /** 9 | * If true, the fake text will be drawn on a Paper. 10 | */ 11 | onPaper?: boolean; 12 | } 13 | /** 14 | * 15 | * Demos: 16 | * 17 | * - https://bit.dev/totalsoft_oss/react-mui/fake-text 18 | * 19 | Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/FakeText/LoadingFakeText.js 20 | */ 21 | export default function LoadingFakeText(props: LoadingFakeTextProps): JSX.Element; -------------------------------------------------------------------------------- /__tests__/CustomLinearProgress/__snapshots__/CustomLinearProgress.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`CustomLinearProgress snapshot 1`] = ` 4 |
11 |
19 |
20 | `; 21 | -------------------------------------------------------------------------------- /__tests__/StatsCard/StatsCard.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import StatsCard from "../../components/StatsCard/StatsCard"; 4 | import Work from "@material-ui/icons/Work"; 5 | import Update from "@material-ui/icons/Update"; 6 | 7 | describe("StatsCard", () => { 8 | it("Snapshot", () => { 9 | const component = renderer.create( 10 | 18 | ); 19 | 20 | const json = component.toJSON(); 21 | expect(json).toMatchSnapshot(); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /src/components/Card/Card.d.ts: -------------------------------------------------------------------------------- 1 | export interface CardProps { 2 | /** 3 | * The className of card. 4 | */ 5 | className?: string; 6 | /** 7 | * The color of card. 8 | */ 9 | color?: "primary" | 10 | "info" | 11 | "success" | 12 | "warning" | 13 | "danger" | 14 | "rose" 15 | /** 16 | * The content of card. 17 | */ 18 | children?: React.ReactNode 19 | } 20 | /** 21 | * 22 | * Demos: 23 | * 24 | * - https://bit.dev/totalsoft_oss/react-mui/card 25 | * 26 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/Card/Card.js 27 | */ 28 | export default function Card(props: CardProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/DateTime/dateTimeStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles'; 2 | 3 | const dateTimeStyles = (theme) => { 4 | const { blackColor, blueColor, defaultFont } = styles(theme); 5 | 6 | return ({ 7 | dateTimeInput: { 8 | ...defaultFont, 9 | minWidth: "100%", 10 | display: 'flex' 11 | }, 12 | label: { 13 | ...defaultFont, 14 | fontWeight: "400", 15 | display: 'flex' 16 | }, 17 | action: { 18 | cursor: 'pointer' 19 | }, 20 | dateTimeIconButtons: { 21 | ...defaultFont, 22 | padding: '0px', 23 | color: blackColor 24 | }, 25 | themeColor: blueColor, 26 | defaultFont 27 | }) 28 | } 29 | 30 | export default dateTimeStyles; -------------------------------------------------------------------------------- /__tests__/SideMenu/__snapshots__/SideMenu.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`SideMenu Snapshot 1`] = ` 4 |
7 |
11 | 17 | 20 | 21 |
22 |
25 | Content of the side-menu 26 |
27 |
28 | `; 29 | -------------------------------------------------------------------------------- /__tests__/FakeText/__snapshots__/FakeText.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`LoadingFakeText snapshot 1`] = ` 4 |
7 |
10 |
13 |
16 |
19 |
22 |
25 |
28 |
31 |
34 |
37 |
38 | `; 39 | -------------------------------------------------------------------------------- /src/components/Toast/toastStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles.js'; 2 | 3 | export const toastStyle = theme => { 4 | const { 5 | snackDangerBgColor, 6 | snackWarningBgColor, 7 | snackSuccessBgColor, 8 | snackSuccessColor, 9 | snackWarningColor, 10 | snackDangerColor 11 | } = styles(theme); 12 | 13 | return { 14 | default: { borderRadius: '6px', padding: '6px 20px' }, 15 | success: { backgroundColor: snackSuccessBgColor, color: snackSuccessColor }, 16 | error: { backgroundColor: snackDangerBgColor, color: snackDangerColor }, 17 | warning: { backgroundColor: snackWarningBgColor, color: snackWarningColor }, 18 | toastWrapper: { borderRadius: '6px', width: '500px', overflowWrap: 'anywhere' } 19 | } 20 | } -------------------------------------------------------------------------------- /__tests__/ExpandingText/__snapshots__/ExpandingText.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`ExpandingText snapshot 1`] = ` 4 |
5 | 30 |
31 | `; 32 | -------------------------------------------------------------------------------- /src/components/CustomTextField/textFieldStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles'; 2 | 3 | const textFieldStyle = theme => { 4 | const { defaultFont, grayColor } = styles(theme); 5 | return { 6 | label: { 7 | ...defaultFont, 8 | color: grayColor[3] + " !important", 9 | fontWeight: "400", 10 | lineHeight: "1.42857", 11 | top: "0px", 12 | marginTop: "0px" 13 | }, 14 | input: { 15 | color: grayColor[14], 16 | "&,&::placeholder": { 17 | ...defaultFont, 18 | fontWeight: "400", 19 | opacity: "1" 20 | }, 21 | "&::placeholder": { 22 | color: grayColor[3] 23 | } 24 | }, 25 | }; 26 | } 27 | 28 | export default textFieldStyle; -------------------------------------------------------------------------------- /__tests__/ImageCard/ImageCard.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ImageCard from "../../components/ImageCard/ImageCard"; 3 | import AssignmentLate from "@material-ui/icons/AssignmentLate"; 4 | import { mount } from 'enzyme'; 5 | 6 | describe("Render ImageCard", () => { 7 | it("imageSize should be equal to 's'", () => { 8 | const wrapper = mount( 9 | 13 | ); 14 | 15 | expect(wrapper.props().imageSize).toBe("s") 16 | }); 17 | 18 | it("alternateText prop should be present in the html attribute alt", () => { 19 | const wrapper = mount( 20 | 24 | ); 25 | 26 | expect(wrapper.find('img').props().alt).toBe("Image card") 27 | }); 28 | }); 29 | -------------------------------------------------------------------------------- /src/components/CardTitle/CardTitle.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import cardTitleStyle from "./cardTitleStyle"; 4 | import { makeStyles } from "@material-ui/core/styles"; 5 | import { Box } from "@material-ui/core"; 6 | 7 | const useStyles = makeStyles(cardTitleStyle); 8 | 9 | export default function CardTitle({ title, actions, ...rest }) { 10 | const classes = useStyles(); 11 | 12 | return ( 13 | 14 | {title} 15 | {actions.map( 16 | (action, index) => ( 17 | 18 | {action} 19 | 20 | ) 21 | )} 22 | 23 | ); 24 | } 25 | 26 | CardTitle.propTypes = { 27 | title: PropTypes.string, 28 | actions: PropTypes.arrayOf(PropTypes.node).isRequired 29 | }; -------------------------------------------------------------------------------- /src/components/Forbidden/Forbidden.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Card, makeStyles } from "@material-ui/core"; 3 | import Typography from "../Typography"; 4 | import forbiddenStyle from "./forbiddenStyle"; 5 | import PropTypes from "prop-types"; 6 | 7 | const useStyles = makeStyles(forbiddenStyle); 8 | 9 | const Forbidden = ({ forbiddenText }) => { 10 | const classes = useStyles(); 11 | 12 | return ( 13 | 14 | 15 | {forbiddenText} 16 | 17 | 18 | ); 19 | }; 20 | 21 | Forbidden.defaultProps = { 22 | forbiddenText: "Not allowed to see this page!" 23 | }; 24 | 25 | Forbidden.propTypes = { 26 | /** 27 | * Text to be displayed 28 | */ 29 | forbiddenText: PropTypes.string 30 | }; 31 | 32 | export default Forbidden; 33 | -------------------------------------------------------------------------------- /__tests__/ExpandingText/ExpandingText.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import renderer from 'react-test-renderer'; 3 | import ExpandingText from '../../components/ExpandingText/ExpandingText'; 4 | 5 | describe('ExpandingText', () => { 6 | it('snapshot', () => { 7 | const component = renderer.create(); 10 | 11 | const json = component.toJSON(); 12 | expect(json).toMatchSnapshot(); 13 | }); 14 | }); -------------------------------------------------------------------------------- /src/components/Pagination/paginationStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles.js'; 2 | 3 | const paginationStyle = theme => { 4 | const { defaultFont } = styles(theme); 5 | 6 | return { 7 | floatRight: { 8 | float: "right" 9 | }, 10 | refreshButton: { 11 | lineHeight: "50px", 12 | float: "right", 13 | marginRight: "10px" 14 | }, 15 | paginationActions: { 16 | lineHeight: "50px", 17 | float: "right", 18 | margin: "0px 10px", 19 | display: "flex" 20 | }, 21 | selectRoot: { 22 | margin: "0!important" 23 | }, 24 | actions: { 25 | margin: "0px" 26 | }, 27 | root: { 28 | margin: "10px" 29 | }, 30 | select: { 31 | ...defaultFont 32 | } 33 | }; 34 | } 35 | 36 | export default paginationStyle; -------------------------------------------------------------------------------- /src/components/PasswordField/PasswordField.d.ts: -------------------------------------------------------------------------------- 1 | import { InputAdornmentProps } from '@material-ui/core/InputAdornment' 2 | 3 | export interface PasswordFieldProps extends InputAdornmentProps { 4 | /** 5 | * @default "Hide password" 6 | * The text to be displayed on tooltip when the user wants to hide the password 7 | */ 8 | hidePasswordText?: string; 9 | /** 10 | * @default "Show password text" 11 | * The text to be displayed on tooltip when the user wants to show the password 12 | */ 13 | showPasswordText?: string; 14 | /** 15 | * Demos: 16 | * 17 | * - https://bit.dev/totalsoft_oss/react-mui/password-field 18 | * 19 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/PasswordField/PasswordField.js 20 | */ 21 | 22 | } 23 | 24 | export default function PasswordField(props: PasswordFieldProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/Accordion/Accordion.d.ts: -------------------------------------------------------------------------------- 1 | export interface AccordionProps { 2 | /** 3 | * @default -1 4 | * The index of the active child. 5 | */ 6 | active?: number; 7 | /** 8 | * The content of accordion. 9 | */ 10 | content: { 11 | title: string, 12 | content: React.ReactNode 13 | }[]; 14 | } 15 | /** 16 | * 17 | * Demos: 18 | * 19 | * - https://bit.dev/totalsoft_oss/react-mui/accordion 20 | * 21 | * - Take a look over the code for further information: https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/Accordion/Accordion.js 22 | * 23 | * Material-UI components used: 24 | * 25 | * - Accordion: https://material-ui.com/api/accordion/ 26 | * - AccordionSummary: https://material-ui.com/api/accordion-summary/ 27 | * - AccordionDetails: https://material-ui.com/api/accordion-details/ 28 | * 29 | */ 30 | export default function Accordion(props: AccordionProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/CustomDialog/customDialogStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles'; 2 | 3 | const customDialogStyle = (theme) => { 4 | const { defaultFont } = styles(theme); 5 | 6 | return { 7 | paper: { 8 | overflowY: 'visible' 9 | }, 10 | modalCloseButton: { 11 | float: "right", 12 | }, 13 | modalTitle: { 14 | ...defaultFont, 15 | display: "inline-block" 16 | }, 17 | text: { 18 | ...defaultFont 19 | }, 20 | content: { 21 | ...defaultFont 22 | }, 23 | visible: { 24 | overflowY: 'visible' 25 | }, 26 | auto: { 27 | overflowY: 'auto' 28 | }, 29 | hidden: { 30 | overflowY: 'hidden' 31 | }, 32 | scroll: { 33 | overflowY: 'scroll' 34 | } 35 | } 36 | } 37 | 38 | export default customDialogStyle; -------------------------------------------------------------------------------- /src/components/DialogDisplay/dialogDisplayStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles'; 2 | 3 | const dialogDisplayStyle = (theme) => { 4 | const { defaultFont } = styles(theme); 5 | 6 | return { 7 | paper: { 8 | overflowY: 'visible' 9 | }, 10 | modalCloseButton: { 11 | float: "right", 12 | }, 13 | modalTitle: { 14 | ...defaultFont, 15 | display: "inline-block" 16 | }, 17 | text: { 18 | ...defaultFont 19 | }, 20 | content: { 21 | ...defaultFont 22 | }, 23 | visible: { 24 | overflowY: 'visible' 25 | }, 26 | auto: { 27 | overflowY: 'auto' 28 | }, 29 | hidden: { 30 | overflowY: 'hidden' 31 | }, 32 | scroll: { 33 | overflowY: 'scroll' 34 | } 35 | } 36 | } 37 | 38 | export default dialogDisplayStyle; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 licenses@totalsoft.ro 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OROTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USEOR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /src/components/Card/Card.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import classNames from "classnames"; 3 | import PropTypes from "prop-types"; 4 | import { makeStyles } from "@material-ui/core/styles"; 5 | import cardStyle from "./cardStyle"; 6 | 7 | const useStyles = makeStyles(cardStyle); 8 | 9 | export default function Card({ className, color, children }) { 10 | const classes = useStyles(); 11 | const cardClasses = classNames({ 12 | [classes.card]: true, 13 | [classes[color]]: color, 14 | [className]: className !== undefined 15 | }); 16 | 17 | return ( 18 |
19 | {children} 20 |
21 | ); 22 | } 23 | 24 | Card.propTypes = { 25 | /** 26 | * The className of card. 27 | */ 28 | className: PropTypes.string, 29 | /** 30 | * The color of card. 31 | */ 32 | color: PropTypes.oneOf([ 33 | "primary", 34 | "info", 35 | "success", 36 | "warning", 37 | "danger", 38 | "rose" 39 | ]), 40 | /** 41 | * The content of card. 42 | */ 43 | children: PropTypes.node 44 | }; -------------------------------------------------------------------------------- /src/components/Charts/components/ChartMix.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ChartCard from "../../ChartCard"; 3 | import PropTypes from "prop-types"; 4 | import { Scatter } from "react-chartjs-2"; 5 | import "chartjs-plugin-datalabels"; 6 | 7 | export const ChartMix = ({ chartColor, dataInfo, displayDataLabels, options, ...other }) => { 8 | let opts = { 9 | ...options, 10 | plugins: { 11 | datalabels: { 12 | formatter: function (value) { 13 | return value; 14 | }, 15 | align: "top", 16 | font: { 17 | size: 8 18 | }, 19 | display: displayDataLabels 20 | } 21 | }, 22 | ...other 23 | }; 24 | 25 | return ( 26 | } chartColor={chartColor || "white"} /> 27 | ); 28 | }; 29 | 30 | ChartMix.propTypes = { 31 | dataInfo: PropTypes.object, 32 | displayDataLabels: PropTypes.bool, 33 | chartColor: PropTypes.string, 34 | options: PropTypes.object 35 | }; 36 | 37 | export default ChartMix; -------------------------------------------------------------------------------- /__tests__/RegularCard/__snapshots__/RegularCard.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`RegularCard Snapshot 1`] = ` 4 |
7 |
10 |
13 | 16 | Title 17 | 18 | 21 | Subtitle 22 | 23 |
24 |
25 |
28 | Card content 29 |
30 |
31 | `; 32 | -------------------------------------------------------------------------------- /src/components/SideMenu/SideMenu.d.ts: -------------------------------------------------------------------------------- 1 | export interface Props { 2 | /** 3 | * The content of the menu 4 | */ 5 | content?: React.ReactNode 6 | /** 7 | * The icon to be displayed on the button 8 | */ 9 | icon?: Object 10 | /** 11 | * Override or extend the styles applied to the side-menu 12 | */ 13 | customSideMenuClass?: string 14 | /** 15 | * Override or extend the styles applied to the button 16 | */ 17 | customButtonClass?: string 18 | /** 19 | * Override or extend the styles applied to the icon 20 | */ 21 | customIconClass?: string 22 | /** 23 | * Override or extend the styles applied to the dropdown 24 | */ 25 | customContainerClass?: string 26 | /** 27 | * Demos: 28 | * 29 | * - https://bit.dev/totalsoft_oss/react-mui/side-menu 30 | * 31 | * Take a look over the code for further information: https://github.com/osstotalsoft/rocket-webapp-components/tree/master/components/SideMenu 32 | */ 33 | } 34 | 35 | export type SideMenuProps = Props 36 | 37 | export default function SideMenu(props: SideMenuProps): JSX.Element -------------------------------------------------------------------------------- /__tests__/Tooltip/__snapshots__/Tooltip.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`Tooltip Snapshot 1`] = ` 4 | 15 | 41 | 42 | `; 43 | -------------------------------------------------------------------------------- /__tests__/DialogDisplay/DialogDisplay.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import DialogDisplay from '../../components/DialogDisplay/DialogDisplay'; 3 | import { mount } from 'enzyme'; 4 | import { IconButton } from "@material-ui/core"; 5 | 6 | describe('DialogDisplay', () => { 7 | it('IconButton has modalCloseButton class', () => { 8 | const onCloseMock = jest.fn(); 9 | 10 | const wrapper = mount( Content
} 15 | />); 16 | 17 | expect(wrapper.find(IconButton).at(0).props().className).toContain('modalCloseButton') 18 | }); 19 | 20 | it('onClose handler should be called', () => { 21 | const onCloseMock = jest.fn(); 22 | 23 | const wrapper = mount( Content
} 28 | />); 29 | 30 | wrapper.find(IconButton).at(0).simulate('click'); 31 | expect(onCloseMock).toHaveBeenCalledTimes(1) 32 | }); 33 | }); -------------------------------------------------------------------------------- /__tests__/SimpleSlider/SimpleSlider.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import renderer from "react-test-renderer"; 3 | import SimpleSlider from "../../components/SimpleSlider/SimpleSlider"; 4 | 5 | jest.mock('react-dom', () => ({ 6 | findDOMNode: (instance) => { 7 | return { ownerDocument: instance }; 8 | }, 9 | })); 10 | 11 | describe("SimpleSlider", () => { 12 | it("Snapshot", () => { 13 | let eventListenerFn = jest.fn(); 14 | const component = renderer.create( 15 | { }} 25 | decimalScale={2} 26 | showSliderLimits={true} 27 | />, { 28 | createNodeMock: (element) => { 29 | if (element.type === 'span') { 30 | return { 31 | addEventListener: eventListenerFn, 32 | }; 33 | } 34 | } 35 | } 36 | ); 37 | 38 | const json = component.toJSON(); 39 | expect(json).toMatchSnapshot(); 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /__tests__/PasswordField/PasswordField.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PasswordField from "../../components/PasswordField/PasswordField"; 3 | import { mount } from 'enzyme'; 4 | import IconButton from "../../components/IconButton/IconButton"; 5 | import CustomTextField from "../../components/CustomTextField/CustomTextField"; 6 | 7 | describe("PasswordField", () => { 8 | it("default props should be provided", () => { 9 | const wrapper = mount( 10 | 11 | ); 12 | 13 | expect(wrapper.props().hidePasswordText).toBe("Hide password") 14 | expect(wrapper.props().showPasswordText).toBe("Show password text") 15 | }); 16 | 17 | it("after pressing the button the input should turn into a text field", () => { 18 | const wrapper = mount( 19 | 22 | ); 23 | 24 | expect(wrapper.find(CustomTextField).props().inputProps.type).toBe('password') 25 | 26 | wrapper.find(IconButton).simulate('click'); 27 | 28 | expect(wrapper.find(CustomTextField).props().inputProps.type).toBe('text') 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /src/components/ExpandingText/ExpandingText.d.ts: -------------------------------------------------------------------------------- 1 | import { FormControlLabelProps } from '@material-ui/core/FormControlLabel'; 2 | 3 | export interface ExpandingTextProps extends FormControlLabelProps { 4 | /** 5 | * The text content. 6 | */ 7 | text: string; 8 | /** 9 | * @default 2000 10 | * The minimum length of the narrow text. 11 | */ 12 | minLength?: number; 13 | /** 14 | * @default "Show less" 15 | * The content of the button when the text is narrow. 16 | */ 17 | showLessText: string; 18 | /** 19 | * @default "Show more" 20 | * The content of the button when the text is wide. 21 | */ 22 | showMoreText?: string; 23 | } 24 | /** 25 | * 26 | * Demos: 27 | * 28 | * - https://bit.dev/totalsoft_oss/react-mui/expanding-text 29 | * 30 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/ExpandingText/ExpandingText.js 31 | * 32 | * Material-UI components used: 33 | * 34 | * - FormControlLabel: https://material-ui.com/api/form-control-label/ 35 | * 36 | */ 37 | export default function ExpandingText(props: ExpandingTextProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/ImageCard/ImageCard.d.ts: -------------------------------------------------------------------------------- 1 | export interface ImageCardProps { 2 | 3 | /** 4 | * Override or extend the styles applied to the component 5 | */ 6 | className?: string; 7 | 8 | /** 9 | * The content of the card 10 | */ 11 | children?: React.ReactNode; 12 | 13 | /** 14 | * The image to be displayed 15 | */ 16 | image?: string | React.ReactNode; 17 | 18 | /** 19 | * If the image cannot be displayed for some reason, this text will be shown 20 | */ 21 | alternateText?: string; 22 | 23 | /** 24 | * The color of the card 25 | */ 26 | color?: "primary" | 27 | "info" | 28 | "success" | 29 | "warning" | 30 | "danger" | 31 | "rose" 32 | 33 | /** 34 | * @default 's' 35 | * The size of the image 36 | */ 37 | imageSize?: 's' | 'm' | 'l' 38 | 39 | /** 40 | * Demos: 41 | * 42 | * - https://bit.dev/totalsoft_oss/react-mui/image-card 43 | * 44 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/ImageCard/ImageCard.js 45 | */ 46 | 47 | } 48 | 49 | export default function ImageCard(props: ImageCardProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/RegularCard/regularCardStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles.js'; 2 | 3 | const regularCardStyle = theme => { 4 | const { card, defaultFont } = styles(theme); 5 | 6 | return { 7 | card, 8 | cardPlain: { 9 | background: "transparent", 10 | boxShadow: "none" 11 | }, 12 | cardFooter: { 13 | margin: "0 20px 10px", 14 | paddingTop: "10px", 15 | borderTop: "1px solid #eeeeee" 16 | }, 17 | cardHeader: { 18 | padding: "15px 20px 0", 19 | zIndex: "3" 20 | }, 21 | cardTitle: { 22 | ...defaultFont, 23 | marginTop: "0", 24 | marginBottom: "3px", 25 | fontWeight: "bold", 26 | fontSize: "20px", 27 | "& small": { 28 | fontWeight: "bold", 29 | lineHeight: "24px", 30 | color: "#777" 31 | } 32 | }, 33 | right: { 34 | textAlign: "right" 35 | }, 36 | left: { 37 | textAlign: "left" 38 | }, 39 | center: { 40 | textAlign: "center" 41 | }, 42 | cardSubtitle: { 43 | ...defaultFont, 44 | color: "#999999", 45 | fontSize: "14px", 46 | margin: "0 0 10px" 47 | }, 48 | cardContent: { 49 | padding: "15px 20px !important", 50 | position: "relative" 51 | } 52 | }; 53 | }; 54 | 55 | export default regularCardStyle; 56 | -------------------------------------------------------------------------------- /src/components/Toast/ToastContainer.d.ts: -------------------------------------------------------------------------------- 1 | export interface ToastContainerProps { 2 | 3 | /** 4 | * @default "top-center" 5 | * The position of the notification. This property is required 6 | 7 | */ 8 | position?: string; 9 | 10 | /** 11 | * @default 3000 12 | * How long the notification will close automatically(milliseconds). This property is required 13 | 14 | */ 15 | autoClose: number; 16 | 17 | /** 18 | * @default false 19 | * If true, the progress bar will be displayed. This property is required 20 | 21 | */ 22 | hideProgressBar: boolean; 23 | 24 | /** 25 | * @default false 26 | * If true, the writing will start from right. This property is required 27 | 28 | */ 29 | rtl: boolean 30 | 31 | /** 32 | * @default 5 33 | * The number of toasts that can appear on screen. This property is required 34 | 35 | */ 36 | limit: number; 37 | 38 | /** 39 | * Demos: 40 | * 41 | * - https://bit.dev/totalsoft_oss/react-mui/toast 42 | * 43 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/Toast/ToastContainer.js 44 | */ 45 | 46 | } 47 | 48 | export default function ToastContainer(props: ToastContainerProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/Toast/Toast.js: -------------------------------------------------------------------------------- 1 | import { useCallback } from 'react'; 2 | import { toast } from "react-toastify"; 3 | import { makeStyles } from "@material-ui/core"; 4 | import { toastStyle } from "./toastStyle"; 5 | import cx from "classnames"; 6 | 7 | const useStyles = makeStyles(toastStyle); 8 | 9 | export function useToast() { 10 | const classes = useStyles(); 11 | return useCallback((message, variant, autoClose = variant !== 'error') => { 12 | const toastClasses = cx({ 13 | [classes[variant]]: variant, 14 | [classes['default']]: true 15 | }); 16 | 17 | switch (variant) { 18 | case 'error': 19 | toast.error(message, { autoClose: false, className: toastClasses, closeOnClick: false, draggable: false }) 20 | break; 21 | case 'info': 22 | toast.info(message, { autoClose, className: toastClasses }) 23 | break; 24 | case 'success': 25 | toast.success(message, { autoClose, className: toastClasses }) 26 | break; 27 | case 'warning': 28 | toast.warn(message, { autoClose, className: toastClasses }) 29 | break; 30 | default: 31 | toast(message, { autoClose, className: toastClasses }) 32 | break; 33 | } 34 | }, []) 35 | } 36 | -------------------------------------------------------------------------------- /src/components/Toast/ToastContainer.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from "prop-types"; 3 | import { ToastContainer as Container, Slide } from 'react-toastify'; 4 | import { toastStyle } from './toastStyle'; 5 | import { makeStyles } from "@material-ui/core"; 6 | import 'react-toastify/dist/ReactToastify.css'; 7 | 8 | const useStyles = makeStyles(toastStyle); 9 | 10 | const ToastContainer = ({ position, autoClose, hideProgressBar, rtl, ...other }) => { 11 | const classes = useStyles(); 12 | return 27 | } 28 | 29 | ToastContainer.defaultProps = { 30 | position: "top-center", 31 | autoClose: 3000, 32 | hideProgressBar: false, 33 | rtl: false, 34 | limit: 5 35 | } 36 | 37 | ToastContainer.propTypes = { 38 | position: PropTypes.string.isRequired, 39 | autoClose: PropTypes.number.isRequired, 40 | hideProgressBar: PropTypes.bool.isRequired, 41 | rtl: PropTypes.bool.isRequired, 42 | limit: PropTypes.number.isRequired 43 | } 44 | 45 | export default ToastContainer; 46 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "es6": true, 5 | "node": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:react/recommended", 10 | "plugin:jest/recommended" 11 | ], 12 | "parser": "@babel/eslint-parser", 13 | "parserOptions": { 14 | "ecmaFeatures": { 15 | "experimentalObjectRestSpread": true, 16 | "jsx": true 17 | }, 18 | "sourceType": "module", 19 | "requireConfigFile": false 20 | }, 21 | "overrides": [ 22 | { 23 | "files": ["**/*.d.ts"], 24 | "plugins": ["@typescript-eslint"], 25 | "extends": [ 26 | "eslint:recommended", 27 | "plugin:@typescript-eslint/recommended" 28 | ], 29 | "parser": "@typescript-eslint/parser", 30 | "parserOptions": { 31 | "ecmaFeatures": { 32 | "jsx": true 33 | }, 34 | "sourceType": "module" 35 | } 36 | } 37 | ], 38 | "plugins": ["react", "react-hooks", "jest"], 39 | "ignorePatterns": ["**/public"], 40 | "rules": { 41 | "indent": 0, 42 | "linebreak-style": 0, 43 | "quotes": 0, 44 | "semi": 0, 45 | "no-console": 0, 46 | "no-debugger": "warn", 47 | "react-hooks/rules-of-hooks": "error", 48 | "react-hooks/exhaustive-deps": "warn", 49 | "no-unused-vars": [1, { "args": "after-used", "argsIgnorePattern": "^_" }], 50 | "react/jsx-no-bind": ["error", { "ignoreRefs": true }] 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/components/FakeText/LoadingFakeText.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import grey from '@material-ui/core/colors/grey'; 3 | import PropTypes from 'prop-types'; 4 | import { Paper } from "@material-ui/core"; 5 | import { makeStyles } from '@material-ui/core'; 6 | 7 | const styles = { 8 | wrapper: { 9 | width: '100%' 10 | }, 11 | fake: { 12 | backgroundColor: grey[200], 13 | height: 10, 14 | margin: 20, 15 | '&:nth-child(2n)': { 16 | marginRight: '20%', 17 | }, 18 | }, 19 | fakeTextPaper: { 20 | padding: "10px" 21 | } 22 | } 23 | 24 | const useStyles = makeStyles(styles); 25 | 26 | const LoadingFakeText = ({ lines = 4, onPaper = false, ...props }) => { 27 | const classes = useStyles(); 28 | const fakeText =
{ 29 | [...Array(lines)].map((e, i) =>
) 30 | } 31 |
32 | 33 | if (onPaper) { 34 | return 35 | {fakeText} 36 | 37 | } 38 | 39 | return fakeText 40 | } 41 | 42 | LoadingFakeText.propTypes = { 43 | /** 44 | * The number of lines appearing. 45 | */ 46 | lines: PropTypes.number, 47 | /** 48 | * If true, the fake text will be drawn on a Paper. 49 | */ 50 | onPaper: PropTypes.bool 51 | }; 52 | 53 | 54 | export default LoadingFakeText; -------------------------------------------------------------------------------- /src/components/Charts/ChartFactory.d.ts: -------------------------------------------------------------------------------- 1 | export interface ChartFactoryProps { 2 | /** 3 | * The options of chart. 4 | */ 5 | options: Object 6 | /** 7 | * The type of chart. 8 | */ 9 | type?: "Line" | 10 | "Bar" | 11 | "Mix" 12 | /** 13 | * The labels of chart. 14 | */ 15 | labels?: string[] 16 | /** 17 | * The info of chart.(see the sample provided in demos) 18 | */ 19 | dataInfo: Object 20 | /** 21 | * If true, the labels are shown. 22 | */ 23 | displayDataLabels: boolean 24 | /** 25 | * The color of chart. 26 | */ 27 | chartColor: string 28 | /** 29 | * The title of chart. 30 | */ 31 | title?: string 32 | /** 33 | * The text status of chart. 34 | */ 35 | text?: string 36 | /** 37 | * If true, the chart moves up on click hover. 38 | */ 39 | hover: boolean 40 | /** 41 | * If provided, its content will appear just below the main content. 42 | */ 43 | underChart: React.ReactNode 44 | /** 45 | * The status icon. 46 | */ 47 | StatIcon: unknown 48 | borderWidth: Number 49 | statText: string 50 | } 51 | /** 52 | * 53 | * Demos: 54 | * 55 | * - https://bit.dev/totalsoft_oss/react-mui/charts 56 | * 57 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/Charts/ChartFactory.js 58 | */ 59 | export default function Charts(props: ChartFactoryProps): JSX.Element; -------------------------------------------------------------------------------- /__tests__/IconButton/__snapshots__/IconButton.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`IconButton render correctly IconButton component 1`] = ` 4 | 15 | 50 | 51 | `; 52 | -------------------------------------------------------------------------------- /src/components/SaveButton/SaveButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import SaveIcon from '@material-ui/icons/Save'; 4 | import CustomIconButton from '../IconButton'; 5 | 6 | const SaveButton = ({ title, onClick, disabled, fontSize, ...rest }) => ( 7 | 8 | 9 | 10 | ) 11 | 12 | SaveButton.defaultProps = { 13 | color: "theme", 14 | size: "medium", 15 | fontSize: "small" 16 | }; 17 | 18 | SaveButton.propTypes = { 19 | title: PropTypes.string, 20 | onClick: PropTypes.func, 21 | disabled: PropTypes.bool, 22 | color: PropTypes.oneOf([ 23 | "primary", 24 | "info", 25 | "theme", 26 | "themeNoBackground", 27 | "themeWithBackground", 28 | "success", 29 | "warning", 30 | "danger", 31 | "rose", 32 | "white", 33 | "simple", 34 | "defaultNoBackground", 35 | "primaryNoBackground", 36 | "infoNoBackground", 37 | "successNoBackground", 38 | "warningNoBackground", 39 | "dangerNoBackground", 40 | "roseNoBackground", 41 | "themeWithGradient" 42 | ]), 43 | size: PropTypes.oneOf([ 44 | "small", 45 | "medium" 46 | ]), 47 | fontSize: PropTypes.oneOf([ 48 | "inherit", 49 | "small", 50 | "medium", 51 | "large" 52 | ]) 53 | }; 54 | 55 | export default SaveButton; -------------------------------------------------------------------------------- /src/components/Tooltip/Tooltip.d.ts: -------------------------------------------------------------------------------- 1 | import { TooltipProps as BaseProps } from "@material-ui/core/Tooltip" 2 | 3 | export interface TooltipProps extends BaseProps { 4 | /** 5 | * Tooltip title. Zero-length titles string are never displayed. 6 | */ 7 | title: React.ReactNode 8 | /** 9 | * @default false 10 | * If true, adds an arrow to the tooltip. 11 | */ 12 | arrow?: boolean 13 | /** 14 | * @default false 15 | * Makes a tooltip interactive, i.e. will not close when the user hovers over the tooltip before the leaveDelay is expired. 16 | */ 17 | interactive?: boolean 18 | /** 19 | * @default 0 20 | * The number of milliseconds to wait before hiding the tooltip. This prop won't impact the leave touch delay (leaveTouchDelay). 21 | */ 22 | leaveDelay?: number 23 | /** 24 | * If true, the tooltip is shown. 25 | */ 26 | open?: boolean 27 | /** 28 | * @default 'bottom' 29 | * Tooltip placement. 30 | */ 31 | placement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top' 32 | } 33 | /** 34 | * 35 | * Demos: 36 | * 37 | * - https://bit.dev/totalsoft_oss/react-mui/tooltip 38 | * 39 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/Tooltip/Tooltip.js 40 | * 41 | * Material UI components used: 42 | * 43 | * - Tooltip: https://material-ui.com/api/tooltip/ 44 | * 45 | */ 46 | export default function Tooltip(props: TooltipProps): JSX.Element -------------------------------------------------------------------------------- /src/components/CustomLinearProgress/CustomLinearProgress.d.ts: -------------------------------------------------------------------------------- 1 | import { LinearProgressProps } from "@material-ui/core"; 2 | 3 | export interface CustomLinearProgressProps extends Omit { 4 | /** 5 | * @default "gray" 6 | * The color of the component. 7 | */ 8 | color?: "primary" | 9 | "warning" | 10 | "danger" | 11 | "success" | 12 | "info" | 13 | "rose" | 14 | "gray" 15 | /** 16 | * @default "indeterminate" 17 | * The variant to use. Use indeterminate or query when there is no progress value. 18 | */ 19 | variant?: "determinate" | 20 | "indeterminate" | 21 | "buffer" | 22 | "query" 23 | /** 24 | * The value of the progress indicator for the determinate and buffer variants. Value between 0 and 100. 25 | */ 26 | value?: number 27 | /** 28 | * The value for the buffer variant. Value between 0 and 100. 29 | */ 30 | valueBuffer?: number 31 | } 32 | /** 33 | * 34 | * Demos: 35 | * 36 | * - https://bit.dev/totalsoft_oss/react-mui/custom-linear-progress 37 | * 38 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/CustomLinearProgress/CustomLinearProgress.js 39 | * 40 | * Material-UI component used: 41 | * 42 | * - LinearProgress: https://material-ui.com/api/linear-progress/ 43 | * 44 | */ 45 | export default function CustomLinearProgress(props: CustomLinearProgressProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/UpwardButton/UpwardButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import { ArrowUpward } from '@material-ui/icons'; 4 | import CustomIconButton from '../IconButton'; 5 | 6 | function UpwardButton({ title, onClick, disabled, fontSize, ...rest }) { 7 | return ( 8 | 9 | 10 | 11 | ) 12 | } 13 | 14 | UpwardButton.defaultProps = { 15 | color: "theme", 16 | fontSize: "small", 17 | size: "medium" 18 | }; 19 | 20 | UpwardButton.propTypes = { 21 | title: PropTypes.string, 22 | onClick: PropTypes.func, 23 | disabled: PropTypes.bool, 24 | color: PropTypes.oneOf([ 25 | "primary", 26 | "info", 27 | "theme", 28 | "themeNoBackground", 29 | "themeWithBackground", 30 | "success", 31 | "warning", 32 | "danger", 33 | "rose", 34 | "white", 35 | "simple", 36 | "defaultNoBackground", 37 | "primaryNoBackground", 38 | "infoNoBackground", 39 | "successNoBackground", 40 | "warningNoBackground", 41 | "dangerNoBackground", 42 | "roseNoBackground", 43 | "themeWithGradient" 44 | ]), 45 | size: PropTypes.oneOf([ 46 | "small", 47 | "medium" 48 | ]), 49 | fontSize: PropTypes.oneOf([ 50 | "inherit", 51 | "small", 52 | "medium", 53 | "large" 54 | ]) 55 | } 56 | 57 | export default UpwardButton; -------------------------------------------------------------------------------- /src/components/CustomLinearProgress/CustomLinearProgress.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import { makeStyles, LinearProgress } from "@material-ui/core"; 4 | import customLinearProgressStyle from "./customLinearProgressStyle"; 5 | 6 | const useStyles = makeStyles(customLinearProgressStyle); 7 | export default function CustomLinearProgress(props) { 8 | const { color, variant, value, ...rest } = props; 9 | const classes = useStyles(); 10 | return ( 11 | 18 | ); 19 | } 20 | 21 | CustomLinearProgress.defaultProps = { 22 | color: "gray", 23 | variant: "indeterminate" 24 | }; 25 | 26 | CustomLinearProgress.propTypes = { 27 | /** 28 | * The color of the component. 29 | */ 30 | color: PropTypes.oneOf([ 31 | "primary", 32 | "warning", 33 | "danger", 34 | "success", 35 | "info", 36 | "rose", 37 | "gray" 38 | ]), 39 | /** 40 | * The variant to use. Use indeterminate or query when there is no progress value. 41 | */ 42 | variant: PropTypes.oneOf([ 43 | "determinate", 44 | "indeterminate", 45 | "buffer", 46 | "query" 47 | ]), 48 | /** 49 | * The value of the progress indicator for the determinate and buffer variants. Value between 0 and 100. 50 | */ 51 | value: PropTypes.number 52 | }; -------------------------------------------------------------------------------- /src/components/ImageCard/ImageCard.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import { Grid, makeStyles } from "@material-ui/core"; 4 | import Card from "../Card"; 5 | import imageCardStyle from "./imageCardStyle"; 6 | 7 | const useStyles = makeStyles(imageCardStyle); 8 | 9 | function ImageCard({ children, image, imageSize, alternateText, ...rest }) { 10 | const classes = useStyles(); 11 | 12 | return ( 13 | 14 | 15 | {alternateText} 20 | 21 | {children} 22 | 23 | ); 24 | } 25 | 26 | ImageCard.defaultProps = { 27 | imageSize: "s" 28 | }; 29 | 30 | ImageCard.propTypes = { 31 | /** 32 | * Override or extend the styles applied to the component 33 | */ 34 | className: PropTypes.string, 35 | /** 36 | * The content of the card 37 | */ 38 | children: PropTypes.node, 39 | /** 40 | * The image to be displayed 41 | */ 42 | image: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), 43 | /** 44 | * If the image cannot be displayed for some reason, this text will be shown 45 | */ alternateText: PropTypes.string, 46 | /** 47 | * The color of the card 48 | */ 49 | color: PropTypes.oneOf([ 50 | "primary", 51 | "info", 52 | "success", 53 | "warning", 54 | "danger", 55 | "rose" 56 | ]), 57 | /** 58 | * The size of the image 59 | */ 60 | imageSize: PropTypes.oneOf(["s", "m", "l"]) 61 | }; 62 | 63 | export default ImageCard; 64 | -------------------------------------------------------------------------------- /__tests__/IconCollapseCard/IconCollapseCard.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import IconCollapseCard from "../../components/IconCollapseCard/IconCollapseCard"; 3 | import AssignmentLate from "@material-ui/icons/AssignmentLate"; 4 | import { mount } from 'enzyme'; 5 | import { Accordion } from "@material-ui/core"; 6 | 7 | describe("IconCollapseCard", () => { 8 | it("iconColor should be equal to default value", () => { 9 | const wrapper = mount( 10 | 16 | ); 17 | 18 | expect(wrapper.props().iconColor).toBe("theme") 19 | }); 20 | 21 | it("if canExpand is undefined then Accordion is by default expandable and enabled", () => { 22 | const wrapper = mount( 23 | 29 | ); 30 | 31 | expect(wrapper.find(Accordion).props().disabled).toBe(false) 32 | expect(wrapper.find(Accordion).props().className).toContain('accordionRoot') 33 | }); 34 | 35 | it("if canExpand is false then Accordion is by default not-expandable and disabled", () => { 36 | const wrapper = mount( 37 | 44 | ); 45 | 46 | expect(wrapper.find(Accordion).props().expanded).toBe(false) 47 | }); 48 | }); 49 | -------------------------------------------------------------------------------- /src/components/UploadButton/UploadButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import BackupIcon from '@material-ui/icons/Backup'; 4 | import CustomIconButton from '../IconButton'; 5 | 6 | const UploadButton = ({ title, onClick, disabled, children, fontSize, ...rest }) => ( 7 | 8 | {children} 9 | 10 | 11 | ) 12 | 13 | UploadButton.defaultProps = { 14 | color: "theme", 15 | size: "medium", 16 | fontSize: "medium" 17 | }; 18 | 19 | UploadButton.propTypes = { 20 | title: PropTypes.string, 21 | onClick: PropTypes.func, 22 | disabled: PropTypes.bool, 23 | children: PropTypes.node, 24 | color: PropTypes.oneOf([ 25 | "primary", 26 | "info", 27 | "theme", 28 | "themeNoBackground", 29 | "themeWithBackground", 30 | "success", 31 | "warning", 32 | "danger", 33 | "rose", 34 | "white", 35 | "simple", 36 | "defaultNoBackground", 37 | "primaryNoBackground", 38 | "infoNoBackground", 39 | "successNoBackground", 40 | "warningNoBackground", 41 | "dangerNoBackground", 42 | "roseNoBackground", 43 | "themeWithGradient" 44 | ]), 45 | size: PropTypes.oneOf([ 46 | "small", 47 | "medium" 48 | ]), 49 | fontSize: PropTypes.oneOf([ 50 | "inherit", 51 | "small", 52 | "medium", 53 | "large" 54 | ]) 55 | }; 56 | 57 | export default UploadButton; -------------------------------------------------------------------------------- /__tests__/SaveButton/SaveButton.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import SaveButton from "../../components/SaveButton/SaveButton"; 3 | import { mount } from 'enzyme'; 4 | import { IconButton } from "@material-ui/core"; 5 | 6 | describe("SaveButton", () => { 7 | it("onClick should be called", () => { 8 | const onClickMock = jest.fn(); 9 | const wrapper = mount(); 12 | 13 | wrapper.find(IconButton).simulate('click') 14 | expect(onClickMock).toHaveBeenCalledTimes(1); 15 | }); 16 | 17 | it('the button should be disabled', () => { 18 | const onClickMock = jest.fn(); 19 | 20 | const wrapper = mount(); 24 | 25 | expect(wrapper.find(IconButton).props().disabled).toBe(true); 26 | }); 27 | 28 | it('the button should be enabled', () => { 29 | const onClickMock = jest.fn(); 30 | 31 | const wrapper = mount(); 35 | 36 | expect(wrapper.find(IconButton).props().disabled).toBe(false); 37 | }); 38 | 39 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 40 | const onClickMock = jest.fn(); 41 | 42 | const wrapper = mount(); 46 | 47 | expect(wrapper.props().color).toBe('theme'); 48 | expect(wrapper.props().fontSize).toBe('small'); 49 | expect(wrapper.props().size).toBe('medium'); 50 | }); 51 | }); -------------------------------------------------------------------------------- /src/components/Autocomplete/autocompleteStyle.js: -------------------------------------------------------------------------------- 1 | import styles from "../../assets/jss/styles"; 2 | import defaultTheme from "../themes/defaultTheme"; 3 | 4 | const autocompleteStyle = theme => { 5 | const { defaultFont } = styles(theme); 6 | 7 | return { 8 | input: { 9 | ...defaultFont, 10 | display: "flex", 11 | whiteSpace: "nowrap" 12 | }, 13 | labelRoot: { 14 | maxWidth: "100%", 15 | overflow: "hidden", 16 | textOverflow: "ellipsis", 17 | whiteSpace: "nowrap" 18 | }, 19 | labelShrink: { 20 | maxWidth: "133%" 21 | }, 22 | option: { 23 | ...defaultFont, 24 | display: "block", 25 | whiteSpace: "nowrap", 26 | overflow: "hidden", 27 | textOverflow: "ellipsis", 28 | width: "100%" 29 | }, 30 | noOptionsMessage: { 31 | ...defaultFont, 32 | padding: `${theme.spacing()}px ${theme.spacing(2)}px` 33 | }, 34 | colorInherit: { 35 | color: "inherit" 36 | }, 37 | colorPrimary: { 38 | color: theme.palette.primary.main || defaultTheme?.palette.primary.main 39 | }, 40 | colorSecondary: { 41 | color: 42 | theme.palette.secondary.main || defaultTheme?.palette.secondary.main 43 | }, 44 | colorTextPrimary: { 45 | color: theme.palette.text.primary || defaultTheme?.palette.text.primary 46 | }, 47 | colorTextSecondary: { 48 | color: theme.palette.text.secondary || defaultTheme?.palette.text.darkGrey 49 | }, 50 | colorError: { 51 | color: 52 | theme.palette.error.main || defaultTheme?.palette.timColors.dangerColor 53 | } 54 | }; 55 | }; 56 | 57 | export default autocompleteStyle; 58 | -------------------------------------------------------------------------------- /__tests__/NavPills/NavPills.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import NavPills from "../../components/NavPills/NavPills"; 3 | import { mount } from "enzyme"; 4 | import { Tab } from "@material-ui/core"; 5 | import { emptyArray, emptyFunction } from "../../utils/constants"; 6 | 7 | const tabsArray = [ 8 | { 9 | tabButton: "Button1", 10 | tabContent:
Content1
11 | }, 12 | { 13 | tabButton: "Button2", 14 | tabContent:
Content2
15 | } 16 | ]; 17 | 18 | describe("NavPills", () => { 19 | it("active, color and actions props should be equal to the default values provided", () => { 20 | const wrapper = mount( 21 | 22 | ); 23 | 24 | expect(wrapper.props().color).toBe("primary"); 25 | expect(wrapper.props().actions).toStrictEqual(emptyArray); 26 | expect(wrapper.props().active).toBe(0); 27 | }); 28 | 29 | it("should have two children", () => { 30 | const wrapper = mount( 31 | 32 | ); 33 | 34 | expect(wrapper.find(Tab)).toHaveLength(2); 35 | }); 36 | 37 | it("Tabs should get the values from the tabs array provided", () => { 38 | const wrapper = mount( 39 | 40 | ); 41 | 42 | expect( 43 | wrapper 44 | .find(Tab) 45 | .at(0) 46 | .props().label 47 | ).toBe(tabsArray[0].tabButton); 48 | expect( 49 | wrapper 50 | .find(Tab) 51 | .at(1) 52 | .props().label 53 | ).toBe(tabsArray[1].tabButton); 54 | }); 55 | }); 56 | -------------------------------------------------------------------------------- /__tests__/UploadButton/UploadButton.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import UploadButton from "../../components/UploadButton/UploadButton"; 3 | import { mount } from 'enzyme'; 4 | import { IconButton } from "@material-ui/core"; 5 | 6 | describe("UploadButton", () => { 7 | it("onClick should be called", () => { 8 | const onClickMock = jest.fn(); 9 | const wrapper = mount(); 12 | 13 | wrapper.find(IconButton).simulate('click') 14 | expect(onClickMock).toHaveBeenCalledTimes(1); 15 | }); 16 | 17 | it('the button should be disabled', () => { 18 | const onClickMock = jest.fn(); 19 | 20 | const wrapper = mount(); 24 | 25 | expect(wrapper.find(IconButton).props().disabled).toBe(true); 26 | }); 27 | 28 | it('the button should be enabled', () => { 29 | const onClickMock = jest.fn(); 30 | 31 | const wrapper = mount(); 35 | 36 | expect(wrapper.find(IconButton).props().disabled).toBe(false); 37 | }); 38 | 39 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 40 | const onClickMock = jest.fn(); 41 | 42 | const wrapper = mount(); 46 | 47 | expect(wrapper.props().color).toBe('theme'); 48 | expect(wrapper.props().fontSize).toBe('medium'); 49 | expect(wrapper.props().size).toBe('medium'); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /__tests__/UpwardButton/UpwardButton.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import UpwardButton from "../../components/UpwardButton/UpwardButton"; 3 | import { mount } from 'enzyme'; 4 | import { IconButton } from "@material-ui/core"; 5 | 6 | describe("UpwardButton", () => { 7 | it("onClick should be called", () => { 8 | const onClickMock = jest.fn(); 9 | const wrapper = mount(); 12 | 13 | wrapper.find(IconButton).simulate('click') 14 | expect(onClickMock).toHaveBeenCalledTimes(1); 15 | }); 16 | 17 | it('the button should be disabled', () => { 18 | const onClickMock = jest.fn(); 19 | 20 | const wrapper = mount(); 24 | 25 | expect(wrapper.find(IconButton).props().disabled).toBe(true); 26 | }); 27 | 28 | it('the button should be enabled', () => { 29 | const onClickMock = jest.fn(); 30 | 31 | const wrapper = mount(); 35 | 36 | expect(wrapper.find(IconButton).props().disabled).toBe(false); 37 | }); 38 | 39 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 40 | const onClickMock = jest.fn(); 41 | 42 | const wrapper = mount(); 46 | 47 | expect(wrapper.props().color).toBe('theme'); 48 | expect(wrapper.props().fontSize).toBe('small'); 49 | expect(wrapper.props().size).toBe('medium'); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /__tests__/IconCard/IconCard.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import IconCard from "../../components/IconCard/IconCard"; 3 | import MailOutline from "@material-ui/icons/MailOutline"; 4 | import { mount } from 'enzyme'; 5 | import { Card, CardHeader } from "@material-ui/core"; 6 | 7 | describe("IconCard", () => { 8 | it("classes cardStyle and textStyle should be present", () => { 9 | const wrapper = mount( 10 | 18 | ); 19 | 20 | expect(wrapper.find(CardHeader).props().classes.root).toContain('cardHeader') 21 | expect(wrapper.find(CardHeader).props().classes.avatar).toContain('cardAvatar') 22 | }); 23 | 24 | it("if footer is provided then classFooter should be present", () => { 25 | const wrapper = mount( 26 | 34 | ); 35 | 36 | expect(wrapper.find(Card).find('div').last().props().className).toContain('cardFooter') 37 | }); 38 | 39 | it("if footer is not provided then classFooter should not be present", () => { 40 | const wrapper = mount( 41 | 48 | ); 49 | 50 | expect(wrapper.find(Card).find('div').last().props().className).not.toContain('cardFooter') 51 | }); 52 | }); 53 | -------------------------------------------------------------------------------- /src/components/DeleteButton/DeleteButton.d.ts: -------------------------------------------------------------------------------- 1 | import { ButtonProps } from '@material-ui/core/Button'; 2 | 3 | export interface DeleteButtonProps extends Omit { 4 | /** 5 | * The title of button. 6 | */ 7 | title?: string; 8 | /** 9 | * Callback fired when a "click" event is detected. 10 | */ 11 | onClick?: () => void 12 | /** 13 | * If true, the button will be disabled. 14 | */ 15 | disabled?: boolean 16 | /** 17 | * @default "theme" 18 | * The color of button. 19 | */ 20 | color?: "primary" | 21 | "info" | 22 | "theme" | 23 | "themeNoBackground" | 24 | "themeWithBackground" | 25 | "success" | 26 | "warning" | 27 | "danger" | 28 | "rose" | 29 | "white" | 30 | "simple" | 31 | "defaultNoBackground" | 32 | "primaryNoBackground" | 33 | "infoNoBackground" | 34 | "successNoBackground" | 35 | "warningNoBackground" | 36 | "dangerNoBackground" | 37 | "roseNoBackground" | 38 | "themeWithGradient" 39 | /** 40 | * @default "medium" 41 | * The size of button. 42 | */ 43 | size?: "medium" | "small" 44 | /** 45 | * @default "medium" 46 | * The fontSize of button's content. 47 | */ 48 | fontSize?: "inherit" | "small" | "medium" | "large" 49 | } 50 | /** 51 | * 52 | * Demos: 53 | * 54 | * - https://bit.dev/totalsoft_oss/react-mui/delete-button 55 | * 56 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/DeleteButton/DeleteButton.js 57 | * 58 | * Material-UI component used: 59 | * 60 | * - IconButton: https://material-ui.com/api/icon-button/ 61 | * 62 | */ 63 | export default function DeleteButton(props: DeleteButtonProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/DynamicInput/DynamicInput.d.ts: -------------------------------------------------------------------------------- 1 | import { SwitchProps } from "@material-ui/core/Switch"; 2 | 3 | export interface DynamicInputProps extends SwitchProps { 4 | /** 5 | * @default 'N/A'' 6 | * The title of button. 7 | */ 8 | controlType?: 'INT' | 9 | 'NUM' | 10 | 'STR' | 11 | 'CLST' | 12 | 'VCLST' | 13 | 'BOOL' 14 | /** 15 | * Callback fired when the value is changed. 16 | * 17 | * @default () => { } 18 | * @param {object} event The event source of the callback. 19 | * You can pull out the new value by accessing `event.target.value` (string). 20 | */ 21 | onChange: (object: Object) => void 22 | /** 23 | * Load the options. 24 | */ 25 | loadOptions?: () => void 26 | /** 27 | * The value of the `input` element, required for a controlled component. 28 | */ 29 | value?: unknown 30 | /** 31 | * @default CustomTextField 32 | * The default component. 33 | */ 34 | DefaultComp?: React.ReactNode 35 | /** 36 | * @default { fullWidth: true, disabled: true } 37 | * The default props of the default component. 38 | */ 39 | defaultCompProps?: unknown 40 | } 41 | /** 42 | * 43 | * Demos: 44 | * 45 | * - https://bit.dev/totalsoft_oss/react-mui/dynamic-input 46 | * 47 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/DynamicInput/DynamicInput.js 48 | * 49 | * Components used: 50 | * 51 | * - TextField: https://material-ui.com/api/text-field/ 52 | * - Switch: https://material-ui.com/api/switch/ 53 | * - Select: https://react-select.com/home 54 | * - FormControlLabel: https://material-ui.com/api/form-control-label/ 55 | * 56 | */ 57 | export default function DynamicInput(props: DynamicInputProps): JSX.Element; -------------------------------------------------------------------------------- /__tests__/AddButton/AddButton.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { mount } from "enzyme"; 3 | import AddButton from '../../components/AddButton/AddButton'; 4 | 5 | describe('AddButton', () => { 6 | it('the button is disabled', () => { 7 | const wrapper = mount( { }} 10 | disabled={true} 11 | fontSize="small" 12 | size="small" 13 | />); 14 | 15 | expect(wrapper.prop('disabled')).toBe(true) 16 | }); 17 | 18 | it('the button is enabled', () => { 19 | const wrapper = mount( { }} 22 | disabled={false} 23 | fontSize="small" 24 | size="small" 25 | />); 26 | 27 | expect(wrapper.prop('disabled')).toBe(false) 28 | }); 29 | 30 | it('the sended props are the same as the expected ones', () => { 31 | const wrapper = mount( { }} 34 | disabled={false} 35 | fontSize="small" 36 | size="small" 37 | />); 38 | 39 | expect(wrapper.prop('disabled')).toBe(false) 40 | expect(wrapper.prop('fontSize')).toBe('small') 41 | expect(wrapper.prop('size')).toBe('small') 42 | }); 43 | 44 | it('the button is expected to be called', () => { 45 | const onChangeMock = jest.fn() 46 | const wrapper = mount(); 53 | 54 | wrapper.find('Button').simulate('click'); 55 | expect(onChangeMock).toHaveBeenCalledTimes(1); 56 | }); 57 | }); -------------------------------------------------------------------------------- /__tests__/FileUploadButton/__snapshots__/FileUploadButton.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`FileUploadButton Snapshot 1`] = ` 4 | 15 | 62 | 63 | `; 64 | -------------------------------------------------------------------------------- /__tests__/CustomTextField/CustomTextField.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import CustomTextField from '../../components/CustomTextField/CustomTextField'; 3 | import { mount } from 'enzyme'; 4 | import { TextField } from "@material-ui/core"; 5 | 6 | describe('CustomTextField', () => { 7 | it('if isNumeric is true then inputComponent node of type NumberFormatCustom exists', () => { 8 | const onCustomInputChange = jest.fn() 9 | 10 | const wrapper = mount(); 22 | 23 | expect(wrapper.find(TextField).props().InputProps.inputComponent).not.toBeUndefined() 24 | }); 25 | 26 | it('if isNumeric is false then inputComponent node of type NumberFormatCustom does not exist', () => { 27 | const onCustomInputChange = jest.fn() 28 | 29 | const wrapper = mount(); 35 | 36 | expect(wrapper.find(TextField).props().InputProps.inputComponent).toBeUndefined() 37 | }); 38 | 39 | it('inputProps class input is present', () => { 40 | const onCustomInputChange = jest.fn() 41 | 42 | const wrapper = mount(); 48 | 49 | expect(wrapper.find(TextField).props().inputProps.className).toContain('input') 50 | }); 51 | }); -------------------------------------------------------------------------------- /__tests__/Card/Card.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import renderer from 'react-test-renderer'; 3 | import Card from '../../components/Card/Card'; 4 | 5 | describe('Card', () => { 6 | it('classes card and rose are present', () => { 7 | const wrapper = renderer.create( 8 |
Card 9 | ); 10 | 11 | const testInstance = wrapper.root; 12 | 13 | expect(testInstance.findByType('div').props.className).toContain('card'); 14 | expect(testInstance.findByType('div').props.className).toContain('rose'); 15 | }); 16 | 17 | it('class danger are present', () => { 18 | const wrapper = renderer.create( 19 |
Card 20 | ); 21 | 22 | const testInstance = wrapper.root; 23 | 24 | expect(testInstance.findByType('div').props.className).toContain('danger'); 25 | }); 26 | 27 | it('class warning are present', () => { 28 | const wrapper = renderer.create( 29 |
Card 30 | ); 31 | 32 | const testInstance = wrapper.root; 33 | 34 | expect(testInstance.findByType('div').props.className).toContain('warning'); 35 | }); 36 | 37 | it('class info are present', () => { 38 | const wrapper = renderer.create( 39 |
Card 40 | ); 41 | 42 | const testInstance = wrapper.root; 43 | 44 | expect(testInstance.findByType('div').props.className).toContain('info'); 45 | }); 46 | 47 | it('class primary are present', () => { 48 | const wrapper = renderer.create( 49 |
Card 50 | ); 51 | 52 | const testInstance = wrapper.root; 53 | 54 | expect(testInstance.findByType('div').props.className).toContain('primary'); 55 | }); 56 | }); -------------------------------------------------------------------------------- /src/components/IconCard/iconCardStyle.js: -------------------------------------------------------------------------------- 1 | import styles from "../../assets/jss/styles"; 2 | import defaultTheme from "../themes/defaultTheme"; 3 | 4 | const iconCardStyle = theme => { 5 | const { 6 | card, 7 | cardHeader, 8 | orangeCardHeader, 9 | greenCardHeader, 10 | redCardHeader, 11 | blueCardHeader, 12 | purpleCardHeader, 13 | roseCardHeader, 14 | themeCardHeader, 15 | themeWithGradientCardHeader 16 | } = styles(theme); 17 | 18 | return { 19 | card, 20 | cardPlain: { 21 | background: "transparent", 22 | boxShadow: "none" 23 | }, 24 | cardHeader: { 25 | ...cardHeader, 26 | float: "left" 27 | }, 28 | orangeCardHeader, 29 | greenCardHeader, 30 | redCardHeader, 31 | blueCardHeader, 32 | purpleCardHeader, 33 | roseCardHeader, 34 | themeCardHeader, 35 | themeWithGradientCardHeader, 36 | cardContent: { 37 | padding: "15px 20px", 38 | position: "relative" 39 | }, 40 | cardAvatar: { 41 | margin: "0px" 42 | }, 43 | cardIcon: { 44 | paddingTop: "3px", 45 | paddingLeft: "3px", 46 | paddingRight: "3px", 47 | color: "#FFFFFF", 48 | width: "30px", 49 | height: "30px" 50 | }, 51 | cardTitle: { 52 | ...(theme.header?.title || defaultTheme?.header.title), 53 | display: "flex", 54 | paddingBottom: "5px", 55 | marginBottom: "3px" 56 | }, 57 | cardCategory: { 58 | color: "#999999", 59 | fontSize: "14px", 60 | fontWeight: "400", 61 | lineHeight: "1", 62 | marginBottom: "0" 63 | }, 64 | cardFooter: { 65 | margin: "0 20px 10px", 66 | paddingTop: "10px", 67 | borderTop: "1px solid #eeeeee" 68 | }, 69 | expansionPanelDetails: { 70 | "@media (max-width: 480px)": { 71 | padding: "4px" 72 | } 73 | } 74 | }; 75 | }; 76 | 77 | export default iconCardStyle; 78 | -------------------------------------------------------------------------------- /src/components/Charts/components/ChartBar.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ChartCard from "../../ChartCard"; 3 | import PropTypes from "prop-types"; 4 | import { Bar } from "react-chartjs-2"; 5 | import "chartjs-plugin-datalabels"; 6 | 7 | export const ChartBar = ({ 8 | labels, 9 | title, 10 | displayDataLabels, 11 | dataInfo, 12 | underChart, 13 | chartColor, 14 | text, 15 | StatIcon, 16 | statText, 17 | hover, 18 | options, 19 | ...other 20 | }) => { 21 | let data = 22 | dataInfo.datasets && 23 | dataInfo.datasets.map(value => { 24 | return { 25 | ...value, 26 | borderColor: value.color, 27 | backgroundColor: value.color, 28 | ...other 29 | }; 30 | }); 31 | 32 | let opts = { 33 | ...options, 34 | plugins: { 35 | datalabels: { 36 | formatter: function (value) { 37 | return value; 38 | }, 39 | align: "top", 40 | font: { 41 | size: 8 42 | }, 43 | display: displayDataLabels 44 | } 45 | } 46 | }; 47 | 48 | return ( 49 | } 51 | underChart={underChart} 52 | chartColor={chartColor || "white"} 53 | title={title} 54 | text={text} 55 | StatIcon={StatIcon} 56 | statText={statText} 57 | hover={hover} 58 | /> 59 | ); 60 | }; 61 | 62 | ChartBar.propTypes = { 63 | labels: PropTypes.array, 64 | dataInfo: PropTypes.object, 65 | underChart: PropTypes.object, 66 | chartColor: PropTypes.string, 67 | title: PropTypes.string, 68 | text: PropTypes.string, 69 | StatIcon: PropTypes.any, 70 | statText: PropTypes.string, 71 | hover: PropTypes.bool, 72 | displayDataLabels: PropTypes.bool, 73 | options: PropTypes.object 74 | }; 75 | 76 | ChartBar.defaultProps = { 77 | displayDataLabels: true 78 | }; 79 | 80 | export default ChartBar; -------------------------------------------------------------------------------- /src/components/AddButton/AddButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import AddIcon from '@material-ui/icons/Add'; 4 | import CustomIconButton from '../IconButton'; 5 | 6 | 7 | const AddButton = ({ title, onClick, disabled, fontSize, ...rest }) => ( 8 | 9 | 10 | 11 | ) 12 | 13 | AddButton.defaultProps = { 14 | color: "theme", 15 | fontSize: "small", 16 | size: "medium" 17 | }; 18 | 19 | AddButton.propTypes = { 20 | /** 21 | * The title of button. 22 | */ 23 | title: PropTypes.string, 24 | /** 25 | * Callback fired when a "click" event is detected. 26 | */ 27 | onClick: PropTypes.func, 28 | /** 29 | * If true, the button will be disabled. 30 | */ 31 | disabled: PropTypes.bool, 32 | /** 33 | * The color of button. 34 | */ 35 | color: PropTypes.oneOf([ 36 | "primary", 37 | "info", 38 | "theme", 39 | "themeNoBackground", 40 | "themeWithBackground", 41 | "success", 42 | "warning", 43 | "danger", 44 | "rose", 45 | "white", 46 | "simple", 47 | "defaultNoBackground", 48 | "primaryNoBackground", 49 | "infoNoBackground", 50 | "successNoBackground", 51 | "warningNoBackground", 52 | "dangerNoBackground", 53 | "roseNoBackground", 54 | "themeWithGradient" 55 | ]), 56 | /** 57 | * The size of button. 58 | */ 59 | size: PropTypes.oneOf([ 60 | "small", 61 | "medium" 62 | ]), 63 | /** 64 | * The fontSize of button's content. 65 | */ 66 | fontSize: PropTypes.oneOf([ 67 | "inherit", 68 | "small", 69 | "medium", 70 | "large" 71 | ]) 72 | }; 73 | 74 | export default AddButton; -------------------------------------------------------------------------------- /src/components/CancelButton/CancelButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import CancelIcon from '@material-ui/icons/Cancel'; 4 | import CustomIconButton from '../IconButton'; 5 | 6 | const CancelButton = ({ title, onClick, disabled, fontSize, ...rest }) => ( 7 | 8 | 9 | 10 | ) 11 | 12 | CancelButton.defaultProps = { 13 | color: "theme", 14 | fontSize: "small", 15 | size: "medium" 16 | }; 17 | 18 | CancelButton.propTypes = { 19 | /** 20 | * The title of button. 21 | */ 22 | title: PropTypes.string, 23 | /** 24 | * Callback fired when a "click" event is detected. 25 | */ 26 | onClick: PropTypes.func, 27 | /** 28 | * If true, the button will be disabled. 29 | */ 30 | disabled: PropTypes.bool, 31 | /** 32 | * The color of button. 33 | */ 34 | color: PropTypes.oneOf([ 35 | "primary", 36 | "info", 37 | "theme", 38 | "themeNoBackground", 39 | "themeWithBackground", 40 | "success", 41 | "warning", 42 | "danger", 43 | "rose", 44 | "white", 45 | "simple", 46 | "defaultNoBackground", 47 | "primaryNoBackground", 48 | "infoNoBackground", 49 | "successNoBackground", 50 | "warningNoBackground", 51 | "dangerNoBackground", 52 | "roseNoBackground", 53 | "themeWithGradient" 54 | ]), 55 | /** 56 | * The size of button. 57 | */ 58 | size: PropTypes.oneOf([ 59 | "small", 60 | "medium" 61 | ]), 62 | /** 63 | * The fontSize of button's content. 64 | */ 65 | fontSize: PropTypes.oneOf([ 66 | "inherit", 67 | "small", 68 | "medium", 69 | "large" 70 | ]) 71 | }; 72 | 73 | export default CancelButton; -------------------------------------------------------------------------------- /src/components/DeleteButton/DeleteButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import DeleteIcon from '@material-ui/icons/Delete'; 4 | import CustomIconButton from '../IconButton'; 5 | 6 | const DeleteButton = ({ title, onClick, disabled, fontSize, ...rest }) => ( 7 | 8 | 9 | 10 | ) 11 | 12 | DeleteButton.defaultProps = { 13 | color: "theme", 14 | fontSize: "medium", 15 | size: "medium" 16 | }; 17 | 18 | DeleteButton.propTypes = { 19 | /** 20 | * The title of button. 21 | */ 22 | title: PropTypes.string, 23 | /** 24 | * Callback fired when a "click" event is detected. 25 | */ 26 | onClick: PropTypes.func, 27 | /** 28 | * If true, the button will be disabled. 29 | */ 30 | disabled: PropTypes.bool, 31 | /** 32 | * The color of button. 33 | */ 34 | color: PropTypes.oneOf([ 35 | "primary", 36 | "info", 37 | "theme", 38 | "themeNoBackground", 39 | "themeWithBackground", 40 | "success", 41 | "warning", 42 | "danger", 43 | "rose", 44 | "white", 45 | "simple", 46 | "defaultNoBackground", 47 | "primaryNoBackground", 48 | "infoNoBackground", 49 | "successNoBackground", 50 | "warningNoBackground", 51 | "dangerNoBackground", 52 | "roseNoBackground", 53 | "themeWithGradient" 54 | ]), 55 | /** 56 | * The size of button. 57 | */ 58 | size: PropTypes.oneOf([ 59 | "small", 60 | "medium" 61 | ]), 62 | /** 63 | * The fontSize of button's content. 64 | */ 65 | fontSize: PropTypes.oneOf([ 66 | "inherit", 67 | "small", 68 | "medium", 69 | "large" 70 | ]) 71 | }; 72 | 73 | export default DeleteButton; -------------------------------------------------------------------------------- /__tests__/DownloadButton/DownloadButton.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import DownloadButton from '../../components/DownloadButton/DownloadButton'; 3 | import { mount } from 'enzyme'; 4 | import { IconButton } from "@material-ui/core"; 5 | 6 | describe('DownloadButton', () => { 7 | it('onClick should be called', () => { 8 | const onClickMock = jest.fn(); 9 | 10 | const wrapper = mount(); 16 | 17 | wrapper.find(IconButton).props().onClick() 18 | expect(onClickMock).toHaveBeenCalledTimes(1); 19 | }); 20 | 21 | it('the button should be disabled', () => { 22 | const wrapper = mount( { }} 25 | disabled={true} 26 | fontSize="small" 27 | >); 28 | 29 | expect(wrapper.find(IconButton).props().disabled).toBe(true); 30 | }); 31 | 32 | it('the button should be enabled', () => { 33 | const wrapper = mount( { }} 36 | disabled={false} 37 | fontSize="small" 38 | >); 39 | 40 | expect(wrapper.find(IconButton).props().disabled).toBe(false); 41 | }); 42 | 43 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 44 | const wrapper = mount( { }} 47 | disabled={false} 48 | fontSize="small" 49 | >); 50 | 51 | expect(wrapper.props().color).toBe('theme'); 52 | expect(wrapper.props().fontSize).toBe('small'); 53 | expect(wrapper.props().size).toBe('medium'); 54 | }); 55 | }); -------------------------------------------------------------------------------- /src/components/Pagination/PaginationActions.js: -------------------------------------------------------------------------------- 1 | import React, { useCallback } from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { makeStyles } from '@material-ui/core'; 4 | import KeyboardArrowLeft from '@material-ui/icons/KeyboardArrowLeft'; 5 | import KeyboardArrowRight from '@material-ui/icons/KeyboardArrowRight'; 6 | import IconButton from '../IconButton'; 7 | import paginationStyle from './paginationStyle'; 8 | 9 | const useStyles = makeStyles(paginationStyle); 10 | 11 | function TablePaginationActions({ count, page, rowsPerPage, onPageChange }) { 12 | const classes = useStyles(); 13 | 14 | const handleBackButtonClick = useCallback(event => { 15 | onPageChange(event, page - 1, 0); 16 | }, [onPageChange, page]) 17 | 18 | const handleNextButtonClick = useCallback(event => { 19 | onPageChange(event, page + 1, 1); 20 | }, [onPageChange, page]) 21 | 22 | return ( 23 |
24 | 31 | 32 | 33 | = Math.ceil(count / rowsPerPage) - 1} 36 | aria-label="Next Page" 37 | size="small" 38 | color="defaultNoBackground" 39 | > 40 | 41 | 42 |
43 | ); 44 | } 45 | 46 | TablePaginationActions.propTypes = { 47 | count: PropTypes.number.isRequired, 48 | onPageChange: PropTypes.func.isRequired, 49 | page: PropTypes.number.isRequired, 50 | rowsPerPage: PropTypes.number.isRequired 51 | }; 52 | 53 | export default TablePaginationActions; -------------------------------------------------------------------------------- /src/components/Accordion/accordionStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles'; 2 | 3 | const accordionStyle = theme => { 4 | 5 | const { themeColor } = styles(theme); 6 | 7 | return { 8 | root: { 9 | flexGrow: 1, 10 | marginBottom: "20px", 11 | '@media (max-width: 480px)': { 12 | width: "100%" 13 | }, 14 | 15 | }, 16 | expansionPanel: { 17 | boxShadow: "none", 18 | "&:before": { 19 | display: "none !important" 20 | } 21 | }, 22 | expansionPanelExpanded: { 23 | margin: "0" 24 | }, 25 | expansionPanelSummary: { 26 | minHeight: "auto !important", 27 | backgroundColor: "transparent", 28 | // borderBottom: "1px solid #ddd", 29 | padding: "2px 2px 2px 0px", 30 | borderTopLeftRadius: "3px", 31 | borderTopRightRadius: "3px", 32 | color: "#3C4858", 33 | "&:hover": { 34 | color: themeColor 35 | } 36 | }, 37 | expansionPanelSummaryExpaned: { 38 | color: themeColor 39 | }, 40 | expansionPanelSummaryContent: { 41 | margin: "0" 42 | }, 43 | expansionPanelSummaryExpandIcon: { 44 | [theme.breakpoints.up("md")]: { 45 | top: "auto !important" 46 | }, 47 | transform: "rotate(0deg)", 48 | color: "inherit", 49 | [theme.breakpoints.down("sm")]: { 50 | top: "10px !important" 51 | } 52 | }, 53 | expansionPanelSummaryExpandIconExpanded: { 54 | [theme.breakpoints.up("md")]: { 55 | top: "auto !important" 56 | }, 57 | transform: "rotate(180deg)", 58 | [theme.breakpoints.down("sm")]: { 59 | top: "10px !important" 60 | } 61 | }, 62 | title: { 63 | fontSize: "15px", 64 | fontWeight: "bolder", 65 | marginTop: "0", 66 | marginBottom: "0", 67 | color: "inherit" 68 | }, 69 | expansionPanelDetails: { 70 | padding: "15px 0px 5px" 71 | } 72 | } 73 | }; 74 | 75 | export default accordionStyle; -------------------------------------------------------------------------------- /__tests__/CardTitle/CardTitle.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import renderer from 'react-test-renderer'; 3 | import CardTitle from '../../components/CardTitle/CardTitle'; 4 | import Button from '../../components/Button/Button'; 5 | import { Box } from "@material-ui/core"; 6 | 7 | describe('CardTitle', () => { 8 | it('classes container and cardTitle are present', () => { 9 | const onClickMock = jest.fn(); 10 | 11 | const wrapper = renderer.create(]} 16 | />); 17 | 18 | const testInstance = wrapper.root; 19 | 20 | expect(testInstance.findAllByType(Box)[0].props.className).toContain('container'); 21 | expect(testInstance.findAllByType(Box)[1].props.className).toContain('cardTitle'); 22 | }); 23 | 24 | 25 | it('should be able to click the button', () => { 26 | const onClickMock = jest.fn(); 27 | 28 | const wrapper = renderer.create(]} 33 | />); 34 | 35 | const testInstance = wrapper.root; 36 | 37 | testInstance.findAllByType(Box)[2].findByType(Button).props.onClick() 38 | expect(onClickMock).toHaveBeenCalledTimes(1); 39 | }); 40 | 41 | it('the button is expected to be disabled', () => { 42 | const onClickMock = jest.fn(); 43 | 44 | const wrapper = renderer.create(]} 49 | />); 50 | 51 | const testInstance = wrapper.root; 52 | 53 | expect(testInstance.findAllByType(Box)[2].findByType(Button).props.disabled).toBe(true); 54 | }); 55 | }); -------------------------------------------------------------------------------- /src/components/PasswordField/PasswordField.js: -------------------------------------------------------------------------------- 1 | import React, { useState, useCallback } from "react"; 2 | import CustomTextField from "../CustomTextField"; 3 | import { InputAdornment } from "@material-ui/core"; 4 | import Tooltip from '../Tooltip/Tooltip'; 5 | import { Visibility, VisibilityOff } from "@material-ui/icons"; 6 | import IconButton from "../IconButton"; 7 | import PropTypes from "prop-types"; 8 | 9 | const PasswordField = ({ showPasswordText, hidePasswordText, ...rest }) => { 10 | const [showPassword, setShowPassword] = useState(false); 11 | const tooltip = showPassword ? hidePasswordText : showPasswordText; 12 | 13 | const handleClickShowPassword = useCallback(_ => { 14 | setShowPassword(x => !x); 15 | }, []); 16 | 17 | const handleMouseDownPassword = useCallback(event => { 18 | event.preventDefault(); 19 | }, []); 20 | 21 | return ( 22 | 29 | 34 | 35 | {showPassword ? : } 36 | 37 | 38 | 39 | } 40 | /> 41 | ); 42 | }; 43 | 44 | PasswordField.defaultProps = { 45 | hidePasswordText: "Hide password", 46 | showPasswordText: "Show password text" 47 | }; 48 | 49 | PasswordField.propTypes = { 50 | /** 51 | * The text to be displayed on tooltip when the user wants to hide the password 52 | */ 53 | hidePasswordText: PropTypes.string, 54 | /** 55 | * The text to be displayed on tooltip when the user wants to show the password 56 | */ 57 | showPasswordText: PropTypes.string 58 | }; 59 | 60 | export default PasswordField; 61 | -------------------------------------------------------------------------------- /src/components/DownloadButton/DownloadButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import CloudDownloadIcon from '@material-ui/icons/CloudDownload'; 4 | import CustomIconButton from '../IconButton'; 5 | 6 | const DownloadButton = ({ title, onClick, disabled, fontSize, ...rest }) => ( 7 | 8 | 9 | 10 | ) 11 | 12 | DownloadButton.defaultProps = { 13 | color: "theme", 14 | fontSize: "medium", 15 | size: "medium" 16 | }; 17 | 18 | DownloadButton.propTypes = { 19 | /** 20 | * The title of button. 21 | */ 22 | title: PropTypes.string, 23 | /** 24 | * Callback fired when a "click" event is detected. 25 | */ 26 | onClick: PropTypes.func, 27 | /** 28 | * The color of button. 29 | */ 30 | color: PropTypes.oneOf([ 31 | "primary", 32 | "info", 33 | "theme", 34 | "themeNoBackground", 35 | "themeWithBackground", 36 | "success", 37 | "warning", 38 | "danger", 39 | "rose", 40 | "white", 41 | "simple", 42 | "defaultNoBackground", 43 | "primaryNoBackground", 44 | "infoNoBackground", 45 | "successNoBackground", 46 | "warningNoBackground", 47 | "dangerNoBackground", 48 | "roseNoBackground", 49 | "themeWithGradient" 50 | ]), 51 | /** 52 | * The size of button. 53 | */ 54 | size: PropTypes.oneOf([ 55 | "small", 56 | "medium" 57 | ]), 58 | /** 59 | * The fontSize of button's content. 60 | */ 61 | fontSize: PropTypes.oneOf([ 62 | "inherit", 63 | "small", 64 | "medium", 65 | "large" 66 | ]), 67 | /** 68 | * If true, the button will be disabled. 69 | */ 70 | disabled: PropTypes.bool 71 | }; 72 | 73 | export default DownloadButton; -------------------------------------------------------------------------------- /src/components/DownwardButton/DownwardButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import { ArrowDownward } from '@material-ui/icons'; 4 | import CustomIconButton from '../IconButton'; 5 | 6 | function DownwardButton({ title, onClick, disabled, fontSize, ...rest }) { 7 | return ( 8 | 9 | 10 | 11 | ) 12 | } 13 | 14 | DownwardButton.defaultProps = { 15 | color: "theme", 16 | fontSize: "small", 17 | size: "medium" 18 | }; 19 | 20 | DownwardButton.propTypes = { 21 | /** 22 | * The title of button. 23 | */ 24 | title: PropTypes.string, 25 | /** 26 | * Callback fired when a "click" event is detected. 27 | */ 28 | onClick: PropTypes.func, 29 | /** 30 | * If true, the button will be disabled. 31 | */ 32 | disabled: PropTypes.bool, 33 | /** 34 | * The color of button. 35 | */ 36 | color: PropTypes.oneOf([ 37 | "primary", 38 | "info", 39 | "theme", 40 | "themeNoBackground", 41 | "themeWithBackground", 42 | "success", 43 | "warning", 44 | "danger", 45 | "rose", 46 | "white", 47 | "simple", 48 | "defaultNoBackground", 49 | "primaryNoBackground", 50 | "infoNoBackground", 51 | "successNoBackground", 52 | "warningNoBackground", 53 | "dangerNoBackground", 54 | "roseNoBackground", 55 | "themeWithGradient" 56 | ]), 57 | /** 58 | * The size of button. 59 | */ 60 | size: PropTypes.oneOf([ 61 | "small", 62 | "medium" 63 | ]), 64 | /** 65 | * The fontSize of button's content. 66 | */ 67 | fontSize: PropTypes.oneOf([ 68 | "inherit", 69 | "small", 70 | "medium", 71 | "large" 72 | ]) 73 | } 74 | 75 | export default DownwardButton; -------------------------------------------------------------------------------- /src/components/ChartCard/ChartCard.d.ts: -------------------------------------------------------------------------------- 1 | export interface ChartCardProps { 2 | /** 3 | * The main content of chart. 4 | */ 5 | chart: React.ReactNode; 6 | /** 7 | * The actions(made of array of buttons) of card. 8 | */ 9 | title?: string 10 | /** 11 | * The text content of chart. 12 | */ 13 | text?: string 14 | /** 15 | * The icon of chart. 16 | */ 17 | StatIcon: unknown 18 | /** 19 | * @default "gray" 20 | * The icon's color of chart. 21 | */ 22 | statIconColor: "warning" | 23 | "primary" | 24 | "danger" | 25 | "success" | 26 | "info" | 27 | "rose" | 28 | "gray" 29 | /** 30 | * @default "purple" 31 | * The color of chart. 32 | */ 33 | chartColor: "orange" | 34 | "green" | 35 | "red" | 36 | "blue" | 37 | "purple" | 38 | "rose" | 39 | "white" 40 | /** 41 | * The color of chart. 42 | */ 43 | statLink: React.ReactNode 44 | /** 45 | * The text status of chart. 46 | */ 47 | statText: string 48 | /** 49 | * @default false 50 | * If true, the chart moves up on click hover. 51 | */ 52 | hover: boolean 53 | /** 54 | * If provided, its content will appear just below the main content. 55 | */ 56 | underChart: React.ReactNode 57 | } 58 | /** 59 | * 60 | * Demos: 61 | * 62 | * - https://bit.dev/totalsoft_oss/react-mui/chart-card 63 | * 64 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/ChartCard/ChartCard.js 65 | * 66 | * Warning: 67 | * This component will be provided only through ChartFactory API. This approach is not compulsory 68 | * but it's recommended to ensure the correct behavior of the component. 69 | */ 70 | export default function ChartCard(props: ChartCardProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/CustomLinearProgress/customLinearProgressStyle.js: -------------------------------------------------------------------------------- 1 | import styles from "../../assets/jss/styles"; 2 | import defaultTheme from "../themes/defaultTheme"; 3 | 4 | const customLinearProgressStyle = theme => { 5 | const { 6 | warningColor, 7 | dangerColor, 8 | successColor, 9 | infoColor, 10 | roseColor, 11 | grayColor, 12 | hexToRgb 13 | } = styles(theme); 14 | 15 | return { 16 | root: { 17 | height: "4px", 18 | marginBottom: "20px", 19 | overflow: "hidden" 20 | }, 21 | bar: { 22 | height: "4px" 23 | }, 24 | primary: { 25 | backgroundColor: 26 | theme.palette?.primary?.main || defaultTheme?.palette?.primary?.main 27 | }, 28 | warning: { 29 | backgroundColor: warningColor 30 | }, 31 | danger: { 32 | backgroundColor: dangerColor 33 | }, 34 | success: { 35 | backgroundColor: successColor 36 | }, 37 | info: { 38 | backgroundColor: infoColor 39 | }, 40 | rose: { 41 | backgroundColor: roseColor 42 | }, 43 | gray: { 44 | backgroundColor: grayColor 45 | }, 46 | primaryBackground: { 47 | background: 48 | "rgba(" + 49 | hexToRgb( 50 | theme.palette?.primary?.main || defaultTheme.palette?.primary?.main 51 | ) + 52 | ", 0.2)" 53 | }, 54 | warningBackground: { 55 | background: "rgba(" + hexToRgb(warningColor) + ", 0.2)" 56 | }, 57 | dangerBackground: { 58 | background: "rgba(" + hexToRgb(dangerColor) + ", 0.2)" 59 | }, 60 | successBackground: { 61 | background: "rgba(" + hexToRgb(successColor) + ", 0.2)" 62 | }, 63 | infoBackground: { 64 | background: "rgba(" + hexToRgb(infoColor) + ", 0.2)" 65 | }, 66 | roseBackground: { 67 | background: "rgba(" + hexToRgb(roseColor) + ", 0.2)" 68 | }, 69 | grayBackground: { 70 | background: "rgba(" + hexToRgb(grayColor) + ", 0.2)" 71 | } 72 | }; 73 | }; 74 | 75 | export default customLinearProgressStyle; 76 | -------------------------------------------------------------------------------- /src/components/StatsCard/StatsCard.d.ts: -------------------------------------------------------------------------------- 1 | import { CardProps } from '@material-ui/core/Card'; 2 | import { CardContentProps } from '@material-ui/core/CardContent'; 3 | import { CardHeaderProps } from '@material-ui/core/CardHeader'; 4 | import { CardActionsProps } from '@material-ui/core/CardActions'; 5 | 6 | export interface Props { 7 | 8 | /** 9 | * The icon to be displayed. This property is required 10 | */ 11 | Icon: unknown; 12 | 13 | /** 14 | * @default "blue" 15 | * The color of the icon 16 | */ 17 | iconColor?: "orange" | 18 | "green" | 19 | "red" | 20 | "blue" | 21 | "purple" 22 | 23 | /** 24 | * The tile of the card 25 | */ 26 | title?: React.ReactNode; 27 | 28 | /** 29 | * Description of the card content 30 | */ 31 | description?: React.ReactNode; 32 | 33 | /** 34 | * Footer for description 35 | */ 36 | subContent?: React.ReactNode; 37 | 38 | /** 39 | * Icon for content 40 | */ 41 | StatIcon?: unknown; 42 | 43 | /** 44 | * @default "gray" 45 | * The color of the status icon 46 | */ 47 | statIconColor?: "warning" | 48 | "primary" | 49 | "danger" | 50 | "success" | 51 | "info" | 52 | "rose" | 53 | "gray" 54 | 55 | /** 56 | * Link for content 57 | */ 58 | statLink?: Object; 59 | 60 | /** 61 | * The footer 62 | */ 63 | footer?: React.ReactNode; 64 | 65 | /** 66 | * Demos: 67 | * 68 | * - https://bit.dev/totalsoft_oss/react-mui/stats-card 69 | * 70 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/StatsCard/StatsCard.js 71 | */ 72 | 73 | } 74 | 75 | export type StatsCardProps = Props | CardProps | CardContentProps | CardHeaderProps | CardActionsProps 76 | 77 | export default function StatsCard(props: StatsCardProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/Charts/components/ChartLine.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ChartCard from "../../ChartCard"; 3 | import PropTypes from "prop-types"; 4 | import { Line } from "react-chartjs-2"; 5 | import "chartjs-plugin-datalabels"; 6 | 7 | export const ChartLine = ({ 8 | labels, 9 | title, 10 | displayDataLabels, 11 | borderWidth, 12 | dataInfo, 13 | underChart, 14 | chartColor, 15 | text, 16 | StatIcon, 17 | statText, 18 | hover, 19 | options, 20 | ...other 21 | }) => { 22 | let data = 23 | dataInfo.datasets && 24 | dataInfo.datasets.map(value => { 25 | return { 26 | ...value, 27 | borderColor: value.color, 28 | borderWidth: borderWidth, 29 | backgroundColor: value.color, 30 | ...other 31 | }; 32 | }); 33 | 34 | let opts = { 35 | ...options, 36 | plugins: { 37 | datalabels: { 38 | formatter: function (value) { 39 | return value; 40 | }, 41 | align: "top", 42 | font: { 43 | size: 8 44 | }, 45 | display: displayDataLabels 46 | } 47 | } 48 | }; 49 | 50 | return ( 51 | } 53 | underChart={underChart} 54 | chartColor={chartColor || "white"} 55 | title={title} 56 | text={text} 57 | StatIcon={StatIcon} 58 | statText={statText} 59 | hover={hover} 60 | /> 61 | ); 62 | }; 63 | 64 | ChartLine.propTypes = { 65 | labels: PropTypes.array, 66 | dataInfo: PropTypes.object, 67 | underChart: PropTypes.object, 68 | chartColor: PropTypes.string, 69 | title: PropTypes.string, 70 | text: PropTypes.string, 71 | StatIcon: PropTypes.any, 72 | statText: PropTypes.string, 73 | hover: PropTypes.bool, 74 | displayDataLabels: PropTypes.bool, 75 | borderWidth: PropTypes.number, 76 | options: PropTypes.object 77 | }; 78 | 79 | ChartLine.defaultProps = { 80 | displayDataLabels: true, 81 | borderWidth: 1 82 | }; 83 | 84 | export default ChartLine; -------------------------------------------------------------------------------- /src/components/ExpandingText/ExpandingText.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { FormControlLabel } from '@material-ui/core'; 4 | 5 | const ExpandingText = ({ text, minLength, showLessText, showMoreText, ...rest }) => { 6 | 7 | const [expanded, setExpanded] = React.useState(false); 8 | const handleChange = _ => { 9 | setExpanded(!expanded); 10 | } 11 | 12 | return ( 13 | !expanded ? 14 | 15 |
16 | {text.substring(0, minLength)}
{text.length > minLength ? 18 |
{showMoreText}
: ""}
} 20 | /> 21 |
22 | : 23 | 24 |
25 | {text}
27 |
{showLessText}
} 29 | /> 30 |
31 | 32 | ) 33 | } 34 | 35 | ExpandingText.defaultProps = { 36 | minLength: 2000, 37 | showLessText: "Show less", 38 | showMoreText: "Show more" 39 | } 40 | 41 | ExpandingText.propTypes = { 42 | /** 43 | * The text content. 44 | */ 45 | text: PropTypes.string.isRequired, 46 | /** 47 | * The minimum length of the narrow text. 48 | */ 49 | minLength: PropTypes.number, 50 | /** 51 | * The content of the button when the text is narrow. 52 | */ 53 | showLessText: PropTypes.string.isRequired, 54 | /** 55 | * The content of the button when the text is wide. 56 | */ 57 | showMoreText: PropTypes.string.isRequired 58 | }; 59 | 60 | export default ExpandingText; -------------------------------------------------------------------------------- /src/components/IconCard/IconCard.d.ts: -------------------------------------------------------------------------------- 1 | import { CardProps } from '@material-ui/core/Card'; 2 | import { CardContentProps } from '@material-ui/core/CardContent'; 3 | import { CardHeaderProps } from '@material-ui/core/CardHeader'; 4 | 5 | export interface Props { 6 | /** 7 | * Icon to be displayed. This property is mandatory 8 | */ 9 | icon: Object; 10 | /** 11 | * @default "theme" 12 | * The color of the icon that will be displayed 13 | */ 14 | iconColor?: "orange" | 15 | "green" | 16 | "red" | 17 | "blue" | 18 | "purple" | 19 | "rose" | 20 | "theme" | 21 | "themeWithGradient" 22 | 23 | /** 24 | * @default "" 25 | * The title to be displayed. This property can be a string or a component 26 | */ 27 | title?: React.ReactNode; 28 | /** 29 | * The subtitle to be displayed. This property can be a string or a component 30 | */ 31 | subtitle?: React.ReactNode; 32 | /** 33 | * The content of the card 34 | */ 35 | content?: React.ReactNode; 36 | /** 37 | * The footer to be displayed. This property can be a string or a component 38 | */ 39 | footer?: React.ReactNode; 40 | /** 41 | * If set to true, the background will be transparent 42 | */ 43 | plain?: boolean; 44 | /** 45 | * Override or extend the styles applied to the content of the card 46 | */ 47 | customCardContentClass?: string; 48 | /** 49 | * Override or extend the styles applied to the card 50 | */ 51 | customCardClass?: string; 52 | /** 53 | * Demos: 54 | * 55 | * - https://bit.dev/totalsoft_oss/react-mui/icon-card 56 | * 57 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/IconCard/IconCard.js 58 | */ 59 | } 60 | 61 | export type IconCardProps = Props | CardProps | CardContentProps | CardHeaderProps 62 | 63 | export default function IconCard(props: IconCardProps): JSX.Element; -------------------------------------------------------------------------------- /__tests__/StatsCard/__snapshots__/StatsCard.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`StatsCard Snapshot 1`] = ` 4 |
7 |
10 |
13 | 19 | 22 | 23 |
24 |
27 |
28 |
31 |

34 | Title 35 |

36 |

39 | Description 40 |

41 |
42 |
45 |
48 | 54 | 57 | 58 | 59 |
60 |
61 |
62 | `; 63 | -------------------------------------------------------------------------------- /src/components/BackToButton/BackToButton.js: -------------------------------------------------------------------------------- 1 | import React, { useCallback } from "react"; 2 | import PropTypes from "prop-types"; 3 | import { useHistory } from 'react-router-dom'; 4 | import { ArrowBack } from '@material-ui/icons'; 5 | import CustomIconButton from '../IconButton'; 6 | 7 | function BackToButton({ title, path, fontSize, ...rest }) { 8 | const history = useHistory(); 9 | 10 | const onBackToList = useCallback(() => { 11 | history.push(path); 12 | }, [history, path]) 13 | 14 | return ( 15 | 16 | 17 | 18 | ) 19 | } 20 | 21 | BackToButton.defaultProps = { 22 | color: "theme", 23 | fontSize: "small", 24 | size: "medium" 25 | }; 26 | 27 | BackToButton.propTypes = { 28 | /** 29 | * The title of button. 30 | */ 31 | title: PropTypes.string, 32 | /** 33 | * The color of button. 34 | */ 35 | color: PropTypes.oneOf([ 36 | "primary", 37 | "info", 38 | "theme", 39 | "themeNoBackground", 40 | "themeWithBackground", 41 | "success", 42 | "warning", 43 | "danger", 44 | "rose", 45 | "white", 46 | "simple", 47 | "defaultNoBackground", 48 | "primaryNoBackground", 49 | "infoNoBackground", 50 | "successNoBackground", 51 | "warningNoBackground", 52 | "dangerNoBackground", 53 | "roseNoBackground", 54 | "themeWithGradient" 55 | ]), 56 | /** 57 | * The size of button. 58 | */ 59 | size: PropTypes.oneOf([ 60 | "small", 61 | "medium" 62 | ]), 63 | /** 64 | * The fontSize of button's content. 65 | */ 66 | fontSize: PropTypes.oneOf([ 67 | "inherit", 68 | "small", 69 | "medium", 70 | "large" 71 | ]), 72 | /** 73 | * The path where the browser will be directed to when the button is clicked. 74 | */ 75 | path: PropTypes.string 76 | } 77 | 78 | export default BackToButton; -------------------------------------------------------------------------------- /src/components/RegularCard/RegularCard.d.ts: -------------------------------------------------------------------------------- 1 | import { CardProps } from '@material-ui/core/Card'; 2 | import { CardContentProps } from '@material-ui/core/CardContent'; 3 | import { CardHeaderProps } from '@material-ui/core/CardHeader'; 4 | 5 | export interface Props { 6 | 7 | /** 8 | * Override or extend the styles applied to the card 9 | */ 10 | customCardClasses?: string; 11 | 12 | /** 13 | * Override or extend the styles applied to the title of the card 14 | */ 15 | customCardTitleClasses?: string; 16 | 17 | /** 18 | * Override or extend the styles applied to the content of the card 19 | */ 20 | customCardContentClasses?: string 21 | /** 22 | * The footer to be displayed. This property can be a string or a component 23 | */ 24 | footer?: React.ReactNode; 25 | 26 | /** 27 | * If set to true, the background will be transparent 28 | */ 29 | plainCard?: boolean; 30 | 31 | /** 32 | * The title of the card 33 | */ 34 | cardTitle?: React.ReactNode; 35 | 36 | /** 37 | * The subtitle of the card 38 | */ 39 | cardSubtitle?: React.ReactNode; 40 | 41 | /** 42 | * The content of the card 43 | */ 44 | content?: React.ReactNode; 45 | 46 | /** 47 | * Title alignment 48 | */ 49 | titleAlign?: "right" | 50 | "left" | 51 | "center" 52 | 53 | /** 54 | * Content alignment 55 | */ 56 | contentAlign?: "right" | 57 | "left" | 58 | "center" 59 | 60 | /** 61 | * Subtitle alignment 62 | */ 63 | subtitleAlign?: "right" | 64 | "left" | 65 | "center" 66 | 67 | /** 68 | * Demos: 69 | * 70 | * - https://bit.dev/totalsoft_oss/react-mui/regular-card 71 | * 72 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/RegularCard/RegularCard.js 73 | */ 74 | 75 | } 76 | 77 | export type RegularCardProps = Props | CardProps | CardContentProps | CardHeaderProps 78 | 79 | export default function RegularCard(props: RegularCardProps): JSX.Element; -------------------------------------------------------------------------------- /__tests__/DownwardButton/DownwardButton.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import DownwardButton from '../../components/DownwardButton/DownwardButton'; 3 | import { mount } from 'enzyme'; 4 | import { IconButton } from "@material-ui/core"; 5 | 6 | describe('DownwardButton', () => { 7 | it('onClick should be called', () => { 8 | const onClickMock = jest.fn(); 9 | 10 | const wrapper = mount(); 16 | 17 | wrapper.find(IconButton).props().onClick() 18 | expect(onClickMock).toHaveBeenCalledTimes(1); 19 | }); 20 | 21 | it('the button should be disabled', () => { 22 | const onClickMock = jest.fn(); 23 | const wrapper = mount(); 29 | 30 | expect(wrapper.find(IconButton).props().disabled).toBe(true); 31 | }); 32 | 33 | it('the button should be enabled', () => { 34 | const onClickMock = jest.fn(); 35 | const wrapper = mount(); 41 | 42 | expect(wrapper.find(IconButton).props().disabled).toBe(false); 43 | }); 44 | 45 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 46 | 47 | const onClickMock = jest.fn(); 48 | const wrapper = mount(); 54 | 55 | expect(wrapper.props().color).toBe('theme'); 56 | expect(wrapper.props().fontSize).toBe('small'); 57 | expect(wrapper.props().size).toBe('medium'); 58 | }); 59 | }); -------------------------------------------------------------------------------- /__tests__/DeleteButton/DeleteButton.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import renderer from 'react-test-renderer'; 3 | import DeleteButton from '../../components/DeleteButton/DeleteButton'; 4 | import { mount } from 'enzyme'; 5 | import { IconButton } from "@material-ui/core"; 6 | 7 | describe('DeleteButton', () => { 8 | it('onClick should be called', () => { 9 | const onClickMock = jest.fn(); 10 | 11 | const wrapper = mount(); 17 | 18 | wrapper.find(IconButton).props().onClick() 19 | expect(onClickMock).toHaveBeenCalledTimes(1); 20 | }); 21 | 22 | it('the button should be disabled', () => { 23 | const onClickMock = jest.fn(); 24 | 25 | const wrapper = mount(); 31 | 32 | expect(wrapper.find(IconButton).props().disabled).toBe(true); 33 | }); 34 | 35 | 36 | it('the button should be enabled', () => { 37 | const onClickMock = jest.fn(); 38 | 39 | const wrapper = mount(); 45 | 46 | expect(wrapper.find(IconButton).props().disabled).toBe(false); 47 | }); 48 | 49 | it('the color, fontSize and size props should be equal to the default values if they are not provided', () => { 50 | 51 | const onClickMock = jest.fn(); 52 | const wrapper = mount(); 58 | 59 | expect(wrapper.props().color).toBe('theme'); 60 | expect(wrapper.props().fontSize).toBe('small'); 61 | expect(wrapper.props().size).toBe('medium'); 62 | }); 63 | }); -------------------------------------------------------------------------------- /src/components/IconCollapseCard/iconCollapseCardStyle.js: -------------------------------------------------------------------------------- 1 | import styles from "../../assets/jss/styles.js"; 2 | import defaultTheme from "../themes/defaultTheme.js"; 3 | 4 | const iconCollapseCardStyle = theme => { 5 | const { 6 | card, 7 | cardHeader, 8 | orangeCardHeader, 9 | greenCardHeader, 10 | redCardHeader, 11 | blueCardHeader, 12 | purpleCardHeader, 13 | roseCardHeader, 14 | themeCardHeader, 15 | themeWithGradientCardHeader 16 | } = styles(theme); 17 | 18 | return { 19 | card, 20 | cardPlain: { 21 | background: "transparent", 22 | boxShadow: "none" 23 | }, 24 | cardHeader: { 25 | ...cardHeader, 26 | float: "left" 27 | }, 28 | orangeCardHeader, 29 | greenCardHeader, 30 | redCardHeader, 31 | blueCardHeader, 32 | purpleCardHeader, 33 | roseCardHeader, 34 | themeCardHeader, 35 | themeWithGradientCardHeader, 36 | cardContent: { 37 | padding: "15px 20px", 38 | position: "relative" 39 | }, 40 | cardAvatar: { 41 | margin: "0px" 42 | }, 43 | cardIcon: { 44 | paddingTop: "3px", 45 | paddingLeft: "3px", 46 | paddingRight: "3px", 47 | color: "#FFFFFF", 48 | width: "30px", 49 | height: "30px" 50 | }, 51 | cardTitle: { 52 | ...(theme.header?.title || defaultTheme?.header?.title), 53 | display: "flex", 54 | marginBottom: "3px", 55 | width: "100%" 56 | }, 57 | cardCategory: { 58 | color: "#999999", 59 | fontSize: "14px", 60 | fontWeight: "400", 61 | lineHeight: "1", 62 | marginBottom: "0" 63 | }, 64 | cardFooter: { 65 | margin: "0 20px 10px", 66 | paddingTop: "10px", 67 | borderTop: "1px solid #eeeeee" 68 | }, 69 | accordionRoot: { 70 | boxShadow: "none", 71 | backgroundColor: "transparent", 72 | padding: "0px" 73 | }, 74 | expansionPanelDetails: { 75 | "@media (max-width: 480px)": { 76 | padding: "4px" 77 | } 78 | }, 79 | content: { 80 | margin: "0px !Important", 81 | padding: "0px" 82 | }, 83 | summaryRoot: { 84 | padding: "0px" 85 | } 86 | }; 87 | }; 88 | 89 | export default iconCollapseCardStyle; 90 | -------------------------------------------------------------------------------- /__tests__/Datetime/Datetime.test.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import DateTime from "../../components/DateTime/DateTime"; 3 | import { mount } from "enzyme"; 4 | import { IconButton } from "@material-ui/core"; 5 | import { CalendarToday } from "@material-ui/icons"; 6 | import { KeyboardDateTimePicker } from "@material-ui/pickers"; 7 | 8 | describe("DateTime", () => { 9 | it("if clearable and value are true then InputProps node will be made up of two IconButtons", () => { 10 | const onDateTimeChanged = jest.fn(); 11 | const defaultTimeFormat = "HH:mm"; 12 | 13 | const wrapper = mount( 14 | 22 | ); 23 | 24 | expect(wrapper.find(IconButton)).toHaveLength(3); 25 | }); 26 | 27 | it("if clearable and value are false then InputProps node will be made of one CalendarToday node", () => { 28 | const onDateTimeChanged = () => { }; 29 | const defaultTimeFormat = "HH:mm"; 30 | 31 | const wrapper = mount( 32 | 40 | ); 41 | 42 | expect(wrapper.find(CalendarToday)).toHaveLength(1); 43 | }); 44 | 45 | it("classes defaultFont and dateTimeInput should be present", () => { 46 | const onDateTimeChanged = jest.fn(); 47 | const defaultTimeFormat = "HH:mm"; 48 | 49 | const wrapper = mount( 50 | 59 | ); 60 | 61 | expect(wrapper.find(KeyboardDateTimePicker).props().className).toContain( 62 | "defaultFont" 63 | ); 64 | expect( 65 | wrapper.find(KeyboardDateTimePicker).props().InputProps.className 66 | ).toContain("dateTimeInput"); 67 | }); 68 | }); 69 | -------------------------------------------------------------------------------- /src/components/EditButton/EditButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import EditIcon from '@material-ui/icons/Edit'; 4 | import VisibilityIcon from '@material-ui/icons/Visibility'; 5 | import CustomIconButton from '../IconButton'; 6 | 7 | const EditButton = ({ title, onClick, editMode, disabled, fontSize, ...rest }) => ( 8 | 9 | {editMode === true 10 | ? 11 | : } 12 | 13 | ) 14 | 15 | EditButton.defaultProps = { 16 | editMode: true, 17 | color: "theme", 18 | fontSize: "medium", 19 | size: "medium" 20 | }; 21 | 22 | EditButton.propTypes = { 23 | /** 24 | * The title of button. 25 | */ 26 | title: PropTypes.string, 27 | /** 28 | * Callback fired when a "click" event is detected. 29 | */ 30 | onClick: PropTypes.func, 31 | /** 32 | * If true, the edit icon will be visible. 33 | */ 34 | editMode: PropTypes.bool, 35 | /** 36 | * If true, the button will be disabled. 37 | */ 38 | disabled: PropTypes.bool, 39 | /** 40 | * The color of button. 41 | */ 42 | color: PropTypes.oneOf([ 43 | "primary", 44 | "info", 45 | "theme", 46 | "themeNoBackground", 47 | "themeWithBackground", 48 | "success", 49 | "warning", 50 | "danger", 51 | "rose", 52 | "white", 53 | "simple", 54 | "defaultNoBackground", 55 | "primaryNoBackground", 56 | "infoNoBackground", 57 | "successNoBackground", 58 | "warningNoBackground", 59 | "dangerNoBackground", 60 | "roseNoBackground", 61 | "themeWithGradient" 62 | ]), 63 | /** 64 | * The size of button. 65 | */ 66 | size: PropTypes.oneOf([ 67 | "small", 68 | "medium" 69 | ]), 70 | /** 71 | * The fontSize of button's content. 72 | */ 73 | fontSize: PropTypes.oneOf([ 74 | "inherit", 75 | "small", 76 | "medium", 77 | "large" 78 | ]) 79 | }; 80 | 81 | export default EditButton; -------------------------------------------------------------------------------- /src/components/Card/cardStyle.js: -------------------------------------------------------------------------------- 1 | import styles from "../../assets/jss/styles"; 2 | import defaultTheme from "../themes/defaultTheme"; 3 | 4 | const cardStyle = theme => { 5 | const { 6 | whiteColor, 7 | roseColor, 8 | successColor, 9 | dangerColor, 10 | warningColor, 11 | infoColor, 12 | hexToRgb 13 | } = styles(theme); 14 | 15 | return { 16 | card: { 17 | ...theme.card 18 | }, 19 | s: { 20 | height: "80px", 21 | width: "80px" 22 | }, 23 | m: { 24 | height: "163px", 25 | width: "163px" 26 | }, 27 | l: { 28 | height: "280px", 29 | width: "280px" 30 | }, 31 | primary: { 32 | background: 33 | theme.palette?.primary?.main || defaultTheme?.palette?.primary?.main, 34 | color: whiteColor 35 | }, 36 | info: { 37 | background: 38 | "linear-gradient(60deg," + infoColor[1] + "," + infoColor[2] + ")", 39 | "& h1 small": { 40 | color: "rgba(" + hexToRgb(whiteColor) + ", 0.8)" 41 | }, 42 | color: whiteColor 43 | }, 44 | success: { 45 | background: 46 | "linear-gradient(60deg," + 47 | successColor[1] + 48 | "," + 49 | successColor[2] + 50 | ")", 51 | "& h1 small": { 52 | color: "rgba(" + hexToRgb(whiteColor) + ", 0.8)" 53 | }, 54 | color: whiteColor 55 | }, 56 | warning: { 57 | background: 58 | "linear-gradient(60deg," + 59 | warningColor[1] + 60 | "," + 61 | warningColor[2] + 62 | ")", 63 | "& h1 small": { 64 | color: "rgba(" + hexToRgb(whiteColor) + ", 0.8)" 65 | }, 66 | color: whiteColor 67 | }, 68 | danger: { 69 | background: 70 | "linear-gradient(60deg," + dangerColor[1] + "," + dangerColor[2] + ")", 71 | "& h1 small": { 72 | color: "rgba(" + hexToRgb(whiteColor) + ", 0.8)" 73 | }, 74 | color: whiteColor 75 | }, 76 | rose: { 77 | background: 78 | "linear-gradient(60deg," + roseColor[1] + "," + roseColor[2] + ")", 79 | "& h1 small": { 80 | color: "rgba(" + hexToRgb(whiteColor) + ", 0.8)" 81 | }, 82 | color: whiteColor 83 | } 84 | }; 85 | }; 86 | 87 | export default cardStyle; 88 | -------------------------------------------------------------------------------- /__tests__/Accordion/Accordion.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import Accordion from '../../components/Accordion/Accordion'; 3 | import { shallow, mount } from "enzyme"; 4 | import { Accordion as AccordionBase } from "@material-ui/core"; 5 | 6 | const someArray = [{ 7 | title: 'Accordion 1', 8 | value: 'Client 1' 9 | }, { 10 | title: 'Accordion 2', 11 | value: 'Client 2' 12 | }, 13 | { 14 | title: 'Accordion 3', 15 | value: 'Client 3' 16 | } 17 | ] 18 | 19 | describe('Accordion', () => { 20 | it('Three children are expected to render', () => { 21 | const wrapper = shallow( { 24 | return { 25 | title: item.title, 26 | content: ( 27 |
28 | {item.value} 29 |
30 | ) 31 | }; 32 | })} 33 | />); 34 | 35 | expect(wrapper.find(AccordionBase)).toHaveLength(3); 36 | }); 37 | 38 | it('Second child is expanded', () => { 39 | const wrapper = mount( { 42 | return { 43 | title: item.title, 44 | content: ( 45 |
46 | {item.value} 47 |
48 | ) 49 | }; 50 | })} 51 | />); 52 | 53 | expect(wrapper.prop('active')).toBe(1) 54 | expect(wrapper.find(AccordionBase).at(1).props().expanded).toBe(true) 55 | }); 56 | 57 | it('Third child is expanded', () => { 58 | const wrapper = mount( { 61 | return { 62 | title: item.title, 63 | content: ( 64 |
65 | {item.value} 66 |
67 | ) 68 | }; 69 | })} 70 | />); 71 | 72 | expect(wrapper.find(AccordionBase).at(2).props().expanded).toBe(true) 73 | }); 74 | }); -------------------------------------------------------------------------------- /src/components/IconButton/iconButtonStyle.js: -------------------------------------------------------------------------------- 1 | import styles from '../../assets/jss/styles'; 2 | 3 | const iconButtonStyle = theme => { 4 | const { whiteColor, grayColor, defaultFont, buttonColors } = styles(theme) 5 | 6 | return { 7 | button: { 8 | ...defaultFont, 9 | color: whiteColor, 10 | boxShadow: '0 2px 2px 0 rgba(153, 153, 153, 0.14), 0 3px 1px -2px rgba(153, 153, 153, 0.2), 0 1px 5px 0 rgba(153, 153, 153, 0.12)', 11 | overflow: 'hidden', 12 | position: 'relative', 13 | border: 'none', 14 | textTransform: 'uppercase', 15 | willChange: 'box-shadow, transform', 16 | transition: 'box-shadow 0.2s cubic-bezier(0.4, 0, 1, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1)', 17 | display: 'inline-block', 18 | textAlign: 'center', 19 | whiteSpace: 'nowrap', 20 | verticalAlign: 'middle', 21 | touchAction: 'manipulation', 22 | cursor: 'pointer', 23 | userSelect: 'none', 24 | backgroundImage: 'none', 25 | backgroundColor: grayColor, 26 | '&:hover': { 27 | backgroundColor: grayColor, 28 | boxShadow: 29 | '0 14px 26px -12px rgba(153, 153, 153, 0.42), 0 4px 23px 0px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(153, 153, 153, 0.2)' 30 | } 31 | }, 32 | primary: buttonColors.primary, 33 | info: buttonColors.info, 34 | success: buttonColors.success, 35 | warning: buttonColors.warning, 36 | danger: buttonColors.danger, 37 | rose: buttonColors.rose, 38 | white: buttonColors.white, 39 | defaultNoBackground: buttonColors.defaultNoBackground, 40 | primaryNoBackground: buttonColors.primaryNoBackground, 41 | infoNoBackground: buttonColors.infoNoBackground, 42 | successNoBackground: buttonColors.successNoBackground, 43 | warningNoBackground: buttonColors.warningNoBackground, 44 | dangerNoBackground: buttonColors.dangerNoBackground, 45 | roseNoBackground: buttonColors.roseNoBackground, 46 | transparent: buttonColors.transparent, 47 | theme: buttonColors.theme, 48 | themeNoBackground: buttonColors.themeNoBackground, 49 | themeWithBackground: buttonColors.themeWithBackground, 50 | themeWithGradient: buttonColors.themeWithGradient, 51 | disabled: buttonColors.disabled, 52 | justIcon: { ...defaultFont } 53 | } 54 | } 55 | 56 | export default iconButtonStyle -------------------------------------------------------------------------------- /__tests__/Button/Button.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import renderer from 'react-test-renderer'; 3 | import Button from '../../components/Button/Button'; 4 | import { Button as ButtonBase } from "@material-ui/core"; 5 | 6 | describe('Button', () => { 7 | it('button will be rounded', () => { 8 | const wrapper = renderer.create(); 11 | 12 | const testInstance = wrapper.root; 13 | 14 | expect(testInstance.findByType(ButtonBase).props.className).toContain('round'); 15 | }); 16 | 17 | 18 | it('button will not be rounded', () => { 19 | const wrapper = renderer.create(); 22 | 23 | const testInstance = wrapper.root; 24 | 25 | expect(testInstance.findByType(ButtonBase).props.className).not.toContain('round'); 26 | }); 27 | 28 | it('button will not be fullWidth', () => { 29 | const wrapper = renderer.create(); 32 | 33 | const testInstance = wrapper.root; 34 | 35 | expect(testInstance.findByType(ButtonBase).props.className).not.toContain('fullWidth'); 36 | }); 37 | 38 | it('button will be fullWidth', () => { 39 | const wrapper = renderer.create(); 42 | 43 | const testInstance = wrapper.root; 44 | 45 | expect(testInstance.findByType(ButtonBase).props.className).toContain('fullWidth'); 46 | }); 47 | 48 | it('button will be disabled', () => { 49 | const wrapper = renderer.create(); 52 | 53 | const testInstance = wrapper.root; 54 | 55 | expect(testInstance.findByType(ButtonBase).props.className).toContain('disabled'); 56 | }); 57 | 58 | 59 | it('button will not be disabled', () => { 60 | const wrapper = renderer.create(); 63 | 64 | const testInstance = wrapper.root; 65 | 66 | expect(testInstance.findByType(ButtonBase).props.className).not.toContain('disabled'); 67 | }); 68 | }); -------------------------------------------------------------------------------- /src/components/BackToButton/BackToButton.d.ts: -------------------------------------------------------------------------------- 1 | import { ButtonProps } from '@material-ui/core/Button'; 2 | 3 | export interface BackToButtonProps extends Omit { 4 | /** 5 | * The title of button. 6 | */ 7 | title?: string 8 | /** 9 | * @default "theme" 10 | * The color of button. 11 | */ 12 | color?: "primary" | 13 | "info" | 14 | "theme" | 15 | "themeNoBackground" | 16 | "themeWithBackground" | 17 | "success" | 18 | "warning" | 19 | "danger" | 20 | "rose" | 21 | "white" | 22 | "simple" | 23 | "defaultNoBackground" | 24 | "primaryNoBackground" | 25 | "infoNoBackground" | 26 | "successNoBackground" | 27 | "warningNoBackground" | 28 | "dangerNoBackground" | 29 | "roseNoBackground" | 30 | "themeWithGradient" 31 | /** 32 | * @default "medium" 33 | * The size of button. 34 | */ 35 | size?: "medium" | "small" 36 | /** 37 | * @default "small" 38 | * The fontsize of button's content. 39 | */ 40 | fontSize?: "inherit" | "small" | "medium" | "large" 41 | /** 42 | * The path where the browser will be directed to when the button is clicked. 43 | */ 44 | path?: string 45 | /** 46 | * Override or extend the styles applied to the component 47 | */ 48 | className?: string 49 | /** 50 | * @default false 51 | * If true, button will be disabled. 52 | */ 53 | disabled?: boolean 54 | /** 55 | * @default false 56 | * If true, the keyboard focus ripple will be disabled. 57 | */ 58 | disableFocusRipple?: boolean 59 | /** 60 | * If true, the ripple effect will be disabled. 61 | */ 62 | disableRipple?: boolean 63 | /** 64 | * @default "false" 65 | * If given, uses a negative margin to counteract the padding on one side 66 | * (this is often helpful for aligning the left or right side of the icon 67 | * with content above or below, without ruining the border size and shape). 68 | */ 69 | edge?: "start" | "end" | "false" 70 | 71 | } 72 | /** 73 | * 74 | * Demos: 75 | * 76 | * - https://bit.dev/totalsoft_oss/react-mui/back-to-button 77 | * 78 | * Take a look over the code for further information:https://github.com/osstotalsoft/rocket-webapp-components/blob/master/components/BackToButton/BackToButton.js 79 | * 80 | * Bit component used: 81 | * 82 | * - IconButton: https://bit.dev/totalsoft_oss/react-mui/icon-button 83 | * 84 | */ 85 | export default function BackToButton(props: BackToButtonProps): JSX.Element; -------------------------------------------------------------------------------- /src/components/SideMenu/sideMenuStyle.js: -------------------------------------------------------------------------------- 1 | import styles from "../../assets/jss/styles"; 2 | import defaultTheme from "../themes/defaultTheme"; 3 | 4 | const sideMenuStyle = theme => { 5 | const { whiteColor, grayColor } = styles(theme); 6 | 7 | return { 8 | sideMenu: { 9 | position: "fixed", 10 | top: "180px", 11 | right: 0, 12 | width: "44px", 13 | height: "38px", 14 | background: "rgba(0, 0, 0, 0.3)", 15 | zIndex: 1031, 16 | borderRadius: "8px 0 0 8px", 17 | textAlign: "center" 18 | }, 19 | moreButton: { 20 | display: "flex", 21 | justifyContent: "center", 22 | height: "100%", 23 | "&:hover": { 24 | outline: "none", 25 | backgroundColor: 26 | theme?.palette?.sideMenu?.hoverBgColor || 27 | defaultTheme?.palette?.sideMenu?.hoverBgColor, 28 | boxShadow: "none", 29 | cursor: "pointer" 30 | } 31 | }, 32 | sideMenuIcon: { 33 | color: `${whiteColor}`, 34 | height: "100%" 35 | }, 36 | menuContainer: { 37 | position: "absolute", 38 | top: "8px", 39 | right: "60px", 40 | zIndex: 1000, 41 | display: "none", 42 | float: "left", 43 | minWidth: "160px", 44 | minHeight: "40px", 45 | backgroundColor: `${whiteColor}`, 46 | opacity: 0, 47 | border: "1px solid #ccc", 48 | borderRadius: "4px", 49 | WebkitBoxShadow: "0 6px 12px rgba(0, 0, 0, 0.175)", 50 | WebkitTransform: "translateY(-15%)", 51 | transformOrigin: "0 0", 52 | margin: "5px", 53 | padding: "10px", 54 | "&:before, &:after": { 55 | content: '""', 56 | display: "inline-block", 57 | position: "absolute", 58 | top: "8%" 59 | }, 60 | "&:before": { 61 | borderBottom: "16px solid transparent", 62 | borderLeft: `16px solid ${grayColor}`, 63 | borderTop: "16px solid transparent", 64 | right: "-17px" 65 | }, 66 | "&:after": { 67 | borderBottom: "16px solid transparent", 68 | borderLeft: `16px solid ${whiteColor}`, 69 | borderTop: "16px solid transparent", 70 | right: "-16px" 71 | } 72 | }, 73 | menuShow: { 74 | opacity: 1, 75 | WebkitTransform: "translateY(-13%)", 76 | transformOrigin: "0 0", 77 | display: "block" 78 | } 79 | }; 80 | }; 81 | 82 | export default sideMenuStyle; 83 | -------------------------------------------------------------------------------- /src/components/IconButton/IconButton.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import cx from "classnames"; 4 | import { IconButton, makeStyles, deprecatedPropType } from "@material-ui/core"; 5 | import Tooltip from '../Tooltip/Tooltip'; 6 | import iconButtonStyle from "./iconButtonStyle"; 7 | 8 | const useStyles = makeStyles(iconButtonStyle); 9 | 10 | // eslint-disable-next-line react/prop-types 11 | const Button = ({ children, color, className, ...rest }) => { 12 | const classes = useStyles(); 13 | const buttonClasses = 14 | classes.button + 15 | cx({ 16 | [" " + classes[color]]: color, 17 | [" " + className]: className 18 | }); 19 | return 20 | {children} 21 | 22 | } 23 | 24 | function CustomIconButton({ tooltip, ...rest }) { 25 | return tooltip ? 26 | 27 |