vibe-storybook-components
Advanced tools
Comparing version 0.9.5-create-story-mettasettings-fix-types-b228274c5d.0 to 0.9.5-create-story-mettasettings-fix-types-e4a0c05e1c.0
@@ -1,3 +0,2 @@ | ||
import { ArgTypes, DecoratorFunction, StoryContext } from '@storybook/types'; | ||
import { ReactRenderer } from '@storybook/react'; | ||
import { ArgTypes, PartialStoryFn, StoryContext } from '@storybook/types'; | ||
export type EnumPropNames = { | ||
@@ -15,2 +14,11 @@ propName: string; | ||
}; | ||
export type AllowedIcons = { | ||
options: string[]; | ||
mapping: { | ||
[key: string]: unknown; | ||
}; | ||
}; | ||
export type Decorator = (story: PartialStoryFn<any>, context: StoryContext<any>) => { | ||
storyResult: any; | ||
}; | ||
export type StoryMetaSettingsArgs = { | ||
@@ -27,3 +35,2 @@ component: any; | ||
}; | ||
export type Decorator = DecoratorFunction<ReactRenderer> | ((Story: () => unknown, context: StoryContext) => Decorator); | ||
export type StoryMetaSettingsResult = { | ||
@@ -33,7 +40,1 @@ argTypes: Partial<ArgTypes>; | ||
}; | ||
export type AllowedIcons = { | ||
options: string[]; | ||
mapping: { | ||
[key: string]: unknown; | ||
}; | ||
}; |
{ | ||
"name": "vibe-storybook-components", | ||
"version": "0.9.5-create-story-mettasettings-fix-types-b228274c5d.0", | ||
"version": "0.9.5-create-story-mettasettings-fix-types-e4a0c05e1c.0", | ||
"description": "Collection of Vibe's Storybook components", | ||
@@ -53,5 +53,5 @@ "license": "MIT", | ||
"dependencies": { | ||
"@storybook/types": "^7.5.0", | ||
"browserslist-config-monday": "^1.0.6", | ||
"classnames": "^2.3.2" | ||
"classnames": "^2.3.2", | ||
"@storybook/types": "^7.5.0" | ||
}, | ||
@@ -58,0 +58,0 @@ "devDependencies": { |
import { useCallback, useMemo, useState } from 'react'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { AllowedIcons, Decorator, IconMetaData, StoryMetaSettingsArgs, StoryMetaSettingsResult } from './types'; | ||
import { StoryContext, ArgTypes } from '@storybook/types'; | ||
import { ArgTypes } from '@storybook/types'; | ||
@@ -29,7 +29,4 @@ function parseStringForEnums(componentName: string, enumName: string, enumObj: { [key: string]: unknown }) { | ||
*/ | ||
function createMappedActionToInputPropDecorator( | ||
actionName: string, | ||
linkedToPropValue: string, | ||
): (Story: () => unknown, context: StoryContext) => Decorator { | ||
return (Story: () => unknown, context: StoryContext): Decorator => { | ||
function createMappedActionToInputPropDecorator(actionName: string, linkedToPropValue: string): Decorator { | ||
return (Story, context) => { | ||
const [propValue, setPropValue] = useState(context.initialArgs[linkedToPropValue]); | ||
@@ -49,3 +46,3 @@ const createAction = useMemo(() => action(actionName), []); | ||
return Story() as Decorator; | ||
return Story(); | ||
}; | ||
@@ -52,0 +49,0 @@ } |
@@ -1,3 +0,2 @@ | ||
import { ArgTypes, DecoratorFunction, StoryContext } from '@storybook/types'; | ||
import { ReactRenderer } from '@storybook/react'; | ||
import { ArgTypes, PartialStoryFn, StoryContext } from '@storybook/types'; | ||
@@ -19,2 +18,10 @@ export type EnumPropNames = { | ||
export type AllowedIcons = { | ||
options: string[]; | ||
mapping: { [key: string]: unknown }; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export type Decorator = (story: PartialStoryFn<any>, context: StoryContext<any>) => { storyResult: any }; | ||
export type StoryMetaSettingsArgs = { | ||
@@ -31,4 +38,2 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
export type Decorator = DecoratorFunction<ReactRenderer> | ((Story: () => unknown, context: StoryContext) => Decorator); | ||
export type StoryMetaSettingsResult = { | ||
@@ -38,6 +43,1 @@ argTypes: Partial<ArgTypes>; | ||
}; | ||
export type AllowedIcons = { | ||
options: string[]; | ||
mapping: { [key: string]: unknown }; | ||
}; |
164855
2234