Skip to content

Commit 09747c6

Browse files
committed
Merge branch 'master' into eslint-strict
# Conflicts: # addons/centered/package.json # addons/graphql/package.json # addons/info/package.json # addons/knobs/package.json # addons/links/.storybook/config.js # addons/notes/package.json # addons/notes/src/index.js # addons/notes/src/register.js # addons/options/src/manager/index.js # addons/storyshots/src/index.js # addons/storyshots/stories/required_with_context/Button.stories.js # addons/storyshots/stories/required_with_context/Welcome.js # app/react-native/package.json # app/react-native/src/manager/index.js # lib/channel-postmessage/package.json # lib/channel-postmessage/src/index.js # lib/channel-websocket/package.json # lib/channel-websocket/src/index.js # lib/cli/generators/METEOR/index.js # lib/cli/generators/REACT/template/stories/Welcome.js # lib/cli/generators/REACT_SCRIPTS/index.js # lib/cli/generators/WEBPACK_REACT/template/stories/Welcome.js # packages/react-storybook/src/server/track_usage.js # packages/storybook-ui/src/modules/ui/components/layout/usplit.js # scripts/prepublish.js
2 parents 45ba7ba + bf7db99 commit 09747c6

File tree

476 files changed

+1844
-1944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

476 files changed

+1844
-1944
lines changed

Diff for: .bithoundrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"ignore": [
3+
"addons/**/.storybook/**/*.js",
4+
"lib/cli/generators/**/.stories/**.js",
5+
"*.ts"
6+
],
7+
"critics": {
8+
"wc": {
9+
"limit": 500
10+
}
11+
}
12+
}

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ coverage/
1212
build
1313
packages/examples/automated-*
1414
yarn.lock
15+
/**/LICENSE

Diff for: .npmignore

+9
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1+
/src/
2+
/example/
3+
/demo/
4+
/docs/
5+
/node_modules/
6+
/.storybook/
7+
8+
*.md
9+
110
.babelrc

Diff for: CONTRIBUTING.md

+19-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to React Storybook
1+
# Contributing to Storybook
22

33
Thanks for your interest in improving Storybook! We are a community-driven project and welcome contributions of all kinds: from discussion to documentation to bugfixes to feature improvements.
44

@@ -33,16 +33,16 @@ To test your project against the current latest version of storybook, you can cl
3333
```
3434
cd packages/react-storybook
3535
npm link
36-
36+
3737
cd <your-project>
3838
npm link @kadira/storybook
39-
39+
4040
# repeat with whichever other parts of the monorepo you are using.
4141
```
4242

4343
### Reproductions
4444

45-
The best way to help figure out an issue you are having is to produce a minimal reproduction against the `master` branch.
45+
The best way to help figure out an issue you are having is to produce a minimal reproduction against the `master` branch.
4646

4747
A good way to do that is using the example `test-cra` app embedded in this repository:
4848

@@ -99,7 +99,18 @@ Issues that are tagged `question / support` or `needs reproduction` are great pl
9999

100100
### Triaging issues
101101

102-
Once you've helped out on a few issues, if you'd like triage access, you can help label issues, and respond to reporters. New issues should be labelled as one of `bug`, `new feature`, `question / support` or `discussion`.
102+
Once you've helped out on a few issues, if you'd like triage access you can help label issues and respond to reporters.
103+
104+
We use the following label scheme to categorize issues:
105+
- **type** - `bug`, `feature`, `question / support`, `discussion`, `greenkeeper`, `maintenance`.
106+
- **area** - `addon: x`, `addons-api`, `stories-api`, `ui`, etc.
107+
- **status** - `needs reproduction`, `needs PR`, `in progress`, etc.
108+
109+
All issues should have a `type` label. `bug`/`feature`/`question`/`discussion` are self-explanatory. `greenkeeper` is for keeping package dependencies up to date. `maintenance` is a catch-all for any kind of cleanup or refactoring.
110+
111+
They should also have one or more `area`/`status` labels. We use these labels to filter issues down so we can easily see all of the issues for a particular area, and keep the total number of open issues under control.
112+
113+
For example, here is the list of [open, untyped issues](https://github.com/storybooks/storybook/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20-label%3A%22bug%22%20-label%3A%22discussion%22%20-label%3A%22feature%22%20-label%3A%22maintenance%22%20-label%3A%22question%20%2F%20support%22%20-label%3A%22documentation%22%20-label%3A%22greenkeeper%22), or here is a list of [bugs that have not been modified since 2017-04-01](https://github.com/storybooks/storybook/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3A%22bug%22%20updated%3A%3C%3D2017-04-01%20). For more info see [searching issues](https://help.github.com/articles/searching-issues/) in the Github docs.
103114

104115
If an issue is a `bug`, and it doesn't have a clear reproduction that you have personally confirmed, label it `needs reproduction` and ask the author to try and create a reproduction, or have a go yourself.
105116

@@ -109,15 +120,14 @@ If an issue is a `bug`, and it doesn't have a clear reproduction that you have p
109120

110121
- Unreproducible issues should be closed if it's not possible to reproduce them (if the reporter drops offline, it is reasonable to wait 2 weeks before closing).
111122

112-
- `bug`s should be closed when the issue is fixed and merged to `master`
123+
- `bug`s should be labeled `merged` when merged, and be closed when the issue is fixed and released.
113124

114-
- `new feature`s should be closed when merged or if the feature is deemed to be not appropriate.
125+
- `feature`s, `maintenance`s, `greenkeeper`s should be labeled `merged` when merged, and closed when released or if the feature is deemed not appropriate.
115126

116127
- `question / support`s should be closed when the question has been answered. If the questioner drops offline, a reasonable period to wait is two weeks.
117128

118129
- `discussion`s should be closed at a maintainer's discretion.
119130

120-
121131
## Development Guide
122132

123133
> If you want to work on a UI feature, refer to the [Storybook UI](https://github.com/storybooks/storybook/tree/master/packages/storybook-ui) project.
@@ -155,7 +165,7 @@ getstorybook
155165
Then link storybook inside the sample project with:
156166

157167
```sh
158-
npm link @kadira/storybook
168+
npm link @storybook/react
159169
```
160170

161171
### Getting Changes

Diff for: HISTORY.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## v.Next
2+
3+
- Deprecated `{ linkTo, action }` as built-in addons: https://github.com/storybooks/storybook/issues/1017. From 3.0 use them as you would [any other addon](https://storybooks.js.org/docs/react-storybook/addons/using-addons/).
4+
5+
Before:
6+
7+
```js
8+
// .storybook/addons.js
9+
import '@kadira/storybook/addons'
10+
11+
// *.stories.js
12+
import { linkTo, action } from '@kadira/storybook'
13+
```
14+
15+
After:
16+
17+
```js
18+
// .storybook/addons.js
19+
import '@storybook/addon-actions/register'
20+
import '@storybook/addon-links/register'
21+
22+
// *.stories.js
23+
import { action } from '@storybook/addon-actions'
24+
import { linkTo } from '@storybook/addon-links'
25+
```

Diff for: LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2016 Your Name. <name@emailprovider.io>
3+
Copyright (c) 2017 Kadira Inc. <hello@kadira.io>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Diff for: README.md

+19-16
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
[![Build Status](https://travis-ci.org/storybooks/storybook.svg?branch=master)](https://travis-ci.org/storybooks/storybook)
44
[![CodeFactor](https://www.codefactor.io/repository/github/storybooks/storybook/badge)](https://www.codefactor.io/repository/github/storybooks/storybook)
55
[![Known Vulnerabilities](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847/badge.svg)](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847)
6-
[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook)
6+
[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook)
77
[![Storybook Slack](https://storybooks-slackin.herokuapp.com/badge.svg)](https://storybooks-slackin.herokuapp.com/)
88

9-
Storybook is a development environment for React UI components. It allows you to browse a component library, view the different states of each component, and interactively develop and test components.
9+
Storybook is a development environment for UI components.
10+
It allows you to browse a component library, view the different states of each component, and interactively develop and test components.
1011

1112
## Intro
1213

13-
![React Storybook Screenshot](packages/react-storybook/docs/demo.gif)
14+
![Storybook Screenshot](app/react/docs/demo.gif)
1415

1516
Storybook runs outside of your app. This allows you to develop UI components in isolation, which can improve component reuse, testability, and development speed. You can build quickly without having to worry about application-specific dependencies.
1617

@@ -20,30 +21,32 @@ Storybook comes with a lot of [addons](https://storybooks.js.org/docs/react-stor
2021

2122
First install storybook:
2223
```js
23-
npm i -g getstorybook
24+
npm i -g @storybook/cli
2425
cd my-react-app
2526
getstorybook
2627
```
2728

2829
Once it's installed, you can `npm run storybook` and it will run the development server on your local machine, and give you a URL to browse some sample stories.
2930

30-
For full documentation on using Storybook visit: https://storybooks.js.org
31+
For full documentation on using Storybook visit: [storybooks.js.org](https://storybooks.js.org)
3132

3233
## Main Projects
33-
- [react-storybook](packages/react-storybook) - Storybook for React components
34-
- [react-native-storybook](packages/react-native-storybook) - Storybook for React components
35-
- [storyshots](packages/storyshots) - Easy snapshot testing for storybook
36-
- [getstorybook](packages/getstorybook) - Streamlined installation for a variety of app types
34+
- [Storybook for react](app/react) - Storybook for React components
35+
- [Storybook for react-native](app/react-native) - Storybook for React components
36+
37+
## Sub Projects
38+
- [Storyshots](lib/storyshots) - Easy snapshot testing for storybook
39+
- [CLI](lib/cli) - Streamlined installation for a variety of app types
3740
- [examples](examples) - Code examples to illustrate different Storybook use cases
3841

3942
## Addons
40-
- [addon-actions](packages/addon-actions/) - Log actions as users interact with components in storybook
41-
- [addon-comments](packages/addon-comments/) - Comment on storybook stories
42-
- [addon-graphql](packages/addon-graphql/) - Query a GraphQL server within Storybook stories
43-
- [addon-info](packages/addon-info/) - Annotate stories with extra component usage information
44-
- [addon-knobs](packages/addon-knobs/) - Interactively edit component prop data in the Storybook UI
45-
- [addon-notes](packages/addon-notes/) - Annotate storybook stories with notes
46-
- [addon-options](packages/addon-options/) - Customize the storybook UI in code
43+
- [addon-actions](addons/actions/) - Log actions as users interact with components in storybook
44+
- [addon-comments](addons/comments/) - Comment on storybook stories
45+
- [addon-graphql](addons/graphql/) - Query a GraphQL server within Storybook stories
46+
- [addon-info](addons/info/) - Annotate stories with extra component usage information
47+
- [addon-knobs](addons/knobs/) - Interactively edit component prop data in the Storybook UI
48+
- [addon-notes](addons/notes/) - Annotate storybook stories with notes
49+
- [addon-options](addons/options/) - Customize the storybook UI in code
4750

4851
## Contributing
4952

Diff for: addons/actions/.storybook/addons.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '../register';
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import * as storybook from '@kadira/storybook';
1+
import * as storybook from '@storybook/react';
22
storybook.configure(() => require('./stories'), module);

Diff for: packages/addon-actions/.storybook/stories.js renamed to addons/actions/.storybook/stories.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { storiesOf } from '@kadira/storybook';
2+
import { storiesOf } from '@storybook/react';
33
import { action, decorateAction } from '../src';
44

55
const pickFirst = decorateAction([
File renamed without changes.

Diff for: addons/actions/README.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Storybook Addon Actions
2+
[![Greenkeeper badge](https://badges.greenkeeper.io/storybooks/storybook.svg)](https://greenkeeper.io/)
3+
[![Build Status](https://travis-ci.org/storybooks/storybook.svg?branch=master)](https://travis-ci.org/storybooks/storybook)
4+
[![CodeFactor](https://www.codefactor.io/repository/github/storybooks/storybook/badge)](https://www.codefactor.io/repository/github/storybooks/storybook)
5+
[![Known Vulnerabilities](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847/badge.svg)](https://snyk.io/test/github/storybooks/storybook/8f36abfd6697e58cd76df3526b52e4b9dc894847)
6+
[![BCH compliance](https://bettercodehub.com/edge/badge/storybooks/storybook)](https://bettercodehub.com/results/storybooks/storybook) [![codecov](https://codecov.io/gh/storybooks/storybook/branch/master/graph/badge.svg)](https://codecov.io/gh/storybooks/storybook)
7+
[![Storybook Slack](https://storybooks-slackin.herokuapp.com/badge.svg)](https://storybooks-slackin.herokuapp.com/)
8+
9+
Storybook Addon Actions can be used to display data received by event handlers in [Storybook](https://storybooks.js.org).
10+
11+
This addon works with Storybook for:
12+
[React](https://github.com/storybooks/storybook/tree/master/app/react) and
13+
[React Native](https://github.com/storybooks/storybook/tree/master/app/react-native).
14+
15+
![Screenshot](docs/screenshot.png)
16+
17+
## Getting Started
18+
19+
You can use this addon without installing it manually.
20+
21+
Import the `action` function and use it to create actions handlers. When creating action handlers, provide a **name** to make it easier to identify.
22+
23+
> *Note: Make sure NOT to use reserved words as function names. [issues#29](https://github.com/storybooks/storybook-addon-actions/issues/29#issuecomment-288274794)*
24+
25+
```js
26+
import { storiesOf } from '@storybook/react'
27+
import { action } from '@storybook/addon-actions'
28+
29+
storiesOf('Button', module)
30+
.add('default view', () => (
31+
<Button onClick={ action('button-click') }>
32+
Hello World!
33+
</Button>
34+
))
35+
```
36+
37+
## Action Decorators
38+
39+
If you wish to process action data before sending them over to the logger, you can do it with action decorators.
40+
41+
`decorateAction` takes an array of decorator functions. Each decorator function is passed an array of arguments, and should return a new arguments array to use. `decorateAction` returns a function that can be used like `action` but will log the modified arguments instead of the original arguments.
42+
43+
```js
44+
import { action, decorateAction } from '@storybook/addon-actions'
45+
46+
const firstArgAction = decorateAction([
47+
args => args.slice(0, 1)
48+
]);
49+
50+
storiesOf('Button', module)
51+
.add('default view', () => (
52+
<Button onClick={ firstArgAction('button-click') }>
53+
Hello World!
54+
</Button>
55+
))
56+
```
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
1-
{
2-
"name": "@kadira/storybook-addon-actions",
3-
"version": "1.1.3",
4-
"description": "Action Logger addon for storybook",
5-
"main": "dist/index.js",
6-
"scripts": {
7-
"deploy-storybook": "storybook-to-ghpages",
8-
"prepublish": "node ../../scripts/prepublish.js",
9-
"storybook": "start-storybook -p 9001"
10-
},
11-
"repository": {
12-
"type": "git",
13-
"url": "git+https://github.com/kadirahq/storybook-addon-actions.git"
14-
},
15-
"keywords": [
16-
"storybook"
17-
],
18-
"license": "MIT",
19-
"bugs": {
20-
"url": "https://github.com/kadirahq/storybook-addon-actions/issues"
21-
},
22-
"homepage": "https://github.com/kadirahq/storybook-addon-actions#readme",
23-
"devDependencies": {
24-
"@kadira/storybook": "*",
25-
"@kadira/storybook-addons": "*",
26-
"@kadira/storybook-ui": "*",
27-
"react": "^15.5.4",
28-
"react-dom": "^15.5.4",
29-
"react-test-renderer": "^15.5.4",
30-
"shelljs": "^0.7.7"
31-
},
32-
"dependencies": {
33-
"deep-equal": "^1.0.1",
34-
"json-stringify-safe": "^5.0.1",
35-
"prop-types": "^15.5.8",
36-
"@storybook/react-inspector": "^1.2.1"
37-
},
38-
"peerDependencies": {
39-
"@kadira/storybook-addons": "*",
40-
"react": "*",
41-
"react-dom": "*"
42-
}
43-
}
1+
{
2+
"name": "@storybook/addon-actions",
3+
"version": "3.0.0-alpha.0",
4+
"description": "Action Logger addon for storybook",
5+
"main": "dist/index.js",
6+
"scripts": {
7+
"deploy-storybook": "storybook-to-ghpages",
8+
"prepublish": "node ../../scripts/prepublish.js",
9+
"storybook": "start-storybook -p 9001"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/storybooks/storybook.git"
14+
},
15+
"keywords": [
16+
"storybook"
17+
],
18+
"license": "MIT",
19+
"bugs": {
20+
"url": "https://github.com/storybooks/storybook/issues"
21+
},
22+
"homepage": "https://github.com/storybooks/storybook/tree/master/packages/addon-actions",
23+
"devDependencies": {
24+
"@storybook/addons": "^3.0.0-alpha.0",
25+
"@storybook/react": "^3.0.0-alpha.0",
26+
"@storybook/ui": "^3.0.0-alpha.0",
27+
"react": "^15.5.4",
28+
"react-dom": "^15.5.4",
29+
"react-test-renderer": "^15.5.4",
30+
"shelljs": "^0.7.7"
31+
},
32+
"dependencies": {
33+
"deep-equal": "^1.0.1",
34+
"json-stringify-safe": "^5.0.1",
35+
"prop-types": "^15.5.8",
36+
"react-inspector": "^2.0.0"
37+
},
38+
"peerDependencies": {
39+
"@storybook/addons": "^3.0.0-alpha.0",
40+
"react": "*",
41+
"react-dom": "*"
42+
}
43+
}
File renamed without changes.

Diff for: packages/addon-actions/src/components/ActionLogger/index.js renamed to addons/actions/src/components/ActionLogger/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import PropTypes from 'prop-types';
22
import React, { Component } from 'react';
3-
import Inspector from '@storybook/react-inspector';
3+
import Inspector from 'react-inspector';
44
import style from './style';
55

66
class ActionLogger extends Component {

Diff for: packages/addon-actions/src/index.js renamed to addons/actions/src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// addons, panels and events get unique names using a prefix
2-
export const ADDON_ID = 'kadirahq/storybook-addon-actions';
2+
export const ADDON_ID = 'storybook/addon-actions';
33
export const PANEL_ID = `${ADDON_ID}/actions-panel`;
44
export const EVENT_ID = `${ADDON_ID}/action-event`;
55

Diff for: packages/addon-actions/src/manager.js renamed to addons/actions/src/manager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import addons from '@kadira/storybook-addons';
2+
import addons from '@storybook/addons';
33
import ActionLogger from './containers/ActionLogger';
44
import { ADDON_ID, PANEL_ID } from './';
55

Diff for: packages/addon-actions/src/preview.js renamed to addons/actions/src/preview.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import addons from '@kadira/storybook-addons';
1+
import addons from '@storybook/addons';
22
import stringify from 'json-stringify-safe';
33
import { EVENT_ID } from './';
44

File renamed without changes.

0 commit comments

Comments
 (0)