import { DependencyList, Dispatch, FC, PropsWithChildren, ReactElement, ReactNode, SetStateAction, SyntheticEvent } from "react"; import { ImageStyle, PressableProps, StyleProp, TextStyle, TouchableOpacityProps, ViewStyle } from "react-native"; import { Args, StoryContext } from "storybook/internal/csf"; import { ReactRenderer } from "@storybook/react"; import { Theme } from "@storybook/react-native-theming"; import { API, IndexHash, State, StoriesHash } from "storybook/manager-api"; import { API_IndexHash, API_PreparedStoryIndex, API_Provider, DocsOptions, StatusValue, StatusesByStoryIdAndTypeId, StoryIndexV2, StoryIndexV3 } from "storybook/internal/types"; //#region src/Button.d.ts interface ButtonProps extends TouchableOpacityProps { asChild?: boolean; size?: 'small' | 'medium'; padding?: 'small' | 'medium'; variant?: 'outline' | 'solid' | 'ghost'; disabled?: boolean; active?: boolean; animation?: 'none' | 'rotate360' | 'glow' | 'jiggle'; text?: string; Icon?: (props: { color: string; }) => ReactElement; } declare const Button: import("react").ForwardRefExoticComponent>; declare const ButtonText: import("@storybook/react-native-theming").StyledComponent; }>; declare const ButtonIcon: ({ Icon, active, variant }: { Icon: (props: { color: string; }) => ReactElement; variant: ButtonProps["variant"]; active: ButtonProps["active"]; }) => import("react/jsx-runtime").JSX.Element; //#endregion //#region src/IconButton.d.ts declare const IconButton: import("react").ForwardRefExoticComponent>; //#endregion //#region src/LayoutProvider.d.ts type LayoutContextType = { isDesktop: boolean; isMobile: boolean; }; declare const LayoutProvider: FC; declare const useLayout: () => LayoutContextType; //#endregion //#region src/StorageProvider.d.ts interface Storage { getItem: (key: string) => Promise | string | null; setItem: (key: string, value: string) => Promise | void; } declare const StorageProvider: FC>; declare const useStorage: () => Storage; //#endregion //#region src/types.d.ts type HighlightRange = [number, number]; type HighlightRanges = HighlightRange[]; type Refs = State['refs']; type RefType = Refs[keyof Refs] & { allStatuses?: StatusesByStoryIdAndTypeId; }; type Item = StoriesHash[keyof StoriesHash]; type Dataset = Record; interface CombinedDataset { hash: Refs; entries: [string, RefType][]; } interface ItemRef { itemId: string; refId: string; } interface StoryRef { storyId: string; refId: string; } type Highlight = ItemRef | null; type Selection = StoryRef | null; declare function isExpandType(x: any): x is ExpandType; interface ExpandType { showAll: () => void; totalCount: number; moreCount: number; } type SearchItem = Item & { refId: string; path: string[]; status?: StatusValue; showAll?: () => void; }; interface SearchResult { item: SearchItem; score: number | null; matches: HighlightRanges[]; } type SearchResultProps = SearchResult & { icon: string; isHighlighted: boolean; onPress: PressableProps['onPress']; }; type GetSearchItemProps = (args: { item: SearchResult; index: number; key: string; }) => SearchResultProps; type SearchChildrenFn = (args: { query: string; results: SearchResult[]; isBrowsing: boolean; closeMenu: (cb?: () => void) => void; getItemProps: GetSearchItemProps; highlightedIndex: number | null; }) => ReactNode; type SBUI = (props: { story?: StoryContext; storyHash: API_IndexHash; setStory: (storyId: string) => void; storage: Storage; theme: Theme; storyBackgroundColor?: string; children: ReactElement; }) => ReactElement; //#endregion //#region src/util/StoryHash.d.ts type ToStoriesHashOptions = { provider: API_Provider; docsOptions: DocsOptions; filters: State['filters']; allStatuses: StatusesByStoryIdAndTypeId; }; declare const intersect: (a: T[], b: T[]) => T[]; declare const merge: (a: TObj, ...b: Partial[]) => TObj; declare const noArrayMerge: (a: TObj, ...b: Partial[]) => TObj; declare const transformStoryIndexToStoriesHash: (input: API_PreparedStoryIndex | StoryIndexV2 | StoryIndexV3, { provider, docsOptions, filters, allStatuses }: ToStoriesHashOptions) => API_IndexHash | any; declare const transformStoryIndexV2toV3: (index: StoryIndexV2) => StoryIndexV3; declare const transformStoryIndexV3toV4: (index: StoryIndexV3) => API_PreparedStoryIndex; declare const transformStoryIndexV4toV5: (index: API_PreparedStoryIndex) => API_PreparedStoryIndex; //#endregion //#region src/util/tree.d.ts declare const createId: (itemId: string, refId?: string) => string; declare const prevent: (e: SyntheticEvent) => boolean; declare const get: (id: string, dataset: Dataset) => Item; declare const getParent: (id: string, dataset: Dataset) => Item; declare const getParents: (id: string, dataset: Dataset) => Item[]; declare const getAncestorIds: (data: IndexHash, id: string | null) => string[]; declare const getDescendantIds: (data: IndexHash, id: string, skipLeafs: boolean) => string[]; declare function getPath(item: Item, ref: RefType): string[]; declare const searchItem: (item: Item, ref: RefType) => SearchItem; declare function cycle(array: T[], index: number, delta: number): number; declare const getStateType: (isLoading: boolean, isAuthRequired: boolean, isError: boolean, isEmpty: boolean) => "auth" | "error" | "loading" | "empty" | "ready"; type ElementLike = { parentElement?: ElementLike | null; }; declare const isAncestor: (element?: ElementLike | null, maybeAncestor?: ElementLike | null) => boolean; declare const removeNoiseFromName: (storyName: string) => string; declare const isStoryHoistable: (storyName: string, componentName: string) => boolean; //#endregion //#region src/util/useStyle.d.ts /** * A hook to memoize a style. Uses `ViewStyle` per default, but can be used with other styles deriving from `FlexStyle` as well, such as `TextStyle`. * @param styleFactory The function that returns a style * @param deps The dependencies to trigger memoization re-evaluation * @see ["Memoize!!! 💾 - a react (native) performance guide"](https://gist.github.com/mrousavy/0de7486814c655de8a110df5cef74ddc) * @example * * // simple object styles * const style1 = useStyle(() => ({ height: someDynamicValue }), [someDynamicValue]) * * // array styles * const style2 = useStyle( * () => [styles.container, props.style, { height: someDynamicValue }], * [props.style, someDynamicValue] * ); */ declare const useStyle: >(styleFactory: () => TOutput, deps?: DependencyList) => TOutput; //#endregion //#region src/util/string.d.ts declare function startCase(str: string): string; //#endregion //#region src/hooks/useExpanded.d.ts type ExpandedState = Record; interface ExpandAction { ids: string[]; value: boolean; } interface ExpandedProps { refId: string; data: StoriesHash; initialExpanded?: ExpandedState; rootIds: string[]; selectedStoryId: string | null; onSelectStoryId: (storyId: string) => void; } declare const useExpanded: ({ refId, data, initialExpanded, rootIds, selectedStoryId }: ExpandedProps) => [ExpandedState, Dispatch]; //#endregion //#region src/hooks/useLastViewed.d.ts declare const useLastViewed: (selection: Selection) => { getLastViewed: () => StoryRef[]; clearLastViewed: () => void; }; //#endregion //#region src/hooks/useStoreState.d.ts declare const useStoreBooleanState: (key: string, defaultValue: boolean) => [boolean, Dispatch>]; declare const useStoreNumberState: (key: string, defaultValue: number) => [number, (value: number | ((prev: number) => number)) => void]; //#endregion export { Button, ButtonIcon, ButtonProps, ButtonText, CombinedDataset, Dataset, ExpandAction, ExpandType, ExpandedProps, ExpandedState, GetSearchItemProps, Highlight, HighlightRange, HighlightRanges, IconButton, Item, ItemRef, LayoutProvider, RefType, Refs, SBUI, SearchChildrenFn, SearchItem, SearchResult, SearchResultProps, Selection, Storage, StorageProvider, StoryRef, createId, cycle, get, getAncestorIds, getDescendantIds, getParent, getParents, getPath, getStateType, intersect, isAncestor, isExpandType, isStoryHoistable, merge, noArrayMerge, prevent, removeNoiseFromName, searchItem, startCase, transformStoryIndexToStoriesHash, transformStoryIndexV2toV3, transformStoryIndexV3toV4, transformStoryIndexV4toV5, useExpanded, useLastViewed, useLayout, useStorage, useStoreBooleanState, useStoreNumberState, useStyle };