├── CHANGELOG.md ├── .npmrc ├── commitlint.config.js ├── .github ├── semantic.yml ├── issue_label_bot.yaml ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── question.md │ ├── feature_request.md │ └── bug_report.md └── CODEOWNERS ├── packages ├── superset-ui-plugin-chart-dummy │ ├── types │ │ └── external.d.ts │ ├── src │ │ ├── images │ │ │ └── thumbnail.png │ │ ├── transformProps.ts │ │ ├── index.ts │ │ └── DummyChart.tsx │ ├── package.json │ └── README.md ├── superset-ui-preset-chart-dummies │ ├── types │ │ └── external.d.ts │ ├── src │ │ ├── index.ts │ │ ├── Watermelon │ │ │ ├── images │ │ │ │ └── thumbnail.png │ │ │ ├── transformProps.ts │ │ │ ├── index.ts │ │ │ └── WatermelonChart.tsx │ │ └── preset.ts │ ├── package.json │ └── README.md └── superset-ui-plugins-demo │ ├── .storybook │ ├── storybook.css │ ├── addons.js │ ├── config.js │ └── webpack.config.js │ ├── storybook │ └── stories │ │ ├── preset-chart-dummies │ │ └── Watermelon │ │ │ ├── data.ts │ │ │ ├── index.js │ │ │ └── Stories.tsx │ │ ├── plugin-chart-dummy │ │ ├── index.js │ │ ├── data.ts │ │ └── Stories.tsx │ │ └── index.js │ ├── tsconfig.json │ ├── README.md │ └── package.json ├── lerna.json ├── .travis.yml ├── scripts └── buildAssets.js ├── .gitignore ├── README.md ├── package.json └── LICENSE /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | package-lock=false 2 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = require('@superset-ui/commit-config/commitlint.config'); 2 | -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | # Always validate the PR title, and ignore the commits 2 | titleOnly: true 3 | -------------------------------------------------------------------------------- /.github/issue_label_bot.yaml: -------------------------------------------------------------------------------- 1 | label-alias: 2 | bug: '#bug' 3 | feature_request: '#enhancement' 4 | question: '#question' 5 | -------------------------------------------------------------------------------- /packages/superset-ui-plugin-chart-dummy/types/external.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.png' { 2 | const value: any; 3 | export default value; 4 | } 5 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/types/external.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.png' { 2 | const value: any; 3 | export default value; 4 | } 5 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 💔 Breaking Changes 2 | 3 | 🏆 Enhancements 4 | 5 | 📜 Documentation 6 | 7 | 🐛 Bug Fix 8 | 9 | 🏠 Internal 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask for help with something. 4 | 5 | --- 6 | 7 | Your question. 8 | - How do I xxx? 9 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "lerna": "3.2.1", 3 | "npmClient": "yarn", 4 | "packages": [ 5 | "packages/*" 6 | ], 7 | "useWorkspaces": true, 8 | "version": "0.11.2" 9 | } 10 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/src/index.ts: -------------------------------------------------------------------------------- 1 | export { default as WatermelonChartPlugin } from './Watermelon'; 2 | export { default as DummiesChartPreset } from './preset'; 3 | -------------------------------------------------------------------------------- /packages/superset-ui-plugin-chart-dummy/src/images/thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache-superset/superset-ui-plugins-template/HEAD/packages/superset-ui-plugin-chart-dummy/src/images/thumbnail.png -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/.storybook/storybook.css: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | #root { 4 | height: 100%; 5 | font-family: BlinkMacSystemFont, Roboto, Helvetica Neue, sans-serif; 6 | font-weight: 200; 7 | color: #484848; 8 | } 9 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/src/Watermelon/images/thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache-superset/superset-ui-plugins-template/HEAD/packages/superset-ui-preset-chart-dummies/src/Watermelon/images/thumbnail.png -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/.storybook/addons.js: -------------------------------------------------------------------------------- 1 | // note that the import order here determines the order in the UI! 2 | import '@storybook/addon-knobs/register'; 3 | import '@storybook/addon-actions/register'; 4 | import '@storybook/addon-links/register'; 5 | import 'storybook-addon-jsx/register'; 6 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/storybook/stories/preset-chart-dummies/Watermelon/data.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-magic-numbers */ 2 | const points: { x: number }[] = []; 3 | 4 | for (let i = 0; i < 10; i += 1) { 5 | points.push({ 6 | x: Math.random(), 7 | }); 8 | } 9 | 10 | export default points; 11 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/storybook/stories/plugin-chart-dummy/index.js: -------------------------------------------------------------------------------- 1 | import DummyChartPlugin from '../../../../superset-ui-plugin-chart-dummy/src'; 2 | import Stories from './Stories'; 3 | 4 | new DummyChartPlugin().configure({ key: 'dummy' }).register(); 5 | 6 | export default { 7 | examples: [...Stories], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/storybook/stories/plugin-chart-dummy/data.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-magic-numbers */ 2 | const points: { x: number; y: number }[] = []; 3 | 4 | for (let i = 0; i < 100; i += 1) { 5 | points.push({ 6 | x: Math.random(), 7 | y: Math.random(), 8 | }); 9 | } 10 | 11 | export default points; 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | 3 | node_js: 4 | - '10.15' 5 | 6 | cache: 7 | - npm: true 8 | - yarn: true 9 | 10 | matrix: 11 | fast_finish: true 12 | 13 | install: 14 | - npm install -g codecov 15 | - yarn install 16 | 17 | before_script: 18 | - yarn build 19 | 20 | script: 21 | - yarn test 22 | 23 | after_script: 24 | - codecov 25 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/storybook/stories/preset-chart-dummies/Watermelon/index.js: -------------------------------------------------------------------------------- 1 | import { WatermelonChartPlugin } from '../../../../../superset-ui-preset-chart-dummies/src'; 2 | import Stories from './Stories'; 3 | 4 | new WatermelonChartPlugin().configure({ key: 'watermelon' }).register(); 5 | 6 | export default { 7 | examples: [...Stories], 8 | }; 9 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/src/preset.ts: -------------------------------------------------------------------------------- 1 | import { Preset } from '@superset-ui/core'; 2 | import WatermelonChartPlugin from './Watermelon'; 3 | 4 | export default class DummyChartPreset extends Preset { 5 | constructor() { 6 | super({ 7 | name: 'Dummy charts', 8 | plugins: [new WatermelonChartPlugin().configure({ key: 'watermelon' })], 9 | }); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/about-codeowners/ 2 | # for more info about CODEOWNERS file 3 | 4 | # It uses the same pattern rule for gitignore file 5 | # https://git-scm.com/docs/gitignore#_pattern_format 6 | 7 | # These owners will be the default owners for everything in 8 | # the repo. Unless a later match takes precedence, 9 | # these users/team will be requested for review 10 | # when someone opens a pull request. 11 | 12 | * @apache-superset/embeddable-charts-team 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/storybook/stories/plugin-chart-dummy/Stories.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-magic-numbers, sort-keys */ 2 | import React from 'react'; 3 | import { SuperChart } from '@superset-ui/chart'; 4 | import data from './data'; 5 | 6 | export default [ 7 | { 8 | renderStory: () => ( 9 | 21 | ), 22 | storyName: 'Basic', 23 | storyPath: 'plugin-chart-dummy|DummyChartPlugin', 24 | }, 25 | ]; 26 | -------------------------------------------------------------------------------- /scripts/buildAssets.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable import/no-extraneous-dependencies, no-console */ 2 | const fg = require('fast-glob'); 3 | const fs = require('fs-extra'); 4 | 5 | const packages = fg.sync(['packages/*'], { 6 | onlyDirectories: true, 7 | }); 8 | 9 | packages.forEach(pkg => { 10 | const assets = fg.sync([`${pkg}/src/**/*.{png,gif,jpg,css,geojson}`]); 11 | assets.forEach(filePath => { 12 | const newPaths = ['lib', 'esm'].map(dir => filePath.replace(`${pkg}/src`, `${pkg}/${dir}`)); 13 | newPaths.forEach(p => { 14 | fs.copy(filePath, p, err => { 15 | if (err) { 16 | console.error(err); 17 | } 18 | console.log(`Copy ${filePath}`); 19 | console.log(`=> to ${p}`); 20 | }); 21 | }); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Environment (please complete the following information):** 24 | - superset-ui version: [e.g. v0.5.0] 25 | - Node version: `node -v` 26 | - npm version: `npm -v` 27 | 28 | **Additional context** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.DS_Store 3 | 4 | # Logs 5 | logs/ 6 | *.log 7 | 8 | # Cache 9 | .bundle/ 10 | .happo/ 11 | .idea/ 12 | .next/ 13 | .cache 14 | .eslintcache 15 | .idea 16 | .npm 17 | .vscode 18 | .yarnclean 19 | 20 | # Directories 21 | build/ 22 | coverage/ 23 | dist/ 24 | esm/ 25 | lib/ 26 | public/ 27 | node_modules/ 28 | tmp/ 29 | 30 | # Custom 31 | *.map 32 | *.min.js 33 | test-changelog.md 34 | 35 | # Configs (provided by Nimbus) 36 | .babelrc 37 | .eslintignore 38 | .eslintrc.js 39 | .flowconfig 40 | .prettierignore 41 | babel.config.js 42 | jest.config.js 43 | prettier.config.js 44 | tsconfig.eslint.json 45 | tsconfig.json 46 | tsconfig.options.json 47 | *.tsbuildinfo 48 | webpack.config.js 49 | 50 | # Lock files, libs should not have lock files 51 | npm-shrinkwrap.json 52 | package-lock.json 53 | # yarn.lock 54 | old-yarn.lock 55 | .*.swp 56 | _gh-pages -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/storybook/stories/preset-chart-dummies/Watermelon/Stories.tsx: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-magic-numbers */ 2 | import React from 'react'; 3 | import { SuperChart } from '@superset-ui/chart'; 4 | import data from './data'; 5 | 6 | export default [ 7 | { 8 | renderStory: () => ( 9 | 24 | ), 25 | storyName: 'Basic', 26 | storyPath: 'preset-chart-dummies|WatermelonChartPlugin', 27 | }, 28 | ]; 29 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/.storybook/config.js: -------------------------------------------------------------------------------- 1 | import { addParameters, configure } from '@storybook/react'; 2 | 3 | addParameters({ 4 | options: { 5 | name: '@superset-ui/plugins-template 🔌💡', 6 | addonPanelInRight: false, 7 | enableShortcuts: false, 8 | goFullScreen: false, 9 | hierarchyRootSeparator: null, 10 | hierarchySeparator: /\|/, 11 | selectedAddonPanel: undefined, // The order of addons in the "Addon panel" is the same as you import them in 'addons.js'. The first panel will be opened by default as you run Storybook 12 | showAddonPanel: true, 13 | showSearchBox: false, 14 | showStoriesPanel: true, 15 | sidebarAnimations: true, 16 | sortStoriesByKind: false, 17 | url: '#', 18 | }, 19 | }); 20 | 21 | function loadStorybook() { 22 | require('./storybook.css'); 23 | require('../storybook/stories'); // all of the stories 24 | } 25 | 26 | configure(loadStorybook, module); 27 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "allowSyntheticDefaultImports": true, 5 | "baseUrl": ".", 6 | "outDir": "./dist", 7 | "esModuleInterop": true, 8 | "forceConsistentCasingInFileNames": true, 9 | "importHelpers": true, 10 | "jsx": "react", 11 | "lib": ["dom", "esnext"], 12 | "module": "commonjs", 13 | "moduleResolution": "node", 14 | "noEmitOnError": true, 15 | "noImplicitReturns": true, 16 | "noImplicitThis": true, 17 | "noImplicitAny": true, 18 | "noUnusedLocals": true, 19 | "pretty": true, 20 | "removeComments": false, 21 | "strictNullChecks": true, 22 | "suppressImplicitAnyIndexErrors": true, 23 | "skipLibCheck": true, 24 | "sourceMap": true, 25 | "target": "esnext" 26 | }, 27 | "include": ["./storybook/stories/**/*", "../superset-ui-*/src/**/*", "./src/**/*", "./spec/**/*", "storybook/shared/dummyDatasource.ts"] 28 | } 29 | -------------------------------------------------------------------------------- /packages/superset-ui-plugin-chart-dummy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "superset-ui-plugin-chart-dummy", 3 | "version": "0.0.0", 4 | "description": "Superset Chart Plugin - Dummy", 5 | "sideEffects": [ 6 | "*.css" 7 | ], 8 | "main": "lib/index.js", 9 | "module": "esm/index.js", 10 | "files": [ 11 | "esm", 12 | "lib" 13 | ], 14 | "repository": { 15 | "type": "git", 16 | "url": "git+https://github.com/apache-superset/superset-ui-plugins-template.git" 17 | }, 18 | "keywords": [ 19 | "superset" 20 | ], 21 | "author": "Superset", 22 | "license": "Apache-2.0", 23 | "bugs": { 24 | "url": "https://github.com/apache-superset/superset-ui-plugins-template/issues" 25 | }, 26 | "homepage": "https://github.com/apache-superset/superset-ui-plugins-template#readme", 27 | "publishConfig": { 28 | "access": "public" 29 | }, 30 | "dependencies": { 31 | "@types/react": "^16" 32 | }, 33 | "peerDependencies": { 34 | "react": "^16", 35 | "@superset-ui/chart": "^0.12.0", 36 | "@superset-ui/translation": "^0.12.0" 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "superset-ui-preset-chart-dummies", 3 | "version": "0.11.1", 4 | "description": "Superset Chart Preset - Dummies", 5 | "sideEffects": [ 6 | "*.css" 7 | ], 8 | "main": "lib/index.js", 9 | "module": "esm/index.js", 10 | "files": [ 11 | "esm", 12 | "lib", 13 | "types" 14 | ], 15 | "repository": { 16 | "type": "git", 17 | "url": "git+https://github.com/apache-superset/superset-ui-plugins-template.git" 18 | }, 19 | "keywords": [ 20 | "superset" 21 | ], 22 | "author": "Superset", 23 | "license": "Apache-2.0", 24 | "bugs": { 25 | "url": "https://github.com/apache-superset/superset-ui-plugins-template/issues" 26 | }, 27 | "homepage": "https://github.com/apache-superset/superset-ui-plugins-template#readme", 28 | "publishConfig": { 29 | "access": "public" 30 | }, 31 | "dependencies": { 32 | "@types/react": "^16" 33 | }, 34 | "peerDependencies": { 35 | "react": "^16", 36 | "@superset-ui/core": "^0.12.0", 37 | "@superset-ui/chart": "^0.12.0", 38 | "@superset-ui/translation": "^0.12.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /packages/superset-ui-plugin-chart-dummy/README.md: -------------------------------------------------------------------------------- 1 | ## superset-ui-plugin-chart-dummy 2 | 3 | [![Version](https://img.shields.io/npm/v/superset-ui-plugin-chart-dummy.svg?style=flat-square)](https://img.shields.io/npm/v/superset-ui-plugin-chart-dummy.svg?style=flat-square) 4 | [![David (path)](https://img.shields.io/david/apache-superset/superset-ui-plugins-template.svg?path=packages%2Fsuperset-ui-legacy-plugin-chart-dummy&style=flat-square)](https://david-dm.org/apache-superset/superset-ui-plugins-template?path=packages/superset-ui-legacy-plugin-chart-dummy) 5 | 6 | This plugin provides Dummy for Superset. 7 | 8 | ### Usage 9 | 10 | Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to lookup this chart throughout the app. 11 | 12 | ```js 13 | import DummyChartPlugin from 'superset-ui-plugin-chart-dummy'; 14 | 15 | new DummyChartPlugin() 16 | .configure({ key: 'dummy' }) 17 | .register(); 18 | ``` 19 | 20 | Then use it via `SuperChart`. See [storybook](https://apache-superset.github.io/superset-ui-plugins-template/?selectedKind=plugin-chart-dummy) for more details. 21 | 22 | ```js 23 | 32 | ``` -------------------------------------------------------------------------------- /packages/superset-ui-plugin-chart-dummy/src/transformProps.ts: -------------------------------------------------------------------------------- 1 | import { ChartProps } from '@superset-ui/chart'; 2 | 3 | /** 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | export default function transformProps(chartProps: ChartProps) { 22 | const { width, height, formData, queryData } = chartProps; 23 | const { color } = formData; 24 | const { data } = queryData; 25 | 26 | return { 27 | width, 28 | height, 29 | color, 30 | data, 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/src/Watermelon/transformProps.ts: -------------------------------------------------------------------------------- 1 | import { ChartProps } from '@superset-ui/chart'; 2 | 3 | /** 4 | * Licensed to the Apache Software Foundation (ASF) under one 5 | * or more contributor license agreements. See the NOTICE file 6 | * distributed with this work for additional information 7 | * regarding copyright ownership. The ASF licenses this file 8 | * to you under the Apache License, Version 2.0 (the 9 | * "License"); you may not use this file except in compliance 10 | * with the License. You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, 15 | * software distributed under the License is distributed on an 16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | * KIND, either express or implied. See the License for the 18 | * specific language governing permissions and limitations 19 | * under the License. 20 | */ 21 | export default function transformProps(chartProps: ChartProps) { 22 | const { width, height, formData, queryData } = chartProps; 23 | const { color } = formData; 24 | const { data } = queryData; 25 | 26 | return { 27 | width, 28 | height, 29 | color, 30 | data, 31 | }; 32 | } 33 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/README.md: -------------------------------------------------------------------------------- 1 | ## superset-ui-preset-chart-dummies 2 | 3 | [![Version](https://img.shields.io/npm/v/superset-ui-preset-chart-dummies.svg?style=flat-square)](https://img.shields.io/npm/v/superset-ui-preset-chart-dummies.svg?style=flat-square) 4 | [![David (path)](https://img.shields.io/david/apache-superset/superset-ui-plugins-template.svg?path=packages%2Fsuperset-ui-preset-chart-dummies&style=flat-square)](https://david-dm.org/apache-superset/superset-ui-plugins-template?path=packages/superset-ui-preset-chart-dummies) 5 | 6 | This plugin provides a set of dummy charts for Superset. 7 | 8 | ### Usage 9 | 10 | Configure `key`, which can be any `string`, and register the plugin. This `key` will be used to lookup this chart throughout the app. 11 | 12 | ```js 13 | import { WatermelonChartPlugin } from 'superset-ui-preset-chart-dummies'; 14 | 15 | new WatermelonChartPlugin() 16 | .configure({ key: 'watermelon' }) 17 | .register(); 18 | ``` 19 | 20 | Then use it via `SuperChart`. See [storybook](https://apache-superset.github.io/superset-ui-plugins-template/?selectedKind=plugin-chart-watermelon) for more details. 21 | 22 | ```js 23 | 32 | ``` 33 | -------------------------------------------------------------------------------- /packages/superset-ui-plugin-chart-dummy/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | import { t } from '@superset-ui/translation'; 20 | import { ChartMetadata, ChartPlugin } from '@superset-ui/chart'; 21 | import transformProps from './transformProps'; 22 | import thumbnail from './images/thumbnail.png'; 23 | 24 | const metadata = new ChartMetadata({ 25 | description: '', 26 | name: t('Example dummy chart'), 27 | thumbnail, 28 | }); 29 | 30 | export default class DummyChartPlugin extends ChartPlugin { 31 | constructor() { 32 | super({ 33 | loadChart: () => import('./DummyChart'), 34 | metadata, 35 | transformProps, 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/src/Watermelon/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | import { t } from '@superset-ui/translation'; 20 | import { ChartMetadata, ChartPlugin } from '@superset-ui/chart'; 21 | import transformProps from './transformProps'; 22 | import thumbnail from './images/thumbnail.png'; 23 | 24 | const metadata = new ChartMetadata({ 25 | description: '', 26 | name: t('Watermelon chart'), 27 | thumbnail, 28 | }); 29 | 30 | export default class WatermelonChartPlugin extends ChartPlugin { 31 | constructor() { 32 | super({ 33 | loadChart: () => import('./WatermelonChart'), 34 | metadata, 35 | transformProps, 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/superset-ui-plugin-chart-dummy/src/DummyChart.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | import React from 'react'; 20 | 21 | export type DummyChartProps = { 22 | height: number; 23 | width: number; 24 | data: { x: number; y: number }[]; 25 | }; 26 | 27 | export default class DummyChart extends React.PureComponent { 28 | render() { 29 | const { data, height, width } = this.props; 30 | 31 | return ( 32 | 33 | {data.map(({ x, y }) => ( 34 | 42 | ))} 43 | 44 | Hello! 45 | 46 | 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /packages/superset-ui-preset-chart-dummies/src/Watermelon/WatermelonChart.tsx: -------------------------------------------------------------------------------- 1 | /** 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | import React from 'react'; 20 | 21 | export type WatermelonChartProps = { 22 | data: { x: number }[]; 23 | height: number; 24 | width: number; 25 | }; 26 | 27 | export default class WatermelonChart extends React.PureComponent { 28 | render() { 29 | const { data, height, width } = this.props; 30 | 31 | return ( 32 | 33 | {data.map(({ x }, i) => ( 34 | 43 | ))} 44 | 45 | Watermelon 46 | 47 | 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/README.md: -------------------------------------------------------------------------------- 1 | ## @superset-ui/demo 2 | 3 | [![David (path)](https://img.shields.io/david/apache-superset/superset-ui-plugins-template.svg?path=packages%2Fsuperset-ui-demo&style=flat-square)](https://david-dm.org/apache-superset/superset-ui-plugins-template?path=packages/superset-ui-demo) 4 | 5 | Storybook of `@superset-ui-plugins-template` packages. See it live at 6 | [apache-superset.github.io/superset-ui-plugins-template](https://apache-superset.github.io/superset-ui-plugins-template) 7 | 8 | ### Development 9 | 10 | #### Run storybook 11 | 12 | To view the storybook locally, you should: 13 | 14 | 1. Clone [superset-ui-plugins-template](https://github.com/apache-superset/superset-ui-plugins-template) repo. 15 | 2. Run `yarn install && yarn build` in the `superset-ui-plugins-template` root directory. 16 | 3. Change to the demo directory `cd packages/superset-ui-plugins-template-demo`. 17 | 4. Run `yarn run storybook`. This will open up a dev server at http://localhost:9001. 18 | 19 | #### Adding new stories 20 | 21 | ###### Existing package 22 | 23 | If stories already exist for the package you are adding, simply extend the `examples` already 24 | exported for that package in the `storybook/stories//index.js` file. 25 | 26 | ###### New package 27 | 28 | If you are creating stories for a package that doesn't yet have any stories, follow these steps: 29 | 30 | 1. Add any new package dependencies via 31 | `yarn add `, but if it is `@superset-ui/*` packages, manually add it to `peerDependencies`. 32 | 33 | 2. Create a new folder that mirrors the package name 34 | 35 | > e.g., `mkdir storybook/stories/superset-ui-color/` 36 | 37 | 3. Add an `index.js` file to that folder with a default export with the following shape: 38 | 39 | > you can use the `|` separator within the `storyPath` string to denote _nested_ stories e.g., 40 | > `storyPath: '@superset-ui/package|Nested i|Nested ii'` 41 | 42 | ```javascript 43 | default export { 44 | examples: [ 45 | { 46 | storyPath: , 47 | storyName: , 48 | renderStory: () => node, 49 | }, 50 | ... 51 | ] 52 | }; 53 | ``` 54 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@superset-ui/plugins-demo", 3 | "version": "0.11.2", 4 | "description": "Storybook for Superset UI Plugins 🔌💡", 5 | "private": true, 6 | "main": "index.js", 7 | "scripts": { 8 | "demo:clean": "rm -rf _gh-pages", 9 | "demo:build": "build-storybook -o _gh-pages", 10 | "demo:publish": "gh-pages -d _gh-pages", 11 | "deploy-demo": "npm run demo:clean && npm run demo:build && npm run demo:publish && npm run demo:clean", 12 | "storybook:run": "start-storybook -p 9001", 13 | "storybook": "cd ../../ && yarn build && cd - && yarn storybook:run" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "git+https://github.com/apache-superset/superset-ui-plugins.git" 18 | }, 19 | "keywords": [ 20 | "storybook", 21 | "superset", 22 | "ui", 23 | "visualization", 24 | "analysis", 25 | "data" 26 | ], 27 | "license": "Apache-2.0", 28 | "bugs": { 29 | "url": "https://github.com/apache-superset/superset-ui-plugins/issues" 30 | }, 31 | "homepage": "https://github.com/apache-superset/superset-ui-plugins#readme", 32 | "dependencies": { 33 | "@babel/polyfill": "^7.4.3", 34 | "@storybook/addon-actions": "^5.0.9", 35 | "@storybook/addon-knobs": "^5.0.9", 36 | "@storybook/addon-links": "^5.0.9", 37 | "@storybook/addons": "^5.0.9", 38 | "@storybook/react": "^5.0.9", 39 | "@types/react": "^16.8.8", 40 | "@types/storybook__react": "3.0.7", 41 | "@types/storybook__addon-knobs": "^5.0.0", 42 | "bootstrap": "^4.3.1", 43 | "react": "^16.6.0", 44 | "storybook-addon-jsx": "^7.1.0" 45 | }, 46 | "devDependencies": { 47 | "@babel/core": "^7.4.3", 48 | "@babel/plugin-syntax-dynamic-import": "^7.2.0", 49 | "babel-loader": "^8.0.5", 50 | "gh-pages": "^2.0.1", 51 | "terser-webpack-plugin": "1.4.1" 52 | }, 53 | "peerDependencies": { 54 | "@superset-ui/chart": "^0.12.0", 55 | "@superset-ui/chart-composition": "^0.12.0", 56 | "@superset-ui/color": "^0.12.0", 57 | "@superset-ui/connection": "^0.12.0", 58 | "@superset-ui/time-format": "^0.12.0", 59 | "@superset-ui/translation": "^0.12.0" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/.storybook/webpack.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const TerserPlugin = require('terser-webpack-plugin'); 3 | const webpack = require('webpack'); 4 | 5 | const BABEL_TYPESCRIPT_OPTIONS = { 6 | presets: [ 7 | ['@babel/preset-env', { useBuiltIns: 'entry', corejs: 3 }], 8 | '@babel/preset-react', 9 | '@babel/preset-typescript', 10 | ], 11 | plugins: [ 12 | '@babel/plugin-proposal-object-rest-spread', 13 | '@babel/plugin-proposal-class-properties', 14 | '@babel/plugin-syntax-dynamic-import', 15 | ] 16 | }; 17 | 18 | const SIBLING_PACKAGES_PATH_REGEXP = new RegExp( 19 | `${path.resolve(__dirname, '../../superset-ui-(legacy-)*(plugin|preset)-')}.+/src`, 20 | ); 21 | 22 | module.exports = async ({ config }) => { 23 | config.resolve = config.resolve || {}; 24 | config.resolve.extensions = ['.tsx', '.ts', '.jsx', '.js']; 25 | 26 | config.plugins.push(new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/)); 27 | // Avoid parsing large libraries to speed up build 28 | config.module.noParse = /jquery|moment/; 29 | 30 | // To enable live debugging of other packages when referring to `src` 31 | config.module.rules.push({ 32 | include: SIBLING_PACKAGES_PATH_REGEXP, 33 | exclude: /node_modules/, 34 | test: /\.jsx?$/, 35 | use: config.module.rules[0].use, 36 | }); 37 | 38 | // Enable TypeScript 39 | config.module.rules.push({ 40 | include: SIBLING_PACKAGES_PATH_REGEXP, 41 | exclude: /node_modules/, 42 | test: /\.tsx?$/, 43 | use: [{ 44 | loader: 'babel-loader', 45 | options: BABEL_TYPESCRIPT_OPTIONS, 46 | }], 47 | }); 48 | 49 | config.module.rules.push({ 50 | include: path.resolve(__dirname, '../storybook'), 51 | exclude: /node_modules/, 52 | test: /\.tsx?$/, 53 | use: [{ 54 | loader: 'babel-loader', 55 | options: BABEL_TYPESCRIPT_OPTIONS, 56 | }], 57 | }); 58 | 59 | config.optimization = config.optimization || {}; 60 | config.optimization.splitChunks = { 61 | chunks: 'async' 62 | }; 63 | config.optimization.minimizer = [ 64 | new TerserPlugin({ 65 | parallel: true, 66 | extractComments: true, 67 | }), 68 | ]; 69 | 70 | if (process.env.RUNNING_CONTEXT === 'netlify') { 71 | config.devtool = false; 72 | config.cache = false; 73 | } 74 | 75 | return config; 76 | }; 77 | -------------------------------------------------------------------------------- /packages/superset-ui-plugins-demo/storybook/stories/index.js: -------------------------------------------------------------------------------- 1 | import '@babel/polyfill'; 2 | import { setAddon, storiesOf } from '@storybook/react'; 3 | import { withKnobs } from '@storybook/addon-knobs'; 4 | import JSXAddon from 'storybook-addon-jsx'; 5 | import categoricalD3 from '@superset-ui/color/esm/colorSchemes/categorical/d3'; 6 | import sequentialCommon from '@superset-ui/color/esm/colorSchemes/sequential/common'; 7 | import sequentialD3 from '@superset-ui/color/esm/colorSchemes/sequential/d3'; 8 | import { configure } from '@superset-ui/translation'; 9 | import { getCategoricalSchemeRegistry, getSequentialSchemeRegistry } from '@superset-ui/color'; 10 | import { getTimeFormatterRegistry, smartDateFormatter } from '@superset-ui/time-format'; 11 | 12 | setAddon(JSXAddon); 13 | 14 | configure(); 15 | 16 | // Register color schemes 17 | const categoricalSchemeRegistry = getCategoricalSchemeRegistry(); 18 | [categoricalD3].forEach(group => { 19 | group.forEach(scheme => { 20 | categoricalSchemeRegistry.registerValue(scheme.id, scheme); 21 | }); 22 | }); 23 | categoricalSchemeRegistry.setDefaultKey('d3Category10'); 24 | 25 | const sequentialSchemeRegistry = getSequentialSchemeRegistry(); 26 | [sequentialCommon, sequentialD3].forEach(group => { 27 | group.forEach(scheme => { 28 | sequentialSchemeRegistry.registerValue(scheme.id, scheme); 29 | }); 30 | }); 31 | 32 | getTimeFormatterRegistry() 33 | .registerValue('smart_date', smartDateFormatter) 34 | .setDefaultKey('smart_date'); 35 | 36 | const EMPTY_EXAMPLES = [ 37 | { 38 | renderStory: () => 'Does your default export have an `examples` key?', 39 | storyName: 'No examples found', 40 | }, 41 | ]; 42 | 43 | /* 44 | * Below we crawl the dir + subdirs looking for index files of stories 45 | * Each index is expected to have a default export with examples key containing 46 | * an array of examples. Each example should have the shape: 47 | * { storyPath: string, storyName: string, renderStory: fn() => node } 48 | * 49 | */ 50 | const requireContext = require.context('./', /* subdirs= */ true, /index\.jsx?$/); 51 | 52 | requireContext.keys().forEach(packageName => { 53 | const packageExport = requireContext(packageName); 54 | if (packageExport && packageExport.default && !Array.isArray(packageExport.default)) { 55 | const { examples = EMPTY_EXAMPLES } = packageExport.default; 56 | 57 | examples.forEach(example => { 58 | const { 59 | storyPath = 'Missing story path', 60 | storyName = 'Missing name', 61 | renderStory = () => 'Missing `renderStory`', 62 | options = {}, 63 | } = example; 64 | 65 | storiesOf(storyPath, module) 66 | .addParameters({ options }) 67 | .addDecorator(withKnobs) 68 | .addWithJSX(storyName, renderStory); 69 | }); 70 | } 71 | }); 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # @superset-ui/plugins-template 🔌💡 2 | 3 | [![Codecov branch](https://img.shields.io/codecov/c/github/apache-superset/superset-ui-plugins-template/master.svg?style=flat-square)](https://codecov.io/gh/apache-superset/superset-ui-plugins-template/branch/master) 4 | [![Build Status](https://img.shields.io/travis/com/apache-superset/superset-ui-plugins-template/master.svg?style=flat-square)](https://travis-ci.com/apache-superset/superset-ui-plugins-template) 5 | [![David](https://img.shields.io/david/dev/apache-superset/superset-ui-plugins-template.svg?style=flat-square)](https://david-dm.org/apache-superset/superset-ui-plugins-template?type=dev) 6 | [![Netlify Status](https://api.netlify.com/api/v1/badges/d2c78390-752e-4fc2-abf0-7e6df362b9ff/deploy-status)](https://app.netlify.com/sites/superset-ui-plugins-template/deploys) 7 | 8 | You can create a new repository based on this one and rename `plugin-chart-dummy` to your plugin. 9 | There is also an example for `preset` package. `preset` contains two or more plugins, which is 10 | useful when the plugins are tightly-coupled together. 11 | 12 | ## Demo (Storybook) 13 | 14 | Most recent release: https://apache-superset.github.io/superset-ui-plugins-template/ 15 | 16 | Current master: https://superset-ui-plugins-template.netlify.com 17 | 18 | > Note: You have to customize your own netlify to use this. 19 | 20 | ## Packages 21 | 22 | | Package | Version | Note | 23 | | ----------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | 24 | | [@superset-ui/plugin-chart-dummy](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-plugin-chart-dummy) | [![Version](https://img.shields.io/npm/v/@superset-ui/plugin-chart-dummy.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/plugin-chart-dummy.svg?style=flat-square) | | 25 | | [@superset-ui/preset-chart-dummies](https://github.com/apache-superset/superset-ui/tree/master/packages/superset-ui-preset-chart-dummies) | [![Version](https://img.shields.io/npm/v/@superset-ui/preset-chart-dummies.svg?style=flat-square)](https://img.shields.io/npm/v/@superset-ui/preset-chart-dummies.svg?style=flat-square) | | 26 | 27 | ## Contribution and development guide 28 | 29 | Please read the 30 | [contributing guidelines](https://github.com/apache-superset/superset-ui/blob/master/CONTRIBUTING.md) 31 | which include development environment setup and other things you should know about coding in this 32 | repo. 33 | 34 | ### License 35 | 36 | Apache-2.0 37 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@superset-ui/plugins-monorepo", 3 | "version": "0.0.0-master", 4 | "description": "Superset UI Plugins", 5 | "private": true, 6 | "scripts": { 7 | "build": "yarn babel && yarn type && yarn build:assets", 8 | "babel": "yarn babel:cjs && yarn babel:esm", 9 | "babel:cjs": "nimbus babel --clean --workspaces=\"!(@superset-ui/plugins-demo)\"", 10 | "babel:esm": "nimbus babel --clean --workspaces=\"!(@superset-ui/plugins-demo)\" --esm", 11 | "build:assets": "node ./scripts/buildAssets.js", 12 | "clean": "rm -rf ./packages/**/{lib,esm}", 13 | "commit": "superset-commit", 14 | "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", 15 | "format": "yarn prettier --write", 16 | "jest": "NODE_ENV=test nimbus jest --coverage --verbose", 17 | "lint": "nimbus eslint && nimbus prettier --check", 18 | "lint:fix": "nimbus eslint --fix", 19 | "prettier": "nimbus prettier", 20 | "test": "yarn type", 21 | "test:watch": "yarn lint:fix && yarn jest --watch", 22 | "type": "nimbus typescript --build --reference-workspaces", 23 | "prepare-release": "git checkout master && git pull --rebase origin master && lerna bootstrap && yarn install && yarn test", 24 | "prerelease": "yarn build", 25 | "pretest": "yarn lint", 26 | "release": "yarn prepare-release && lerna publish --exact && yarn postrelease", 27 | "postrelease": "lerna run deploy-demo", 28 | "storybook": "cd packages/superset-ui-plugins-demo && yarn storybook" 29 | }, 30 | "repository": "https://github.com/apache-superset/superset-ui-plugins.git", 31 | "keywords": [ 32 | "apache", 33 | "superset", 34 | "data", 35 | "analytics", 36 | "analysis", 37 | "visualization", 38 | "react", 39 | "d3", 40 | "data-ui", 41 | "vx" 42 | ], 43 | "license": "Apache-2.0", 44 | "devDependencies": { 45 | "@airbnb/config-babel": "^2.1.3", 46 | "@airbnb/config-eslint": "^2.1.3", 47 | "@airbnb/config-jest": "^2.1.3", 48 | "@airbnb/config-prettier": "^2.0.4", 49 | "@airbnb/config-typescript": "^2.1.2", 50 | "@airbnb/nimbus": "^2.1.3", 51 | "@superset-ui/commit-config": "^0.0.9", 52 | "@superset-ui/superset-ui": "^0.12.5", 53 | "@types/enzyme": "^3.10.3", 54 | "@types/jest": "^25.1.1", 55 | "@types/jsdom": "^12.2.4", 56 | "@types/react": "^16.9.0", 57 | "@types/react-test-renderer": "^16.9.0", 58 | "csstype": "^2.6.3", 59 | "enzyme": "^3.10.0", 60 | "enzyme-adapter-react-16": "^1.15.1", 61 | "enzyme-to-json": "^3.4.3", 62 | "fast-glob": "^3.0.1", 63 | "fs-extra": "^8.0.1", 64 | "husky": "^3.0.1", 65 | "jest-mock-console": "^1.0.0", 66 | "lerna": "^3.15.0", 67 | "lint-staged": "^9.2.5", 68 | "react-test-renderer": "^16.9.0", 69 | "react-dom": "^16.9.0", 70 | "react": "^16.9.0" 71 | }, 72 | "engines": { 73 | "node": ">=10.10.0", 74 | "npm": ">=6.8.0", 75 | "yarn": ">=1.13.0" 76 | }, 77 | "workspaces": [ 78 | "./packages/*" 79 | ], 80 | "browserslist": [ 81 | "last 3 chrome versions", 82 | "last 3 firefox versions", 83 | "last 3 safari versions", 84 | "last 3 edge versions" 85 | ], 86 | "nimbus": { 87 | "drivers": [ 88 | "babel", 89 | "eslint", 90 | "jest", 91 | "prettier", 92 | "typescript" 93 | ], 94 | "settings": { 95 | "library": true, 96 | "react": true, 97 | "next": true, 98 | "env": { 99 | "targets": false 100 | } 101 | }, 102 | "jest": { 103 | "timers": "real", 104 | "setupFilesAfterEnv": [ 105 | "@airbnb/config-jest/enzyme" 106 | ], 107 | "coverageThreshold": { 108 | "global": { 109 | "branches": 0, 110 | "functions": 0, 111 | "lines": 0, 112 | "statements": 0 113 | } 114 | } 115 | }, 116 | "eslint": { 117 | "overrides": [ 118 | { 119 | "files": "*.{js,jsx,ts,tsx}", 120 | "rules": { 121 | "react/jsx-no-literals": "off", 122 | "prefer-exponentiation-operator": "off", 123 | "@typescript-eslint/no-explicit-any": ["warn", { "fixToUnknown": false }] 124 | } 125 | } 126 | ] 127 | }, 128 | "typescript": { 129 | "compilerOptions": { 130 | "emitDeclarationOnly": true 131 | } 132 | } 133 | }, 134 | "husky": { 135 | "hooks": { 136 | "pre-commit": "lint-staged", 137 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS" 138 | } 139 | }, 140 | "lint-staged": { 141 | "./packages/*/{src,test,storybook}/**/*.{js,jsx,ts,tsx,json,md}": [ 142 | "yarn prettier --write", 143 | "git add" 144 | ] 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. --------------------------------------------------------------------------------