Skip to content

Refresh #1172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Sep 14, 2023
Merged

Refresh #1172

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8d3453f
Bump supported engines/deps
dmt0 May 17, 2022
645198d
Drop IE support
dmt0 May 17, 2022
99f59a9
Upgrade build tools
dmt0 May 17, 2022
ec25f6e
Rename unsafe react lifecycle methods
dmt0 May 17, 2022
b5b7d1f
Prettier fix
dmt0 May 17, 2022
73277ab
Fix eslint
dmt0 May 17, 2022
8a5d740
Storybook fix
dmt0 May 18, 2022
7860c00
Update percy
dmt0 May 18, 2022
2e0d63f
Update circleci
dmt0 May 18, 2022
2727941
Remove deprecated polyfill
dmt0 May 18, 2022
cdc0c80
Add volta
dmt0 May 27, 2022
8fd47d0
Prettify SCSS
dmt0 May 31, 2022
5c2b5b0
Package updates
dmt0 May 31, 2022
26e3d52
Don't open dev app automatically
dmt0 May 31, 2022
e7253d9
Don't show dev overlay on warnings
dmt0 May 31, 2022
f7002b6
Upgrade to dart-sass
dmt0 May 31, 2022
ab04753
Standardize parts of the build
dmt0 May 31, 2022
9d1fe9a
Upgrade plotly.js to 2.x
dmt0 May 31, 2022
a2025e3
Package updates
dmt0 Jun 1, 2022
d9f9a64
Remove files from npm - especially postcss config
dmt0 Jun 1, 2022
66f2c9d
plotly.js as peer dep
dmt0 Jun 1, 2022
b6940b5
Fix: Transforms panel crash
dmt0 Jun 8, 2022
cdfb983
Package updates
dmt0 Jun 10, 2022
163d306
Remove unknown property
dmt0 Sep 7, 2022
b00b484
Fix empty panel z-index
dmt0 Oct 21, 2022
f2b5423
Plotly.js V2
dmt0 Dec 13, 2022
8081779
Remove nonexisting dataSources from figure
dmt0 Jan 31, 2023
21fbec3
Minify in production
dmt0 Jan 31, 2023
8e5af6e
Package updates
dmt0 Jan 31, 2023
b604f1a
npm -> yarn
dmt0 Feb 17, 2023
171178a
remove dead dep
dmt0 Feb 17, 2023
d4ec162
Update demo
dmt0 Jul 6, 2023
752fe43
Version bump
dmt0 Sep 5, 2023
cd89e81
fixup prettier
dmt0 Sep 7, 2023
2df5be4
legend.x behaves differently since plotly.js 2.23.0
dmt0 Sep 7, 2023
c31d9f7
Disable renovateBot
dmt0 Sep 7, 2023
56a5fb4
Upgrade Node.js to v20
dmt0 Sep 12, 2023
0d8c8ab
npm -> yarn in CI
dmt0 Sep 12, 2023
71e4b30
Fix SASS animations
dmt0 Sep 13, 2023
73e866b
Upgrade storybook
dmt0 Sep 12, 2023
d27b1b8
Downgrade percy - regression
dmt0 Sep 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions circle.yml → .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:12.13.1-browsers
- image: cimg/node:20.6.0-browsers

working_directory: ~/react-chart-editor

Expand All @@ -14,12 +14,12 @@ jobs:
- v2-dependencies-{{ checksum "package.json" }}
- v2-dependencies-

- run: npm install
- run: yarn install

- save_cache:
paths:
- node_modules
key: v2-dependencies-{{ checksum "package.json" }}

- run: npm test
- run: npm run test:percy
- run: yarn test
- run: yarn test:percy
47 changes: 27 additions & 20 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": ["eslint:recommended", "prettier"],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 6,
"ecmaVersion": 13,
"sourceType": "module",
"ecmaFeatures": {
"arrowFunctions": true,
Expand All @@ -15,6 +15,9 @@
"modules": true,
"templateStrings": true,
"jsx": true
},
"babelOptions": {
"presets": ["@babel/preset-react"]
}
},
"settings": {
Expand All @@ -25,24 +28,18 @@
},
"env": {
"browser": true,
"es6": true,
"es2021": true,
"jasmine": true,
"jest": true,
"node": true
},
"globals": {
"jest": true
},
"plugins": [
"react",
"import",
"react-percy"
],
"plugins": ["react", "import", "react-percy", "jsx"],
"overrides": [
{
"files": [
"**/*.percy.{js,jsx}"
],
"files": ["**/*.percy.{js,jsx}"],
"env": {
"react-percy/globals": true
}
Expand Down Expand Up @@ -120,20 +117,30 @@
"react/prop-types": "error",
"valid-jsdoc": ["error"],
"yoda": ["error"],
"spaced-comment": ["error", "always", {
"block": {
"exceptions": ["*"]
"spaced-comment": [
"error",
"always",
{
"block": {
"exceptions": ["*"]
}
}
}],
"no-unused-vars": ["error", {
],
"no-unused-vars": [
"error",
{
"args": "after-used",
"argsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^e$"
}],
"no-magic-numbers": ["error", {
"ignoreArrayIndexes": true,
}
],
"no-magic-numbers": [
"error",
{
"ignoreArrayIndexes": true,
"ignore": [-1, 0, 1, 2, 3, 100, 10, 0.5]
}],
}
],
"no-underscore-dangle": ["off"]
}
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ npm-debug.log*
!.npmignore
!.eslintrc
!.eslintignore
!.percy.yml
!.circleci

example/dist

Expand Down
22 changes: 20 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
# Almost all .gitignore content

npm-debug.log*
*.sublime*
accessTokens.js
yarn.lock
yarn-error.log
package-lock.json
storybook-static


# Additionally:

test
src
build
examples

circle.yml

.ackrc
.agignore
.circleci
.github
.storybook
.babelrc
.eslintrc
.gitattributes
.percy.yml
.prettierrc
.git
babel.config.json
postcss.config.js
renovate.json

npm-debug.log
14 changes: 14 additions & 0 deletions .percy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
snapshot:
widths:
- 500
minHeight: 600
percyCSS: ""
discovery:
allowedHostnames: []
disallowedHostnames: []
networkIdleTimeout: 100
upload:
files: "**/*.{png,jpg,jpeg}"
ignore: ""
stripExtensions: false
12 changes: 11 additions & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
module.exports = {
stories: ['../src/__stories__/index.js'],
stories: ['../src/__stories__/*.stories.js'],
core: {
disableTelemetry: true, // Disables telemetry
},
framework: {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: false,
},
};
2 changes: 1 addition & 1 deletion .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');

module.exports = async ({config, mode}) => {
module.exports = async ({config}) => {
config.module.rules.push({
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Check out the demo of the latest release of the `DefaultEditor` at https://plotl
git clone [this repo]
cd react-chart-editor
cd examples/demo
npm install
npm start
yarn install
yarn watch
```

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

```
cp accessTokens.tpl.js accessTokens.js # and edit to taste
npm install
npm start
yarn install
yarn watch
# hacking happens here
npm test
yarn test
```

## Built-in Components
Expand Down
13 changes: 0 additions & 13 deletions THEMING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,3 @@ Here is a sample theme to change the UI from light to dark. We attach all of our
You can inspect the editor and see a full listing of all variables that you can override:

![see-css-variables-inspector](https://user-images.githubusercontent.com/11803153/34531018-7e24bbba-f076-11e7-90cd-a35fe5eae84d.png)

## Caveats

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).

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:
`import react-chart-editor/lib/react-chart-editor.ie.css` (this stylesheet has the variables attached to the `:root{}` scope).

Then, rather than applying your custom properties to `.theme--dark .plotly-editor--theme-provider`, you would apply your overrides to `:root{}`.

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.

You can see our PostCSS scripts [here](https://github.com/plotly/react-chart-editor/tree/master/scripts/postcss.js).
30 changes: 30 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"env": {
"development": {"comments": false, "minified": true},
"production": {"comments": true, "minified": false}
},
"presets": [
[
"@babel/preset-react",
{
"runtime": "automatic"
}
],
"@babel/env"
],
"plugins": [
"react-hot-loader/babel",
"@babel/plugin-proposal-object-rest-spread",
[
"module-resolver",
{
"root": ["./"],
"alias": {
"components": "./src/components",
"lib": "./src/lib",
"styles": "./src/styles"
}
}
]
]
}
25 changes: 13 additions & 12 deletions dev/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@ import React, {Component} from 'react';
import {hot} from 'react-hot-loader/root';
import plotly from 'plotly.js/dist/plotly-with-meta';
import '../src/styles/main.scss';
import brace from 'brace'; // eslint-disable-line no-unused-vars
import AceEditor from 'react-ace';
import Select from 'react-select';
import PlotlyEditor, {DefaultEditor, Panel} from '../src';
import Inspector from 'react-inspector';
import dataSources from './dataSources';
import 'brace/mode/json';
import 'brace/theme/textmate';

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

// import {customConfigTest} from '../src/__stories__';
// import {customConfigTest} from './customConfigTest';

const dataSourceOptions = Object.keys(dataSources).map(name => ({
const dataSourceOptions = Object.keys(dataSources).map((name) => ({
value: name,
label: name,
}));

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

// eslint-disable-next-line no-unused-vars
const traceTypesConfig = {
traces: _ => [
traces: (_) => [
{
value: 'scatter',
icon: 'scatter',
Expand Down Expand Up @@ -66,16 +64,19 @@ const traceTypesConfig = {
complex: true,
};

// eslint-disable-next-line no-unused-vars
const chartHelp = {
area: {
helpDoc: 'https://help.plot.ly/make-an-area-graph/',
examplePlot: () => {
// eslint-disable-next-line no-console
console.log('example bar plot!');
},
},
bar: {
helpDoc: 'https://help.plot.ly/stacked-bar-chart/',
examplePlot: () => {
// eslint-disable-next-line no-console
console.log('example bar plot!');
},
},
Expand Down Expand Up @@ -122,8 +123,8 @@ class App extends Component {
// curl https://api.github.com/repos/plotly/plotly.js/contents/test/image/mocks \
// | jq '[.[] | .name ]' > mocks.json
fetch('/mocks.json')
.then(response => response.json())
.then(mocks => this.setState({mocks}));
.then((response) => response.json())
.then((mocks) => this.setState({mocks}));
}

loadMock(mockIndex) {
Expand All @@ -135,8 +136,8 @@ class App extends Component {
fetch(prefix + mockName, {
headers: new Headers({Accept: 'application/vnd.github.v3.raw'}),
})
.then(response => response.json())
.then(figure => {
.then((response) => response.json())
.then((figure) => {
const {data, layout, frames} = figure;
this.updateState(data, layout, frames, mockIndex);
});
Expand Down Expand Up @@ -219,7 +220,7 @@ class App extends Component {
}))}
searchable={true}
searchPromptText="Search for a mock"
onChange={option => this.loadMock(option.value)}
onChange={(option) => this.loadMock(option.value)}
noResultsText={'No Results'}
placeholder={'Search for a mock'}
/>
Expand All @@ -234,7 +235,7 @@ class App extends Component {
<AceEditor
mode="json"
theme="textmate"
onChange={json_string => this.setState({json_string})}
onChange={(json_string) => this.setState({json_string})}
value={this.state.json_string}
name="UNIQUE_ID_OF_DIV"
style={{height: '80vh'}}
Expand Down
Loading