@storybook/blocks 8.0.0-alpha.8 → 8.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +19 -99
- package/dist/index.js +3 -28
- package/dist/index.mjs +9 -34
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Conditional, DocsContextProps, PreparedStory, ModuleExports,
|
|
1
|
+
import { Conditional, DocsContextProps, PreparedStory, ModuleExports, Renderer as Renderer$1, Args as Args$1, StoryId, ModuleExport, StoryContextForLoaders, ResolvedModuleExportType, ResolvedModuleExportFromType, Parameters as Parameters$1, ProjectAnnotations, BaseAnnotations, ComponentTitle } from '@storybook/types';
|
|
2
2
|
export { DocsContextProps } from '@storybook/types';
|
|
3
3
|
import React, { ComponentProps, FunctionComponent, ReactNode, FC, PropsWithChildren, Context, ReactElement } from 'react';
|
|
4
4
|
import { Renderer } from '@storybook/csf';
|
|
@@ -97,12 +97,12 @@ interface ArgsTableErrorProps {
|
|
|
97
97
|
interface ArgsTableLoadingProps {
|
|
98
98
|
isLoading: boolean;
|
|
99
99
|
}
|
|
100
|
-
type ArgsTableProps
|
|
100
|
+
type ArgsTableProps = ArgsTableOptionProps & (ArgsTableDataProps | ArgsTableErrorProps | ArgsTableLoadingProps);
|
|
101
101
|
/**
|
|
102
102
|
* Display the props for a component as a props table. Each row is a collection of
|
|
103
103
|
* ArgDefs, usually derived from docgen info for the component.
|
|
104
104
|
*/
|
|
105
|
-
declare const ArgsTable
|
|
105
|
+
declare const ArgsTable: FC<ArgsTableProps>;
|
|
106
106
|
|
|
107
107
|
interface CommonProps {
|
|
108
108
|
story: PreparedStory;
|
|
@@ -120,12 +120,12 @@ interface IFrameStoryProps extends CommonProps {
|
|
|
120
120
|
inline: false;
|
|
121
121
|
height: string;
|
|
122
122
|
}
|
|
123
|
-
type StoryProps$
|
|
123
|
+
type StoryProps$1 = InlineStoryProps | IFrameStoryProps;
|
|
124
124
|
/**
|
|
125
125
|
* A story element, either rendered inline or in an iframe,
|
|
126
126
|
* with configurable height.
|
|
127
127
|
*/
|
|
128
|
-
declare const Story$1: FunctionComponent<StoryProps$
|
|
128
|
+
declare const Story$1: FunctionComponent<StoryProps$1>;
|
|
129
129
|
|
|
130
130
|
interface TypesetProps {
|
|
131
131
|
fontFamily?: string;
|
|
@@ -193,44 +193,6 @@ type ArgTypesProps = ArgTypesParameters & {
|
|
|
193
193
|
};
|
|
194
194
|
declare const ArgTypes: FC<ArgTypesProps>;
|
|
195
195
|
|
|
196
|
-
declare const PRIMARY_STORY = "^";
|
|
197
|
-
type Component = any;
|
|
198
|
-
type DocsStoryProps = {
|
|
199
|
-
of: ModuleExport;
|
|
200
|
-
expanded?: boolean;
|
|
201
|
-
withToolbar?: boolean;
|
|
202
|
-
__forceInitialArgs?: boolean;
|
|
203
|
-
__primary?: boolean;
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
interface BaseProps {
|
|
207
|
-
include?: PropDescriptor;
|
|
208
|
-
exclude?: PropDescriptor;
|
|
209
|
-
sort?: SortType;
|
|
210
|
-
}
|
|
211
|
-
type OfProps = BaseProps & {
|
|
212
|
-
of: '^' | Component;
|
|
213
|
-
};
|
|
214
|
-
type ComponentsProps = BaseProps & {
|
|
215
|
-
parameters: Parameters$1;
|
|
216
|
-
components: {
|
|
217
|
-
[label: string]: Component;
|
|
218
|
-
};
|
|
219
|
-
};
|
|
220
|
-
type StoryProps$1 = BaseProps & {
|
|
221
|
-
story: '.' | '^' | string;
|
|
222
|
-
showComponent?: boolean;
|
|
223
|
-
};
|
|
224
|
-
type ArgsTableProps = BaseProps | OfProps | ComponentsProps | StoryProps$1;
|
|
225
|
-
declare const extractComponentArgTypes: (component: Component, parameters: Parameters$1, include?: PropDescriptor, exclude?: PropDescriptor) => StrictArgTypes;
|
|
226
|
-
declare const getComponent: (props: ArgsTableProps, component: Component) => Component;
|
|
227
|
-
declare const StoryTable: FC<StoryProps$1 & {
|
|
228
|
-
component: Component;
|
|
229
|
-
subcomponents: Record<string, Component>;
|
|
230
|
-
}>;
|
|
231
|
-
declare const ComponentsTable: FC<ComponentsProps>;
|
|
232
|
-
declare const ArgsTable: FC<ArgsTableProps>;
|
|
233
|
-
|
|
234
196
|
declare const DocsContext: Context<DocsContextProps<Renderer$1>>;
|
|
235
197
|
|
|
236
198
|
type ArgsHash = string;
|
|
@@ -250,11 +212,6 @@ declare const SourceContainer: FC<PropsWithChildren<{
|
|
|
250
212
|
channel: Channel;
|
|
251
213
|
}>>;
|
|
252
214
|
|
|
253
|
-
declare enum SourceState {
|
|
254
|
-
OPEN = "open",
|
|
255
|
-
CLOSED = "closed",
|
|
256
|
-
NONE = "none"
|
|
257
|
-
}
|
|
258
215
|
type SourceParameters = SourceCodeProps & {
|
|
259
216
|
/**
|
|
260
217
|
* Where to read the source code from, see `SourceType`
|
|
@@ -281,20 +238,13 @@ type SourceProps = SourceParameters & {
|
|
|
281
238
|
* ```
|
|
282
239
|
*/
|
|
283
240
|
of?: ModuleExport;
|
|
284
|
-
/** @deprecated use of={storyExport} instead */
|
|
285
|
-
id?: string;
|
|
286
|
-
/** @deprecated use of={storyExport} instead */
|
|
287
|
-
ids?: string[];
|
|
288
241
|
/**
|
|
289
242
|
* Internal prop to control if a story re-renders on args updates
|
|
290
243
|
*/
|
|
291
244
|
__forceInitialArgs?: boolean;
|
|
292
245
|
};
|
|
293
|
-
type SourceStateProps = {
|
|
294
|
-
state: SourceState;
|
|
295
|
-
};
|
|
296
246
|
type PureSourceProps = ComponentProps<typeof Source$1>;
|
|
297
|
-
declare const useSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps
|
|
247
|
+
declare const useSourceProps: (props: SourceProps, docsContext: DocsContextProps<any>, sourceContext: SourceContextProps) => PureSourceProps;
|
|
298
248
|
/**
|
|
299
249
|
* Story source doc block renders source code if provided,
|
|
300
250
|
* or the source for a story if `storyId` is provided, or
|
|
@@ -303,24 +253,10 @@ declare const useSourceProps: (props: SourceProps, docsContext: DocsContextProps
|
|
|
303
253
|
declare const Source: FC<SourceProps>;
|
|
304
254
|
|
|
305
255
|
type PureStoryProps = ComponentProps<typeof Story$1>;
|
|
306
|
-
/**
|
|
307
|
-
* Props to define a story
|
|
308
|
-
*
|
|
309
|
-
* @deprecated Define stories in CSF files
|
|
310
|
-
*/
|
|
311
|
-
type StoryDefProps = StoryAnnotations;
|
|
312
256
|
/**
|
|
313
257
|
* Props to reference another story
|
|
314
258
|
*/
|
|
315
259
|
type StoryRefProps = {
|
|
316
|
-
/**
|
|
317
|
-
* @deprecated Use of={storyExport} instead
|
|
318
|
-
*/
|
|
319
|
-
id?: string;
|
|
320
|
-
/**
|
|
321
|
-
* @deprecated Use of={storyExport} and define the story in the CSF file
|
|
322
|
-
*/
|
|
323
|
-
story?: StoryAnnotations;
|
|
324
260
|
/**
|
|
325
261
|
* Pass the export defining a story to render that story
|
|
326
262
|
*
|
|
@@ -367,33 +303,11 @@ type StoryParameters = {
|
|
|
367
303
|
*/
|
|
368
304
|
__primary?: boolean;
|
|
369
305
|
};
|
|
370
|
-
type StoryProps =
|
|
306
|
+
type StoryProps = StoryRefProps & StoryParameters;
|
|
371
307
|
declare const getStoryId: (props: StoryProps, context: DocsContextProps) => StoryId;
|
|
372
308
|
declare const getStoryProps: <TFramework extends Renderer$1>(props: StoryParameters, story: PreparedStory<TFramework>, context: DocsContextProps<TFramework>) => PureStoryProps;
|
|
373
309
|
declare const Story: FC<StoryProps>;
|
|
374
310
|
|
|
375
|
-
type DeprecatedCanvasProps = {
|
|
376
|
-
/**
|
|
377
|
-
* @deprecated multiple stories are not supported
|
|
378
|
-
*/
|
|
379
|
-
isColumn?: boolean;
|
|
380
|
-
/**
|
|
381
|
-
* @deprecated multiple stories are not supported
|
|
382
|
-
*/
|
|
383
|
-
columns?: number;
|
|
384
|
-
/**
|
|
385
|
-
* @deprecated use `sourceState` instead
|
|
386
|
-
*/
|
|
387
|
-
withSource?: SourceState;
|
|
388
|
-
/**
|
|
389
|
-
* @deprecated use `source.code` instead
|
|
390
|
-
*/
|
|
391
|
-
mdxSource?: string;
|
|
392
|
-
/**
|
|
393
|
-
* @deprecated reference stories with the `of` prop instead
|
|
394
|
-
*/
|
|
395
|
-
children?: ReactNode;
|
|
396
|
-
};
|
|
397
311
|
type CanvasProps = Pick<PreviewProps, 'withToolbar' | 'additionalActions' | 'className'> & {
|
|
398
312
|
/**
|
|
399
313
|
* Pass the export defining a story to render that story
|
|
@@ -443,7 +357,7 @@ type CanvasProps = Pick<PreviewProps, 'withToolbar' | 'additionalActions' | 'cla
|
|
|
443
357
|
*/
|
|
444
358
|
story?: Pick<StoryProps, 'inline' | 'height' | 'autoplay' | '__forceInitialArgs' | '__primary'>;
|
|
445
359
|
};
|
|
446
|
-
declare const Canvas: FC<CanvasProps
|
|
360
|
+
declare const Canvas: FC<CanvasProps>;
|
|
447
361
|
|
|
448
362
|
type ControlsParameters = {
|
|
449
363
|
include?: PropDescriptor;
|
|
@@ -493,6 +407,16 @@ interface DocsContainerProps<TFramework extends Renderer$1 = Renderer$1> {
|
|
|
493
407
|
}
|
|
494
408
|
declare const DocsContainer: FC<PropsWithChildren<DocsContainerProps>>;
|
|
495
409
|
|
|
410
|
+
declare const PRIMARY_STORY = "^";
|
|
411
|
+
type Component = any;
|
|
412
|
+
type DocsStoryProps = {
|
|
413
|
+
of: ModuleExport;
|
|
414
|
+
expanded?: boolean;
|
|
415
|
+
withToolbar?: boolean;
|
|
416
|
+
__forceInitialArgs?: boolean;
|
|
417
|
+
__primary?: boolean;
|
|
418
|
+
};
|
|
419
|
+
|
|
496
420
|
declare const DocsStory: FC<DocsStoryProps>;
|
|
497
421
|
|
|
498
422
|
type ExternalDocsProps<TRenderer extends Renderer$1 = Renderer$1> = {
|
|
@@ -523,10 +447,6 @@ type MetaProps = BaseAnnotations & {
|
|
|
523
447
|
declare const Meta: FC<MetaProps>;
|
|
524
448
|
|
|
525
449
|
interface PrimaryProps {
|
|
526
|
-
/**
|
|
527
|
-
* @deprecated Primary block should only be used to render the primary story, which is automatically found.
|
|
528
|
-
*/
|
|
529
|
-
name?: string;
|
|
530
450
|
/**
|
|
531
451
|
* Specify where to get the primary story from.
|
|
532
452
|
*/
|
|
@@ -697,4 +617,4 @@ type ColorProps = ColorControlProps;
|
|
|
697
617
|
declare const LazyColorControl: React.LazyExoticComponent<React.FC<ColorControlProps>>;
|
|
698
618
|
declare const ColorControl: (props: ComponentProps<typeof LazyColorControl>) => React.JSX.Element;
|
|
699
619
|
|
|
700
|
-
export { AddContext, Anchor, AnchorMdx, AnchorProps, ArgTypes,
|
|
620
|
+
export { AddContext, Anchor, AnchorMdx, AnchorProps, ArgTypes, BooleanConfig, BooleanControl, BooleanProps, BooleanValue, Canvas, CodeOrSourceMdx, ColorConfig, ColorControl, ColorItem, ColorPalette, ColorProps, ColorValue, Component, Control, ControlProps, ControlType, Controls, DateConfig, DateControl, DateProps, DateValue, DescriptionContainer as Description, DescriptionType, Docs, DocsContainer, DocsContainerProps, DocsContext, DocsPage, DocsProps, DocsStory, DocsStoryProps, ExternalDocs, ExternalDocsContainer, ExternalDocsProps, FilesControl, FilesControlProps, HeaderMdx, HeadersMdx, Heading, HeadingProps, IconGallery, IconItem, Markdown, Meta, NormalizedOptionsConfig, NumberConfig, NumberControl, NumberValue, ObjectConfig, ObjectControl, ObjectProps, ObjectValue, Of, Options, OptionsArray, OptionsConfig, OptionsControl, OptionsControlType, OptionsMultiSelection, OptionsObject, OptionsProps, OptionsSelection, OptionsSingleSelection, PRIMARY_STORY, PresetColor, Primary, ArgsTable as PureArgsTable, RangeConfig, RangeControl, SortType, Source, SourceContainer, SourceContext, SourceContextProps, SourceItem, SourceProps, Stories, Story, StoryProps, StorySources, Subheading, Subtitle, TextConfig, TextControl, TextProps, TextValue, Title, Typeset, UNKNOWN_ARGS_HASH, Unstyled, Wrapper, anchorBlockIdFromId, argsHash, assertIsFn, extractTitle, format, formatDate, formatTime, getStoryId, getStoryProps, parse, parseDate, parseTime, useOf, useSourceProps };
|