Skip to content

Commit d4ac168

Browse files
committed
Merge branch 'next' into shilman/add-tag-exclusion
2 parents 8f7d569 + 1e0e822 commit d4ac168

File tree

273 files changed

+13322
-3514
lines changed

Some content is hidden

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

273 files changed

+13322
-3514
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ jobs:
124124
yarn docs:prettier:check
125125
build:
126126
executor:
127-
class: large
127+
class: xlarge
128128
name: sb_node_16_classic
129129
steps:
130130
- git-shallow-clone/checkout_advanced:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 8.0.10
2+
3+
- MDX: Don't transform `http://` links - [#26488](https://github.com/storybookjs/storybook/pull/26488), thanks @JReinhold!
4+
- React: Support v19 in `react-dom-shim` - [#26898](https://github.com/storybookjs/storybook/pull/26898), thanks @Tobbe!
5+
- Vite: Merge assetsInclude property with Storybook default values - [#26860](https://github.com/storybookjs/storybook/pull/26860), thanks @yuemori!
6+
17
## 8.0.9
28

39
- Addon-docs: Fix MDX compilation when using `@vitejs/plugin-react-swc` with plugins - [#26837](https://github.com/storybookjs/storybook/pull/26837), thanks @JReinhold!

CHANGELOG.prerelease.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
## 8.1.0-alpha.8
2+
3+
- Addon-actions: Fix falsy args printing as object - 22163 - [#26917](https://github.com/storybookjs/storybook/pull/26917), thanks @Fatcat560!
4+
- Addon-docs: Fix MDX compilation with `@vitejs/plugin-react-swc` and plugins - [#26837](https://github.com/storybookjs/storybook/pull/26837), thanks @JReinhold!
5+
- Automigration: Fix name of VTA addon - [#26816](https://github.com/storybookjs/storybook/pull/26816), thanks @valentinpalkovic!
6+
- Blocks: Add `of` prop to `Subtitle` - [#22552](https://github.com/storybookjs/storybook/pull/22552), thanks @joaonunomota!
7+
- Blocks: Add `of` prop to `Title` - [#23728](https://github.com/storybookjs/storybook/pull/23728), thanks @Sidnioulz!
8+
- CSF: Fix typings for control and other properties of argTypes - [#26824](https://github.com/storybookjs/storybook/pull/26824), thanks @kasperpeulen!
9+
- Controls: Added server channel to create a new story - [#26769](https://github.com/storybookjs/storybook/pull/26769), thanks @valentinpalkovic!
10+
- Controls: Fix crashing when docgen extraction partially fails - [#26862](https://github.com/storybookjs/storybook/pull/26862), thanks @yannbf!
11+
- Controls: Add UI to create new story files - [#26875](https://github.com/storybookjs/storybook/pull/26875), thanks @valentinpalkovic!
12+
- Core: Drop unneeded `UPDATE_STORY_ARGS` which was for SSv6 - [#25993](https://github.com/storybookjs/storybook/pull/25993), thanks @tmeasday!
13+
- Core: Ensure that simultaneous onStoriesChanged don't clobber each other - [#26882](https://github.com/storybookjs/storybook/pull/26882), thanks @tmeasday!
14+
- Core: Fix filters not being applied in WebKit - [#26949](https://github.com/storybookjs/storybook/pull/26949), thanks @JReinhold!
15+
- Core: Implement file formatter - [#26809](https://github.com/storybookjs/storybook/pull/26809), thanks @valentinpalkovic!
16+
- Core: Save from controls - [#26827](https://github.com/storybookjs/storybook/pull/26827), thanks @ndelangen!
17+
- Dependencies: Upgrade @storybook/csf to 0.1.5 - [#26958](https://github.com/storybookjs/storybook/pull/26958), thanks @Cherry!
18+
- Doc Tools: Signature Type Error Handling - [#26774](https://github.com/storybookjs/storybook/pull/26774), thanks @ethriel3695!
19+
- Docs: Fix providerImportSource extension - [#26868](https://github.com/storybookjs/storybook/pull/26868), thanks @bashmish!
20+
- MDX: Don't transform `http://` links - [#26488](https://github.com/storybookjs/storybook/pull/26488), thanks @JReinhold!
21+
- Next.js: Move sharp into optional deps - [#26787](https://github.com/storybookjs/storybook/pull/26787), thanks @shuta13!
22+
- Next.js: Support v14.2 useParams functionality - [#26874](https://github.com/storybookjs/storybook/pull/26874), thanks @yannbf!
23+
- Portable Stories: Warn when rendering stories without cleaning up first - [#27008](https://github.com/storybookjs/storybook/pull/27008), thanks @JReinhold!
24+
- React: Support v19 in `react-dom-shim` - [#26898](https://github.com/storybookjs/storybook/pull/26898), thanks @Tobbe!
25+
- Test: Remove chai as dependency of @storybook/test - [#26852](https://github.com/storybookjs/storybook/pull/26852), thanks @kasperpeulen!
26+
- Test: Support module mocking with conditional subpath imports in `package.json` - [#26688](https://github.com/storybookjs/storybook/pull/26688), thanks @kasperpeulen!
27+
- UI: Fix not re-rendering tabs on state change - [#26899](https://github.com/storybookjs/storybook/pull/26899), thanks @lifeiscontent!
28+
- UI: Fix sidebar search hanging when selecting a story in touch mode - [#26807](https://github.com/storybookjs/storybook/pull/26807), thanks @JReinhold!
29+
- Vite: Merge assetsInclude property with Storybook default values - [#26860](https://github.com/storybookjs/storybook/pull/26860), thanks @yuemori!
30+
131
## 8.1.0-alpha.7
232

333
- CLI: Add --config-dir flag to add command - [#26771](https://github.com/storybookjs/storybook/pull/26771), thanks @eric-blue!

MIGRATION.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<h1>Migration</h1>
22

3-
- [From version 8.0 to 8.1.0](#from-version-80-to-810)
3+
- [From version 8.0.x to 8.1.x](#from-version-80x-to-81x)
4+
- [Portable stories](#portable-stories)
5+
- [@storybook/nextjs requires specific path aliases to be setup](#storybooknextjs-requires-specific-path-aliases-to-be-setup)
46
- [main.js `docs.autodocs` is deprecated](#mainjs-docsautodocs-is-deprecated)
57
- [`docs` and `story` system tags removed](#docs-and-story-system-tags-removed)
68
- [Subtitle block and `parameters.componentSubtitle`](#subtitle-block-and-parameterscomponentsubtitle)
79
- [Title block `of` prop](#title-block-of-prop)
810
- [From version 7.x to 8.0.0](#from-version-7x-to-800)
9-
- [Portable stories](#portable-stories)
11+
- [Portable stories](#portable-stories-1)
1012
- [Project annotations are now merged instead of overwritten in composeStory](#project-annotations-are-now-merged-instead-of-overwritten-in-composestory)
1113
- [Type change in `composeStories` API](#type-change-in-composestories-api)
1214
- [Composed Vue stories are now components instead of functions](#composed-vue-stories-are-now-components-instead-of-functions)
@@ -408,7 +410,27 @@
408410
- [Packages renaming](#packages-renaming)
409411
- [Deprecated embedded addons](#deprecated-embedded-addons)
410412

411-
## From version 8.0 to 8.1.0
413+
## From version 8.0.x to 8.1.x
414+
415+
### Portable stories
416+
417+
#### @storybook/nextjs requires specific path aliases to be setup
418+
419+
In order to properly mock the `next/router`, `next/header`, `next/navigation` and `next/cache` APIs, the `@storybook/nextjs` framework includes internal Webpack aliases to those modules. If you use portable stories in your Jest tests, you should set the aliases in your Jest config files `moduleNameMapper` property using the `getPackageAliases` helper from `@storybook/nextjs/export-mocks`:
420+
421+
```js
422+
const nextJest = require("next/jest.js");
423+
const { getPackageAliases } = require("@storybook/nextjs/export-mocks");
424+
const createJestConfig = nextJest();
425+
const customJestConfig = {
426+
moduleNameMapper: {
427+
...getPackageAliases(), // Add aliases for @storybook/nextjs mocks
428+
},
429+
};
430+
module.exports = createJestConfig(customJestConfig);
431+
```
432+
433+
This will make sure you end using the correct implementation of the packages and avoid having issues in your tests.
412434

413435
### main.js `docs.autodocs` is deprecated
414436

@@ -5106,7 +5128,7 @@ SB 5.1.0 added [support for project root `babel.config.js` files](https://github
51065128
51075129
### React native server
51085130
5109-
Storybook 5.1 contains a major overhaul of `@storybook/react-native` as compared to 4.1 (we didn't ship a version of RN in 5.0 due to timing constraints). Storybook for RN consists of an an UI for browsing stories on-device or in a simulator, and an optional webserver which can also be used to browse stories and web addons.
5131+
Storybook 5.1 contains a major overhaul of `@storybook/react-native` as compared to 4.1 (we didn't ship a version of RN in 5.0 due to timing constraints). Storybook for RN consists of an UI for browsing stories on-device or in a simulator, and an optional webserver which can also be used to browse stories and web addons.
51105132
51115133
5.1 refactors both pieces:
51125134

code/addons/a11y/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@storybook/addon-a11y",
3-
"version": "8.1.0-alpha.7",
3+
"version": "8.1.0-alpha.8",
44
"description": "Test component compliance with web accessibility standards",
55
"keywords": [
66
"a11y",

code/addons/actions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@storybook/addon-actions",
3-
"version": "8.1.0-alpha.7",
3+
"version": "8.1.0-alpha.8",
44
"description": "Get UI feedback when an action is performed on an interactive element",
55
"keywords": [
66
"storybook",
Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1-
import type { FC, PropsWithChildren } from 'react';
2-
import React, { Fragment } from 'react';
3-
import { styled, withTheme } from '@storybook/theming';
1+
import type { ElementRef, ReactNode } from 'react';
2+
import React, { forwardRef, Fragment, useEffect, useRef } from 'react';
43
import type { Theme } from '@storybook/theming';
4+
import { styled, withTheme } from '@storybook/theming';
55

66
import { Inspector } from 'react-inspector';
77
import { ActionBar, ScrollArea } from '@storybook/components';
88

9-
import { Action, InspectorContainer, Counter } from './style';
9+
import { Action, Counter, InspectorContainer } from './style';
1010
import type { ActionDisplay } from '../../models';
1111

12-
const UnstyledWrapped: FC<PropsWithChildren<{ className?: string }>> = ({
13-
children,
14-
className,
15-
}) => (
16-
<ScrollArea horizontal vertical className={className}>
17-
{children}
18-
</ScrollArea>
12+
const UnstyledWrapped = forwardRef<HTMLDivElement, { children: ReactNode; className?: string }>(
13+
({ children, className }, ref) => (
14+
<ScrollArea ref={ref} horizontal vertical className={className}>
15+
{children}
16+
</ScrollArea>
17+
)
1918
);
19+
UnstyledWrapped.displayName = 'UnstyledWrapped';
20+
2021
export const Wrapper = styled(UnstyledWrapped)({
2122
margin: 0,
2223
padding: '10px 5px 20px',
@@ -39,24 +40,34 @@ interface ActionLoggerProps {
3940
onClear: () => void;
4041
}
4142

42-
export const ActionLogger = ({ actions, onClear }: ActionLoggerProps) => (
43-
<Fragment>
44-
<Wrapper>
45-
{actions.map((action: ActionDisplay) => (
46-
<Action key={action.id}>
47-
{action.count > 1 && <Counter>{action.count}</Counter>}
48-
<InspectorContainer>
49-
<ThemedInspector
50-
sortObjectKeys
51-
showNonenumerable={false}
52-
name={action.data.name}
53-
data={action.data.args || action.data}
54-
/>
55-
</InspectorContainer>
56-
</Action>
57-
))}
58-
</Wrapper>
59-
60-
<ActionBar actionItems={[{ title: 'Clear', onClick: onClear }]} />
61-
</Fragment>
62-
);
43+
export const ActionLogger = ({ actions, onClear }: ActionLoggerProps) => {
44+
const wrapperRef = useRef<ElementRef<typeof Wrapper>>(null);
45+
const wrapper = wrapperRef.current;
46+
const wasAtBottom = wrapper && wrapper.scrollHeight - wrapper.scrollTop === wrapper.clientHeight;
47+
48+
useEffect(() => {
49+
// Scroll to bottom, when the action panel was already scrolled down
50+
if (wasAtBottom) wrapperRef.current.scrollTop = wrapperRef.current.scrollHeight;
51+
}, [wasAtBottom, actions.length]);
52+
53+
return (
54+
<Fragment>
55+
<Wrapper ref={wrapperRef}>
56+
{actions.map((action: ActionDisplay) => (
57+
<Action key={action.id}>
58+
{action.count > 1 && <Counter>{action.count}</Counter>}
59+
<InspectorContainer>
60+
<ThemedInspector
61+
sortObjectKeys
62+
showNonenumerable={false}
63+
name={action.data.name}
64+
data={action.data.args ?? action.data}
65+
/>
66+
</InspectorContainer>
67+
</Action>
68+
))}
69+
</Wrapper>
70+
<ActionBar actionItems={[{ title: 'Clear', onClick: onClear }]} />
71+
</Fragment>
72+
);
73+
};

code/addons/actions/src/containers/ActionLogger/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ export default class ActionLogger extends Component<ActionLoggerProps, ActionLog
6363
addAction = (action: ActionDisplay) => {
6464
this.setState((prevState: ActionLoggerState) => {
6565
const actions = [...prevState.actions];
66-
const previous = actions.length && actions[0];
66+
const previous = actions.length && actions[actions.length - 1];
6767
if (previous && safeDeepEqual(previous.data, action.data)) {
6868
previous.count++;
6969
} else {
7070
action.count = 1;
71-
actions.unshift(action);
71+
actions.push(action);
7272
}
7373
return { actions: actions.slice(0, action.options.limit) };
7474
});

code/addons/actions/src/loaders.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,26 @@ const logActionsWhenMockCalled: LoaderFunction = (context) => {
1818
typeof global.__STORYBOOK_TEST_ON_MOCK_CALL__ === 'function'
1919
) {
2020
const onMockCall = global.__STORYBOOK_TEST_ON_MOCK_CALL__ as typeof onMockCallType;
21-
onMockCall((mock, args) => action(mock.getMockName())(args));
21+
onMockCall((mock, args) => {
22+
const name = mock.getMockName();
23+
24+
// TODO: Make this a configurable API in 8.2
25+
if (
26+
!/^next\/.*::/.test(name) ||
27+
[
28+
'next/router::useRouter()',
29+
'next/navigation::useRouter()',
30+
'next/navigation::redirect',
31+
'next/cache::',
32+
'next/headers::cookies().set',
33+
'next/headers::cookies().delete',
34+
'next/headers::headers().set',
35+
'next/headers::headers().delete',
36+
].some((prefix) => name.startsWith(prefix))
37+
) {
38+
action(name)(args);
39+
}
40+
});
2241
subscribed = true;
2342
}
2443
};
Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
import { global as globalThis } from '@storybook/global';
22
import { spyOn } from '@storybook/test';
33

4-
export default {
4+
const meta = {
55
component: globalThis.Components.Button,
6-
loaders() {
6+
beforeEach() {
77
spyOn(console, 'log').mockName('console.log');
8-
},
9-
args: {
10-
label: 'Button',
11-
},
12-
parameters: {
13-
chromatic: { disable: true },
8+
console.log('first');
149
},
1510
};
1611

12+
export default meta;
13+
1714
export const ShowSpyOnInActions = {
15+
parameters: {
16+
chromatic: { disable: true },
17+
},
18+
beforeEach() {
19+
console.log('second');
20+
},
1821
args: {
22+
label: 'Button',
1923
onClick: () => {
20-
console.log('first');
21-
console.log('second');
24+
console.log('third');
2225
},
2326
},
2427
};

code/addons/backgrounds/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@storybook/addon-backgrounds",
3-
"version": "8.1.0-alpha.7",
3+
"version": "8.1.0-alpha.8",
44
"description": "Switch backgrounds to view components in different settings",
55
"keywords": [
66
"addon",

code/addons/controls/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@storybook/addon-controls",
3-
"version": "8.1.0-alpha.7",
3+
"version": "8.1.0-alpha.8",
44
"description": "Interact with component inputs dynamically in the Storybook UI",
55
"keywords": [
66
"addon",
@@ -52,13 +52,15 @@
5252
},
5353
"dependencies": {
5454
"@storybook/blocks": "workspace:*",
55+
"dequal": "^2.0.2",
5556
"lodash": "^4.17.21",
5657
"ts-dedent": "^2.0.0"
5758
},
5859
"devDependencies": {
5960
"@storybook/client-logger": "workspace:*",
6061
"@storybook/components": "workspace:*",
6162
"@storybook/core-common": "workspace:*",
63+
"@storybook/icons": "^1.2.5",
6264
"@storybook/manager-api": "workspace:*",
6365
"@storybook/node-logger": "workspace:*",
6466
"@storybook/preview-api": "workspace:*",

0 commit comments

Comments
 (0)