Comments (7)
@storybook/csf
got a 0.1.5 release that fixes this: https://github.com/ComponentDriven/csf/releases/tag/v0.1.5
Once #26958 is merged and a storybook release is out, that should resolve this moving forward.
from storybook.
Having same issues but with latest SB version you no longer need to set options as before. You will get those automatically.
You can still change the control type indeed.
from storybook.
I think simply making options
a readonly any[]
instead of just any[]
should work, as per https://www.typescriptlang.org/play?#code/C4TwDgpgBAhgdiAKgCwJZwOZQLxQE4QwAmA9nADYiwIDaAugNwBQTAxmQM7BQckC2EYGkw4oNAEQAzEiXEAaKOIBGMPOLqwOUdnC7MdXHv0HCMAUXIdouGgEYFAJgUBmRiwPdeAoegwBBBAAuaiRTUS8TX31OT2MfTAsrAJBg+FDfcLjTRIgGIA
I'd make a PR for this and test it, but I'm struggling to find where this is defined. I can see it published in @storybook/types
but can't quite find it in this repo. https://npmdiff.dev/%40storybook%2Ftypes/8.0.8/8.0.9/
EDIT: I found it. It's https://github.com/ComponentDriven/csf. I think this was introduced in ComponentDriven/csf@ab72fee
from storybook.
I've opened ComponentDriven/csf#85 which from my testing resolves this.
from storybook.
I've opened ComponentDriven/csf#85 which from my testing resolves this.
Great! Do we also need a PR in storybook to address the dependency upgrade? I'm a bit of a OS / Storybook noob, so not completely sure what the best approach is.
from storybook.
Hello,
We are also experiencing this issue with 8.0.9 when using an enum as the value for the options property against an argType.
Previously ok and now throwing same error as above:
export enum EStatus {
ACCENT = "accent",
DANGER = "danger",
LOADING = "loading",
NEUTRAL = "neutral",
SUCCESS = "success",
WARNING = "warning",
}
argTypes: {
status: {
options: EStatus,
control: { type: "radio" },
},
},
Removing the options property does not automatically give the correct enum as options even through it is specified in the prop types for the component. Control in Storybook gives "-".
Manually specifying individual enum items in an array in the options property does still work e.g.
argTypes: {
status: {
control: { type: "radio" },
options: [EStatus.ACCENT, EStatus.DANGER, EStatus.NEUTRAL, EStatus.SUCCESS, EStatus.WARNING],
},
}
Do we need to change our technique for the options property or is this a bug with the new version? Many thanks.
from storybook.
I've opened ComponentDriven/csf#85 which from my testing resolves this.
Great! Do we also need a PR in storybook to address the dependency upgrade? I'm a bit of a OS / Storybook noob, so not completely sure what the best approach is.
There will need to be a PR here too yes, once that PR for @storybook/csf
is merged and released.
from storybook.
Related Issues (20)
- [Bug]: Failure in Upgrading Storybook
- [Bug]: Importing anything that contains a word `raw` in NextJS+Storybook project from ant-design makes every other import null HOT 2
- Warn when a story is rendered in portable stories when there are lingering cleanup functions
- [Bug]: Module not found error when using CommonJS entry point in @storybook/test HOT 1
- [Bug]: v8 Loading @emotion/react more than once warning HOT 1
- [Bug]: Error with static storybook HOT 2
- [Bug]: Configuration options don't seem to get passed on to vitest HOT 2
- [Bug]: Next 14.2.2 [ yarn dlx sb init -> running storybook error ] HOT 1
- [Tracking] On-going effort to fix flakey tests
- [Bug]: Empty index.html
- [Bug]: docs tab not display in storybook ui HOT 3
- [Bug]: defaultProps Warnings HOT 1
- [Bug]: Failed to execute 'insertRule' on 'CSSStyleSheet' : Storybook 8.0.6
- Check command seems to be inconsistent HOT 1
- [Bug]: Docs stories filtered with `'!autodocs'` behaves weird in `Primary`, `Stories`, `Controls`, etc. components HOT 5
- Bench script flakiness
- [Bug]: Can't install latest version with the Next.js option HOT 1
- [Bug]: Typescript JSX types for Vue3 (Vite project) . The type of the tsc command is incorrect
- [Bug]: Not possible to map complex types to different types with typescript and react
- [Bug]: Load component fail after publish HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storybook.