From 90dfbf37e0bf19cb16da08d5f19e336e868f69bd Mon Sep 17 00:00:00 2001 From: orangemug Date: Wed, 3 Jun 2020 09:52:54 +0100 Subject: [PATCH] Added 'a11y' and 'source' addons to storybook as well as more stories --- .storybook/main.js | 14 +++- package-lock.json | 104 +++++++++++++++++++++++++++ package.json | 2 + stories/Button.stories.js | 5 +- stories/FieldArray.stories.js | 44 ++++++++++++ stories/FieldAutocomplete.stories.js | 28 ++++++++ stories/FieldCheckbox.stories.js | 39 ++++++++++ stories/FieldColor.stories.js | 4 +- stories/FieldDynamicArray.stories.js | 55 ++++++++++++++ stories/FieldEnum.stories.js | 76 ++++++++++++++++++++ stories/FieldFont.stories.js | 28 ++++++++ stories/FieldMultiInput.stories.js | 28 ++++++++ stories/FieldNumber.stories.js | 4 +- stories/FieldSelect.stories.js | 29 ++++++++ stories/FieldString.stories.js | 69 ++++++++++++++++++ stories/FieldSymbol.stories.js | 29 ++++++++ stories/FieldUrl.stories.js | 42 +++++++++++ 17 files changed, 594 insertions(+), 6 deletions(-) create mode 100644 stories/FieldArray.stories.js create mode 100644 stories/FieldAutocomplete.stories.js create mode 100644 stories/FieldCheckbox.stories.js create mode 100644 stories/FieldDynamicArray.stories.js create mode 100644 stories/FieldEnum.stories.js create mode 100644 stories/FieldFont.stories.js create mode 100644 stories/FieldMultiInput.stories.js create mode 100644 stories/FieldSelect.stories.js create mode 100644 stories/FieldString.stories.js create mode 100644 stories/FieldSymbol.stories.js create mode 100644 stories/FieldUrl.stories.js diff --git a/.storybook/main.js b/.storybook/main.js index 02169ea..81ab3a1 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -2,15 +2,23 @@ const rules = require('../config/webpack.rules'); module.exports = { stories: ['../stories/**/*.stories.js'], - addons: ['@storybook/addon-actions', '@storybook/addon-links'], + addons: [ + '@storybook/addon-actions', + '@storybook/addon-links', + '@storybook/addon-a11y/register', + '@storybook/addon-storysource', + ], webpackFinal: async config => { // do mutation to the config + console.log("config.module", config.module); return { ...config, module: { - ...config.module, - rules + rules: [ + ...config.module.rules, + ...rules, + ] } }; }, diff --git a/package-lock.json b/package-lock.json index 976b49a..4c73eae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1534,6 +1534,30 @@ "integrity": "sha512-/aPsuoj/1Dw/kzhkgz+ES6TxG0zfTMGLwuK2ZG00k/iJzYHTLCE8mVU8EPqEOp/lmxPoq1C1C9RYToRKb2KEfg==", "dev": true }, + "@storybook/addon-a11y": { + "version": "5.3.19", + "resolved": "https://registry.npmjs.org/@storybook/addon-a11y/-/addon-a11y-5.3.19.tgz", + "integrity": "sha512-obh2Uy8IeXU+UPQXoqT2Q0hRdAuQdfZjYdrGJ9RGoehVEzMxZlR0x1Cml5xf3u9v6+l72hi85RvA6YEGl+jKZw==", + "dev": true, + "requires": { + "@storybook/addons": "5.3.19", + "@storybook/api": "5.3.19", + "@storybook/client-logger": "5.3.19", + "@storybook/components": "5.3.19", + "@storybook/core-events": "5.3.19", + "@storybook/theming": "5.3.19", + "axe-core": "^3.3.2", + "core-js": "^3.0.1", + "global": "^4.3.2", + "memoizerific": "^1.11.3", + "react": "^16.8.3", + "react-redux": "^7.0.2", + "react-sizeme": "^2.5.2", + "redux": "^4.0.1", + "ts-dedent": "^1.1.0", + "util-deprecate": "^1.0.2" + } + }, "@storybook/addon-actions": { "version": "5.3.19", "resolved": "https://registry.npmjs.org/@storybook/addon-actions/-/addon-actions-5.3.19.tgz", @@ -1590,6 +1614,27 @@ } } }, + "@storybook/addon-storysource": { + "version": "5.3.19", + "resolved": "https://registry.npmjs.org/@storybook/addon-storysource/-/addon-storysource-5.3.19.tgz", + "integrity": "sha512-W7mIAHuxYT+b1huaHCHLkBAh2MbeWmF8CxeBCFiOgZaYYQUTDEh018HJF8u2AqiWSouRhcfzhTnGxOo0hNRBgw==", + "dev": true, + "requires": { + "@storybook/addons": "5.3.19", + "@storybook/components": "5.3.19", + "@storybook/router": "5.3.19", + "@storybook/source-loader": "5.3.19", + "@storybook/theming": "5.3.19", + "core-js": "^3.0.1", + "estraverse": "^4.2.0", + "loader-utils": "^1.2.3", + "prettier": "^1.16.4", + "prop-types": "^15.7.2", + "react-syntax-highlighter": "^11.0.2", + "regenerator-runtime": "^0.13.3", + "util-deprecate": "^1.0.2" + } + }, "@storybook/addons": { "version": "5.3.19", "resolved": "https://registry.npmjs.org/@storybook/addons/-/addons-5.3.19.tgz", @@ -2341,6 +2386,24 @@ } } }, + "@storybook/source-loader": { + "version": "5.3.19", + "resolved": "https://registry.npmjs.org/@storybook/source-loader/-/source-loader-5.3.19.tgz", + "integrity": "sha512-srSZRPgEOUse8nRVnlazweB2QGp63mPqM0uofg8zYARyaYSOzkC155ymdeiHsmiBTS3X3I0FQE4+KnwiH7iLtw==", + "dev": true, + "requires": { + "@storybook/addons": "5.3.19", + "@storybook/client-logger": "5.3.19", + "@storybook/csf": "0.0.1", + "core-js": "^3.0.1", + "estraverse": "^4.2.0", + "global": "^4.3.2", + "loader-utils": "^1.2.3", + "prettier": "^1.16.4", + "prop-types": "^15.7.2", + "regenerator-runtime": "^0.13.3" + } + }, "@storybook/theming": { "version": "5.3.19", "resolved": "https://registry.npmjs.org/@storybook/theming/-/theming-5.3.19.tgz", @@ -4232,6 +4295,12 @@ "integrity": "sha512-wMHVg2EOHaMRxbzgFJ9gtjOOCrI80OHLG14rxi28XwOW8ux6IiEbRCGGGqCtdAIg4FQCbW20k9RsT4y3gJlFug==", "dev": true }, + "axe-core": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-3.5.4.tgz", + "integrity": "sha512-JRuxixN5bPHre+815qnyqBQzNpRTqGxLWflvjr4REpGZ5o0WXm+ik2IS4PZ01EnacWmVRB4jCPWFiYENMiiasA==", + "dev": true + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -13920,6 +13989,12 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true + }, "pretty-error": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", @@ -15136,6 +15211,19 @@ "react-popper": "^1.3.7" } }, + "react-redux": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-7.2.0.tgz", + "integrity": "sha512-EvCAZYGfOLqwV7gh849xy9/pt55rJXPwmYvI4lilPM5rUT/1NxuuN59ipdBksRVSvz0KInbPnp4IfoXJXCqiDA==", + "dev": true, + "requires": { + "@babel/runtime": "^7.5.5", + "hoist-non-react-statics": "^3.3.0", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-is": "^16.9.0" + } + }, "react-sizeme": { "version": "2.6.12", "resolved": "https://registry.npmjs.org/react-sizeme/-/react-sizeme-2.6.12.tgz", @@ -15331,6 +15419,16 @@ } } }, + "redux": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/redux/-/redux-4.0.5.tgz", + "integrity": "sha512-VSz1uMAH24DM6MF72vcojpYPtrTUu3ByVWfPL1nPfVRb5mZVTve5GnNCUV53QM/BZ66xfWrm0CTWoM+Xlz8V1w==", + "dev": true, + "requires": { + "loose-envify": "^1.4.0", + "symbol-observable": "^1.2.0" + } + }, "refractor": { "version": "2.10.1", "resolved": "https://registry.npmjs.org/refractor/-/refractor-2.10.1.tgz", @@ -17656,6 +17754,12 @@ } } }, + "symbol-observable": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.2.0.tgz", + "integrity": "sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ==", + "dev": true + }, "symbol.prototype.description": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/symbol.prototype.description/-/symbol.prototype.description-1.0.2.tgz", diff --git a/package.json b/package.json index c77c8d6..047d86e 100644 --- a/package.json +++ b/package.json @@ -121,8 +121,10 @@ "@babel/preset-flow": "^7.0.0", "@babel/preset-react": "^7.6.3", "@mdi/js": "^5.0.45", + "@storybook/addon-a11y": "^5.3.19", "@storybook/addon-actions": "^5.3.19", "@storybook/addon-links": "^5.3.19", + "@storybook/addon-storysource": "^5.3.19", "@storybook/addons": "^5.3.19", "@storybook/react": "^5.3.19", "@storybook/theming": "^5.3.19", diff --git a/stories/Button.stories.js b/stories/Button.stories.js index a1dc3ac..c158d7c 100644 --- a/stories/Button.stories.js +++ b/stories/Button.stories.js @@ -2,13 +2,16 @@ import React from 'react'; import Button from '../src/components/Button'; import {action} from '@storybook/addon-actions'; import {Wrapper} from './ui'; +import {withA11y} from '@storybook/addon-a11y'; + export default { title: 'Button', component: Button, + decorators: [withA11y], }; -export const Simple = () => ( +export const Basic = () => (