Skip to content

Commit 703e5fa

Browse files
committed
Merge branch 'main' of github.com:storybookjs/addon-knobs into next
2 parents f0dc860 + 11d65f9 commit 703e5fa

21 files changed

Lines changed: 5684 additions & 7503 deletions

.github/workflows/release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@ jobs:
1010
- uses: actions/checkout@v2
1111

1212
- name: Prepare repository
13-
run: git fetch --unshallow --tags
13+
run: |
14+
git fetch --unshallow --tags
15+
git config user.name "GitHub Actions Bot"
16+
git config user.email "bot@github.com"
1417
15-
- name: Use Node.js 14.x
18+
- name: Use Node.js 16.x
1619
uses: actions/setup-node@v1
1720
with:
18-
node-version: 14.x
21+
node-version: 16.x
1922

2023
- name: Install dependencies
2124
uses: bahmutov/npm-install@v1

.github/workflows/tests-unit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
- uses: actions/checkout@v2
1111
- uses: actions/setup-node@v2
1212
with:
13-
node-version: "14.x"
13+
node-version: "16.x"
1414
cache: yarn
1515
- name: install
1616
run: |
1717
yarn install --immutable
1818
- name: test
1919
run: |
20-
yarn test --runInBand --ci
20+
yarn test --runInBand --ci

.storybook/main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module.exports = {
2-
stories: [
3-
"../stories/**/*.stories.mdx",
4-
"../stories/**/*.stories.@(js|jsx|ts|tsx)",
5-
],
2+
stories: ["../stories/**/*.stories.mdx", "../stories/**/*.stories.@(js|jsx|ts|tsx)"],
63
addons: ["../preset"],
4+
framework: {
5+
name: "@storybook/react-webpack5",
6+
options: {}
7+
}
78
};

CHANGELOG.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# v7.0.1 (Thu Apr 27 2023)
2+
3+
#### 🐛 Bug Fix
4+
5+
- build: make storybook peer dependency less strict [#51](https://github.com/storybookjs/addon-knobs/pull/51) ([@literalpie](https://github.com/literalpie))
6+
7+
#### Authors: 1
8+
9+
- Benjamin Kindle ([@literalpie](https://github.com/literalpie))
10+
11+
---
12+
13+
# v7.0.0 (Sat Apr 01 2023)
14+
15+
#### 💥 Breaking Change
16+
17+
- Support Storybook 7.0.0 [#48](https://github.com/storybookjs/addon-knobs/pull/48) ([@literalpie](https://github.com/literalpie))
18+
19+
#### ⚠️ Pushed to `main`
20+
21+
- Add Git user info to release workflow ([@JReinhold](https://github.com/JReinhold))
22+
23+
#### 🏠 Internal
24+
25+
- Remove unnecessary `check-metadata.js` [#50](https://github.com/storybookjs/addon-knobs/pull/50) ([@JReinhold](https://github.com/JReinhold))
26+
- Upgrade Node in CI [#49](https://github.com/storybookjs/addon-knobs/pull/49) ([@jonniebigodes](https://github.com/jonniebigodes) [@JReinhold](https://github.com/JReinhold))
27+
28+
#### 📝 Documentation
29+
30+
- Chore: (Docs) Updates link for support table [#44](https://github.com/storybookjs/addon-knobs/pull/44) ([@jonniebigodes](https://github.com/jonniebigodes))
31+
32+
#### Authors: 3
33+
34+
- [@jonniebigodes](https://github.com/jonniebigodes)
35+
- Benjamin Kindle ([@literalpie](https://github.com/literalpie))
36+
- Jeppe Reinhold ([@JReinhold](https://github.com/JReinhold))
37+
38+
---
39+
40+
# v6.4.0 (Sat Nov 27 2021)
41+
42+
#### 🚀 Enhancement
43+
44+
- 6.4.0 [#41](https://github.com/storybookjs/addon-knobs/pull/41) ([@shilman](https://github.com/shilman))
45+
46+
#### 🐛 Bug Fix
47+
48+
- fix gh secret [#40](https://github.com/storybookjs/addon-knobs/pull/40) ([@shilman](https://github.com/shilman))
49+
50+
#### ⚠️ Pushed to `main`
51+
52+
- Merge branch 'next' ([@shilman](https://github.com/shilman))
53+
54+
#### Authors: 1
55+
56+
- Michael Shilman ([@shilman](https://github.com/shilman))
57+
58+
---
59+
60+
# v6.3.1 (Sat Sep 04 2021)
61+
62+
#### 🐛 Bug Fix
63+
64+
65+
#### ⚠️ Pushed to `main`
66+
67+
- Merge branch 'next' into main ([@shilman](https://github.com/shilman))
68+
69+
#### 🔩 Dependency Updates
70+
71+
- build: make copy-to-clipboard an explicit dependency [#36](https://github.com/storybookjs/addon-knobs/pull/36) ([@hydrosquall](https://github.com/hydrosquall))
72+
73+
#### Authors: 3
74+
75+
- Cameron Yick ([@hydrosquall](https://github.com/hydrosquall))
76+
- Jordan ([@Silic0nS0ldier](https://github.com/Silic0nS0ldier))
77+
- Michael Shilman ([@shilman](https://github.com/shilman))
78+
79+
---
80+
81+
# v6.3.0 (Wed Jun 23 2021)
82+
83+
#### 🚀 Enhancement
84+
85+
- Update package version [#31](https://github.com/storybookjs/addon-knobs/pull/31) ([@shilman](https://github.com/shilman))
86+
87+
#### 🐛 Bug Fix
88+
89+
- Upgrade to Storybook 6.3 [#34](https://github.com/storybookjs/addon-knobs/pull/34) ([@shilman](https://github.com/shilman))
90+
91+
#### ⚠️ Pushed to `main`
92+
93+
- Add deprecation warning ([@shilman](https://github.com/shilman))
94+
- Fix index ([@shilman](https://github.com/shilman))
95+
- Update version ([@shilman](https://github.com/shilman))
96+
- Update package metadata ([@shilman](https://github.com/shilman))
97+
- Fix typescript errors ([@shilman](https://github.com/shilman))
98+
- Extract addon-knobs from monorepo ([@shilman](https://github.com/shilman))
99+
- Initial commit ([@shilman](https://github.com/shilman))
100+
101+
#### Authors: 1
102+
103+
- Michael Shilman ([@shilman](https://github.com/shilman))

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ First of all, you need to install Knobs into your project as a dev dependency.
2323
yarn add @storybook/addon-knobs --dev
2424
```
2525

26+
The latest version of this addon supports Storybook v7. If you're using a previous version of Storybook you need to install the matching version of this addon, eg `@storybook/addon-knobs@6.4.0`.
27+
2628
within `.storybook/main.js`:
2729

2830
```js

check-metadata.js

Lines changed: 0 additions & 23 deletions
This file was deleted.

jest.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ module.exports = {
1515
coverageDirectory: 'coverage',
1616
setupFilesAfterEnv: ['./scripts/jest.init.js'],
1717
coverageReporters: ['lcov'],
18+
testEnvironmentOptions: {
19+
url: 'http://localhost',
20+
},
1821
testEnvironment: 'jest-environment-jsdom',
1922
setupFiles: [],
20-
testURL: 'http://localhost',
2123
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json', 'node'],
2224
};

package.json

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@storybook/addon-knobs",
3-
"version": "6.3.0-next.0",
3+
"version": "7.0.1",
44
"description": "Storybook addon for editing props",
55
"keywords": [
66
"storybook-addons",
@@ -23,59 +23,62 @@
2323
"buildTsc": "tsc --declaration --emitDeclarationOnly --outDir ./dist",
2424
"build": "concurrently \"npm run buildBabel\" \"npm run buildTsc\"",
2525
"test": "jest",
26-
"storybook": "start-storybook -p 6006",
26+
"storybook": "storybook dev -p 6006",
2727
"start": "concurrently \"npm run storybook -- --no-manager-cache --quiet\" \"npm run build -- --watch\"",
28-
"build-storybook": "build-storybook",
29-
"prerelease": "node check-metadata.js",
28+
"build-storybook": "storybook build",
3029
"release": "npm run build && auto shipit"
3130
},
3231
"dependencies": {
33-
"copy-to-clipboard": "^3.3.1",
34-
"core-js": "^3.8.2",
32+
"copy-to-clipboard": "^3.3.3",
33+
"core-js": "^3.29.0",
3534
"escape-html": "^1.0.3",
3635
"fast-deep-equal": "^3.1.3",
3736
"global": "^4.4.0",
38-
"lodash": "^4.17.20",
39-
"prop-types": "^15.7.2",
40-
"qs": "^6.10.0",
41-
"react-colorful": "^5.1.2",
37+
"lodash": "^4.17.21",
38+
"prop-types": "^15.8.1",
39+
"qs": "^6.11.1",
40+
"react-colorful": "^5.6.1",
4241
"react-lifecycles-compat": "^3.0.4",
43-
"react-select": "^3.2.0"
42+
"react-select": "^5.7.0"
4443
},
4544
"devDependencies": {
46-
"@babel/cli": "^7.12.1",
47-
"@babel/core": "^7.12.3",
48-
"@babel/preset-env": "^7.12.1",
49-
"@babel/preset-react": "^7.12.5",
50-
"@babel/preset-typescript": "^7.13.0",
51-
"@emotion/jest": "^11.3.0",
52-
"@storybook/react": "^6.4.0",
53-
"@testing-library/jest-dom": "^5.14.1",
54-
"@testing-library/react": "^12.0.0",
55-
"@testing-library/user-event": "^13.2.1",
56-
"@types/escape-html": "^1.0.1",
57-
"@types/lodash": "^4.14.168",
45+
"@babel/cli": "^7.21.0",
46+
"@babel/core": "^7.21.0",
47+
"@babel/preset-env": "^7.20.2",
48+
"@babel/preset-react": "^7.18.6",
49+
"@babel/preset-typescript": "^7.21.0",
50+
"@emotion/jest": "^11.10.5",
51+
"@storybook/react": "^7.0.0",
52+
"@storybook/react-webpack5": "^7.0.0",
53+
"@testing-library/dom": "^9.2.0",
54+
"@testing-library/jest-dom": "^5.16.5",
55+
"@testing-library/react": "^14.0.0",
56+
"@testing-library/user-event": "^14.4.3",
57+
"@types/escape-html": "^1.0.2",
58+
"@types/lodash": "^4.14.191",
59+
"@types/node": "^18.15.11",
5860
"@types/react-lifecycles-compat": "^3.0.1",
5961
"@types/react-select": "^3.1.2",
60-
"@types/webpack-env": "^1.16.0",
61-
"auto": "^10.3.0",
62-
"babel-loader": "^8.1.0",
63-
"chalk": "^2.4.2",
64-
"concurrently": "^5.3.0",
65-
"jest": "^27.0.6",
66-
"react": "^17.0.1",
67-
"react-dom": "^17.0.1",
68-
"rimraf": "^3.0.2",
69-
"typescript": "^3.9.7"
62+
"@types/webpack-env": "^1.18.0",
63+
"auto": "^10.43.0",
64+
"chalk": "^5.2.0",
65+
"concurrently": "^7.6.0",
66+
"jest": "^29.5.0",
67+
"jest-environment-jsdom": "^29.5.0",
68+
"react": "^18.2.0",
69+
"react-dom": "^18.2.0",
70+
"rimraf": "^4.4.0",
71+
"storybook": "^7.0.0",
72+
"typescript": "^4.9.5"
7073
},
7174
"peerDependencies": {
72-
"@storybook/addons": "^6.4.0",
73-
"@storybook/api": "^6.4.0",
74-
"@storybook/components": "^6.4.0",
75-
"@storybook/core-events": "^6.4.0",
76-
"@storybook/theming": "^6.4.0",
77-
"react": "^16.8.0 || ^17.0.0",
78-
"react-dom": "^16.8.0 || ^17.0.0"
75+
"@storybook/addons": "^7.0.0",
76+
"@storybook/api": "^7.0.0",
77+
"@storybook/components": "^7.0.0",
78+
"@storybook/core-events": "^7.0.0",
79+
"@storybook/theming": "^7.0.0",
80+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
81+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
7982
},
8083
"peerDependenciesMeta": {
8184
"react": {

scripts/jest.init.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import '@testing-library/jest-dom';
66
*/
77
const consoleError = global.console.error;
88
global.console.error = (...args) => {
9+
const reactDomError = (args[0].toString()).includes('ReactDOM.render');
10+
if (reactDomError) {
11+
return;
12+
}
913
consoleError(...args);
1014
throw new Error(JSON.stringify(args));
1115
}

src/KnobManager.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* eslint no-underscore-dangle: 0 */
22

3-
import { navigator } from 'global';
3+
// navigator exists in Jest but not the browser. global exists in the browser but not Jest
4+
import { navigator as gNavigator, global } from 'global';
45
import escape from 'escape-html';
5-
import { getQueryParams } from '@storybook/client-api';
6+
import { getQueryParams } from '@storybook/preview-api';
67
import { Channel } from '@storybook/channels';
78

89
import KnobStore, { KnobStoreKnob } from './KnobStore';
@@ -11,6 +12,8 @@ import { SET } from './shared';
1112

1213
import { deserializers } from './converters';
1314

15+
const navigator: Navigator = gNavigator || global.navigator;
16+
1417
const knobValuesFromUrl: Record<string, string> = Object.entries(getQueryParams()).reduce(
1518
(acc, [k, v]) => {
1619
if (k.includes('knob-')) {

0 commit comments

Comments
 (0)