@storybook/components 7.0.0-alpha.5 → 7.0.0-alpha.8

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/html.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{Ha as e,Ia as r,a as p}from"./chunk-XFBIFQ3K.mjs";import"./chunk-EBKGXALM.mjs";import{a as t}from"./chunk-DF422II4.mjs";import"./chunk-WYLOY4EF.mjs";import"./chunk-7IK3EOFL.mjs";import"./chunk-AZCVBZVA.mjs";import"./chunk-XZM6YCLI.mjs";import{h as o}from"./chunk-PJYBQ6PQ.mjs";o();import n from"util-deprecate";var s=n(()=>{},t`
1
+ import{a as p,da as e,ea as r}from"./chunk-37LBAZBN.mjs";import"./chunk-NS5PSNOW.mjs";import{a as t}from"./chunk-DF422II4.mjs";import"./chunk-IONIU25V.mjs";import"./chunk-7IK3EOFL.mjs";import{h as o}from"./chunk-PJYBQ6PQ.mjs";o();import n from"util-deprecate";var s=n(()=>{},t`
2
2
  The entry point '@storybook/components/html' is deprecated. Please use '@storybook/components' directly instead.
3
3
 
4
4
  See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-storybook-components-html-entry-point
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import * as react from 'react';
2
- import react__default, { ComponentProps, FunctionComponent, AnchorHTMLAttributes, MouseEvent, ReactNode, ReactElement, Component, RefObject, SyntheticEvent, FC, ElementType } from 'react';
2
+ import react__default, { ComponentProps, FunctionComponent, AnchorHTMLAttributes, MouseEvent, ReactNode, ReactElement, Component, RefObject, SyntheticEvent, ElementType } from 'react';
3
3
  import * as _storybook_theming from '@storybook/theming';
4
- import { Theme } from '@storybook/theming';
4
+ import { Theme, CSSObject } from '@storybook/theming';
5
5
  import { BuiltInParserName } from 'prettier';
6
6
  import * as react_textarea_autosize from 'react-textarea-autosize';
7
- import { Conditional, Parameters } from '@storybook/csf';
8
7
 
9
8
  declare const A: _storybook_theming.StyledComponent<any, {
10
9
  theme: _storybook_theming.Theme;
@@ -174,6 +173,8 @@ declare type SyntaxHighlighterProps = SyntaxHighlighterBaseProps & SyntaxHighlig
174
173
  declare const LazySyntaxHighlighter: react__default.LazyExoticComponent<react__default.FunctionComponent<SyntaxHighlighterProps>>;
175
174
  declare const SyntaxHighlighter: (props: ComponentProps<typeof LazySyntaxHighlighter>) => JSX.Element;
176
175
 
176
+ declare function createCopyToClipboardFunction(): (text: string) => any;
177
+
177
178
  interface ActionItem {
178
179
  title: string | JSX.Element;
179
180
  className?: string;
@@ -251,24 +252,24 @@ declare const Form: _storybook_theming.StyledComponent<react.DetailedHTMLProps<r
251
252
  Field: react.FunctionComponent<FieldProps>;
252
253
  Input: _storybook_theming.StyledComponent<any, {
253
254
  size?: "flex" | "auto" | "100%";
254
- align?: "start" | "center" | "end";
255
- valid?: "error" | "valid" | "warn";
255
+ align?: "center" | "end" | "start";
256
+ valid?: "valid" | "error" | "warn";
256
257
  height?: number;
257
258
  }, _storybook_theming.Theme> & {
258
259
  displayName: string;
259
260
  };
260
261
  Select: _storybook_theming.StyledComponent<any, Omit<react.SelectHTMLAttributes<HTMLSelectElement>, "height" | "size" | "valid" | "align"> & {
261
262
  size?: "flex" | "auto" | "100%";
262
- align?: "start" | "center" | "end";
263
- valid?: "error" | "valid" | "warn";
263
+ align?: "center" | "end" | "start";
264
+ valid?: "valid" | "error" | "warn";
264
265
  height?: number;
265
266
  }, _storybook_theming.Theme> & {
266
267
  displayName: string;
267
268
  };
268
269
  Textarea: _storybook_theming.StyledComponent<any, Omit<react_textarea_autosize.TextareaAutosizeProps, "height" | "size" | "valid" | "align"> & {
269
270
  size?: "flex" | "auto" | "100%";
270
- align?: "start" | "center" | "end";
271
- valid?: "error" | "valid" | "warn";
271
+ align?: "center" | "end" | "start";
272
+ valid?: "valid" | "error" | "warn";
272
273
  height?: number;
273
274
  }, _storybook_theming.Theme> & {
274
275
  displayName: string;
@@ -542,6 +543,7 @@ interface IconButtonProps {
542
543
  disabled?: boolean;
543
544
  }
544
545
  declare const IconButton: _storybook_theming.StyledComponent<any, IconButtonProps, _storybook_theming.Theme>;
546
+ declare const IconButtonSkeleton: () => JSX.Element;
545
547
 
546
548
  declare const Separator: _storybook_theming.StyledComponent<react__default.DetailedHTMLProps<react__default.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, SeparatorProps, _storybook_theming.Theme>;
547
549
  declare const interleaveSeparators: (list: any[]) => any;
@@ -759,337 +761,6 @@ declare const StorybookLogo: FunctionComponent<{
759
761
 
760
762
  declare const StorybookIcon: FunctionComponent<{}>;
761
763
 
762
- interface DescriptionProps {
763
- markdown: string;
764
- }
765
- /**
766
- * A markdown description for a component, typically used to show the
767
- * components docgen docs.
768
- */
769
- declare const Description: FunctionComponent<DescriptionProps>;
770
-
771
- interface DocsPageProps {
772
- title: string;
773
- subtitle?: string;
774
- }
775
- declare const Title: _storybook_theming.StyledComponent<react__default.DetailedHTMLProps<react__default.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {}, Theme>;
776
- declare const Subtitle: _storybook_theming.StyledComponent<react__default.DetailedHTMLProps<react__default.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>, {}, Theme>;
777
- declare const DocsContent: _storybook_theming.StyledComponent<react__default.DetailedHTMLProps<react__default.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<react__default.ClassAttributes<HTMLDivElement> & react__default.HTMLAttributes<HTMLDivElement>, keyof react__default.HTMLAttributes<HTMLDivElement>>, Theme>;
778
- declare const DocsWrapper: _storybook_theming.StyledComponent<react__default.DetailedHTMLProps<react__default.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}, Theme>;
779
- declare const DocsPageWrapper: FC;
780
-
781
- declare const StyledSyntaxHighlighter: _storybook_theming.StyledComponent<any, {}, _storybook_theming.Theme>;
782
- declare enum SourceError {
783
- NO_STORY = "There\u2019s no story here.",
784
- SOURCE_UNAVAILABLE = "Oh no! The source is not available."
785
- }
786
- interface SourceErrorProps {
787
- isLoading?: boolean;
788
- error?: SourceError;
789
- }
790
- interface SourceCodeProps {
791
- language?: string;
792
- code?: string;
793
- format?: ComponentProps<typeof SyntaxHighlighter>['format'];
794
- dark?: boolean;
795
- }
796
- declare type SourceProps = SourceErrorProps & SourceCodeProps;
797
- /**
798
- * Syntax-highlighted source code for a component (or anything!)
799
- */
800
- declare const Source: FunctionComponent<SourceProps>;
801
-
802
- interface PreviewProps {
803
- isLoading?: true;
804
- isColumn?: boolean;
805
- columns?: number;
806
- withSource?: SourceProps;
807
- isExpanded?: boolean;
808
- withToolbar?: boolean;
809
- className?: string;
810
- additionalActions?: ActionItem[];
811
- }
812
- /**
813
- * A preview component for showing one or more component `Story`
814
- * items. The preview also shows the source for the component
815
- * as a drop-down.
816
- */
817
- declare const Preview: FunctionComponent<PreviewProps>;
818
- declare const PreviewSkeleton: () => JSX.Element;
819
-
820
- interface JsDocParam {
821
- name: string;
822
- description?: string;
823
- }
824
- interface JsDocReturns {
825
- description?: string;
826
- }
827
- interface JsDocTags {
828
- params?: JsDocParam[];
829
- returns?: JsDocReturns;
830
- }
831
- interface PropSummaryValue {
832
- summary: string;
833
- detail?: string;
834
- required?: boolean;
835
- }
836
- declare type PropType = PropSummaryValue;
837
- declare type PropDefaultValue = PropSummaryValue;
838
- interface TableAnnotation {
839
- type: PropType;
840
- jsDocTags?: JsDocTags;
841
- defaultValue?: PropDefaultValue;
842
- category?: string;
843
- }
844
- interface ArgType {
845
- name?: string;
846
- description?: string;
847
- defaultValue?: any;
848
- if?: Conditional;
849
- [key: string]: any;
850
- }
851
- interface ArgTypes {
852
- [key: string]: ArgType;
853
- }
854
- interface Args {
855
- [key: string]: any;
856
- }
857
- declare type Globals = {
858
- [name: string]: any;
859
- };
860
-
861
- declare const TableWrapper: _storybook_theming.StyledComponent<react__default.DetailedHTMLProps<react__default.TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, {
862
- compact?: boolean;
863
- inAddonPanel?: boolean;
864
- isLoading?: boolean;
865
- }, _storybook_theming.Theme>;
866
- declare enum ArgsTableError {
867
- NO_COMPONENT = "No component found.",
868
- ARGS_UNSUPPORTED = "Args unsupported. See Args documentation for your framework."
869
- }
870
- declare type SortType = 'alpha' | 'requiredFirst' | 'none';
871
- interface ArgsTableOptionProps {
872
- updateArgs?: (args: Args) => void;
873
- resetArgs?: (argNames?: string[]) => void;
874
- compact?: boolean;
875
- inAddonPanel?: boolean;
876
- initialExpandedArgs?: boolean;
877
- isLoading?: boolean;
878
- sort?: SortType;
879
- }
880
- interface ArgsTableDataProps {
881
- rows: ArgTypes;
882
- args?: Args;
883
- globals?: Globals;
884
- }
885
- interface ArgsTableErrorProps {
886
- error: ArgsTableError;
887
- }
888
- interface ArgsTableLoadingProps {
889
- isLoading: true;
890
- }
891
- declare const argsTableLoadingData: ArgsTableDataProps;
892
- declare type ArgsTableProps = ArgsTableOptionProps & (ArgsTableDataProps | ArgsTableErrorProps | ArgsTableLoadingProps);
893
- /**
894
- * Display the props for a component as a props table. Each row is a collection of
895
- * ArgDefs, usually derived from docgen info for the component.
896
- */
897
- declare const ArgsTable: FC<ArgsTableProps>;
898
-
899
- interface TabbedArgsTableProps {
900
- tabs: Record<string, ArgsTableProps>;
901
- sort?: SortType;
902
- }
903
- declare const TabbedArgsTable: FC<TabbedArgsTableProps>;
904
-
905
- declare const NoControlsWarning: () => JSX.Element;
906
-
907
- declare enum StoryError {
908
- NO_STORY = "No component or story to display"
909
- }
910
- interface CommonProps {
911
- title?: string;
912
- height?: string;
913
- id: string;
914
- }
915
- interface InlineStoryProps extends CommonProps {
916
- parameters: Parameters;
917
- storyFn: ElementType;
918
- }
919
- declare type IFrameStoryProps = CommonProps;
920
- declare type StoryProps = InlineStoryProps | IFrameStoryProps;
921
- /**
922
- * A story element, either rendered inline or in an iframe,
923
- * with configurable height.
924
- */
925
- declare const Story: FunctionComponent<StoryProps & {
926
- inline?: boolean;
927
- error?: StoryError;
928
- }>;
929
- declare const StorySkeleton: () => JSX.Element;
930
-
931
- interface IFrameProps {
932
- id: string;
933
- key?: string;
934
- title: string;
935
- src: string;
936
- allowFullScreen: boolean;
937
- scale: number;
938
- style?: any;
939
- }
940
- interface BodyStyle {
941
- width: string;
942
- height: string;
943
- transform: string;
944
- transformOrigin: string;
945
- }
946
- declare class IFrame extends Component<IFrameProps> {
947
- iframe: any;
948
- componentDidMount(): void;
949
- shouldComponentUpdate(nextProps: IFrameProps): boolean;
950
- setIframeBodyStyle(style: BodyStyle): any;
951
- render(): JSX.Element;
952
- }
953
-
954
- interface TypesetProps {
955
- fontFamily?: string;
956
- fontSizes: string[];
957
- fontWeight?: number;
958
- sampleText?: string;
959
- }
960
- /**
961
- * Convenient styleguide documentation showing examples of type
962
- * with different sizes and weights and configurable sample text.
963
- */
964
- declare const Typeset: FunctionComponent<TypesetProps>;
965
-
966
- declare type Colors = string[] | {
967
- [key: string]: string;
968
- };
969
- interface ColorItemProps {
970
- title: string;
971
- subtitle: string;
972
- colors: Colors;
973
- }
974
- /**
975
- * A single color row your styleguide showing title, subtitle and one or more colors, used
976
- * as a child of `ColorPalette`.
977
- */
978
- declare const ColorItem: FunctionComponent<ColorItemProps>;
979
- /**
980
- * Styleguide documentation for colors, including names, captions, and color swatches,
981
- * all specified as `ColorItem` children of this wrapper component.
982
- */
983
- declare const ColorPalette: FunctionComponent;
984
-
985
- interface IconItemProps {
986
- name: string;
987
- }
988
- /**
989
- * An individual icon with a caption and an example (passed as `children`).
990
- */
991
- declare const IconItem: FunctionComponent<IconItemProps>;
992
- /**
993
- * Show a grid of icons, as specified by `IconItem`.
994
- */
995
- declare const IconGallery: FunctionComponent;
996
-
997
- interface ControlProps<T> {
998
- name: string;
999
- value?: T;
1000
- defaultValue?: T;
1001
- argType?: ArgType;
1002
- onChange: (value: T) => T | void;
1003
- onFocus?: (evt: any) => void;
1004
- onBlur?: (evt: any) => void;
1005
- }
1006
- declare type BooleanValue = boolean;
1007
- interface BooleanConfig {
1008
- }
1009
- declare type ColorValue = string;
1010
- declare type PresetColor = ColorValue | {
1011
- color: ColorValue;
1012
- title?: string;
1013
- };
1014
- interface ColorConfig {
1015
- presetColors?: PresetColor[];
1016
- startOpen?: boolean;
1017
- }
1018
- declare type DateValue = Date | number;
1019
- interface DateConfig {
1020
- }
1021
- declare type NumberValue = number;
1022
- interface NumberConfig {
1023
- min?: number;
1024
- max?: number;
1025
- step?: number;
1026
- }
1027
- declare type RangeConfig = NumberConfig;
1028
- declare type ObjectValue = any;
1029
- interface ObjectConfig {
1030
- }
1031
- declare type OptionsSingleSelection = any;
1032
- declare type OptionsMultiSelection = any[];
1033
- declare type OptionsSelection = OptionsSingleSelection | OptionsMultiSelection;
1034
- declare type OptionsArray = any[];
1035
- declare type OptionsObject = Record<string, any>;
1036
- declare type Options = OptionsArray | OptionsObject;
1037
- declare type OptionsControlType = 'radio' | 'inline-radio' | 'check' | 'inline-check' | 'select' | 'multi-select';
1038
- interface OptionsConfig {
1039
- labels: Record<any, string>;
1040
- options: Options;
1041
- type: OptionsControlType;
1042
- }
1043
- interface NormalizedOptionsConfig {
1044
- options: OptionsObject;
1045
- }
1046
- declare type TextValue = string;
1047
- interface TextConfig {
1048
- }
1049
- declare type ControlType = 'array' | 'boolean' | 'color' | 'date' | 'number' | 'range' | 'object' | OptionsControlType | 'text';
1050
- declare type Control = BooleanConfig | ColorConfig | DateConfig | NumberConfig | ObjectConfig | OptionsConfig | RangeConfig | TextConfig;
1051
- declare type Controls = Record<string, Control>;
1052
-
1053
- declare type ColorControlProps = ControlProps<ColorValue> & ColorConfig;
1054
-
1055
- declare type BooleanProps = ControlProps<BooleanValue> & BooleanConfig;
1056
- declare const BooleanControl: FC<BooleanProps>;
1057
-
1058
- declare const parseDate: (value: string) => Date;
1059
- declare const parseTime: (value: string) => Date;
1060
- declare const formatDate: (value: Date | number) => string;
1061
- declare const formatTime: (value: Date | number) => string;
1062
- declare type DateProps = ControlProps<DateValue> & DateConfig;
1063
- declare const DateControl: FC<DateProps>;
1064
-
1065
- declare type NumberProps = ControlProps<NumberValue | null> & NumberConfig;
1066
- declare const parse: (value: string) => number;
1067
- declare const format: (value: NumberValue) => string;
1068
- declare const NumberControl: FC<NumberProps>;
1069
-
1070
- declare type OptionsProps = ControlProps<OptionsSelection> & OptionsConfig;
1071
- declare const OptionsControl: FC<OptionsProps>;
1072
-
1073
- declare type ObjectProps = ControlProps<ObjectValue> & ObjectConfig & {
1074
- theme: any;
1075
- };
1076
- declare const ObjectControl: FC<ObjectProps>;
1077
-
1078
- declare type RangeProps = ControlProps<NumberValue | null> & RangeConfig;
1079
- declare const RangeControl: FC<RangeProps>;
1080
-
1081
- declare type TextProps = ControlProps<TextValue | undefined> & TextConfig;
1082
- declare const TextControl: FC<TextProps>;
1083
-
1084
- interface FilesControlProps extends ControlProps<string[]> {
1085
- accept?: string;
1086
- }
1087
- declare const FilesControl: FunctionComponent<FilesControlProps>;
1088
-
1089
- declare type ColorProps = ColorControlProps;
1090
- declare const LazyColorControl: react__default.LazyExoticComponent<react__default.FC<ColorControlProps>>;
1091
- declare const ColorControl: (props: ComponentProps<typeof LazyColorControl>) => JSX.Element;
1092
-
1093
764
  declare const ProgressWrapper: _storybook_theming.StyledComponent<react__default.DetailedHTMLProps<react__default.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<react__default.ClassAttributes<HTMLDivElement> & react__default.HTMLAttributes<HTMLDivElement>, keyof react__default.HTMLAttributes<HTMLDivElement>>, _storybook_theming.Theme>;
1094
765
  interface Progress {
1095
766
  value: number;
@@ -1115,6 +786,22 @@ declare const nameSpaceClassNames: ({ ...props }: {
1115
786
  [x: string]: any;
1116
787
  };
1117
788
 
789
+ /**
790
+ * This is a "local" reset to style subtrees with Storybook styles
791
+ *
792
+ * We can't style individual elements (e.g. h1, h2, etc.) in here
793
+ * because the CSS specificity is too high, so those styles can too
794
+ * easily override child elements that are not expecting it.
795
+ */
796
+ declare const ResetWrapper: _storybook_theming.StyledComponent<react.DetailedHTMLProps<react.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}, _storybook_theming.Theme>;
797
+
798
+ declare const codeCommon: ({ theme }: {
799
+ theme: Theme;
800
+ }) => CSSObject;
801
+ declare const withReset: ({ theme }: {
802
+ theme: Theme;
803
+ }) => CSSObject;
804
+
1118
805
  declare const components: {
1119
806
  h1: (props: react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) => JSX.Element;
1120
807
  h2: (props: react.DetailedHTMLProps<react.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement>) => JSX.Element;
@@ -1141,4 +828,4 @@ declare const components: {
1141
828
  };
1142
829
  declare const resetComponents: Record<string, ElementType>;
1143
830
 
1144
- export { A, ActionBar, AddonPanel, ArgType, ArgTypes, Args, ArgsTable, ArgsTableDataProps, ArgsTableError, ArgsTableErrorProps, ArgsTableLoadingProps, ArgsTableOptionProps, ArgsTableProps, Badge, Bar, Blockquote, BooleanConfig, BooleanControl, BooleanProps, BooleanValue, Button, Code, ColorConfig, ColorControl, ColorItem, ColorPalette, ColorProps, ColorValue, Control, ControlProps, ControlType, Controls, DL, DateConfig, DateControl, DateProps, DateValue, Description, DescriptionProps, Div, DocsContent, DocsPageProps, DocsPageWrapper, DocsWrapper, DocumentWrapper, FilesControl, FilesControlProps, FlexBar, Form, Globals, H1, H2, H3, H4, H5, H6, HR, IFrame, IconButton, IconGallery, IconItem, Icons, IconsProps, Img, JsDocParam, JsDocReturns, JsDocTags, LI, Link$1 as Link, Loader, NoControlsWarning, NormalizedOptionsConfig, NumberConfig, NumberControl, NumberValue, OL, ObjectConfig, ObjectControl, ObjectProps, ObjectValue, Options, OptionsArray, OptionsConfig, OptionsControl, OptionsControlType, OptionsMultiSelection, OptionsObject, OptionsProps, OptionsSelection, OptionsSingleSelection, P, Placeholder, Pre, PresetColor, Preview, PreviewProps, PreviewSkeleton, PropDefaultValue, PropSummaryValue, PropType, RangeConfig, RangeControl, ScrollArea, Separator, SortType, Source, SourceError, SourceProps, Spaced, Span, Story, StoryError, StorySkeleton, StorybookIcon, StorybookLogo, StyledSyntaxHighlighter, Subtitle, Symbols, SyntaxHighlighter, SyntaxHighlighterFormatTypes, SyntaxHighlighterProps, SyntaxHighlighterRendererProps, TT, TabBar, TabButton, TabWrapper, TabbedArgsTable, TabbedArgsTableProps, Table, TableAnnotation, TableWrapper, Tabs, TabsState, TextConfig, TextControl, TextProps, TextValue, Title, TooltipLinkList, TooltipMessage, TooltipNote, Typeset, TypesetProps, UL, WithTooltip, WithTooltipPure, Zoom, argsTableLoadingData, components, format, formatDate, formatTime, getStoryHref, interleaveSeparators, nameSpaceClassNames, parse, parseDate, parseTime, resetComponents };
831
+ export { A, ActionBar, ActionItem, AddonPanel, Badge, Bar, Blockquote, Button, Code, DL, Div, DocumentWrapper, FlexBar, Form, H1, H2, H3, H4, H5, H6, HR, IconButton, IconButtonSkeleton, Icons, IconsProps, Img, LI, Link$1 as Link, Loader, OL, P, Placeholder, Pre, ResetWrapper, ScrollArea, Separator, Spaced, Span, StorybookIcon, StorybookLogo, Symbols, SyntaxHighlighter, SyntaxHighlighterFormatTypes, SyntaxHighlighterProps, SyntaxHighlighterRendererProps, TT, TabBar, TabButton, TabWrapper, Table, Tabs, TabsState, TooltipLinkList, TooltipMessage, TooltipNote, UL, WithTooltip, WithTooltipPure, Zoom, codeCommon, components, createCopyToClipboardFunction, getStoryHref, interleaveSeparators, nameSpaceClassNames, resetComponents, withReset };