Skip to content

Commit 8097fbd

Browse files
authored
Merge pull request #1172 from plotly/refresh
Refresh
2 parents 5baa87d + d27b1b8 commit 8097fbd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1648
-1960
lines changed

circle.yml .circleci/config.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs:
33
build:
44
docker:
55
# specify the version you desire here
6-
- image: circleci/node:12.13.1-browsers
6+
- image: cimg/node:20.6.0-browsers
77

88
working_directory: ~/react-chart-editor
99

@@ -14,12 +14,12 @@ jobs:
1414
- v2-dependencies-{{ checksum "package.json" }}
1515
- v2-dependencies-
1616

17-
- run: npm install
17+
- run: yarn install
1818

1919
- save_cache:
2020
paths:
2121
- node_modules
2222
key: v2-dependencies-{{ checksum "package.json" }}
2323

24-
- run: npm test
25-
- run: npm run test:percy
24+
- run: yarn test
25+
- run: yarn test:percy

.eslintrc

+27-20
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"extends": ["eslint:recommended", "prettier"],
3-
"parser": "babel-eslint",
3+
"parser": "@babel/eslint-parser",
44
"parserOptions": {
5-
"ecmaVersion": 6,
5+
"ecmaVersion": 13,
66
"sourceType": "module",
77
"ecmaFeatures": {
88
"arrowFunctions": true,
@@ -15,6 +15,9 @@
1515
"modules": true,
1616
"templateStrings": true,
1717
"jsx": true
18+
},
19+
"babelOptions": {
20+
"presets": ["@babel/preset-react"]
1821
}
1922
},
2023
"settings": {
@@ -25,24 +28,18 @@
2528
},
2629
"env": {
2730
"browser": true,
28-
"es6": true,
31+
"es2021": true,
2932
"jasmine": true,
3033
"jest": true,
3134
"node": true
3235
},
3336
"globals": {
3437
"jest": true
3538
},
36-
"plugins": [
37-
"react",
38-
"import",
39-
"react-percy"
40-
],
39+
"plugins": ["react", "import", "react-percy", "jsx"],
4140
"overrides": [
4241
{
43-
"files": [
44-
"**/*.percy.{js,jsx}"
45-
],
42+
"files": ["**/*.percy.{js,jsx}"],
4643
"env": {
4744
"react-percy/globals": true
4845
}
@@ -120,20 +117,30 @@
120117
"react/prop-types": "error",
121118
"valid-jsdoc": ["error"],
122119
"yoda": ["error"],
123-
"spaced-comment": ["error", "always", {
124-
"block": {
125-
"exceptions": ["*"]
120+
"spaced-comment": [
121+
"error",
122+
"always",
123+
{
124+
"block": {
125+
"exceptions": ["*"]
126+
}
126127
}
127-
}],
128-
"no-unused-vars": ["error", {
128+
],
129+
"no-unused-vars": [
130+
"error",
131+
{
129132
"args": "after-used",
130133
"argsIgnorePattern": "^_",
131134
"caughtErrorsIgnorePattern": "^e$"
132-
}],
133-
"no-magic-numbers": ["error", {
134-
"ignoreArrayIndexes": true,
135+
}
136+
],
137+
"no-magic-numbers": [
138+
"error",
139+
{
140+
"ignoreArrayIndexes": true,
135141
"ignore": [-1, 0, 1, 2, 3, 100, 10, 0.5]
136-
}],
142+
}
143+
],
137144
"no-underscore-dangle": ["off"]
138145
}
139146
}

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ npm-debug.log*
1010
!.npmignore
1111
!.eslintrc
1212
!.eslintignore
13+
!.percy.yml
14+
!.circleci
1315

1416
example/dist
1517

.npmignore

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,34 @@
1+
# Almost all .gitignore content
2+
3+
npm-debug.log*
4+
*.sublime*
5+
accessTokens.js
6+
yarn.lock
7+
yarn-error.log
8+
package-lock.json
9+
storybook-static
10+
11+
12+
# Additionally:
13+
114
test
215
src
316
build
417
examples
518

6-
circle.yml
7-
819
.ackrc
920
.agignore
21+
.circleci
22+
.github
23+
.storybook
1024
.babelrc
1125
.eslintrc
1226
.gitattributes
27+
.percy.yml
1328
.prettierrc
1429
.git
30+
babel.config.json
31+
postcss.config.js
32+
renovate.json
1533

1634
npm-debug.log

.percy.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
snapshot:
3+
widths:
4+
- 500
5+
minHeight: 600
6+
percyCSS: ""
7+
discovery:
8+
allowedHostnames: []
9+
disallowedHostnames: []
10+
networkIdleTimeout: 100
11+
upload:
12+
files: "**/*.{png,jpg,jpeg}"
13+
ignore: ""
14+
stripExtensions: false

.storybook/main.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
11
module.exports = {
2-
stories: ['../src/__stories__/index.js'],
2+
stories: ['../src/__stories__/*.stories.js'],
3+
core: {
4+
disableTelemetry: true, // Disables telemetry
5+
},
6+
framework: {
7+
name: '@storybook/react-webpack5',
8+
options: {},
9+
},
10+
docs: {
11+
autodocs: false,
12+
},
313
};

.storybook/webpack.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require('path');
22

3-
module.exports = async ({config, mode}) => {
3+
module.exports = async ({config}) => {
44
config.module.rules.push({
55
test: /\.scss$/,
66
use: ['style-loader', 'css-loader', 'sass-loader'],

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Check out the demo of the latest release of the `DefaultEditor` at https://plotl
1818
git clone [this repo]
1919
cd react-chart-editor
2020
cd examples/demo
21-
npm install
22-
npm start
21+
yarn install
22+
yarn watch
2323
```
2424

2525
See more examples
@@ -41,10 +41,10 @@ This repo contains a [dev app](https://github.com/plotly/react-chart-editor/tree
4141

4242
```
4343
cp accessTokens.tpl.js accessTokens.js # and edit to taste
44-
npm install
45-
npm start
44+
yarn install
45+
yarn watch
4646
# hacking happens here
47-
npm test
47+
yarn test
4848
```
4949

5050
## Built-in Components

THEMING.md

-13
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,3 @@ Here is a sample theme to change the UI from light to dark. We attach all of our
7777
You can inspect the editor and see a full listing of all variables that you can override:
7878

7979
![see-css-variables-inspector](https://user-images.githubusercontent.com/11803153/34531018-7e24bbba-f076-11e7-90cd-a35fe5eae84d.png)
80-
81-
## Caveats
82-
83-
CSS custom properties are not supported in IE11. However, you can use a [PostCSS](https://github.com/postcss/postcss) plugin to convert the css properties to their true value when they are used. We are using [PostCSS Custom Properties](https://github.com/postcss/postcss-custom-properties).
84-
85-
The PostCSS plugin we are using only applies to variables that are in the `:root{}` scope. If you'd like to both theme and use your styles to support IE11, you would need to import the unminified IE styles we ship with the editor:
86-
`import react-chart-editor/lib/react-chart-editor.ie.css` (this stylesheet has the variables attached to the `:root{}` scope).
87-
88-
Then, rather than applying your custom properties to `.theme--dark .plotly-editor--theme-provider`, you would apply your overrides to `:root{}`.
89-
90-
Finally, you would pipe in the PostCSS plugin(s) to your project and produce a css file with the properties applied as their true value. It's recommended to use the [PostCSS Remove Root](https://github.com/cbracco/postcss-remove-root) plugin after you have converted all of the properties.
91-
92-
You can see our PostCSS scripts [here](https://github.com/plotly/react-chart-editor/tree/master/scripts/postcss.js).

babel.config.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"env": {
3+
"development": {"comments": false, "minified": true},
4+
"production": {"comments": true, "minified": false}
5+
},
6+
"presets": [
7+
[
8+
"@babel/preset-react",
9+
{
10+
"runtime": "automatic"
11+
}
12+
],
13+
"@babel/env"
14+
],
15+
"plugins": [
16+
"react-hot-loader/babel",
17+
"@babel/plugin-proposal-object-rest-spread",
18+
[
19+
"module-resolver",
20+
{
21+
"root": ["./"],
22+
"alias": {
23+
"components": "./src/components",
24+
"lib": "./src/lib",
25+
"styles": "./src/styles"
26+
}
27+
}
28+
]
29+
]
30+
}

dev/App.js

+13-12
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,27 @@ import React, {Component} from 'react';
22
import {hot} from 'react-hot-loader/root';
33
import plotly from 'plotly.js/dist/plotly-with-meta';
44
import '../src/styles/main.scss';
5-
import brace from 'brace'; // eslint-disable-line no-unused-vars
65
import AceEditor from 'react-ace';
76
import Select from 'react-select';
87
import PlotlyEditor, {DefaultEditor, Panel} from '../src';
98
import Inspector from 'react-inspector';
109
import dataSources from './dataSources';
11-
import 'brace/mode/json';
12-
import 'brace/theme/textmate';
1310

1411
// https://github.com/plotly/react-chart-editor#mapbox-access-tokens
1512
import ACCESS_TOKENS from '../accessTokens';
1613

17-
// import {customConfigTest} from '../src/__stories__';
14+
// import {customConfigTest} from './customConfigTest';
1815

19-
const dataSourceOptions = Object.keys(dataSources).map(name => ({
16+
const dataSourceOptions = Object.keys(dataSources).map((name) => ({
2017
value: name,
2118
label: name,
2219
}));
2320

2421
const config = {mapboxAccessToken: ACCESS_TOKENS.MAPBOX, editable: true};
2522

23+
// eslint-disable-next-line no-unused-vars
2624
const traceTypesConfig = {
27-
traces: _ => [
25+
traces: (_) => [
2826
{
2927
value: 'scatter',
3028
icon: 'scatter',
@@ -66,16 +64,19 @@ const traceTypesConfig = {
6664
complex: true,
6765
};
6866

67+
// eslint-disable-next-line no-unused-vars
6968
const chartHelp = {
7069
area: {
7170
helpDoc: 'https://help.plot.ly/make-an-area-graph/',
7271
examplePlot: () => {
72+
// eslint-disable-next-line no-console
7373
console.log('example bar plot!');
7474
},
7575
},
7676
bar: {
7777
helpDoc: 'https://help.plot.ly/stacked-bar-chart/',
7878
examplePlot: () => {
79+
// eslint-disable-next-line no-console
7980
console.log('example bar plot!');
8081
},
8182
},
@@ -122,8 +123,8 @@ class App extends Component {
122123
// curl https://api.github.com/repos/plotly/plotly.js/contents/test/image/mocks \
123124
// | jq '[.[] | .name ]' > mocks.json
124125
fetch('/mocks.json')
125-
.then(response => response.json())
126-
.then(mocks => this.setState({mocks}));
126+
.then((response) => response.json())
127+
.then((mocks) => this.setState({mocks}));
127128
}
128129

129130
loadMock(mockIndex) {
@@ -135,8 +136,8 @@ class App extends Component {
135136
fetch(prefix + mockName, {
136137
headers: new Headers({Accept: 'application/vnd.github.v3.raw'}),
137138
})
138-
.then(response => response.json())
139-
.then(figure => {
139+
.then((response) => response.json())
140+
.then((figure) => {
140141
const {data, layout, frames} = figure;
141142
this.updateState(data, layout, frames, mockIndex);
142143
});
@@ -219,7 +220,7 @@ class App extends Component {
219220
}))}
220221
searchable={true}
221222
searchPromptText="Search for a mock"
222-
onChange={option => this.loadMock(option.value)}
223+
onChange={(option) => this.loadMock(option.value)}
223224
noResultsText={'No Results'}
224225
placeholder={'Search for a mock'}
225226
/>
@@ -234,7 +235,7 @@ class App extends Component {
234235
<AceEditor
235236
mode="json"
236237
theme="textmate"
237-
onChange={json_string => this.setState({json_string})}
238+
onChange={(json_string) => this.setState({json_string})}
238239
value={this.state.json_string}
239240
name="UNIQUE_ID_OF_DIV"
240241
style={{height: '80vh'}}

0 commit comments

Comments
 (0)