Skip to content

Commit 307997b

Browse files
committed
initial commit
0 parents  commit 307997b

15 files changed

+613
-0
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
test/coverage/
2+
es/
3+
lib/
4+
umd/

.eslintrc

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"env": {
3+
"browser": true,
4+
"node": true,
5+
"es6": true
6+
},
7+
"extends": ["eslint:recommended", "plugin:react/recommended"],
8+
"parser": "babel-eslint",
9+
"parserOptions": {
10+
"sourceType": "module",
11+
"ecmaFeatures": {
12+
"jsx": true,
13+
"arrowFunctions": true,
14+
"blockBindings": true,
15+
"defaultParams": true,
16+
"destructuring": true,
17+
"forOf": true,
18+
"generators": true,
19+
"objectLiteralComputedProperties": true,
20+
"objectLiteralShorthandMethods": true,
21+
"objectLiteralShorthandProperties": true,
22+
"experimentalObjectRestSpread": true,
23+
"restParams": true,
24+
"spread": true,
25+
"templateStrings": true,
26+
"modules": true,
27+
"classes": true
28+
}
29+
},
30+
"plugins": [
31+
"react"
32+
],
33+
"root": true,
34+
"rules": {
35+
"comma-dangle": 0,
36+
"linebreak-style": 0
37+
},
38+
"settings": {
39+
"react": {
40+
"createClass": "createReactClass", // Regex for Component Factory to use,
41+
// default to "createReactClass"
42+
"pragma": "React", // Pragma to use, default to "React"
43+
"version": "16.8", // React version, default to the latest React stable release
44+
"flowVersion": "0.81" // Flow version
45+
},
46+
"propWrapperFunctions": [ "forbidExtraProps" ] // The names of any functions used to wrap the
47+
// propTypes object, e.g. `forbidExtraProps`.
48+
// If this isn't set, any propTypes wrapped in
49+
// a function will be skipped.
50+
}
51+
}

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
node_modules
5+
/node_modules
6+
package-lock.json
7+
8+
# testing
9+
/demo/dist
10+
11+
# testing
12+
/coverage
13+
14+
# production
15+
/es
16+
/lib
17+
/umd
18+
19+
# misc
20+
.DS_Store
21+
.idea
22+
23+
npm-debug.log*

CHANGELOG.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
### [@coreui/react-chartjs](https://coreui.io/) changelog
2+
3+
##### `1.0.0-alpha.0`
4+
- initial version
5+
6+
install:
7+
```bash
8+
npm install @coreui/react
9+
npm install @coreui/react-chartjs
10+
```
11+
12+
import:
13+
```jsx
14+
import { CCharts } from '@coreui/react-chartjs';
15+
```
16+
17+
usage:
18+
```jsx
19+
...
20+
class CoreUICharts extends Component {
21+
...
22+
render() {
23+
return (
24+
<CCharts
25+
type="radar"
26+
datasets={[
27+
{
28+
label: '2019',
29+
backgroundColor: 'rgba(179,181,198,0.2)',
30+
borderColor: 'rgba(179,181,198,1)',
31+
pointBackgroundColor: 'rgba(179,181,198,1)',
32+
pointBorderColor: '#fff',
33+
pointHoverBackgroundColor: '#fff',
34+
pointHoverBorderColor: 'rgba(179,181,198,1)',
35+
tooltipLabelColor: 'rgba(179,181,198,1)',
36+
data: [65, 59, 90, 81, 56, 55, 40]
37+
},
38+
{
39+
label: '2020',
40+
backgroundColor: 'rgba(255,99,132,0.2)',
41+
borderColor: 'rgba(255,99,132,1)',
42+
pointBackgroundColor: 'rgba(255,99,132,1)',
43+
pointBorderColor: '#fff',
44+
pointHoverBackgroundColor: '#fff',
45+
pointHoverBorderColor: 'rgba(255,99,132,1)',
46+
tooltipLabelColor: 'rgba(255,99,132,1)',
47+
data: [28, 48, 40, 19, 96, 27, 100]
48+
}
49+
]}
50+
options={{
51+
aspectRatio: 1.5,
52+
tooltips: {
53+
enabled: true
54+
}
55+
}}
56+
labels={[
57+
'Eating', 'Drinking', 'Sleeping', 'Designing',
58+
'Coding', 'Cycling', 'Running'
59+
]}
60+
/>
61+
)
62+
}
63+
...
64+
```

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 creativeLabs Łukasz Holeczek
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

NWB.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Prerequisites
2+
3+
[Node.js](http://nodejs.org/) >= v4 must be installed.
4+
5+
## Installation
6+
7+
- Running `npm install` in the component's root directory will install everything you need for development.
8+
9+
## Demo Development Server
10+
11+
- `npm start` will run a development server with the component's demo app at [http://localhost:3000](http://localhost:3000) with hot module reloading.
12+
13+
## Running Tests
14+
15+
- `npm test` will run the tests once.
16+
17+
- `npm run test:coverage` will run the tests and produce a coverage report in `coverage/`.
18+
19+
- `npm run test:watch` will run the tests on every change.
20+
21+
## Building
22+
23+
- `npm run build` will build the component for publishing to npm and also bundle the demo app.
24+
25+
- `npm run clean` will delete built resources.

README.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
### [@coreui/react-chartjs](https://coreui.io/) for [CoreUI for React](https://coreui.io/react/)
2+
3+
[![npm package][npm-badge]][npm]
4+
[![NPM downloads][npm-download]][npm]
5+
6+
[npm-badge]: https://img.shields.io/npm/v/@coreui/react-chartjs/latest?style=flat-square
7+
[npm]: https://www.npmjs.com/package/@coreui/react-chartjs
8+
[npm-download]: https://img.shields.io/npm/dm/@coreui/react-chartjs.svg?style=flat-square
9+
10+
##### install:
11+
```bash
12+
npm install @coreui/react
13+
npm install @coreui/react-chartjs
14+
```
15+
16+
##### import:
17+
```jsx
18+
import { CCharts } from '@coreui/react-chartjs';
19+
```
20+
21+
##### usage:
22+
```jsx
23+
...
24+
class CoreUICharts extends Component {
25+
...
26+
render() {
27+
return (
28+
<CCharts
29+
type="radar"
30+
datasets={[
31+
{
32+
label: '2019',
33+
backgroundColor: 'rgba(179,181,198,0.2)',
34+
borderColor: 'rgba(179,181,198,1)',
35+
pointBackgroundColor: 'rgba(179,181,198,1)',
36+
pointBorderColor: '#fff',
37+
pointHoverBackgroundColor: '#fff',
38+
pointHoverBorderColor: 'rgba(179,181,198,1)',
39+
tooltipLabelColor: 'rgba(179,181,198,1)',
40+
data: [65, 59, 90, 81, 56, 55, 40]
41+
},
42+
{
43+
label: '2020',
44+
backgroundColor: 'rgba(255,99,132,0.2)',
45+
borderColor: 'rgba(255,99,132,1)',
46+
pointBackgroundColor: 'rgba(255,99,132,1)',
47+
pointBorderColor: '#fff',
48+
pointHoverBackgroundColor: '#fff',
49+
pointHoverBorderColor: 'rgba(255,99,132,1)',
50+
tooltipLabelColor: 'rgba(255,99,132,1)',
51+
data: [28, 48, 40, 19, 96, 27, 100]
52+
}
53+
]}
54+
options={{
55+
aspectRatio: 1.5,
56+
tooltips: {
57+
enabled: true
58+
}
59+
}}
60+
labels={[
61+
'Eating', 'Drinking', 'Sleeping', 'Designing',
62+
'Coding', 'Cycling', 'Running'
63+
]}
64+
/>
65+
)
66+
}
67+
...
68+
```
69+
70+
---
71+
72+
- bootstrapped with [nwb](https://github.com/insin/nwb) toolkit
73+
74+
##### `npm run` scripts
75+
76+
`package.json` is configured with `"scripts"` we can use with `npm run` while developing the project.
77+
78+
Command | Description |
79+
--- | ---
80+
`npm start` | start a development server for the demo app
81+
`npm test` | run tests
82+
`npm run test:coverage` | run tests and produce a code coverage report in `coverage/`
83+
`npm run test:watch` | start a test server and re-run tests on every change
84+
`npm run build` | prepare for publishing to npm
85+
`npm run clean` | delete built resources
86+
87+
#### see also:
88+
- [Developing React Components and Libraries with nwb](https://github.com/insin/nwb/blob/master/docs/guides/ReactComponents.md#developing-react-components-and-libraries-with-nwb)

link.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
npm link ../coreui-pro-react-admin-template/node_modules/react
2+
npm link ../coreui-pro-react-admin-template/node_modules/react-dom
3+
npm link ../coreui-pro-react-admin-template/node_modules/react-router-dom

nwb.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
type: 'react-component',
3+
npm: {
4+
esModules: true,
5+
umd: {
6+
global: 'CoreUIReact',
7+
externals: {
8+
react: 'React',
9+
'react-dom': 'ReactDom',
10+
'react-router': 'ReactRouter',
11+
'react-router-dom': 'ReactRouterDom',
12+
'@coreui/react' : 'CoreUIReact'
13+
}
14+
}
15+
}
16+
}

package.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"name": "@coreui/react-chartjs",
3+
"version": "1.0.0-alpha.0",
4+
"description": "CoreUI React component wrapper for chart.js",
5+
"license": "MIT",
6+
"homepage": "https://coreui.io",
7+
"author": {
8+
"name": "CoreUI",
9+
"url": "https://coreui.io",
10+
"github": "https://github.com/coreui",
11+
"twitter": "https://twitter.com/core_ui"
12+
},
13+
"contributors": [
14+
{
15+
"name": "CoreUI Team",
16+
"url": "https://github.com/orgs/coreui/people"
17+
}
18+
],
19+
"repository": {
20+
"type": "git",
21+
"url": "https://github.com/coreui/coreui-react-chartjs.git"
22+
},
23+
"bugs": {
24+
"url": "https://github.com/coreui/coreui-react-chartjs/issues"
25+
},
26+
"main": "lib/index.js",
27+
"module": "es/index.js",
28+
"files": [
29+
"css/",
30+
"es/",
31+
"lib/",
32+
"umd/",
33+
"README.md"
34+
],
35+
"scripts": {
36+
"build": "nwb build-react-component --copy-files --no-demo",
37+
"clean": "nwb clean-module && nwb clean-demo",
38+
"lint": "eslint src",
39+
"link": "npm link @coreui/react"
40+
},
41+
"dependencies": {
42+
"@coreui/coreui-chartjs": "^2.0.0-beta.0",
43+
"chart.js": "^2.9.3",
44+
"classnames": "^2.2.6",
45+
"core-js": "^3.6.4",
46+
"prop-types": "^15.7.2"
47+
},
48+
"peerDependencies": {
49+
"@coreui/react": "^3.0.0-alpha.1",
50+
"react": "^16.12.0"
51+
},
52+
"devDependencies": {
53+
"babel-eslint": "^10.0.3",
54+
"enzyme": "^3.11.0",
55+
"enzyme-adapter-react-16": "^1.15.2",
56+
"eslint": "^6.8.0",
57+
"eslint-plugin-import": "^2.20.1",
58+
"eslint-plugin-react": "^7.18.3",
59+
"nwb": "^0.23.0",
60+
"react-app-polyfill": "^1.0.6",
61+
"sinon": "^5.1.1"
62+
},
63+
"keywords": [
64+
"coreui",
65+
"chart.js",
66+
"charts",
67+
"react chart.js",
68+
"coreui-react",
69+
"react charts",
70+
"react chart components",
71+
"react chart.js implementation",
72+
"layout",
73+
"component",
74+
"react"
75+
]
76+
}

0 commit comments

Comments
 (0)