Open Dawdre opened 1 year ago
Have the same Error. I'm passing parameters, decorates and test Information through a Configuration File
Configuration.ts
import { withTests } from '@storybook/addon-jest';
import results from '@kern/components/jest-test-results.json';
import { BADGE } from '@geometricpanda/storybook-addon-badges';
import { argTypes } from './arg-types';
export const HeadingConfiguration = {
decorators: [
withTests({
results,
}),
],
parameters: {
badges: [BADGE.STABLE],
jest: ['heading.e2e.ts', 'heading.spec.ts', 'heading.spec.tsx'],
status: { type: 'bitv' },
},
...argTypes,
};
arg-types.ts
export const argTypes = {
_level: {
name: 'Überschrift (h1 bis h6)',
description: 'Gibt an, welchen H-Level von 1 bis 6 die Überschrift hat. Oder ob es keine Überschrift ist, sondern nur fett gedruckt.',
control: {
type: 'select',
},
options: [1, 2, 3, 4, 5, 6],
type: {
required: true,
},
defaultValue: 1,
},
_label: {
name: 'Titel',
description: 'Gibt den Text der Überschrift an.',
control: {
type: 'text',
},
defaultValue: 'Beliebiger Titel.',
},
};
In AutoDocs of my Component, the argType information won't show up.
If I manually add argTypes Information in my react.stories.ts
everything works normally
I changed my argTypes File and my configuration.ts and now everything works fine.
type: {
required:true
}
Is shown correctly in column name but satifies Meta<typeof Heading>
doesn't know this parameter. Maybe this is a different Issue.
In my Configuration I changed to include from argTypes from ...argTypes
to just argTypes
Having trouble with the same issue! I think this solution might work.
First make an util function
function getMetaArguments(componentProps: { [key: string]: any }) {
const metaArgs: { [key: string]: any } = {};
Object.keys(componentProps).forEach((prop) => {
const { default: defaultValue } = componentProps[prop];
if (typeof defaultValue === 'function') {
metaArgs[prop] = defaultValue();
return;
}
if (defaultValue === undefined) {
metaArgs[prop] = null;
} else {
metaArgs[prop] = defaultValue;
}
});
return metaArgs;
}
add the result to meta.args
// ...stories.ts
const meta: Meta<typeof AtomTextInput> = {
...
}
meta.args = getMetaArguments(AtomTextInput.props);
export default meta;
Describe the bug
Context
I am at the start of implementing Storybook into our Vue 2 Typescript Design System. Given the repetitive nature of some of our components, i.e. form components, we use vue composables to make consuming common props and functionality easier.
Problem
The props defined in my util/composable are not being picked up and thus missing from the documentation/canvas.
Is there a way to get around this? Setting
args
manually for the "missing" props has drawbacks. I have done this in the examples below just for illustrative purposeswidth
prop in the composable) don't update dynamically and only work on first load. Only simple strings seem to be reactiveGoal
Have my abstract props be picked up by Storybook files
Text input component
Atom composable/util
Story file
To Reproduce
No response
System
Additional context
No response