@storybook/nextjs-vite
Version:
Storybook for Next.js and Vite: Develop, document, and test UI components in isolation
53 lines (50 loc) • 1.85 kB
TypeScript
import { CompatibleString } from 'storybook/internal/types';
import { BuilderOptions } from '@storybook/builder-vite';
import { StorybookConfig as StorybookConfig$1 } from '@storybook/react-vite';
import { NextRouter } from 'next/router';
type FrameworkName = CompatibleString<'@storybook/nextjs-vite'>;
type BuilderName = CompatibleString<'@storybook/builder-vite'>;
type FrameworkOptions = {
/** The path to the Next.js configuration file. */
nextConfigPath?: string;
builder?: BuilderOptions;
};
type StorybookConfigFramework = {
framework: FrameworkName | {
name: FrameworkName;
options: FrameworkOptions;
};
core?: StorybookConfig$1['core'] & {
builder?: BuilderName | {
name: BuilderName;
options: BuilderOptions;
};
};
};
/** The interface for Storybook configuration in `main.ts` files. */
type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigFramework> & StorybookConfigFramework;
interface NextJsParameters {
/**
* Next.js framework configuration
*
* @see https://storybook.js.org/docs/get-started/frameworks/nextjs
*/
nextjs?: {
/**
* Enable App Directory features If your story imports components that use next/navigation, you
* need to set this parameter to true
*/
appDirectory?: boolean;
/**
* Next.js navigation configuration when using `next/navigation`. Please note that it can only
* be used in components/pages in the app directory.
*/
navigation?: Partial<NextRouter>;
/** Next.js router configuration */
router?: Partial<NextRouter>;
};
}
interface NextJsTypes {
parameters: NextJsParameters;
}
export { FrameworkOptions as F, NextJsTypes as N, StorybookConfig as S, NextJsParameters as a };