diff --git a/addons/info/README.md b/addons/info/README.md deleted file mode 100644 index 7a19479ec3f8..000000000000 --- a/addons/info/README.md +++ /dev/null @@ -1,338 +0,0 @@ -# Storybook Info Addon - -Storybook Info Addon will show additional information for your stories in [Storybook](https://storybook.js.org). -Useful when you want to display usage or other types of documentation alongside your story. - -[Framework Support](https://github.com/storybookjs/storybook/blob/master/ADDONS_SUPPORT.md) - -![Screenshot](https://raw.githubusercontent.com/storybookjs/storybook/HEAD/addons/info/docs/home-screenshot.png) - -## Installation - -Install the following npm module: - -```sh -npm i -D @storybook/addon-info -``` - -## Basic usage - -Then, add `withInfo` as a decorator to your book of stories. -It is possible to add `info` by default to all or a subsection of stories by using a global or story decorator. - -It is important to declare this decorator as **the first decorator**, otherwise it won't work well. - -```js -// Globally in your .storybook/preview.js. -import { addDecorator } from '@storybook/react'; -import { withInfo } from '@storybook/addon-info'; - -addDecorator(withInfo); -``` - -or - -```js -export default { - title: 'Component', - decorators: [withInfo], -}; -``` - -Then, you can use the `info` parameter to either pass certain options or specific documentation text to your stories. -A complete list of possible configurations can be found [in a later section](#setting-global-options). -This can be done per book of stories: - -```js -import Component from './Component'; - -export default { - title: 'Component', - parameters: { - info: {}, - }, -}; -``` - -...or for each story individually: - -```js -import Component from './Component'; - -export default { - title: 'Component', -}; - -export const defaultView = () => ; -defaultView = { - parameters: { - info: { inline: true }, - }, -}; -``` - -It is also possible to disable the `info` addon entirely. -Depending on the scope at which you want to disable the addon, pass the following parameters object either to an individual story or to an `addParameters` call. - -``` -info: { - disable: true, -} -``` - -## Markdown - -The `info` addon also supports markdown. -To use markdown as additional textual documentation for your stories, either pass it directly as a String to the `info` parameters, or use the `text` option. - -```js -info: { - text: ` - description or documentation about my component, supports markdown - - ~~~js - - ~~~ - `, -} -``` - -## Setting Global Options - -To configure default options for all usage of the info addon, pass a option object along with the decorator in `.storybook/preview.js`. - -```js -import { withInfo } from '@storybook/addon-info'; - -addDecorator( - withInfo({ - header: false, - }) -); -``` - -Configuration parameters can be set at 3 different locations: passed as default options along the `addDecorator` call, passed as an object of parameters to a book of stories to the `addParameters` call, and passed as direct parameters to each individual story. -In order, all of them will be combined together, with a later call overriding the previous set configurations on a per-key basis. - -## Options and Defaults - -```js -{ - /** - * Text to display with storybook component - */ - text?: string; - /** - * Displays info inline vs click button to view - * @default false - */ - inline: boolean, - /** - * Toggles display of header with component name and description - * @default true - */ - header: boolean, - /** - * Displays the source of story Component - * @default true - */ - source: boolean, - /** - * Components used in story - * Displays Prop Tables with these components - * @default [] - */ - propTables: Array, - /** - * Exclude Components from being shown in Prop Tables section - * Accepts an array of component classes or functions - * @default [] - */ - propTablesExclude: Array, - /** - * Overrides styles of addon. The object should follow this shape: - * https://github.com/storybookjs/storybook/blob/master/addons/info/src/components/Story.js#L19. - * This prop can also accept a function which has the default stylesheet passed as an argument - */ - styles: Object | Function, - /** - * Overrides components used to display markdown - * @default {} - */ - components: { [key: string]: React.ComponentType }, - /** - * Max props to display per line in source code - * @default 3 - */ - maxPropsIntoLine: number, - /** - * Displays the first 10 characters of the prop name - * @default 3 - */ - maxPropObjectKeys: number, - /** - * Displays the first 10 items in the default prop array - * @default 3 - */ - maxPropArrayLength: number, - /** - * Displays the first 100 characters in the default prop string - * @default 50 - */ - maxPropStringLength: number, - /** - * Override the component used to render the props table - * @default PropTable - */ - TableComponent: React.ComponentType, - /** - * Will exclude any respective properties whose name is included in array - * @default [] - */ - excludedPropTypes: Array, -} -``` - -### Rendering a Custom Table - -The `TableComponent` option allows you to define how the prop table should be rendered. Your component will be rendered with the following props. - -```js - { - propDefinitions: Array<{ - property: string, // The name of the prop - propType: Object | string, // The prop type. TODO: info about what this object is... - required: boolean, // True if the prop is required - description: string, // The description of the prop - defaultValue: any // The default value of the prop - }> - } -``` - -Example: - -```js -// button.js -// @flow -import React from 'react'; - -const paddingStyles = { - small: '4px 8px', - medium: '8px 16px', -}; - -const Button = ({ - size, - ...rest -}: { - /** The size of the button */ - size: 'small' | 'medium', -}) => { - const style = { - padding: paddingStyles[size] || '', - }; - return -); - -DocgenButton.defaultProps = { - disabled: false, - onClick: () => {}, - style: {}, -}; - -DocgenButton.propTypes = { - /** Boolean indicating whether the button should render as disabled */ - disabled: PropTypes.bool, - /** button label. */ - label: PropTypes.string.isRequired, - /** onClick handler */ - onClick: PropTypes.func, - /** component styles */ - style: PropTypes.shape, -}; - -export default DocgenButton; -``` - -Comments above flow types are also supported. Storybook Info Addon should now render all the correct types for your component if the PropTypes are in the same file as the React component. - -## The FAQ - -**Components lose their names on static build** - -Component names also get minified with other javascript code when building for production. -When creating components, set the `displayName` static property to show the correct component name on static builds. diff --git a/addons/info/docs/home-screenshot.png b/addons/info/docs/home-screenshot.png deleted file mode 100644 index e31189043753..000000000000 Binary files a/addons/info/docs/home-screenshot.png and /dev/null differ diff --git a/addons/info/package.json b/addons/info/package.json deleted file mode 100644 index 72e410117b22..000000000000 --- a/addons/info/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "@storybook/addon-info", - "version": "6.0.0-alpha.2", - "description": "A Storybook addon to show additional information for your stories.", - "keywords": [ - "addon", - "storybook" - ], - "homepage": "https://github.com/storybookjs/storybook/tree/master/addons/info", - "bugs": { - "url": "https://github.com/storybookjs/storybook/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/storybookjs/storybook.git", - "directory": "addons/info" - }, - "license": "MIT", - "files": [ - "dist/**/*", - "README.md", - "*.js", - "*.d.ts" - ], - "main": "dist/index.js", - "scripts": { - "prepare": "node ../../scripts/prepare.js" - }, - "dependencies": { - "@storybook/addons": "6.0.0-alpha.2", - "@storybook/client-logger": "6.0.0-alpha.2", - "@storybook/components": "6.0.0-alpha.2", - "@storybook/theming": "6.0.0-alpha.2", - "core-js": "^3.0.1", - "global": "^4.3.2", - "marksy": "^8.0.0", - "nested-object-assign": "^1.0.3", - "prop-types": "^15.7.2", - "react": "^16.8.3", - "react-addons-create-fragment": "^15.6.2", - "react-element-to-jsx-string": "^14.0.2", - "react-is": "^16.8.3", - "react-lifecycles-compat": "^3.0.4", - "util-deprecate": "^1.0.2" - }, - "devDependencies": { - "react-test-renderer": "^16.8.3" - }, - "peerDependencies": { - "react": "*" - }, - "publishConfig": { - "access": "public" - }, - "gitHead": "4b9d901add9452525135caae98ae5f78dd8da9ff" -} diff --git a/addons/info/src/__snapshots__/index.test.js.snap b/addons/info/src/__snapshots__/index.test.js.snap deleted file mode 100644 index 7dc48103b4f2..000000000000 --- a/addons/info/src/__snapshots__/index.test.js.snap +++ /dev/null @@ -1,10004 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`addon Info should render and external markdown 1`] = ` - - -
-
- It's a - story: - -
-

- x => x + 1 -

-

- [object Object] -

-

- 1,2,3 -

-

- 7 -

-
- seven -
-
- true -
-

- undefined -

- - test - - - storiesOf - -
    -
  • - 1 -
  • -
  • - 2 -
  • -
-
-
-
-
- -
-
-`; - -exports[`addon Info should render and markdown 1`] = ` - - -
-
- It's a - story: - -
-

- x => x + 1 -

-

- [object Object] -

-

- 1,2,3 -

-

- 7 -

-
- seven -
-
- true -
-

- undefined -

- - test - - - storiesOf - -
    -
  • - 1 -
  • -
  • - 2 -
  • -
-
-
-
-
- -
-
-`; - -exports[`addon Info should render for memoized component 1`] = ` - - -
-
- It's a - story: - -
-

- x => x + 1 -

-

- [object Object] -

-

- 1,2,3 -

-

- 7 -

-
- seven -
-
- true -
-

- undefined -

- - test - - - storiesOf - -
    -
  • - 1 -
  • -
  • - 2 -
  • -
-
-
-
-
- -
-
-`; - -exports[`addon Info should render component description if story kind matches component 1`] = ` -.emotion-10 { - position: relative; - overflow: hidden; - color: #333333; - border: 1px solid rgba(0,0,0,.1); - background: #FFFFFF; -} - -.emotion-5 { - position: relative; -} - -.emotion-5 code { - padding-right: 10px; -} - -.emotion-5 * .token { - font-family: "Operator Mono","Fira Code Retina","Fira Code","FiraCode-Retina","Andale Mono","Lucida Console",Consolas,Monaco,monospace; - -webkit-font-smoothing: antialiased; -} - -.emotion-5 * .token.comment { - color: #008000; - font-style: italic; -} - -.emotion-5 * .token.prolog { - color: #008000; - font-style: italic; -} - -.emotion-5 * .token.doctype { - color: #008000; - font-style: italic; -} - -.emotion-5 * .token.cdata { - color: #008000; - font-style: italic; -} - -.emotion-5 * .token.string { - color: #A31515; -} - -.emotion-5 * .token.punctuation { - color: #393A34; -} - -.emotion-5 * .token.operator { - color: #393A34; -} - -.emotion-5 * .token.url { - color: #36acaa; -} - -.emotion-5 * .token.symbol { - color: #36acaa; -} - -.emotion-5 * .token.number { - color: #36acaa; -} - -.emotion-5 * .token.boolean { - color: #36acaa; -} - -.emotion-5 * .token.variable { - color: #36acaa; -} - -.emotion-5 * .token.constant { - color: #36acaa; -} - -.emotion-5 * .token.inserted { - color: #36acaa; -} - -.emotion-5 * .token.atrule { - color: #0000ff; -} - -.emotion-5 * .token.keyword { - color: #0000ff; -} - -.emotion-5 * .token.attr-value { - color: #0000ff; -} - -.emotion-5 * .token.function { - color: #393A34; -} - -.emotion-5 * .token.deleted { - color: #9a050f; -} - -.emotion-5 * .token.important { - font-weight: bold; -} - -.emotion-5 * .token.bold { - font-weight: bold; -} - -.emotion-5 * .token.italic { - font-style: italic; -} - -.emotion-5 * .token.class-name { - color: #2B91AF; -} - -.emotion-5 * .token.tag { - color: #800000; -} - -.emotion-5 * .token.selector { - color: #800000; -} - -.emotion-5 * .token.attr-name { - color: #ff0000; -} - -.emotion-5 * .token.property { - color: #ff0000; -} - -.emotion-5 * .token.regex { - color: #ff0000; -} - -.emotion-5 * .token.entity { - color: #ff0000; -} - -.emotion-5 * .token.directive.tag .tag { - background: #ffff00; - color: #393A34; -} - -.emotion-5 * .language-json .token.boolean { - color: #0000ff; -} - -.emotion-5 * .language-json .token.number { - color: #0000ff; -} - -.emotion-5 * .language-json .token.property { - color: #2B91AF; -} - -.emotion-5 * .namespace { - opacity: 0.7; -} - -.emotion-2 { - overflow-y: auto; - height: 100%; - overflow-x: auto; - width: 100%; - position: relative; -} - -.emotion-2 code { - padding-right: 10px; -} - -.emotion-2 * .token { - font-family: "Operator Mono","Fira Code Retina","Fira Code","FiraCode-Retina","Andale Mono","Lucida Console",Consolas,Monaco,monospace; - -webkit-font-smoothing: antialiased; -} - -.emotion-2 * .token.comment { - color: #008000; - font-style: italic; -} - -.emotion-2 * .token.prolog { - color: #008000; - font-style: italic; -} - -.emotion-2 * .token.doctype { - color: #008000; - font-style: italic; -} - -.emotion-2 * .token.cdata { - color: #008000; - font-style: italic; -} - -.emotion-2 * .token.string { - color: #A31515; -} - -.emotion-2 * .token.punctuation { - color: #393A34; -} - -.emotion-2 * .token.operator { - color: #393A34; -} - -.emotion-2 * .token.url { - color: #36acaa; -} - -.emotion-2 * .token.symbol { - color: #36acaa; -} - -.emotion-2 * .token.number { - color: #36acaa; -} - -.emotion-2 * .token.boolean { - color: #36acaa; -} - -.emotion-2 * .token.variable { - color: #36acaa; -} - -.emotion-2 * .token.constant { - color: #36acaa; -} - -.emotion-2 * .token.inserted { - color: #36acaa; -} - -.emotion-2 * .token.atrule { - color: #0000ff; -} - -.emotion-2 * .token.keyword { - color: #0000ff; -} - -.emotion-2 * .token.attr-value { - color: #0000ff; -} - -.emotion-2 * .token.function { - color: #393A34; -} - -.emotion-2 * .token.deleted { - color: #9a050f; -} - -.emotion-2 * .token.important { - font-weight: bold; -} - -.emotion-2 * .token.bold { - font-weight: bold; -} - -.emotion-2 * .token.italic { - font-style: italic; -} - -.emotion-2 * .token.class-name { - color: #2B91AF; -} - -.emotion-2 * .token.tag { - color: #800000; -} - -.emotion-2 * .token.selector { - color: #800000; -} - -.emotion-2 * .token.attr-name { - color: #ff0000; -} - -.emotion-2 * .token.property { - color: #ff0000; -} - -.emotion-2 * .token.regex { - color: #ff0000; -} - -.emotion-2 * .token.entity { - color: #ff0000; -} - -.emotion-2 * .token.directive.tag .tag { - background: #ffff00; - color: #393A34; -} - -.emotion-2 * .language-json .token.boolean { - color: #0000ff; -} - -.emotion-2 * .language-json .token.number { - color: #0000ff; -} - -.emotion-2 * .language-json .token.property { - color: #2B91AF; -} - -.emotion-2 * .namespace { - opacity: 0.7; -} - -.emotion-1 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: start; - -webkit-justify-content: flex-start; - -ms-flex-pack: start; - justify-content: flex-start; - margin: 0; - padding: 10px; -} - -.emotion-0 { - -webkit-flex: 1; - -ms-flex: 1; - flex: 1; - padding-right: 0; - opacity: 1; -} - -.emotion-9 { - position: absolute; - bottom: 0; - right: 0; - max-width: 100%; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - background: #FFFFFF; - z-index: 1; -} - -.emotion-8 { - border: 0 none; - padding: 4px 10px; - cursor: pointer; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - color: #333333; - background: #FFFFFF; - font-size: 12px; - line-height: 16px; - font-family: "Nunito Sans",-apple-system,".SFNSText-Regular","San Francisco",BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Helvetica,Arial,sans-serif; - font-weight: 700; - border-top: 1px solid rgba(0,0,0,.1); - border-left: 1px solid rgba(0,0,0,.1); - margin-left: -1px; - border-radius: 4px 0 0 0; -} - -.emotion-8:not(:last-child) { - border-right: 1px solid rgba(0,0,0,.1); -} - -.emotion-8 + * { - border-left: 1px solid rgba(0,0,0,.1); - border-radius: 0; -} - -.emotion-8:focus { - box-shadow: #1EA7FD 0 -3px 0 0 inset; - outline: 0 none; -} - - - -
-
-
-

- TestComponent -

-

- Basic test -

-
-
-
-
-
- It's a - Basic test - story: - -
-

- x => x + 1 -

-

- [object Object] -

-

- 1,2,3 -

-

- 7 -

-
- seven -
-
- true -
-

- undefined -

- - test - - - storiesOf - -
    -
  • - 1 -
  • -
  • - 2 -
  • -
-
-
-
-
-
-
-

-

- Awesome test component description -

- -

-

- with markdown support -

- -

-

- - bold - - - - cursive - -

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - "ctr": 82, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "tags": Array [ - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - ], - }, - } - } - serialized={ - Object { - "map": undefined, - "name": "nh5djz", - "next": undefined, - "styles": "[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start;}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit;}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto !important;height:auto !important;z-index:0;}.simplebar-offset{direction:inherit !important;resize:none !important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch;}.simplebar-content-wrapper{direction:inherit;position:relative;display:block;visibility:visible;}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none;}.simplebar-height-auto-observer-wrapper{height:100%;width:inherit;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0;}.simplebar-height-auto-observer{display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1;}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden;}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all;}.simplebar-scrollbar{position:absolute;right:2px;width:7px;min-height:10px;}.simplebar-scrollbar:before{position:absolute;content:\\"\\";border-radius:7px;left:0;right:0;opacity:0;transition:opacity 0.2s linear;background:#333333;}.simplebar-track .simplebar-scrollbar.simplebar-visible:before{opacity:0.5;transition:opacity 0s linear;}.simplebar-track.simplebar-vertical{top:0;width:11px;}.simplebar-track.simplebar-vertical .simplebar-scrollbar:before{top:2px;bottom:2px;}.simplebar-track.simplebar-horizontal{left:0;height:11px;}.simplebar-track.simplebar-horizontal .simplebar-scrollbar:before{height:100%;left:2px;right:2px;}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:2px;height:7px;min-height:0;min-width:10px;width:auto;}[data-simplebar-direction=\\"rtl\\"] .simplebar-track.simplebar-vertical{right:auto;left:0;}", - "toString": [Function], - } - } - /> - - - - -
-
-
-
-
-
-
-
-
- - -
-                                                
-                                                  
-                                                    a
-                                                    
-                                                      ;
-                                                    
-                                                  
-                                                
-                                              
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - - -
- - - -
-
-
-
- - - -
-

- Story Source -

- -
" - format={false} - language="jsx" - > - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - "ctr": 82, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "tags": Array [ - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - ], - }, - } - } - serialized={ - Object { - "map": undefined, - "name": "nh5djz", - "next": undefined, - "styles": "[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start;}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit;}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto !important;height:auto !important;z-index:0;}.simplebar-offset{direction:inherit !important;resize:none !important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch;}.simplebar-content-wrapper{direction:inherit;position:relative;display:block;visibility:visible;}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none;}.simplebar-height-auto-observer-wrapper{height:100%;width:inherit;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0;}.simplebar-height-auto-observer{display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1;}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden;}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all;}.simplebar-scrollbar{position:absolute;right:2px;width:7px;min-height:10px;}.simplebar-scrollbar:before{position:absolute;content:\\"\\";border-radius:7px;left:0;right:0;opacity:0;transition:opacity 0.2s linear;background:#333333;}.simplebar-track .simplebar-scrollbar.simplebar-visible:before{opacity:0.5;transition:opacity 0s linear;}.simplebar-track.simplebar-vertical{top:0;width:11px;}.simplebar-track.simplebar-vertical .simplebar-scrollbar:before{top:2px;bottom:2px;}.simplebar-track.simplebar-horizontal{left:0;height:11px;}.simplebar-track.simplebar-horizontal .simplebar-scrollbar:before{height:100%;left:2px;right:2px;}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:2px;height:7px;min-height:0;min-width:10px;width:auto;}[data-simplebar-direction=\\"rtl\\"] .simplebar-track.simplebar-vertical{right:auto;left:0;}", - "toString": [Function], - } - } - /> - - - - -
-
-
-
-
-
-
-
-
- - -
-                                                
-                                                  
-                                                    
-                                                      
-                                                        
-                                                          <
-                                                        
-                                                        div
-                                                      
-                                                      
-                                                        >
-                                                      
-                                                    
-                                                    
-                                                      
-  It's a Basic test story:
-  
-                                                    
-                                                    
-                                                      
-                                                        
-                                                          <
-                                                        
-                                                        
-                                                          TestComponent
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        array
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          [
-                                                        
-                                                        
-      
-                                                        
-                                                          1
-                                                        
-                                                        
-                                                          ,
-                                                        
-                                                        
-      
-                                                        
-                                                          2
-                                                        
-                                                        
-                                                          ,
-                                                        
-                                                        
-      
-                                                        
-                                                          3
-                                                        
-                                                        
-    
-                                                        
-                                                          ]
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        bool
-                                                      
-                                                      
-    
-                                                      
-                                                        func
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          function
-                                                        
-                                                         
-                                                        
-                                                          noRefCheck
-                                                        
-                                                        
-                                                          (
-                                                        
-                                                        
-                                                          )
-                                                        
-                                                         
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        number
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          7
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        obj
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-      a
-                                                        
-                                                          :
-                                                        
-                                                         
-                                                        
-                                                          'a'
-                                                        
-                                                        
-                                                          ,
-                                                        
-                                                        
-      b
-                                                        
-                                                          :
-                                                        
-                                                         
-                                                        
-                                                          'b'
-                                                        
-                                                        
-    
-                                                        
-                                                          }
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        string
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          "
-                                                        
-                                                        seven
-                                                        
-                                                          "
-                                                        
-                                                      
-                                                      
-  
-                                                      
-                                                        />
-                                                      
-                                                    
-                                                    
-                                                      
-
-                                                    
-                                                    
-                                                      
-                                                        
-                                                          </
-                                                        
-                                                        div
-                                                      
-                                                      
-                                                        >
-                                                      
-                                                    
-                                                  
-                                                
-                                              
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - - -
- - - -
-
-
-
- - - -
-
-
- - -`; - -exports[`addon Info should render component description if story name matches component 1`] = ` -.emotion-10 { - position: relative; - overflow: hidden; - color: #333333; - border: 1px solid rgba(0,0,0,.1); - background: #FFFFFF; -} - -.emotion-5 { - position: relative; -} - -.emotion-5 code { - padding-right: 10px; -} - -.emotion-5 * .token { - font-family: "Operator Mono","Fira Code Retina","Fira Code","FiraCode-Retina","Andale Mono","Lucida Console",Consolas,Monaco,monospace; - -webkit-font-smoothing: antialiased; -} - -.emotion-5 * .token.comment { - color: #008000; - font-style: italic; -} - -.emotion-5 * .token.prolog { - color: #008000; - font-style: italic; -} - -.emotion-5 * .token.doctype { - color: #008000; - font-style: italic; -} - -.emotion-5 * .token.cdata { - color: #008000; - font-style: italic; -} - -.emotion-5 * .token.string { - color: #A31515; -} - -.emotion-5 * .token.punctuation { - color: #393A34; -} - -.emotion-5 * .token.operator { - color: #393A34; -} - -.emotion-5 * .token.url { - color: #36acaa; -} - -.emotion-5 * .token.symbol { - color: #36acaa; -} - -.emotion-5 * .token.number { - color: #36acaa; -} - -.emotion-5 * .token.boolean { - color: #36acaa; -} - -.emotion-5 * .token.variable { - color: #36acaa; -} - -.emotion-5 * .token.constant { - color: #36acaa; -} - -.emotion-5 * .token.inserted { - color: #36acaa; -} - -.emotion-5 * .token.atrule { - color: #0000ff; -} - -.emotion-5 * .token.keyword { - color: #0000ff; -} - -.emotion-5 * .token.attr-value { - color: #0000ff; -} - -.emotion-5 * .token.function { - color: #393A34; -} - -.emotion-5 * .token.deleted { - color: #9a050f; -} - -.emotion-5 * .token.important { - font-weight: bold; -} - -.emotion-5 * .token.bold { - font-weight: bold; -} - -.emotion-5 * .token.italic { - font-style: italic; -} - -.emotion-5 * .token.class-name { - color: #2B91AF; -} - -.emotion-5 * .token.tag { - color: #800000; -} - -.emotion-5 * .token.selector { - color: #800000; -} - -.emotion-5 * .token.attr-name { - color: #ff0000; -} - -.emotion-5 * .token.property { - color: #ff0000; -} - -.emotion-5 * .token.regex { - color: #ff0000; -} - -.emotion-5 * .token.entity { - color: #ff0000; -} - -.emotion-5 * .token.directive.tag .tag { - background: #ffff00; - color: #393A34; -} - -.emotion-5 * .language-json .token.boolean { - color: #0000ff; -} - -.emotion-5 * .language-json .token.number { - color: #0000ff; -} - -.emotion-5 * .language-json .token.property { - color: #2B91AF; -} - -.emotion-5 * .namespace { - opacity: 0.7; -} - -.emotion-2 { - overflow-y: auto; - height: 100%; - overflow-x: auto; - width: 100%; - position: relative; -} - -.emotion-2 code { - padding-right: 10px; -} - -.emotion-2 * .token { - font-family: "Operator Mono","Fira Code Retina","Fira Code","FiraCode-Retina","Andale Mono","Lucida Console",Consolas,Monaco,monospace; - -webkit-font-smoothing: antialiased; -} - -.emotion-2 * .token.comment { - color: #008000; - font-style: italic; -} - -.emotion-2 * .token.prolog { - color: #008000; - font-style: italic; -} - -.emotion-2 * .token.doctype { - color: #008000; - font-style: italic; -} - -.emotion-2 * .token.cdata { - color: #008000; - font-style: italic; -} - -.emotion-2 * .token.string { - color: #A31515; -} - -.emotion-2 * .token.punctuation { - color: #393A34; -} - -.emotion-2 * .token.operator { - color: #393A34; -} - -.emotion-2 * .token.url { - color: #36acaa; -} - -.emotion-2 * .token.symbol { - color: #36acaa; -} - -.emotion-2 * .token.number { - color: #36acaa; -} - -.emotion-2 * .token.boolean { - color: #36acaa; -} - -.emotion-2 * .token.variable { - color: #36acaa; -} - -.emotion-2 * .token.constant { - color: #36acaa; -} - -.emotion-2 * .token.inserted { - color: #36acaa; -} - -.emotion-2 * .token.atrule { - color: #0000ff; -} - -.emotion-2 * .token.keyword { - color: #0000ff; -} - -.emotion-2 * .token.attr-value { - color: #0000ff; -} - -.emotion-2 * .token.function { - color: #393A34; -} - -.emotion-2 * .token.deleted { - color: #9a050f; -} - -.emotion-2 * .token.important { - font-weight: bold; -} - -.emotion-2 * .token.bold { - font-weight: bold; -} - -.emotion-2 * .token.italic { - font-style: italic; -} - -.emotion-2 * .token.class-name { - color: #2B91AF; -} - -.emotion-2 * .token.tag { - color: #800000; -} - -.emotion-2 * .token.selector { - color: #800000; -} - -.emotion-2 * .token.attr-name { - color: #ff0000; -} - -.emotion-2 * .token.property { - color: #ff0000; -} - -.emotion-2 * .token.regex { - color: #ff0000; -} - -.emotion-2 * .token.entity { - color: #ff0000; -} - -.emotion-2 * .token.directive.tag .tag { - background: #ffff00; - color: #393A34; -} - -.emotion-2 * .language-json .token.boolean { - color: #0000ff; -} - -.emotion-2 * .language-json .token.number { - color: #0000ff; -} - -.emotion-2 * .language-json .token.property { - color: #2B91AF; -} - -.emotion-2 * .namespace { - opacity: 0.7; -} - -.emotion-1 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: start; - -webkit-justify-content: flex-start; - -ms-flex-pack: start; - justify-content: flex-start; - margin: 0; - padding: 10px; -} - -.emotion-0 { - -webkit-flex: 1; - -ms-flex: 1; - flex: 1; - padding-right: 0; - opacity: 1; -} - -.emotion-9 { - position: absolute; - bottom: 0; - right: 0; - max-width: 100%; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - background: #FFFFFF; - z-index: 1; -} - -.emotion-8 { - border: 0 none; - padding: 4px 10px; - cursor: pointer; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - color: #333333; - background: #FFFFFF; - font-size: 12px; - line-height: 16px; - font-family: "Nunito Sans",-apple-system,".SFNSText-Regular","San Francisco",BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Helvetica,Arial,sans-serif; - font-weight: 700; - border-top: 1px solid rgba(0,0,0,.1); - border-left: 1px solid rgba(0,0,0,.1); - margin-left: -1px; - border-radius: 4px 0 0 0; -} - -.emotion-8:not(:last-child) { - border-right: 1px solid rgba(0,0,0,.1); -} - -.emotion-8 + * { - border-left: 1px solid rgba(0,0,0,.1); - border-radius: 0; -} - -.emotion-8:focus { - box-shadow: #1EA7FD 0 -3px 0 0 inset; - outline: 0 none; -} - - - -
-
-
-

- Test Components -

-

- TestComponent -

-
-
-
-
-
- It's a - TestComponent - story: - -
-

- x => x + 1 -

-

- [object Object] -

-

- 1,2,3 -

-

- 7 -

-
- seven -
-
- true -
-

- undefined -

- - test - - - storiesOf - -
    -
  • - 1 -
  • -
  • - 2 -
  • -
-
-
-
-
-
-
-

-

- Awesome test component description -

- -

-

- with markdown support -

- -

-

- - bold - - - - cursive - -

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - "ctr": 82, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "tags": Array [ - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - ], - }, - } - } - serialized={ - Object { - "map": undefined, - "name": "nh5djz", - "next": undefined, - "styles": "[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start;}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit;}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto !important;height:auto !important;z-index:0;}.simplebar-offset{direction:inherit !important;resize:none !important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch;}.simplebar-content-wrapper{direction:inherit;position:relative;display:block;visibility:visible;}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none;}.simplebar-height-auto-observer-wrapper{height:100%;width:inherit;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0;}.simplebar-height-auto-observer{display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1;}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden;}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all;}.simplebar-scrollbar{position:absolute;right:2px;width:7px;min-height:10px;}.simplebar-scrollbar:before{position:absolute;content:\\"\\";border-radius:7px;left:0;right:0;opacity:0;transition:opacity 0.2s linear;background:#333333;}.simplebar-track .simplebar-scrollbar.simplebar-visible:before{opacity:0.5;transition:opacity 0s linear;}.simplebar-track.simplebar-vertical{top:0;width:11px;}.simplebar-track.simplebar-vertical .simplebar-scrollbar:before{top:2px;bottom:2px;}.simplebar-track.simplebar-horizontal{left:0;height:11px;}.simplebar-track.simplebar-horizontal .simplebar-scrollbar:before{height:100%;left:2px;right:2px;}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:2px;height:7px;min-height:0;min-width:10px;width:auto;}[data-simplebar-direction=\\"rtl\\"] .simplebar-track.simplebar-vertical{right:auto;left:0;}", - "toString": [Function], - } - } - /> - - - - -
-
-
-
-
-
-
-
-
- - -
-                                                
-                                                  
-                                                    a
-                                                    
-                                                      ;
-                                                    
-                                                  
-                                                
-                                              
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - - -
- - - -
-
-
-
- - - -
-

- Story Source -

- -
" - format={false} - language="jsx" - > - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - "ctr": 82, - "isSpeedy": false, - "key": "css", - "nonce": undefined, - "tags": Array [ - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - , - ], - }, - } - } - serialized={ - Object { - "map": undefined, - "name": "nh5djz", - "next": undefined, - "styles": "[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start;}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit;}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto !important;height:auto !important;z-index:0;}.simplebar-offset{direction:inherit !important;resize:none !important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch;}.simplebar-content-wrapper{direction:inherit;position:relative;display:block;visibility:visible;}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none;}.simplebar-height-auto-observer-wrapper{height:100%;width:inherit;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0;}.simplebar-height-auto-observer{display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1;}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden;}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all;}.simplebar-scrollbar{position:absolute;right:2px;width:7px;min-height:10px;}.simplebar-scrollbar:before{position:absolute;content:\\"\\";border-radius:7px;left:0;right:0;opacity:0;transition:opacity 0.2s linear;background:#333333;}.simplebar-track .simplebar-scrollbar.simplebar-visible:before{opacity:0.5;transition:opacity 0s linear;}.simplebar-track.simplebar-vertical{top:0;width:11px;}.simplebar-track.simplebar-vertical .simplebar-scrollbar:before{top:2px;bottom:2px;}.simplebar-track.simplebar-horizontal{left:0;height:11px;}.simplebar-track.simplebar-horizontal .simplebar-scrollbar:before{height:100%;left:2px;right:2px;}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:2px;height:7px;min-height:0;min-width:10px;width:auto;}[data-simplebar-direction=\\"rtl\\"] .simplebar-track.simplebar-vertical{right:auto;left:0;}", - "toString": [Function], - } - } - /> - - - - -
-
-
-
-
-
-
-
-
- - -
-                                                
-                                                  
-                                                    
-                                                      
-                                                        
-                                                          <
-                                                        
-                                                        div
-                                                      
-                                                      
-                                                        >
-                                                      
-                                                    
-                                                    
-                                                      
-  It's a TestComponent story:
-  
-                                                    
-                                                    
-                                                      
-                                                        
-                                                          <
-                                                        
-                                                        
-                                                          TestComponent
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        array
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          [
-                                                        
-                                                        
-      
-                                                        
-                                                          1
-                                                        
-                                                        
-                                                          ,
-                                                        
-                                                        
-      
-                                                        
-                                                          2
-                                                        
-                                                        
-                                                          ,
-                                                        
-                                                        
-      
-                                                        
-                                                          3
-                                                        
-                                                        
-    
-                                                        
-                                                          ]
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        bool
-                                                      
-                                                      
-    
-                                                      
-                                                        func
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          function
-                                                        
-                                                         
-                                                        
-                                                          noRefCheck
-                                                        
-                                                        
-                                                          (
-                                                        
-                                                        
-                                                          )
-                                                        
-                                                         
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        number
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          7
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        obj
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-                                                          {
-                                                        
-                                                        
-      a
-                                                        
-                                                          :
-                                                        
-                                                         
-                                                        
-                                                          'a'
-                                                        
-                                                        
-                                                          ,
-                                                        
-                                                        
-      b
-                                                        
-                                                          :
-                                                        
-                                                         
-                                                        
-                                                          'b'
-                                                        
-                                                        
-    
-                                                        
-                                                          }
-                                                        
-                                                        
-                                                          }
-                                                        
-                                                      
-                                                      
-    
-                                                      
-                                                        string
-                                                      
-                                                      
-                                                        
-                                                          =
-                                                        
-                                                        
-                                                          "
-                                                        
-                                                        seven
-                                                        
-                                                          "
-                                                        
-                                                      
-                                                      
-  
-                                                      
-                                                        />
-                                                      
-                                                    
-                                                    
-                                                      
-
-                                                    
-                                                    
-                                                      
-                                                        
-                                                          </
-                                                        
-                                                        div
-                                                      
-                                                      
-                                                        >
-                                                      
-                                                    
-                                                  
-                                                
-                                              
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - - - - - - - -
- - - -
-
-
-
- - - -
-
-
- - -`; diff --git a/addons/info/src/components/PropTable.js b/addons/info/src/components/PropTable.js deleted file mode 100644 index f2ad6453a5de..000000000000 --- a/addons/info/src/components/PropTable.js +++ /dev/null @@ -1,122 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; - -import PropVal from './PropVal'; -import PrettyPropType from './types/PrettyPropType'; - -const Table = props => ; -const Td = props => ; -const Th = props => ; -const Thead = props => ; - -export const multiLineText = input => { - if (!input) { - return input; - } - const text = String(input); - const arrayOfText = text.split(/\r?\n|\r/g); - const isSingleLine = arrayOfText.length < 2; - return isSingleLine - ? text - : arrayOfText.map((lineOfText, i) => ( - // eslint-disable-next-line react/no-array-index-key - - {i > 0 &&
} {lineOfText} -
- )); -}; - -const determineIncludedPropTypes = (propDefinitions, excludedPropTypes) => { - if (excludedPropTypes.length === 0) { - return propDefinitions; - } - - return propDefinitions.filter( - propDefinition => !excludedPropTypes.includes(propDefinition.property) - ); -}; - -export default function PropTable(props) { - const { - type, - maxPropObjectKeys, - maxPropArrayLength, - maxPropStringLength, - propDefinitions, - excludedPropTypes, - } = props; - - if (!type) { - return null; - } - - const includedPropDefinitions = determineIncludedPropTypes(propDefinitions, excludedPropTypes); - - if (!includedPropDefinitions.length) { - return No propTypes defined!; - } - - const propValProps = { - maxPropObjectKeys, - maxPropArrayLength, - maxPropStringLength, - }; - - return ( -
; -const Tr = props =>
; -const Tbody = props =>
- - - - - - - - - - - {includedPropDefinitions.map(row => ( - - - - - - - - ))} - -
propertypropTyperequireddefaultdescription
{row.property} - - {row.required ? 'yes' : '-'} - {row.defaultValue === undefined ? ( - '-' - ) : ( - - )} - {multiLineText(row.description)}
- ); -} - -PropTable.displayName = 'PropTable'; -PropTable.defaultProps = { - type: null, - propDefinitions: [], - excludedPropTypes: [], -}; -PropTable.propTypes = { - type: PropTypes.func, - maxPropObjectKeys: PropTypes.number.isRequired, - maxPropArrayLength: PropTypes.number.isRequired, - maxPropStringLength: PropTypes.number.isRequired, - excludedPropTypes: PropTypes.arrayOf(PropTypes.string), - propDefinitions: PropTypes.arrayOf( - PropTypes.shape({ - property: PropTypes.string.isRequired, - propType: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), - required: PropTypes.bool, - description: PropTypes.string, - defaultValue: PropTypes.any, - }) - ), -}; diff --git a/addons/info/src/components/PropTable.test.js b/addons/info/src/components/PropTable.test.js deleted file mode 100644 index 43547f6b6eb7..000000000000 --- a/addons/info/src/components/PropTable.test.js +++ /dev/null @@ -1,71 +0,0 @@ -import React from 'react'; -import renderer from 'react-test-renderer'; -import { shallow } from 'enzyme'; - -import PropTable, { multiLineText } from './PropTable'; - -describe('PropTable', () => { - describe('multiLineText', () => { - const singleLine = 'Foo bar baz'; - const unixMultiLineText = 'foo \n bar \n baz'; - const windowsMultiLineText = 'foo \r bar \r baz'; - const duplicatedMultiLine = 'foo\nfoo\nfoo'; - const propDefinitions = [ - { - defaultValue: undefined, - description: '', - propType: { name: 'string' }, - property: 'foo', - required: false, - }, - ]; - const FooComponent = () =>
; - const propTableProps = { - type: FooComponent, - maxPropArrayLength: 5, - maxPropObjectKeys: 5, - maxPropStringLength: 5, - propDefinitions, - }; - - it('should include all propTypes by default', () => { - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); - }); - - it('should exclude excluded propTypes', () => { - const props = { ...propTableProps, excludedPropTypes: ['foo'] }; - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); - }); - - it('should return a blank string for a null input', () => { - expect(multiLineText(null)).toBe(null); - }); - it('should return a blank string for an undefined input', () => { - expect(multiLineText(undefined)).toBe(undefined); - }); - it('should cast a number to a string', () => { - expect(multiLineText(1)).toBe('1'); - }); - it('should return its input for a single line of text', () => { - expect(multiLineText(singleLine)).toBe(singleLine); - }); - it('should return an array for unix multiline text', () => { - expect(multiLineText(unixMultiLineText)).toHaveLength(3); - }); - it('should return an array for windows multiline text', () => { - expect(multiLineText(windowsMultiLineText)).toHaveLength(3); - }); - it('should return an array with unique keys for duplicated multiline text', () => { - const wrappers = multiLineText(duplicatedMultiLine).map(tag => shallow(tag)); - const keys = wrappers.map(wrapper => wrapper.key()); - const deDup = new Set(keys); - expect(keys).toHaveLength(deDup.size); - }); - it('should have 2 br tags for 3 lines of text', () => { - const tree = renderer.create(multiLineText(unixMultiLineText)).toJSON(); - expect(tree).toMatchSnapshot(); - }); - }); -}); diff --git a/addons/info/src/components/PropTable/__snapshots__/index.test.js.snap b/addons/info/src/components/PropTable/__snapshots__/index.test.js.snap deleted file mode 100644 index d4aef4cc698a..000000000000 --- a/addons/info/src/components/PropTable/__snapshots__/index.test.js.snap +++ /dev/null @@ -1,86 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PropTable multiLineText should exclude excluded propTypes 1`] = ` - - No propTypes defined! - -`; - -exports[`PropTable multiLineText should have 2 br tags for 3 lines of text 1`] = ` -Array [ - - - foo - , - -
- - bar -
, - -
- - baz -
, -] -`; - -exports[`PropTable multiLineText should include all propTypes by default 1`] = ` - - - - - - - - - - - - - - - - - - -
- property - - propType - - required - - default - - description -
- foo - - - - - - - - - -
-`; diff --git a/addons/info/src/components/PropTable/components/Table.js b/addons/info/src/components/PropTable/components/Table.js deleted file mode 100644 index 893470b04ab3..000000000000 --- a/addons/info/src/components/PropTable/components/Table.js +++ /dev/null @@ -1,12 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import '../style.css'; - -const Table = ({ children }) => {children}
; - -Table.propTypes = { - children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]) - .isRequired, -}; - -export default Table; diff --git a/addons/info/src/components/PropTable/components/Table.test.js b/addons/info/src/components/PropTable/components/Table.test.js deleted file mode 100644 index 6910f2548e7c..000000000000 --- a/addons/info/src/components/PropTable/components/Table.test.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; - -import Table from './Table'; - -describe('PropTable/Table', () => { - it('renders a table html node with one child element', () => { - const wrapper = shallow( - -
foo bar
-
- ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a table html node with multiple children elements', () => { - const wrapper = shallow( - -
foo bar
-
baz
-
- ); - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/addons/info/src/components/PropTable/components/Tbody.js b/addons/info/src/components/PropTable/components/Tbody.js deleted file mode 100644 index ef77ac517bef..000000000000 --- a/addons/info/src/components/PropTable/components/Tbody.js +++ /dev/null @@ -1,11 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; - -const Tbody = ({ children }) => {children}; - -Tbody.propTypes = { - children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]) - .isRequired, -}; - -export default Tbody; diff --git a/addons/info/src/components/PropTable/components/Tbody.test.js b/addons/info/src/components/PropTable/components/Tbody.test.js deleted file mode 100644 index 901a7900ac59..000000000000 --- a/addons/info/src/components/PropTable/components/Tbody.test.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; - -import Tbody from './Tbody'; - -describe('PropTable/Tbody', () => { - it('renders a tbody html node with children', () => { - const wrapper = shallow( - -
foo bar
- - ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a tbody html node with multiple children elements', () => { - const wrapper = shallow( - -
foo bar
-
baz
- - ); - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/addons/info/src/components/PropTable/components/Td.js b/addons/info/src/components/PropTable/components/Td.js deleted file mode 100644 index a429e6bc633e..000000000000 --- a/addons/info/src/components/PropTable/components/Td.js +++ /dev/null @@ -1,24 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; -import '../style.css'; - -const Td = ({ isMonospace, children }) => ( - {children} -); - -Td.propTypes = { - children: PropTypes.oneOfType([ - PropTypes.node, - PropTypes.element, - PropTypes.arrayOf(PropTypes.node), - PropTypes.arrayOf(PropTypes.element), - ]), - isMonospace: PropTypes.bool, -}; - -Td.defaultProps = { - isMonospace: false, - children: null, -}; - -export default Td; diff --git a/addons/info/src/components/PropTable/components/Td.test.js b/addons/info/src/components/PropTable/components/Td.test.js deleted file mode 100644 index e5b8dc663253..000000000000 --- a/addons/info/src/components/PropTable/components/Td.test.js +++ /dev/null @@ -1,54 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; - -import Td from './Td'; - -describe('PropTable/Td', () => { - it('renders a td html node child element', () => { - const wrapper = shallow( - -
foo bar
- - ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a monospace td html node child element', () => { - const wrapper = shallow( - -
foo bar
- - ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a td html node with multiple children elements', () => { - const wrapper = shallow( - -
foo bar
-
baz
- - ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a monospace td html node with multiple children elements', () => { - const wrapper = shallow( - -
foo bar
-
baz
- - ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a td html node with one child node', () => { - const wrapper = shallow(foo bar); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a monospace td html node with one child node', () => { - const wrapper = shallow(foo bar); - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/addons/info/src/components/PropTable/components/Th.js b/addons/info/src/components/PropTable/components/Th.js deleted file mode 100644 index acf43b6664e0..000000000000 --- a/addons/info/src/components/PropTable/components/Th.js +++ /dev/null @@ -1,15 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; - -const Th = ({ children }) => {children}; - -Th.propTypes = { - children: PropTypes.oneOfType([ - PropTypes.node, - PropTypes.element, - PropTypes.arrayOf(PropTypes.node), - PropTypes.arrayOf(PropTypes.element), - ]).isRequired, -}; - -export default Th; diff --git a/addons/info/src/components/PropTable/components/Th.test.js b/addons/info/src/components/PropTable/components/Th.test.js deleted file mode 100644 index cd84814d1721..000000000000 --- a/addons/info/src/components/PropTable/components/Th.test.js +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; - -import Th from './Th'; - -describe('PropTable/Th', () => { - it('renders a th html node with react element children', () => { - const wrapper = shallow( - -
foo bar
-
baz
- - ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a th html node with html node children', () => { - const wrapper = shallow(foo bar baz); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a th html node with one child node', () => { - const wrapper = shallow(foo bar); - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/addons/info/src/components/PropTable/components/Thead.js b/addons/info/src/components/PropTable/components/Thead.js deleted file mode 100644 index 0abe57156f86..000000000000 --- a/addons/info/src/components/PropTable/components/Thead.js +++ /dev/null @@ -1,11 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; - -const Thead = ({ children }) => {children}; - -Thead.propTypes = { - children: PropTypes.oneOfType([PropTypes.element, PropTypes.arrayOf(PropTypes.element)]) - .isRequired, -}; - -export default Thead; diff --git a/addons/info/src/components/PropTable/components/Thead.test.js b/addons/info/src/components/PropTable/components/Thead.test.js deleted file mode 100644 index d1a96fccd72c..000000000000 --- a/addons/info/src/components/PropTable/components/Thead.test.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; - -import Thead from './Thead'; - -describe('PropTable/Thead', () => { - it('renders a thead html node with children', () => { - const wrapper = shallow( - -
foo bar
- - ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a thead html node with multiple children elements', () => { - const wrapper = shallow( - -
foo bar
-
baz
- - ); - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/addons/info/src/components/PropTable/components/Tr.js b/addons/info/src/components/PropTable/components/Tr.js deleted file mode 100644 index 103e8ad5449f..000000000000 --- a/addons/info/src/components/PropTable/components/Tr.js +++ /dev/null @@ -1,10 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; - -const Tr = ({ children }) => {children}; - -Tr.propTypes = { - children: PropTypes.node.isRequired, -}; - -export default Tr; diff --git a/addons/info/src/components/PropTable/components/Tr.test.js b/addons/info/src/components/PropTable/components/Tr.test.js deleted file mode 100644 index 071e87001f25..000000000000 --- a/addons/info/src/components/PropTable/components/Tr.test.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import { shallow } from 'enzyme'; - -import Tr from './Tr'; -import Td from './Td'; - -describe('PropTable/Tr', () => { - it('renders a tr html node with react element children', () => { - const wrapper = shallow( - - foo bar - baz - - ); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a tr html node with html node children', () => { - const wrapper = shallow(foo bar baz); - expect(wrapper).toMatchSnapshot(); - }); - - it('renders a tr html node with one child node', () => { - const wrapper = shallow(foo bar); - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/addons/info/src/components/PropTable/components/__snapshots__/Table.test.js.snap b/addons/info/src/components/PropTable/components/__snapshots__/Table.test.js.snap deleted file mode 100644 index c245e98aca7a..000000000000 --- a/addons/info/src/components/PropTable/components/__snapshots__/Table.test.js.snap +++ /dev/null @@ -1,24 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PropTable/Table renders a table html node with multiple children elements 1`] = ` - -
- foo bar -
-
- baz -
-
-`; - -exports[`PropTable/Table renders a table html node with one child element 1`] = ` - -
- foo bar -
-
-`; diff --git a/addons/info/src/components/PropTable/components/__snapshots__/Tbody.test.js.snap b/addons/info/src/components/PropTable/components/__snapshots__/Tbody.test.js.snap deleted file mode 100644 index 70840d14f0a8..000000000000 --- a/addons/info/src/components/PropTable/components/__snapshots__/Tbody.test.js.snap +++ /dev/null @@ -1,20 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PropTable/Tbody renders a tbody html node with children 1`] = ` - -
- foo bar -
- -`; - -exports[`PropTable/Tbody renders a tbody html node with multiple children elements 1`] = ` - -
- foo bar -
-
- baz -
- -`; diff --git a/addons/info/src/components/PropTable/components/__snapshots__/Td.test.js.snap b/addons/info/src/components/PropTable/components/__snapshots__/Td.test.js.snap deleted file mode 100644 index 4e2d98f83b5f..000000000000 --- a/addons/info/src/components/PropTable/components/__snapshots__/Td.test.js.snap +++ /dev/null @@ -1,63 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PropTable/Td renders a monospace td html node child element 1`] = ` - -
- foo bar -
- -`; - -exports[`PropTable/Td renders a monospace td html node with multiple children elements 1`] = ` - -
- foo bar -
-
- baz -
- -`; - -exports[`PropTable/Td renders a monospace td html node with one child node 1`] = ` - - foo bar - -`; - -exports[`PropTable/Td renders a td html node child element 1`] = ` - -
- foo bar -
- -`; - -exports[`PropTable/Td renders a td html node with multiple children elements 1`] = ` - -
- foo bar -
-
- baz -
- -`; - -exports[`PropTable/Td renders a td html node with one child node 1`] = ` - - foo bar - -`; diff --git a/addons/info/src/components/PropTable/components/__snapshots__/Th.test.js.snap b/addons/info/src/components/PropTable/components/__snapshots__/Th.test.js.snap deleted file mode 100644 index c7c55c291314..000000000000 --- a/addons/info/src/components/PropTable/components/__snapshots__/Th.test.js.snap +++ /dev/null @@ -1,24 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PropTable/Th renders a th html node with html node children 1`] = ` - - foo bar baz - -`; - -exports[`PropTable/Th renders a th html node with one child node 1`] = ` - - foo bar - -`; - -exports[`PropTable/Th renders a th html node with react element children 1`] = ` - -
- foo bar -
-
- baz -
- -`; diff --git a/addons/info/src/components/PropTable/components/__snapshots__/Thead.test.js.snap b/addons/info/src/components/PropTable/components/__snapshots__/Thead.test.js.snap deleted file mode 100644 index a5ba8a5330f7..000000000000 --- a/addons/info/src/components/PropTable/components/__snapshots__/Thead.test.js.snap +++ /dev/null @@ -1,20 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PropTable/Thead renders a thead html node with children 1`] = ` - -
- foo bar -
- -`; - -exports[`PropTable/Thead renders a thead html node with multiple children elements 1`] = ` - -
- foo bar -
-
- baz -
- -`; diff --git a/addons/info/src/components/PropTable/components/__snapshots__/Tr.test.js.snap b/addons/info/src/components/PropTable/components/__snapshots__/Tr.test.js.snap deleted file mode 100644 index 9ba2d695e37b..000000000000 --- a/addons/info/src/components/PropTable/components/__snapshots__/Tr.test.js.snap +++ /dev/null @@ -1,28 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PropTable/Tr renders a tr html node with html node children 1`] = ` - - foo bar baz - -`; - -exports[`PropTable/Tr renders a tr html node with one child node 1`] = ` - - foo bar - -`; - -exports[`PropTable/Tr renders a tr html node with react element children 1`] = ` - - - foo bar - - - baz - - -`; diff --git a/addons/info/src/components/PropTable/index.js b/addons/info/src/components/PropTable/index.js deleted file mode 100644 index 6e6a033943ee..000000000000 --- a/addons/info/src/components/PropTable/index.js +++ /dev/null @@ -1,121 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; - -import PrettyPropType from '../types/PrettyPropType'; -import PropVal from '../PropVal'; -import Table from './components/Table'; -import Tbody from './components/Tbody'; -import Td from './components/Td'; -import Th from './components/Th'; -import Thead from './components/Thead'; -import Tr from './components/Tr'; - -export const multiLineText = input => { - if (!input) { - return input; - } - const text = String(input); - const arrayOfText = text.split(/\r?\n|\r/g); - const isSingleLine = arrayOfText.length < 2; - return isSingleLine - ? text - : arrayOfText.map((lineOfText, i) => ( - // eslint-disable-next-line react/no-array-index-key - - {i > 0 &&
} {lineOfText} -
- )); -}; - -const determineIncludedPropTypes = (propDefinitions, excludedPropTypes) => { - if (excludedPropTypes.length === 0) { - return propDefinitions; - } - - return propDefinitions.filter( - propDefinition => !excludedPropTypes.includes(propDefinition.property) - ); -}; - -export default function PropTable(props) { - const { - type, - maxPropObjectKeys, - maxPropArrayLength, - maxPropStringLength, - propDefinitions, - excludedPropTypes, - } = props; - - if (!type) { - return null; - } - - const includedPropDefinitions = determineIncludedPropTypes(propDefinitions, excludedPropTypes); - - if (!includedPropDefinitions.length) { - return No propTypes defined!; - } - - const propValProps = { - maxPropObjectKeys, - maxPropArrayLength, - maxPropStringLength, - }; - - return ( - - - - - - - - - - - - {includedPropDefinitions.map(row => ( - - - - - - - - ))} - -
propertypropTyperequireddefaultdescription
{row.property} - - {row.required ? 'yes' : '-'} - {row.defaultValue === undefined ? ( - '-' - ) : ( - - )} - {multiLineText(row.description)}
- ); -} - -PropTable.displayName = 'PropTable'; -PropTable.defaultProps = { - type: null, - propDefinitions: [], - excludedPropTypes: [], -}; -PropTable.propTypes = { - type: PropTypes.func, - maxPropObjectKeys: PropTypes.number.isRequired, - maxPropArrayLength: PropTypes.number.isRequired, - maxPropStringLength: PropTypes.number.isRequired, - excludedPropTypes: PropTypes.arrayOf(PropTypes.string), - propDefinitions: PropTypes.arrayOf( - PropTypes.shape({ - property: PropTypes.string.isRequired, - propType: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), - required: PropTypes.bool, - description: PropTypes.string, - defaultValue: PropTypes.any, - }) - ), -}; diff --git a/addons/info/src/components/PropTable/index.test.js b/addons/info/src/components/PropTable/index.test.js deleted file mode 100644 index 0a6bb05eb1a7..000000000000 --- a/addons/info/src/components/PropTable/index.test.js +++ /dev/null @@ -1,78 +0,0 @@ -import React from 'react'; -import renderer from 'react-test-renderer'; -import { shallow } from 'enzyme'; - -import PropTable, { multiLineText } from './index'; - -describe('PropTable', () => { - describe('multiLineText', () => { - const singleLine = 'Foo bar baz'; - const unixMultiLineText = 'foo \n bar \n baz'; - const windowsMultiLineText = 'foo \r bar \r baz'; - const duplicatedMultiLine = 'foo\nfoo\nfoo'; - const propDefinitions = [ - { - defaultValue: undefined, - description: '', - propType: { name: 'string' }, - property: 'foo', - required: false, - }, - ]; - const FooComponent = () =>
; - const propTableProps = { - type: FooComponent, - maxPropArrayLength: 5, - maxPropObjectKeys: 5, - maxPropStringLength: 5, - propDefinitions, - }; - - it('should include all propTypes by default', () => { - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); - }); - - it('should exclude excluded propTypes', () => { - const props = { ...propTableProps, excludedPropTypes: ['foo'] }; - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); - }); - - it('should return a blank string for a null input', () => { - expect(multiLineText(null)).toBe(null); - }); - - it('should return a blank string for an undefined input', () => { - expect(multiLineText(undefined)).toBe(undefined); - }); - - it('should cast a number to a string', () => { - expect(multiLineText(1)).toBe('1'); - }); - - it('should return its input for a single line of text', () => { - expect(multiLineText(singleLine)).toBe(singleLine); - }); - - it('should return an array for unix multiline text', () => { - expect(multiLineText(unixMultiLineText)).toHaveLength(3); - }); - - it('should return an array for windows multiline text', () => { - expect(multiLineText(windowsMultiLineText)).toHaveLength(3); - }); - - it('should return an array with unique keys for duplicated multiline text', () => { - const wrappers = multiLineText(duplicatedMultiLine).map(tag => shallow(tag)); - const keys = wrappers.map(wrapper => wrapper.key()); - const deDup = new Set(keys); - expect(keys).toHaveLength(deDup.size); - }); - - it('should have 2 br tags for 3 lines of text', () => { - const tree = renderer.create(multiLineText(unixMultiLineText)).toJSON(); - expect(tree).toMatchSnapshot(); - }); - }); -}); diff --git a/addons/info/src/components/PropTable/style.css b/addons/info/src/components/PropTable/style.css deleted file mode 100644 index 010f200df8b4..000000000000 --- a/addons/info/src/components/PropTable/style.css +++ /dev/null @@ -1,19 +0,0 @@ -.info-table { - width: 100%; -} - -.info-table, .info-table td, .info-table th { - border-collapse: collapse; - border: 1px solid #cccccc; - color: #444444; - margin-top: 0.25rem; - padding-right: 0.5rem; - padding: 0.25rem; - text-align: left; - vertical-align: top; -} - -.info-table-monospace { - font-family: Menlo, Monaco, "Courier New", monospace; - font-size: 0.88em; -} diff --git a/addons/info/src/components/PropVal.js b/addons/info/src/components/PropVal.js deleted file mode 100644 index e7527d749566..000000000000 --- a/addons/info/src/components/PropVal.js +++ /dev/null @@ -1,274 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import createFragment from 'react-addons-create-fragment'; - -const getValueStyles = (codeColors = {}) => ({ - func: { - color: codeColors.func || '#170', - }, - - attr: { - color: codeColors.attr || '#666', - }, - - object: { - color: codeColors.object || '#666', - }, - - array: { - color: codeColors.array || '#666', - }, - - number: { - color: codeColors.number || '#a11', - }, - - string: { - color: codeColors.string || '#22a', - wordBreak: 'break-word', - }, - - bool: { - color: codeColors.bool || '#a11', - }, - - empty: { - color: '#444', - }, -}); - -function indent(breakIntoNewLines, level, isBlock) { - return ( - breakIntoNewLines && ( - -
- {`${Array(level).join(' ')} `} - {!isBlock && ' '} -
- ) - ); -} - -function PreviewArray({ - val, - level, - maxPropArrayLength, - maxPropStringLength, - maxPropsIntoLine, - valueStyles, -}) { - const items = {}; - const breakIntoNewLines = val.length > maxPropsIntoLine; - val.slice(0, maxPropArrayLength).forEach((item, i) => { - items[`n${i}`] = ( - - {indent(breakIntoNewLines, level)} - - - ); - items[`c${i}`] = ','; - }); - if (val.length > maxPropArrayLength) { - items.last = {indent(breakIntoNewLines, level)}…; - } else { - delete items[`c${val.length - 1}`]; - } - - return ( - - [{createFragment(items)} - {indent(breakIntoNewLines, level, true)}] - - ); -} - -PreviewArray.propTypes = { - val: PropTypes.any, // eslint-disable-line - maxPropArrayLength: PropTypes.number.isRequired, - maxPropStringLength: PropTypes.number.isRequired, - maxPropsIntoLine: PropTypes.number.isRequired, - level: PropTypes.number.isRequired, - valueStyles: PropTypes.shape({ - func: PropTypes.object, - attr: PropTypes.object, - object: PropTypes.object, - array: PropTypes.object, - number: PropTypes.object, - string: PropTypes.object, - bool: PropTypes.object, - empty: PropTypes.object, - }).isRequired, -}; - -function PreviewObject({ - val, - level, - maxPropObjectKeys, - maxPropStringLength, - maxPropsIntoLine, - valueStyles, -}) { - const names = Object.keys(val); - const items = {}; - const breakIntoNewLines = names.length > maxPropsIntoLine; - names.slice(0, maxPropObjectKeys).forEach((name, i) => { - items[`k${i}`] = ( - - {indent(breakIntoNewLines, level)} - {name} - - ); - items[`c${i}`] = ': '; - items[`v${i}`] = ( - - ); - items[`m${i}`] = ','; - }); - if (names.length > maxPropObjectKeys) { - items.rest = {indent(breakIntoNewLines, level)}…; - } else { - delete items[`m${names.length - 1}`]; - } - return ( - - {'{'} - {createFragment(items)} - {indent(breakIntoNewLines, level, true)} - {'}'} - - ); -} - -PreviewObject.propTypes = { - val: PropTypes.any, // eslint-disable-line - maxPropObjectKeys: PropTypes.number.isRequired, - maxPropStringLength: PropTypes.number.isRequired, - maxPropsIntoLine: PropTypes.number.isRequired, - level: PropTypes.number.isRequired, - valueStyles: PropTypes.shape({ - func: PropTypes.object, - attr: PropTypes.object, - object: PropTypes.object, - array: PropTypes.object, - number: PropTypes.object, - string: PropTypes.object, - bool: PropTypes.object, - empty: PropTypes.object, - }).isRequired, -}; - -function PropVal(props) { - const { - level, - maxPropObjectKeys, - maxPropArrayLength, - maxPropStringLength, - maxPropsIntoLine, - theme, - } = props; - let { val } = props; - const { codeColors } = theme || {}; - let content = null; - const valueStyles = props.valueStyles || getValueStyles(codeColors); - - if (typeof val === 'number') { - content = {val}; - } else if (typeof val === 'string') { - if (val.length > maxPropStringLength) { - val = `${val.slice(0, maxPropStringLength)}…`; - } - if (level > 1) { - val = `'${val}'`; - } - content = {val}; - } else if (typeof val === 'boolean') { - content = {`${val}`}; - } else if (Array.isArray(val)) { - content = ( - - ); - } else if (typeof val === 'function') { - content = {val.name || 'anonymous'}; - } else if (!val) { - content = {`${val}`}; - } else if (typeof val !== 'object') { - content = ; - } else if (React.isValidElement(val)) { - content = ( - - {`<${val.type.displayName || val.type.name || val.type} />`} - - ); - } else { - content = ( - - ); - } - - return content; -} - -PropVal.defaultProps = { - val: null, - maxPropObjectKeys: 3, - maxPropArrayLength: 3, - maxPropStringLength: 50, - maxPropsIntoLine: 3, - level: 1, - theme: {}, - valueStyles: null, -}; - -PropVal.propTypes = { - val: PropTypes.any, // eslint-disable-line - maxPropObjectKeys: PropTypes.number, - maxPropArrayLength: PropTypes.number, - maxPropStringLength: PropTypes.number, - maxPropsIntoLine: PropTypes.number, - level: PropTypes.number, - theme: PropTypes.shape({ - codeColors: PropTypes.object, - }), - valueStyles: PropTypes.shape({ - func: PropTypes.object, - attr: PropTypes.object, - object: PropTypes.object, - array: PropTypes.object, - number: PropTypes.object, - string: PropTypes.object, - bool: PropTypes.object, - empty: PropTypes.object, - }), -}; - -export default PropVal; diff --git a/addons/info/src/components/Props.js b/addons/info/src/components/Props.js deleted file mode 100644 index 722c4aa8be28..000000000000 --- a/addons/info/src/components/Props.js +++ /dev/null @@ -1,89 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import PropVal from './PropVal'; -import { getType } from '../react-utils'; - -const stylesheet = { - propStyle: {}, - propNameStyle: {}, - propValueStyle: {}, -}; - -export default function Props(props) { - const { - maxPropsIntoLine, - maxPropArrayLength, - maxPropObjectKeys, - maxPropStringLength, - node, - singleLine, - } = props; - const nodeProps = node.props; - const { defaultProps } = getType(node.type); - if (!nodeProps || typeof nodeProps !== 'object') { - return ; - } - - const { propValueStyle, propNameStyle } = stylesheet; - - const names = Object.keys(nodeProps).filter( - name => - name[0] !== '_' && - name !== 'children' && - (!defaultProps || nodeProps[name] !== defaultProps[name]) - ); - - const breakIntoNewLines = names.length > maxPropsIntoLine; - const endingSpace = singleLine ? ' ' : ''; - - const items = []; - names.forEach((name, i) => { - items.push( - - {breakIntoNewLines ? ( - -
-    -
- ) : ( - ' ' - )} - {name} - {/* Use implicit true: */} - {(!nodeProps[name] || typeof nodeProps[name] !== 'boolean') && ( - - = - - {typeof nodeProps[name] === 'string' ? '"' : '{'} - - {typeof nodeProps[name] === 'string' ? '"' : '}'} - - - )} - - {i === names.length - 1 && (breakIntoNewLines ?
: endingSpace)} -
- ); - }); - - return {items}; -} - -Props.defaultProps = { - singleLine: false, -}; - -Props.propTypes = { - node: PropTypes.node.isRequired, - singleLine: PropTypes.bool, - maxPropsIntoLine: PropTypes.number.isRequired, - maxPropObjectKeys: PropTypes.number.isRequired, - maxPropArrayLength: PropTypes.number.isRequired, - maxPropStringLength: PropTypes.number.isRequired, -}; diff --git a/addons/info/src/components/Story.js b/addons/info/src/components/Story.js deleted file mode 100644 index 42f5026f0808..000000000000 --- a/addons/info/src/components/Story.js +++ /dev/null @@ -1,442 +0,0 @@ -/* eslint no-underscore-dangle: 0 */ - -import React, { Fragment, Component, createElement } from 'react'; -import { isForwardRef } from 'react-is'; -import { polyfill } from 'react-lifecycles-compat'; -import PropTypes from 'prop-types'; -import global from 'global'; - -import marksy from 'marksy'; -import jsxToString from 'react-element-to-jsx-string'; -import { Code } from './markdown'; -import { getDisplayName, getType } from '../react-utils'; - -global.STORYBOOK_REACT_CLASSES = global.STORYBOOK_REACT_CLASSES || []; -const { STORYBOOK_REACT_CLASSES } = global; - -const stylesheetBase = { - button: { - base: { - fontFamily: 'sans-serif', - fontSize: 12, - display: 'block', - position: 'fixed', - border: 'none', - background: '#027ac5', - color: '#fff', - padding: '5px 15px', - cursor: 'pointer', - }, - topRight: { - top: 0, - right: 0, - borderRadius: '0 0 0 5px', - }, - }, - info: { - position: 'fixed', - background: 'white', - top: 0, - left: 0, - height: '100vh', - width: '100vw', - overflow: 'auto', - zIndex: 99999, - }, - children: { - position: 'relative', - zIndex: 0, - }, - infoBody: { - fontFamily: 'Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif', - color: 'black', - fontWeight: 300, - lineHeight: 1.45, - fontSize: '15px', - padding: '20px 40px 40px', - borderRadius: '2px', - backgroundColor: '#fff', - }, - infoContent: { - marginBottom: 0, - }, - infoStory: {}, - jsxInfoContent: { - borderTop: '1px solid #eee', - margin: '20px 0 0 0', - }, - header: { - h1: { - margin: 0, - padding: 0, - fontSize: '35px', - }, - h2: { - margin: '0 0 10px 0', - padding: 0, - fontWeight: 400, - fontSize: '22px', - }, - h3: { - margin: '0 0 10px 0', - padding: 0, - fontWeight: 400, - fontSize: '18px', - }, - body: { - borderBottom: '1px solid #eee', - paddingTop: 10, - marginBottom: 10, - }, - }, - source: { - h1: { - margin: '20px 0 0 0', - padding: '0 0 5px 0', - fontSize: '25px', - borderBottom: '1px solid #EEE', - }, - }, - propTableHead: { - margin: '20px 0 0 0', - }, -}; - -class Story extends Component { - constructor(props, ...args) { - super(props, ...args); - this.state = { - open: false, - }; - this.marksy = marksy({ - createElement, - elements: props.components, - }); - } - - _renderStory() { - const { stylesheet } = this.state; - const { children } = this.props; - - return ( -
- {children} -
- ); - } - - _renderInline() { - const { stylesheet } = this.state; - - return ( - - {this._renderInlineHeader()} - {this._renderStory()} -
-
- {this._getInfoContent()} - {this._getComponentDescription()} - {this._getSourceCode()} - {this._getPropTables()} -
-
-
- ); - } - - _renderInlineHeader() { - const { stylesheet } = this.state; - - const infoHeader = this._getInfoHeader(); - - return ( - infoHeader && ( -
-
{infoHeader}
-
- ) - ); - } - - _renderOverlay() { - const { stylesheet, open } = this.state; - const { children } = this.props; - - const buttonStyle = { - ...stylesheet.button.base, - ...stylesheet.button.topRight, - }; - - const infoStyle = { ...stylesheet.info }; - if (!open) { - infoStyle.display = 'none'; - } - - const openOverlay = () => { - this.setState({ open: true }); - return false; - }; - - const closeOverlay = () => { - this.setState({ open: false }); - return false; - }; - - return ( - -
{children}
- - {open ? ( -
- -
-
- {this._getInfoHeader()} - {this._getInfoContent()} - {this._getComponentDescription()} - {this._getSourceCode()} - {this._getPropTables()} -
-
-
- ) : null} -
- ); - } - - _getInfoHeader() { - const { stylesheet } = this.state; - const { context, showHeader } = this.props; - - if (!context || !showHeader) { - return null; - } - - return ( -
-

{context.kind}

-

{context.name}

-
- ); - } - - _getInfoContent() { - const { info, showInline } = this.props; - const { stylesheet } = this.state; - - if (!info) { - return ''; - } - - if (React.isValidElement(info)) { - return ( -
{info}
- ); - } - - const lines = info.split('\n'); - while (lines[0].trim() === '') { - lines.shift(); - } - let padding = 0; - const matches = lines[0].match(/^ */); - if (matches) { - padding = matches[0].length; - } - const source = lines.map(s => s.slice(padding)).join('\n'); - - return {this.marksy(source).tree}; - } - - _getComponentDescription() { - const { - context: { kind, name }, - } = this.props; - let retDiv = null; - - const validMatches = [kind, name]; - - if (Object.keys(STORYBOOK_REACT_CLASSES).length) { - Object.keys(STORYBOOK_REACT_CLASSES).forEach(key => { - if (validMatches.includes(STORYBOOK_REACT_CLASSES[key].name)) { - const componentDescription = STORYBOOK_REACT_CLASSES[key].docgenInfo.description; - retDiv = {this.marksy(componentDescription).tree}; - } - }); - } - - return retDiv; - } - - _getSourceCode() { - const { showSource, children } = this.props; - const { stylesheet } = this.state; - - if (!showSource) { - return null; - } - - return ( - -

Story Source

- -
- ); - } - - _getPropTables() { - const { - children, - propTablesExclude, - propTableCompare, - maxPropObjectKeys, - maxPropArrayLength, - maxPropStringLength, - excludedPropTypes, - } = this.props; - let { propTables } = this.props; - const { stylesheet } = this.state; - const types = new Map(); - - if (!propTables) { - return null; - } - - if (!children) { - return null; - } - - propTables.forEach(type => { - types.set(type, true); - }); - - // depth-first traverse and collect types - const extract = innerChildren => { - if (!innerChildren) { - return; - } - if (Array.isArray(innerChildren)) { - innerChildren.forEach(extract); - return; - } - if (innerChildren.props && innerChildren.props.children) { - extract(innerChildren.props.children); - } - if (isForwardRef(innerChildren)) { - try { - // this might fail because of hooks being used - extract(innerChildren.type.render(innerChildren.props)); - } catch (e) { - // do nothing - } - } - if ( - typeof innerChildren === 'string' || - typeof innerChildren.type === 'string' || - (propTables.length > 0 && // if propTables is set and has items in it - !propTables.includes(innerChildren.type)) || // ignore types that are missing from propTables - (Array.isArray(propTablesExclude) && // also ignore excluded types - propTablesExclude.some(Comp => propTableCompare(innerChildren, Comp))) - ) { - return; - } - - if (innerChildren.type && !types.has(innerChildren.type)) { - types.set(innerChildren.type, true); - } - }; - - // extract components from children - extract(children); - - const array = Array.from(types.keys()); - array.sort((a, b) => (getDisplayName(a) > getDisplayName(b) ? 1 : -1)); - - propTables = array.map((type, i) => ( - // eslint-disable-next-line react/no-array-index-key -
-

"{getDisplayName(type)}" Component

- -
- )); - - if (!propTables || propTables.length === 0) { - return null; - } - - return ( - -

Prop Types

- {propTables} -
- ); - } - - render() { - const { showInline } = this.props; - return showInline ? this._renderInline() : this._renderOverlay(); - } -} - -Story.getDerivedStateFromProps = ({ styles }) => ({ stylesheet: styles(stylesheetBase) }); - -Story.displayName = 'Story'; - -Story.propTypes = { - context: PropTypes.shape({ - kind: PropTypes.string, - name: PropTypes.string, - }), - info: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), - propTables: PropTypes.arrayOf(PropTypes.func), - propTablesExclude: PropTypes.arrayOf(PropTypes.func), - propTableCompare: PropTypes.func.isRequired, - showInline: PropTypes.bool, - showHeader: PropTypes.bool, - showSource: PropTypes.bool, - // eslint-disable-next-line react/no-unused-prop-types - styles: PropTypes.func.isRequired, - children: PropTypes.oneOfType([PropTypes.object, PropTypes.array]), - components: PropTypes.shape({}), - maxPropObjectKeys: PropTypes.number.isRequired, - maxPropArrayLength: PropTypes.number.isRequired, - maxPropStringLength: PropTypes.number.isRequired, - excludedPropTypes: PropTypes.arrayOf(PropTypes.string), -}; - -Story.defaultProps = { - context: null, - info: '', - children: null, - propTables: null, - propTablesExclude: [], - showInline: false, - showHeader: true, - showSource: true, - components: {}, - excludedPropTypes: [], -}; - -polyfill(Story); - -export default Story; diff --git a/addons/info/src/components/__snapshots__/PropTable.test.js.snap b/addons/info/src/components/__snapshots__/PropTable.test.js.snap deleted file mode 100644 index d153afdfd080..000000000000 --- a/addons/info/src/components/__snapshots__/PropTable.test.js.snap +++ /dev/null @@ -1,76 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`PropTable multiLineText should exclude excluded propTypes 1`] = ` - - No propTypes defined! - -`; - -exports[`PropTable multiLineText should have 2 br tags for 3 lines of text 1`] = ` -Array [ - - - foo - , - -
- - bar -
, - -
- - baz -
, -] -`; - -exports[`PropTable multiLineText should include all propTypes by default 1`] = ` - - - - - - - - - - - - - - - - - - -
- property - - propType - - required - - default - - description -
- foo - - - - - - - - - -
-`; diff --git a/addons/info/src/components/makeTableComponent.js b/addons/info/src/components/makeTableComponent.js deleted file mode 100644 index 8842bcbcaaef..000000000000 --- a/addons/info/src/components/makeTableComponent.js +++ /dev/null @@ -1,98 +0,0 @@ -/* eslint-disable no-underscore-dangle,react/forbid-foreign-prop-types */ -import PropTypes from 'prop-types'; -import React from 'react'; - -const PropTypesMap = new Map(); - -Object.keys(PropTypes).forEach(typeName => { - const type = PropTypes[typeName]; - - PropTypesMap.set(type, typeName); - PropTypesMap.set(type.isRequired, typeName); -}); - -const isNotEmpty = obj => obj && obj.props && Object.keys(obj.props).length > 0; - -const hasDocgen = type => isNotEmpty(type.__docgenInfo); - -const propsFromDocgen = type => { - const props = {}; - const docgenInfoProps = type.__docgenInfo.props; - - Object.keys(docgenInfoProps).forEach(property => { - const docgenInfoProp = docgenInfoProps[property]; - const defaultValueDesc = docgenInfoProp.defaultValue || {}; - const propType = docgenInfoProp.flowType || docgenInfoProp.type || 'other'; - - props[property] = { - property, - propType, - required: docgenInfoProp.required, - description: docgenInfoProp.description, - defaultValue: defaultValueDesc.value, - }; - }); - - return props; -}; - -const propsFromPropTypes = type => { - const props = {}; - - if (type.propTypes) { - Object.keys(type.propTypes).forEach(property => { - const typeInfo = type.propTypes[property]; - const required = typeInfo.isRequired === undefined; - const docgenInfo = - type.__docgenInfo && type.__docgenInfo.props && type.__docgenInfo.props[property]; - const description = docgenInfo ? docgenInfo.description : null; - let propType = PropTypesMap.get(typeInfo) || 'other'; - - if (propType === 'other') { - if (docgenInfo && docgenInfo.type) { - propType = docgenInfo.type.name; - } - } - - props[property] = { property, propType, required, description }; - }); - } - - if (type.defaultProps) { - Object.keys(type.defaultProps).forEach(property => { - const value = type.defaultProps[property]; - - if (value === undefined) { - return; - } - - if (!props[property]) { - props[property] = { property }; - } - - props[property].defaultValue = value; - }); - } - - return props; -}; - -export default function makeTableComponent(Component) { - const TableComponent = props => { - const { type } = props; - if (!type) { - return null; - } - - const propDefinitionsMap = hasDocgen(type) ? propsFromDocgen(type) : propsFromPropTypes(type); - const propDefinitions = Object.values(propDefinitionsMap); - - return ; - }; - - TableComponent.propTypes = { - type: PropTypes.func.isRequired, - }; - - return TableComponent; -} diff --git a/addons/info/src/components/markdown/code.js b/addons/info/src/components/markdown/code.js deleted file mode 100644 index 4e6b24ba7de2..000000000000 --- a/addons/info/src/components/markdown/code.js +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import { SyntaxHighlighter } from '@storybook/components'; -import { ThemeProvider, convert } from '@storybook/theming'; - -const Code = ({ code, language = 'plaintext', ...rest }) => ( - - - {code} - - -); -Code.propTypes = { - language: PropTypes.string.isRequired, - code: PropTypes.string.isRequired, -}; - -export { Code }; - -export function Blockquote({ children }) { - const style = { - fontSize: '1.88em', - fontFamily: 'Menlo, Monaco, "Courier New", monospace', - borderLeft: '8px solid #fafafa', - padding: '1rem', - }; - return
{children}
; -} - -Blockquote.propTypes = { children: PropTypes.node }; -Blockquote.defaultProps = { children: null }; - -export { default as Pre } from './pre/pre'; diff --git a/addons/info/src/components/markdown/htags.js b/addons/info/src/components/markdown/htags.js deleted file mode 100644 index 57da398d6422..000000000000 --- a/addons/info/src/components/markdown/htags.js +++ /dev/null @@ -1,115 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -const defaultProps = { - children: null, - id: null, -}; -const propTypes = { - children: PropTypes.node, - id: PropTypes.string, -}; - -export function H1({ id, children }) { - const styles = { - borderBottom: '1px solid #eee', - fontWeight: 600, - margin: 0, - padding: 0, - fontSize: '40px', - }; - return ( -

- {children} -

- ); -} - -H1.defaultProps = defaultProps; -H1.propTypes = propTypes; - -export function H2({ id, children }) { - const styles = { - fontWeight: 600, - margin: 0, - padding: 0, - fontSize: '30px', - }; - return ( -

- {children} -

- ); -} - -H2.defaultProps = defaultProps; -H2.propTypes = propTypes; - -export function H3({ id, children }) { - const styles = { - fontWeight: 600, - margin: 0, - padding: 0, - fontSize: '22px', - textTransform: 'uppercase', - }; - return ( -

- {children} -

- ); -} - -H3.defaultProps = defaultProps; -H3.propTypes = propTypes; - -export function H4({ id, children }) { - const styles = { - fontWeight: 600, - margin: 0, - padding: 0, - fontSize: '20px', - }; - return ( -

- {children} -

- ); -} - -H4.defaultProps = defaultProps; -H4.propTypes = propTypes; - -export function H5({ id, children }) { - const styles = { - fontWeight: 600, - margin: 0, - padding: 0, - fontSize: '18px', - }; - return ( -
- {children} -
- ); -} - -H5.defaultProps = defaultProps; -H5.propTypes = propTypes; - -export function H6({ id, children }) { - const styles = { - fontWeight: 400, - margin: 0, - padding: 0, - fontSize: '18px', - }; - return ( -
- {children} -
- ); -} - -H6.defaultProps = defaultProps; -H6.propTypes = propTypes; diff --git a/addons/info/src/components/markdown/index.js b/addons/info/src/components/markdown/index.js deleted file mode 100644 index 2c9ff6ea3064..000000000000 --- a/addons/info/src/components/markdown/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export { H1, H2, H3, H4, H5, H6 } from './htags'; -export { Code, Pre } from './code'; -export { P, A, LI, UL } from './text'; diff --git a/addons/info/src/components/markdown/pre/copy.js b/addons/info/src/components/markdown/pre/copy.js deleted file mode 100644 index 8142b089573e..000000000000 --- a/addons/info/src/components/markdown/pre/copy.js +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable no-undef */ -export default function copy(str) { - const tmp = document.createElement('TEXTAREA'); - const focus = document.activeElement; - - tmp.value = str; - - document.body.appendChild(tmp); - tmp.select(); - document.execCommand('copy'); - document.body.removeChild(tmp); - focus.focus(); -} diff --git a/addons/info/src/components/markdown/pre/copyButton.js b/addons/info/src/components/markdown/pre/copyButton.js deleted file mode 100644 index cf44fa8c3b53..000000000000 --- a/addons/info/src/components/markdown/pre/copyButton.js +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -function CopyButton({ onClick, toggled }) { - const toggleText = 'Copied!'; - const text = 'Copy'; - - return ( - - ); -} - -CopyButton.propTypes = { - onClick: PropTypes.func, - toggled: PropTypes.bool, -}; - -CopyButton.defaultProps = { - onClick: () => {}, - toggled: false, -}; - -export default CopyButton; diff --git a/addons/info/src/components/markdown/pre/pre.js b/addons/info/src/components/markdown/pre/pre.js deleted file mode 100644 index 160b2c09a964..000000000000 --- a/addons/info/src/components/markdown/pre/pre.js +++ /dev/null @@ -1,76 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -import CopyButton from './copyButton'; -import copy from './copy'; - -const TOGGLE_TIMEOUT = 1800; - -class Pre extends React.Component { - state = { - copied: false, - }; - - setRef = elem => { - this.pre = elem; - }; - - handleClick = () => { - const text = this.pre && this.pre.innerText; - - if (!text) { - return; - } - - copy(text); - this.setState({ copied: true }); - - clearTimeout(this.timeout); - - this.timeout = setTimeout(() => { - this.setState({ copied: false }); - }, TOGGLE_TIMEOUT); - }; - - render() { - const { theme, children } = this.props; - const { pre } = theme; - const { copied } = this.state; - - return ( -
-        
{children}
- -
- ); - } -} - -Pre.propTypes = { - children: PropTypes.node, - theme: PropTypes.shape({ - pre: PropTypes.object, - }), -}; - -Pre.defaultProps = { - children: null, - theme: {}, -}; - -export default Pre; diff --git a/addons/info/src/components/markdown/text.js b/addons/info/src/components/markdown/text.js deleted file mode 100644 index 356a4575cd5e..000000000000 --- a/addons/info/src/components/markdown/text.js +++ /dev/null @@ -1,40 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; - -const defaultProps = { children: null }; -const propTypes = { children: PropTypes.node }; - -export function P({ children }) { - return

{children}

; -} - -P.defaultProps = defaultProps; -P.propTypes = propTypes; - -export function LI({ children }) { - return
  • {children}
  • ; -} - -LI.defaultProps = defaultProps; -LI.propTypes = propTypes; - -export function UL({ children }) { - return
      {children}
    ; -} - -UL.defaultProps = defaultProps; -UL.propTypes = propTypes; - -export function A({ href, children }) { - const style = { - color: '#3498db', - }; - return ( - - {children} - - ); -} - -A.defaultProps = defaultProps; -A.propTypes = { children: PropTypes.node, href: PropTypes.string.isRequired }; diff --git a/addons/info/src/components/types/ArrayOf.js b/addons/info/src/components/types/ArrayOf.js deleted file mode 100644 index 28f1dffe8156..000000000000 --- a/addons/info/src/components/types/ArrayOf.js +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable import/no-cycle */ -import React from 'react'; - -import PrettyPropType from './PrettyPropType'; -import { TypeInfo, getPropTypes } from './proptypes'; - -const ArrayOf = ({ propType }) => ( - - [ - - - - ] - -); - -ArrayOf.propTypes = { - propType: TypeInfo.isRequired, -}; - -export default ArrayOf; diff --git a/addons/info/src/components/types/Enum.js b/addons/info/src/components/types/Enum.js deleted file mode 100644 index 2de8d4830a87..000000000000 --- a/addons/info/src/components/types/Enum.js +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -import { TypeInfo, getPropTypes } from './proptypes'; - -const Enum = ({ propType }) => ( - - {getPropTypes(propType) - .map(({ value }) => value) - .join(' | ')} - -); - -Enum.propTypes = { - propType: TypeInfo.isRequired, -}; diff --git a/addons/info/src/components/types/InstanceOf.js b/addons/info/src/components/types/InstanceOf.js deleted file mode 100644 index 786c77fdd399..000000000000 --- a/addons/info/src/components/types/InstanceOf.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import { TypeInfo, getPropTypes } from './proptypes'; - -const InstanceOf = ({ propType }) => {getPropTypes(propType)}; - -InstanceOf.propTypes = { - propType: TypeInfo.isRequired, -}; - -export default InstanceOf; diff --git a/addons/info/src/components/types/Literal.js b/addons/info/src/components/types/Literal.js deleted file mode 100644 index 83b222e40788..000000000000 --- a/addons/info/src/components/types/Literal.js +++ /dev/null @@ -1,10 +0,0 @@ -import React from 'react'; -import { TypeInfo } from './proptypes'; - -const Literal = ({ propType }) => {propType.value}; - -Literal.propTypes = { - propType: TypeInfo.isRequired, -}; - -export default Literal; diff --git a/addons/info/src/components/types/ObjectOf.js b/addons/info/src/components/types/ObjectOf.js deleted file mode 100644 index 48a56d91026f..000000000000 --- a/addons/info/src/components/types/ObjectOf.js +++ /dev/null @@ -1,19 +0,0 @@ -/* eslint-disable import/no-cycle */ -import React from 'react'; - -import PrettyPropType from './PrettyPropType'; -import { TypeInfo, getPropTypes } from './proptypes'; - -const ObjectOf = ({ propType }) => ( - - {'{[]: '} - - {'}'} - -); - -ObjectOf.propTypes = { - propType: TypeInfo.isRequired, -}; - -export default ObjectOf; diff --git a/addons/info/src/components/types/OneOf.js b/addons/info/src/components/types/OneOf.js deleted file mode 100644 index deacfa4633e8..000000000000 --- a/addons/info/src/components/types/OneOf.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { TypeInfo, getPropTypes } from './proptypes'; - -const joinValues = propTypes => propTypes.map(({ value }) => value).join(' | '); - -const OneOf = ({ propType }) => { - const propTypes = getPropTypes(propType); - return {`oneOf ${Array.isArray(propTypes) ? joinValues(propTypes) : propTypes}`}; -}; - -OneOf.propTypes = { - propType: TypeInfo.isRequired, -}; - -export default OneOf; diff --git a/addons/info/src/components/types/OneOfType.js b/addons/info/src/components/types/OneOfType.js deleted file mode 100644 index 2b269d0dad68..000000000000 --- a/addons/info/src/components/types/OneOfType.js +++ /dev/null @@ -1,26 +0,0 @@ -/* eslint-disable import/no-cycle */ -import React from 'react'; - -import PrettyPropType from './PrettyPropType'; -import { TypeInfo, getPropTypes } from './proptypes'; - -const OneOfType = ({ propType }) => { - const propTypes = getPropTypes(propType); - return ( - - {propTypes - .map((value, i) => { - const key = `${value.name}${value.value ? `-${value.value}` : ''}`; - return [ - , - i < propTypes.length - 1 ? | : null, - ]; - }) - .reduce((acc, tuple) => acc.concat(tuple), [])} - - ); -}; -OneOfType.propTypes = { - propType: TypeInfo.isRequired, -}; -export default OneOfType; diff --git a/addons/info/src/components/types/PrettyPropType.js b/addons/info/src/components/types/PrettyPropType.js deleted file mode 100644 index ff7ea413614b..000000000000 --- a/addons/info/src/components/types/PrettyPropType.js +++ /dev/null @@ -1,56 +0,0 @@ -/* eslint-disable import/no-cycle */ -import PropTypes from 'prop-types'; -import React from 'react'; - -import Shape from './Shape'; -import OneOfType from './OneOfType'; -import ArrayOf from './ArrayOf'; -import ObjectOf from './ObjectOf'; -import OneOf from './OneOf'; -import InstanceOf from './InstanceOf'; -import Signature from './Signature'; -import Literal from './Literal'; - -import { TypeInfo } from './proptypes'; - -// propType -> Component map - these are a bit more complex prop types to display -const propTypeComponentMap = new Map([ - ['shape', Shape], - ['union', OneOfType], - ['arrayOf', ArrayOf], - ['objectOf', ObjectOf], - // Might be overkill to have below proptypes as separate components *shrug* - ['literal', Literal], - ['enum', OneOf], - ['instanceOf', InstanceOf], - ['signature', Signature], -]); - -const PrettyPropType = props => { - const { propType, depth } = props; - if (!propType) { - return unknown; - } - - if (propTypeComponentMap.has(propType.name)) { - const Component = propTypeComponentMap.get(propType.name); - return ; - } - - // Otherwise, propType does not have a dedicated component, display proptype name by default - return {propType.name || propType}; -}; - -PrettyPropType.displayName = 'PrettyPropType'; - -PrettyPropType.defaultProps = { - propType: null, - depth: 1, -}; - -PrettyPropType.propTypes = { - propType: TypeInfo, - depth: PropTypes.number, -}; - -export default PrettyPropType; diff --git a/addons/info/src/components/types/PropertyLabel.js b/addons/info/src/components/types/PropertyLabel.js deleted file mode 100644 index d5ad3d896fab..000000000000 --- a/addons/info/src/components/types/PropertyLabel.js +++ /dev/null @@ -1,31 +0,0 @@ -import PropTypes from 'prop-types'; -import React from 'react'; - -const styles = { - hasProperty: { - whiteSpace: 'nowrap', - }, -}; - -const PropertyLabel = ({ property, required }) => { - if (!property) return null; - - return ( - - {property} - {required ? '' : '?'}:  - - ); -}; - -PropertyLabel.propTypes = { - property: PropTypes.string, - required: PropTypes.bool, -}; - -PropertyLabel.defaultProps = { - property: '', - required: false, -}; - -export default PropertyLabel; diff --git a/addons/info/src/components/types/Shape.js b/addons/info/src/components/types/Shape.js deleted file mode 100644 index a9f1b6c5affc..000000000000 --- a/addons/info/src/components/types/Shape.js +++ /dev/null @@ -1,76 +0,0 @@ -/* eslint-disable import/no-cycle */ -import PropTypes from 'prop-types'; -import React from 'react'; - -import PrettyPropType from './PrettyPropType'; -import PropertyLabel from './PropertyLabel'; - -import { TypeInfo, getPropTypes } from './proptypes'; - -const MARGIN_SIZE = 15; - -const HighlightButton = props => ( - - - -`; - -exports[`Storyshots Addon/Notes Simple note 1`] = ` - - - - - -`; diff --git a/examples/angular-cli/src/stories/__snapshots__/core.stories.storyshot b/examples/angular-cli/src/stories/__snapshots__/core.stories.storyshot index ebb28412d380..baa509cf0f47 100644 --- a/examples/angular-cli/src/stories/__snapshots__/core.stories.storyshot +++ b/examples/angular-cli/src/stories/__snapshots__/core.stories.storyshot @@ -7,10 +7,10 @@ exports[`Storyshots Core/Parameters passed to story 1`] = ` target={[Function ViewContainerRef_]} > diff --git a/examples/angular-cli/src/stories/__snapshots__/custom-styles.stories.storyshot b/examples/angular-cli/src/stories/__snapshots__/custom-styles.stories.storyshot index f9628db33bf5..7aaa2e151141 100644 --- a/examples/angular-cli/src/stories/__snapshots__/custom-styles.stories.storyshot +++ b/examples/angular-cli/src/stories/__snapshots__/custom-styles.stories.storyshot @@ -8,11 +8,11 @@ exports[`Storyshots Custom/Style Default 1`] = ` > @@ -29,11 +29,11 @@ exports[`Storyshots Custom/Style With Knobs 1`] = ` > diff --git a/examples/angular-cli/src/stories/addon-notes.stories.ts b/examples/angular-cli/src/stories/addon-notes.stories.ts deleted file mode 100644 index 87f7bb7d69c9..000000000000 --- a/examples/angular-cli/src/stories/addon-notes.stories.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Button } from '@storybook/angular/demo'; - -export default { - title: 'Addon/Notes', -}; - -export const SimpleNote = () => ({ - component: Button, - props: { - text: 'Notes on some Button', - onClick: () => {}, - }, -}); - -SimpleNote.story = { - name: 'Simple note', - parameters: { notes: 'My notes on some button' }, -}; - -export const NoteWithHtml = () => ({ - component: Button, - props: { - text: 'Notes with HTML', - onClick: () => {}, - }, -}); - -NoteWithHtml.story = { - name: 'Note with HTML', - parameters: { - notes: ` -

    My notes on emojis

    - - It's not all that important to be honest, but.. - - Emojis are great, I love emojis, in fact I like using them in my Component notes too! 😇 - `, - }, -}; diff --git a/examples/angular-cli/src/stories/customControlValueAccessor/custom-cva-component.stories.ts b/examples/angular-cli/src/stories/customControlValueAccessor/custom-cva-component.stories.ts index bb93d416ef2f..e4a7ae06b432 100644 --- a/examples/angular-cli/src/stories/customControlValueAccessor/custom-cva-component.stories.ts +++ b/examples/angular-cli/src/stories/customControlValueAccessor/custom-cva-component.stories.ts @@ -1,10 +1,6 @@ import { action } from '@storybook/addon-actions'; import { CustomCvaComponent } from './custom-cva.component'; -const description = ` - This is an example of component that implements ControlValueAccessor interface -`; - export default { title: 'Custom/ngModel', }; @@ -19,5 +15,4 @@ export const CustomControlValueAccessor = () => ({ CustomControlValueAccessor.story = { name: 'custom ControlValueAccessor', - parameters: { notes: description }, }; diff --git a/examples/angular-cli/src/stories/module-context/module-context-forRoot.stories.ts b/examples/angular-cli/src/stories/module-context/module-context-forRoot.stories.ts index 91039deff0f6..10438400c401 100644 --- a/examples/angular-cli/src/stories/module-context/module-context-forRoot.stories.ts +++ b/examples/angular-cli/src/stories/module-context/module-context-forRoot.stories.ts @@ -13,33 +13,26 @@ storiesOf('Custom/Feature Module as Context with forRoot', module) imports: [ChipsModule.forRoot()], }) ) - .add( - 'Component with self and dependencies declared in its feature module', - () => { - const props: { [K in keyof ChipsGroupComponent]?: any } = { - chips: object('Chips', [ - { - id: 1, - text: 'Chip 1', - }, - { - id: 2, - text: 'Chip 2', - }, - ]), - removeChipClick: action('Remove chip'), - removeAllChipsClick: action('Remove all chips clicked'), - }; - return { - component: ChipsGroupComponent, - props, - }; - }, - { - notes: `This component includes a child component, a pipe, and a default provider, all which come from - the specified feature module.`, - } - ) + .add('Component with self and dependencies declared in its feature module', () => { + const props: { [K in keyof ChipsGroupComponent]?: any } = { + chips: object('Chips', [ + { + id: 1, + text: 'Chip 1', + }, + { + id: 2, + text: 'Chip 2', + }, + ]), + removeChipClick: action('Remove chip'), + removeAllChipsClick: action('Remove all chips clicked'), + }; + return { + component: ChipsGroupComponent, + props, + }; + }) .add('Component with default providers', () => { const props: { [K in keyof ChipComponent]?: any } = { displayText: text('Display Text', 'My Chip'), diff --git a/examples/angular-cli/src/stories/on-push/__snapshots__/on-push.stories.storyshot b/examples/angular-cli/src/stories/on-push/__snapshots__/on-push.stories.storyshot index bc7d043ffef1..ab226b47795a 100644 --- a/examples/angular-cli/src/stories/on-push/__snapshots__/on-push.stories.storyshot +++ b/examples/angular-cli/src/stories/on-push/__snapshots__/on-push.stories.storyshot @@ -7,7 +7,7 @@ exports[`Storyshots Core/OnPush Class-specified component with OnPush and Knobs target={[Function ViewContainerRef_]} > Word of the day: OnPush diff --git a/examples/angular-cli/src/stories/on-push/on-push.stories.ts b/examples/angular-cli/src/stories/on-push/on-push.stories.ts index 0246c5e87a36..543a6187e630 100644 --- a/examples/angular-cli/src/stories/on-push/on-push.stories.ts +++ b/examples/angular-cli/src/stories/on-push/on-push.stories.ts @@ -16,9 +16,4 @@ export const ClassSpecifiedComponentWithOnPushAndKnobs = () => ({ ClassSpecifiedComponentWithOnPushAndKnobs.story = { name: 'Class-specified component with OnPush and Knobs', - parameters: { - notes: ` - This component is specified by class and uses OnPush change detection. It has two properties, one being a HostBinding. Both should be updatable using knobs. - `.trim(), - }, }; diff --git a/examples/cra-kitchen-sink/.storybook/main.js b/examples/cra-kitchen-sink/.storybook/main.js index 3cb41fc807f7..cded0ccb8265 100644 --- a/examples/cra-kitchen-sink/.storybook/main.js +++ b/examples/cra-kitchen-sink/.storybook/main.js @@ -10,7 +10,6 @@ module.exports = { '@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-events', - '@storybook/addon-notes', '@storybook/addon-options', '@storybook/addon-knobs', '@storybook/addon-backgrounds', diff --git a/examples/cra-kitchen-sink/package.json b/examples/cra-kitchen-sink/package.json index 34045f78ea37..96b5cd1dcba1 100644 --- a/examples/cra-kitchen-sink/package.json +++ b/examples/cra-kitchen-sink/package.json @@ -24,11 +24,9 @@ "@storybook/addon-centered": "6.0.0-alpha.2", "@storybook/addon-docs": "6.0.0-alpha.2", "@storybook/addon-events": "6.0.0-alpha.2", - "@storybook/addon-info": "6.0.0-alpha.2", "@storybook/addon-jest": "6.0.0-alpha.2", "@storybook/addon-knobs": "6.0.0-alpha.2", "@storybook/addon-links": "6.0.0-alpha.2", - "@storybook/addon-notes": "6.0.0-alpha.2", "@storybook/addon-options": "6.0.0-alpha.2", "@storybook/addon-storyshots": "6.0.0-alpha.2", "@storybook/addons": "6.0.0-alpha.2", diff --git a/examples/cra-kitchen-sink/src/stories/button.stories.js b/examples/cra-kitchen-sink/src/stories/button.stories.js index 4a6563d040f4..d4045dc185b2 100644 --- a/examples/cra-kitchen-sink/src/stories/button.stories.js +++ b/examples/cra-kitchen-sink/src/stories/button.stories.js @@ -1,28 +1,7 @@ -/* eslint-disable react/destructuring-assignment */ import React from 'react'; import { action } from '@storybook/addon-actions'; -import { withInfo } from '@storybook/addon-info'; import { Button } from '@storybook/react/demo'; -import Container from '../components/Container'; - -const InfoButton = () => ( - -  Show Info  - -); - export default { title: 'Button', component: Button, @@ -49,32 +28,3 @@ Story2.story = { options: { selectedPanel: 'storybook/actions/panel' }, }, }; - -export const Story3 = () => ; -Story3.story = { - name: 'with notes', - parameters: { - notes: 'A very simple button', - options: { selectedPanel: 'storybook/notes/panel' }, - }, -}; - -export const Story4 = context => ( - - - click the label in top right for info about "{context.name}" - - -); -Story4.story = { - name: 'with new info', - parameters: { - notes: 'Composition: Info(Notes())', - options: { selectedPanel: 'storybook/info/panel' }, - }, - decorators: [ - withInfo( - 'Use the [info addon](https://github.com/storybookjs/storybook/tree/master/addons/info) with its new painless API.' - ), - ], -}; diff --git a/examples/cra-ts-kitchen-sink/package.json b/examples/cra-ts-kitchen-sink/package.json index 754ec97f4790..94e55238304f 100644 --- a/examples/cra-ts-kitchen-sink/package.json +++ b/examples/cra-ts-kitchen-sink/package.json @@ -36,7 +36,6 @@ "devDependencies": { "@storybook/addon-a11y": "6.0.0-alpha.2", "@storybook/addon-actions": "6.0.0-alpha.2", - "@storybook/addon-info": "6.0.0-alpha.2", "@storybook/addon-knobs": "6.0.0-alpha.2", "@storybook/addon-links": "6.0.0-alpha.2", "@storybook/addon-options": "6.0.0-alpha.2", diff --git a/examples/ember-cli/.storybook/main.js b/examples/ember-cli/.storybook/main.js index f57119476336..989dc9ee719b 100644 --- a/examples/ember-cli/.storybook/main.js +++ b/examples/ember-cli/.storybook/main.js @@ -7,7 +7,6 @@ module.exports = { '@storybook/addon-actions', '@storybook/addon-docs', '@storybook/addon-links', - '@storybook/addon-notes', '@storybook/addon-knobs', '@storybook/addon-viewport', '@storybook/addon-options', diff --git a/examples/ember-cli/package.json b/examples/ember-cli/package.json index 19db23a55661..8cd7a57a410d 100644 --- a/examples/ember-cli/package.json +++ b/examples/ember-cli/package.json @@ -23,7 +23,6 @@ "@storybook/addon-docs": "6.0.0-alpha.2", "@storybook/addon-knobs": "6.0.0-alpha.2", "@storybook/addon-links": "6.0.0-alpha.2", - "@storybook/addon-notes": "6.0.0-alpha.2", "@storybook/addon-options": "6.0.0-alpha.2", "@storybook/addon-storysource": "6.0.0-alpha.2", "@storybook/addon-viewport": "6.0.0-alpha.2", diff --git a/examples/ember-cli/stories/addon-notes.stories.js b/examples/ember-cli/stories/addon-notes.stories.js deleted file mode 100644 index c413870dad1d..000000000000 --- a/examples/ember-cli/stories/addon-notes.stories.js +++ /dev/null @@ -1,32 +0,0 @@ -import { hbs } from 'ember-cli-htmlbars'; - -export default { - title: 'Addon/Notes', -}; - -export const SimpleNote = () => ({ - template: hbs`

    Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi urna id urna.

    `, -}); - -SimpleNote.story = { - name: 'Simple note', - parameters: { notes: 'My notes on some bold text' }, -}; - -export const NoteWithHtml = () => ({ - template: hbs`

    🤔😳😯😮
    😄😩😓😱
    🤓😑😶😊

    `, -}); - -NoteWithHtml.story = { - name: 'Note with HTML', - - parameters: { - notes: ` -

    My notes on emojies

    - - It's not all that important to be honest, but.. - - Emojis are great, I love emojis, in fact I like using them in my Component notes too! 😇 - `, - }, -}; diff --git a/examples/html-kitchen-sink/.storybook/main.js b/examples/html-kitchen-sink/.storybook/main.js index 66ab602a73cd..042b87f86daf 100644 --- a/examples/html-kitchen-sink/.storybook/main.js +++ b/examples/html-kitchen-sink/.storybook/main.js @@ -10,7 +10,6 @@ module.exports = { '@storybook/addon-jest', '@storybook/addon-knobs', '@storybook/addon-links', - '@storybook/addon-notes', '@storybook/addon-options', '@storybook/addon-storysource', '@storybook/addon-viewport', diff --git a/examples/html-kitchen-sink/package.json b/examples/html-kitchen-sink/package.json index cd316a0248a1..0c8391b6c76c 100644 --- a/examples/html-kitchen-sink/package.json +++ b/examples/html-kitchen-sink/package.json @@ -22,7 +22,6 @@ "@storybook/addon-jest": "6.0.0-alpha.2", "@storybook/addon-knobs": "6.0.0-alpha.2", "@storybook/addon-links": "6.0.0-alpha.2", - "@storybook/addon-notes": "6.0.0-alpha.2", "@storybook/addon-options": "6.0.0-alpha.2", "@storybook/addon-storyshots": "6.0.0-alpha.2", "@storybook/addon-storysource": "6.0.0-alpha.2", diff --git a/examples/html-kitchen-sink/stories/__snapshots__/addon-notes.stories.storyshot b/examples/html-kitchen-sink/stories/__snapshots__/addon-notes.stories.storyshot deleted file mode 100644 index 229ca7197d45..000000000000 --- a/examples/html-kitchen-sink/stories/__snapshots__/addon-notes.stories.storyshot +++ /dev/null @@ -1,15 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Storyshots Addons/Notes Simple note 1`] = ` -

    - - - - - This is a fragment of HTML - - - - -

    -`; diff --git a/examples/html-kitchen-sink/stories/addon-notes.stories.js b/examples/html-kitchen-sink/stories/addon-notes.stories.js deleted file mode 100644 index 9129457c82d5..000000000000 --- a/examples/html-kitchen-sink/stories/addon-notes.stories.js +++ /dev/null @@ -1,16 +0,0 @@ -export default { - title: 'Addons/Notes', -}; - -export const Story1 = () => - `

    - - This is a fragment of HTML - -

    `; -Story1.story = { - name: 'Simple note', - parameters: { - notes: 'My notes on some bold text', - }, -}; diff --git a/examples/mithril-kitchen-sink/.storybook/main.js b/examples/mithril-kitchen-sink/.storybook/main.js index 3a53130947d7..0a070fa00ad2 100644 --- a/examples/mithril-kitchen-sink/.storybook/main.js +++ b/examples/mithril-kitchen-sink/.storybook/main.js @@ -6,7 +6,6 @@ module.exports = { '@storybook/addon-storysource', '@storybook/addon-actions', '@storybook/addon-links', - '@storybook/addon-notes', '@storybook/addon-knobs', '@storybook/addon-viewport', '@storybook/addon-options', diff --git a/examples/mithril-kitchen-sink/package.json b/examples/mithril-kitchen-sink/package.json index 4a875364c661..841dae795db9 100644 --- a/examples/mithril-kitchen-sink/package.json +++ b/examples/mithril-kitchen-sink/package.json @@ -16,7 +16,6 @@ "@storybook/addon-centered": "6.0.0-alpha.2", "@storybook/addon-knobs": "6.0.0-alpha.2", "@storybook/addon-links": "6.0.0-alpha.2", - "@storybook/addon-notes": "6.0.0-alpha.2", "@storybook/addon-options": "6.0.0-alpha.2", "@storybook/addon-storyshots": "6.0.0-alpha.2", "@storybook/addon-storysource": "6.0.0-alpha.2", diff --git a/examples/mithril-kitchen-sink/src/stories/addon-notes.stories.js b/examples/mithril-kitchen-sink/src/stories/addon-notes.stories.js deleted file mode 100644 index 26a9b8a401db..000000000000 --- a/examples/mithril-kitchen-sink/src/stories/addon-notes.stories.js +++ /dev/null @@ -1,52 +0,0 @@ -/** @jsx m */ - -import m from 'mithril'; - -export default { - title: 'Addons/Notes', -}; - -export const Story1 = () => ({ - view: () => ( -

    - - Etiam vulputate elit eu venenatis eleifend. Duis nec lectus augue. Morbi egestas diam sed - vulputate mollis. Fusce egestas pretium vehicula. Integer sed neque diam. Donec consectetur - velit vitae enim varius, ut placerat arcu imperdiet. Praesent sed faucibus arcu. Nullam sit - amet nibh a enim eleifend rhoncus. Donec pretium elementum leo at fermentum. Nulla - sollicitudin, mauris quis semper tempus, sem metus tristique diam, efficitur pulvinar mi - urna id urna. - -

    - ), -}); - -Story1.story = { - name: 'Simple note', - parameters: { notes: 'My notes on some bold text' }, -}; - -export const Story2 = () => ({ - view: () => ( -

    - 🤔😳😯😮 -
    - 😄😩😓😱 -
    - 🤓😑😶😊 -

    - ), -}); - -Story2.story = { - name: 'Note with HTML', - parameters: { - notes: ` -

    My notes on emojies

    - - It's not all that important to be honest, but.. - - Emojis are great, I love emojis, in fact I like using them in my Component notes too! 😇 - `, - }, -}; diff --git a/examples/official-storybook/main.js b/examples/official-storybook/main.js index cd5ac9d75050..0e2cf6ee5151 100644 --- a/examples/official-storybook/main.js +++ b/examples/official-storybook/main.js @@ -12,7 +12,6 @@ module.exports = { '@storybook/addon-actions', '@storybook/addon-links', '@storybook/addon-events', - '@storybook/addon-notes', '@storybook/addon-options', '@storybook/addon-knobs', '@storybook/addon-cssresources', diff --git a/examples/official-storybook/package.json b/examples/official-storybook/package.json index e5b94f3be5f6..334c149947f1 100644 --- a/examples/official-storybook/package.json +++ b/examples/official-storybook/package.json @@ -24,11 +24,9 @@ "@storybook/addon-docs": "6.0.0-alpha.2", "@storybook/addon-events": "6.0.0-alpha.2", "@storybook/addon-graphql": "6.0.0-alpha.2", - "@storybook/addon-info": "6.0.0-alpha.2", "@storybook/addon-jest": "6.0.0-alpha.2", "@storybook/addon-knobs": "6.0.0-alpha.2", "@storybook/addon-links": "6.0.0-alpha.2", - "@storybook/addon-notes": "6.0.0-alpha.2", "@storybook/addon-options": "6.0.0-alpha.2", "@storybook/addon-queryparams": "6.0.0-alpha.2", "@storybook/addon-storyshots": "6.0.0-alpha.2", diff --git a/examples/official-storybook/preview.js b/examples/official-storybook/preview.js index c8ef59f5683d..074c294f18c0 100644 --- a/examples/official-storybook/preview.js +++ b/examples/official-storybook/preview.js @@ -3,7 +3,6 @@ import { addDecorator, addParameters } from '@storybook/react'; import { Global, ThemeProvider, themes, createReset, convert } from '@storybook/theming'; import { withCssResources } from '@storybook/addon-cssresources'; import { withA11y } from '@storybook/addon-a11y'; -import { withNotes } from '@storybook/addon-notes'; import { DocsPage } from '@storybook/addon-docs/blocks'; import addHeadWarning from './head-warning'; @@ -27,7 +26,6 @@ addHeadWarning('dotenv-file-not-loaded', 'Dotenv file not loaded'); addDecorator(withCssResources); addDecorator(withA11y); -addDecorator(withNotes); addDecorator(storyFn => ( diff --git a/examples/official-storybook/stories/addon-info/EXAMPLE.md b/examples/official-storybook/stories/addon-info/EXAMPLE.md deleted file mode 100644 index fc965844dda0..000000000000 --- a/examples/official-storybook/stories/addon-info/EXAMPLE.md +++ /dev/null @@ -1,3 +0,0 @@ -# external -## markdown -file diff --git a/examples/official-storybook/stories/addon-info/decorators.stories.js b/examples/official-storybook/stories/addon-info/decorators.stories.js deleted file mode 100644 index 780fb3a0b6db..000000000000 --- a/examples/official-storybook/stories/addon-info/decorators.stories.js +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import { withInfo } from '@storybook/addon-info'; -import BaseButton from '../../components/BaseButton'; - -export default { - title: 'Addons/Info/Decorator', - decorators: [withInfo('Info can take options via the global or local decorator as well.')], -}; - -export const UseInfo = () => ; -UseInfo.story = { name: 'Use Info as story decorator' }; diff --git a/examples/official-storybook/stories/addon-info/forward-ref.stories.js b/examples/official-storybook/stories/addon-info/forward-ref.stories.js deleted file mode 100644 index 1aa8da24c022..000000000000 --- a/examples/official-storybook/stories/addon-info/forward-ref.stories.js +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import { withInfo } from '@storybook/addon-info'; -import ForwardedRefButton from '../../components/ForwardedRefButton'; -import ForwardedRefButtonWDisplayName from '../../components/ForwardedRefButtonWDisplayName'; - -export default { - title: 'Addons/Info/ForwardRef', - decorators: [withInfo], -}; - -export const DisplaysCorrectly = () => ; -DisplaysCorrectly.story = { name: 'Displays forwarded ref components correctly' }; - -export const DisplayName = () => ( - -); -DisplayName.story = { name: 'Uses forwardRef displayName if available' }; diff --git a/examples/official-storybook/stories/addon-info/github-issues.js b/examples/official-storybook/stories/addon-info/github-issues.js deleted file mode 100644 index 3b96ca11eded..000000000000 --- a/examples/official-storybook/stories/addon-info/github-issues.js +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react'; -import { withInfo } from '@storybook/addon-info'; - -const hoc = WrapComponent => ({ ...props }) => ; - -const Input = hoc(() => ); - -const TextArea = hoc(({ children }) => ); - -export default { - title: 'Addons/Info/GitHub issues', - decorators: [withInfo], -}; - -export const issue1814 = () => ( -
    - -