Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controls: Add UI to create new story files #26875

Merged
merged 93 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
84b1609
Fix typo
joaonunomota May 14, 2023
764c819
Add of prop and deprecate componentSubtitle
joaonunomota May 15, 2023
75564f3
Shorten declaring componentSubtitle and docs
joaonunomota May 15, 2023
bd34ef7
Fix autodocs link
joaonunomota May 15, 2023
bba00d9
Add missing parameter change documentation
joaonunomota May 15, 2023
b8e2820
Fix DEPRECATION_MIGRATION_LINK in Subtitle
joaonunomota May 15, 2023
dad7e2d
Merge branch 'next' into subtitle-of-prop
joaonunomota May 15, 2023
3a209e2
Fix grammar
joaonunomota May 15, 2023
975c32d
feat: Update title to support 'of' prop
Sidnioulz Aug 5, 2023
0baa41a
Merge branch 'storybookjs:next' into subtitle-of-prop
joaonunomota Aug 7, 2023
266266d
Update subtitle block props into alphabetical order
joaonunomota Aug 7, 2023
2e886c0
Merge branch 'next' into feat/22490-Title
ndelangen Sep 4, 2023
2acbd53
Merge branch 'next' into feat/22490-Title
ndelangen Sep 6, 2023
ad2d183
fix addon-links stories
JReinhold Oct 6, 2023
8ff51e0
Merge branch 'next' into fix-links-stories
JReinhold Oct 6, 2023
8c7e037
Merge branch 'next' into fix-links-stories
JReinhold Oct 26, 2023
3830eef
Merge branch 'next' into subtitle-of-prop
joaonunomota Oct 27, 2023
636fd4f
Merge branch 'next' into fix-links-stories
yannbf Oct 27, 2023
4b05aa8
Update MIGRATION.md
joaonunomota Oct 27, 2023
c40902b
Merge branch 'next' into subtitle-of-prop
joaonunomota Oct 27, 2023
2a723e0
use play instead of render for hrefTo stories
JReinhold Oct 27, 2023
3680c89
Merge branch 'next' into fix-links-stories
JReinhold Oct 30, 2023
bc623d1
Merge branch 'next' into pr/joaonunomota/22552
ndelangen Nov 28, 2023
ca18dec
Merge branch 'next' into fix-links-stories
ndelangen Nov 29, 2023
e6cba31
Add 'Create a new story' button to sidebar
valentinpalkovic Apr 10, 2024
0675bb4
Add stories to 'Create a new story' button
valentinpalkovic Apr 10, 2024
92ba347
Only show create new story button for react renderers
valentinpalkovic Apr 10, 2024
2e6862a
Disable TurboSnap
valentinpalkovic Apr 10, 2024
b86eeb0
Apply mediumdark color only to IconButton
valentinpalkovic Apr 11, 2024
f1c6ae9
Adjust top position of code in search field
valentinpalkovic Apr 15, 2024
0757f18
fix CI
valentinpalkovic Apr 15, 2024
e89b365
Merge remote-tracking branch 'origin/save-from-controls' into valenti…
valentinpalkovic Apr 17, 2024
944ff5f
Introduce useDebounce hook
valentinpalkovic Apr 18, 2024
333329a
Export request and response interfaces for some channels
valentinpalkovic Apr 18, 2024
0c19a46
Change generic parser to use @babel/parser
valentinpalkovic Apr 18, 2024
6b81b0c
Use renderer package for typescript template
valentinpalkovic Apr 18, 2024
a449d8c
Return storyFilePath and exported name when creating a story in the r…
valentinpalkovic Apr 18, 2024
0f37b98
Enhance file search to exclude stories and to filter out unsupported …
valentinpalkovic Apr 18, 2024
b2ba678
Update error message
valentinpalkovic Apr 18, 2024
343081b
Implement argtypes channel in Preview
valentinpalkovic Apr 18, 2024
30eb66a
Implement FileSearchModal
valentinpalkovic Apr 18, 2024
fa49c94
Add unit tests to FileSearchModal.utils
valentinpalkovic Apr 18, 2024
19b6094
Rename helper function
valentinpalkovic Apr 18, 2024
aac320d
Remove unnecessary imports
valentinpalkovic Apr 18, 2024
f9d81b5
Animate modal opening
valentinpalkovic Apr 18, 2024
05ac43c
Try to absolute position modal
valentinpalkovic Apr 18, 2024
f1808c8
Modal polishing
valentinpalkovic Apr 18, 2024
1d423a7
Merge remote-tracking branch 'origin/save-from-controls' into valenti…
valentinpalkovic Apr 18, 2024
cfec679
Add stories and polishing
valentinpalkovic Apr 18, 2024
2cf3ea2
Polishing
valentinpalkovic Apr 19, 2024
e0af40b
Polish skeleton
valentinpalkovic Apr 19, 2024
c3f0177
Polish no results
valentinpalkovic Apr 19, 2024
fa134a9
Add FileSearchModal
valentinpalkovic Apr 19, 2024
0596ca2
Separate CreateNewStoryFileModal from FileSearchModal
valentinpalkovic Apr 19, 2024
1c194d8
Cleanup
valentinpalkovic Apr 19, 2024
9077f9e
Move icons to FileSearchList
valentinpalkovic Apr 19, 2024
f29966e
Fix test
valentinpalkovic Apr 19, 2024
1378113
Retrigger search after succefull story creation
valentinpalkovic Apr 19, 2024
e7817b0
Merge remote-tracking branch 'origin/save-from-controls' into valenti…
valentinpalkovic Apr 19, 2024
a007256
WIP
valentinpalkovic Apr 19, 2024
3cf9846
Finalize Create New Story File feature
valentinpalkovic Apr 20, 2024
6a961aa
Fix tests
valentinpalkovic Apr 20, 2024
bda5336
Fix TypeScript errors
valentinpalkovic Apr 20, 2024
fcc3ca5
chore: fix rendering of stateful tabs component
lifeiscontent Apr 20, 2024
f9ba2f1
test 'nextjs/default-ts' instead of 'nextjs/default-js' in e2e tests
JReinhold Apr 22, 2024
3c33b3c
Merge pull request #26907 from storybookjs/jeppe/fix-nextjs-js-e2e
JReinhold Apr 22, 2024
5c20d18
Merge branch 'next' of github.com:storybookjs/storybook into subtitle…
JReinhold Apr 22, 2024
6dadc7c
fix migration
JReinhold Apr 22, 2024
3889e83
rename Subtitle stories
JReinhold Apr 22, 2024
1c204ea
Merge branch 'next' into subtitle-of-prop
JReinhold Apr 22, 2024
ce73138
Merge branch 'next' into feat/22490-Title
JReinhold Apr 22, 2024
ee0dd00
simplify Title extraction
JReinhold Apr 22, 2024
2bff7a1
Merge pull request #22552 from joaonunomota/subtitle-of-prop
JReinhold Apr 22, 2024
5542e3a
Merge branch 'next' of github.com:storybookjs/storybook into feat/224…
JReinhold Apr 22, 2024
688cf18
Move migration note
JReinhold Apr 22, 2024
7b2ddea
Update CHANGELOG.md for v8.0.9 [skip ci]
storybook-bot Apr 22, 2024
d310cb9
Fix tests
valentinpalkovic Apr 22, 2024
01dcbd8
Merge branch 'next' into chore/fix-rendering-of-stateful-tabs-component
lifeiscontent Apr 22, 2024
466a774
Upgrade babel dependencies
valentinpalkovic Apr 23, 2024
9fc3a0f
Update kitchen-sink lock files
valentinpalkovic Apr 23, 2024
51ede75
Merge branch 'next' into feat/22490-Title
JReinhold Apr 23, 2024
37b8aef
Merge pull request #23728 from Sidnioulz/feat/22490-Title
JReinhold Apr 23, 2024
b6c900a
add previewHead to sandboxes with explicit monospace font stack
JReinhold Apr 24, 2024
0a1e098
align monospace font stack with Next.js defaults
JReinhold Apr 24, 2024
9148b6a
Merge pull request #26939 from storybookjs/jeppe/sandbox-fix-monospac…
JReinhold Apr 24, 2024
c3eb412
Merge branch 'next' into fix-links-stories
JReinhold Apr 24, 2024
caf3f2a
fix link stories not working in all renderers
JReinhold Apr 24, 2024
18e298a
Merge pull request #24400 from storybookjs/fix-links-stories
JReinhold Apr 24, 2024
2aadfc1
Merge branch 'next' into chore/fix-rendering-of-stateful-tabs-component
JReinhold Apr 24, 2024
4c1d585
Merge pull request #26899 from storybookjs/chore/fix-rendering-of-sta…
JReinhold Apr 24, 2024
3625c2e
Merge remote-tracking branch 'origin/next' into valentin/add-file-picker
valentinpalkovic Apr 25, 2024
7c89f0f
Update snapshot
valentinpalkovic Apr 25, 2024
397ab28
Fix play function
valentinpalkovic Apr 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 8.0.9

- Addon-docs: Fix MDX compilation when using `@vitejs/plugin-react-swc` with plugins - [#26837](https://github.com/storybookjs/storybook/pull/26837), thanks @JReinhold!
- CSF: Fix typings for control and other properties of argTypes - [#26824](https://github.com/storybookjs/storybook/pull/26824), thanks @kasperpeulen!
- Controls: Fix crashing when docgen extraction partially fails - [#26862](https://github.com/storybookjs/storybook/pull/26862), thanks @yannbf!
- Doc Tools: Signature Type Error Handling - [#26774](https://github.com/storybookjs/storybook/pull/26774), thanks @ethriel3695!
- Next.js: Move sharp into optional deps - [#26787](https://github.com/storybookjs/storybook/pull/26787), thanks @shuta13!
- Nextjs: Support next 14.2 useParams functionality - [#26874](https://github.com/storybookjs/storybook/pull/26874), thanks @yannbf!
- Test: Remove chai as dependency of @storybook/test - [#26852](https://github.com/storybookjs/storybook/pull/26852), thanks @kasperpeulen!
- UI: Fix sidebar search hanging when selecting a story in touch mode - [#26807](https://github.com/storybookjs/storybook/pull/26807), thanks @JReinhold!

## 8.0.8

- Automigration: Fix name of VTA addon - [#26816](https://github.com/storybookjs/storybook/pull/26816), thanks @valentinpalkovic!
Expand Down
41 changes: 29 additions & 12 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<h1>Migration</h1>

- [From version 8.0 to 8.1.0](#from-version-80-to-810)
- [Subtitle block and `parameters.componentSubtitle`](#subtitle-block-and-parameterscomponentsubtitle)
- [Title block](#title-block)
- [From version 7.x to 8.0.0](#from-version-7x-to-800)
- [Portable stories](#portable-stories)
- [Project annotations are now merged instead of overwritten in composeStory](#project-annotations-are-now-merged-instead-of-overwritten-in-composestory)
Expand Down Expand Up @@ -90,17 +93,17 @@
- [Tab addons cannot manually route, Tool addons can filter their visibility via tabId](#tab-addons-cannot-manually-route-tool-addons-can-filter-their-visibility-via-tabid)
- [Removed `config` preset](#removed-config-preset-1)
- [From version 7.5.0 to 7.6.0](#from-version-750-to-760)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
- [typescript.skipBabel deprecated](#typescriptskipbabel-deprecated)
- [Primary doc block accepts of prop](#primary-doc-block-accepts-of-prop)
- [Addons no longer need a peer dependency on React](#addons-no-longer-need-a-peer-dependency-on-react)
- [CommonJS with Vite is deprecated](#commonjs-with-vite-is-deprecated)
- [Using implicit actions during rendering is deprecated](#using-implicit-actions-during-rendering-is-deprecated)
- [typescript.skipBabel deprecated](#typescriptskipbabel-deprecated)
- [Primary doc block accepts of prop](#primary-doc-block-accepts-of-prop)
- [Addons no longer need a peer dependency on React](#addons-no-longer-need-a-peer-dependency-on-react)
- [From version 7.4.0 to 7.5.0](#from-version-740-to-750)
- [`storyStoreV6` and `storiesOf` is deprecated](#storystorev6-and-storiesof-is-deprecated)
- [`storyIndexers` is replaced with `experimental_indexers`](#storyindexers-is-replaced-with-experimental_indexers)
- [`storyStoreV6` and `storiesOf` is deprecated](#storystorev6-and-storiesof-is-deprecated)
- [`storyIndexers` is replaced with `experimental_indexers`](#storyindexers-is-replaced-with-experimental_indexers)
- [From version 7.0.0 to 7.2.0](#from-version-700-to-720)
- [Addon API is more type-strict](#addon-api-is-more-type-strict)
- [Addon-controls hideNoControlsWarning parameter is deprecated](#addon-controls-hidenocontrolswarning-parameter-is-deprecated)
- [Addon API is more type-strict](#addon-api-is-more-type-strict)
- [Addon-controls hideNoControlsWarning parameter is deprecated](#addon-controls-hidenocontrolswarning-parameter-is-deprecated)
- [From version 6.5.x to 7.0.0](#from-version-65x-to-700)
- [7.0 breaking changes](#70-breaking-changes)
- [Dropped support for Node 15 and below](#dropped-support-for-node-15-and-below)
Expand All @@ -126,7 +129,7 @@
- [Deploying build artifacts](#deploying-build-artifacts)
- [Dropped support for file URLs](#dropped-support-for-file-urls)
- [Serving with nginx](#serving-with-nginx)
- [Ignore story files from node_modules](#ignore-story-files-from-node_modules)
- [Ignore story files from node\_modules](#ignore-story-files-from-node_modules)
- [7.0 Core changes](#70-core-changes)
- [7.0 feature flags removed](#70-feature-flags-removed)
- [Story context is prepared before for supporting fine grained updates](#story-context-is-prepared-before-for-supporting-fine-grained-updates)
Expand All @@ -140,7 +143,7 @@
- [Addon-interactions: Interactions debugger is now default](#addon-interactions-interactions-debugger-is-now-default)
- [7.0 Vite changes](#70-vite-changes)
- [Vite builder uses Vite config automatically](#vite-builder-uses-vite-config-automatically)
- [Vite cache moved to node_modules/.cache/.vite-storybook](#vite-cache-moved-to-node_modulescachevite-storybook)
- [Vite cache moved to node\_modules/.cache/.vite-storybook](#vite-cache-moved-to-node_modulescachevite-storybook)
- [7.0 Webpack changes](#70-webpack-changes)
- [Webpack4 support discontinued](#webpack4-support-discontinued)
- [Babel mode v7 exclusively](#babel-mode-v7-exclusively)
Expand Down Expand Up @@ -190,7 +193,7 @@
- [Dropped addon-docs manual babel configuration](#dropped-addon-docs-manual-babel-configuration)
- [Dropped addon-docs manual configuration](#dropped-addon-docs-manual-configuration)
- [Autoplay in docs](#autoplay-in-docs)
- [Removed STORYBOOK_REACT_CLASSES global](#removed-storybook_react_classes-global)
- [Removed STORYBOOK\_REACT\_CLASSES global](#removed-storybook_react_classes-global)
- [7.0 Deprecations and default changes](#70-deprecations-and-default-changes)
- [storyStoreV7 enabled by default](#storystorev7-enabled-by-default)
- [`Story` type deprecated](#story-type-deprecated)
Expand Down Expand Up @@ -403,6 +406,20 @@
- [Packages renaming](#packages-renaming)
- [Deprecated embedded addons](#deprecated-embedded-addons)

## From version 8.0 to 8.1.0

### Subtitle block and `parameters.componentSubtitle`

The `Subtitle` block now accepts an `of` prop, which can be a reference to a CSF file or a default export (meta).

`parameters.componentSubtitle` has been deprecated to be consistent with other parameters related to autodocs, instead use `parameters.docs.subtitle`.

##### Title block

The `Title` block now accepts an `of` prop, which can be a reference to a CSF file or a default export (meta).

It still accepts being passed `children`.

## From version 7.x to 8.0.0

### Portable stories
Expand Down
50 changes: 23 additions & 27 deletions code/addons/controls/src/manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,20 @@ addons.register(ADDON_ID, (api) => {
if (data.type !== 'story') throw new Error('Not a story');

try {
const response = await experimental_requestResponse<SaveStoryResponsePayload>(
channel,
SAVE_STORY_REQUEST,
SAVE_STORY_RESPONSE,
{
// Only send updated args
args: stringifyArgs(
Object.entries(data.args || {}).reduce<Args>((acc, [key, value]) => {
if (!deepEqual(value, data.initialArgs?.[key])) acc[key] = value;
return acc;
}, {})
),
csfId: data.id,
importPath: data.importPath,
} satisfies SaveStoryRequestPayload
);
const response = await experimental_requestResponse<
SaveStoryRequestPayload,
SaveStoryResponsePayload
>(channel, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, {
// Only send updated args
args: stringifyArgs(
Object.entries(data.args || {}).reduce<Args>((acc, [key, value]) => {
if (!deepEqual(value, data.initialArgs?.[key])) acc[key] = value;
return acc;
}, {})
),
csfId: data.id,
importPath: data.importPath,
});

api.addNotification({
id: 'save-story-success',
Expand Down Expand Up @@ -96,17 +94,15 @@ addons.register(ADDON_ID, (api) => {
const data = api.getCurrentStoryData();
if (data.type !== 'story') throw new Error('Not a story');

const response = await experimental_requestResponse<SaveStoryResponsePayload>(
channel,
SAVE_STORY_REQUEST,
SAVE_STORY_RESPONSE,
{
args: data.args && stringifyArgs(data.args),
csfId: data.id,
importPath: data.importPath,
name,
} satisfies SaveStoryRequestPayload
);
const response = await experimental_requestResponse<
SaveStoryRequestPayload,
SaveStoryResponsePayload
>(channel, SAVE_STORY_REQUEST, SAVE_STORY_RESPONSE, {
args: data.args && stringifyArgs(data.args),
csfId: data.id,
importPath: data.importPath,
name,
});

api.addNotification({
id: 'save-story-success',
Expand Down
2 changes: 1 addition & 1 deletion code/addons/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@babel/core": "^7.12.3",
"@babel/core": "^7.24.4",
"@mdx-js/react": "^3.0.0",
"@storybook/blocks": "workspace:*",
"@storybook/client-logger": "workspace:*",
Expand Down
27 changes: 21 additions & 6 deletions code/addons/links/template/stories/decorator.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,44 @@ export default {
decorators: [withLinks],
};

export const Basic = {
export const Target = {
args: {
content: `
<div>
<a class="link" href="#" data-sb-story="other">go to other</a>
This is just a story to target with the links
</div>
`,
},
parameters: {
chromatic: { disable: true },
},
};
export const Other = {

export const KindAndStory = {
args: {
content: `
<div>
<a class="link" href="#" data-sb-story="third">go to third</a>
<a class="link" href="#" data-sb-kind="addons-links-decorator" data-sb-story="story-only">go to story only</a>
</div>
`,
},
};
export const Third = {

export const StoryOnly = {
args: {
content: `
<div>
<a class="link" href="#" data-sb-story="target">go to target</a>
</div>
`,
},
};

export const KindOnly = {
args: {
content: `
<div>
<a class="link" href="#" data-sb-story="basic">go to basic</a>
<a class="link" href="#" data-sb-kind="addons-links-decorator">go to target</a>
</div>
`,
},
Expand Down
22 changes: 22 additions & 0 deletions code/addons/links/template/stories/hrefto.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { hrefTo } from '@storybook/addon-links';

export default {
component: globalThis.Components.Html,
title: 'hrefTo',
parameters: {
chromatic: { disable: true },
},
args: {
content: '<div><code id="content">Waiting for hrefTo to resolve...</code></div>',
},
};

export const Default = {
play: async () => {
const href = await hrefTo('addons-links-hrefto', 'target');
const content = document.querySelector('#content');
if (content) {
content.textContent = href;
}
},
};
58 changes: 47 additions & 11 deletions code/addons/links/template/stories/linkto.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { linkTo } from '@storybook/addon-links';

export default {
component: globalThis.Components.Button,
title: 'linkTo',
args: {
label: 'Click Me!',
},
Expand All @@ -11,34 +12,69 @@ export default {
},
};

export const ID = {
export const Target = {
args: {
onClick: linkTo('addons-links-parameters--basic'),
label: 'This is just a story to target with the links',
},
parameters: {
chromatic: { disable: true },
},
};
export const Title = {

export const Id = {
args: {
onClick: linkTo('addons-links-parameters'),
onClick: linkTo('addons-links-linkto--target'),
label: 'addons-links-linkto--target',
},
};
export const Basic = {

export const TitleOnly = {
args: {
onClick: linkTo('addons-links-parameters', 'basic'),
onClick: linkTo('addons/links/linkTo'),
label: 'addons/links/linkTo',
},
};
export const Other = {

export const NormalizedTitleOnly = {
args: {
onClick: linkTo('addons-links-parameters', 'basic'),
onClick: linkTo('addons-links-linkto'),
label: 'addons-links-linkto',
},
};
export const Third = {

export const TitleAndName = {
args: {
onClick: linkTo('addons-links-parameters', 'other'),
onClick: linkTo('addons/links/linkTo', 'Target'),
label: 'addons/links/linkTo, Target',
},
};

export const NormalizedTitleAndName = {
args: {
onClick: linkTo('addons-links-linkto', 'target'),
label: 'addons-links-linkto, target',
},
};

export const Callback = {
args: {
onClick: linkTo('addons-links-parameters', (event: Event) => 'basic'),
onClick: linkTo(
(event: Event) => 'addons-links-linkto',
(event: Event) => 'target'
),
},
};

export const ToMDXDocs = {
args: {
onClick: linkTo('Configure Your Project'),
label: 'Configure Your Project',
},
};

export const ToAutodocs = {
args: {
onClick: linkTo('Example Button', 'Docs'),
label: 'Example Button, Docs',
},
};
41 changes: 0 additions & 41 deletions code/addons/links/template/stories/scroll.stories.ts

This file was deleted.

Loading
Loading