Socket
Socket
Sign inDemoInstall

@kadira/react-storybook-addon-info

Package Overview
Dependencies
23
Maintainers
6
Versions
23
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.2 to 3.1.3

7

CHANGELOG.md
# Change Log
### v3.1.3
* Fix wrong detection of propType when isRequired is set [PR49](https://github.com/kadirahq/react-storybook-addon-info/pull/49)
* Add displayName for Button [PR51](https://github.com/kadirahq/react-storybook-addon-info/pull/51)
### v3.1.2
* Fixed a bug which made the `info` to not display and the `options` parameter to be ignored when `info` is not given.[PR45](https://github.com/kadirahq/react-storybook-addon-info/pull/45)
### v3.1.1

@@ -4,0 +11,0 @@

1

dist/components/PropTable.js

@@ -52,2 +52,3 @@ 'use strict';

PropTypesMap.set(type, typeName);
PropTypesMap.set(type.isRequired, typeName);
}

@@ -54,0 +55,0 @@

15

example/Button.js

@@ -9,9 +9,12 @@ import React from 'react';

Button.propTypes = {
label: React.PropTypes.string.isRequired,
style: React.PropTypes.object,
disabled: React.PropTypes.bool,
onClick: React.PropTypes.func,
};
Object.assign(Button, {
displayName: 'Button',
propTypes: {
label: React.PropTypes.string.isRequired,
style: React.PropTypes.object,
disabled: React.PropTypes.bool,
onClick: React.PropTypes.func,
},
});
export default Button;
{
"name": "@kadira/react-storybook-addon-info",
"version": "3.1.2",
"version": "3.1.3",
"description": "A React Storybook addon to show additional information for your stories.",

@@ -5,0 +5,0 @@ "repository": {

import React from 'react';
import PropVal from './PropVal'
import PropVal from './PropVal';
const PropTypesMap = new Map();
for (let typeName in React.PropTypes) {
for (const typeName in React.PropTypes) {
if (!React.PropTypes.hasOwnProperty(typeName)) {
continue
continue;
}
const type = React.PropTypes[typeName];
PropTypesMap.set(type, typeName);
PropTypesMap.set(type.isRequired, typeName);
}

@@ -18,7 +19,7 @@

borderCollapse: 'separate',
}
},
};
export default class PropTable extends React.Component {
render () {
render() {
const type = this.props.type;

@@ -33,5 +34,5 @@

if (type.propTypes) {
for (let property in type.propTypes) {
for (const property in type.propTypes) {
if (!type.propTypes.hasOwnProperty(property)) {
continue
continue;
}

@@ -41,3 +42,3 @@ const typeInfo = type.propTypes[property];

const required = typeInfo.isRequired === undefined ? 'yes' : 'no';
props[property] = {property, propType, required};
props[property] = { property, propType, required };
}

@@ -47,5 +48,5 @@ }

if (type.defaultProps) {
for (let property in type.defaultProps) {
for (const property in type.defaultProps) {
if (!type.defaultProps.hasOwnProperty(property)) {
continue
continue;
}

@@ -57,3 +58,3 @@ const value = type.defaultProps[property];

if (!props[property]) {
props[property] = {property};
props[property] = { property };
}

@@ -88,3 +89,3 @@ props[property].defaultValue = value;

<td>{row.required}</td>
<td>{row.defaultValue === undefined ? '-' : <PropVal val={row.defaultValue} />}</td>
<td>{row.defaultValue === undefined ? '-' : <PropVal val={row.defaultValue} />}</td>
</tr>

@@ -100,3 +101,3 @@ ))}

PropTable.propTypes = {
type: React.PropTypes.func
type: React.PropTypes.func,
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc