├── .eslintignore ├── src ├── components │ ├── FilterGroupSettingsRow │ │ ├── FilterGroupSettingsRow.css │ │ ├── index.js │ │ ├── FilterGroupSettingsRow.test.js │ │ └── FilterGroupSettingsRow.js │ ├── Button │ │ ├── index.js │ │ ├── __snapshots__ │ │ │ └── Button.test.js.snap │ │ ├── Button.js │ │ └── Button.test.js │ ├── Condition │ │ ├── index.js │ │ ├── Condition.css │ │ ├── Condition.test.js │ │ └── Condition.js │ ├── ContextMenu │ │ ├── index.js │ │ ├── ContextMenu.css │ │ ├── ContextMenu.js │ │ └── ContextMenu.test.js │ ├── DropDownMenu │ │ ├── index.js │ │ ├── DropDownMenu.test.js │ │ └── DropDownMenu.js │ ├── FilterGroup │ │ ├── index.js │ │ ├── FilterGroup.css │ │ ├── FilterGroup.test.js │ │ └── FilterGroup.js │ └── FilterControl │ │ ├── index.js │ │ ├── FilterControl.test.js │ │ └── FilterControl.js ├── filterControl.js ├── utils │ └── deepCopy.js ├── index.js ├── demo │ ├── demo.js │ └── data.js ├── controls.css └── context.js ├── public ├── favicon.ico ├── manifest.json └── index.html ├── static └── filter-control.png ├── index.d.ts ├── .npmignore ├── .travis.yml ├── .gitignore ├── CONTRIBUTING.md ├── .eslintrc.js ├── jest.config.js ├── .babelrc ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── rollup.config.js ├── interfaces.d.ts ├── LICENSE ├── .vscode └── launch.json ├── package.json └── README.md /.eslintignore: -------------------------------------------------------------------------------- 1 | /src/demo/registerServiceWorker.js -------------------------------------------------------------------------------- /src/components/FilterGroupSettingsRow/FilterGroupSettingsRow.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/components/Button/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './Button'; 2 | -------------------------------------------------------------------------------- /src/components/Condition/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './Condition'; 2 | -------------------------------------------------------------------------------- /src/components/ContextMenu/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './ContextMenu'; 2 | -------------------------------------------------------------------------------- /src/components/DropDownMenu/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './DropDownMenu'; 2 | -------------------------------------------------------------------------------- /src/components/FilterGroup/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './FilterGroup'; 2 | -------------------------------------------------------------------------------- /src/components/FilterControl/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './FilterControl'; 2 | -------------------------------------------------------------------------------- /src/components/FilterGroupSettingsRow/index.js: -------------------------------------------------------------------------------- 1 | export { default } from './FilterGroupSettingsRow'; 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/komarovalexander/react-filter-control/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /src/filterControl.js: -------------------------------------------------------------------------------- 1 | import './controls.css'; 2 | 3 | export { default } from './components/FilterControl'; 4 | -------------------------------------------------------------------------------- /src/utils/deepCopy.js: -------------------------------------------------------------------------------- 1 | export default function (obj) { 2 | return JSON.parse(JSON.stringify(obj)); 3 | } 4 | -------------------------------------------------------------------------------- /static/filter-control.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/komarovalexander/react-filter-control/HEAD/static/filter-control.png -------------------------------------------------------------------------------- /src/components/Condition/Condition.css: -------------------------------------------------------------------------------- 1 | .fc-condition { 2 | display: flex; 3 | } 4 | 5 | .fc-condition input { 6 | width: 120px; 7 | } -------------------------------------------------------------------------------- /src/components/ContextMenu/ContextMenu.css: -------------------------------------------------------------------------------- 1 | .fc-hidden { 2 | display: none; 3 | } 4 | 5 | .fc-contextmenu-item-active { 6 | color: red; 7 | } -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import FilterControlDemo from './demo/demo'; 4 | 5 | ReactDOM.render(, document.getElementById('root')); 6 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | import { IFilterControlProps } from "./interfaces"; 2 | 3 | declare const FilterControl: React.FunctionComponent = (props: IFilterControlProps) => {}; 4 | 5 | export default FilterControl; 6 | -------------------------------------------------------------------------------- /src/components/Button/__snapshots__/Button.test.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`structures 1`] = ` 4 | 10 | `; 11 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | public 3 | static 4 | .vscode 5 | .github 6 | node_modules 7 | .babelrc 8 | .eslintignore 9 | .eslintrc.js 10 | .gitignore 11 | .npmignore 12 | .travis.yml 13 | CONTRIBUTING.md 14 | jest.config.js 15 | package-lock.json 16 | README.md 17 | rollup.config.js -------------------------------------------------------------------------------- /src/components/FilterGroup/FilterGroup.css: -------------------------------------------------------------------------------- 1 | .fc-group-content { 2 | padding-left: 20px; 3 | } 4 | 5 | .fc-group .fc-group-button-icon { 6 | opacity: .6; 7 | font-weight: 100; 8 | } 9 | 10 | .fc-group .fc-group-button-icon:hover { 11 | opacity: .8; 12 | } -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "stable" 4 | cache: 5 | directories: 6 | - node_modules 7 | script: 8 | - npm run lint 9 | - npm test -- --coverage 10 | - npm run build 11 | after_script: 12 | - COVERALLS_REPO_TOKEN=$coveralls_repo_token npm run coveralls -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # testing 7 | /coverage 8 | 9 | # production 10 | /build 11 | 12 | # misc 13 | .DS_Store 14 | .env.local 15 | .env.development.local 16 | .env.test.local 17 | .env.production.local 18 | 19 | npm-debug.log* 20 | yarn-debug.log* 21 | yarn-error.log* 22 | dist/react-filter-control.min.js 23 | yarn.lock 24 | package-lock.json 25 | -------------------------------------------------------------------------------- /src/components/Button/Button.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | const Button = ({ text, onClick }) => ( 5 | 8 | ); 9 | 10 | Button.propTypes = { 11 | text: PropTypes.string, 12 | onClick: PropTypes.func, 13 | }; 14 | 15 | Button.defaultProps = { 16 | text: '', 17 | onClick: undefined, 18 | }; 19 | 20 | export default Button; 21 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Running the demo app 2 | ``` npm run start ``` 3 | 4 | ## Sending a Pull Request 5 | Before submitting a pull request, please make sure the following is done: 6 | 7 | 1. Fork the repository and create your branch from master 8 | 2. Run ```npm install``` in the repository root 9 | 3. If you’ve fixed a bug or added code that should be tested, add tests 10 | 4. Ensure the test suite passes (```npm run test```) 11 | 5. Make sure your code lints (```npm run lint```) 12 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | "extends": "airbnb", 3 | "parser": "babel-eslint", 4 | "rules":{ 5 | "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], 6 | "no-shadow": "off", 7 | "linebreak-style": 0, 8 | "object-curly-spacing": 0, 9 | "comma-dangle": 0, 10 | "jsx-a11y/click-events-have-key-events": 0, 11 | "arrow-body-style": 0 12 | }, 13 | "env": { 14 | "jest": true, 15 | "browser": true 16 | } 17 | }; -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // For a detailed explanation regarding each configuration property, visit: 2 | // https://jestjs.io/docs/en/configuration.html 3 | 4 | module.exports = { 5 | // A map from regular expressions to paths to transformers 6 | transform: { 7 | '^.+\\.js$': 'babel-jest', 8 | ".+\\.(css|styl|less|sass|scss)$": "jest-transform-css" 9 | }, 10 | 11 | // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation 12 | transformIgnorePatterns: [ 13 | "/node_modules/" 14 | ] 15 | }; 16 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-react" 4 | ], 5 | "env": { 6 | "test": { 7 | "presets": [ 8 | "@babel/preset-env", 9 | "@babel/preset-react" 10 | ], 11 | "plugins": [ 12 | "@babel/plugin-proposal-export-default-from", 13 | "@babel/plugin-proposal-export-namespace-from" 14 | ], 15 | "only": [ 16 | "./**/*.js", 17 | "node_modules/jest-runtime" 18 | ] 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/components/FilterControl/FilterControl.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import FilterControl from './FilterControl'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render( {}} 17 | />, div); 18 | ReactDOM.unmountComponentAtNode(div); 19 | }); 20 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /rollup.config.js: -------------------------------------------------------------------------------- 1 | 2 | import babel from 'rollup-plugin-babel' 3 | import resolve from 'rollup-plugin-node-resolve'; 4 | import postcss from 'rollup-plugin-postcss'; 5 | import commonjs from 'rollup-plugin-commonjs'; 6 | 7 | const config = { 8 | input: 'src/filterControl.js', 9 | external: ['react'], 10 | output: { 11 | format: 'umd', 12 | name: 'react-filter-control', 13 | globals: { 14 | react: "React" 15 | } 16 | }, 17 | plugins: [ 18 | babel({ 19 | exclude: "node_modules/**" 20 | }), 21 | resolve({ }), 22 | postcss({ 23 | plugins: [] 24 | }), 25 | commonjs({ 26 | include: 'node_modules/**', 27 | namedExports: { 28 | 'node_modules/prop-types/index.js': ['PropTypes'] 29 | } 30 | }) 31 | ] 32 | } 33 | export default config -------------------------------------------------------------------------------- /src/components/Button/Button.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import TestRenderer from 'react-test-renderer'; 4 | import { configure, shallow } from 'enzyme'; 5 | import Adapter from 'enzyme-adapter-react-16'; 6 | import Button from './Button'; 7 | 8 | configure({ adapter: new Adapter() }); 9 | 10 | it('renders without crashing', () => { 11 | const div = document.createElement('div'); 12 | ReactDOM.render(