@storybook/addon-notes
Advanced tools
Comparing version 3.1.2 to 3.2.0-alpha.0
@@ -6,32 +6,8 @@ 'use strict'; | ||
}); | ||
exports.WithNotes = undefined; | ||
exports.addonNotes = undefined; | ||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); | ||
var _utilDeprecate = require('util-deprecate'); | ||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); | ||
var _utilDeprecate2 = _interopRequireDefault(_utilDeprecate); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
var _inherits2 = require('babel-runtime/helpers/inherits'); | ||
var _inherits3 = _interopRequireDefault(_inherits2); | ||
var _react = require('react'); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _addons = require('@storybook/addons'); | ||
@@ -41,37 +17,26 @@ | ||
var _react = require('./react'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var WithNotes = exports.WithNotes = function (_React$Component) { | ||
(0, _inherits3.default)(WithNotes, _React$Component); | ||
var addonNotes = exports.addonNotes = function addonNotes(_ref) { | ||
var notes = _ref.notes; | ||
function WithNotes() { | ||
(0, _classCallCheck3.default)(this, WithNotes); | ||
return (0, _possibleConstructorReturn3.default)(this, (WithNotes.__proto__ || (0, _getPrototypeOf2.default)(WithNotes)).apply(this, arguments)); | ||
} | ||
var channel = _addons2.default.getChannel(); | ||
(0, _createClass3.default)(WithNotes, [{ | ||
key: 'render', | ||
value: function render() { | ||
var _props = this.props, | ||
children = _props.children, | ||
notes = _props.notes; | ||
var channel = _addons2.default.getChannel(); | ||
// send the notes to the channel. | ||
return function (getStory) { | ||
return function () { | ||
// send the notes to the channel before the story is rendered | ||
channel.emit('storybook/notes/add_notes', notes); | ||
// return children elements. | ||
return children; | ||
} | ||
}]); | ||
return WithNotes; | ||
}(_react2.default.Component); | ||
return getStory(); | ||
}; | ||
}; | ||
}; | ||
WithNotes.propTypes = { | ||
children: _propTypes2.default.node, | ||
notes: _propTypes2.default.string | ||
}; | ||
WithNotes.defaultProps = { | ||
children: null, | ||
notes: '' | ||
}; | ||
Object.defineProperty(exports, 'WithNotes', { | ||
configurable: true, | ||
enumerable: true, | ||
get: (0, _utilDeprecate2.default)(function () { | ||
return _react.WithNotes; | ||
}, '@storybook/addon-notes WithNotes Component is deprecated, use withNotes() instead. See https://github.com/storybooks/storybook/tree/master/addons/notes') | ||
}); |
{ | ||
"name": "@storybook/addon-notes", | ||
"version": "3.1.2", | ||
"version": "3.2.0-alpha.0", | ||
"description": "Write notes for your Storybook stories.", | ||
"keywords": [ | ||
"addon", | ||
"react", | ||
"storybook" | ||
"storybook", | ||
"notes" | ||
], | ||
@@ -24,9 +24,7 @@ "license": "MIT", | ||
"babel-runtime": "^6.23.0", | ||
"prop-types": "^15.5.10" | ||
"util-deprecate": "^1.0.2" | ||
}, | ||
"devDependencies": { | ||
"git-url-parse": "^6.2.2", | ||
"react": "^15.5.4", | ||
"react-addons-test-utils": "^15.5.1", | ||
"react-dom": "^15.5.4" | ||
"prop-types": "^15.5.10", | ||
"react": "^15.5.4" | ||
}, | ||
@@ -33,0 +31,0 @@ "peerDependencies": { |
@@ -34,6 +34,4 @@ # Storybook Addon Notes | ||
```js | ||
import React from 'react'; | ||
import { storiesOf } from '@storybook/react'; | ||
import { WithNotes } from '@storybook/addon-notes'; | ||
import { addonNotes } from '@storybook/addon-notes'; | ||
@@ -43,7 +41,3 @@ import Component from './Component'; | ||
storiesOf('Component', module) | ||
.add('with some emoji', () => ( | ||
<WithNotes notes={'A very simple component'}> | ||
<Component></Component> | ||
</WithNotes> | ||
)); | ||
.add('with some emoji', addonNotes({ notes: 'A very simple component'})(() => <Component></Component>)); | ||
``` |
@@ -1,24 +0,22 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import deprecate from 'util-deprecate'; | ||
import addons from '@storybook/addons'; | ||
import { WithNotes as ReactWithNotes } from './react'; | ||
export class WithNotes extends React.Component { | ||
render() { | ||
const { children, notes } = this.props; | ||
const channel = addons.getChannel(); | ||
export const addonNotes = ({ notes }) => { | ||
const channel = addons.getChannel(); | ||
// send the notes to the channel. | ||
return getStory => () => { | ||
// send the notes to the channel before the story is rendered | ||
channel.emit('storybook/notes/add_notes', notes); | ||
// return children elements. | ||
return children; | ||
} | ||
} | ||
return getStory(); | ||
}; | ||
}; | ||
WithNotes.propTypes = { | ||
children: PropTypes.node, | ||
notes: PropTypes.string, | ||
}; | ||
WithNotes.defaultProps = { | ||
children: null, | ||
notes: '', | ||
}; | ||
Object.defineProperty(exports, 'WithNotes', { | ||
configurable: true, | ||
enumerable: true, | ||
get: deprecate( | ||
() => ReactWithNotes, | ||
'@storybook/addon-notes WithNotes Component is deprecated, use withNotes() instead. See https://github.com/storybooks/storybook/tree/master/addons/notes' | ||
), | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
179181
2
18
311
2
42
1
+ Addedutil-deprecate@^1.0.2
+ Addedutil-deprecate@1.0.2(transitive)
- Removedprop-types@^15.5.10
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact-is@16.13.1(transitive)