diff --git a/.babelrc b/.babelrc deleted file mode 100644 index ec6da7006b9..00000000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["./packages/patternfly-3/.babelrc.js"] -} diff --git a/.circleci/conditional_upload.sh b/.circleci/conditional_upload.sh deleted file mode 100755 index 605ff0fd5d2..00000000000 --- a/.circleci/conditional_upload.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -# The situation occasionally arises where our docs build successfully, -# but due to caching and other unopportune CI events the files aren't -# actually there. So make sure they're there before uploading. -if [ -z "$(ls -A .public/patternfly-3 2>/dev/null)" ] -then - echo "Missing PF3 docs, skipping upload" - exit 1 -fi -if [ -z "$(ls -A .public/patternfly-4 2>/dev/null)" ] -then - echo "Missing PF4 docs, skipping upload" - exit 1 -fi - -if yarn run surge --project .public --domain patternfly-react.surge.sh -then - # Sends a POST request to Travis that triggers browser tests from here: - # https://github.com/quarckster/widgetastic.patternfly4/tree/master/testing - curl -s -X POST \ - -H "Content-Type: application/json" \ - -H "Accept: application/json" \ - -H "Travis-API-Version: 3" \ - -H "Authorization: token $QUARCKSTER_TOKEN" \ - -d '{"request": {"branch": "master"}}' \ - https://api.travis-ci.org/repo/quarckster%2Fwidgetastic.patternfly4/requests -fi \ No newline at end of file diff --git a/.circleci/config.yml b/.circleci/config.yml index 9402853315c..b97cb9d4b80 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,47 +1,226 @@ version: 2 + +# Adapted from https://github.com/circleci/circleci-docs/blob/master/.circleci/config.yml +# I'd love to find docs on this syntax. +references: + js_deps_paths: &js_deps_paths + - node_modules/ + - packages/patternfly-3/patternfly-react-extensions/node_modules/ + - packages/patternfly-3/patternfly-react-wooden-tree/node_modules/ + - packages/patternfly-3/patternfly-react/node_modules/ + - packages/patternfly-3/react-console/node_modules/ + - packages/patternfly-4/react-charts/node_modules/ + - packages/patternfly-4/react-core/node_modules/ + - packages/patternfly-4/react-docs/node_modules/ + - packages/patternfly-4/react-docs/plugins/gatsby-transformer-react-docgen-typescript/node_modules/ + - packages/patternfly-4/react-inline-edit-extension/node_modules/ + - packages/patternfly-4/react-integration/demo-app-ts/node_modules/ + - packages/patternfly-4/react-integration/node_modules/ + - packages/patternfly-4/react-styled-system/node_modules/ + - packages/patternfly-4/react-styles/node_modules/ + - packages/patternfly-4/react-table/node_modules/ + - packages/patternfly-4/react-tokens/node_modules/ + - packages/patternfly-4/react-topology/node_modules/ + - packages/patternfly-4/react-virtualized-extension/node_modules/ + - packages/react-codemods/node_modules/ + - packages/react-icons/node_modules/ + build_cache_paths: &build_cache_paths + - .cache/ + - packages/patternfly-3/patternfly-react-extensions/dist/ + - packages/patternfly-3/patternfly-react-wooden-tree/dist/ + - packages/patternfly-3/patternfly-react/dist/ + - packages/patternfly-3/react-console/dist/ + - packages/patternfly-4/react-charts/dist/ + - packages/patternfly-4/react-core/dist/ + - packages/patternfly-4/react-inline-edit-extension/dist/ + - packages/patternfly-4/react-styled-system/dist/ + - packages/patternfly-4/react-styles/css/ + - packages/patternfly-4/react-styles/dist/ + - packages/patternfly-4/react-table/dist/ + - packages/patternfly-4/react-tokens/dist/ + - packages/patternfly-4/react-topology/dist/ + - packages/patternfly-4/react-virtualized-extension/dist/ + - packages/react-icons/dist/ + js_deps_cache_key: &js_deps_cache_key + js-deps-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}} + build_cache_key: &build_cache_key + build-cache-v{{.Environment.CACHE_VERSION}}-{{checksum "yarn.lock"}} + attach_workspace: &attach_workspace + attach_workspace: + at: ~/project + +workflows: + version: 2 + build_test_deploy: + jobs: + - build + - build_pf4_docs: + requires: + - build + - build_pf3_docs: + requires: + - build + - test_jest_pf4: + requires: + - build + - test_jest_other: + requires: + - build + - build_integration: + requires: + - build + - lint: + requires: + - build + - upload_docs: + requires: + - build_pf3_docs + - build_pf4_docs + - deploy_prerelease: + requires: + - test_jest_pf4 + - test_jest_other + - build_pf3_docs + - build_pf4_docs + filters: + branches: + only: master jobs: build: - branches: - ignore: - - master - docker: - - image: circleci/node:8.15 - working_directory: ~/repo - steps: - - checkout - # Download and cache dependencies - - restore_cache: - keys: - - v{{ .Environment.CACHE_VERSION }}-deps-{{ .Branch }}-{{ checksum "yarn.lock" }} - - run: - name: Conditional install - command: if [ ! -d node_modules ]; then yarn install --frozen-lockfile; fi - - save_cache: - paths: - - node_modules - - packages/react-icons/node_modules - - packages/patternfly-4/react-core/node_modules - - packages/patternfly-4/react-docs/node_modules - - packages/patternfly-4/react-charts/node_modules - - packages/patternfly-4/react-styles/node_modules - - packages/patternfly-3/patternfly-react/node_modules - - .cache # Incremental builds - key: v{{ .Environment.CACHE_VERSION }}-deps-{{ .Branch }}-{{ checksum "yarn.lock" }} - - run: - name: Build Dist - command: yarn build - - run: - name: (PF3) Build Storybook - command: | - yarn build:storybook && - cp -r .out .public/patternfly-3 - - run: - name: (PF4) Build Docs - command: | - yarn build:docs && - cp -r packages/patternfly-4/react-docs/public .public/patternfly-4 && - cp -r .public/patternfly-4/assets .public/assets && - cp .public/patternfly-4/favicon* .public - - run: - name: Deploy Docs - command: if [ -n "$CIRCLE_PULL_REQUEST" ]; then .circleci/upload_preview.sh; fi + docker: + - image: circleci/node:8.15 + steps: + - checkout + - persist_to_workspace: + root: ~/project + paths: + - "*" + - restore_cache: + keys: + - *js_deps_cache_key + - run: + name: Conditional install + command: if [ ! -d node_modules ]; then yarn install --frozen-lockfile; fi + - save_cache: + paths: *js_deps_paths + key: *js_deps_cache_key + - restore_cache: + keys: + - *build_cache_key + - run: + name: Build Dist + command: yarn build + - save_cache: + paths: *build_cache_paths + key: *build_cache_key + - persist_to_workspace: + root: ~/project + paths: *build_cache_paths + test_jest_pf4: + docker: + - image: circleci/node:8.15 + steps: + - *attach_workspace + - restore_cache: + keys: + - *js_deps_cache_key + - run: + name: PF4 Jest Tests + command: yarn test:pf4 --maxWorkers=2 + test_jest_other: + docker: + - image: circleci/node:8.15 + steps: + - *attach_workspace + - restore_cache: + keys: + - *js_deps_cache_key + - run: + name: PF3 Jest Tests + command: yarn test:pf3 --maxWorkers=2 + - run: + name: Other Tests + command: yarn test:misc --maxWorkers=2 + build_integration: + docker: + - image: circleci/node:8.15 + steps: + - *attach_workspace + - restore_cache: + keys: + - *js_deps_cache_key + - run: + name: Build Cypress Integration Tests + command: yarn build:integration + lint: + docker: + - image: circleci/node:8.15 + steps: + - *attach_workspace + - restore_cache: + keys: + - *js_deps_cache_key + - run: + name: TSLint + command: yarn lint:ts + - run: + name: ESLint + command: yarn lint:js + - run: + name: "@patternfly/patternfly Versions Match" + command: yarn lint:versions + - run: + name: StyleLint + command: yarn lint:style + build_pf3_docs: + docker: + - image: circleci/node:8.15 + steps: + - *attach_workspace + - restore_cache: + keys: + - *js_deps_cache_key + - run: + name: Build PF3 Storybook Static Site + command: yarn build:storybook + - persist_to_workspace: + root: ~/project + paths: + - .out/ + build_pf4_docs: + docker: + - image: circleci/node:8.15 + steps: + - *attach_workspace + - restore_cache: + keys: + - *js_deps_cache_key + - run: + name: Build PF4 Gatsby Static Site + command: yarn build:docs + - persist_to_workspace: + root: ~/project + paths: + - packages/patternfly-4/react-docs/public/ + upload_docs: + docker: + - image: circleci/node:8.15 + steps: + - *attach_workspace + - run: + name: Build docs Folder + command: .circleci/copy-docs.sh + - run: + name: Upload docs to surge.sh + command: .circleci/upload-docs.sh + deploy_prerelease: + docker: + - image: circleci/node:8.15 + steps: + - *attach_workspace + - run: + name: Avoid hosts unknown for github + command: mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config + - run: + name: Deploy to NPM and Github + command: .circleci/release.sh diff --git a/.circleci/copy-docs.sh b/.circleci/copy-docs.sh new file mode 100755 index 00000000000..c21adf585ee --- /dev/null +++ b/.circleci/copy-docs.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Build the docs/ folder from pf3 and pf4 docs +mkdir -p docs +cp -r .out docs/patternfly-3 +cp -r packages/patternfly-4/react-docs/public docs/patternfly-4 +cp .circleci/index.html docs/index.html +# These need to be at the root for CSS variables +cp -r docs/patternfly-4/assets docs/assets +# Use newer favicon +cp docs/patternfly-4/favicon* docs diff --git a/.public/index.html b/.circleci/index.html similarity index 100% rename from .public/index.html rename to .circleci/index.html diff --git a/.circleci/release.sh b/.circleci/release.sh index 473a7ae4392..2842ac0b28a 100755 --- a/.circleci/release.sh +++ b/.circleci/release.sh @@ -1,39 +1,16 @@ #!/bin/bash -# Note: do not do set -x or the passwords will leak! -set -e +GIT_USERNAME="patternfly-build" +REPO="github.com:${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git" echo "Preparing release environment..." git config --global user.email "patternfly-build@redhat.com" -git config --global user.name "patternfly-build" +git config --global user.name ${GIT_USERNAME} git config credential.helper store - -echo "https://${GH_USERNAME}:${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" > ~/.git-credentials +echo "https://${GIT_USERNAME}:${GH_TOKEN}@${REPO}" > ~/.git-credentials echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc echo "Doing a release..." # Lerna is complicated. Commands: https://github.com/lerna/lerna/tree/master/commands -git checkout $TRAVIS_BRANCH # Lerna can't have a detached HEAD -git rev-parse HEAD - # Identify packages that have been updated since the previous tagged release # Update their versions and changelogs -npx lerna version --conventional-commits --no-git-tag-version --no-commit-hooks --no-push --yes - -# Amend the commit to avoid lerna ERR! EUNCOMMIT -git add **/package.json **/CHANGELOG.md -git commit --amend --no-edit --no-verify - -# Check each package.json and determine if any package version is not present in the registry; -# any versions not present in the registry will be published -if npx lerna publish from-package --no-git-tag-version --no-push --yes ; then - # Undo that last amended commit locally, because we don't actually want to push it - git reset --hard $TRAVIS_COMMIT - # Now only if it publishes should we also push this commit to Github and do a Github release - if ! npx lerna version --conventional-commits --github-release --no-commit-hooks --yes ; then - echo "Something went wrong committing or making a Github release." - exit 0 # Publishing to the registry is what matters... - fi -else # Failed to publish to npm - echo "Failed to publish to npm :(" - exit 1 -fi \ No newline at end of file +npx lerna publish --conventional-commits --create-release=github --yes diff --git a/.circleci/upload-docs.sh b/.circleci/upload-docs.sh new file mode 100755 index 00000000000..939d2684c64 --- /dev/null +++ b/.circleci/upload-docs.sh @@ -0,0 +1,31 @@ +#!/bin/bash +USERNAME=${CIRCLE_PROJECT_USERNAME} +REPONAME=${CIRCLE_PROJECT_REPONAME} + +if [ -n "${CIRCLE_PULL_REQUEST}" ] # If build is a PR +then + # Split on "/" to get last part of URL, ref: http://stackoverflow.com/a/5257398/689223 + URL_SPLIT=(${CIRCLE_PULL_REQUEST//\// }) + PR_NUM=$(printf %s\\n "${URL_SPLIT[@]:(-1)}") + # Domain names follow the RFC1123 spec [a-Z] [0-9] [-] limited to 253 characters + # https://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax + # So, just replace "/" or "." with "-" + DEPLOY_SUBDOMAIN=`echo "${REPONAME}-pr-$PR_NUM" | tr '[\/|\.]' '-' | cut -c1-253` + ALREADY_DEPLOYED=`npx surge list | grep ${DEPLOY_SUBDOMAIN}` +else + DEPLOY_SUBDOMAIN=${REPONAME} +fi + +DEPLOY_DOMAIN="https://${DEPLOY_SUBDOMAIN}.surge.sh" +npx surge --project docs --domain $DEPLOY_DOMAIN; + +if [ -n "${CIRCLE_PULL_REQUEST}" ] && [ -z "${ALREADY_DEPLOYED}" ] # Leave a Github comment +then + # Use Issues api instead of PR api because + # PR api requires comments be made on specific files of specific commits + GITHUB_PR_COMMENTS="https://api.github.com/repos/${USERNAME}/${REPONAME}/issues/${PR_NUM}/comments" + echo "Adding github PR comment ${GITHUB_PR_COMMENTS}" + curl -H "Authorization: token ${GH_PR_TOKEN}" --request POST ${GITHUB_PR_COMMENTS} --data '{"body":"PatternFly-React preview: '${DEPLOY_DOMAIN}'"}' +else + echo "Already deployed ${DEPLOY_DOMAIN}" +fi \ No newline at end of file diff --git a/.circleci/upload_preview.sh b/.circleci/upload_preview.sh deleted file mode 100755 index 005cb6e9d20..00000000000 --- a/.circleci/upload_preview.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# Split on "/" to get last part of URL, ref: http://stackoverflow.com/a/5257398/689223 -URL_SPLIT=(${CIRCLE_PULL_REQUEST//\// }) -PR_NUM=$(printf %s\\n "${URL_SPLIT[@]:(-1)}") -# Domain names follow the RFC1123 spec [a-Z] [0-9] [-] limited to 253 characters -# https://en.wikipedia.org/wiki/Domain_Name_System#Domain_name_syntax -# So, just replace "/" or "." with "-" -DEPLOY_SUBDOMAIN=`echo "$PR_NUM-pr-${CIRCLE_PROJECT_REPONAME}-${CIRCLE_PROJECT_USERNAME}" | tr '[\/|\.]' '-' | cut -c1-253` -DEPLOY_DOMAIN="https://${DEPLOY_SUBDOMAIN}.surge.sh" -ALREADY_DEPLOYED=`yarn run surge list | grep ${DEPLOY_SUBDOMAIN}` - -yarn run surge --project .public --domain $DEPLOY_DOMAIN; - -if [ -z "$ALREADY_DEPLOYED" ] -then - # Using the Issues api instead of the PR api - # Done so because every PR is an issue, and the issues api allows to post general comments, - # while the PR api requires that comments are made to specific files and specific commits - GITHUB_PR_COMMENTS="https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/issues/${PR_NUM}/comments" - echo "Adding github PR comment ${GITHUB_PR_COMMENTS}" - curl -H "Authorization: token ${GH_PR_TOKEN}" --request POST ${GITHUB_PR_COMMENTS} --data '{"body":"PatternFly-React preview: '${DEPLOY_DOMAIN}'"}' -else - echo "Already deployed ${DEPLOY_DOMAIN}" -fi \ No newline at end of file diff --git a/.gitignore b/.gitignore index ed26ae50fd8..2d7b16dfe96 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,8 @@ lerna-debug.log .vscode # For prettier !.vscode/settings.json +# For vim +*.swp # Deploy directory -.public -!.public/index.html +docs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b8a1b836cde..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,106 +0,0 @@ -dist: xenial -language: node_js -node_js: - - "8" # Also included in .nvmrc, but this saves a few seconds -cache: - yarn: false - directories: - - node_modules # God help us... - - packages/react-icons/node_modules/ - - packages/patternfly-4/react-core/node_modules - - packages/patternfly-4/react-docs/node_modules - - packages/patternfly-4/react-docs/plugins/gatsby-transformer-react-docgen-typescript/node_modules - - packages/patternfly-4/react-docs/plugins/gatsby-transformer-react-examples/node_modules - - packages/patternfly-4/react-charts/node_modules - - packages/patternfly-4/react-styles/node_modules - - packages/patternfly-3/patternfly-react/node_modules - - packages/patternfly-4/react-integration/node_modules - - packages/patternfly-4/react-integration/demo-app-ts/node_modules - - packages/react-icons/dist - - packages/react-icons/src/icons - - packages/react-icons/src/index.d.ts - - packages/react-icons/src/index.js - - packages/patternfly-3/patternfly-react-extensions/dist - - packages/patternfly-3/patternfly-react/dist - - packages/patternfly-3/react-console/dist - - packages/patternfly-4/react-charts/dist - - packages/patternfly-4/react-core/dist - - packages/patternfly-4/react-styled-system/dist - - packages/patternfly-4/react-styles/dist - - packages/patternfly-4/react-styles/css - - packages/patternfly-4/react-table/dist - - packages/patternfly-4/react-tokens/dist - - packages/patternfly-4/react-inline-edit-extension/dist - - packages/patternfly-4/react-integration/demo-app-ts/build - - packages/patternfly-4/react-virtualized-extension/dist - - packages/patternfly-4/react-topology/dist - - packages/patternfly-4/react-docs/public # To cache PF4 docs - - .cache # For incremental builds -git: - depth: 10 -branches: - except: - - "/^chore/bump-.*$/" # Avoid hookbot double-builds -notifications: - email: false - -stages: - - Build - - Test - - name: Deploy - if: branch = master && type != pull_request && fork = false - -install: - - yarn install --frozen-lockfile -jobs: - include: - - stage: Build - name: Build Dist - script: - - yarn build - - - stage: Test # Nothing can be cached in this stage since steps run in parallel. - name: (PF4) Jest Tests - install: skip - script: - - ls packages/patternfly-4/react-styles - - yarn test:pf4 - - npx codecov -F patternfly4 - - name: (PF3 and Misc) Jest Tests - install: skip - script: - - yarn test:pf3 - - npx codecov -F patternfly3 - - rm -rf coverage - - yarn test:misc - - npx codecov -F patternflymisc - - name: Integration test - install: skip - script: - - yarn build:integration - - name: (PF4) Build Docs - if: branch = master && type != pull_request && fork = false - install: skip - script: - - yarn build:docs - - name: TSLint, ESLint, and Stylelint - install: skip - script: - - yarn lint:ts - - yarn lint:js - - yarn lint:versions - - yarn lint:style - - - stage: Deploy - name: NPM and Github Release - install: skip - script: .circleci/release.sh - - name: (PF3) Build Storybook and Deploy Docs - install: skip - script: - - yarn build:storybook - - mv .out .public/patternfly-3 - - mv packages/patternfly-4/react-docs/public .public/patternfly-4 - - cp .public/patternfly-4/favicon* .public - - cp -r .public/patternfly-4/assets .public/assets - - .circleci/conditional_upload.sh diff --git a/README.md b/README.md index 3c082a574d2..f8fea3c2d86 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # patternfly-react [![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lernajs.io/) -[![Build Status](https://travis-ci.org/patternfly/patternfly-react.svg?branch=master)](https://travis-ci.org/patternfly/patternfly-react) +[![CircleCI](https://circleci.com/gh/patternfly/patternfly-react.svg?style=svg)](https://circleci.com/gh/patternfly/patternfly-react) [![npm version](https://badge.fury.io/js/patternfly-react.svg)](https://badge.fury.io/js/patternfly-react) [![codecov](https://codecov.io/gh/patternfly/patternfly-react/branch/master/graph/badge.svg)](https://codecov.io/gh/patternfly/patternfly-react) [![Selenium Tests](https://travis-ci.org/quarckster/widgetastic.patternfly4.svg?branch=master)](https://travis-ci.org/quarckster/widgetastic.patternfly4) diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 00000000000..429a1720c05 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,4 @@ +module.exports = { + extends: './packages/patternfly-4/.babelrc', + presets: [['@babel/env', {'modules': 'commonjs'}], '@babel/react'], +} \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index a5d66cd9119..2b770f22737 100644 --- a/jest.config.js +++ b/jest.config.js @@ -26,7 +26,7 @@ module.exports = { "/packages/patternfly-4/react-core/scripts/snapshot-serializer" ], transform: { - '^.+\\.(ts|tsx)?$': 'ts-jest', + '^.+\\.(ts|tsx?)$': 'ts-jest', '^.+\\.jsx?$': 'babel-jest', '\\.(css)$': '/packages/patternfly-4/react-styles/jest-transform.js' }, diff --git a/package.json b/package.json index bca7d01f9c2..475780604be 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,13 @@ }, "homepage": "https://github.com/patternfly/patternfly-react#readme", "devDependencies": { + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/plugin-proposal-class-properties": "^7.0.0", + "@babel/plugin-proposal-object-rest-spread": "^7.0.0", + "@babel/plugin-transform-typescript": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "@babel/preset-react": "^7.0.0", "@storybook/addon-actions": "^v3.4.11", "@storybook/addon-info": "^v3.4.11", "@storybook/addon-knobs": "^v3.4.11", @@ -33,17 +40,7 @@ "@storybook/addons": "^3.3.0", "@storybook/react": "^v3.4.11", "@storybook/storybook-deployer": "^2.1.0", - "babel-cli": "^6.26.0", - "babel-core": "^6.26.0", - "babel-eslint": "^9.0.0", - "babel-jest": "^23.6.0", - "babel-plugin-transform-class-properties": "^6.24.1", - "babel-plugin-transform-export-extensions": "^6.22.0", - "babel-plugin-transform-imports": "^1.5.0", - "babel-plugin-transform-object-assign": "^6.22.0", - "babel-plugin-transform-object-rest-spread": "^6.26.0", - "babel-preset-env": "^1.6.1", - "babel-preset-react": "^6.24.1", + "babel-plugin-typescript-to-proptypes": "^0.17.1", "change-case": "^3.0.2", "codecov": "^3.2.0", "commitizen": "^3.0.7", diff --git a/packages/patternfly-3/patternfly-react-extensions/CHANGELOG.md b/packages/patternfly-3/patternfly-react-extensions/CHANGELOG.md index ea538d1eebe..ebb878e75cc 100644 --- a/packages/patternfly-3/patternfly-react-extensions/CHANGELOG.md +++ b/packages/patternfly-3/patternfly-react-extensions/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.19.2](https://github.com/patternfly/patternfly-react/compare/patternfly-react-extensions@2.19.1...patternfly-react-extensions@2.19.2) (2019-06-19) + +**Note:** Version bump only for package patternfly-react-extensions + + + + + +## 2.19.1 (2019-06-10) + +**Note:** Version bump only for package patternfly-react-extensions + + + + + # 2.19.0 (2019-06-05) diff --git a/packages/patternfly-3/patternfly-react-extensions/package.json b/packages/patternfly-3/patternfly-react-extensions/package.json index 0f8c520631a..1e71374f7de 100644 --- a/packages/patternfly-3/patternfly-react-extensions/package.json +++ b/packages/patternfly-3/patternfly-react-extensions/package.json @@ -1,6 +1,6 @@ { "name": "patternfly-react-extensions", - "version": "2.19.0", + "version": "2.19.2", "private": false, "description": "This library provides an extended set of React components for use with the PatternFly reference implementation.", "main": "dist/js/index.js", @@ -42,7 +42,7 @@ "classnames": "^2.2.5", "css-element-queries": "^1.0.1", "patternfly": "^3.58.0", - "patternfly-react": "^2.36.0", + "patternfly-react": "^2.36.2", "react-bootstrap": "^0.32.1", "react-click-outside": "^3.0.1", "react-diff-view": "^1.8.1", @@ -51,6 +51,17 @@ "unidiff": "^1.0.1" }, "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.0", + "babel-eslint": "^9.0.0", + "babel-jest": "^23.6.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-plugin-transform-imports": "^1.5.0", + "babel-plugin-transform-object-assign": "^6.22.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.6.1", + "babel-preset-react": "^6.24.1", "rimraf": "^2.6.2", "shx": "^0.3.2" }, diff --git a/packages/patternfly-3/patternfly-react-wooden-tree/CHANGELOG.md b/packages/patternfly-3/patternfly-react-wooden-tree/CHANGELOG.md index 53f612ca02b..dbdb650c84c 100644 --- a/packages/patternfly-3/patternfly-react-wooden-tree/CHANGELOG.md +++ b/packages/patternfly-3/patternfly-react-wooden-tree/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## 2.0.1 (2019-06-10) + +**Note:** Version bump only for package patternfly-react-wooden-tree + + + + + # 2.0.0 (2019-06-05) diff --git a/packages/patternfly-3/patternfly-react-wooden-tree/package.json b/packages/patternfly-3/patternfly-react-wooden-tree/package.json index f4db1ceb26a..9a6227dcfa5 100644 --- a/packages/patternfly-3/patternfly-react-wooden-tree/package.json +++ b/packages/patternfly-3/patternfly-react-wooden-tree/package.json @@ -1,6 +1,6 @@ { "name": "patternfly-react-wooden-tree", - "version": "2.0.0", + "version": "2.0.1", "description": "Reexport react-wooden-tree with Patternfly design.", "main": "dist/js/index.js", "module": "dist/esm/index.js", @@ -33,6 +33,19 @@ "dependencies": { "react-wooden-tree": "^2.0.1" }, + "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.0", + "babel-eslint": "^9.0.0", + "babel-jest": "^23.6.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-plugin-transform-imports": "^1.5.0", + "babel-plugin-transform-object-assign": "^6.22.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.6.1", + "babel-preset-react": "^6.24.1" + }, "peerDependencies": { "prop-types": "^15.6.1", "react": "^16.3.2", diff --git a/packages/patternfly-3/patternfly-react/CHANGELOG.md b/packages/patternfly-3/patternfly-react/CHANGELOG.md index c480e4b7744..1a2b6019dec 100644 --- a/packages/patternfly-3/patternfly-react/CHANGELOG.md +++ b/packages/patternfly-3/patternfly-react/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.36.2](https://github.com/patternfly/patternfly-react/compare/patternfly-react@2.36.1...patternfly-react@2.36.2) (2019-06-19) + +**Note:** Version bump only for package patternfly-react + + + + + +## 2.36.1 (2019-06-10) + +**Note:** Version bump only for package patternfly-react + + + + + # 2.36.0 (2019-06-05) diff --git a/packages/patternfly-3/patternfly-react/package.json b/packages/patternfly-3/patternfly-react/package.json index a566382c20e..96b2a7beeff 100644 --- a/packages/patternfly-3/patternfly-react/package.json +++ b/packages/patternfly-3/patternfly-react/package.json @@ -1,6 +1,6 @@ { "name": "patternfly-react", - "version": "2.36.0", + "version": "2.36.2", "private": false, "description": "This library provides a set of common React components for use with the PatternFly reference implementation.", "main": "dist/js/index.js", @@ -68,6 +68,17 @@ "clean": "rimraf dist" }, "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.0", + "babel-eslint": "^9.0.0", + "babel-jest": "^23.6.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-plugin-transform-imports": "^1.5.0", + "babel-plugin-transform-object-assign": "^6.22.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.6.1", + "babel-preset-react": "^6.24.1", "clean-css-cli": "^4.2.1", "react-axe": "^3.0.2", "rimraf": "^2.6.2", diff --git a/packages/patternfly-3/patternfly-react/src/components/Cards/Card.js b/packages/patternfly-3/patternfly-react/src/components/Cards/Card.js index b1144b2adfe..1aa2c55d1c4 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Cards/Card.js +++ b/packages/patternfly-3/patternfly-react/src/components/Cards/Card.js @@ -2,25 +2,6 @@ import classNames from 'classnames'; import React from 'react'; import PropTypes from 'prop-types'; -import CardTitle from './CardTitle'; -import CardBody from './CardBody'; -import CardHeading from './CardHeading'; -import CardFooter from './CardFooter'; -import CardLink from './CardLink'; -import CardGrid from './CardGrid'; -import CardDropdownButton from './CardDropdownButton'; -import CardHeightMatching from './CardHeightMatching'; -import { - UtilizationCard, - UtilizationCardDetails, - UtilizationCardDetailsCount, - UtilizationCardDetailsDesc, - UtilizationCardDetailsLine1, - UtilizationCardDetailsLine2 -} from './UtilizationTrendCard'; - -import { AggregateStatusCount, AggregateStatusNotifications, AggregateStatusNotification } from './AggregateStatusCard'; - /** * Card Component for PatternFly React */ @@ -69,22 +50,4 @@ Card.defaultProps = { cardRef: null }; -Card.Title = CardTitle; -Card.Body = CardBody; -Card.Heading = CardHeading; -Card.Footer = CardFooter; -Card.Link = CardLink; -Card.Grid = CardGrid; -Card.DropdownButton = CardDropdownButton; -Card.HeightMatching = CardHeightMatching; -Card.UtilizationCard = UtilizationCard; -Card.UtilizationCardDetails = UtilizationCardDetails; -Card.UtilizationCardDetailsCount = UtilizationCardDetailsCount; -Card.UtilizationCardDetailsDesc = UtilizationCardDetailsDesc; -Card.UtilizationCardDetailsLine1 = UtilizationCardDetailsLine1; -Card.UtilizationCardDetailsLine2 = UtilizationCardDetailsLine2; -Card.AggregateStatusCount = AggregateStatusCount; -Card.AggregateStatusNotifications = AggregateStatusNotifications; -Card.AggregateStatusNotification = AggregateStatusNotification; - export default Card; diff --git a/packages/patternfly-3/patternfly-react/src/components/Cards/UtilizationTrendCard/UtilizationCard.js b/packages/patternfly-3/patternfly-react/src/components/Cards/UtilizationTrendCard/UtilizationCard.js index 8e1787d2d3a..0b589f4e73c 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Cards/UtilizationTrendCard/UtilizationCard.js +++ b/packages/patternfly-3/patternfly-react/src/components/Cards/UtilizationTrendCard/UtilizationCard.js @@ -1,7 +1,7 @@ import classNames from 'classnames'; import React from 'react'; import PropTypes from 'prop-types'; -import { Card } from '../index'; +import Card from '../Card'; const UtilizationCard = ({ children, className, ...props }) => { const classes = classNames('card-pf-utilization', className); diff --git a/packages/patternfly-3/patternfly-react/src/components/Cards/index.js b/packages/patternfly-3/patternfly-react/src/components/Cards/index.js index 64d2530f843..5252339c44c 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Cards/index.js +++ b/packages/patternfly-3/patternfly-react/src/components/Cards/index.js @@ -17,6 +17,24 @@ import { UtilizationCardDetailsLine2 } from './UtilizationTrendCard'; +Card.Title = CardTitle; +Card.Body = CardBody; +Card.Heading = CardHeading; +Card.Footer = CardFooter; +Card.Link = CardLink; +Card.Grid = CardGrid; +Card.DropdownButton = CardDropdownButton; +Card.HeightMatching = CardHeightMatching; +Card.UtilizationCard = UtilizationCard; +Card.UtilizationCardDetails = UtilizationCardDetails; +Card.UtilizationCardDetailsCount = UtilizationCardDetailsCount; +Card.UtilizationCardDetailsDesc = UtilizationCardDetailsDesc; +Card.UtilizationCardDetailsLine1 = UtilizationCardDetailsLine1; +Card.UtilizationCardDetailsLine2 = UtilizationCardDetailsLine2; +Card.AggregateStatusCount = AggregateStatusCount; +Card.AggregateStatusNotifications = AggregateStatusNotifications; +Card.AggregateStatusNotification = AggregateStatusNotification; + export { Card, CardTitle, diff --git a/packages/patternfly-3/patternfly-react/src/components/Form/Form.stories.js b/packages/patternfly-3/patternfly-react/src/components/Form/Form.stories.js index 89621e9d24c..1a94acb5425 100644 --- a/packages/patternfly-3/patternfly-react/src/components/Form/Form.stories.js +++ b/packages/patternfly-3/patternfly-react/src/components/Form/Form.stories.js @@ -2,15 +2,12 @@ import React from 'react'; import { storiesOf } from '@storybook/react'; -import { action } from '@storybook/addon-actions'; import { withKnobs, boolean } from '@storybook/addon-knobs'; import { withInfo } from '@storybook/addon-info'; import { inlineTemplate } from 'storybook/decorators/storyTemplates'; import { storybookPackageName, DOCUMENTATION_URL, STORYBOOK_CATEGORY } from 'storybook/constants/siteConstants'; -import { Icon } from '../Icon'; import { Col, Row, Grid } from '../Grid'; import { Button } from '../Button'; -import { Modal } from '../Modal'; import { Form, FormGroup, FormControl, ControlLabel } from './index'; import { FormExample, FormExampleSource } from './Stories/FormExample'; @@ -21,6 +18,7 @@ import { InputGroupsFormFields, getInputGroupsFormKnobs } from './Stories/InputG import { InlineFormField } from './Stories/InlineFormField'; import { HorizontalFormField } from './Stories/HorizontalFormField'; import { VerticalFormField } from './Stories/VerticalFormField'; +import { ModalForm } from './Stories/ModalForm'; import { name } from '../../../package.json'; const stories = storiesOf(`${storybookPackageName(name)}/${STORYBOOK_CATEGORY.FORMS_AND_CONTROLS}/Forms`, module); @@ -219,7 +217,6 @@ exampleStories.add( if (bsSize) buttonsProps.bsSize = bsSize; if (disabled) buttonsProps.disabled = disabled; - const showModal = boolean('Show Modal', true); const showLoading = boolean('Show Loading', false); const formFields = BasicFormFields.map(formField => HorizontalFormField({ ...formField, ...formFieldsKnobs })); const formButtons = BasicFormButtons.map(({ text, ...props }) => ( @@ -231,21 +228,12 @@ exampleStories.add(
{[...BasicFormSpinner].reverse()}
); const story = ( - - - - Basic Settings - - -
{formFields}
-
- - {formButtons} - {showLoading && formSpinner} - -
+ ); return inlineTemplate({ diff --git a/packages/patternfly-3/patternfly-react/src/components/Form/Stories/ModalForm.js b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/ModalForm.js new file mode 100644 index 00000000000..68cb3b1f2e8 --- /dev/null +++ b/packages/patternfly-3/patternfly-react/src/components/Form/Stories/ModalForm.js @@ -0,0 +1,55 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { Button } from '../../Button'; +import { Modal } from '../../Modal'; +import { Icon } from '../../Icon'; +import { Form } from '../index'; + +class ModalForm extends React.Component { + constructor() { + super(); + this.state = { showModal: false }; + this.open = this.open.bind(this); + this.close = this.close.bind(this); + } + close() { + this.setState({ showModal: false }); + } + open() { + this.setState({ showModal: true }); + } + render() { + return ( +
+ + + + + + Basic Settings + + +
{this.props.formFields}
+
+ + {this.props.formButtons} + {this.props.showLoading && this.props.formSpinner} + +
+
+ ); + } +} + +ModalForm.propTypes = { + showLoading: PropTypes.bool.isRequired, + formFields: PropTypes.array.isRequired, + formButtons: PropTypes.array.isRequired, + formSpinner: PropTypes.node.isRequired +}; + +export { ModalForm }; diff --git a/packages/patternfly-3/react-console/CHANGELOG.md b/packages/patternfly-3/react-console/CHANGELOG.md index 266b1ae15b1..3ab6e98f69f 100644 --- a/packages/patternfly-3/react-console/CHANGELOG.md +++ b/packages/patternfly-3/react-console/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.11.2](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-console@1.11.1...@patternfly/react-console@1.11.2) (2019-06-19) + +**Note:** Version bump only for package @patternfly/react-console + + + + + +## 1.11.1 (2019-06-10) + +**Note:** Version bump only for package @patternfly/react-console + + + + + # 1.11.0 (2019-06-05) diff --git a/packages/patternfly-3/react-console/package.json b/packages/patternfly-3/react-console/package.json index fdb4d362a1c..bf11693c27d 100644 --- a/packages/patternfly-3/react-console/package.json +++ b/packages/patternfly-3/react-console/package.json @@ -1,6 +1,6 @@ { "name": "@patternfly/react-console", - "version": "1.11.0", + "version": "1.11.2", "private": false, "description": "This library provides a set of Console React components for use with the PatternFly reference implementation.", "main": "dist/js/index.js", @@ -46,8 +46,19 @@ "xterm": "^3.3.0" }, "devDependencies": { + "babel-cli": "^6.26.0", + "babel-core": "^6.26.0", + "babel-eslint": "^9.0.0", + "babel-jest": "^23.6.0", + "babel-plugin-transform-class-properties": "^6.24.1", + "babel-plugin-transform-export-extensions": "^6.22.0", + "babel-plugin-transform-imports": "^1.5.0", + "babel-plugin-transform-object-assign": "^6.22.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", + "babel-preset-env": "^1.6.1", + "babel-preset-react": "^6.24.1", "patternfly": "^3.58.0", - "patternfly-react": "^2.36.0", + "patternfly-react": "^2.36.2", "rimraf": "^2.6.2", "shx": "^0.3.2" }, diff --git a/packages/patternfly-4/.babelrc b/packages/patternfly-4/.babelrc new file mode 100644 index 00000000000..38cc0d3fe51 --- /dev/null +++ b/packages/patternfly-4/.babelrc @@ -0,0 +1,11 @@ +{ + "presets": ["@babel/react"], + "ignore": ["**/__snapshots__", "**/*.d.ts"], + "plugins": [ + "@babel/plugin-transform-typescript", + "babel-plugin-typescript-to-proptypes", + "@babel/plugin-proposal-export-default-from", + "@babel/proposal-class-properties", + "@babel/proposal-object-rest-spread", + ] +} diff --git a/packages/patternfly-4/.babelrc.js b/packages/patternfly-4/.babelrc.js deleted file mode 100644 index 0804442c329..00000000000 --- a/packages/patternfly-4/.babelrc.js +++ /dev/null @@ -1,38 +0,0 @@ -const babelENV = process.env.BABEL_ENV || 'development'; -const modules = babelENV !== 'production:esm' ? 'commonjs' : false; - -module.exports = { - presets: [['env', { modules }], 'react'], - plugins: [ - 'transform-class-properties', - 'transform-export-extensions', - 'transform-object-rest-spread', - 'transform-object-assign', - babelENV !== 'development' && [ - 'transform-imports', - { - '@patternfly/react-icons': { - kebabCase: true, - preventFullImport: true, - transform: importName => { - if (importName.toLowerCase() === 'icon') { - throw new Error('Icon import is not allowed'); - } - const importPath = `icons/${importName}`; - if (!modules) { - return `@patternfly/react-icons/dist/esm/${importPath}`; - } - return `@patternfly/react-icons/dist/js/${importPath}`; - } - } - } - ] - ].filter(Boolean), - ignore: (() => { - const ignore = ['src/**/__snapshots__']; - if (babelENV.includes('production')) { - ignore.push('test.js', '__mocks__'); - } - return ignore; - })() -}; diff --git a/packages/patternfly-4/react-charts/.babelrc b/packages/patternfly-4/react-charts/.babelrc new file mode 100644 index 00000000000..25c4221a16d --- /dev/null +++ b/packages/patternfly-4/react-charts/.babelrc @@ -0,0 +1,3 @@ +{ + "extends": "../.babelrc" +} \ No newline at end of file diff --git a/packages/patternfly-4/react-charts/.babelrc.js b/packages/patternfly-4/react-charts/.babelrc.js deleted file mode 100644 index a59fe297daa..00000000000 --- a/packages/patternfly-4/react-charts/.babelrc.js +++ /dev/null @@ -1,5 +0,0 @@ -const coreConfig = require('../react-core/.babelrc.js'); - -module.exports = { - ...coreConfig -} diff --git a/packages/patternfly-4/react-charts/.npmignore b/packages/patternfly-4/react-charts/.npmignore index eeb8914e39f..5344519a423 100644 --- a/packages/patternfly-4/react-charts/.npmignore +++ b/packages/patternfly-4/react-charts/.npmignore @@ -1,3 +1,6 @@ -src build dist/**/demos +dist/**/examples +dist/**/__snapshots__ +dist/**/*.test.js +dist/**/*.map diff --git a/packages/patternfly-4/react-charts/CHANGELOG.md b/packages/patternfly-4/react-charts/CHANGELOG.md index 02e57a52717..51895be2402 100644 --- a/packages/patternfly-4/react-charts/CHANGELOG.md +++ b/packages/patternfly-4/react-charts/CHANGELOG.md @@ -3,6 +3,130 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [4.3.7](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.3.6...@patternfly/react-charts@4.3.7) (2019-06-18) + +**Note:** Version bump only for package @patternfly/react-charts + + + + + +## [4.3.6](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.3.5...@patternfly/react-charts@4.3.6) (2019-06-18) + +**Note:** Version bump only for package @patternfly/react-charts + + + + + +## [4.3.5](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.3.4...@patternfly/react-charts@4.3.5) (2019-06-18) + +**Note:** Version bump only for package @patternfly/react-charts + + + + + +## [4.3.4](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.3.2...@patternfly/react-charts@4.3.4) (2019-06-18) + + +### Bug Fixes + +* **ChartDonutThreshold:** Don't show static threshold donut tooltips by default. ([#2270](https://github.com/patternfly/patternfly-react/issues/2270)) ([7d9bd16](https://github.com/patternfly/patternfly-react/commit/7d9bd16)) + + + + + +## [4.3.3](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.3.2...@patternfly/react-charts@4.3.3) (2019-06-18) + + +### Bug Fixes + +* **ChartDonutThreshold:** Don't show static threshold donut tooltips by default. ([#2270](https://github.com/patternfly/patternfly-react/issues/2270)) ([7d9bd16](https://github.com/patternfly/patternfly-react/commit/7d9bd16)) + + + + + +## [4.3.2](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.3.1...@patternfly/react-charts@4.3.2) (2019-06-14) + +**Note:** Version bump only for package @patternfly/react-charts + + + + + +## [4.3.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.3.0...@patternfly/react-charts@4.3.1) (2019-06-14) + +**Note:** Version bump only for package @patternfly/react-charts + + + + + +# [4.3.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.2.0...@patternfly/react-charts@4.3.0) (2019-06-13) + + +### Features + +* **build:** add source maps ([#2142](https://github.com/patternfly/patternfly-react/issues/2142)) ([5076c48](https://github.com/patternfly/patternfly-react/commit/5076c48)) + + + + + +# 4.2.0 (2019-06-13) + + +### Bug Fixes + +* **charts:** labels should use the overpass font ([#2232](https://github.com/patternfly/patternfly-react/issues/2232)) ([7b4e100](https://github.com/patternfly/patternfly-react/commit/7b4e100)) + + +### Features + +* **react-core:** allow dynamic rendering of anchor components ([#2117](https://github.com/patternfly/patternfly-react/issues/2117)) ([c1c3be9](https://github.com/patternfly/patternfly-react/commit/c1c3be9)) + + + + + +## [4.1.5](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.1.4...@patternfly/react-charts@4.1.5) (2019-06-11) + +**Note:** Version bump only for package @patternfly/react-charts + + + + + +## [4.1.4](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.1.3...@patternfly/react-charts@4.1.4) (2019-06-10) + +**Note:** Version bump only for package @patternfly/react-charts + + + + + +## [4.1.3](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.1.2...@patternfly/react-charts@4.1.3) (2019-06-10) + +**Note:** Version bump only for package @patternfly/react-charts + + + + + +## 4.1.2 (2019-06-10) + + +### Bug Fixes + +* **charts:** align label vertically and add donutHeight/Width defaults ([#2193](https://github.com/patternfly/patternfly-react/issues/2193)) ([59aadfc](https://github.com/patternfly/patternfly-react/commit/59aadfc)) + + + + + ## [4.1.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-charts@4.1.0...@patternfly/react-charts@4.1.1) (2019-06-05) **Note:** Version bump only for package @patternfly/react-charts diff --git a/packages/patternfly-4/react-charts/package.json b/packages/patternfly-4/react-charts/package.json index 3029c840b83..d898f0c9225 100644 --- a/packages/patternfly-4/react-charts/package.json +++ b/packages/patternfly-4/react-charts/package.json @@ -1,6 +1,6 @@ { "name": "@patternfly/react-charts", - "version": "4.1.1", + "version": "4.3.7", "description": "This library provides a set of React chart components for use with the PatternFly reference implementation.", "main": "dist/js/index.js", "module": "dist/esm/index.js", @@ -29,7 +29,7 @@ }, "homepage": "https://github.com/patternfly/patternfly-react#readme", "dependencies": { - "@patternfly/react-styles": "^3.3.0" + "@patternfly/react-styles": "^3.4.2" }, "peerDependencies": { "prop-types": "^15.6.1", @@ -37,10 +37,10 @@ }, "scripts": { "build": "yarn build:babel && yarn build:types && node ./scripts/copyTS.js", - "build:babel": "concurrently 'yarn build:babel:cjs' 'yarn build:babel:esm && yarn build:babel:umd'", - "build:babel:cjs": "cross-env BABEL_ENV=production:cjs babel src --out-dir dist/js --extensions '.js,.ts,.tsx' -q", - "build:babel:esm": "cross-env BABEL_ENV=production:esm babel src --out-dir dist/esm --extensions '.js,.ts,.tsx' -q", - "build:babel:umd": "cross-env BABEL_ENV=production:umd babel dist/esm --out-dir dist/umd --plugins transform-es2015-modules-umd --extensions '.js,.ts,.tsx' -q", + "build:babel": "concurrently 'yarn build:babel:esm && yarn build:babel:umd' 'yarn build:babel:cjs'", + "build:babel:cjs": "babel --source-maps --extensions '.js,.ts,.tsx' src --out-dir dist/js --presets=@babel/env", + "build:babel:esm": "babel --source-maps --extensions '.js,.ts,.tsx' src --out-dir dist/esm", + "build:babel:umd": "babel --source-maps --extensions '.js' dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", "build:types": "tsc -p tsconfig.gen-dts.json", "clean": "rimraf dist", "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose --source-maps", @@ -60,17 +60,14 @@ "@babel/core": "^7.0.0", "@babel/plugin-proposal-class-properties": "^7.0.0", "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-export-namespace-from": "^7.0.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-object-assign": "^7.0.0", "@babel/plugin-transform-typescript": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-react": "^7.0.0", - "@patternfly/patternfly": "2.8.2", - "@patternfly/react-icons": "^3.9.3", - "@patternfly/react-tokens": "^2.5.3", + "@patternfly/patternfly": "2.13.0", + "@patternfly/react-icons": "^3.10.2", + "@patternfly/react-tokens": "^2.6.1", "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-transform-imports": "^1.5.0", "babel-plugin-typescript-to-proptypes": "^0.17.1", "css": "^2.2.3", "enzyme": "3.9.0", diff --git a/packages/patternfly-4/react-charts/src/components/Chart/__snapshots__/Chart.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/Chart/__snapshots__/Chart.test.tsx.snap index 5ffb4c5cda5..80cf60a80d5 100644 --- a/packages/patternfly-4/react-charts/src/components/Chart/__snapshots__/Chart.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/Chart/__snapshots__/Chart.test.tsx.snap @@ -2151,9 +2151,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2179,9 +2180,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2227,9 +2229,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2253,9 +2256,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2333,9 +2337,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2359,9 +2364,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2376,9 +2382,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2403,9 +2410,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2414,9 +2422,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2446,9 +2455,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2473,9 +2483,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2498,9 +2509,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2525,9 +2537,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2564,9 +2577,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -4751,9 +4765,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -4779,9 +4794,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -4827,9 +4843,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -4853,9 +4870,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -4933,9 +4951,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -4959,9 +4978,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -4976,9 +4996,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -5003,9 +5024,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -5014,9 +5036,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -5046,9 +5069,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -5073,9 +5097,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -5098,9 +5123,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -5125,9 +5151,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -5164,9 +5191,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7357,9 +7385,10 @@ exports[`renders axis and component children 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7385,9 +7414,10 @@ exports[`renders axis and component children 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7433,9 +7463,10 @@ exports[`renders axis and component children 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7459,9 +7490,10 @@ exports[`renders axis and component children 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7539,9 +7571,10 @@ exports[`renders axis and component children 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7565,9 +7598,10 @@ exports[`renders axis and component children 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7582,9 +7616,10 @@ exports[`renders axis and component children 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7609,9 +7644,10 @@ exports[`renders axis and component children 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7620,9 +7656,10 @@ exports[`renders axis and component children 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -7652,9 +7689,10 @@ exports[`renders axis and component children 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7679,9 +7717,10 @@ exports[`renders axis and component children 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -7704,9 +7743,10 @@ exports[`renders axis and component children 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7731,9 +7771,10 @@ exports[`renders axis and component children 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -7770,9 +7811,10 @@ exports[`renders axis and component children 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartArea/__snapshots__/ChartArea.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartArea/__snapshots__/ChartArea.test.tsx.snap index 1607a91f8d0..dfb5e10e6aa 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartArea/__snapshots__/ChartArea.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartArea/__snapshots__/ChartArea.test.tsx.snap @@ -43,9 +43,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -71,9 +72,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -119,9 +121,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -145,9 +148,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -225,9 +229,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -251,9 +256,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -268,9 +274,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -295,9 +302,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -306,9 +314,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -338,9 +347,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -365,9 +375,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -390,9 +401,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -417,9 +429,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -456,9 +469,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -535,9 +549,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -563,9 +578,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -611,9 +627,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -637,9 +654,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -717,9 +735,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -743,9 +762,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -760,9 +780,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -787,9 +808,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -798,9 +820,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -830,9 +853,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -857,9 +881,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -882,9 +907,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -909,9 +935,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -948,9 +975,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1051,9 +1079,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1079,9 +1108,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1127,9 +1157,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1153,9 +1184,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1233,9 +1265,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1259,9 +1292,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1276,9 +1310,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1303,9 +1338,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1314,9 +1350,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1346,9 +1383,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1373,9 +1411,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1398,9 +1437,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1425,9 +1465,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1464,9 +1505,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartAxis/__snapshots__/ChartAxis.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartAxis/__snapshots__/ChartAxis.test.tsx.snap index b030f60ecd9..237c22fc138 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartAxis/__snapshots__/ChartAxis.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartAxis/__snapshots__/ChartAxis.test.tsx.snap @@ -43,9 +43,10 @@ exports[`ChartAxis 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -71,9 +72,10 @@ exports[`ChartAxis 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -119,9 +121,10 @@ exports[`ChartAxis 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -145,9 +148,10 @@ exports[`ChartAxis 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -225,9 +229,10 @@ exports[`ChartAxis 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -251,9 +256,10 @@ exports[`ChartAxis 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -268,9 +274,10 @@ exports[`ChartAxis 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -295,9 +302,10 @@ exports[`ChartAxis 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -306,9 +314,10 @@ exports[`ChartAxis 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -338,9 +347,10 @@ exports[`ChartAxis 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -365,9 +375,10 @@ exports[`ChartAxis 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -390,9 +401,10 @@ exports[`ChartAxis 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -417,9 +429,10 @@ exports[`ChartAxis 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -456,9 +469,10 @@ exports[`ChartAxis 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -550,9 +564,10 @@ exports[`ChartAxis 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -578,9 +593,10 @@ exports[`ChartAxis 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -626,9 +642,10 @@ exports[`ChartAxis 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -652,9 +669,10 @@ exports[`ChartAxis 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -732,9 +750,10 @@ exports[`ChartAxis 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -758,9 +777,10 @@ exports[`ChartAxis 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -775,9 +795,10 @@ exports[`ChartAxis 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -802,9 +823,10 @@ exports[`ChartAxis 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -813,9 +835,10 @@ exports[`ChartAxis 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -845,9 +868,10 @@ exports[`ChartAxis 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -872,9 +896,10 @@ exports[`ChartAxis 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -897,9 +922,10 @@ exports[`ChartAxis 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -924,9 +950,10 @@ exports[`ChartAxis 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -963,9 +990,10 @@ exports[`ChartAxis 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3174,9 +3202,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3202,9 +3231,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3250,9 +3280,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3276,9 +3307,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3356,9 +3388,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3382,9 +3415,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3399,9 +3433,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3426,9 +3461,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3437,9 +3473,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -3469,9 +3506,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3496,9 +3534,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -3521,9 +3560,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3548,9 +3588,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3587,9 +3628,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartBar/__snapshots__/ChartBar.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartBar/__snapshots__/ChartBar.test.tsx.snap index 1dee7aa7d01..f539e86f80f 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartBar/__snapshots__/ChartBar.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartBar/__snapshots__/ChartBar.test.tsx.snap @@ -58,9 +58,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -86,9 +87,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -134,9 +136,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -160,9 +163,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -240,9 +244,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -266,9 +271,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -283,9 +289,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -310,9 +317,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -321,9 +329,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -353,9 +362,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -380,9 +390,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -405,9 +416,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -432,9 +444,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -471,9 +484,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -565,9 +579,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -593,9 +608,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -641,9 +657,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -667,9 +684,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -747,9 +765,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -773,9 +792,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -790,9 +810,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -817,9 +838,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -828,9 +850,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -860,9 +883,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -887,9 +911,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -912,9 +937,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -939,9 +965,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -978,9 +1005,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3174,9 +3202,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3202,9 +3231,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3250,9 +3280,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3276,9 +3307,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3356,9 +3388,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3382,9 +3415,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3399,9 +3433,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3426,9 +3461,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3437,9 +3473,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -3469,9 +3506,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3496,9 +3534,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -3521,9 +3560,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3548,9 +3588,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3587,9 +3628,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartContainer/__snapshots__/ChartContainer.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartContainer/__snapshots__/ChartContainer.test.tsx.snap index 7638b8a3246..71d1003c08f 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartContainer/__snapshots__/ChartContainer.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartContainer/__snapshots__/ChartContainer.test.tsx.snap @@ -15,9 +15,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -43,9 +44,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -91,9 +93,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -117,9 +120,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -197,9 +201,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -223,9 +228,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -240,9 +246,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -267,9 +274,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -278,9 +286,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -310,9 +319,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -337,9 +347,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -362,9 +373,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -389,9 +401,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -428,9 +441,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -490,9 +504,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -518,9 +533,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -566,9 +582,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -592,9 +609,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -672,9 +690,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -698,9 +717,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -715,9 +735,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -742,9 +763,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -753,9 +775,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -785,9 +808,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -812,9 +836,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -837,9 +862,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -864,9 +890,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -903,9 +930,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -963,9 +991,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -991,9 +1020,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1039,9 +1069,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1065,9 +1096,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1145,9 +1177,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1171,9 +1204,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1188,9 +1222,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1215,9 +1250,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1226,9 +1262,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1258,9 +1295,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1285,9 +1323,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1310,9 +1349,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1337,9 +1377,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1376,9 +1417,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1438,9 +1480,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1466,9 +1509,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1514,9 +1558,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1540,9 +1585,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1620,9 +1666,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1646,9 +1693,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1663,9 +1711,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1690,9 +1739,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1701,9 +1751,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1733,9 +1784,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1760,9 +1812,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1785,9 +1838,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1812,9 +1866,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1851,9 +1906,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1911,9 +1967,10 @@ exports[`renders container via ChartLegend 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1939,9 +1996,10 @@ exports[`renders container via ChartLegend 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1987,9 +2045,10 @@ exports[`renders container via ChartLegend 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2013,9 +2072,10 @@ exports[`renders container via ChartLegend 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2093,9 +2153,10 @@ exports[`renders container via ChartLegend 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2119,9 +2180,10 @@ exports[`renders container via ChartLegend 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2136,9 +2198,10 @@ exports[`renders container via ChartLegend 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2163,9 +2226,10 @@ exports[`renders container via ChartLegend 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2174,9 +2238,10 @@ exports[`renders container via ChartLegend 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2206,9 +2271,10 @@ exports[`renders container via ChartLegend 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2233,9 +2299,10 @@ exports[`renders container via ChartLegend 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2258,9 +2325,10 @@ exports[`renders container via ChartLegend 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2285,9 +2353,10 @@ exports[`renders container via ChartLegend 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2324,9 +2393,10 @@ exports[`renders container via ChartLegend 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2387,9 +2457,10 @@ exports[`renders container via ChartLegend 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2415,9 +2486,10 @@ exports[`renders container via ChartLegend 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2463,9 +2535,10 @@ exports[`renders container via ChartLegend 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2489,9 +2562,10 @@ exports[`renders container via ChartLegend 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2569,9 +2643,10 @@ exports[`renders container via ChartLegend 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2595,9 +2670,10 @@ exports[`renders container via ChartLegend 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2612,9 +2688,10 @@ exports[`renders container via ChartLegend 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2639,9 +2716,10 @@ exports[`renders container via ChartLegend 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2650,9 +2728,10 @@ exports[`renders container via ChartLegend 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2682,9 +2761,10 @@ exports[`renders container via ChartLegend 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2709,9 +2789,10 @@ exports[`renders container via ChartLegend 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2734,9 +2815,10 @@ exports[`renders container via ChartLegend 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2761,9 +2843,10 @@ exports[`renders container via ChartLegend 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2800,9 +2883,10 @@ exports[`renders container via ChartLegend 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx index d68597b4e3f..c62bcb78410 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/ChartDonut.tsx @@ -8,16 +8,19 @@ import { EventPropTypeInterface, PaddingProps, StringOrNumberOrCallback, - VictoryPieProps, VictoryStyleInterface } from 'victory'; import { getDonutTheme } from '../ChartUtils/chart-theme'; import { ChartContainer } from '../ChartContainer/ChartContainer'; import { ChartLabel } from '../ChartLabel/ChartLabel'; +import { ChartLegend } from "../ChartLegend/ChartLegend"; import { ChartPie, ChartPieProps } from '../ChartPie/ChartPie'; import { ChartThemeDefinition } from '../ChartTheme/ChartTheme'; -import { DonutStyles, DonutTheme } from '../ChartTheme/themes/donut-theme'; +import { DonutStyles } from '../ChartTheme/themes/donut-theme'; import { ChartTooltip } from '../ChartTooltip/ChartTooltip'; +import { getLabelX, getLabelY } from "../ChartUtils/chart-label"; +import { getLegendDimensions, getLegendX, getLegendY } from "../ChartUtils/chart-legend"; +import { getChartOrigin } from '../ChartUtils/chart-origin'; export enum ChartDonutLabelPosition { centroid = 'centroid', @@ -25,11 +28,27 @@ export enum ChartDonutLabelPosition { startAngle = 'startAngle' }; +export enum ChartDonutLegendOrientation { + horizontal = 'horizontal', + vertical = 'vertical' +}; + +export enum ChartDonutLegendPosition { + bottom = 'bottom', + right = 'right' +}; + export enum ChartDonutSortOrder { ascending = 'ascending', descending = 'descending' }; +export enum ChartDonutSubTitlePosition { + bottom = 'bottom', + center = 'center', + right = 'right' +} + /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts */ @@ -46,6 +65,13 @@ export interface ChartDonutProps extends ChartPieProps { * {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})} */ animate?: AnimatePropTypeInterface; + /** + * The capHeight prop defines a text metric for the font being used: the expected height of capital letters. + * This is necessary because of SVG, which (a) positions the *bottom* of the text at `y`, and (b) has no notion of + * line height. The value should ideally use the same units as `lineHeight` and `dy`, preferably ems. If given a + * unitless number, it is assumed to be ems. + */ + capHeight?: StringOrNumberOrCallback; /** * The categories prop specifies how categorical data for a chart should be ordered. * This prop should be given as an array of string values, or an object with @@ -102,6 +128,49 @@ export interface ChartDonutProps extends ChartPieProps { * If a dataComponent is not provided, ChartDonut's Slice component will be used. */ dataComponent?: React.ReactElement; + /** + * Specifies the height of the donut chart. This value should be given as a + * number of pixels. + * + * Because Victory renders responsive containers, the width and height props do not determine the width and + * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of + * pixels will depend on the size of the container the chart is rendered into. + * + * Note: When adding a legend, height (the overall SVG height) may need to be larger than donutHeight (the donut size) + * in order to accommodate the extra legend. + * + * By default, donutHeight is the min. of either height or width. This covers most use cases in order to accommodate + * legends within the same SVG. However, donutHeight (not height) may need to be set in order to adjust the donut + * height. + * + * The innerRadius may also need to be set when changing the donut size. + */ + donutHeight?: number; + /** + * Defines a horizontal shift from the x coordinate. It should not be set manually. + */ + donutDx?: number; + /** + * Defines a vertical shift from the y coordinate. It should not be set manually. + */ + donutDy?: number; + /** + * Specifies the width of the donut chart. This value should be given as a + * number of pixels. + * + * Because Victory renders responsive containers, the width and height props do not determine the width and + * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of + * pixels will depend on the size of the container the chart is rendered into. + * + * Note: When adding a legend, width (the overall SVG width) may need to be larger than donutWidth (the donut size) + * in order to accommodate the extra legend. + * + * By default, donutWidth is the min. of either height or width. This covers most use cases in order to accommodate + * legends within the same SVG. However, donutWidth (not width) may need to be set in order to adjust the donut width. + * + * The innerRadius may also need to be set when changing the donut size. + */ + donutWidth?: number; /** * The overall end angle of the pie in degrees. This prop is used in conjunction with * startAngle to create a pie that spans only a segment of a circle. @@ -211,6 +280,46 @@ export interface ChartDonutProps extends ChartPieProps { * @example ["spring", "summer", "fall", "winter"], (datum) => datum.title */ labels?: string[] | ((data: any) => string); + /** + * The legend component to render with chart. + * + * Note: Use legendData so the legend width can be calculated and positioned properly. + * Default legend properties may be applied + */ + legendComponent?: React.ReactElement; + /** + * The data prop specifies the data to be plotted, + * where data X-value is the slice label (string or number), + * and Y-value is the corresponding number value represented by the slice + * Data should be in the form of an array of data points. + * Each data point may be any format you wish (depending on the `x` and `y` accessor props), + * but by default, an object with x and y properties is expected. + * + * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} + */ + legendData?: any[]; + /** + * Defines a horizontal shift from the x coordinate. It should not be set manually. + */ + legendDx?: number; + /** + * Defines a vertical shift from the y coordinate. It should not be set manually. + */ + legendDy?: number; + /** + * The orientation prop takes a string that defines whether legend data + * are displayed in a row or column. When orientation is "horizontal", + * legend items will be displayed in a single row. When orientation is + * "vertical", legend items will be displayed in a single column. Line + * and text-wrapping is not currently supported, so "vertical" + * orientation is both the default setting and recommended for + * displaying many series of data. + */ + legendOrientation?: 'horizontal' | 'vertical'; + /** + * The legend position relation to the donut chart. Valid values are 'bottom' and 'right' + */ + legendPosition?: 'bottom' | 'right'; /** * The name prop is used to reference a component instance when defining shared events. */ @@ -274,6 +383,24 @@ export interface ChartDonutProps extends ChartPieProps { * The subtitle for the donut chart */ subTitle?: string; + /** + * The label component to render the chart subTitle. + * + * Note: Default label properties may be applied + */ + subTitleComponent?: React.ReactElement; + /** + * Defines a horizontal shift from the x coordinate. It should not be set manually. + */ + subTitleDx?: number; + /** + * Defines a vertical shift from the y coordinate. It should not be set manually. + */ + subTitleDy?: number; + /** + * The orientation of the donut chart in relation to the legend. Valid values are 'bottom', 'center', and 'right' + */ + subTitlePosition?: 'bottom' | 'center' | 'right'; /** * The theme prop takes a style object with nested data, labels, and parent objects. * You can create this object yourself, or you can use a theme provided by @@ -302,6 +429,12 @@ export interface ChartDonutProps extends ChartPieProps { * The title for the donut chart */ title?: string; + /** + * The label component to render the chart title. + * + * Note: Default label properties may be applied + */ + titleComponent?: React.ReactElement; /** * Specifies the width of the svg viewBox of the chart container. This value should be given as a * number of pixels. @@ -338,49 +471,164 @@ export interface ChartDonutProps extends ChartPieProps { } export const ChartDonut: React.FunctionComponent = ({ - height = DonutTheme.pie.height, + donutDx = 0, + donutDy = 0, + legendComponent = , + legendData, + legendDx = 0, + legendDy = 0, + legendPosition = DonutStyles.legend.position as ChartDonutLegendPosition, standalone = true, subTitle, + subTitleComponent = , + subTitleDx = 0, + subTitleDy = 0, + subTitlePosition = DonutStyles.label.subTitlePosition as ChartDonutSubTitlePosition, themeColor, themeVariant, title, - width = DonutTheme.pie.width, + titleComponent = , // destructure last - innerRadius = ((height || width) - 34) / 2, theme = getDonutTheme(themeColor, themeVariant), + legendOrientation = theme.legend.orientation as ChartDonutLegendOrientation, + capHeight = 1.1, + height = theme.pie.height, + width = theme.pie.width, + donutHeight = Math.min(height, width), + donutWidth = Math.min(height, width, donutHeight), + innerRadius = (Math.min(donutHeight, donutWidth) - 34) / 2, ...rest }: ChartDonutProps) => { + // Returns legend + const getLegend = () => { + if (!legendData && !legendComponent.props.data) { + return null; + } + const props = legendComponent.props ? legendComponent.props : {}; + return React.cloneElement(legendComponent, { + data: legendData, + orientation: legendOrientation, + standalone: false, + theme: theme, + x: getLegendX({ + chartWidth: donutWidth, + dx: legendDx, + legendData, + legendOrientation: props.legendOrientation ? props.legendOrientation : legendOrientation, + legendPosition, + legendProps: props, + theme, + svgWidth: width + }), + y: getLegendY({ + chartHeight: donutHeight, + chartType: 'pie', + dy: legendDy, + legendData: props.data ? props.data : legendData, + legendOrientation: props.legendOrientation ? props.legendOrientation : legendOrientation, + legendProps: props, + legendPosition, + theme + }), + ...props + }); + }; + + // Returns subtitle + const getSubTitle = () => { + if (!subTitle || subTitlePosition === ChartDonutSubTitlePosition.center) { + return null; + } + const props = titleComponent.props ? titleComponent.props : {}; + return React.cloneElement(titleComponent, { + style: DonutStyles.label.subTitle, + text: subTitle, + textAnchor: subTitlePosition === 'right' ? 'start' : 'middle', + verticalAnchor: 'middle', + x: getLabelX({ + chartWidth: donutWidth, + dx: subTitleDx, + labelPosition: subTitlePosition, + legendPosition, + svgWidth: width + }), + y: getLabelY({ + chartHeight: donutHeight, + dy: subTitleDy, + labelPosition: subTitlePosition + }), + ...props + }); + }; + + // Returns title + const getTitle = () => { + if (!title) { + return null; + } + const props = titleComponent ? titleComponent.props : {}; + const showBoth = title && subTitle && subTitlePosition == ChartDonutSubTitlePosition.center; + return React.cloneElement(titleComponent, { + ...showBoth && { capHeight }, + style: [DonutStyles.label.title, DonutStyles.label.subTitle], + text: showBoth ? [title, subTitle] : title, + textAnchor: 'middle', + verticalAnchor: 'middle', + x: getLabelX({ + chartWidth: donutWidth, + dx: donutDx, + labelPosition: 'center', + legendPosition, + svgWidth: width + }), + y: getLabelY({ + chartHeight: donutHeight, + dy: donutDy, + labelPosition: 'center' + }), + ...props + }); + }; + const chart = ( - 0 ? innerRadius : 0} labelComponent={} + origin={getChartOrigin({ + chartHeight: donutHeight, + chartWidth: donutWidth, + dx: donutDx, + dy: donutDy, + legendPosition, + svgWidth: width + })} standalone={false} theme={theme} - width={width} + width={donutWidth} {...rest} /> ); return standalone ? ( - + {chart} + {getLegend()} + {getTitle()} + {getSubTitle()} ) : ( - chart + + {chart} + {getLegend()} + {getTitle()} + {getSubTitle()} + ); }; -// Note: VictoryPie.role must be hoisted +// Note: ChartPie.role must be hoisted hoistNonReactStatics(ChartDonut, ChartPie); diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/__snapshots__/ChartDonut.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartDonut/__snapshots__/ChartDonut.test.tsx.snap index 15a3d1b411c..544c59d361a 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonut/__snapshots__/ChartDonut.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/__snapshots__/ChartDonut.test.tsx.snap @@ -5,23 +5,6 @@ exports[`Chart 1`] = ` height={230} width={230} > - } + origin={ + Object { + "x": 115, + "y": 115, + } + } standalone={false} theme={ Object { "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -515,9 +519,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -563,9 +568,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -589,9 +595,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -669,9 +676,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -695,9 +703,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -712,9 +721,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -739,9 +749,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -750,9 +761,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -782,9 +794,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -809,9 +822,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padAngle": 1, @@ -835,9 +849,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -862,9 +877,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -901,9 +917,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -944,23 +961,6 @@ exports[`Chart 2`] = ` height={230} width={230} > - } + origin={ + Object { + "x": 115, + "y": 115, + } + } standalone={false} theme={ Object { "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1454,9 +1475,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1502,9 +1524,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1528,9 +1551,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1608,9 +1632,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1634,9 +1659,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1651,9 +1677,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1678,9 +1705,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1689,9 +1717,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1721,9 +1750,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1748,9 +1778,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padAngle": 1, @@ -1774,9 +1805,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1801,9 +1833,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1840,9 +1873,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1883,23 +1917,6 @@ exports[`renders component data 1`] = ` height={200} width={200} > - } + origin={ + Object { + "x": 100, + "y": 100, + } + } standalone={false} theme={ Object { "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2409,9 +2447,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2457,9 +2496,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2483,9 +2523,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2563,9 +2604,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2589,9 +2631,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2606,9 +2649,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2633,9 +2677,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2644,9 +2689,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2676,9 +2722,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2703,9 +2750,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padAngle": 1, @@ -2729,9 +2777,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2756,9 +2805,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2795,9 +2845,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/examples/ChartDonut.md b/packages/patternfly-4/react-charts/src/components/ChartDonut/examples/ChartDonut.md index e95f346a0b3..58b57466cae 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonut/examples/ChartDonut.md +++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/examples/ChartDonut.md @@ -2,63 +2,181 @@ title: 'Donut' section: 'charts' typescript: true -propComponents: ['ChartDonut', 'ChartLegend'] +propComponents: ['ChartDonut'] --- -import { ChartDonut, ChartLegend, ChartThemeColor, ChartThemeVariant } from '@patternfly/react-charts'; +import { ChartDonut, ChartThemeColor, ChartThemeVariant } from '@patternfly/react-charts'; import './chart-donut.scss'; -## Blue donut chart +## Simple donut chart +```js +import React from 'react'; +import { ChartDonut } from '@patternfly/react-charts'; +
+
+ `${datum.x}: ${datum.y}%`} + subTitle="Pets" + title="100" + /> +
+
+``` + +## Donut chart with right-aligned legend ```js import React from 'react'; -import { ChartDonut, ChartLegend } from '@patternfly/react-charts'; +import { ChartDonut } from '@patternfly/react-charts';
-
-
- `${datum.x}: ${datum.y}`} - subTitle="Pets" - title="100" - /> -
- + `${datum.x}: ${datum.y}%`} + legendData={[{ name: 'Cats: 35' }, { name: 'Dogs: 55' }, { name: 'Birds: 10' }]} + legendOrientation="vertical" + legendPosition="right" + subTitle="Pets" + title="100" + width={350} />
``` -## Multi-color donut chart +## Multi-color donut chart with right-aligned legend ```js import React from 'react'; -import { ChartDonut, ChartLegend, ChartThemeColor, ChartThemeVariant } from '@patternfly/react-charts'; +import { ChartDonut } from '@patternfly/react-charts';
-
+
`${datum.x}: ${datum.y}`} + labels={datum => `${datum.x}: ${datum.y}%`} + legendData={[{ name: 'Cats: 35' }, { name: 'Dogs: 55' }, { name: 'Birds: 10' }]} + legendOrientation="vertical" + legendPosition="right" subTitle="Pets" + title="100" themeColor={ChartThemeColor.multi} themeVariant={ChartThemeVariant.light} + width={350} + /> +
+
+``` + +## Donut chart with bottom-aligned legend +```js +import React from 'react'; +import { ChartDonut } from '@patternfly/react-charts'; + +
+
+ `${datum.x}: ${datum.y}%`} + legendData={[{ name: 'Cats: 35' }, { name: 'Dogs: 55' }, { name: 'Birds: 10' }]} + legendPosition="bottom" + legendWidth={225} + subTitle="Pets" + title="100" + width={300} + /> +
+
+``` + +## Small donut chart +```js +import React from 'react'; +import { ChartDonut } from '@patternfly/react-charts'; + +
+
+ `${datum.x}: ${datum.y}%`} + subTitle="Pets" + title="100" + width={150} + /> +
+
+``` + +## Small donut chart with right-aligned legend +```js +import React from 'react'; +import { ChartDonut } from '@patternfly/react-charts'; + +
+
+ `${datum.x}: ${datum.y}%`} + legendData={[{ name: 'Cats: 35' }, { name: 'Dogs: 55' }, { name: 'Birds: 10' }]} + legendOrientation="vertical" + legendPosition="right" + subTitle="Pets" + title="100" + width={275} + /> +
+
+``` + +## Small donut chart with right-aligned legend and bottom-aligned subtitle +```js +import React from 'react'; +import { ChartDonut } from '@patternfly/react-charts'; + +
+
+ `${datum.x}: ${datum.y}%`} + legendData={[{ name: 'Cats: 35' }, { name: 'Dogs: 55' }, { name: 'Birds: 10' }]} + legendOrientation="vertical" + legendPosition="right" + subTitle="Pets" + subTitlePosition="bottom" + title="100" + width={275} + /> +
+
+``` + +## Small donut chart with bottom-aligned legend and right-aligned subtitle +```js +import React from 'react'; +import { ChartDonut } from '@patternfly/react-charts'; + +
+
+ `${datum.x}: ${datum.y}%`} + legendData={[{ name: 'Cats: 35' }, { name: 'Dogs: 55' }, { name: 'Birds: 10' }]} + legendPosition="bottom" + subTitle="Pets" + subTitlePosition="right" title="100" + width={300} />
-
``` diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonut/examples/chart-donut.scss b/packages/patternfly-4/react-charts/src/components/ChartDonut/examples/chart-donut.scss index e22c971e11a..d5c73e3ff43 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonut/examples/chart-donut.scss +++ b/packages/patternfly-4/react-charts/src/components/ChartDonut/examples/chart-donut.scss @@ -1,12 +1,38 @@ .ws-preview { & > * { - .donut-chart-container { + .donut-chart { height: 230px; width: 230px; } - .donut-chart-inline { - display: inline-flex; + .donut-chart-sm { + height: 150px; + width: 150px; + } + + .donut-chart-legend-bottom { + height: 275px; + width: 300px; + } + + .donut-chart-legend-right { + height: 230px; + width: 350px; + } + + .donut-chart-legend-right-sm { + height: 150px; + width: 275px; + } + + .donut-chart-legend-right-subtitle-bottom-sm { + height: 175px; + width: 275px; + } + + .donut-chart-legend-bottom-subtitle-right-sm { + height: 200px; + width: 300px; } } } diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx index fde2c785622..163404d2277 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/ChartDonutThreshold.tsx @@ -2,17 +2,21 @@ import * as React from 'react'; import { AnimatePropTypeInterface, CategoryPropType, - ColorScalePropType, DataGetterPropType, - EventPropTypeInterface, PaddingProps, - StringOrNumberOrCallback, VictoryStyleInterface + ColorScalePropType, + DataGetterPropType, + EventPropTypeInterface, + PaddingProps, + StringOrNumberOrCallback, + VictoryStyleInterface } from "victory"; import { Data } from 'victory-core'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { ChartContainer } from '../ChartContainer/ChartContainer'; -import { ChartPie, ChartPieProps } from '../ChartPie/ChartPie'; +import { ChartDonut, ChartDonutProps } from '../ChartDonut/ChartDonut'; import { ChartThemeDefinition } from "../ChartTheme/ChartTheme"; import { getChartOrigin } from '../ChartUtils/chart-origin'; import { getDonutThresholdDynamicTheme, getDonutThresholdStaticTheme } from '../ChartUtils/chart-theme'; +import { DonutStyles } from "../ChartTheme/themes/donut-theme"; export enum ChartDonutThresholdDonutOrientation { left = 'left', @@ -31,15 +35,26 @@ export enum ChartDonutThresholdLabelPosition { startAngle = 'startAngle' }; +export enum ChartDonutThresholdLegendPosition { + bottom = 'bottom', + right = 'right' +}; + export enum ChartDonutThresholdSortOrder { ascending = 'ascending', descending = 'descending' }; +export enum ChartDonutThresholdSubTitlePosition { + bottom = 'bottom', + center = 'center', + right = 'right' +} + /** * See https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/victory/index.d.ts */ -export interface ChartDonutThresholdProps extends ChartPieProps { +export interface ChartDonutThresholdProps extends ChartDonutProps { /** * See Victory type docs: https://formidable.com/open-source/victory/docs/victory-pie/ */ @@ -122,14 +137,16 @@ export interface ChartDonutThresholdProps extends ChartPieProps { * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of * pixels will depend on the size of the container the chart is rendered into. * - * Note: The parent container must be set to the same height in order to maintain the aspect ratio. Otherwise, the - * innerRadius may need to be set when using this property. + * Note: When adding a legend, height (the overall SVG height) may need to be larger than donutHeight (the donut size) + * in order to accommodate the extra legend. + * + * By default, donutHeight is the min. of either height or width. This covers most use cases in order to accommodate + * legends within the same SVG. However, donutHeight (not height) may need to be set in order to adjust the donut + * height. + * + * The innerRadius may also need to be set when changing the donut size. */ donutHeight?: number; - /** - * The orientation of the donut chart in relation to the legend. Valid values are 'left', 'top', and 'right' - */ - donutOrientation?: 'left' | 'right' | 'top'; /** * Specifies the width of the donut chart. This value should be given as a * number of pixels. @@ -138,8 +155,13 @@ export interface ChartDonutThresholdProps extends ChartPieProps { * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of * pixels will depend on the size of the container the chart is rendered into. * - * Note: The parent container must be set to the same height in order to maintain the aspect ratio. Otherwise, the - * innerRadius may need to be set when using this property. + * Note: When adding a legend, width (the overall SVG width) may need to be larger than donutWidth (the donut size) + * in order to accommodate the extra legend. + * + * By default, donutWidth is the min. of either height or width. This covers most use cases in order to accommodate + * legends within the same SVG. However, donutWidth (not width) may need to be set in order to adjust the donut width. + * + * The innerRadius may also need to be set when changing the donut size. */ donutWidth?: number; /** @@ -211,7 +233,10 @@ export interface ChartDonutThresholdProps extends ChartPieProps { * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of * pixels will depend on the size of the container the chart is rendered into. * - * Note: innerRadius may need to be set when using this property. + * Note: When adding a legend, height (the overall SVG height) may need to be larger than donutHeight (the donut size) + * in order to accommodate the extra legend. + * + * Typically, the parent container is set to the same height in order to maintain the aspect ratio. */ height?: number; /** @@ -234,13 +259,17 @@ export interface ChartDonutThresholdProps extends ChartPieProps { * @example ["spring", "summer", "fall", "winter"], (datum) => datum.title */ labels?: string[] | ((data: any) => string); + /** + * The legend position relation to the donut chart. Valid values are 'bottom' and 'right' + */ + legendPosition?: 'bottom' | 'right'; /** * The name prop is used to reference a component instance when defining shared events. */ name?: string; /** * Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts. - * **This prop should not be set manually.** + * It should not be set manually.** */ origin?: { x: number, y: number }; /** @@ -301,6 +330,10 @@ export interface ChartDonutThresholdProps extends ChartPieProps { * The subtitle for the donut chart */ subTitle?: string; + /** + * The orientation of the donut chart in relation to the legend. Valid values are 'bottom', 'center', and 'right' + */ + subTitlePosition?: 'bottom' | 'center' | 'right'; /** * The theme prop takes a style object with nested data, labels, and parent objects. * You can create this object yourself, or you can use a theme provided by @@ -344,7 +377,10 @@ export interface ChartDonutThresholdProps extends ChartPieProps { * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of * pixels will depend on the size of the container the chart is rendered into. * - * Note: innerRadius may need to be set when using this property. + * Note: When adding a legend, width (the overall SVG width) may need to be larger than donutWidth (the donut size) + * in order to accommodate the extra legend. + * + * Typically, the parent container is set to the same width in order to maintain the aspect ratio. */ width?: number; /** @@ -374,8 +410,12 @@ export interface ChartDonutThresholdProps extends ChartPieProps { export const ChartDonutThreshold: React.FunctionComponent = ({ children, data = [], - donutOrientation = 'left', + labels = [], // Don't show any tooltip labels by default, let consumer override if needed + legendComponent, + legendData, + legendPosition = DonutStyles.legend.position as ChartDonutThresholdLegendPosition, standalone = true, + subTitlePosition = DonutStyles.label.subTitlePosition as ChartDonutThresholdSubTitlePosition, themeColor, themeVariant, x, @@ -383,84 +423,136 @@ export const ChartDonutThreshold: React.FunctionComponent { + // Returns computed data representing pie chart slices const getComputedData = () => { - const computedData = []; - const datum = getData(data); - let prevYVal = 0; - datum.forEach((dataPoint: {_x?: any, _y: any}) => { - computedData.push({ x: dataPoint._x, y: dataPoint._y ? Math.abs(dataPoint._y - prevYVal) : 0 }); - prevYVal = dataPoint._y; - }); - computedData.push({ y: prevYVal ? Math.abs(100 - prevYVal) : 0 }); - return computedData; + // Format and sort data. Sorting ensures thresholds are displayed in the correct order and simplifies calculations. + const datum = Data.formatData(data, {x, y, ...rest}, ['x', 'y']).sort((a: any,b: any) => a._y - b._y); + + // Data must be offset so that the sum of all data point y-values (including the final slice) == 100. + const [prev, computedData] = datum.reduce((acc: [number, any], dataPoint: {_x: number | string, _y: number}) => { + return [ + dataPoint._y, // Set the previous value to current y value + [ + ...acc[1], + { + x: dataPoint._x, // Conditionally add x property only if it is in the original data object + y: dataPoint._y - acc[0] // Must be offset by previous value + } + ] + ]; + }, [0, []]); + + return [ + ...computedData, + { + y: prev ? (100 - prev) : 0 + } + ]; }; - const getData = (datum: any[]) => { - const accessorTypes = ['x', 'y']; - return Data.formatData(datum, { x, y, ...rest }, accessorTypes); + // Returns the horizontal shift for the donut utilization chart + const getDonutDx = (dynamicTheme: ChartThemeDefinition, legendPosition: string) => { + const dynamicWidth = donutWidth - (theme.pie.width - dynamicTheme.pie.width); + switch (legendPosition) { + case 'right': + return Math.round((donutWidth - dynamicWidth) / 2); + default: + return 0; + } }; - // Returns the horizontal shift for the dynamic utilization donut cart - const getDynamicDonutDx = (dynamicTheme: ChartThemeDefinition, orientation: string) => { - switch (orientation) { - case 'left': - return Math.round((theme.pie.width - dynamicTheme.pie.width) / 2); + // Returns the vertical shift for the donut utilization chart + const getDonutDy = (dynamicTheme: ChartThemeDefinition) => { + const dynamicHeight = donutHeight - (theme.pie.height - dynamicTheme.pie.height); + return Math.round((donutHeight - dynamicHeight) / 2); + } + + // Returns the horizontal shift for the donut utilization legend + const getLegendDx = (dynamicTheme: ChartThemeDefinition, position: string) => { + const dynamicWidth = donutWidth - (theme.pie.width - dynamicTheme.pie.width); + switch (position) { case 'right': - return -Math.round((theme.pie.width - dynamicTheme.pie.width) / 2); + return getDonutDx(dynamicTheme, legendPosition) + Math.round((donutWidth - dynamicWidth) / 2); default: return 0; } }; - // Returns the vertical shift for the dynamic utilization donut cart - const getDynamicDonutDy = (dynamicTheme: ChartThemeDefinition) => - Math.round((theme.pie.height - dynamicTheme.pie.height) / 2); + // Returns the vertical shift for the donut utilization legend and subtitle + const getLegendAndSubTitleDy = (dynamicTheme: ChartThemeDefinition, position: string) => { + const dynamicWidth = donutWidth - (theme.pie.width - dynamicTheme.pie.width); + switch (position) { + case 'bottom': + return getDonutDy(dynamicTheme) + Math.round((donutWidth - dynamicWidth) / 2); + default: + return getDonutDy(dynamicTheme); + } + } + + // Returns the horizontal shift for the donut utilization subtitle + const getSubTitleDx = (dynamicTheme: ChartThemeDefinition, position: string) => { + const dynamicWidth = donutWidth - (theme.pie.width - dynamicTheme.pie.width); + switch (position) { + case 'right': + return getDonutDx(dynamicTheme, legendPosition) + Math.round((donutWidth - dynamicWidth) / 2); + default: + return Math.round((donutWidth - dynamicWidth) / 2); + } + }; // Render dynamic utilization donut cart const renderChildren = () => React.Children.toArray(children).map(child => { - const datum = getData([{ ...child.props.data }]); - const orientation = child.props.donutOrientation || donutOrientation; - const dynamicTheme = - child.props.theme || - getDonutThresholdDynamicTheme(child.props.themeColor || themeColor, - child.props.themeVariant || themeVariant); - return React.cloneElement(child, { - donutDx: child.props.donutDx || getDynamicDonutDx(dynamicTheme, orientation), - donutDy: child.props.donutDy || getDynamicDonutDy(dynamicTheme), - donutHeight: child.props.donutHeight || dynamicTheme.pie.height, - donutOrientation: orientation, - donutWidth: child.props.donutWidth || dynamicTheme.pie.width, - endAngle: child.props.endAngle || 360 * (datum[0]._y ? datum[0]._y / 100 : 100), - height: child.props.height || height, - showStatic: child.props.showStatic || false, - standalone: false, - theme: dynamicTheme, - width: child.props.width || width - }); + if (child.props) { + const { data: childData, ...childProps } = child.props; + const datum = Data.formatData([childData], childProps, ['x', 'y']); // Format child data independently of this component's props + const dynamicTheme = childProps.theme || + getDonutThresholdDynamicTheme(childProps.themeColor || themeColor, + childProps.themeVariant || themeVariant); + const legendPos = childProps.legendPosition || legendPosition; + const subTitlePos = childProps.subTitlePosition || subTitlePosition; + return React.cloneElement(child, { + data: childData, + donutDx: getDonutDx(dynamicTheme, legendPos), + donutDy: getDonutDy(dynamicTheme), + donutHeight: donutHeight - (theme.pie.height - dynamicTheme.pie.height), + donutWidth: donutWidth - (theme.pie.width - dynamicTheme.pie.width), + endAngle: 360 * (datum[0]._y ? datum[0]._y / 100 : 0), + height, + legendDx: getLegendDx(dynamicTheme, legendPos), + legendDy: getLegendAndSubTitleDy(dynamicTheme, legendPos), + legendPosition: legendPos, + showStatic: false, + standalone: false, + subTitleDx: getSubTitleDx(dynamicTheme, subTitlePos), + subTitleDy: getLegendAndSubTitleDy(dynamicTheme, subTitlePos), + subTitlePosition: subTitlePos, + theme: dynamicTheme, + width, + ...childProps, + }); + } }); // Static threshold dount chart const chart = ( - 0 ? innerRadius : 0} + labels={labels} origin={getChartOrigin({ chartHeight: donutHeight, chartWidth: donutWidth, - chartOrientation: donutOrientation, - height, - width + legendPosition, + svgWidth: width })} standalone={false} theme={theme} @@ -480,5 +572,5 @@ export const ChartDonutThreshold: React.FunctionComponent {}, onEnter: {duration: 500, before: () => ({y: 0})})} */ animate?: AnimatePropTypeInterface; + /** + * The capHeight prop defines a text metric for the font being used: the expected height of capital letters. + * This is necessary because of SVG, which (a) positions the *bottom* of the text at `y`, and (b) has no notion of + * line height. The value should ideally use the same units as `lineHeight` and `dy`, preferably ems. If given a + * unitless number, it is assumed to be ems. + */ + capHeight?: StringOrNumberOrCallback; /** * The categories prop specifies how categorical data for a chart should be ordered. * This prop should be given as an array of string values, or an object with @@ -119,11 +126,11 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { */ dataComponent?: React.ReactElement; /** - * Defines a horizontal shift from the x coordinate. This should not be set manually. + * Defines a horizontal shift from the x coordinate. It should not be set manually. */ donutDx?: number; /** - * Defines a vertical shift from the y coordinate. This should not be set manually. + * Defines a vertical shift from the y coordinate. It should not be set manually. */ donutDy?: number; /** @@ -134,14 +141,16 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of * pixels will depend on the size of the container the chart is rendered into. * - * Note: The parent container must be set to the same height in order to maintain the aspect ratio. Otherwise, the - * innerRadius may need to be set when using this property. + * Note: When adding a legend, height (the overall SVG height) may need to be larger than donutHeight (the donut size) + * in order to accommodate the extra legend. + * + * By default, donutHeight is the min. of either height or width. This covers most use cases in order to accommodate + * legends within the same SVG. However, donutHeight (not height) may need to be set in order to adjust the donut + * height. + * + * The innerRadius may also need to be set when changing the donut size. */ donutHeight?: number; - /** - * The orientation of the donut chart in relation to the legend. Valid values are 'left', 'top', and 'right' - */ - donutOrientation?: 'left' | 'right' | 'top'; /** * Specifies the width of the donut chart. This value should be given as a * number of pixels. @@ -150,10 +159,23 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of * pixels will depend on the size of the container the chart is rendered into. * - * Note: The parent container must be set to the same height in order to maintain the aspect ratio. Otherwise, the - * innerRadius may need to be set when using this property. + * Note: When adding a legend, width (the overall SVG width) may need to be larger than donutWidth (the donut size) + * in order to accommodate the extra legend. + * + * By default, donutWidth is the min. of either height or width. This covers most use cases in order to accommodate + * legends within the same SVG. However, donutWidth (not width) may need to be set in order to adjust the donut width. + * + * The innerRadius may also need to be set when changing the donut size. */ donutWidth?: number; + /** + * Defines a horizontal shift from the x coordinate for legend and subtitle. It should not be set manually. + */ + dx?: number; + /** + * Defines a vertical shift from the y coordinate for legend and subtitle. It should not be set manually. + */ + dy?: number; /** * The overall end angle of the pie in degrees. This prop is used in conjunction with * startAngle to create a pie that spans only a segment of a circle. @@ -223,7 +245,10 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of * pixels will depend on the size of the container the chart is rendered into. * - * Note: innerRadius may need to be set when using this property. + * Note: When adding a legend, height (the overall SVG height) may need to be larger than donutHeight (the donut size) + * in order to accommodate the extra legend. + * + * Typically, the parent container is set to the same height in order to maintain the aspect ratio. */ height?: number; /** @@ -250,7 +275,10 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { */ labelPosition?: 'startAngle' | 'endAngle' | 'centroid'; /** - * The legend component to render with chart. This overrides other legend props. + * The legend component to render with chart. + * + * Note: Use legendData so the legend width can be calculated and positioned properly. + * Default legend properties may be applied */ legendComponent?: React.ReactElement; /** @@ -261,11 +289,17 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { * Each data point may be any format you wish (depending on the `x` and `y` accessor props), * but by default, an object with x and y properties is expected. * - * Note: Not compatible with legendComponent prop. - * * @example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} */ legendData?: any[]; + /** + * Defines a horizontal shift from the x coordinate. It should not be set manually. + */ + legendDx?: number; + /** + * Defines a vertical shift from the y coordinate. It should not be set manually. + */ + legendDy?: number; /** * The orientation prop takes a string that defines whether legend data * are displayed in a row or column. When orientation is "horizontal", @@ -274,11 +308,12 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { * and text-wrapping is not currently supported, so "vertical" * orientation is both the default setting and recommended for * displaying many series of data. - * - * Note: May need to set legendHeight and legendWidth in order to position properly. - * Not compatible with legendComponent prop. */ legendOrientation?: 'horizontal' | 'vertical'; + /** + * The legend position relation to the donut chart. Valid values are 'bottom' and 'right' + */ + legendPosition?: 'bottom' | 'right'; /** * The labelRadius prop defines the radius of the arc that will be used for positioning each slice label. * If this prop is not set, the label radius will default to the radius of the pie + label padding. @@ -324,7 +359,7 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { */ sharedEvents?: any; /** - * This will show the static, unused portion of the donut chart + * This will show the static, unused portion of the donut chart. It should not be set manually. */ showStatic?: boolean; /** @@ -356,9 +391,27 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { */ style?: VictoryStyleInterface; /** - * The subtitle for the donut chart + * The subtitle for the donut chart label */ subTitle?: string; + /** + * The label component to render the chart subTitle. + * + * Note: Default label properties may be applied + */ + subTitleComponent?: React.ReactElement; + /** + * Defines a horizontal shift from the x coordinate. It should not be set manually. + */ + subTitleDx?: number; + /** + * Defines a vertical shift from the y coordinate. It should not be set manually. + */ + subTitleDy?: number; + /** + * The orientation of the donut chart in relation to the legend. Valid values are 'bottom', 'center', and 'right' + */ + subTitlePosition?: 'bottom' | 'center' | 'right'; /** * The theme prop takes a style object with nested data, labels, and parent objects. * You can create this object yourself, or you can use a theme provided by @@ -384,7 +437,7 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { */ themeVariant?: string; /** - * The title for the donut chart + * The title for the donut chart label */ title?: string; /** @@ -402,7 +455,10 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { * height of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of * pixels will depend on the size of the container the chart is rendered into. * - * Note: innerRadius may need to be set when using this property. + * Note: When adding a legend, width (the overall SVG width) may need to be larger than donutWidth (the donut size) + * in order to accommodate the extra legend. + * + * Typically, the parent container is set to the same width in order to maintain the aspect ratio. */ width?: number; /** @@ -431,29 +487,20 @@ export interface ChartDonutUtilizationProps extends ChartPieProps { export const ChartDonutUtilization: React.FunctionComponent = ({ data, - donutDx = 0, - donutDy = 0, - donutOrientation = 'left', - legendComponent, - legendData, - legendOrientation = DonutUtilizationStyles.legend.orientation as ChartDonutUtilizationLabelOrientation, showStatic = true, standalone = true, - subTitle, themeColor, themeVariant, thresholds, - title, x, y, // destructure last theme = getDonutUtilizationTheme(themeColor, themeVariant), - donutHeight = theme.pie.height, - donutWidth = theme.pie.width, height = theme.pie.height, - innerRadius = ((donutHeight || donutWidth) - 34) / 2, width = theme.pie.width, + donutHeight = Math.min(height, width), + donutWidth = Math.min(height, width, donutHeight), ...rest }: ChartDonutUtilizationProps) => { // Returns computed data representing pie chart slices @@ -487,41 +534,6 @@ export const ChartDonutUtilization: React.FunctionComponent { - if (legendComponent) { - return legendComponent; - } - if (legendData) { - return ( - - ); - } - return null; - }; - // Returns theme based on threshold and current value const getThresholdTheme = () => { const newTheme = { ...theme }; @@ -543,51 +555,16 @@ export const ChartDonutUtilization: React.FunctionComponent - - 0 ? innerRadius : 0} - origin={getChartOrigin({ - chartDx: donutDx, - chartDy: donutDy, - chartHeight: donutHeight, - chartWidth: donutWidth, - chartOrientation: donutOrientation, - height, - width - })} + donutHeight={donutHeight} + donutWidth={donutWidth} + height={height} standalone={false} theme={getThresholdTheme()} - width={donutWidth} + width={width} {...rest} /> @@ -596,15 +573,13 @@ export const ChartDonutUtilization: React.FunctionComponent {chart} - {getLegend()} ) : ( {chart} - {getLegend()} ); }; -// Note: ChartPie.role must be hoisted -hoistNonReactStatics(ChartDonutUtilization, ChartPie); +// Note: ChartDonut.role must be hoisted +hoistNonReactStatics(ChartDonutUtilization, ChartDonut); diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/__snapshots__/ChartDonutThreshold.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/__snapshots__/ChartDonutThreshold.test.tsx.snap index d0248e98d5e..4f4666aae4d 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/__snapshots__/ChartDonutThreshold.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/__snapshots__/ChartDonutThreshold.test.tsx.snap @@ -14,7 +14,7 @@ exports[`Chart 1`] = ` ] } height={230} - innerRadius={98} + labels={Array []} origin={ Object { "x": 115, @@ -27,9 +27,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -55,9 +56,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -103,9 +105,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -129,9 +132,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -209,9 +213,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -235,9 +240,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -252,9 +258,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -279,9 +286,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -290,9 +298,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -322,9 +331,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -351,7 +361,8 @@ exports[`Chart 1`] = ` "#EDEDED", "#D2D2D2", "#BBBBBB", - "#0066ff", + "#519de9", + "#004b95", ], "height": 230, "padAngle": 1, @@ -375,9 +386,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -402,9 +414,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -441,9 +454,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -493,7 +507,7 @@ exports[`Chart 2`] = ` ] } height={230} - innerRadius={98} + labels={Array []} origin={ Object { "x": 115, @@ -506,9 +520,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -534,9 +549,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -582,9 +598,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -608,9 +625,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -688,9 +706,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -714,9 +733,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -731,9 +751,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -758,9 +779,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -769,9 +791,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -801,9 +824,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -830,7 +854,8 @@ exports[`Chart 2`] = ` "#EDEDED", "#D2D2D2", "#BBBBBB", - "#0066ff", + "#519de9", + "#004b95", ], "height": 230, "padAngle": 1, @@ -854,9 +879,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -881,9 +907,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -920,9 +947,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -966,29 +994,29 @@ exports[`renders component data 1`] = ` `; diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/__snapshots__/ChartDonutUtilization.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/__snapshots__/ChartDonutUtilization.test.tsx.snap index 31cd7c1e016..f7f12c93152 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/__snapshots__/ChartDonutUtilization.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/__snapshots__/ChartDonutUtilization.test.tsx.snap @@ -5,23 +5,6 @@ exports[`Chart 1`] = ` height={230} width={230} > - - - `; diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/examples/ChartDonutUtilization.md b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/examples/ChartDonutUtilization.md index 83c9a08756d..18e123011ef 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/examples/ChartDonutUtilization.md +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/examples/ChartDonutUtilization.md @@ -17,7 +17,7 @@ import { ChartDonutUtilization } from '@patternfly/react-charts';
datum.x ? `${datum.x} - ${datum.y}%` : null} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} subTitle="of 100 GBps" title="75%" /> @@ -58,11 +58,12 @@ class UtilizationChart extends React.Component { const { spacer, used } = this.state; return (
-
+
datum.x ? `${datum.x} - ${datum.y}%` : null} - legendData={[{ name: `GBps capacity - ${spacer}${used}%` }, { name: 'Unused' }]} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: ${spacer}${used}%` }, { name: 'Unused' }]} + legendOrientation="vertical" subTitle="of 100 GBps" title={`${used}%`} thresholds={[{ value: 60 }, { value: 90 }]} @@ -108,17 +109,21 @@ class UtilizationChart extends React.Component { const { spacer, used } = this.state; return (
-
+
datum.x ? `${datum.x} - ${datum.y}%` : null} - legendData={[{ name: `GBps capacity - ${spacer}${used}%` }, { name: 'Unused' }]} + data={{ x: 'Storage capacity', y: used }} + donutHeight={230} + height={300} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: ${spacer}${used}%` }, { name: 'Unused' }]} + legendOrientation="vertical" + legendPosition="bottom" subTitle="of 100 GBps" title={`${used}%`} themeColor={ChartThemeColor.green} themeVariant={ChartThemeVariant.light} thresholds={[{ value: 60 }, { value: 90 }]} - width={435} + width={230} />
@@ -133,15 +138,14 @@ import React from 'react'; import { ChartDonutUtilization } from '@patternfly/react-charts';
-
+
datum.x ? `${datum.x} - ${datum.y}%` : null} - legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} - legendOrientation="horizontal" - legendWidth={282} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: 45%` }, { name: 'Unused' }]} + legendPosition="bottom" subTitle="of 100 GBps" title="45%" thresholds={[{ value: 60 }, { value: 90 }]} @@ -151,42 +155,20 @@ import { ChartDonutUtilization } from '@patternfly/react-charts';
``` -## Simple donut utilization chart with left-aligned legend -```js -import React from 'react'; -import { ChartDonutUtilization } from '@patternfly/react-charts'; - -
-
- datum.x ? `${datum.x} - ${datum.y}%` : null} - legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]} - subTitle="of 100 GBps" - title="45%" - thresholds={[{ value: 60 }, { value: 90 }]} - width={425} - /> -
-
-``` - ## Donut utilization chart with static thresholds ```js import React from 'react'; import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts';
-
+
datum.x ? datum.x : null} - width={475} > datum.x ? `${datum.x} - ${datum.y}%` : null} + data={{ x: 'Storage capacity', y: 45 }} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} subTitle="of 100 GBps" title="45%" /> @@ -223,16 +205,17 @@ class ThresholdChart extends React.Component { const { used } = this.state; return (
-
+
datum.x ? datum.x : null} - width={492} + width={500} > datum.x ? `${datum.x} - ${datum.y}%` : null} - legendData={[{ name: `GBps capacity - ${used}%` }, { name: 'Warning threshold at - 60%' }, { name: 'Danger threshold at - 90%' }]} + data={{ x: 'Storage capacity', y: used }} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: ${used}%` }, { name: 'Warning threshold at 60%' }, { name: 'Danger threshold at 90%' }]} + legendOrientation="vertical" subTitle="of 100 GBps" title={`${used}%`} thresholds={[{ value: 60 }, { value: 90 }]} @@ -245,7 +228,7 @@ class ThresholdChart extends React.Component { } ``` -## Green donut utilization chart with static thresholds and right-aligned legend +## Green donut utilization chart with static thresholds and right-aligned (custom) legend ```js import React from 'react'; import { ChartDonutThreshold, ChartDonutUtilization, ChartThemeColor, ChartThemeVariant } from '@patternfly/react-charts'; @@ -273,16 +256,19 @@ class ThresholdChart extends React.Component { const { used } = this.state; return (
-
+
datum.x ? datum.x : null} - width={492} + legendPosition="bottom" + width={230} > datum.x ? `${datum.x} - ${datum.y}%` : null} - legendData={[{ name: `GBps capacity - ${used}%` }, { name: 'Warning threshold at - 60%' }, { name: 'Danger threshold at - 90%' }]} + data={{ x: 'Storage capacity', y: used }} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: ${used}%` }, { name: 'Warning threshold at 60%' }, { name: 'Danger threshold at 90%' }]} + legendOrientation="vertical" subTitle="of 100 GBps" title={`${used}%`} themeColor={ChartThemeColor.green} @@ -303,45 +289,274 @@ import React from 'react'; import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts';
-
+
+ datum.x ? datum.x : null} + legendPosition="bottom" + width={675} + > + datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: 45%` }, { name: 'Warning threshold at 60%' }, { name: 'Danger threshold at 90%' }]} + subTitle="of 100 GBps" + title="45%" + /> + +
+
+``` + +## Small donut utilization chart +```js +import React from 'react'; +import { ChartDonutUtilization } from '@patternfly/react-charts'; + +
+
+ datum.x ? `${datum.x}: ${datum.y}%` : null} + subTitle="of 100 GBps" + title="75%" + width={150} + /> +
+
+``` + +## Small donut utilization chart with right-aligned legend +```js +import React from 'react'; +import { ChartDonutUtilization } from '@patternfly/react-charts'; + +class UtilizationChart extends React.Component { + constructor(props) { + super(props); + this.state = { + spacer: '', + used: 0 + }; + } + + componentDidMount() { + this.interval = setInterval(() => { + const { used } = this.state; + const val = (used + 10) % 100; + this.setState({ + spacer: val < 10 ? ' ' : '', + used: val + }); + }, 1000); + } + + componentWillUnmount() { + clearInterval(this.interval); + } + + render() { + const { spacer, used } = this.state; + return ( +
+
+ datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: ${spacer}${used}%` }, { name: 'Unused' }]} + legendOrientation="vertical" + subTitle="of 100 GBps" + title={`${used}%`} + thresholds={[{ value: 60 }, { value: 90 }]} + width={350} + /> +
+
+ ); + } +} +``` + +## Small donut utilization chart with right-aligned legend and bottom-aligned subtitle +```js +import React from 'react'; +import { ChartDonutUtilization } from '@patternfly/react-charts'; + +
+
+ datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: 45%` }, { name: 'Unused' }]} + legendOrientation="vertical" + subTitle="of 100 GBps" + subTitlePosition="bottom" + title="45%" + thresholds={[{ value: 60 }, { value: 90 }]} + width={350} + /> +
+
+``` + +## Small donut utilization chart with bottom-aligned legend and right-aligned subtitle +```js +import React from 'react'; +import { ChartDonutUtilization } from '@patternfly/react-charts'; + +
+
+ datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: 45%` }, { name: 'Unused' }]} + legendPosition="bottom" + subTitle="of 100 GBps" + subTitlePosition="right" + title="45%" + thresholds={[{ value: 60 }, { value: 90 }]} + width={350} + /> +
+
+``` + +## Small donut utilization chart with static thresholds +```js +import React from 'react'; +import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts'; + +
+
+ datum.x ? datum.x : null} + width={175} + > + datum.x ? `${datum.x}: ${datum.y}%` : null} + subTitle="of 100 GBps" + title="45%" + /> + +
+
+``` + +## Small donut utilization chart with static thresholds and right-aligned legend +```js +import React from 'react'; +import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts'; + +class ThresholdChart extends React.Component { + constructor(props) { + super(props); + this.state = { + used: 0 + }; + } + + componentDidMount() { + this.interval = setInterval(() => { + const { used } = this.state; + this.setState({ used: (used + 10) % 100 }); + }, 1000); + } + + componentWillUnmount() { + clearInterval(this.interval); + } + + render() { + const { used } = this.state; + return ( +
+
+ datum.x ? datum.x : null} + width={425} + > + datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: ${used}%` }, { name: 'Warning threshold at 60%' }, { name: 'Danger threshold at 90%' }]} + legendOrientation="vertical" + subTitle="of 100 GBps" + title={`${used}%`} + thresholds={[{ value: 60 }, { value: 90 }]} + /> + +
+
+ ); + } +} +``` + +## Small donut utilization chart with static thresholds with right-aligned legend and bottom-aligned subtitle +```js +import React from 'react'; +import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts'; + +
+
datum.x ? datum.x : null} - width={275} + subTitlePosition="bottom" + width={425} > datum.x ? `${datum.x} - ${datum.y}%` : null} - legendData={[{ name: `GBps capacity - 45%` }, { name: 'Warning threshold at - 60%' }, { name: 'Danger threshold at - 90%' }]} + data={{ x: 'Storage capacity', y: 45 }} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: 45%` }, { name: 'Warning threshold at 60%' }, { name: 'Danger threshold at 90%' }]} + legendOrientation="vertical" subTitle="of 100 GBps" title="45%" + thresholds={[{ value: 60 }, { value: 90 }]} />
``` -## Donut utilization chart with static thresholds and left-aligned legend +## Small donut utilization chart with static thresholds with bottom-aligned legend and right-aligned subtitle ```js import React from 'react'; import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts';
-
+
datum.x ? datum.x : null} - width={475} + legendPosition="bottom" + subTitlePosition="right" + width={675} > datum.x ? `${datum.x} - ${datum.y}%` : null} - legendData={[{ name: `GBps capacity - 45%` }, { name: 'Warning threshold at - 60%' }, { name: 'Danger threshold at - 90%' }]} + data={{ x: 'Storage capacity', y: 45 }} + labels={datum => datum.x ? `${datum.x}: ${datum.y}%` : null} + legendData={[{ name: `Storage capacity: 45%` }, { name: 'Warning threshold at 60%' }, { name: 'Danger threshold at 90%' }]} subTitle="of 100 GBps" title="45%" + thresholds={[{ value: 60 }, { value: 90 }]} />
diff --git a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/examples/chart-donut-utilization.scss b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/examples/chart-donut-utilization.scss index 13de880e58a..1c89f1d88ad 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/examples/chart-donut-utilization.scss +++ b/packages/patternfly-4/react-charts/src/components/ChartDonutUtilization/examples/chart-donut-utilization.scss @@ -1,18 +1,43 @@ .ws-preview { & > * { - .donut-threshold-chart-horz { + .donut-threshold-chart { height: 230px; - width: 492px; + width: 230px; + } + + .donut-threshold-chart-sm { + height: 175px; + width: 175px; + } + + .donut-threshold-chart-legend-bottom-horz { + height: 275px; + width: 675px; } - .donut-threshold-chart-horz-sm { + .donut-threshold-chart-legend-bottom-vert { + height: 350px; + width: 230px; + } + + .donut-threshold-chart-legend-right { height: 230px; - width: 475px; + width: 500px; + } + + .donut-threshold-chart-legend-right-sm { + height: 175px; + width: 425px; + } + + .donut-threshold-chart-legend-right-subtitle-bottom-sm { + height: 200px; + width: 425px; } - .donut-threshold-chart-vert { - height: 325px; - width: 275px; + .donut-threshold-chart-legend-bottom-subtitle-right-sm { + height: 225px; + width: 675px; } .donut-utilization-chart { @@ -20,19 +45,39 @@ width: 230px; } - .donut-utilization-chart-horz { + .donut-utilization-chart-sm { + height: 150px; + width: 150px; + } + + .donut-utilization-chart-legend-bottom-horz { + height: 275px; + width: 300px; + } + + .donut-utilization-chart-legend-bottom-vert { + height: 300px; + width: 230px; + } + + .donut-utilization-chart-legend-right { height: 230px; width: 435px; } - .donut-utilization-chart-horz-sm { - height: 230px; - width: 425px; + .donut-utilization-chart-legend-right-sm { + height: 150px; + width: 350px; } - .donut-utilization-chart-vert { - height: 275px; - width: 300px; + .donut-utilization-chart-legend-bottom-subtitle-right-sm { + height: 200px; + width: 350px; + } + + .donut-utilization-chart-legend-right-subtitle-bottom-sm { + height: 175px; + width: 350px; } } } diff --git a/packages/patternfly-4/react-charts/src/components/ChartGroup/__snapshots__/ChartGroup.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartGroup/__snapshots__/ChartGroup.test.tsx.snap index 2104c522fa1..a4fb4a12410 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartGroup/__snapshots__/ChartGroup.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartGroup/__snapshots__/ChartGroup.test.tsx.snap @@ -19,9 +19,10 @@ exports[`ChartGroup 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -47,9 +48,10 @@ exports[`ChartGroup 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -95,9 +97,10 @@ exports[`ChartGroup 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -121,9 +124,10 @@ exports[`ChartGroup 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -201,9 +205,10 @@ exports[`ChartGroup 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -227,9 +232,10 @@ exports[`ChartGroup 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -244,9 +250,10 @@ exports[`ChartGroup 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -271,9 +278,10 @@ exports[`ChartGroup 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -282,9 +290,10 @@ exports[`ChartGroup 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -314,9 +323,10 @@ exports[`ChartGroup 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -341,9 +351,10 @@ exports[`ChartGroup 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -366,9 +377,10 @@ exports[`ChartGroup 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -393,9 +405,10 @@ exports[`ChartGroup 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -432,9 +445,10 @@ exports[`ChartGroup 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -487,9 +501,10 @@ exports[`ChartGroup 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -515,9 +530,10 @@ exports[`ChartGroup 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -563,9 +579,10 @@ exports[`ChartGroup 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -589,9 +606,10 @@ exports[`ChartGroup 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -669,9 +687,10 @@ exports[`ChartGroup 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -695,9 +714,10 @@ exports[`ChartGroup 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -712,9 +732,10 @@ exports[`ChartGroup 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -739,9 +760,10 @@ exports[`ChartGroup 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -750,9 +772,10 @@ exports[`ChartGroup 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -782,9 +805,10 @@ exports[`ChartGroup 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -809,9 +833,10 @@ exports[`ChartGroup 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -834,9 +859,10 @@ exports[`ChartGroup 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -861,9 +887,10 @@ exports[`ChartGroup 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -900,9 +927,10 @@ exports[`ChartGroup 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -956,9 +984,10 @@ exports[`renders container children 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -984,9 +1013,10 @@ exports[`renders container children 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1032,9 +1062,10 @@ exports[`renders container children 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1058,9 +1089,10 @@ exports[`renders container children 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1138,9 +1170,10 @@ exports[`renders container children 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1164,9 +1197,10 @@ exports[`renders container children 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1181,9 +1215,10 @@ exports[`renders container children 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1208,9 +1243,10 @@ exports[`renders container children 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1219,9 +1255,10 @@ exports[`renders container children 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1251,9 +1288,10 @@ exports[`renders container children 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1278,9 +1316,10 @@ exports[`renders container children 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1303,9 +1342,10 @@ exports[`renders container children 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1330,9 +1370,10 @@ exports[`renders container children 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1369,9 +1410,10 @@ exports[`renders container children 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx index 997ca88d5f9..fa91d6e25a1 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx +++ b/packages/patternfly-4/react-charts/src/components/ChartLabel/ChartLabel.tsx @@ -1,12 +1,12 @@ import * as React from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; +import { defaults } from 'lodash'; import { StringOrNumberOrCallback, - // TextAnchorType, - // VerticalAnchorType, VictoryLabel, VictoryLabelProps } from 'victory'; +import { LabelStyles } from '../ChartTheme/themes/label-theme'; export enum ChartLabelDirection { rtl = 'rtl', @@ -132,7 +132,7 @@ export interface ChartLabelProps extends VictoryLabelProps { /** * The style prop applies CSS properties to the rendered `` element. */ - style?: React.CSSProperties; + style?: React.CSSProperties; // Todo: style accepts arrays, but TS definition is wrong /** * The text prop defines the text ChartLabel will render. The text prop may be given as a string, number, a function * of datum, or an array of any of these. Strings may include newline characters, which ChartLabel will split into @@ -166,8 +166,14 @@ export interface ChartLabelProps extends VictoryLabelProps { y?: number; }; -export const ChartLabel: React.FunctionComponent = (props: ChartLabelProps) => - ; +export const ChartLabel: React.FunctionComponent = ({ + style, + ...rest +}: ChartLabelProps) => { + const applyDefaultStyle = (customStyle: React.CSSProperties) => defaults(customStyle, LabelStyles); + const newStyle = Array.isArray(style) ? style.map(applyDefaultStyle) : applyDefaultStyle(style); + return ; +} // Note: VictoryLabel.role must be hoisted hoistNonReactStatics(ChartLabel, VictoryLabel); diff --git a/packages/patternfly-4/react-charts/src/components/ChartLabel/__snapshots__/ChartLabel.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartLabel/__snapshots__/ChartLabel.test.tsx.snap index f121d850d2e..11331b6faf1 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLabel/__snapshots__/ChartLabel.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartLabel/__snapshots__/ChartLabel.test.tsx.snap @@ -5,6 +5,11 @@ exports[`Chart 1`] = ` capHeight={0.71} direction="inherit" lineHeight={1} + style={ + Object { + "fontFamily": "overpass,overpass,open sans,-apple-system,blinkmacsystemfont,Segoe UI,roboto,Helvetica Neue,arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol", + } + } textComponent={} tspanComponent={} /> @@ -15,6 +20,11 @@ exports[`Chart 2`] = ` capHeight={0.71} direction="inherit" lineHeight={1} + style={ + Object { + "fontFamily": "overpass,overpass,open sans,-apple-system,blinkmacsystemfont,Segoe UI,roboto,Helvetica Neue,arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol", + } + } textComponent={} tspanComponent={} /> @@ -25,6 +35,11 @@ exports[`renders component text 1`] = ` capHeight={0.71} direction="inherit" lineHeight={1} + style={ + Object { + "fontFamily": "overpass,overpass,open sans,-apple-system,blinkmacsystemfont,Segoe UI,roboto,Helvetica Neue,arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol", + } + } text="This is a test" textComponent={} tspanComponent={} diff --git a/packages/patternfly-4/react-charts/src/components/ChartLegend/__snapshots__/ChartLegend.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartLegend/__snapshots__/ChartLegend.test.tsx.snap index 7998e6949f5..bc6eb761fce 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLegend/__snapshots__/ChartLegend.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartLegend/__snapshots__/ChartLegend.test.tsx.snap @@ -15,9 +15,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -43,9 +44,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -91,9 +93,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -117,9 +120,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -197,9 +201,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -223,9 +228,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -240,9 +246,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -267,9 +274,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -278,9 +286,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -310,9 +319,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -337,9 +347,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -362,9 +373,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -389,9 +401,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -428,9 +441,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -490,9 +504,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -518,9 +533,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -566,9 +582,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -592,9 +609,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -672,9 +690,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -698,9 +717,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -715,9 +735,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -742,9 +763,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -753,9 +775,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -785,9 +808,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -812,9 +836,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -837,9 +862,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -864,9 +890,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -903,9 +930,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -963,9 +991,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -991,9 +1020,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1039,9 +1069,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1065,9 +1096,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1145,9 +1177,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1171,9 +1204,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1188,9 +1222,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1215,9 +1250,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1226,9 +1262,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1258,9 +1295,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1285,9 +1323,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1310,9 +1349,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1337,9 +1377,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1376,9 +1417,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1438,9 +1480,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1466,9 +1509,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1514,9 +1558,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1540,9 +1585,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1620,9 +1666,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1646,9 +1693,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1663,9 +1711,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1690,9 +1739,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1701,9 +1751,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1733,9 +1784,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1760,9 +1812,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1785,9 +1838,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1812,9 +1866,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1851,9 +1906,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1911,9 +1967,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1939,9 +1996,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1987,9 +2045,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2013,9 +2072,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2093,9 +2153,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2119,9 +2180,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2136,9 +2198,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2163,9 +2226,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2174,9 +2238,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2206,9 +2271,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2233,9 +2299,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2258,9 +2325,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2285,9 +2353,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2324,9 +2393,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2387,9 +2457,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2415,9 +2486,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2463,9 +2535,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2489,9 +2562,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2569,9 +2643,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2595,9 +2670,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2612,9 +2688,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2639,9 +2716,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2650,9 +2728,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2682,9 +2761,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2709,9 +2789,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2734,9 +2815,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2761,9 +2843,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2800,9 +2883,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartLine/__snapshots__/ChartLine.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartLine/__snapshots__/ChartLine.test.tsx.snap index 354185f1270..513c01c71dc 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartLine/__snapshots__/ChartLine.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartLine/__snapshots__/ChartLine.test.tsx.snap @@ -42,9 +42,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -70,9 +71,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -118,9 +120,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -144,9 +147,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -224,9 +228,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -250,9 +255,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -267,9 +273,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -294,9 +301,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -305,9 +313,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -337,9 +346,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -364,9 +374,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -389,9 +400,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -416,9 +428,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -455,9 +468,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -533,9 +547,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -561,9 +576,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -609,9 +625,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -635,9 +652,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -715,9 +733,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -741,9 +760,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -758,9 +778,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -785,9 +806,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -796,9 +818,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -828,9 +851,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -855,9 +879,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -880,9 +905,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -907,9 +933,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -946,9 +973,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3139,9 +3167,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3167,9 +3196,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3215,9 +3245,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3241,9 +3272,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3321,9 +3353,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3347,9 +3380,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3364,9 +3398,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3391,9 +3426,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3402,9 +3438,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -3434,9 +3471,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3461,9 +3499,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -3486,9 +3525,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3513,9 +3553,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3552,9 +3593,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/__snapshots__/ChartPie.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartPie/__snapshots__/ChartPie.test.tsx.snap index 7b363af66bf..de7f00dd387 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPie/__snapshots__/ChartPie.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartPie/__snapshots__/ChartPie.test.tsx.snap @@ -47,9 +47,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -75,9 +76,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -123,9 +125,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -149,9 +152,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -229,9 +233,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -255,9 +260,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -272,9 +278,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -299,9 +306,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -310,9 +318,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -342,9 +351,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -369,9 +379,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -394,9 +405,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -421,9 +433,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -460,9 +473,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -502,9 +516,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -530,9 +545,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -578,9 +594,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -604,9 +621,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -684,9 +702,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -710,9 +729,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -727,9 +747,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -754,9 +775,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -765,9 +787,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -797,9 +820,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -824,9 +848,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -849,9 +874,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -876,9 +902,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -915,9 +942,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -998,9 +1026,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1026,9 +1055,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1074,9 +1104,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1100,9 +1131,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1180,9 +1212,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1206,9 +1239,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1223,9 +1257,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1250,9 +1285,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1261,9 +1297,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1293,9 +1330,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1320,9 +1358,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1345,9 +1384,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1372,9 +1412,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1411,9 +1452,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1453,9 +1495,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1481,9 +1524,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1529,9 +1573,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1555,9 +1600,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1635,9 +1681,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1661,9 +1708,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1678,9 +1726,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1705,9 +1754,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1716,9 +1766,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1748,9 +1799,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1775,9 +1827,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1800,9 +1853,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1827,9 +1881,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1866,9 +1921,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1942,9 +1998,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1970,9 +2027,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2018,9 +2076,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2044,9 +2103,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2124,9 +2184,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2150,9 +2211,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2167,9 +2229,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2194,9 +2257,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2205,9 +2269,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2237,9 +2302,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2264,9 +2330,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2289,9 +2356,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2316,9 +2384,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2355,9 +2424,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2397,9 +2467,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2425,9 +2496,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2473,9 +2545,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2499,9 +2572,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2579,9 +2653,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2605,9 +2680,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2622,9 +2698,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2649,9 +2726,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2660,9 +2738,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2692,9 +2771,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2719,9 +2799,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2744,9 +2825,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2771,9 +2853,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2810,9 +2893,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartPie/examples/ChartPie.md b/packages/patternfly-4/react-charts/src/components/ChartPie/examples/ChartPie.md index e7248c4c7d7..fc7f0da595c 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPie/examples/ChartPie.md +++ b/packages/patternfly-4/react-charts/src/components/ChartPie/examples/ChartPie.md @@ -16,14 +16,14 @@ import { ChartLegend, ChartPie } from '@patternfly/react-charts';
-
+
`${datum.x}: ${datum.y}`} />
- `${datum.x}: ${datum.y}`} - themeColor={ChartThemeColor.multi} - themeVariant={ChartThemeVariant.light} - /> +
+ `${datum.x}: ${datum.y}`} + themeColor={ChartThemeColor.multi} + themeVariant={ChartThemeVariant.light} + /> +
* { .pie-chart-container { - height: 230px; - width: 230px; + display: flex; + justify-content: center; + width: 300px; } .pie-chart-inline { display: inline-flex; } + + .pie-chart-legend-bottom { + height: 230px; + width: 230px; + } + + .pie-chart-legend-right { + height: 230px; + width: 230px; + } } } diff --git a/packages/patternfly-4/react-charts/src/components/ChartPoint/__snapshots__/ChartPoint.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartPoint/__snapshots__/ChartPoint.test.tsx.snap index 128be439b2a..0bfc6f1c148 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartPoint/__snapshots__/ChartPoint.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartPoint/__snapshots__/ChartPoint.test.tsx.snap @@ -15,9 +15,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -43,9 +44,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -91,9 +93,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -117,9 +120,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -197,9 +201,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -223,9 +228,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -240,9 +246,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -267,9 +274,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -278,9 +286,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -310,9 +319,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -337,9 +347,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -362,9 +373,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -389,9 +401,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -428,9 +441,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -490,9 +504,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -518,9 +533,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -566,9 +582,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -592,9 +609,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -672,9 +690,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -698,9 +717,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -715,9 +735,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -742,9 +763,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -753,9 +775,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -785,9 +808,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -812,9 +836,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -837,9 +862,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -864,9 +890,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -903,9 +930,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -963,9 +991,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -991,9 +1020,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1039,9 +1069,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1065,9 +1096,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1145,9 +1177,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1171,9 +1204,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1188,9 +1222,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1215,9 +1250,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1226,9 +1262,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1258,9 +1295,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1285,9 +1323,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1310,9 +1349,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1337,9 +1377,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1376,9 +1417,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1438,9 +1480,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1466,9 +1509,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1514,9 +1558,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1540,9 +1585,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1620,9 +1666,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1646,9 +1693,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1663,9 +1711,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1690,9 +1739,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1701,9 +1751,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1733,9 +1784,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1760,9 +1812,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1785,9 +1838,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1812,9 +1866,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1851,9 +1906,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1911,9 +1967,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1939,9 +1996,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1987,9 +2045,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2013,9 +2072,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2093,9 +2153,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2119,9 +2180,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2136,9 +2198,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2163,9 +2226,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2174,9 +2238,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2206,9 +2271,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2233,9 +2299,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2258,9 +2325,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2285,9 +2353,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2324,9 +2393,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2390,9 +2460,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2418,9 +2489,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2466,9 +2538,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2492,9 +2565,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2572,9 +2646,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2598,9 +2673,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2615,9 +2691,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2642,9 +2719,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2653,9 +2731,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -2685,9 +2764,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2712,9 +2792,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -2737,9 +2818,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2764,9 +2846,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -2803,9 +2886,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartStack/__snapshots__/ChartStack.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartStack/__snapshots__/ChartStack.test.tsx.snap index 25d30595144..a3e8e30bc08 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartStack/__snapshots__/ChartStack.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartStack/__snapshots__/ChartStack.test.tsx.snap @@ -18,9 +18,10 @@ exports[`Chart 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -46,9 +47,10 @@ exports[`Chart 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -94,9 +96,10 @@ exports[`Chart 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -120,9 +123,10 @@ exports[`Chart 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -200,9 +204,10 @@ exports[`Chart 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -226,9 +231,10 @@ exports[`Chart 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -243,9 +249,10 @@ exports[`Chart 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -270,9 +277,10 @@ exports[`Chart 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -281,9 +289,10 @@ exports[`Chart 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -313,9 +322,10 @@ exports[`Chart 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -340,9 +350,10 @@ exports[`Chart 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -365,9 +376,10 @@ exports[`Chart 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -392,9 +404,10 @@ exports[`Chart 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -431,9 +444,10 @@ exports[`Chart 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -485,9 +499,10 @@ exports[`Chart 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -513,9 +528,10 @@ exports[`Chart 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -561,9 +577,10 @@ exports[`Chart 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -587,9 +604,10 @@ exports[`Chart 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -667,9 +685,10 @@ exports[`Chart 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -693,9 +712,10 @@ exports[`Chart 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -710,9 +730,10 @@ exports[`Chart 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -737,9 +758,10 @@ exports[`Chart 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -748,9 +770,10 @@ exports[`Chart 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -780,9 +803,10 @@ exports[`Chart 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -807,9 +831,10 @@ exports[`Chart 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -832,9 +857,10 @@ exports[`Chart 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -859,9 +885,10 @@ exports[`Chart 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -898,9 +925,10 @@ exports[`Chart 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3094,9 +3122,10 @@ exports[`renders component data 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3122,9 +3151,10 @@ exports[`renders component data 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3170,9 +3200,10 @@ exports[`renders component data 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3196,9 +3227,10 @@ exports[`renders component data 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3276,9 +3308,10 @@ exports[`renders component data 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3302,9 +3335,10 @@ exports[`renders component data 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3319,9 +3353,10 @@ exports[`renders component data 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3346,9 +3381,10 @@ exports[`renders component data 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3357,9 +3393,10 @@ exports[`renders component data 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -3389,9 +3426,10 @@ exports[`renders component data 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3416,9 +3454,10 @@ exports[`renders component data 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -3441,9 +3480,10 @@ exports[`renders component data 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3468,9 +3508,10 @@ exports[`renders component data 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -3507,9 +3548,10 @@ exports[`renders component data 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/ChartTheme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/ChartTheme.ts index 6e03ac5d191..a17fb18e387 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/ChartTheme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/ChartTheme.ts @@ -30,10 +30,14 @@ export interface ChartThemeDefinitionInterface extends VictoryThemeDefinition { interface ChartThemeColorInterface { blue: string; + cyan: string; default: string; + gold: string; + gray: string; green: string; - grey: string; multi: string; + orange: string; + purple: string; } interface ChartThemeVariantInterface { @@ -44,10 +48,14 @@ interface ChartThemeVariantInterface { export const ChartThemeColor: ChartThemeColorInterface = { blue: 'blue', + cyan: 'cyan', default: 'blue', + gold: 'gold', + gray: 'gray', green: 'green', - grey: 'grey', - multi: 'multi' + multi: 'multi', + orange: 'orange', + purple: 'purple' }; export const ChartThemeVariant: ChartThemeVariantInterface = { diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/common-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/common-theme.ts new file mode 100644 index 00000000000..4efbedc5e8c --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/common-theme.ts @@ -0,0 +1,11 @@ +// TODO Replace label props with PF css when available + +// Common properties not included with Victory theme +export const CommonStyles = { + label: { + margin: 8 + }, + legend: { + margin: 16 + }, +}; diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/blue-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/blue-color-theme.ts index 446b06789a2..151882385f9 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/blue-color-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/blue-color-theme.ts @@ -1,6 +1,10 @@ /* eslint-disable camelcase */ import { - global_active_color_100, + chart_color_blue_100, + chart_color_blue_200, + chart_color_blue_300, + chart_color_blue_400, + chart_color_blue_500, global_active_color_200, global_active_color_300, global_Color_dark_200, @@ -15,12 +19,6 @@ const COLOR_AXIS_FILL = 'transparent'; const COLOR_AXIS_STROKE = '#D2D2D2'; const COLOR_FILL = global_active_color_200.value; const COLOR_LABEL = global_Color_light_100.value; -const COLOR_SCALE = [ - global_active_color_100.value, - global_active_color_200.value, - global_active_color_300.value, - '#0066ff' -]; const COLOR_STACK_STROKE = global_Color_dark_200.value; const COLOR_STROKE = global_active_color_300.value; const COLOR_TOOLTIP_FILL = '#151515'; @@ -28,6 +26,16 @@ const COLOR_TOOLTIP_STROKE = '#151515'; const COLOR_TOOLTIP_FLYOUT_FILL = '#EDEDED'; const COLOR_TOOLTIP_FLYOUT_STROKE = '#EDEDED'; +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_blue_300.value, + chart_color_blue_100.value, + chart_color_blue_500.value, + chart_color_blue_200.value, + chart_color_blue_400.value +]; + export const DarkBlueColorTheme = ColorTheme({ COLOR_AXIS_FILL, COLOR_AXIS_STROKE, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/grey-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/cyan-color-theme.ts similarity index 68% rename from packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/grey-color-theme.ts rename to packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/cyan-color-theme.ts index c9973711dd6..fa71c3ec2d9 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/grey-color-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/cyan-color-theme.ts @@ -1,5 +1,10 @@ /* eslint-disable camelcase */ import { + chart_color_cyan_100, + chart_color_cyan_200, + chart_color_cyan_300, + chart_color_cyan_400, + chart_color_cyan_500, global_active_color_200, global_active_color_300, global_Color_dark_200, @@ -14,7 +19,6 @@ const COLOR_AXIS_FILL = 'transparent'; const COLOR_AXIS_STROKE = '#D2D2D2'; const COLOR_FILL = global_active_color_200.value; const COLOR_LABEL = global_Color_light_100.value; -const COLOR_SCALE = ['#EDEDED', '#D2D2D2', '#BBBBBB']; const COLOR_STACK_STROKE = global_Color_dark_200.value; const COLOR_STROKE = global_active_color_300.value; const COLOR_TOOLTIP_FILL = '#151515'; @@ -22,7 +26,17 @@ const COLOR_TOOLTIP_STROKE = '#151515'; const COLOR_TOOLTIP_FLYOUT_FILL = '#EDEDED'; const COLOR_TOOLTIP_FLYOUT_STROKE = '#EDEDED'; -export const DarkGreyColorTheme = ColorTheme({ +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_cyan_300.value, + chart_color_cyan_100.value, + chart_color_cyan_500.value, + chart_color_cyan_200.value, + chart_color_cyan_400.value +]; + +export const DarkCyanColorTheme = ColorTheme({ COLOR_AXIS_FILL, COLOR_AXIS_STROKE, COLOR_FILL, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gold-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gold-color-theme.ts new file mode 100644 index 00000000000..97e2acb4c48 --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gold-color-theme.ts @@ -0,0 +1,51 @@ +/* eslint-disable camelcase */ +import { + chart_color_gold_100, + chart_color_gold_200, + chart_color_gold_300, + chart_color_gold_400, + chart_color_gold_500, + global_active_color_200, + global_active_color_300, + global_Color_dark_200, + global_Color_light_100 +} from '@patternfly/react-tokens'; +import { ColorTheme } from '../color-theme'; + +// TODO Replace values with PF css variable when available + +// Colors +const COLOR_AXIS_FILL = 'transparent'; +const COLOR_AXIS_STROKE = '#D2D2D2'; +const COLOR_FILL = global_active_color_200.value; +const COLOR_LABEL = global_Color_light_100.value; +const COLOR_STACK_STROKE = global_Color_dark_200.value; +const COLOR_STROKE = global_active_color_300.value; +const COLOR_TOOLTIP_FILL = '#151515'; +const COLOR_TOOLTIP_STROKE = '#151515'; +const COLOR_TOOLTIP_FLYOUT_FILL = '#EDEDED'; +const COLOR_TOOLTIP_FLYOUT_STROKE = '#EDEDED'; + +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_gold_300.value, + chart_color_gold_100.value, + chart_color_gold_500.value, + chart_color_gold_200.value, + chart_color_gold_400.value +]; + +export const DarkGoldColorTheme = ColorTheme({ + COLOR_AXIS_FILL, + COLOR_AXIS_STROKE, + COLOR_FILL, + COLOR_LABEL, + COLOR_SCALE, + COLOR_STACK_STROKE, + COLOR_STROKE, + COLOR_TOOLTIP_FILL, + COLOR_TOOLTIP_STROKE, + COLOR_TOOLTIP_FLYOUT_FILL, + COLOR_TOOLTIP_FLYOUT_STROKE +}); diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gray-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gray-color-theme.ts new file mode 100644 index 00000000000..f25d33f9c01 --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/gray-color-theme.ts @@ -0,0 +1,51 @@ +/* eslint-disable camelcase */ +import { + chart_color_black_100, + chart_color_black_200, + chart_color_black_300, + chart_color_black_400, + chart_color_black_500, + global_active_color_200, + global_active_color_300, + global_Color_dark_200, + global_Color_light_100 +} from '@patternfly/react-tokens'; +import { ColorTheme } from '../color-theme'; + +// TODO Replace values with PF css variable when available + +// Colors +const COLOR_AXIS_FILL = 'transparent'; +const COLOR_AXIS_STROKE = '#D2D2D2'; +const COLOR_FILL = global_active_color_200.value; +const COLOR_LABEL = global_Color_light_100.value; +const COLOR_STACK_STROKE = global_Color_dark_200.value; +const COLOR_STROKE = global_active_color_300.value; +const COLOR_TOOLTIP_FILL = '#151515'; +const COLOR_TOOLTIP_STROKE = '#151515'; +const COLOR_TOOLTIP_FLYOUT_FILL = '#EDEDED'; +const COLOR_TOOLTIP_FLYOUT_STROKE = '#EDEDED'; + +// Color variants +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_black_300.value, + chart_color_black_100.value, + chart_color_black_500.value, + chart_color_black_200.value, + chart_color_black_400.value +]; + +export const DarkGrayColorTheme = ColorTheme({ + COLOR_AXIS_FILL, + COLOR_AXIS_STROKE, + COLOR_FILL, + COLOR_LABEL, + COLOR_SCALE, + COLOR_STACK_STROKE, + COLOR_STROKE, + COLOR_TOOLTIP_FILL, + COLOR_TOOLTIP_STROKE, + COLOR_TOOLTIP_FLYOUT_FILL, + COLOR_TOOLTIP_FLYOUT_STROKE +}); diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/green-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/green-color-theme.ts index d29a2132cb2..c93afe4bff0 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/green-color-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/green-color-theme.ts @@ -1,10 +1,13 @@ /* eslint-disable camelcase */ import { + chart_color_green_100, + chart_color_green_200, + chart_color_green_300, + chart_color_green_400, + chart_color_green_500, global_active_color_200, global_active_color_300, global_Color_dark_200, - global_success_color_100, - global_success_color_200, global_Color_light_100 } from '@patternfly/react-tokens'; import { ColorTheme } from '../color-theme'; @@ -16,7 +19,6 @@ const COLOR_AXIS_FILL = 'transparent'; const COLOR_AXIS_STROKE = '#D2D2D2'; const COLOR_FILL = global_active_color_200.value; const COLOR_LABEL = global_Color_light_100.value; -const COLOR_SCALE = [global_success_color_100.value, global_success_color_200.value, '#59C768']; const COLOR_STACK_STROKE = global_Color_dark_200.value; const COLOR_STROKE = global_active_color_300.value; const COLOR_TOOLTIP_FILL = '#151515'; @@ -24,6 +26,16 @@ const COLOR_TOOLTIP_STROKE = '#151515'; const COLOR_TOOLTIP_FLYOUT_FILL = '#EDEDED'; const COLOR_TOOLTIP_FLYOUT_STROKE = '#EDEDED'; +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_green_300.value, + chart_color_green_100.value, + chart_color_green_500.value, + chart_color_green_200.value, + chart_color_green_400.value +]; + export const DarkGreenColorTheme = ColorTheme({ COLOR_AXIS_FILL, COLOR_AXIS_STROKE, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/multi-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/multi-color-theme.ts index ecc9ccb7cc3..21fc800421e 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/multi-color-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/multi-color-theme.ts @@ -1,5 +1,40 @@ /* eslint-disable camelcase */ import { + chart_color_blue_100, + chart_color_blue_200, + chart_color_blue_300, + chart_color_blue_400, + chart_color_blue_500, + chart_color_green_100, + chart_color_green_200, + chart_color_green_300, + chart_color_green_400, + chart_color_green_500, + chart_color_cyan_100, + chart_color_cyan_200, + chart_color_cyan_300, + chart_color_cyan_400, + chart_color_cyan_500, + chart_color_purple_100, + chart_color_purple_200, + chart_color_purple_300, + chart_color_purple_400, + chart_color_purple_500, + chart_color_gold_100, + chart_color_gold_200, + chart_color_gold_300, + chart_color_gold_400, + chart_color_gold_500, + chart_color_orange_100, + chart_color_orange_200, + chart_color_orange_300, + chart_color_orange_400, + chart_color_orange_500, + chart_color_black_100, + chart_color_black_200, + chart_color_black_300, + chart_color_black_400, + chart_color_black_500, global_active_color_200, global_active_color_300, global_Color_dark_200, @@ -14,7 +49,6 @@ const COLOR_AXIS_FILL = 'transparent'; const COLOR_AXIS_STROKE = '#D2D2D2'; const COLOR_FILL = global_active_color_200.value; const COLOR_LABEL = global_Color_light_100.value; -const COLOR_SCALE = ['#39A5DC', '#9C92F5', '#59C768', '#FFD47D']; const COLOR_STACK_STROKE = global_Color_dark_200.value; const COLOR_STROKE = global_active_color_300.value; const COLOR_TOOLTIP_FILL = '#151515'; @@ -22,6 +56,46 @@ const COLOR_TOOLTIP_STROKE = '#151515'; const COLOR_TOOLTIP_FLYOUT_FILL = '#EDEDED'; const COLOR_TOOLTIP_FLYOUT_STROKE = '#EDEDED'; +// The color order below improves the color contrast in unordered charts +// See https://github.com/patternfly/patternfly-next/issues/1551 +const COLOR_SCALE = [ + chart_color_blue_300.value, + chart_color_gold_300.value, + chart_color_green_300.value, + chart_color_purple_300.value, + chart_color_orange_300.value, + chart_color_cyan_300.value, + chart_color_black_300.value, + chart_color_blue_100.value, + chart_color_gold_500.value, + chart_color_green_100.value, + chart_color_purple_500.value, + chart_color_orange_100.value, + chart_color_cyan_500.value, + chart_color_black_100.value, + chart_color_blue_500.value, + chart_color_gold_100.value, + chart_color_green_500.value, + chart_color_purple_100.value, + chart_color_orange_500.value, + chart_color_cyan_100.value, + chart_color_black_500.value, + chart_color_blue_200.value, + chart_color_gold_400.value, + chart_color_green_200.value, + chart_color_purple_400.value, + chart_color_orange_200.value, + chart_color_cyan_400.value, + chart_color_black_200.value, + chart_color_blue_400.value, + chart_color_gold_200.value, + chart_color_green_400.value, + chart_color_purple_200.value, + chart_color_orange_400.value, + chart_color_cyan_200.value, + chart_color_black_400.value +]; + export const DarkMultiColorTheme = ColorTheme({ COLOR_AXIS_FILL, COLOR_AXIS_STROKE, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/orange-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/orange-color-theme.ts new file mode 100644 index 00000000000..dd4312aa360 --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/orange-color-theme.ts @@ -0,0 +1,51 @@ +/* eslint-disable camelcase */ +import { + chart_color_orange_100, + chart_color_orange_200, + chart_color_orange_300, + chart_color_orange_400, + chart_color_orange_500, + global_active_color_200, + global_active_color_300, + global_Color_dark_200, + global_Color_light_100 +} from '@patternfly/react-tokens'; +import { ColorTheme } from '../color-theme'; + +// TODO Replace values with PF css variable when available + +// Colors +const COLOR_AXIS_FILL = 'transparent'; +const COLOR_AXIS_STROKE = '#D2D2D2'; +const COLOR_FILL = global_active_color_200.value; +const COLOR_LABEL = global_Color_light_100.value; +const COLOR_STACK_STROKE = global_Color_dark_200.value; +const COLOR_STROKE = global_active_color_300.value; +const COLOR_TOOLTIP_FILL = '#151515'; +const COLOR_TOOLTIP_STROKE = '#151515'; +const COLOR_TOOLTIP_FLYOUT_FILL = '#EDEDED'; +const COLOR_TOOLTIP_FLYOUT_STROKE = '#EDEDED'; + +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_orange_300.value, + chart_color_orange_100.value, + chart_color_orange_500.value, + chart_color_orange_200.value, + chart_color_orange_400.value +]; + +export const DarkOrangeColorTheme = ColorTheme({ + COLOR_AXIS_FILL, + COLOR_AXIS_STROKE, + COLOR_FILL, + COLOR_LABEL, + COLOR_SCALE, + COLOR_STACK_STROKE, + COLOR_STROKE, + COLOR_TOOLTIP_FILL, + COLOR_TOOLTIP_STROKE, + COLOR_TOOLTIP_FLYOUT_FILL, + COLOR_TOOLTIP_FLYOUT_STROKE +}); diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/purple-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/purple-color-theme.ts new file mode 100644 index 00000000000..88f118d88f2 --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/dark/purple-color-theme.ts @@ -0,0 +1,51 @@ +/* eslint-disable camelcase */ +import { + chart_color_purple_100, + chart_color_purple_200, + chart_color_purple_300, + chart_color_purple_400, + chart_color_purple_500, + global_active_color_200, + global_active_color_300, + global_Color_dark_200, + global_Color_light_100 +} from '@patternfly/react-tokens'; +import { ColorTheme } from '../color-theme'; + +// TODO Replace values with PF css variable when available + +// Colors +const COLOR_AXIS_FILL = 'transparent'; +const COLOR_AXIS_STROKE = '#D2D2D2'; +const COLOR_FILL = global_active_color_200.value; +const COLOR_LABEL = global_Color_light_100.value; +const COLOR_STACK_STROKE = global_Color_dark_200.value; +const COLOR_STROKE = global_active_color_300.value; +const COLOR_TOOLTIP_FILL = '#151515'; +const COLOR_TOOLTIP_STROKE = '#151515'; +const COLOR_TOOLTIP_FLYOUT_FILL = '#EDEDED'; +const COLOR_TOOLTIP_FLYOUT_STROKE = '#EDEDED'; + +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_purple_300.value, + chart_color_purple_100.value, + chart_color_purple_500.value, + chart_color_purple_200.value, + chart_color_purple_400.value +]; + +export const DarkPurpleColorTheme = ColorTheme({ + COLOR_AXIS_FILL, + COLOR_AXIS_STROKE, + COLOR_FILL, + COLOR_LABEL, + COLOR_SCALE, + COLOR_STACK_STROKE, + COLOR_STROKE, + COLOR_TOOLTIP_FILL, + COLOR_TOOLTIP_STROKE, + COLOR_TOOLTIP_FLYOUT_FILL, + COLOR_TOOLTIP_FLYOUT_STROKE +}); diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-theme.ts index 78377b0470b..fef64cce319 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-theme.ts @@ -4,12 +4,18 @@ export const DonutStyles = { label: { subTitle: { + // Victory props only fill: '#bbb', - fontSize: 16 + fontSize: 14 }, + subTitlePosition: 'center', title: { - fontSize: 26 + // Victory props only + fontSize: 24 } + }, + legend: { + position: 'right' } }; diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-utilization-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-utilization-theme.ts index 7c7151d1b3b..e49d21dd45c 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-utilization-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/donut-utilization-theme.ts @@ -2,18 +2,6 @@ // Donut utilization styles export const DonutUtilizationStyles = { - label: { - subTitle: { - fill: '#bbb', - fontSize: 16 - }, - title: { - fontSize: 26 - } - }, - legend: { - orientation: 'vertical' - }, thresholds: { colorScale: ['#F0AB00', '#C9190B'] } diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/label-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/label-theme.ts new file mode 100644 index 00000000000..ac60140680f --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/label-theme.ts @@ -0,0 +1,7 @@ +/* eslint-disable camelcase */ +import { global_FontFamily_sans_serif } from '@patternfly/react-tokens'; + +// Label styles +export const LabelStyles = { + fontFamily: global_FontFamily_sans_serif.value +}; diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/blue-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/blue-color-theme.ts index cc3cf85f565..0863424022a 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/blue-color-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/blue-color-theme.ts @@ -1,6 +1,10 @@ /* eslint-disable camelcase */ import { - global_active_color_100, + chart_color_blue_100, + chart_color_blue_200, + chart_color_blue_300, + chart_color_blue_400, + chart_color_blue_500, global_active_color_200, global_active_color_300, global_Color_dark_100, @@ -15,12 +19,6 @@ const COLOR_AXIS_FILL = 'transparent'; const COLOR_AXIS_STROKE = '#D2D2D2'; const COLOR_FILL = global_active_color_200.value; const COLOR_LABEL = global_Color_dark_100.value; -const COLOR_SCALE = [ - global_active_color_100.value, - global_active_color_200.value, - global_active_color_300.value, - '#0066ff' -]; const COLOR_STACK_STROKE = global_Color_light_100.value; const COLOR_STROKE = global_active_color_300.value; const COLOR_TOOLTIP_FILL = '#EDEDED'; @@ -28,6 +26,16 @@ const COLOR_TOOLTIP_STROKE = '#EDEDED'; const COLOR_TOOLTIP_FLYOUT_FILL = '#151515'; const COLOR_TOOLTIP_FLYOUT_STROKE = '#151515'; +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_blue_300.value, + chart_color_blue_100.value, + chart_color_blue_500.value, + chart_color_blue_200.value, + chart_color_blue_400.value +]; + export const LightBlueColorTheme = ColorTheme({ COLOR_AXIS_FILL, COLOR_AXIS_STROKE, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/cyan-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/cyan-color-theme.ts new file mode 100644 index 00000000000..620d7a13d75 --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/cyan-color-theme.ts @@ -0,0 +1,51 @@ +/* eslint-disable camelcase */ +import { + chart_color_cyan_100, + chart_color_cyan_200, + chart_color_cyan_300, + chart_color_cyan_400, + chart_color_cyan_500, + global_Color_dark_100, + global_Color_light_100, + global_active_color_200, + global_active_color_300, +} from '@patternfly/react-tokens'; +import { ColorTheme } from '../color-theme'; + +// TODO Replace values with PF css variable when available + +// Colors +const COLOR_AXIS_FILL = 'transparent'; +const COLOR_AXIS_STROKE = '#D2D2D2'; +const COLOR_FILL = global_active_color_200.value; +const COLOR_LABEL = global_Color_dark_100.value; +const COLOR_STACK_STROKE = global_Color_light_100.value; +const COLOR_STROKE = global_active_color_300.value; +const COLOR_TOOLTIP_FILL = '#EDEDED'; +const COLOR_TOOLTIP_STROKE = '#EDEDED'; +const COLOR_TOOLTIP_FLYOUT_FILL = '#151515'; +const COLOR_TOOLTIP_FLYOUT_STROKE = '#151515'; + +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_cyan_300.value, + chart_color_cyan_100.value, + chart_color_cyan_500.value, + chart_color_cyan_200.value, + chart_color_cyan_400.value +]; + +export const LightCyanColorTheme = ColorTheme({ + COLOR_AXIS_FILL, + COLOR_AXIS_STROKE, + COLOR_FILL, + COLOR_LABEL, + COLOR_SCALE, + COLOR_STACK_STROKE, + COLOR_STROKE, + COLOR_TOOLTIP_FILL, + COLOR_TOOLTIP_STROKE, + COLOR_TOOLTIP_FLYOUT_FILL, + COLOR_TOOLTIP_FLYOUT_STROKE +}) ; diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gold-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gold-color-theme.ts new file mode 100644 index 00000000000..fb5639baba4 --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gold-color-theme.ts @@ -0,0 +1,52 @@ +/* eslint-disable camelcase */ +import { + chart_color_gold_100, + chart_color_gold_200, + chart_color_gold_300, + chart_color_gold_400, + chart_color_gold_500, + global_Color_dark_100, + global_Color_light_100, + global_active_color_200, + global_active_color_300, +} from '@patternfly/react-tokens'; +import { ColorTheme } from '../color-theme'; + +// TODO Replace values with PF css variable when available + +// Colors +const COLOR_AXIS_FILL = 'transparent'; +const COLOR_AXIS_STROKE = '#D2D2D2'; +const COLOR_FILL = global_active_color_200.value; +const COLOR_LABEL = global_Color_dark_100.value; +const COLOR_STACK_STROKE = global_Color_light_100.value; +const COLOR_STROKE = global_active_color_300.value; +const COLOR_TOOLTIP_FILL = '#EDEDED'; +const COLOR_TOOLTIP_STROKE = '#EDEDED'; +const COLOR_TOOLTIP_FLYOUT_FILL = '#151515'; +const COLOR_TOOLTIP_FLYOUT_STROKE = '#151515'; + +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_gold_300.value, + chart_color_gold_100.value, + chart_color_gold_500.value, + chart_color_gold_200.value, + chart_color_gold_400.value, + +]; + +export const LightGoldColorTheme = ColorTheme({ + COLOR_AXIS_FILL, + COLOR_AXIS_STROKE, + COLOR_FILL, + COLOR_LABEL, + COLOR_SCALE, + COLOR_STACK_STROKE, + COLOR_STROKE, + COLOR_TOOLTIP_FILL, + COLOR_TOOLTIP_STROKE, + COLOR_TOOLTIP_FLYOUT_FILL, + COLOR_TOOLTIP_FLYOUT_STROKE +}) ; diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/grey-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gray-color-theme.ts similarity index 68% rename from packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/grey-color-theme.ts rename to packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gray-color-theme.ts index 5b9a659e65c..b20af69f7e0 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/grey-color-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/gray-color-theme.ts @@ -1,5 +1,10 @@ /* eslint-disable camelcase */ import { + chart_color_black_100, + chart_color_black_200, + chart_color_black_300, + chart_color_black_400, + chart_color_black_500, global_active_color_200, global_active_color_300, global_Color_dark_100, @@ -14,7 +19,6 @@ const COLOR_AXIS_FILL = 'transparent'; const COLOR_AXIS_STROKE = '#D2D2D2'; const COLOR_FILL = global_active_color_200.value; const COLOR_LABEL = global_Color_dark_100.value; -const COLOR_SCALE = ['#EDEDED', '#D2D2D2', '#BBBBBB']; const COLOR_STACK_STROKE = global_Color_light_100.value; const COLOR_STROKE = global_active_color_300.value; const COLOR_TOOLTIP_FILL = '#EDEDED'; @@ -22,7 +26,17 @@ const COLOR_TOOLTIP_STROKE = '#EDEDED'; const COLOR_TOOLTIP_FLYOUT_FILL = '#151515'; const COLOR_TOOLTIP_FLYOUT_STROKE = '#151515'; -export const LightGreyColorTheme = ColorTheme({ +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_black_300.value, + chart_color_black_100.value, + chart_color_black_500.value, + chart_color_black_200.value, + chart_color_black_400.value +]; + +export const LightGrayColorTheme = ColorTheme({ COLOR_AXIS_FILL, COLOR_AXIS_STROKE, COLOR_FILL, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/green-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/green-color-theme.ts index 435f26fd7ee..748ea248f5e 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/green-color-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/green-color-theme.ts @@ -1,11 +1,14 @@ /* eslint-disable camelcase */ import { + chart_color_green_100, + chart_color_green_200, + chart_color_green_300, + chart_color_green_400, + chart_color_green_500, global_Color_dark_100, global_Color_light_100, global_active_color_200, global_active_color_300, - global_success_color_100, - global_success_color_200 } from '@patternfly/react-tokens'; import { ColorTheme } from '../color-theme'; @@ -16,7 +19,6 @@ const COLOR_AXIS_FILL = 'transparent'; const COLOR_AXIS_STROKE = '#D2D2D2'; const COLOR_FILL = global_active_color_200.value; const COLOR_LABEL = global_Color_dark_100.value; -const COLOR_SCALE = [global_success_color_100.value, global_success_color_200.value, '#59C768']; const COLOR_STACK_STROKE = global_Color_light_100.value; const COLOR_STROKE = global_active_color_300.value; const COLOR_TOOLTIP_FILL = '#EDEDED'; @@ -24,6 +26,16 @@ const COLOR_TOOLTIP_STROKE = '#EDEDED'; const COLOR_TOOLTIP_FLYOUT_FILL = '#151515'; const COLOR_TOOLTIP_FLYOUT_STROKE = '#151515'; +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_green_300.value, + chart_color_green_100.value, + chart_color_green_500.value, + chart_color_green_200.value, + chart_color_green_400.value +]; + export const LightGreenColorTheme = ColorTheme({ COLOR_AXIS_FILL, COLOR_AXIS_STROKE, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/multi-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/multi-color-theme.ts index 2bee48203a2..4203c8c4d3e 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/multi-color-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/multi-color-theme.ts @@ -1,5 +1,40 @@ /* eslint-disable camelcase */ import { + chart_color_blue_100, + chart_color_blue_200, + chart_color_blue_300, + chart_color_blue_400, + chart_color_blue_500, + chart_color_green_100, + chart_color_green_200, + chart_color_green_300, + chart_color_green_400, + chart_color_green_500, + chart_color_cyan_100, + chart_color_cyan_200, + chart_color_cyan_300, + chart_color_cyan_400, + chart_color_cyan_500, + chart_color_purple_100, + chart_color_purple_200, + chart_color_purple_300, + chart_color_purple_400, + chart_color_purple_500, + chart_color_gold_100, + chart_color_gold_200, + chart_color_gold_300, + chart_color_gold_400, + chart_color_gold_500, + chart_color_orange_100, + chart_color_orange_200, + chart_color_orange_300, + chart_color_orange_400, + chart_color_orange_500, + chart_color_black_100, + chart_color_black_200, + chart_color_black_300, + chart_color_black_400, + chart_color_black_500, global_active_color_200, global_active_color_300, global_Color_dark_100, @@ -14,7 +49,6 @@ const COLOR_AXIS_FILL = 'transparent'; const COLOR_AXIS_STROKE = '#D2D2D2'; const COLOR_FILL = global_active_color_200.value; const COLOR_LABEL = global_Color_dark_100.value; -const COLOR_SCALE = ['#39A5DC', '#9C92F5', '#59C768', '#FFD47D']; const COLOR_STACK_STROKE = global_Color_light_100.value; const COLOR_STROKE = global_active_color_300.value; const COLOR_TOOLTIP_FILL = '#EDEDED'; @@ -22,6 +56,46 @@ const COLOR_TOOLTIP_STROKE = '#EDEDED'; const COLOR_TOOLTIP_FLYOUT_FILL = '#151515'; const COLOR_TOOLTIP_FLYOUT_STROKE = '#151515'; +// The color order below improves the color contrast in unordered charts +// See https://github.com/patternfly/patternfly-next/issues/1551 +const COLOR_SCALE = [ + chart_color_blue_300.value, + chart_color_gold_300.value, + chart_color_green_300.value, + chart_color_purple_300.value, + chart_color_orange_300.value, + chart_color_cyan_300.value, + chart_color_black_300.value, + chart_color_blue_100.value, + chart_color_gold_500.value, + chart_color_green_100.value, + chart_color_purple_500.value, + chart_color_orange_100.value, + chart_color_cyan_500.value, + chart_color_black_100.value, + chart_color_blue_500.value, + chart_color_gold_100.value, + chart_color_green_500.value, + chart_color_purple_100.value, + chart_color_orange_500.value, + chart_color_cyan_100.value, + chart_color_black_500.value, + chart_color_blue_200.value, + chart_color_gold_400.value, + chart_color_green_200.value, + chart_color_purple_400.value, + chart_color_orange_200.value, + chart_color_cyan_400.value, + chart_color_black_200.value, + chart_color_blue_400.value, + chart_color_gold_200.value, + chart_color_green_400.value, + chart_color_purple_200.value, + chart_color_orange_400.value, + chart_color_cyan_200.value, + chart_color_black_400.value +]; + export const LightMultiColorTheme = ColorTheme({ COLOR_AXIS_FILL, COLOR_AXIS_STROKE, diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/orange-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/orange-color-theme.ts new file mode 100644 index 00000000000..872e82ac1e1 --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/orange-color-theme.ts @@ -0,0 +1,52 @@ +/* eslint-disable camelcase */ +import { + chart_color_orange_100, + chart_color_orange_200, + chart_color_orange_300, + chart_color_orange_400, + chart_color_orange_500, + global_Color_dark_100, + global_Color_light_100, + global_active_color_200, + global_active_color_300, +} from '@patternfly/react-tokens'; +import { ColorTheme } from '../color-theme'; + +// TODO Replace values with PF css variable when available + +// Colors +const COLOR_AXIS_FILL = 'transparent'; +const COLOR_AXIS_STROKE = '#D2D2D2'; +const COLOR_FILL = global_active_color_200.value; +const COLOR_LABEL = global_Color_dark_100.value; +const COLOR_STACK_STROKE = global_Color_light_100.value; +const COLOR_STROKE = global_active_color_300.value; +const COLOR_TOOLTIP_FILL = '#EDEDED'; +const COLOR_TOOLTIP_STROKE = '#EDEDED'; +const COLOR_TOOLTIP_FLYOUT_FILL = '#151515'; +const COLOR_TOOLTIP_FLYOUT_STROKE = '#151515'; + +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_orange_300.value, + chart_color_orange_100.value, + chart_color_orange_500.value, + chart_color_orange_200.value, + chart_color_orange_400.value, + +]; + +export const LightOrangeColorTheme = ColorTheme({ + COLOR_AXIS_FILL, + COLOR_AXIS_STROKE, + COLOR_FILL, + COLOR_LABEL, + COLOR_SCALE, + COLOR_STACK_STROKE, + COLOR_STROKE, + COLOR_TOOLTIP_FILL, + COLOR_TOOLTIP_STROKE, + COLOR_TOOLTIP_FLYOUT_FILL, + COLOR_TOOLTIP_FLYOUT_STROKE +}) ; diff --git a/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/purple-color-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/purple-color-theme.ts new file mode 100644 index 00000000000..c9894d02bcd --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartTheme/themes/light/purple-color-theme.ts @@ -0,0 +1,51 @@ +/* eslint-disable camelcase */ +import { + chart_color_purple_100, + chart_color_purple_200, + chart_color_purple_300, + chart_color_purple_400, + chart_color_purple_500, + global_Color_dark_100, + global_Color_light_100, + global_active_color_200, + global_active_color_300, +} from '@patternfly/react-tokens'; +import { ColorTheme } from '../color-theme'; + +// TODO Replace values with PF css variable when available + +// Colors +const COLOR_AXIS_FILL = 'transparent'; +const COLOR_AXIS_STROKE = '#D2D2D2'; +const COLOR_FILL = global_active_color_200.value; +const COLOR_LABEL = global_Color_dark_100.value; +const COLOR_STACK_STROKE = global_Color_light_100.value; +const COLOR_STROKE = global_active_color_300.value; +const COLOR_TOOLTIP_FILL = '#EDEDED'; +const COLOR_TOOLTIP_STROKE = '#EDEDED'; +const COLOR_TOOLTIP_FLYOUT_FILL = '#151515'; +const COLOR_TOOLTIP_FLYOUT_STROKE = '#151515'; + +// Color scale +// See https://docs.google.com/document/d/1cw10pJFXWruB1SA8TQwituxn5Ss6KpxYPCOYGrH8qAY/edit +const COLOR_SCALE = [ + chart_color_purple_300.value, + chart_color_purple_100.value, + chart_color_purple_500.value, + chart_color_purple_200.value, + chart_color_purple_400.value +]; + +export const LightPurpleColorTheme = ColorTheme({ + COLOR_AXIS_FILL, + COLOR_AXIS_STROKE, + COLOR_FILL, + COLOR_LABEL, + COLOR_SCALE, + COLOR_STACK_STROKE, + COLOR_STROKE, + COLOR_TOOLTIP_FILL, + COLOR_TOOLTIP_STROKE, + COLOR_TOOLTIP_FLYOUT_FILL, + COLOR_TOOLTIP_FLYOUT_STROKE +}) ; diff --git a/packages/patternfly-4/react-charts/src/components/ChartTooltip/__snapshots__/ChartTooltip.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartTooltip/__snapshots__/ChartTooltip.test.tsx.snap index 1e79a4e41a7..10cdfdcd8dd 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartTooltip/__snapshots__/ChartTooltip.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartTooltip/__snapshots__/ChartTooltip.test.tsx.snap @@ -25,9 +25,10 @@ exports[`ChartTooltip 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -53,9 +54,10 @@ exports[`ChartTooltip 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -101,9 +103,10 @@ exports[`ChartTooltip 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -127,9 +130,10 @@ exports[`ChartTooltip 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -207,9 +211,10 @@ exports[`ChartTooltip 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -233,9 +238,10 @@ exports[`ChartTooltip 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -250,9 +256,10 @@ exports[`ChartTooltip 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -277,9 +284,10 @@ exports[`ChartTooltip 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -288,9 +296,10 @@ exports[`ChartTooltip 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -320,9 +329,10 @@ exports[`ChartTooltip 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -347,9 +357,10 @@ exports[`ChartTooltip 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -372,9 +383,10 @@ exports[`ChartTooltip 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -399,9 +411,10 @@ exports[`ChartTooltip 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -438,9 +451,10 @@ exports[`ChartTooltip 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -499,9 +513,10 @@ exports[`ChartTooltip 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -527,9 +542,10 @@ exports[`ChartTooltip 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -575,9 +591,10 @@ exports[`ChartTooltip 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -601,9 +618,10 @@ exports[`ChartTooltip 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -681,9 +699,10 @@ exports[`ChartTooltip 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -707,9 +726,10 @@ exports[`ChartTooltip 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -724,9 +744,10 @@ exports[`ChartTooltip 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -751,9 +772,10 @@ exports[`ChartTooltip 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -762,9 +784,10 @@ exports[`ChartTooltip 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -794,9 +817,10 @@ exports[`ChartTooltip 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -821,9 +845,10 @@ exports[`ChartTooltip 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -846,9 +871,10 @@ exports[`ChartTooltip 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -873,9 +899,10 @@ exports[`ChartTooltip 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -912,9 +939,10 @@ exports[`ChartTooltip 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -965,9 +993,10 @@ exports[`allows tooltip via container component 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -993,9 +1022,10 @@ exports[`allows tooltip via container component 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1041,9 +1071,10 @@ exports[`allows tooltip via container component 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1067,9 +1098,10 @@ exports[`allows tooltip via container component 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1147,9 +1179,10 @@ exports[`allows tooltip via container component 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1173,9 +1206,10 @@ exports[`allows tooltip via container component 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1190,9 +1224,10 @@ exports[`allows tooltip via container component 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1217,9 +1252,10 @@ exports[`allows tooltip via container component 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1228,9 +1264,10 @@ exports[`allows tooltip via container component 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1260,9 +1297,10 @@ exports[`allows tooltip via container component 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1287,9 +1325,10 @@ exports[`allows tooltip via container component 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1312,9 +1351,10 @@ exports[`allows tooltip via container component 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1339,9 +1379,10 @@ exports[`allows tooltip via container component 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1378,9 +1419,10 @@ exports[`allows tooltip via container component 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts new file mode 100644 index 00000000000..7eb91e49c37 --- /dev/null +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-label.ts @@ -0,0 +1,77 @@ +import { CommonStyles } from '../ChartTheme/themes/common-theme'; +import { ChartThemeDefinition } from '../ChartTheme/ChartTheme'; + +interface ChartLabelDimensionsInterface { + label: string; // The label text + theme: ChartThemeDefinition; // The theme that will be applied to the chart +} + +interface ChartLabelPaddingXInterface { + dx?: number; // Horizontal shift from the x coordinate + chartWidth: number; // Width of chart (e.g., donut) within SVG + labelPosition: string; // Position of label (e.g., bottom, right) + legendPosition: string; // Position of legend (e.g., bottom, right) + svgWidth: number; // Overall width of SVG +} + +interface ChartLabelPaddingYInterface { + dy?: number; // Vertical shift from the x coordinate + chartHeight: number; // Width of chart (e.g., donut) within SVG + labelPosition: string; // Position of label (e.g., bottom, right) +} + +// Returns x coordinate for label +export const getLabelX = ({ + chartWidth, + dx = 0, + labelPosition, + legendPosition, + svgWidth +}: ChartLabelPaddingXInterface) => { + if (!chartWidth) { + return 0; + } + switch (labelPosition) { + case 'center': + switch (legendPosition) { + case 'bottom': + return Math.round(svgWidth / 2) + dx; + default: + return Math.round(chartWidth / 2) + dx; + } + case 'bottom': + return Math.round(chartWidth / 2) + dx; + case 'right': + switch (legendPosition) { + case 'bottom': + return Math.round(svgWidth / 2) + Math.round(chartWidth / 2) + CommonStyles.label.margin + dx; + case 'right': + return chartWidth + CommonStyles.label.margin + dx; + default: + return dx; + } + default: + return dx; + } +}; + +// Returns y coordinate for label +export const getLabelY = ({ + chartHeight, + dy = 0, + labelPosition, +}: ChartLabelPaddingYInterface) => { + if (!chartHeight) { + return 0; + } + switch (labelPosition) { + case 'center': + return Math.round(chartHeight / 2) + dy; + case 'bottom': + return chartHeight + CommonStyles.label.margin + dy; + case 'right': + return Math.round(chartHeight / 2) + dy; + default: + return dy; + } +}; diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts index 83d72069d94..e1fd48883b5 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-legend.ts @@ -1,22 +1,42 @@ +import { VictoryLegend } from 'victory'; +import { TextSize } from 'victory-core'; +import { ChartLegendProps } from '../ChartLegend/ChartLegend'; import { ChartThemeDefinition } from '../ChartTheme/ChartTheme'; +import { CommonStyles } from '../ChartTheme/themes/common-theme'; interface ChartLegendPaddingXInterface { - chartOrientation: string; - legendOrientation: string; - legendWidth: number; - theme: ChartThemeDefinition; - width: number; + chartWidth: number; // Width of chart (e.g., donut) within SVG + dx?: number; // Horizontal shift from the x coordinate + legendData: any[]; // The legend data used to determine width + legendOrientation: string; // Orientation of legend (e.g., vertical, horizontal) + legendPosition: string; // Position of legend (e.g., bottom, right) + legendProps: any; // The legend props used to determine width + svgWidth: number; // Overall width of SVG + theme: ChartThemeDefinition; // The theme that will be applied to the chart } interface ChartLegendPaddingYInterface { - chartDy?: number; - chartHeight: number; - chartOrientation: string; - chartType: string; - height: number; - legendData: any[] - legendHeight: number; - theme: ChartThemeDefinition; + chartHeight: number; // Height of chart (e.g., donut) within SVG + chartType: string; // The type of chart (e.g., pie) to lookup for props like padding + dy?: number; // Vertical shift from the x coordinate + legendData: any[]; // The legend data used to determine width + legendOrientation: string; // Orientation of legend (e.g., vertical, horizontal) + legendPosition: string; // Position of legend (e.g., bottom, right) + legendProps: any; // The legend props used to determine width + theme: ChartThemeDefinition; // The theme that will be applied to the chart +} + +interface ChartLegendDimensionsInterface { + legendData: any[]; // The legend data used to determine width + legendOrientation: string; // Orientation of legend (e.g., vertical, horizontal) + legendProps: ChartLegendProps; // Legend properties + theme: ChartThemeDefinition; // The theme that will be applied to the chart +} + +interface ChartLegendTextSizeInterface { + legendData: any[]; // The legend data used to determine width + legendOrientation?: string; // Orientation of legend (e.g., vertical, horizontal) + theme: ChartThemeDefinition; // The theme that will be applied to the chart } // Returns chart padding @@ -27,56 +47,118 @@ export const getChartPadding = (chartType: string = 'chart', theme: ChartThemeDe return padding + offset; }; -// Returns legend padding -export const getLegendPadding = (legendData: any[]) => (legendData && legendData.length > 0 ? 15 : 0); +// Returns legend dimensions +export const getLegendDimensions = ({ + legendData, + legendOrientation, + legendProps, + theme +}: ChartLegendDimensionsInterface) => { + if (legendData || legendProps.data) { + return (VictoryLegend as any).getDimensions({ + data: legendData, + orientation: legendOrientation, + theme, + ...legendProps // override above + }); + } + return {}; +} // Returns x coordinate for legend export const getLegendX = ({ - chartOrientation, + chartWidth, + dx = 0, + legendData, legendOrientation, - legendWidth, - theme, - width + legendPosition, + legendProps, + svgWidth, + theme }: ChartLegendPaddingXInterface) => { - if (!legendWidth) { - return 0; - } - const offset = legendOrientation === 'vertical' ? 22 : 4; - const gutter = legendOrientation === 'vertical' ? theme.legend.gutter : 0; - const padding = gutter + offset; - switch (chartOrientation) { - case 'left': - return width > legendWidth ? width - legendWidth : 0; - case 'top': - return width > legendWidth - padding ? Math.round((width - (legendWidth - padding)) / 2) : 0; + const legendDimensions = getLegendDimensions({ + legendData, + legendOrientation, + legendProps, + theme + }); + const textSizeWorkAround = getTextSizeWorkAround({ + legendData, + legendOrientation, + theme + }); + switch (legendPosition) { + case 'bottom': + return svgWidth > legendDimensions.width - textSizeWorkAround + ? Math.round((svgWidth - (legendDimensions.width - textSizeWorkAround)) / 2) + dx : dx; + case 'right': + return chartWidth + CommonStyles.legend.margin + dx; default: - return 0; + return dx; } }; // Returns y coordinate for legend export const getLegendY = ({ - chartDy = 0, chartHeight, - chartOrientation, + dy = 0, + legendPosition, chartType, - height, legendData, - legendHeight, + legendOrientation, + legendProps, theme }: ChartLegendPaddingYInterface) => { - // Todo: Get padding for other types of charts + const legendDimensions = getLegendDimensions({ + legendData, + legendOrientation, + legendProps, + theme + }); + const getLegendPadding = (legendData: any[]) => (legendData && legendData.length > 0 ? 15 : 0); const dHeight = chartHeight ? chartHeight + getChartPadding(chartType, theme) : 0; - const lHeight = legendHeight ? legendHeight + getLegendPadding(legendData) : 0; + const lHeight = legendDimensions.height ? legendDimensions.height + getLegendPadding(legendData) : 0; - switch (chartOrientation) { + switch (legendPosition) { + case 'bottom': + return chartHeight + CommonStyles.legend.margin + dy; case 'left': - return dHeight > lHeight ? Math.round((dHeight - lHeight) / 2) + chartDy : 0; + return dHeight > lHeight ? Math.round((dHeight - lHeight) / 2) + dy : dy; case 'right': - return dHeight > lHeight ? Math.round((dHeight - lHeight) / 2) + chartDy : 0; - case 'top': - return height > lHeight ? height - lHeight + chartDy : 0; + return dHeight > lHeight ? Math.round((dHeight - lHeight) / 2) + dy : dy; default: - return chartDy; + return dy; + } +}; + +// Returns an approximation of over-sized text width due to growing character count +// +// See https://github.com/FormidableLabs/victory/issues/864 +const getTextSizeWorkAround = ({ + legendData, + legendOrientation, + theme +}: ChartLegendTextSizeInterface) => { + const style = theme.legend.style.labels; + if (!(legendData && style.fontFamily.includes('overpass'))) { + return 0; + } + + // For horizontal legends, account for the growing char count of the last legend item + let result = legendData[legendData.length - 1].name; + + // For vertical legends, account for the growing char count of the longest legend item + if (legendOrientation === 'vertical') { + legendData.forEach(data => { + if (data.name && data.name.length > result.length) { + result = data.name; + } + }); } + const textSize = TextSize.approximateTextSize(result, style); + const adjustedTextSize = TextSize.approximateTextSize(result, { + ...style, + characterConstant: 2.5875 // Average pixels per glyph + }); + return Math.abs(textSize.width - adjustedTextSize.width); }; diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-origin.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-origin.ts index 3a87888cbbe..7dbcdd19264 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-origin.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-origin.ts @@ -1,61 +1,63 @@ interface ChartOriginInterface { - chartDx?: number; - chartDy?: number; - chartHeight: number; - chartOrientation: string; - chartWidth: number; - height: number; - width: number; + chartHeight: number; // Height of chart (e.g., donut) within SVG + chartWidth: number; // Width of chart (e.g., donut) within SVG + dx?: number; // Horizontal shift from the x coordinate + dy?: number; // vertical shift from the x coordinate + legendPosition?: string; // Position of legend (e.g., bottom, right) + svgWidth: number; // Overall width of SVG } interface ChartOriginXInterface { - chartDx?: number; - chartOrientation: string; - chartWidth: number; - width: number; + chartWidth: number; // Width of chart (e.g., donut) within SVG + dx?: number; // Horizontal shift from the x coordinate + legendPosition?: string; // Position of legend (e.g., bottom, right) + svgWidth: number; // Overall width of SVG } interface ChartOriginYInterface { - chartDy?: number; - chartHeight: number; - chartOrientation: string; - height: number; + chartHeight: number; // Height of chart (e.g., donut) within SVG + dy?: number; // vertical shift from the x coordinate + legendPosition?: string; // Position of legend (e.g., bottom, right) } // Returns origin x and y coordinates export const getChartOrigin = ({ - chartDx = 0, - chartDy = 0, chartHeight, - chartOrientation, chartWidth, - height, - width + dx = 0, + dy = 0, + legendPosition, + svgWidth }: ChartOriginInterface) => ({ - x: getChartOriginX({ chartDx, chartOrientation, chartWidth, width }), - y: getChartOriginY({ chartDy, chartHeight, chartOrientation, height }) + x: getChartOriginX({ chartWidth, dx, legendPosition, svgWidth }), + y: getChartOriginY({ chartHeight, dy, legendPosition }) }); // Returns origin x coordinate -export const getChartOriginX = ({ chartDx = 0, chartOrientation, chartWidth, width }: ChartOriginXInterface) => { - switch (chartOrientation) { - case 'left': - return (chartWidth ? Math.round(chartWidth / 2) : 0) + chartDx; - case 'right': - return (width > chartWidth ? Math.round(width - chartWidth / 2) : 0) + chartDx; - case 'top': - return (width ? Math.round(width / 2) : 0) + chartDx; +export const getChartOriginX = ({ + chartWidth, + dx = 0, + legendPosition, + svgWidth +}: ChartOriginXInterface) => { + switch (legendPosition) { + case 'bottom': + return Math.round(svgWidth / 2) + dx; default: - return 0; + return Math.round(chartWidth / 2) + dx; } }; // Returns origin y coordinate -export const getChartOriginY = ({ chartDy = 0, chartHeight, chartOrientation, height }: ChartOriginYInterface) => { - switch (chartOrientation) { - case 'bottom': - return chartDy; // TBD... +export const getChartOriginY = ({ + chartHeight, + dy = 0, + legendPosition +}: ChartOriginYInterface) => { + switch (legendPosition) { + case 'top': + return dy; // TBD... default: - return (chartHeight ? Math.round(chartHeight / 2) : 0) + chartDy; + return Math.round(chartHeight / 2) + dy; } }; diff --git a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts index b1fcca40940..bb090ec26f5 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts +++ b/packages/patternfly-4/react-charts/src/components/ChartUtils/chart-theme.ts @@ -1,12 +1,20 @@ import { merge } from 'lodash'; import { DarkBlueColorTheme } from '../ChartTheme/themes/dark/blue-color-theme'; +import { DarkCyanColorTheme } from '../ChartTheme/themes/dark/cyan-color-theme'; +import { DarkGoldColorTheme } from '../ChartTheme/themes/dark/gold-color-theme'; +import { DarkGrayColorTheme } from '../ChartTheme/themes/dark/gray-color-theme'; import { DarkGreenColorTheme } from '../ChartTheme/themes/dark/green-color-theme'; -import { DarkGreyColorTheme } from '../ChartTheme/themes/dark/grey-color-theme'; import { DarkMultiColorTheme } from '../ChartTheme/themes/dark/multi-color-theme'; +import { DarkOrangeColorTheme } from '../ChartTheme/themes/dark/orange-color-theme'; +import { DarkPurpleColorTheme } from '../ChartTheme/themes/dark/purple-color-theme'; import { LightBlueColorTheme } from '../ChartTheme/themes/light/blue-color-theme'; +import { LightCyanColorTheme } from '../ChartTheme/themes/light/cyan-color-theme'; +import { LightGoldColorTheme } from '../ChartTheme/themes/light/gold-color-theme'; +import { LightGrayColorTheme } from '../ChartTheme/themes/light/gray-color-theme'; import { LightGreenColorTheme } from '../ChartTheme/themes/light/green-color-theme'; -import { LightGreyColorTheme } from '../ChartTheme/themes/light/grey-color-theme'; import { LightMultiColorTheme } from '../ChartTheme/themes/light/multi-color-theme'; +import { LightOrangeColorTheme } from '../ChartTheme/themes/light/orange-color-theme'; +import { LightPurpleColorTheme } from '../ChartTheme/themes/light/purple-color-theme'; import { ChartBaseTheme, ChartDonutTheme, @@ -34,6 +42,9 @@ export const getDonutThresholdDynamicTheme = (themeColor: string, themeVariant: // Merge just the first color of dynamic (blue, green, etc.) with static (grey) for expected colorScale theme.legend.colorScale = [theme.pie.colorScale[0], ...ChartDonutThresholdDynamicTheme.legend.colorScale]; + + // Merge the threshold colors in case users want to show the unused data + theme.pie.colorScale = [theme.pie.colorScale[0], ...ChartDonutThresholdStaticTheme.pie.colorScale]; return theme; }; @@ -57,12 +68,20 @@ export const getDarkThemeColors = (themeColor: string) => { switch (themeColor) { case ChartThemeColor.blue: return DarkBlueColorTheme; + case ChartThemeColor.cyan: + return DarkCyanColorTheme; + case ChartThemeColor.gold: + return DarkGoldColorTheme; + case ChartThemeColor.gray: + return DarkGrayColorTheme; case ChartThemeColor.green: return DarkGreenColorTheme; - case ChartThemeColor.grey: - return DarkGreyColorTheme; case ChartThemeColor.multi: return DarkMultiColorTheme; + case ChartThemeColor.orange: + return DarkOrangeColorTheme; + case ChartThemeColor.purple: + return DarkPurpleColorTheme; default: return DarkBlueColorTheme; } @@ -73,12 +92,20 @@ export const getLightThemeColors = (themeColor: string) => { switch (themeColor) { case ChartThemeColor.blue: return LightBlueColorTheme; + case ChartThemeColor.cyan: + return LightCyanColorTheme; + case ChartThemeColor.gold: + return LightGoldColorTheme; + case ChartThemeColor.gray: + return LightGrayColorTheme; case ChartThemeColor.green: return LightGreenColorTheme; - case ChartThemeColor.grey: - return LightGreyColorTheme; case ChartThemeColor.multi: return LightMultiColorTheme; + case ChartThemeColor.orange: + return LightOrangeColorTheme; + case ChartThemeColor.purple: + return LightPurpleColorTheme; default: return LightBlueColorTheme; } diff --git a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/__snapshots__/ChartVoronoContainer.test.tsx.snap b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/__snapshots__/ChartVoronoContainer.test.tsx.snap index 3ac07f4771d..8de49369076 100644 --- a/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/__snapshots__/ChartVoronoContainer.test.tsx.snap +++ b/packages/patternfly-4/react-charts/src/components/ChartVoronoiContainer/__snapshots__/ChartVoronoContainer.test.tsx.snap @@ -12,9 +12,10 @@ exports[`ChartVoronoiContainer 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -40,9 +41,10 @@ exports[`ChartVoronoiContainer 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -88,9 +90,10 @@ exports[`ChartVoronoiContainer 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -114,9 +117,10 @@ exports[`ChartVoronoiContainer 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -194,9 +198,10 @@ exports[`ChartVoronoiContainer 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -220,9 +225,10 @@ exports[`ChartVoronoiContainer 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -237,9 +243,10 @@ exports[`ChartVoronoiContainer 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -264,9 +271,10 @@ exports[`ChartVoronoiContainer 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -275,9 +283,10 @@ exports[`ChartVoronoiContainer 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -307,9 +316,10 @@ exports[`ChartVoronoiContainer 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -334,9 +344,10 @@ exports[`ChartVoronoiContainer 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -359,9 +370,10 @@ exports[`ChartVoronoiContainer 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -386,9 +398,10 @@ exports[`ChartVoronoiContainer 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -425,9 +438,10 @@ exports[`ChartVoronoiContainer 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -479,9 +493,10 @@ exports[`ChartVoronoiContainer 2`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -507,9 +522,10 @@ exports[`ChartVoronoiContainer 2`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -555,9 +571,10 @@ exports[`ChartVoronoiContainer 2`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -581,9 +598,10 @@ exports[`ChartVoronoiContainer 2`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -661,9 +679,10 @@ exports[`ChartVoronoiContainer 2`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -687,9 +706,10 @@ exports[`ChartVoronoiContainer 2`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -704,9 +724,10 @@ exports[`ChartVoronoiContainer 2`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -731,9 +752,10 @@ exports[`ChartVoronoiContainer 2`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -742,9 +764,10 @@ exports[`ChartVoronoiContainer 2`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -774,9 +797,10 @@ exports[`ChartVoronoiContainer 2`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -801,9 +825,10 @@ exports[`ChartVoronoiContainer 2`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -826,9 +851,10 @@ exports[`ChartVoronoiContainer 2`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -853,9 +879,10 @@ exports[`ChartVoronoiContainer 2`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -892,9 +919,10 @@ exports[`ChartVoronoiContainer 2`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -947,9 +975,10 @@ exports[`renders container via ChartGroup 1`] = ` "area": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -975,9 +1004,10 @@ exports[`renders container via ChartGroup 1`] = ` "axis": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1023,9 +1053,10 @@ exports[`renders container via ChartGroup 1`] = ` "barWidth": 10, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1049,9 +1080,10 @@ exports[`renders container via ChartGroup 1`] = ` "boxWidth": 20, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1129,9 +1161,10 @@ exports[`renders container via ChartGroup 1`] = ` }, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1155,9 +1188,10 @@ exports[`renders container via ChartGroup 1`] = ` "chart": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1172,9 +1206,10 @@ exports[`renders container via ChartGroup 1`] = ` "borderWidth": 8, "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1199,9 +1234,10 @@ exports[`renders container via ChartGroup 1`] = ` "group": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1210,9 +1246,10 @@ exports[`renders container via ChartGroup 1`] = ` "legend": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "gutter": 20, "orientation": "horizontal", @@ -1242,9 +1279,10 @@ exports[`renders container via ChartGroup 1`] = ` "line": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1269,9 +1307,10 @@ exports[`renders container via ChartGroup 1`] = ` "pie": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 230, "padding": 8, @@ -1294,9 +1333,10 @@ exports[`renders container via ChartGroup 1`] = ` "scatter": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1321,9 +1361,10 @@ exports[`renders container via ChartGroup 1`] = ` "stack": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, @@ -1360,9 +1401,10 @@ exports[`renders container via ChartGroup 1`] = ` "voronoi": Object { "colorScale": Array [ "#06c", - "#bee1f4", - "#73bcf7", - "#0066ff", + "#8bc1f7", + "#002f5d", + "#519de9", + "#004b95", ], "height": 300, "padding": 50, diff --git a/packages/patternfly-4/react-charts/src/declarations.d.ts b/packages/patternfly-4/react-charts/src/declarations.d.ts index 323261667a2..cb4cdf22f8b 100644 --- a/packages/patternfly-4/react-charts/src/declarations.d.ts +++ b/packages/patternfly-4/react-charts/src/declarations.d.ts @@ -2,4 +2,5 @@ declare module 'victory-core' { export const Data: any; export const Helpers: any; export const Path: any; + export const TextSize: any; } diff --git a/packages/patternfly-4/react-core/.babelrc b/packages/patternfly-4/react-core/.babelrc new file mode 100644 index 00000000000..25c4221a16d --- /dev/null +++ b/packages/patternfly-4/react-core/.babelrc @@ -0,0 +1,3 @@ +{ + "extends": "../.babelrc" +} \ No newline at end of file diff --git a/packages/patternfly-4/react-core/.babelrc.js b/packages/patternfly-4/react-core/.babelrc.js deleted file mode 100644 index ee1e6c7192e..00000000000 --- a/packages/patternfly-4/react-core/.babelrc.js +++ /dev/null @@ -1,20 +0,0 @@ -const babelENV = process.env.BABEL_ENV || 'development'; -const modules = babelENV !== 'production:esm' ? 'commonjs' : false; - -module.exports = { - presets: [['@babel/env', { modules }], '@babel/react'], - ignore: (() => { - const ignore = ['**/__snapshots__', '**/*.d.ts']; - if (babelENV.includes('production')) { - ignore.push('test.js', '__mocks__'); - } - return ignore; - })(), - plugins: [ - '@babel/plugin-transform-typescript', - 'babel-plugin-typescript-to-proptypes', - '@babel/plugin-proposal-export-default-from', - '@babel/proposal-class-properties', - '@babel/proposal-object-rest-spread', - ] -}; diff --git a/packages/patternfly-4/react-core/.npmignore b/packages/patternfly-4/react-core/.npmignore index e047f55d752..5344519a423 100644 --- a/packages/patternfly-4/react-core/.npmignore +++ b/packages/patternfly-4/react-core/.npmignore @@ -1,7 +1,6 @@ -src build dist/**/demos dist/**/examples dist/**/__snapshots__ -dist/**/*.docs.js -dist/**/*.test.js \ No newline at end of file +dist/**/*.test.js +dist/**/*.map diff --git a/packages/patternfly-4/react-core/CHANGELOG.md b/packages/patternfly-4/react-core/CHANGELOG.md index 749541a8888..7fce59336db 100644 --- a/packages/patternfly-4/react-core/CHANGELOG.md +++ b/packages/patternfly-4/react-core/CHANGELOG.md @@ -3,6 +3,226 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.48.5](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.48.4...@patternfly/react-core@3.48.5) (2019-06-18) + +**Note:** Version bump only for package @patternfly/react-core + + + + + +## [3.48.4](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.48.3...@patternfly/react-core@3.48.4) (2019-06-18) + +**Note:** Version bump only for package @patternfly/react-core + + + + + +## [3.48.3](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.48.2...@patternfly/react-core@3.48.3) (2019-06-18) + + +### Bug Fixes + +* **popover:** reset pointer-events to capture default target bounds ([#2284](https://github.com/patternfly/patternfly-react/issues/2284)) ([910c667](https://github.com/patternfly/patternfly-react/commit/910c667)) + + + + + +## [3.48.2](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.48.1...@patternfly/react-core@3.48.2) (2019-06-18) + +**Note:** Version bump only for package @patternfly/react-core + + + + + +## [3.48.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.48.0...@patternfly/react-core@3.48.1) (2019-06-18) + + +### Bug Fixes + +* **Accordion:** final changes ([#2290](https://github.com/patternfly/patternfly-react/issues/2290)) ([6fce654](https://github.com/patternfly/patternfly-react/commit/6fce654)) + + + + + +# [3.48.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.46.1...@patternfly/react-core@3.48.0) (2019-06-18) + + +### Features + +* **ContextSelector:** Convert context selector to typescript ([#2147](https://github.com/patternfly/patternfly-react/issues/2147)) ([9a4f484](https://github.com/patternfly/patternfly-react/commit/9a4f484)) + + + + + +# [3.47.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.46.1...@patternfly/react-core@3.47.0) (2019-06-18) + + +### Features + +* **ContextSelector:** Convert context selector to typescript ([#2147](https://github.com/patternfly/patternfly-react/issues/2147)) ([9a4f484](https://github.com/patternfly/patternfly-react/commit/9a4f484)) + + + + + +## [3.46.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.46.0...@patternfly/react-core@3.46.1) (2019-06-14) + +**Note:** Version bump only for package @patternfly/react-core + + + + + +# [3.46.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.45.0...@patternfly/react-core@3.46.0) (2019-06-14) + + +### Bug Fixes + +* **Alert:** set the variant prop to info by default ([#2218](https://github.com/patternfly/patternfly-react/issues/2218)) ([bd8afad](https://github.com/patternfly/patternfly-react/commit/bd8afad)) +* **react-icons:** add noVerticalAlign prop to d.ts file ([#2238](https://github.com/patternfly/patternfly-react/issues/2238)) ([c50143c](https://github.com/patternfly/patternfly-react/commit/c50143c)), closes [#2237](https://github.com/patternfly/patternfly-react/issues/2237) + + +### Features + +* **Accordion:** Accordion Component TypeScript Conversion ([#2121](https://github.com/patternfly/patternfly-react/issues/2121)) ([e2e981d](https://github.com/patternfly/patternfly-react/commit/e2e981d)) + + + + + +# [3.45.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.44.0...@patternfly/react-core@3.45.0) (2019-06-14) + + +### Features + +* **PF4: Application launcher:** Use dropdown components in App launcher ([#2101](https://github.com/patternfly/patternfly-react/issues/2101)) ([44a2ea1](https://github.com/patternfly/patternfly-react/commit/44a2ea1)) + + + + + +# [3.44.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.43.0...@patternfly/react-core@3.44.0) (2019-06-14) + + +### Features + +* **PF4 Dropdown:** Wrap dropdown with context ([#2227](https://github.com/patternfly/patternfly-react/issues/2227)) ([5bb8051](https://github.com/patternfly/patternfly-react/commit/5bb8051)) + + + + + +# [3.43.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.42.1...@patternfly/react-core@3.43.0) (2019-06-13) + + +### Features + +* **build:** add source maps ([#2142](https://github.com/patternfly/patternfly-react/issues/2142)) ([5076c48](https://github.com/patternfly/patternfly-react/commit/5076c48)) + + + + + +## [3.42.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.42.0...@patternfly/react-core@3.42.1) (2019-06-13) + + +### Bug Fixes + +* **pagination:** dropdown closes on click outside of menu area ([#2235](https://github.com/patternfly/patternfly-react/issues/2235)) ([a2942c2](https://github.com/patternfly/patternfly-react/commit/a2942c2)) + + + + + +# [3.42.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.41.0...@patternfly/react-core@3.42.0) (2019-06-12) + + +### Features + +* **Alert:** Add the inline alert modifier ([#2126](https://github.com/patternfly/patternfly-react/issues/2126)) ([230e83a](https://github.com/patternfly/patternfly-react/commit/230e83a)), closes [#1934](https://github.com/patternfly/patternfly-react/issues/1934) + + + + + +# [3.41.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.40.0...@patternfly/react-core@3.41.0) (2019-06-12) + + +### Features + +* **react-core:** allow dynamic rendering of anchor components ([#2117](https://github.com/patternfly/patternfly-react/issues/2117)) ([c1c3be9](https://github.com/patternfly/patternfly-react/commit/c1c3be9)) + + + + + +# [3.40.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.39.0...@patternfly/react-core@3.40.0) (2019-06-11) + + +### Features + +* **ApplicationLauncher:** Convert application launcher to typescript ([#2166](https://github.com/patternfly/patternfly-react/issues/2166)) ([9b90f94](https://github.com/patternfly/patternfly-react/commit/9b90f94)) +* **Card:** Add support for images and actions ([#2122](https://github.com/patternfly/patternfly-react/issues/2122)) ([7832518](https://github.com/patternfly/patternfly-react/commit/7832518)) + + + + + +# [3.39.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.38.1...@patternfly/react-core@3.39.0) (2019-06-11) + + +### Features + +* **Topology:** Add @patternfly/react-topology package ([#2170](https://github.com/patternfly/patternfly-react/issues/2170)) ([58eb9cc](https://github.com/patternfly/patternfly-react/commit/58eb9cc)) + + + + + +## [3.38.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.38.0...@patternfly/react-core@3.38.1) (2019-06-11) + +**Note:** Version bump only for package @patternfly/react-core + + + + + +# [3.38.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.37.1...@patternfly/react-core@3.38.0) (2019-06-10) + + +### Features + +* **backdrop:** Convert backdrop to typescript ([#2105](https://github.com/patternfly/patternfly-react/issues/2105)) ([fd3d771](https://github.com/patternfly/patternfly-react/commit/fd3d771)) + + + + + +## [3.37.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.37.0...@patternfly/react-core@3.37.1) (2019-06-10) + +**Note:** Version bump only for package @patternfly/react-core + + + + + +# [3.37.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.36.1...@patternfly/react-core@3.37.0) (2019-06-07) + + +### Features + +* **PF4: Pagination:** When empty array sent to pagination no per page should be visible ([#2175](https://github.com/patternfly/patternfly-react/issues/2175)) ([cb97dfd](https://github.com/patternfly/patternfly-react/commit/cb97dfd)) + + + + + ## [3.36.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@3.36.0...@patternfly/react-core@3.36.1) (2019-06-06) **Note:** Version bump only for package @patternfly/react-core diff --git a/packages/patternfly-4/react-core/package.json b/packages/patternfly-4/react-core/package.json index a0d062f6649..c62c9775b5d 100644 --- a/packages/patternfly-4/react-core/package.json +++ b/packages/patternfly-4/react-core/package.json @@ -1,6 +1,6 @@ { "name": "@patternfly/react-core", - "version": "3.36.1", + "version": "3.48.5", "description": "This library provides a set of common React components for use with the PatternFly reference implementation.", "main": "dist/js/index.js", "module": "dist/esm/index.js", @@ -31,9 +31,9 @@ "scripts": { "build": "yarn typecheck && yarn build:babel && yarn build:types && node ./scripts/copyTS.js && node ./scripts/copyStyles.js", "build:babel": "concurrently 'yarn build:babel:esm && yarn build:babel:umd' 'yarn build:babel:cjs'", - "build:babel:cjs": "babel src --out-dir dist/js --extensions '.js,.ts,.tsx' -q", - "build:babel:esm": "babel src --out-dir dist/esm --extensions '.js,.ts,.tsx' -q", - "build:babel:umd": "babel dist/esm --out-dir dist/umd --plugins transform-es2015-modules-umd -q", + "build:babel:cjs": "babel --source-maps --extensions '.js,.ts,.tsx' src --out-dir dist/js --presets=@babel/env", + "build:babel:esm": "babel --source-maps --extensions '.js,.ts,.tsx' src --out-dir dist/esm", + "build:babel:umd": "babel --source-maps --extensions '.js' dist/esm --out-dir dist/umd --plugins=transform-es2015-modules-umd", "build:types": "tsc -p tsconfig.gen-dts.json", "clean": "rimraf dist", "develop": "yarn build:babel:esm --skip-initial-build --watch --verbose", @@ -41,9 +41,9 @@ "typecheck": "tsc -p tsconfig.typecheck.json" }, "dependencies": { - "@patternfly/react-icons": "^3.9.3", - "@patternfly/react-styles": "^3.3.0", - "@patternfly/react-tokens": "^2.5.3", + "@patternfly/react-icons": "^3.10.2", + "@patternfly/react-styles": "^3.4.2", + "@patternfly/react-tokens": "^2.6.1", "@tippy.js/react": "^1.1.1", "emotion": "^9.2.9", "exenv": "^1.2.2", @@ -54,13 +54,11 @@ "@babel/core": "^7.0.0", "@babel/plugin-proposal-class-properties": "^7.0.0", "@babel/plugin-proposal-export-default-from": "^7.0.0", - "@babel/plugin-proposal-export-namespace-from": "^7.0.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-object-assign": "^7.0.0", "@babel/plugin-transform-typescript": "^7.0.0", "@babel/preset-env": "^7.0.0", "@babel/preset-react": "^7.0.0", - "@patternfly/patternfly": "2.8.2", + "@patternfly/patternfly": "2.13.0", "@types/enzyme": "3.9.0", "@types/exenv": "^1.2.0", "@types/jest": "^24.0.11", @@ -68,7 +66,6 @@ "@types/react": "~16.8.0", "@types/react-dom": "~16.8.0", "babel-plugin-transform-es2015-modules-umd": "^6.24.1", - "babel-plugin-transform-imports": "^1.5.0", "babel-plugin-typescript-to-proptypes": "^0.17.1", "css": "^2.2.3", "enzyme": "3.9.0", diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalContainer.tsx b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalContainer.tsx index aacbe730a2b..497b6cd2062 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalContainer.tsx +++ b/packages/patternfly-4/react-core/src/components/AboutModal/AboutModalContainer.tsx @@ -5,7 +5,7 @@ import { AboutModalBoxHero } from './AboutModalBoxHero'; import { AboutModalBoxBrand } from './AboutModalBoxBrand'; import { AboutModalBoxCloseButton } from './AboutModalBoxCloseButton'; import { AboutModalBox } from './AboutModalBox'; -import Backdrop from '../Backdrop/Backdrop'; +import { Backdrop } from '../Backdrop/Backdrop'; import Bullseye from '../../layouts/Bullseye/Bullseye'; export interface AboutModalContainerProps extends React.HTMLProps { diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap b/packages/patternfly-4/react-core/src/components/AboutModal/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap index 0367c897b2f..d001a6a5701 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/AboutModal/__snapshots__/AboutModalBoxCloseButton.test.tsx.snap @@ -11,6 +11,7 @@ exports[`AboutModalBoxCloseButton Test 1`] = ` > @@ -29,6 +30,7 @@ exports[`AboutModalBoxCloseButton Test onclose 1`] = ` > diff --git a/packages/patternfly-4/react-core/src/components/AboutModal/__snapshots__/AboutModalContainer.test.tsx.snap b/packages/patternfly-4/react-core/src/components/AboutModal/__snapshots__/AboutModalContainer.test.tsx.snap index 6f52e4feea7..3da487c4c62 100644 --- a/packages/patternfly-4/react-core/src/components/AboutModal/__snapshots__/AboutModalContainer.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/AboutModal/__snapshots__/AboutModalContainer.test.tsx.snap @@ -1,9 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`About Modal Container Test isOpen 1`] = ` - + - + `; exports[`About Modal Container Test simple 1`] = `""`; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.d.ts b/packages/patternfly-4/react-core/src/components/Accordion/Accordion.d.ts deleted file mode 100644 index 5427c5a8c55..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { FunctionComponent, HTMLProps } from 'react'; -import { Omit } from '../../helpers/typeUtils'; - -export interface AccordionProps extends Omit, 'aria-label'> { - 'aria-label': string; -} - -declare const Accordion: FunctionComponent; - -export default Accordion; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.js b/packages/patternfly-4/react-core/src/components/Accordion/Accordion.js deleted file mode 100644 index 26061c99524..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.js +++ /dev/null @@ -1,29 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { css } from '@patternfly/react-styles'; -import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; - -const Accordion = ({ children, className, 'aria-label': ariaLabel, ...props }) => ( -
- {children} -
-); - -Accordion.propTypes = { - /** Content rendered inside the Accordion */ - children: PropTypes.node, - /** Additional classes added to the Accordion */ - className: PropTypes.string, - /** Adds accessible text to the Accordion */ - 'aria-label': PropTypes.string, - /** Additional props are spread to the container
*/ - '': PropTypes.any // eslint-disable-line react/require-default-props -}; - -Accordion.defaultProps = { - children: null, - className: '', - 'aria-label': '' -}; - -export default Accordion; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.md b/packages/patternfly-4/react-core/src/components/Accordion/Accordion.md index 793dd970e7a..85f2b8f3f45 100644 --- a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.md +++ b/packages/patternfly-4/react-core/src/components/Accordion/Accordion.md @@ -1,6 +1,7 @@ --- title: 'Accordion' cssPrefix: 'pf-c-accordion' +typescript: true propComponents: ['Accordion', 'AccordionItem', 'AccordionContent', 'AccordionToggle'] --- diff --git a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.test.js b/packages/patternfly-4/react-core/src/components/Accordion/Accordion.test.tsx similarity index 65% rename from packages/patternfly-4/react-core/src/components/Accordion/Accordion.test.js rename to packages/patternfly-4/react-core/src/components/Accordion/Accordion.test.tsx index b425331827c..196beffeb8f 100644 --- a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.test.js +++ b/packages/patternfly-4/react-core/src/components/Accordion/Accordion.test.tsx @@ -1,7 +1,9 @@ import React from 'react'; import { shallow, mount } from 'enzyme'; -import Accordion from './Accordion'; -import AccordionToggle from './AccordionToggle'; +import { Accordion } from './Accordion'; +import { AccordionToggle } from './AccordionToggle'; +import { AccordionContent } from './AccordionContent'; +import { AccordionItem } from './AccordionItem'; describe('Accordion', () => { test('Accordion default', () => { @@ -9,6 +11,19 @@ describe('Accordion', () => { expect(view.render()).toMatchSnapshot(); }); + test('Accordion with non-default headingLevel', () => { + const view = shallow( + + + Item One + Item One Content + + + ); + expect(view.render()).toMatchSnapshot(); + }); + + test('It should pass optional aria props', () => { const view = mount( diff --git a/packages/patternfly-4/react-core/src/components/Accordion/Accordion.tsx b/packages/patternfly-4/react-core/src/components/Accordion/Accordion.tsx new file mode 100644 index 00000000000..322b59ba035 --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/Accordion/Accordion.tsx @@ -0,0 +1,29 @@ +import * as React from 'react'; +import { css } from '@patternfly/react-styles'; +import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; + +export const AccordionContext = React.createContext('h3'); + +export interface AccordionProps extends React.HTMLProps { + /** Content rendered inside the Accordion */ + children?: React.ReactNode; + /** Additional classes added to the Accordion */ + className?: string; + /** Adds accessible text to the Accordion */ + 'aria-label'?: string; + /** the heading level to use */ + headingLevel?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; +} + +export const Accordion: React.FunctionComponent = ({ + children = null, + className = '', + 'aria-label': ariaLabel = '', + headingLevel = 'h3', + ...props +}: AccordionProps) => ( +
+ {children} + {children} +
+); diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.d.ts b/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.d.ts deleted file mode 100644 index 9e27b9777ae..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { FunctionComponent, HTMLProps } from 'react'; -import { Omit } from '../../helpers/typeUtils'; - -export interface AccordionContentProps extends Omit, 'aria-label'> { - isHidden: boolean; - isFixed: boolean; - 'aria-label': string; -} - -declare const AccordionContent: FunctionComponent; - -export default AccordionContent; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.js b/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.js deleted file mode 100644 index 8c3abb4ba5c..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.js +++ /dev/null @@ -1,49 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { css } from '@patternfly/react-styles'; -import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; - -const AccordionContent = ({ className, children, id, isHidden, isFixed, 'aria-label': ariaLabel, ...props }) => ( - -); - -AccordionContent.propTypes = { - /** Content rendered inside the Accordion */ - children: PropTypes.node, - /** Additional classes added to the Accordion content */ - className: PropTypes.string, - /** Identify the AccordionContent item */ - id: PropTypes.string, - /** Flag to show if the expanded content of the Accordion item is visible */ - isHidden: PropTypes.bool, - /** Flag to indicate Accordion content is fixed */ - isFixed: PropTypes.bool, - /** Adds accessible text to the Accordion content */ - 'aria-label': PropTypes.string, - /** Additional props are spread to the container
*/ - '': PropTypes.any // eslint-disable-line react/require-default-props -}; - -AccordionContent.defaultProps = { - children: null, - className: '', - id: '', - isHidden: false, - isFixed: false, - 'aria-label': '' -}; - -export default AccordionContent; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.tsx b/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.tsx new file mode 100644 index 00000000000..dd42d7b95e4 --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/Accordion/AccordionContent.tsx @@ -0,0 +1,43 @@ +import * as React from 'react'; +import { css } from '@patternfly/react-styles'; +import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; + +export interface AccordionContentProps extends React.HTMLProps { + /** Content rendered inside the Accordion */ + children?: React.ReactNode; + /** Additional classes added to the Accordion content */ + className?: string; + /** Identify the AccordionContent item */ + id?: string; + /** Flag to show if the expanded content of the Accordion item is visible */ + isHidden?: boolean; + /** Flag to indicate Accordion content is fixed */ + isFixed?: boolean; + /** Adds accessible text to the Accordion content */ + 'aria-label'?: string; +} + +export const AccordionContent: React.FunctionComponent = ({ + className = '', + children = null, + id = '', + isHidden = false, + isFixed = false, + 'aria-label': ariaLabel = '', + ...props +}: AccordionContentProps) => ( +
+); diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.d.ts b/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.d.ts deleted file mode 100644 index 7152f10346c..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { FunctionComponent, HTMLProps } from 'react'; -import { Omit } from '../../helpers/typeUtils'; - -export interface AccordionItemProps extends Omit, 'aria-label'> { -} - -declare const AccordionItem: FunctionComponent; - -export default AccordionItem; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.js b/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.js deleted file mode 100644 index 8be8f96c341..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.js +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -const AccordionItem = ({ children, ...props }) => {children}; - -AccordionItem.propTypes = { - /** Content rendered inside the Accordion item */ - children: PropTypes.node, - /** Additional props are spread to the container */ - '': PropTypes.any // eslint-disable-line react/require-default-props -}; - -AccordionItem.defaultProps = { - children: null -}; - -export default AccordionItem; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.tsx b/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.tsx new file mode 100644 index 00000000000..198ddae0d37 --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/Accordion/AccordionItem.tsx @@ -0,0 +1,10 @@ +import * as React from 'react'; + +export interface AccordionItemProps { + /** Content rendered inside the Accordion item */ + children?: React.ReactNode; +} + +export const AccordionItem: React.FunctionComponent = ({ children = null }: AccordionItemProps) => ( + {children} +); diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.d.ts b/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.d.ts deleted file mode 100644 index 3d49378e697..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { FunctionComponent, HTMLProps } from 'react'; -import { Omit } from '../../helpers/typeUtils'; - -export interface AccordionToggleProps extends Omit, 'aria-labelledby' | 'aria-label' | 'id'> { - isExpanded: boolean; - id: string; -} - -declare const AccordionToggle: FunctionComponent; - -export default AccordionToggle; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.js b/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.js deleted file mode 100644 index 663e9711529..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.js +++ /dev/null @@ -1,43 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { css } from '@patternfly/react-styles'; -import { AngleRightIcon } from '@patternfly/react-icons'; -import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; - -const AccordionToggle = ({ className, id, isExpanded, children, ...props }) => ( -
-

- -

-
-); - -AccordionToggle.propTypes = { - /** Content rendered inside the Accordion toggle */ - children: PropTypes.node, - /** Additional classes added to the Accordion Toggle */ - className: PropTypes.string, - /** Flag to show if the expanded content of the Accordion item is visible */ - isExpanded: PropTypes.bool, - /** Identify the Accordion toggle number */ - id: PropTypes.string.isRequired, - /** Additional props are spread to the container
*/ - '': PropTypes.any // eslint-disable-line react/require-default-props -}; - -AccordionToggle.defaultProps = { - className: '', - children: null, - isExpanded: false -}; - -export default AccordionToggle; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.tsx b/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.tsx new file mode 100644 index 00000000000..e5f169251b4 --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/Accordion/AccordionToggle.tsx @@ -0,0 +1,43 @@ +import * as React from 'react'; +import { css } from '@patternfly/react-styles'; +import styles from '@patternfly/react-styles/css/components/Accordion/accordion'; +import { AngleRightIcon } from '@patternfly/react-icons'; +import { Omit } from '../../helpers/typeUtils'; +import { AccordionContext } from './Accordion'; + +export interface AccordionToggleProps extends Omit, 'type'> { + /** Content rendered inside the Accordion toggle */ + children?: React.ReactNode; + /** Additional classes added to the Accordion Toggle */ + className?: string; + /** Flag to show if the expanded content of the Accordion item is visible */ + isExpanded?: boolean; + /** Identify the Accordion toggle number */ + id: string; +} + +export const AccordionToggle: React.FunctionComponent = ({ + className = '', + id, + isExpanded = false, + children = null, + ...props +}: AccordionToggleProps) => ( +
+ + {(AccordionHeadingLevel: any) => ( + + + + )} + +
+); diff --git a/packages/patternfly-4/react-core/src/components/Accordion/__snapshots__/Accordion.test.js.snap b/packages/patternfly-4/react-core/src/components/Accordion/__snapshots__/Accordion.test.js.snap deleted file mode 100644 index 8b5b87cfc40..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/__snapshots__/Accordion.test.js.snap +++ /dev/null @@ -1,8 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Accordion Accordion default 1`] = ` -
-`; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap b/packages/patternfly-4/react-core/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap new file mode 100644 index 00000000000..ac5f7da3423 --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/Accordion/__snapshots__/Accordion.test.tsx.snap @@ -0,0 +1,98 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Accordion Accordion default 1`] = ` +
+`; + +exports[`Accordion Accordion with non-default headingLevel 1`] = ` +
+
+

+ +

+
+
+
+ Item One Content +
+
+
+

+ +

+
+
+
+ Item One Content +
+
+
+`; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/index.d.ts b/packages/patternfly-4/react-core/src/components/Accordion/index.d.ts deleted file mode 100644 index 0bebc39e8af..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export { default as Accordion } from './Accordion'; -export { default as AccordionItem } from './AccordionItem'; -export { default as AccordionContent } from './AccordionContent'; -export { default as AccordionToggle } from './AccordionToggle'; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/index.js b/packages/patternfly-4/react-core/src/components/Accordion/index.js deleted file mode 100644 index 0bebc39e8af..00000000000 --- a/packages/patternfly-4/react-core/src/components/Accordion/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export { default as Accordion } from './Accordion'; -export { default as AccordionItem } from './AccordionItem'; -export { default as AccordionContent } from './AccordionContent'; -export { default as AccordionToggle } from './AccordionToggle'; diff --git a/packages/patternfly-4/react-core/src/components/Accordion/index.ts b/packages/patternfly-4/react-core/src/components/Accordion/index.ts new file mode 100644 index 00000000000..7139e97c322 --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/Accordion/index.ts @@ -0,0 +1,4 @@ +export * from './Accordion'; +export * from './AccordionItem'; +export * from './AccordionContent'; +export * from './AccordionToggle'; diff --git a/packages/patternfly-4/react-core/src/components/Alert/Alert.md b/packages/patternfly-4/react-core/src/components/Alert/Alert.md index d0fd4714f78..8004c76adcc 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/Alert.md +++ b/packages/patternfly-4/react-core/src/components/Alert/Alert.md @@ -175,3 +175,70 @@ class DangerAlert extends React.Component { } } ``` + +## Inline alert types +```js +import React from 'react'; +import { Alert } from '@patternfly/react-core'; + +class InlineAlert extends React.Component { + render() { + return ( + + + + + + + ); + } +} +``` + +## Inline alert variations +```js +import React from 'react'; +import { Alert, AlertActionLink, AlertActionCloseButton } from '@patternfly/react-core'; + +class InlineAlertVariations extends React.Component { + constructor(props) { + super(props); + this.state = { alertOneVisible: true, alertTwoVisible: true }; + this.hideAlertOne = () => this.setState({ alertOneVisible: false }); + this.hideAlertTwo = () => this.setState({ alertTwoVisible: false }); + } + render() { + const { alertOneVisible, alertTwoVisible } = this.state; + return ( + + {alertOneVisible && ( + } + > + Success alert description. This is a link. + + )} + {alertTwoVisible && ( + } + /> + )} + Action Button} + /> + + + ); + } +} +``` + diff --git a/packages/patternfly-4/react-core/src/components/Alert/Alert.test.tsx b/packages/patternfly-4/react-core/src/components/Alert/Alert.test.tsx index b09704ad25c..7b7571615f7 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/Alert.test.tsx +++ b/packages/patternfly-4/react-core/src/components/Alert/Alert.test.tsx @@ -1,10 +1,15 @@ import * as React from 'react'; -import { mount } from 'enzyme'; +import { mount, shallow } from 'enzyme'; import { Alert, AlertVariant } from './Alert'; import { AlertActionLink } from './AlertActionLink'; import { AlertActionCloseButton } from './AlertActionCloseButton'; +test('default Alert variant is info', () => { + const view = shallow(Alert testing) + expect(view.props().className).toMatch(/pf-m-info/); +}) + Object.values(AlertVariant).forEach(variant => { describe(`Alert - ${variant}`, () => { test('Description', () => { @@ -67,6 +72,20 @@ Object.values(AlertVariant).forEach(variant => { ); expect(view).toMatchSnapshot(); + + }); + + test('inline variation', () => { + const view = mount( + + Some alert + + ); + expect(view).toMatchSnapshot(); }); }); }); diff --git a/packages/patternfly-4/react-core/src/components/Alert/Alert.tsx b/packages/patternfly-4/react-core/src/components/Alert/Alert.tsx index 5cf443969fd..5bd31e515f7 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/Alert.tsx +++ b/packages/patternfly-4/react-core/src/components/Alert/Alert.tsx @@ -16,7 +16,9 @@ export enum AlertVariant { export interface AlertProps extends Omit, 'action' | 'title'> { /** Adds Alert variant styles */ - variant: 'success' | 'danger' | 'warning' | 'info'; + variant?: 'success' | 'danger' | 'warning' | 'info'; + /** Flag to indicate if the Alert is inline */ + isInline?: boolean; /** Title of the Alert */ title: React.ReactNode; /** Action button to put in the Alert. Should be or */ @@ -32,7 +34,8 @@ export interface AlertProps }; export const Alert: React.FunctionComponent = ({ - variant, + variant = AlertVariant.info, + isInline = false, variantLabel = `${capitalize(variant)} alert:`, 'aria-label': ariaLabel = `${capitalize(variant)} Alert`, action = null, @@ -48,7 +51,7 @@ export const Alert: React.FunctionComponent = ({ ); - const customClassName = css(styles.alert, getModifier(styles, variant, styles.modifiers.info), className); + const customClassName = css(styles.alert, isInline && styles.modifiers.inline, getModifier(styles, variant, styles.modifiers.info), className); return (
diff --git a/packages/patternfly-4/react-core/src/components/Alert/__snapshots__/Alert.test.tsx.snap b/packages/patternfly-4/react-core/src/components/Alert/__snapshots__/Alert.test.tsx.snap index 6f36259ce21..152755dd083 100644 --- a/packages/patternfly-4/react-core/src/components/Alert/__snapshots__/Alert.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/Alert/__snapshots__/Alert.test.tsx.snap @@ -23,6 +23,7 @@ exports[`Alert - danger Action Close Button 1`] = ` > @@ -89,6 +90,7 @@ exports[`Alert - danger Action Close Button 1`] = ` > @@ -142,6 +144,7 @@ exports[`Alert - danger Action Link 1`] = ` > @@ -237,6 +240,7 @@ exports[`Alert - danger Action and Title 1`] = ` > @@ -334,6 +338,7 @@ exports[`Alert - danger Custom aria label 1`] = ` > @@ -425,6 +430,7 @@ exports[`Alert - danger Description 1`] = ` > @@ -487,6 +493,72 @@ exports[`Alert - danger Title 1`] = ` > + + + + +
+ +

+ + Danger alert: + + Some title +

+
+

+ Some alert +

+
+
+ +`; + +exports[`Alert - danger inline variation 1`] = ` + +
+ +
+ @@ -556,6 +628,7 @@ exports[`Alert - info Action Close Button 1`] = ` > @@ -622,6 +695,7 @@ exports[`Alert - info Action Close Button 1`] = ` > @@ -675,6 +749,7 @@ exports[`Alert - info Action Link 1`] = ` > @@ -770,6 +845,7 @@ exports[`Alert - info Action and Title 1`] = ` > @@ -867,6 +943,7 @@ exports[`Alert - info Custom aria label 1`] = ` > @@ -958,6 +1035,7 @@ exports[`Alert - info Description 1`] = ` > @@ -1020,6 +1098,72 @@ exports[`Alert - info Title 1`] = ` > + + + + +
+
+

+ + Info alert: + + Some title +

+
+

+ Some alert +

+
+
+
+`; + +exports[`Alert - info inline variation 1`] = ` + +
+ +
+ @@ -1089,6 +1233,7 @@ exports[`Alert - success Action Close Button 1`] = ` > @@ -1155,6 +1300,7 @@ exports[`Alert - success Action Close Button 1`] = ` > @@ -1208,6 +1354,7 @@ exports[`Alert - success Action Link 1`] = ` > @@ -1303,6 +1450,7 @@ exports[`Alert - success Action and Title 1`] = ` > @@ -1400,6 +1548,7 @@ exports[`Alert - success Custom aria label 1`] = ` > @@ -1491,6 +1640,7 @@ exports[`Alert - success Description 1`] = ` > @@ -1553,6 +1703,72 @@ exports[`Alert - success Title 1`] = ` > + + + + +
+
+

+ + Success alert: + + Some title +

+
+

+ Some alert +

+
+
+
+`; + +exports[`Alert - success inline variation 1`] = ` + +
+ +
+ @@ -1622,6 +1838,7 @@ exports[`Alert - warning Action Close Button 1`] = ` > @@ -1688,6 +1905,7 @@ exports[`Alert - warning Action Close Button 1`] = ` > @@ -1741,6 +1959,7 @@ exports[`Alert - warning Action Link 1`] = ` > @@ -1836,6 +2055,7 @@ exports[`Alert - warning Action and Title 1`] = ` > @@ -1933,6 +2153,7 @@ exports[`Alert - warning Custom aria label 1`] = ` > @@ -2024,6 +2245,7 @@ exports[`Alert - warning Description 1`] = ` > @@ -2086,6 +2308,72 @@ exports[`Alert - warning Title 1`] = ` > + + + + +
+
+

+ + Warning alert: + + Some title +

+
+

+ Some alert +

+
+
+
+`; + +exports[`Alert - warning inline variation 1`] = ` + +
+ +
+ diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.d.ts b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.d.ts deleted file mode 100644 index 9b873b3e085..00000000000 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { FunctionComponent, HTMLProps, ReactNode } from 'react'; - -export interface ApplicationLauncherProps extends HTMLProps { - dropdownItems: ReactNode[]; - isOpen?: boolean; - onSelect(event: React.SyntheticEvent): void; - onToggle?(event: React.SyntheticEvent): void; -} - -declare const ApplicationLauncher: FunctionComponent; - -export default ApplicationLauncher; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.js b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.js deleted file mode 100644 index 84e1595c113..00000000000 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.js +++ /dev/null @@ -1,91 +0,0 @@ -import React, { Children, cloneElement } from 'react'; -import styles from '@patternfly/react-styles/css/components/AppLauncher/app-launcher'; -import { css } from '@patternfly/react-styles'; -import PropTypes from 'prop-types'; -import ApplicationLauncherMenu from './ApplicationLauncherMenu'; -import Toggle from './Toggle'; -import { ThIcon } from '@patternfly/react-icons'; -import { DropdownContext } from '../Dropdown/dropdownConstants'; -import GenerateId from '../../helpers/GenerateId/GenerateId'; - -export const propTypes = { - /** Additional element css classes */ - className: PropTypes.string, - /** Array of DropdownItem nodes that will be rendered in the dropdown Menu list */ - dropdownItems: PropTypes.array, - /** open bool */ - isOpen: PropTypes.bool, - /** Function callback called when user selects item */ - onSelect: PropTypes.func, - /** Callback called when application launcher toggle is clicked */ - onToggle: PropTypes.func, - /** Adds accessible text to the button. Required for plain buttons */ - 'aria-label': PropTypes.string -}; - -export const defaultProps = { - className: '', - dropdownItems: [], - isOpen: false, - onSelect: Function.prototype, - onToggle: Function.prototype, - 'aria-label': 'Actions' -}; - -class ApplicationLauncher extends React.Component { - onEnter = () => { - this.openedOnEnter = true; - }; - - componentDidUpdate() { - if (!this.props.isOpen) this.openedOnEnter = false; - } - - render() { - const { 'aria-label': ariaLabel, dropdownItems, className, isOpen, onSelect, onToggle } = this.props; - return ( - - {randomId => ( -
{ - this.parentRef = ref; - }} - > - {Children.map( - - - , - oneToggle => - cloneElement(oneToggle, { - parentRef: this.parentRef, - id: randomId, - isOpen, - isPlain: true, - 'aria-haspopup': true, - onEnter: this.onEnter - }) - )} - {isOpen && ( - onSelect && onSelect(event)}> - - {dropdownItems} - - - )} -
- )} -
- ); - } -} - -ApplicationLauncher.propTypes = propTypes; -ApplicationLauncher.defaultProps = defaultProps; - -export default ApplicationLauncher; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.md b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.md index 205b23f870a..8812510abc4 100644 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.md +++ b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.md @@ -2,7 +2,10 @@ title: 'Application launcher' cssPrefix: 'pf-c-app-launcher' propComponents: ['ApplicationLauncher'] +typescript: true --- +Note: Application launcher is build on top of Dropdown, for extended API go to [`Dropdown`](/components/dropdown/) documentation. + import { ApplicationLauncher, DropdownItem, Tooltip } from '@patternfly/react-core'; ## Simple application launcher @@ -46,7 +49,6 @@ class SimpleApplicationLauncher extends React.Component { ]; return ( { test('regular', () => { - const view = shallow(); + const view = mount(); expect(view).toMatchSnapshot(); }); test('right aligned', () => { - const view = shallow(); + const view = mount(); expect(view).toMatchSnapshot(); }); test('dropup', () => { - const view = shallow(); + const view = mount(); expect(view).toMatchSnapshot(); }); test('dropup + right aligned', () => { - const view = shallow( + const view = mount( { }); test('expanded', () => { - const view = shallow(); + const view = mount(); expect(view).toMatchSnapshot(); }); }); diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.tsx b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.tsx new file mode 100644 index 00000000000..09e710efc5f --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncher.tsx @@ -0,0 +1,71 @@ +import * as React from 'react'; +import styles from '@patternfly/react-styles/css/components/AppLauncher/app-launcher'; +import { css } from '@patternfly/react-styles'; +import { ThIcon } from '@patternfly/react-icons'; +import { DropdownDirection, DropdownPosition, DropdownToggle, DropdownContext } from '../Dropdown'; +import { DropdownWithContext } from '../Dropdown/Dropdown'; + +export interface ApplicationLauncherProps extends React.HTMLProps { + /** Additional element css classes */ + className: string; + /** Display menu above or below dropdown toggle */ + direction: DropdownDirection; + /** Array of DropdownItem nodes that will be rendered in the dropdown Menu list */ + dropdownItems: React.ReactNode[]; + /** Render Application launcher toggle as disabled icon */ + isDisabled: boolean; + /** open bool */ + isOpen: boolean; + /** Indicates where menu will be alligned horizontally */ + position: DropdownPosition; + /** Function callback called when user selects item */ + onSelect: (event: any) => void; + /** Callback called when application launcher toggle is clicked */ + onToggle?: (value: boolean) => void; + /** Adds accessible text to the button. Required for plain buttons */ + 'aria-label': string; +} + +export class ApplicationLauncher extends React.Component { + static defaultProps = { + className: '', + isDisabled: false, + direction: DropdownDirection.down, + dropdownItems: [] as React.ReactNode[], + isOpen: false, + position: DropdownPosition.left, + onSelect: (_event: any): any => undefined, + onToggle: (_value: boolean): any => undefined, + 'aria-label': 'Actions' + }; + render() { + const { 'aria-label': ariaLabel, isOpen, onToggle, onSelect, isDisabled, className, ...props } = this.props; + return ( + + + + + } + isPlain + /> + + ); + } +} diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherMenu.js b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherMenu.js deleted file mode 100644 index 5faa51d7443..00000000000 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/ApplicationLauncherMenu.js +++ /dev/null @@ -1,108 +0,0 @@ -import React from 'react'; -import styles from '@patternfly/react-styles/css/components/AppLauncher/app-launcher'; -import { css } from '@patternfly/react-styles'; -import PropTypes from 'prop-types'; -import { ApplicationLauncherPosition } from './applicationLauncherConstants'; -import { DropdownArrowContext } from '../Dropdown/dropdownConstants'; -import ReactDOM from 'react-dom'; -import { keyHandler } from '../../helpers/util'; -import { KEY_CODES, KEYHANDLER_DIRECTION } from '../../helpers/constants'; - -const propTypes = { - /** Anything which can be rendered as dropdown items */ - children: PropTypes.node, - /** Classess applied to root element of dropdown menu */ - className: PropTypes.string, - /** internal index of the item */ - index: PropTypes.number, - /** Flag to indicate if menu is opened */ - isOpen: PropTypes.bool, - /** Flag to indicate if menu should be opened on enter */ - openedOnEnter: PropTypes.bool, - /** Indicates where menu will be alligned horizontally */ - position: PropTypes.oneOf(Object.values(ApplicationLauncherPosition)), - /** Additional props are spread to the container component */ - '': PropTypes.any // eslint-disable-line react/require-default-props -}; - -const defaultProps = { - children: null, - className: '', - index: null, - isOpen: true, - openedOnEnter: false, - position: ApplicationLauncherPosition.left -}; - -class ApplicationLauncherMenu extends React.Component { - refsCollection = []; - - childKeyHandler = (index, position, custom = false) => { - keyHandler(index, position, this.refsCollection, this.props.children, custom); - }; - - onKeyDown = event => { - // Detected key press on this item, notify the menu parent so that the appropriate - // item can be focused - if (event.key === KEY_CODES.TAB) return; - event.preventDefault(); - if (event.keyCode === KEY_CODES.ARROW_UP) { - keyHandler(this.props.index, KEYHANDLER_DIRECTION.UP, this.refsCollection, this.props.children); - } else if (event.keyCode === KEY_CODES.ARROW_DOWN) { - keyHandler(this.props.index, KEYHANDLER_DIRECTION.DOWN, this.refsCollection, this.props.children); - } else if (event.key === KEY_CODES.ENTER) { - if (!this.ref.current.getAttribute) { - ReactDOM.findDOMNode(this.ref.current).click(); // eslint-disable-line react/no-find-dom-node - } else { - this.ref.current.click && this.ref.current.click(); - } - } - }; - - componentDidMount() { - if (this.props.openedOnEnter) { - this.refsCollection[0].focus(); - } - } - - sendRef = (index, node, isDisabled) => { - if (!node.getAttribute) { - this.refsCollection[index] = ReactDOM.findDOMNode(node); // eslint-disable-line react/no-find-dom-node - } else if (isDisabled || node.getAttribute('role') === 'separator') { - this.refsCollection[index] = null; - } else { - this.refsCollection[index] = node; - } - }; - - extendChildren() { - return React.Children.map(this.props.children, (child, index) => - React.cloneElement(child, { - index, - isAppLauncher: true - }) - ); - } - - render() { - const { className, isOpen, position, children, openedOnEnter, ...props } = this.props; - - return ( - - - - ); - } -} - -ApplicationLauncherMenu.propTypes = propTypes; -ApplicationLauncherMenu.defaultProps = defaultProps; - -export default ApplicationLauncherMenu; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/Toggle.js b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/Toggle.js deleted file mode 100644 index 1b1c24003f9..00000000000 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/Toggle.js +++ /dev/null @@ -1,143 +0,0 @@ -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; -import styles from '@patternfly/react-styles/css/components/Button/button'; -import { css } from '@patternfly/react-styles'; -import { KEY_CODES } from '../../helpers/constants'; - -const propTypes = { - /** HTML ID of toggle */ - id: PropTypes.string.isRequired, - /** Type to put on the button */ - type: PropTypes.string, - /** Anything which can be rendered as toggle */ - children: PropTypes.node, - /** Classes applied to root element of toggle */ - className: PropTypes.string, - /** Flag to indicate if menu is opened */ - isOpen: PropTypes.bool, - /** Callback called when toggle is clicked */ - onToggle: PropTypes.func, - /** Callback for toggle open on keyboard entry */ - onEnter: PropTypes.func, - /** Element which wraps toggle */ - parentRef: PropTypes.any, - /** Forces focus state */ - isFocused: PropTypes.bool, - /** Forces hover state */ - isHovered: PropTypes.bool, - /** Forces active state */ - isActive: PropTypes.bool, - /** Display the toggle with no border or background */ - isPlain: PropTypes.bool, - /** Additional props are spread to the container - ); - } -} - -ApplicationLauncherToggle.propTypes = propTypes; -ApplicationLauncherToggle.defaultProps = defaultProps; - -export default ApplicationLauncherToggle; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/__snapshots__/ApplicationLauncher.test.js.snap b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/__snapshots__/ApplicationLauncher.test.js.snap index 172ba92c450..57043bfbdb1 100644 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/__snapshots__/ApplicationLauncher.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/__snapshots__/ApplicationLauncher.test.js.snap @@ -1,41 +1,2154 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ApplicationLauncher dropup + right aligned 1`] = ` - + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isDisabled={false} + isOpen={false} + onSelect={[Function]} + onToggle={[Function]} + position="right" > - - + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="right" + toggle={ + + + + } + > +
+ + + + + +
+
+
`; exports[`ApplicationLauncher dropup 1`] = ` - + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isDisabled={false} + isOpen={false} + onSelect={[Function]} + onToggle={[Function]} + position="left" > - - + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + + + } + > +
+ + + + + +
+
+
`; exports[`ApplicationLauncher expanded 1`] = ` - + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isDisabled={false} + isOpen={true} + onSelect={[Function]} + onToggle={[Function]} + position="left" > - - + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={true} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + + + } + > +
+ + + + + + + + +
+
+
`; exports[`ApplicationLauncher regular 1`] = ` - + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isDisabled={false} + isOpen={false} + onSelect={[Function]} + onToggle={[Function]} + position="left" > - - + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + + + } + > +
+ + + + + +
+
+
`; exports[`ApplicationLauncher right aligned 1`] = ` - + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isDisabled={false} + isOpen={false} + onSelect={[Function]} + onToggle={[Function]} + position="right" > - - + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="right" + toggle={ + + + + } + > +
+ + + + + +
+
+
`; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/applicationLauncherConstants.d.ts b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/applicationLauncherConstants.d.ts deleted file mode 100644 index d9d4dc49c7c..00000000000 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/applicationLauncherConstants.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const ApplicationLauncherPosition: { - right: 'right'; - left: 'left'; -}; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/applicationLauncherConstants.js b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/applicationLauncherConstants.js deleted file mode 100644 index 20b50640e22..00000000000 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/applicationLauncherConstants.js +++ /dev/null @@ -1,4 +0,0 @@ -export const ApplicationLauncherPosition = { - right: 'right', - left: 'left' -}; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.d.ts b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.d.ts deleted file mode 100644 index eb80d448cc0..00000000000 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as ApplicationLauncher } from './ApplicationLauncher'; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.js b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.js deleted file mode 100644 index eb80d448cc0..00000000000 --- a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default as ApplicationLauncher } from './ApplicationLauncher'; diff --git a/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.ts b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.ts new file mode 100644 index 00000000000..3554cd7dddd --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/ApplicationLauncher/index.ts @@ -0,0 +1 @@ +export * from './ApplicationLauncher'; diff --git a/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.d.ts b/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.d.ts deleted file mode 100644 index d618ac52dba..00000000000 --- a/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { FunctionComponent, HTMLProps, ReactNode } from 'react'; - -export interface BackdropProps extends HTMLProps { - children?: ReactNode; - className?: string; -} - -declare const Backdrop: FunctionComponent; - -export default Backdrop; diff --git a/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.js b/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.js deleted file mode 100644 index 066f421ce34..00000000000 --- a/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { css } from '@patternfly/react-styles'; -import styles from '@patternfly/react-styles/css/components/Backdrop/backdrop'; - -const propTypes = { - /** content rendered inside the backdrop */ - children: PropTypes.node, - /** additional classes added to the button */ - className: PropTypes.string -}; - -const defaultProps = { - children: null, - className: '' -}; - -const Backdrop = ({ className, children, ...props }) => ( -
- {children} -
-); - -Backdrop.propTypes = propTypes; -Backdrop.defaultProps = defaultProps; - -export default Backdrop; diff --git a/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.test.js b/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.test.tsx similarity index 82% rename from packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.test.js rename to packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.test.tsx index 99d675aca51..cfd8d97ec70 100644 --- a/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.test.js +++ b/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { shallow } from 'enzyme'; -import Backdrop from './Backdrop'; +import { Backdrop } from './Backdrop'; test('Backdrop Test', () => { const view = shallow(Backdrop); diff --git a/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.tsx b/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.tsx new file mode 100644 index 00000000000..ae7b7c8d7ce --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/Backdrop/Backdrop.tsx @@ -0,0 +1,20 @@ +import * as React from 'react'; +import { css } from '@patternfly/react-styles'; +import styles from '@patternfly/react-styles/css/components/Backdrop/backdrop'; + +export interface BackdropProps extends React.HTMLProps { + /** content rendered inside the backdrop */ + children?: React.ReactNode; + /** additional classes added to the button */ + className?: string; +} + +export const Backdrop: React.FunctionComponent = ({ + children = null, + className = '', + ...props +}: BackdropProps) => ( +
+ {children} +
+) \ No newline at end of file diff --git a/packages/patternfly-4/react-core/src/components/Backdrop/__snapshots__/Backdrop.test.js.snap b/packages/patternfly-4/react-core/src/components/Backdrop/__snapshots__/Backdrop.test.tsx.snap similarity index 100% rename from packages/patternfly-4/react-core/src/components/Backdrop/__snapshots__/Backdrop.test.js.snap rename to packages/patternfly-4/react-core/src/components/Backdrop/__snapshots__/Backdrop.test.tsx.snap diff --git a/packages/patternfly-4/react-core/src/components/Backdrop/index.d.ts b/packages/patternfly-4/react-core/src/components/Backdrop/index.d.ts deleted file mode 100644 index c76cf6cade7..00000000000 --- a/packages/patternfly-4/react-core/src/components/Backdrop/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as Backdrop, BackdropProps } from './Backdrop'; diff --git a/packages/patternfly-4/react-core/src/components/Backdrop/index.js b/packages/patternfly-4/react-core/src/components/Backdrop/index.js deleted file mode 100644 index 70cf60d910c..00000000000 --- a/packages/patternfly-4/react-core/src/components/Backdrop/index.js +++ /dev/null @@ -1 +0,0 @@ -export { default as Backdrop } from './Backdrop'; diff --git a/packages/patternfly-4/react-core/src/components/Backdrop/index.ts b/packages/patternfly-4/react-core/src/components/Backdrop/index.ts new file mode 100644 index 00000000000..b4c58db120a --- /dev/null +++ b/packages/patternfly-4/react-core/src/components/Backdrop/index.ts @@ -0,0 +1 @@ +export * from './Backdrop'; diff --git a/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbItem.tsx b/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbItem.tsx index 9c078ecdb03..3f4188a47ed 100644 --- a/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbItem.tsx +++ b/packages/patternfly-4/react-core/src/components/Breadcrumb/BreadcrumbItem.tsx @@ -26,7 +26,7 @@ export const BreadcrumbItem: React.FunctionComponent = ({ target = null, component = 'a', ...props -}) => { +}: BreadcrumbItemProps) => { const Component = component as any; return (
  • diff --git a/packages/patternfly-4/react-core/src/components/Breadcrumb/__snapshots__/BreadcrumbItem.test.tsx.snap b/packages/patternfly-4/react-core/src/components/Breadcrumb/__snapshots__/BreadcrumbItem.test.tsx.snap index 847784e33c7..e30f4ed22ec 100644 --- a/packages/patternfly-4/react-core/src/components/Breadcrumb/__snapshots__/BreadcrumbItem.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/Breadcrumb/__snapshots__/BreadcrumbItem.test.tsx.snap @@ -18,6 +18,7 @@ exports[`BreadcrumbItem component should render breadcrumbItem with className 1` > @@ -37,6 +38,7 @@ exports[`BreadcrumbItem component should render breadcrumbItem with custom eleme > @@ -55,6 +57,7 @@ exports[`BreadcrumbItem component should render breadcrumbItem with id 1`] = ` > @@ -72,6 +75,7 @@ exports[`BreadcrumbItem component should render breadcrumbItem with target 1`] = > @@ -89,6 +93,7 @@ exports[`BreadcrumbItem component should render default breadcrumbItem 1`] = ` > @@ -112,6 +117,7 @@ exports[`BreadcrumbItem component should render link breadcrumbItem 1`] = ` > diff --git a/packages/patternfly-4/react-core/src/components/Button/Button.md b/packages/patternfly-4/react-core/src/components/Button/Button.md index 4b999cf4f24..85f3a6ae8ec 100644 --- a/packages/patternfly-4/react-core/src/components/Button/Button.md +++ b/packages/patternfly-4/react-core/src/components/Button/Button.md @@ -28,8 +28,8 @@ ButtonVariants = () => ( {' '} {' '} - {' '} + ); + expect(view).toMatchSnapshot(); +}); + test('isBlock', () => { const view = shallow(); expect(view).toMatchSnapshot(); diff --git a/packages/patternfly-4/react-core/src/components/Button/Button.tsx b/packages/patternfly-4/react-core/src/components/Button/Button.tsx index eaed589ce96..46f5f387624 100644 --- a/packages/patternfly-4/react-core/src/components/Button/Button.tsx +++ b/packages/patternfly-4/react-core/src/components/Button/Button.tsx @@ -41,6 +41,8 @@ export interface ButtonProps extends React.HTMLProps { variant?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'link' | 'plain' ; /** Adds accessible text to the button. */ 'aria-label'?: string; + /** Icon for the button if variant is a link */ + icon?: React.ReactNode | null; } export const Button: React.FunctionComponent = ({ @@ -56,6 +58,7 @@ export const Button: React.FunctionComponent = ({ type = ButtonType.button, variant = ButtonVariant.primary, 'aria-label': ariaLabel = null, + icon = null, ...props }: ButtonProps) => { const Component = component as any; @@ -80,6 +83,7 @@ export const Button: React.FunctionComponent = ({ tabIndex={isDisabled && !isButtonElement ? -1 : null} type={isButtonElement ? type : null} > + {(icon && variant === ButtonVariant.link) && {icon}} {children} ); diff --git a/packages/patternfly-4/react-core/src/components/Button/__snapshots__/Button.test.tsx.snap b/packages/patternfly-4/react-core/src/components/Button/__snapshots__/Button.test.tsx.snap index 17e823c2d29..e6bd74e6a92 100644 --- a/packages/patternfly-4/react-core/src/components/Button/__snapshots__/Button.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/Button/__snapshots__/Button.test.tsx.snap @@ -106,6 +106,29 @@ exports[`link button 1`] = ` `; +exports[`link with icon 1`] = ` + +`; + exports[`plain button 1`] = ` ); } -} - -ContextSelectorToggle.propTypes = propTypes; -ContextSelectorToggle.defaultProps = defaultProps; - -export default ContextSelectorToggle; +} \ No newline at end of file diff --git a/packages/patternfly-4/react-core/src/components/ContextSelector/__snapshots__/ContextSelector.test.js.snap b/packages/patternfly-4/react-core/src/components/ContextSelector/__snapshots__/ContextSelector.test.tsx.snap similarity index 99% rename from packages/patternfly-4/react-core/src/components/ContextSelector/__snapshots__/ContextSelector.test.js.snap rename to packages/patternfly-4/react-core/src/components/ContextSelector/__snapshots__/ContextSelector.test.tsx.snap index 50b4e78b02b..ca876950c62 100644 --- a/packages/patternfly-4/react-core/src/components/ContextSelector/__snapshots__/ContextSelector.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/ContextSelector/__snapshots__/ContextSelector.test.tsx.snap @@ -80,6 +80,7 @@ exports[`Renders ContextSelector open 1`] = `
  • + `; @@ -283,26 +310,159 @@ exports[`KebabToggle dropup + right aligned 1`] = ` /> } > -
    + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + position="right" + toggle={ + + } > - - - - - -
    + + + + + + + +
    + `; @@ -512,102 +690,253 @@ exports[`KebabToggle dropup 1`] = ` /> } > -
    - - - - - -
    - -`; - -exports[`KebabToggle expanded 1`] = ` -, + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + position="left" + toggle={ + + } + > +
    + + + + + +
    + +
    +`; + +exports[`KebabToggle expanded 1`] = ` + } > -
    - - - - - - - - -
    -
    -`; - -exports[`KebabToggle plain 1`] = ` -, + ] + } + isGrouped={false} + isOpen={true} + isPlain={false} + onSelect={[Function]} + position="left" + toggle={ + + } + > +
    + + + + + + + + +
    + +
    +`; + +exports[`KebabToggle plain 1`] = ` + } > -
    - - - - - -
    -
    -`; - -exports[`KebabToggle regular 1`] = ` -, + - Link - , - + Action + , + - Action - , - + Disabled Link + , + - Disabled Link - , - + Disabled Action + , + , + - Disabled Action - , - , - + Separated Link + , + - Separated Link - , - + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + - Separated Action - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={false} - onSelect={[Function]} - position="left" - toggle={ - - } -> -
    + } > - - - - - -
    + + + + + + +
    +
    + `; -exports[`KebabToggle right aligned 1`] = ` +exports[`KebabToggle regular 1`] = ` } > -
    - - + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + position="left" + toggle={ + - - - -
    -
    -`; - -exports[`dropdown basic 1`] = ` - - Dropdown - - } -> -
    + } > - - - - - - - - -
    + + + + + + + + +
    + `; -exports[`dropdown dropup + right aligned 1`] = ` +exports[`KebabToggle right aligned 1`] = ` - Dropdown - + /> } > -
    - - - - - -
    -
    -`; - -exports[`dropdown dropup 1`] = ` + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + position="right" + toggle={ + + } + > +
    + + + + + +
    + + +`; + +exports[`dropdown basic 1`] = ` + + Dropdown + + } +> + + Dropdown + + } + > +
    + + + + + + + + +
    +
    +
    +`; + +exports[`dropdown dropup + right aligned 1`] = ` } > -
    - - - + + +
    + +
    +`; + +exports[`dropdown dropup 1`] = ` + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + position="left" + toggle={ + + Dropdown + + } +> + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + position="left" + toggle={ + + Dropdown + + } + > +
    + + + + + +
    +
    +
    +`; + +exports[`dropdown expanded 1`] = ` + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={true} + isPlain={false} + onSelect={[Function]} + position="left" + toggle={ + + Dropdown + + } +> + + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={true} + isPlain={false} + onSelect={[Function]} + position="left" + toggle={ + + Dropdown + + } + > +
    + + + + + + +
    + + + + + +
    + `; -exports[`dropdown expanded 1`] = ` +exports[`dropdown regular 1`] = ` } > -
    - - - - - - - - -
    -
    -`; - -exports[`dropdown regular 1`] = ` - - Link - , - - Action - , - - Disabled Link - , - - Disabled Action - , - , - , + - Separated Link - , - + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + position="left" + toggle={ + - Separated Action - , - ] - } - isGrouped={false} - isOpen={false} - isPlain={false} - onSelect={[Function]} - position="left" - toggle={ - - Dropdown - - } -> -
    + } > - - - - - -
    + + + + + + + +
    + `; @@ -3248,85 +4817,237 @@ exports[`dropdown right aligned 1`] = ` } > -
    + Link + , + + Action + , + + Disabled Link + , + + Disabled Action + , + , + + Separated Link + , + + Separated Action + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={false} + onSelect={[Function]} + position="right" + toggle={ + + Dropdown + + } > - - - - - -
    + + + + + + + +
    + `; diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/DropdownToggle.test.js.snap b/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/DropdownToggle.test.js.snap index cc2706ccf32..0e3a49fc0ca 100644 --- a/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/DropdownToggle.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/DropdownToggle.test.js.snap @@ -45,6 +45,7 @@ exports[`state active 1`] = ` @@ -119,6 +120,7 @@ exports[`state focus 1`] = ` @@ -193,6 +195,7 @@ exports[`state hover 1`] = ` diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Toggle.test.js.snap b/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Toggle.test.js.snap index 0e70cdbbd6d..39c8e7c2659 100644 --- a/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Toggle.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/Dropdown/__snapshots__/Toggle.test.js.snap @@ -45,6 +45,7 @@ exports[`Dropdown toggle 1`] = ` @@ -116,6 +117,7 @@ exports[`Kebab toggle 1`] = ` > diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/dropdownConstants.d.ts b/packages/patternfly-4/react-core/src/components/Dropdown/dropdownConstants.d.ts index a5b28878890..ff0c263f17f 100644 --- a/packages/patternfly-4/react-core/src/components/Dropdown/dropdownConstants.d.ts +++ b/packages/patternfly-4/react-core/src/components/Dropdown/dropdownConstants.d.ts @@ -1,9 +1,24 @@ -export const DropdownPosition: { - right: 'right'; - left: 'left'; -}; - -export const DropdownDirection: { - up: 'up'; - down: 'down'; -}; +import * as React from 'react'; + +export enum DropdownPosition { + right = 'right', + left = 'left' +} + +export enum DropdownDirection { + up = 'up', + down = 'down' +} + +export const DropdownContext: React.Context<{ + onSelect: (event: any) => void, + menuClass?: string, + itemClass?: string, + toggleClass?: string, + baseClass?: string +}> + +export const DropdownArrowContext: React.Context<{ + keyHandler: (index: number, position: any, custom: boolean) => void, + sendRef: (index: number, node: any, isDisabled: boolean) => void +}> diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/dropdownConstants.js b/packages/patternfly-4/react-core/src/components/Dropdown/dropdownConstants.js index a8e4765e6b4..8caae02a2ee 100644 --- a/packages/patternfly-4/react-core/src/components/Dropdown/dropdownConstants.js +++ b/packages/patternfly-4/react-core/src/components/Dropdown/dropdownConstants.js @@ -11,7 +11,11 @@ export const DropdownDirection = { }; export const DropdownContext = React.createContext({ - onSelect: () => {} + onSelect: () => {}, + menuClass: '', + itemClass: '', + toggleClass: '', + baseClass: '' }); export const DropdownArrowContext = React.createContext({ diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/index.d.ts b/packages/patternfly-4/react-core/src/components/Dropdown/index.d.ts index 7523f36b927..3cb22403a0e 100644 --- a/packages/patternfly-4/react-core/src/components/Dropdown/index.d.ts +++ b/packages/patternfly-4/react-core/src/components/Dropdown/index.d.ts @@ -1,6 +1,5 @@ export { default as Dropdown, DropdownProps } from './Dropdown'; - -export { DropdownDirection, DropdownPosition } from './dropdownConstants'; +export { DropdownDirection, DropdownPosition, DropdownContext } from './dropdownConstants'; export { default as DropdownItem, ItemProps } from './Item'; export { default as DropdownSeparator, SeparatorProps } from './Separator'; export { default as KebabToggle, KebabProps } from './KebabToggle'; diff --git a/packages/patternfly-4/react-core/src/components/Dropdown/index.js b/packages/patternfly-4/react-core/src/components/Dropdown/index.js index cd3b6a5272d..10facabab0f 100644 --- a/packages/patternfly-4/react-core/src/components/Dropdown/index.js +++ b/packages/patternfly-4/react-core/src/components/Dropdown/index.js @@ -1,5 +1,5 @@ export { default as Dropdown } from './Dropdown'; -export { DropdownDirection, DropdownPosition } from './dropdownConstants'; +export { DropdownDirection, DropdownPosition, DropdownContext } from './dropdownConstants'; export { default as DropdownGroup } from './DropdownGroup'; export { default as DropdownItem } from './Item'; export { default as DropdownSeparator } from './Separator'; diff --git a/packages/patternfly-4/react-core/src/components/Expandable/__snapshots__/Expandable.test.tsx.snap b/packages/patternfly-4/react-core/src/components/Expandable/__snapshots__/Expandable.test.tsx.snap index b0affdc881a..88a87ebbb0a 100644 --- a/packages/patternfly-4/react-core/src/components/Expandable/__snapshots__/Expandable.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/Expandable/__snapshots__/Expandable.test.tsx.snap @@ -13,6 +13,7 @@ exports[`Expandable 1`] = ` aria-hidden={true} className="pf-c-expandable__toggle-icon" color="currentColor" + noVerticalAlign={false} size="sm" title={null} /> @@ -40,6 +41,7 @@ exports[`Renders Expandable expanded 1`] = ` aria-hidden={true} className="pf-c-expandable__toggle-icon" color="currentColor" + noVerticalAlign={false} size="sm" title={null} /> diff --git a/packages/patternfly-4/react-core/src/components/LoginPage/LoginMainFooterLinksItem.tsx b/packages/patternfly-4/react-core/src/components/LoginPage/LoginMainFooterLinksItem.tsx index 7dc850ca518..6ec4235b588 100644 --- a/packages/patternfly-4/react-core/src/components/LoginPage/LoginMainFooterLinksItem.tsx +++ b/packages/patternfly-4/react-core/src/components/LoginPage/LoginMainFooterLinksItem.tsx @@ -11,6 +11,8 @@ export interface LoginMainFooterLinksItemProps extends React.HTMLProps = ({ @@ -18,11 +20,16 @@ export const LoginMainFooterLinksItem: React.FunctionComponent ( -
  • - - {children} - -
  • -); +}: LoginMainFooterLinksItemProps) => { + const LinkComponent = linkComponent as any; + + return ( +
  • + + {children} + +
  • + ); +} diff --git a/packages/patternfly-4/react-core/src/components/Modal/ModalContent.tsx b/packages/patternfly-4/react-core/src/components/Modal/ModalContent.tsx index 32f61a280e4..c8a3de99645 100644 --- a/packages/patternfly-4/react-core/src/components/Modal/ModalContent.tsx +++ b/packages/patternfly-4/react-core/src/components/Modal/ModalContent.tsx @@ -8,7 +8,7 @@ const FocusTrap: any = require('focus-trap-react'); import styles from '@patternfly/react-styles/css/layouts/Bullseye/bullseye'; import { css } from '@patternfly/react-styles'; -import Backdrop from '../Backdrop/Backdrop'; +import { Backdrop } from '../Backdrop/Backdrop'; import { ModalBoxBody } from './ModalBoxBody'; import { ModalBoxHeader } from './ModalBoxHeader'; import { ModalBoxCloseButton } from './ModalBoxCloseButton'; diff --git a/packages/patternfly-4/react-core/src/components/Modal/__snapshots__/ModalBoxCloseButton.test.tsx.snap b/packages/patternfly-4/react-core/src/components/Modal/__snapshots__/ModalBoxCloseButton.test.tsx.snap index 9d90add6d9f..017023e98f8 100644 --- a/packages/patternfly-4/react-core/src/components/Modal/__snapshots__/ModalBoxCloseButton.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/Modal/__snapshots__/ModalBoxCloseButton.test.tsx.snap @@ -10,6 +10,7 @@ exports[`ModalBoxCloseButton Test 1`] = ` > diff --git a/packages/patternfly-4/react-core/src/components/Modal/__snapshots__/ModalContent.test.tsx.snap b/packages/patternfly-4/react-core/src/components/Modal/__snapshots__/ModalContent.test.tsx.snap index 6c5194b15f3..415e4c3f592 100644 --- a/packages/patternfly-4/react-core/src/components/Modal/__snapshots__/ModalContent.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/Modal/__snapshots__/ModalContent.test.tsx.snap @@ -1,9 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Modal Content Test isOpen 1`] = ` - + - + `; exports[`Modal Content Test only body 1`] = ` - + - + `; exports[`Modal Content Test with footer 1`] = ` - + - + `; exports[`Modal Content Test with onclose 1`] = ` - + - + `; exports[`Modal Content test without footer 1`] = ` - + - + `; diff --git a/packages/patternfly-4/react-core/src/components/Nav/NavItem.tsx b/packages/patternfly-4/react-core/src/components/Nav/NavItem.tsx index 7bdc61eaef1..73ff2f8b2c4 100644 --- a/packages/patternfly-4/react-core/src/components/Nav/NavItem.tsx +++ b/packages/patternfly-4/react-core/src/components/Nav/NavItem.tsx @@ -20,35 +20,39 @@ export interface NavItemProps extends Omit, /** If true prevents the default anchor link action to occur. Set to true if you want to handle navigation yourself. */ preventDefault?: boolean; /** Callback for item click */ - onClick?: NavSelectClickHandler + onClick?: NavSelectClickHandler; + /** Component used to render NavItems */ + component?: React.ReactNode; } export const NavItem: React.FunctionComponent = ({ - children = null as React.ReactNode, - className = '', - to = '', - isActive = false, - groupId = null as string, - itemId = null as string, - preventDefault = false, - onClick = null as NavSelectClickHandler, + children = null as React.ReactNode, + className = '', + to = '', + isActive = false, + groupId = null as string, + itemId = null as string, + preventDefault = false, + onClick = null as NavSelectClickHandler, + component = 'a', ...props }: NavItemProps) => { + const Component = component as any; - const renderDefaultLink = ():React.ReactNode => { + const renderDefaultLink = (): React.ReactNode => { const preventLinkDefault = preventDefault || !to; return ( {(context: any) => ( - context.onSelect(e, groupId, itemId, to, preventLinkDefault, onClick)} + onClick={(e: any) => context.onSelect(e, groupId, itemId, to, preventLinkDefault, onClick)} className={css(styles.navLink, isActive && styles.modifiers.current, className)} aria-current={isActive ? 'page' : null} {...props} > {children} - + )} ); diff --git a/packages/patternfly-4/react-core/src/components/Nav/__snapshots__/Nav.test.tsx.snap b/packages/patternfly-4/react-core/src/components/Nav/__snapshots__/Nav.test.tsx.snap index f808c431627..e4ad4bdd820 100644 --- a/packages/patternfly-4/react-core/src/components/Nav/__snapshots__/Nav.test.tsx.snap +++ b/packages/patternfly-4/react-core/src/components/Nav/__snapshots__/Nav.test.tsx.snap @@ -241,6 +241,7 @@ exports[`Expandable Nav List - Trigger toggle 1`] = `
    )} {logo && ( - + {logo} - + )}
    )} diff --git a/packages/patternfly-4/react-core/src/components/Page/__snapshots__/Page.test.js.snap b/packages/patternfly-4/react-core/src/components/Page/__snapshots__/Page.test.js.snap index e7020aaad2e..3aec120b09c 100644 --- a/packages/patternfly-4/react-core/src/components/Page/__snapshots__/Page.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/Page/__snapshots__/Page.test.js.snap @@ -12,6 +12,7 @@ exports[`Check page horizontal layout example against snapshot 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} nav="Navigation" onNavToggle={[Function]} @@ -45,6 +46,7 @@ exports[`Check page horizontal layout example against snapshot 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} nav="Navigation" onNavToggle={[Function]} @@ -157,6 +159,7 @@ exports[`Check page to verify breadcrumb is created 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} nav="Navigation" onNavToggle={[Function]} @@ -190,6 +193,7 @@ exports[`Check page to verify breadcrumb is created 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} nav="Navigation" onNavToggle={[Function]} @@ -329,6 +333,7 @@ exports[`Check page to verify skip to content is created 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} nav="Navigation" onNavToggle={[Function]} @@ -384,6 +389,7 @@ exports[`Check page to verify skip to content is created 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} nav="Navigation" onNavToggle={[Function]} @@ -452,6 +458,7 @@ exports[`Check page to verify skip to content is created 1`] = ` > @@ -496,6 +503,7 @@ exports[`Check page to verify skip to content is created 1`] = ` > @@ -540,6 +548,7 @@ exports[`Check page to verify skip to content is created 1`] = ` > @@ -655,6 +664,7 @@ exports[`Check page vertical layout example against snapshot 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} onNavToggle={[Function]} showNavToggle={false} @@ -685,6 +695,7 @@ exports[`Check page vertical layout example against snapshot 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} onNavToggle={[Function]} showNavToggle={false} diff --git a/packages/patternfly-4/react-core/src/components/Page/__snapshots__/PageHeader.test.js.snap b/packages/patternfly-4/react-core/src/components/Page/__snapshots__/PageHeader.test.js.snap index 628d72e87aa..4022e02972d 100644 --- a/packages/patternfly-4/react-core/src/components/Page/__snapshots__/PageHeader.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/Page/__snapshots__/PageHeader.test.js.snap @@ -7,6 +7,7 @@ exports[`Check page vertical layout example against snapshot 1`] = ` className="" isNavOpen={true} logo="Logo" + logoComponent="a" logoProps={null} onNavToggle={[Function]} showNavToggle={false} diff --git a/packages/patternfly-4/react-core/src/components/Pagination/OptionsToggle.js b/packages/patternfly-4/react-core/src/components/Pagination/OptionsToggle.js index de9b1479614..797b2799f0b 100644 --- a/packages/patternfly-4/react-core/src/components/Pagination/OptionsToggle.js +++ b/packages/patternfly-4/react-core/src/components/Pagination/OptionsToggle.js @@ -1,43 +1,49 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { CaretDownIcon } from '@patternfly/react-icons'; import styles from '@patternfly/react-styles/css/components/OptionsMenu/options-menu'; import { css, getModifier } from '@patternfly/react-styles'; + import { fillTemplate } from '../../helpers'; +import { DropdownToggle } from '../Dropdown'; + +function OptionsToggle(props) { + const { + itemsTitle, + optionsToggle, + firstIndex, + lastIndex, + itemCount, + widgetId, + onToggle, + isOpen, + showToggle, + parentRef, + toggleTemplate: ToggleTemplate + } = props; -const OptionsToggle = ({ - itemsTitle, - optionsToggle, - firstIndex, - lastIndex, - itemCount, - widgetId, - onToggle, - isOpen, - toggleTemplate: ToggleTemplate -}) => ( -
    - - {typeof ToggleTemplate === 'string' ? ( - fillTemplate(ToggleTemplate, { firstIndex, lastIndex, itemCount, itemsTitle }) - ) : ( - + return ( +
    + + {typeof ToggleTemplate === 'string' ? ( + fillTemplate(ToggleTemplate, { firstIndex, lastIndex, itemCount, itemsTitle }) + ) : ( + + )} + + {showToggle && ( + )} - - -
    -); +
    + ); +} OptionsToggle.propTypes = { itemsTitle: PropTypes.string, @@ -48,6 +54,8 @@ OptionsToggle.propTypes = { widgetId: PropTypes.string, onToggle: PropTypes.func, isOpen: PropTypes.bool, + parentRef: PropTypes.any, + showToggle: PropTypes.bool, toggleTemplate: PropTypes.oneOfType([PropTypes.string, PropTypes.func]) }; @@ -60,7 +68,8 @@ OptionsToggle.defaultProps = { widgetId: '', onToggle: () => undefined, isOpen: false, + parentRef: null, + showToggle: true, toggleTemplate: '' }; - export default OptionsToggle; diff --git a/packages/patternfly-4/react-core/src/components/Pagination/Pagination.test.js b/packages/patternfly-4/react-core/src/components/Pagination/Pagination.test.js index a316c2a0839..bf8f7fae9f8 100644 --- a/packages/patternfly-4/react-core/src/components/Pagination/Pagination.test.js +++ b/packages/patternfly-4/react-core/src/components/Pagination/Pagination.test.js @@ -28,6 +28,11 @@ describe('component render', () => { expect(wrapper).toMatchSnapshot(); }); + test('empty per page options', () => { + const wrapper = mount(); + expect(wrapper).toMatchSnapshot(); + }); + test('no items', () => { const wrapper = mount(); expect(wrapper).toMatchSnapshot(); diff --git a/packages/patternfly-4/react-core/src/components/Pagination/PaginationOptionsMenu.js b/packages/patternfly-4/react-core/src/components/Pagination/PaginationOptionsMenu.js index 3e3e6928b83..1a9572d942d 100644 --- a/packages/patternfly-4/react-core/src/components/Pagination/PaginationOptionsMenu.js +++ b/packages/patternfly-4/react-core/src/components/Pagination/PaginationOptionsMenu.js @@ -112,7 +112,13 @@ class PaginationOptionsMenu extends Component { ...props } = this.props; return ( -
    +
    { + this.parentRef = ref; + }} + > @@ -123,6 +129,7 @@ class PaginationOptionsMenu extends Component { toggle={ 0} itemsTitle={itemsTitle} onToggle={this.onToggle} isOpen={this.state.isOpen} @@ -130,6 +137,7 @@ class PaginationOptionsMenu extends Component { lastIndex={lastIndex} itemCount={itemCount} widgetId={widgetId} + parentRef={this.parentRef} toggleTemplate={toggleTemplate} /> } diff --git a/packages/patternfly-4/react-core/src/components/Pagination/__snapshots__/Pagination.test.js.snap b/packages/patternfly-4/react-core/src/components/Pagination/__snapshots__/Pagination.test.js.snap index a30f459bf9a..622cb37aa61 100644 --- a/packages/patternfly-4/react-core/src/components/Pagination/__snapshots__/Pagination.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/Pagination/__snapshots__/Pagination.test.js.snap @@ -133,6 +133,7 @@ exports[`component render custom pagination toggle 1`] = ` > @@ -202,77 +203,219 @@ exports[`component render custom pagination toggle 1`] = ` lastIndex={10} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate="\${firstIndex} - \${lastIndex} - \${itemCount} - \${itemsTitle}" widgetId="pagination-options-menu" /> } > -
    + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - 1 - 10 - 40 - items - - -
    -
    -
    + + + +
    + +
    +
    @@ -317,6 +460,7 @@ exports[`component render custom pagination toggle 1`] = ` > @@ -361,6 +505,7 @@ exports[`component render custom pagination toggle 1`] = ` > @@ -426,6 +571,7 @@ exports[`component render custom pagination toggle 1`] = ` > @@ -470,6 +616,7 @@ exports[`component render custom pagination toggle 1`] = ` > @@ -622,95 +769,179 @@ exports[`component render custom perPageOptions 1`] = ` lastIndex={10} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate={[Function]} widgetId="pagination-options-menu" /> } > -
    + some + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - - - 1 - - - 10 - - - of - - 40 - - - items - - - -
    -
    -
    + + + +
    + +
    +
    @@ -755,6 +986,7 @@ exports[`component render custom perPageOptions 1`] = ` > @@ -799,6 +1031,7 @@ exports[`component render custom perPageOptions 1`] = ` > @@ -864,6 +1097,7 @@ exports[`component render custom perPageOptions 1`] = ` > @@ -908,6 +1142,7 @@ exports[`component render custom perPageOptions 1`] = ` > @@ -1072,6 +1307,7 @@ exports[`component render custom start end 1`] = ` > @@ -1134,102 +1370,647 @@ exports[`component render custom start end 1`] = ` position="left" toggle={ + } + > + + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } + > +
    + +
    + + + + 5 + - + 15 + + + of + + 40 + + + items + + + + + + + +
    +
    +
    +
    + +
    + + + + +
    + +`; + +exports[`component render empty per page options 1`] = ` + +
    +
    + 40 items +
    + +
    + + } > -
    + } > - -
    - - - - 5 - - - 15 - - - of - - 40 - - - items - - - -
    -
    -
    + + 1 + - + 10 + + + of + + 40 + + + items + + +
    + +
    +
    @@ -1274,6 +2055,7 @@ exports[`component render custom start end 1`] = ` > @@ -1318,6 +2100,7 @@ exports[`component render custom start end 1`] = ` > @@ -1383,6 +2166,7 @@ exports[`component render custom start end 1`] = ` > @@ -1427,6 +2211,7 @@ exports[`component render custom start end 1`] = ` > @@ -1591,6 +2376,7 @@ exports[`component render last page 1`] = ` > @@ -1660,95 +2446,237 @@ exports[`component render last page 1`] = ` lastIndex={20} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate={[Function]} widgetId="pagination-options-menu" /> } > -
    + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - - - 11 - - - 20 - - - of - - 20 - - - items - - - -
    -
    -
    + + + +
    + +
    +
    @@ -1793,6 +2721,7 @@ exports[`component render last page 1`] = ` > @@ -1837,6 +2766,7 @@ exports[`component render last page 1`] = ` > @@ -1902,6 +2832,7 @@ exports[`component render last page 1`] = ` > @@ -1946,6 +2877,7 @@ exports[`component render last page 1`] = ` > @@ -2126,6 +3058,7 @@ exports[`component render limited number of pages 1`] = ` > @@ -2179,95 +3112,237 @@ exports[`component render limited number of pages 1`] = ` lastIndex={20} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate={[Function]} widgetId="pagination-options-menu" /> } > -
    + 10 + + per page + + , + + 20 + + per page + + + + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - - - 1 - - - 20 - - - of - - 20 - - - items - - - -
    -
    -
    + + + +
    + +
    +
    @@ -2312,6 +3387,7 @@ exports[`component render limited number of pages 1`] = ` > @@ -2356,6 +3432,7 @@ exports[`component render limited number of pages 1`] = ` > @@ -2421,6 +3498,7 @@ exports[`component render limited number of pages 1`] = ` > @@ -2465,6 +3543,7 @@ exports[`component render limited number of pages 1`] = ` > @@ -2629,6 +3708,7 @@ exports[`component render no items 1`] = ` > @@ -2698,95 +3778,237 @@ exports[`component render no items 1`] = ` lastIndex={0} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate={[Function]} widgetId="pagination-options-menu" /> } > -
    + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - - - 0 - - - 0 - - - of - - 0 - - - items - - - -
    -
    -
    + + + +
    + +
    + @@ -2831,6 +4053,7 @@ exports[`component render no items 1`] = ` > @@ -2875,6 +4098,7 @@ exports[`component render no items 1`] = ` > @@ -2940,6 +4164,7 @@ exports[`component render no items 1`] = ` > @@ -2984,6 +4209,7 @@ exports[`component render no items 1`] = ` > @@ -3143,6 +4369,7 @@ exports[`component render should render correctly bottom 1`] = ` > @@ -3212,95 +4439,237 @@ exports[`component render should render correctly bottom 1`] = ` lastIndex={10} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate={[Function]} widgetId="pagination-options-menu" /> } > -
    + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - - - 1 - - - 10 - - - of - - 20 - - - items - - - -
    -
    -
    + + + + + + + @@ -3345,6 +4714,7 @@ exports[`component render should render correctly bottom 1`] = ` > @@ -3389,6 +4759,7 @@ exports[`component render should render correctly bottom 1`] = ` > @@ -3454,6 +4825,7 @@ exports[`component render should render correctly bottom 1`] = ` > @@ -3498,6 +4870,7 @@ exports[`component render should render correctly bottom 1`] = ` > @@ -3662,6 +5035,7 @@ exports[`component render should render correctly top 1`] = ` > @@ -3731,95 +5105,237 @@ exports[`component render should render correctly top 1`] = ` lastIndex={10} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate={[Function]} widgetId="pagination-options-menu" /> } > -
    + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - - - 1 - - - 10 - - - of - - 20 - - - items - - - -
    -
    -
    + + + + + + + @@ -3864,6 +5380,7 @@ exports[`component render should render correctly top 1`] = ` > @@ -3908,6 +5425,7 @@ exports[`component render should render correctly top 1`] = ` > @@ -3973,6 +5491,7 @@ exports[`component render should render correctly top 1`] = ` > @@ -4017,6 +5536,7 @@ exports[`component render should render correctly top 1`] = ` > @@ -4172,6 +5692,7 @@ exports[`component render titles 1`] = ` > @@ -4241,95 +5762,237 @@ exports[`component render titles 1`] = ` lastIndex={10} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate={[Function]} widgetId="pagination-options-menu" /> } > -
    + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - - - 1 - - - 10 - - - of - - 40 - - - values - - - -
    -
    -
    + + + + + + + @@ -4374,6 +6037,7 @@ exports[`component render titles 1`] = ` > @@ -4418,6 +6082,7 @@ exports[`component render titles 1`] = ` > @@ -4483,6 +6148,7 @@ exports[`component render titles 1`] = ` > @@ -4527,6 +6193,7 @@ exports[`component render titles 1`] = ` > @@ -4691,6 +6358,7 @@ exports[`component render up drop direction 1`] = ` > @@ -4760,95 +6428,237 @@ exports[`component render up drop direction 1`] = ` lastIndex={10} onToggle={[Function]} optionsToggle="Select" + parentRef={null} + showToggle={true} toggleTemplate={[Function]} widgetId="pagination-options-menu" /> } > -
    + 10 + + per page + + + + + , + + 20 + + per page + + , + + 50 + + per page + + , + + 100 + + per page + + , + ] + } + isGrouped={false} + isOpen={false} + isPlain={true} + onSelect={[Function]} + position="left" + toggle={ + + } > - -
    - - - - 1 - - - 10 - - - of - - 40 - - - items - - - -
    -
    -
    + + + + + + + @@ -4893,6 +6703,7 @@ exports[`component render up drop direction 1`] = ` > @@ -4937,6 +6748,7 @@ exports[`component render up drop direction 1`] = ` > @@ -5002,6 +6814,7 @@ exports[`component render up drop direction 1`] = ` > @@ -5046,6 +6859,7 @@ exports[`component render up drop direction 1`] = ` > diff --git a/packages/patternfly-4/react-core/src/components/Popover/Popover.md b/packages/patternfly-4/react-core/src/components/Popover/Popover.md index 6c74a996e3c..8c6d7a904cf 100644 --- a/packages/patternfly-4/react-core/src/components/Popover/Popover.md +++ b/packages/patternfly-4/react-core/src/components/Popover/Popover.md @@ -116,7 +116,7 @@ class AdvancedPopover extends React.Component { ## Popover (headless) ```js import React from 'react'; -import { Popover, PopoverPosition, Checkbox, Button } from '@patternfly/react-core'; +import { Popover, PopoverPosition, Button } from '@patternfly/react-core'; HeadlessPopover = () => ( ( ); ``` + +## Popover with Link +```js +import React from 'react'; +import { Popover, PopoverPosition, Button } from '@patternfly/react-core'; + +HeadlessPopover = () => ( + PatternFly is a community project that promotes design commonality and improved user experience. Its offerings include open source code, patterns, style guides, and an active community that helps support it all. + } + aria-label="Popover with Link" + closeBtnAriaLabel="Close Popover with Link" + footerContent="Popover Footer" + > + + +); +``` diff --git a/packages/patternfly-4/react-core/src/components/Popover/Popover.tsx b/packages/patternfly-4/react-core/src/components/Popover/Popover.tsx index 94855ca5316..a10adef89a0 100644 --- a/packages/patternfly-4/react-core/src/components/Popover/Popover.tsx +++ b/packages/patternfly-4/react-core/src/components/Popover/Popover.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import Tippy from '@tippy.js/react'; -import { Instance as TippyInstance, BasicPlacement } from 'tippy.js'; +import { Instance as TippyInstance } from 'tippy.js'; import { KEY_CODES } from '../../helpers/constants'; import styles from '@patternfly/react-styles/css/components/Popover/popover'; import { css, getModifier } from '@patternfly/react-styles'; diff --git a/packages/patternfly-4/react-core/src/components/Popover/PopoverCloseButton.tsx b/packages/patternfly-4/react-core/src/components/Popover/PopoverCloseButton.tsx index 981f0b37165..33b02df2a5a 100644 --- a/packages/patternfly-4/react-core/src/components/Popover/PopoverCloseButton.tsx +++ b/packages/patternfly-4/react-core/src/components/Popover/PopoverCloseButton.tsx @@ -2,18 +2,18 @@ import * as React from 'react'; import { Button } from '../Button'; import { TimesIcon } from '@patternfly/react-icons'; -export const PopoverCloseButton: React.FunctionComponent = ({ - onClose = () => undefined, - ...props +export const PopoverCloseButton: React.FunctionComponent = ({ + onClose = () => undefined as void, + ...props }) => ( - ); export interface PopoverCloseButtonProps { /** PopoverCloseButton onClose function */ - onClose?(): void; + onClose?: () => void; /** Aria label for the Close button */ 'aria-label': string; } diff --git a/packages/patternfly-4/react-core/src/components/Progress/__snapshots__/Progress.test.js.snap b/packages/patternfly-4/react-core/src/components/Progress/__snapshots__/Progress.test.js.snap index 5a443664318..90812a1bca3 100644 --- a/packages/patternfly-4/react-core/src/components/Progress/__snapshots__/Progress.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/Progress/__snapshots__/Progress.test.js.snap @@ -735,6 +735,7 @@ exports[`Progress variant danger 1`] = ` > @@ -938,6 +939,7 @@ exports[`Progress variant success 1`] = ` > diff --git a/packages/patternfly-4/react-core/src/components/Select/__snapshots__/Select.test.js.snap b/packages/patternfly-4/react-core/src/components/Select/__snapshots__/Select.test.js.snap index 268709ac2f2..c2871d830b6 100644 --- a/packages/patternfly-4/react-core/src/components/Select/__snapshots__/Select.test.js.snap +++ b/packages/patternfly-4/react-core/src/components/Select/__snapshots__/Select.test.js.snap @@ -65,6 +65,7 @@ exports[`checkbox select renders checkbox select groups successfully 1`] = ` @@ -482,6 +483,7 @@ exports[`checkbox select renders closed successfully 1`] = ` @@ -577,6 +579,7 @@ exports[`checkbox select renders expanded successfully 1`] = ` @@ -836,6 +839,7 @@ exports[`select single select renders closed successfully 1`] = ` @@ -933,6 +937,7 @@ exports[`select single select renders expanded successfully 1`] = ` @@ -1178,6 +1183,7 @@ exports[`typeahead multi select renders closed successfully 1`] = ` @@ -1287,6 +1293,7 @@ exports[`typeahead multi select renders expanded successfully 1`] = ` @@ -1581,6 +1588,7 @@ exports[`typeahead multi select renders selected successfully 1`] = `