{"bugs":{"url":"https://github.com/storybookjs/storybook/issues"},"dist":{"shasum":"0f11255bc8ea32450a48b7f5b473794d9c7f2da6","tarball":"https://registry.npmjs.org/@storybook/addon-info/-/addon-info-5.3.0-rc.7.tgz","fileCount":38,"integrity":"sha512-qtDuQzpddr+Ui0xf6dNxeaPX56MfcKQ1msTnNEMOVKorqnf3n77qBZs2XnAVQLBQx3emJTP9QfYNIxgXA82Wug==","signatures":[{"sig":"MEQCIAW3dmvDa/kbIZWhTM58M4M+SUVD/eGhpoCWPATeSR4cAiBndAE0n92vcN08MpL/EHbe6q1q5FOlQjf1qwXArjG67Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":227445,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeDV5qCRA9TVsSAnZWagAAMbIP/RCNMbZSU0Dxa2P+B3LU\nNcF45pCROiMZ79lG5yzwi0ZqUpQxsLnS3YEsnqWr1+bQcrPEqgDj6Ki35Sz0\nVyIv5+/AndLY/O4hQKaOcQSCugqSMCuicb1vLNcQdSlGLt7BvMC6ZB3FkeMI\nUC74vsBhsyFkNBNArPiNZ/TBkLW/9lQ81qPxm6Z0aVJ8dwhCHtNee5kj3eFe\nUDeRrL/T8uC1IKecdNd5qDZY41YDGmblH8+FHQ+RMk/n5DEbWhn5zQAgy4lP\nw0ojccUW7SEEtsChYrCPNDxaC0y1Sd1mXLCuny6oglxF0HaRI1nfN6VpvnKK\n9M1VWw9FGrWALP5h77Tj7z+xI2sRi27fJyg+aDpWhb5cJtUMnLv0R74C1reg\nnX13yyF1uoqKDhPc1yBL1aW/t4NmEWecmfgavkG25Bz6eg4sB1hxK+7O6PFk\nlePz1QHmbN0QdQPzLQG55Pi5U2oEHibkEViei7i/5BlkZJmPZZR22VBP46jU\njquTBIGsHcRv/3oqTnFaBnexiy+PTTZyXOCyrYPuRYkUUW2FduOSNPLGR7R9\nncxz0odogzqJ+IeajxeS0Ro6+ONTQ5gr2b0Dyv0Y2BAqPomLIR3gwl3vxBXz\nCJAKsEG+oiDw9YDiJSbV/rGDyT/Rl8eIE0NeGj3ePcTjT5sT92pOiKGKiquy\nEj+z\r\n=nSME\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","name":"@storybook/addon-info","readme":"# Storybook Info Addon\n\nStorybook Info Addon will show additional information for your stories in [Storybook](https://storybook.js.org).\nUseful when you want to display usage or other types of documentation alongside your story.\n\n[Framework Support](https://github.com/storybookjs/storybook/blob/master/ADDONS_SUPPORT.md)\n\n![Screenshot](https://raw.githubusercontent.com/storybookjs/storybook/HEAD/addons/info/docs/home-screenshot.png)\n\n## Installation\n\nInstall the following npm module:\n\n```sh\nnpm i -D @storybook/addon-info\n```\n\n## Basic usage\n\nThen, add `withInfo` as a decorator to your book of stories.\nIt is possible to add `info` by default to all or a subsection of stories by using a global or story decorator.\n\nIt is important to declare this decorator as **the first decorator**, otherwise it won't work well.\n\n```js\n// Globally in your .storybook/preview.js.\nimport { addDecorator } from '@storybook/react';\nimport { withInfo } from '@storybook/addon-info';\n\naddDecorator(withInfo); \n```\n\nor\n\n```js\nexport default {\n  title: 'Component',\n  decorators: [withInfo],\n};\n```\n\nThen, you can use the `info` parameter to either pass certain options or specific documentation text to your stories.\nA complete list of possible configurations can be found [in a later section](#setting-global-options).\nThis can be done per book of stories:\n\n```js\nimport Component from './Component';\n\nexport default {\n  title: 'Component',\n  parameters: {\n    info: {},\n  },\n};\n```\n\n...or for each story individually:\n\n```js\nimport Component from './Component';\n\nexport default {\n  title: 'Component',\n};\n\nexport const defaultView = () => <Component />;\ndefaultView = {\n  parameters: {\n    info: { inline: true },\n  },\n};\n```\n\nIt is also possible to disable the `info` addon entirely.\nDepending 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.\n\n```\ninfo: {\n  disable: true,\n}\n```\n\n## Markdown\n\nThe `info` addon also supports markdown.\nTo 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.\n\n```js\ninfo: {\n  text: `\n    description or documentation about my component, supports markdown\n\n    ~~~js\n    <Button>Click Here</Button>\n    ~~~\n  `,\n}\n```\n\n## Setting Global Options\n\nTo configure default options for all usage of the info addon, pass a option object along with the decorator in `.storybook/preview.js`.\n\n```js\nimport { withInfo } from '@storybook/addon-info';\n\naddDecorator(\n  withInfo({\n    header: false,\n  })\n);\n```\n\nConfiguration 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.\nIn order, all of them will be combined together, with a later call overriding the previous set configurations on a per-key basis.\n\n## Options and Defaults\n\n```js\n{\n  /**\n   * Text to display with storybook component\n   */\n  text?: string;\n  /**\n   * Displays info inline vs click button to view\n   * @default false\n   */\n  inline: boolean,\n  /**\n   * Toggles display of header with component name and description\n   * @default true\n   */\n  header: boolean,\n  /**\n   * Displays the source of story Component\n   * @default true\n   */\n  source: boolean,\n  /**\n   * Components used in story\n   * Displays Prop Tables with these components\n   * @default []\n   */\n  propTables: Array<React.ComponentType>,\n  /**\n   * Exclude Components from being shown in Prop Tables section\n   * Accepts an array of component classes or functions\n   * @default []\n   */\n  propTablesExclude: Array<React.ComponentType>,\n  /**\n   * Overrides styles of addon. The object should follow this shape:\n   * https://github.com/storybookjs/storybook/blob/master/addons/info/src/components/Story.js#L19.\n   * This prop can also accept a function which has the default stylesheet passed as an argument\n   */\n  styles: Object | Function,\n  /**\n   * Overrides components used to display markdown\n   * @default {}\n   */\n  components: { [key: string]: React.ComponentType },\n  /**\n   * Max props to display per line in source code\n   * @default 3\n   */\n  maxPropsIntoLine: number,\n  /**\n   * Displays the first 10 characters of the prop name\n   * @default 3\n   */\n  maxPropObjectKeys: number,\n  /**\n   * Displays the first 10 items in the default prop array\n   * @default 3\n   */\n  maxPropArrayLength: number,\n  /**\n   * Displays the first 100 characters in the default prop string\n   * @default 50\n   */\n  maxPropStringLength: number,\n  /**\n   * Override the component used to render the props table\n   * @default PropTable\n   */\n  TableComponent: React.ComponentType,\n  /**\n   * Will exclude any respective properties whose name is included in array\n   * @default []\n   */\n  excludedPropTypes: Array<string>,\n}\n```\n\n### Rendering a Custom Table\n\nThe `TableComponent` option allows you to define how the prop table should be rendered. Your component will be rendered with the following props.\n\n```js\n  {\n    propDefinitions: Array<{\n      property: string, // The name of the prop\n      propType: Object | string, // The prop type. TODO: info about what this object is...\n      required: boolean, // True if the prop is required\n      description: string, // The description of the prop\n      defaultValue: any // The default value of the prop\n    }>\n  }\n```\n\nExample:\n\n```js\n// button.js\n// @flow\nimport React from 'react';\n\nconst paddingStyles = {\n  small: '4px 8px',\n  medium: '8px 16px',\n};\n\nconst Button = ({\n  size,\n  ...rest\n}: {\n  /** The size of the button */\n  size: 'small' | 'medium',\n}) => {\n  const style = {\n    padding: paddingStyles[size] || '',\n  };\n  return <button style={style} {...rest} />;\n};\nButton.defaultProps = {\n  size: 'medium',\n};\n\nexport default Button;\n```\n\n```js\n// stories.js\nimport React from 'react';\n\nimport { storiesOf } from '@storybook/react';\nimport Button from './button';\n\nexport default {\n  title: 'Button',\n  component: Button,\n  parameters: {\n    info: TableComponent,\n  },\n};\n\nconst Red = props => <span style={{ color: 'red' }} {...props} />;\n\nconst TableComponent = ({ propDefinitions }) => {\n  const props = propDefinitions.map(\n    ({ property, propType, required, description, defaultValue }) => {\n      return (\n        <tr key={property}>\n          <td>\n            {property}\n            {required ? <Red>*</Red> : null}\n          </td>\n          <td>{propType.name}</td>\n          <td>{defaultValue}</td>\n          <td>{description}</td>\n        </tr>\n      );\n    }\n  );\n\n  return (\n    <table>\n      <thead>\n        <tr>\n          <th>name</th>\n          <th>type</th>\n          <th>default</th>\n          <th>description</th>\n        </tr>\n      </thead>\n      <tbody>{props}</tbody>\n    </table>\n  );\n};\n\nexport const defaultView = () => <Button />;\n```\n\n### React Docgen Integration\n\nReact Docgen is included as part of the @storybook/react package through the use of `babel-plugin-react-docgen` during babel compile time.\nWhen rendering a story with a React component commented in this supported format, the Addon Info description will render the comments above the component declaration and the prop table will display the prop's comment in the description column.\n\n```js\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\n/** Button component description */\nconst DocgenButton = ({ disabled, label, style, onClick }) => (\n  <button disabled={disabled} style={style} onClick={onClick}>\n    {label}\n  </button>\n);\n\nDocgenButton.defaultProps = {\n  disabled: false,\n  onClick: () => {},\n  style: {},\n};\n\nDocgenButton.propTypes = {\n  /** Boolean indicating whether the button should render as disabled */\n  disabled: PropTypes.bool,\n  /** button label. */\n  label: PropTypes.string.isRequired,\n  /** onClick handler */\n  onClick: PropTypes.func,\n  /** component styles */\n  style: PropTypes.shape,\n};\n\nexport default DocgenButton;\n```\n\nComments 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.\n\n## The FAQ\n\n**Components lose their names on static build**\n\nComponent names also get minified with other javascript code when building for production.\nWhen creating components, set the `displayName` static property to show the correct component name on static builds.\n","gitHead":"f54e19061b27204d2b569db1c0cd720eb6a5b25a","license":"MIT","scripts":{"prepare":"node ../../scripts/prepare.js"},"_npmUser":{"name":"shilman","email":"michael@lab80.co"},"homepage":"https://github.com/storybookjs/storybook/tree/master/addons/info","keywords":["addon","storybook"],"repository":{"url":"git+https://github.com/storybookjs/storybook.git","type":"git","directory":"addons/info"},"_npmVersion":"lerna/3.19.0/node@v10.16.3+x64 (darwin)","description":"A Storybook addon to show additional information for your stories.","directories":{},"maintainers":[{"name":"alexandrebodin","email":"bodin.alex@gmail.com"},{"name":"danielduan","email":"dduan@yahoo.com"},{"name":"domyen","email":"dom@hichroma.com"},{"name":"ghengeveld","email":"info@ghengeveld.nl"},{"name":"gongreg","email":"gytis.vinclovas@gmail.com"},{"name":"hypnosphi","email":"talpa@yandex.ru"},{"name":"igor-dv","email":"davydkin.igor@gmail.com"},{"name":"kylesuss","email":"susskyle@gmail.com"},{"name":"ndelangen","email":"ndelangen@me.com"},{"name":"pksunkara","email":"pavan.sss1991@gmail.com"},{"name":"shilman","email":"michael@lab80.co"},{"name":"tmeasday","email":"tom@thesnail.org"},{"name":"usulpro","email":"regx@usul.su"}],"_nodeVersion":"10.16.3","dependencies":{"react":"^16.8.3","global":"^4.3.2","marksy":"^8.0.0","core-js":"^3.0.1","react-is":"^16.8.3","prop-types":"^15.7.2","util-deprecate":"^1.0.2","@storybook/addons":"5.3.0-rc.7","@storybook/theming":"5.3.0-rc.7","nested-object-assign":"^1.0.3","@storybook/components":"5.3.0-rc.7","react-lifecycles-compat":"^3.0.4","@storybook/client-logger":"5.3.0-rc.7","react-element-to-jsx-string":"^14.0.2","react-addons-create-fragment":"^15.6.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"react-test-renderer":"^16.8.3"},"peerDependencies":{"react":"*"},"_npmOperationalInternal":{"tmp":"tmp/addon-info_5.3.0-rc.7_1577934442469_0.177955163806097","host":"s3://npm-registry-packages"},"_id":"@storybook/addon-info@5.3.0-rc.7","version":"5.3.0-rc.7"}