@storybook/react-native-ui 8.0.0-alpha.3 → 8.2.0-alpha.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 CHANGED
@@ -3,11 +3,12 @@ import * as react_native from 'react-native';
3
3
  import { PressableProps, View, Text, TouchableOpacityProps, TouchableOpacity } from 'react-native';
4
4
  import * as React$1 from 'react';
5
5
  import React__default, { FC, ComponentProps, ReactElement, PropsWithChildren, ReactNode } from 'react';
6
- import { State, StoriesHash, API } from '@storybook/manager-api';
6
+ import { State, StoriesHash, API } from '@storybook/core/manager-api';
7
+ import { API_StatusState, API_StatusValue, API_LoadedRefData, Addon_SidebarTopType, Addon_SidebarBottomType, API_IndexHash, StoryContext, Args, API_PreparedStoryIndex, StoryIndexV2, StoryIndexV3, API_Provider, DocsOptions } from '@storybook/core/types';
7
8
  import * as Fuse from 'fuse.js';
8
9
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
10
  import { SvgProps } from 'react-native-svg';
10
- import { R } from './types-bf5e6555.js';
11
+ import { ReactRenderer } from '@storybook/react';
11
12
 
12
13
  interface NodeProps$1 {
13
14
  children: React__default.ReactNode | React__default.ReactNode[];
@@ -47,278 +48,6 @@ interface ExpandAction {
47
48
  value: boolean;
48
49
  }
49
50
 
50
- declare global {
51
- interface SymbolConstructor {
52
- readonly observable: symbol;
53
- }
54
- }
55
-
56
- interface SBBaseType {
57
- required?: boolean;
58
- raw?: string;
59
- }
60
- type SBScalarType = SBBaseType & {
61
- name: 'boolean' | 'string' | 'number' | 'function' | 'symbol';
62
- };
63
- type SBArrayType = SBBaseType & {
64
- name: 'array';
65
- value: SBType;
66
- };
67
- type SBObjectType = SBBaseType & {
68
- name: 'object';
69
- value: Record<string, SBType>;
70
- };
71
- type SBEnumType = SBBaseType & {
72
- name: 'enum';
73
- value: (string | number)[];
74
- };
75
- type SBIntersectionType = SBBaseType & {
76
- name: 'intersection';
77
- value: SBType[];
78
- };
79
- type SBUnionType = SBBaseType & {
80
- name: 'union';
81
- value: SBType[];
82
- };
83
- type SBOtherType = SBBaseType & {
84
- name: 'other';
85
- value: string;
86
- };
87
- type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType;
88
-
89
- type StoryId = string;
90
- type ComponentId = string;
91
- type ComponentTitle = string;
92
- type StoryName = string;
93
- type Tag$1 = string;
94
- interface StoryIdentifier {
95
- componentId: ComponentId;
96
- title: ComponentTitle;
97
- /** @deprecated */
98
- kind: ComponentTitle;
99
- id: StoryId;
100
- name: StoryName;
101
- /** @deprecated */
102
- story: StoryName;
103
- tags: Tag$1[];
104
- }
105
- interface Parameters {
106
- [name: string]: any;
107
- }
108
- type ConditionalTest = {
109
- truthy?: boolean;
110
- } | {
111
- exists: boolean;
112
- } | {
113
- eq: any;
114
- } | {
115
- neq: any;
116
- };
117
- type ConditionalValue = {
118
- arg: string;
119
- } | {
120
- global: string;
121
- };
122
- type Conditional = ConditionalValue & ConditionalTest;
123
- interface InputType {
124
- name?: string;
125
- description?: string;
126
- defaultValue?: any;
127
- type?: SBType | SBScalarType['name'];
128
- if?: Conditional;
129
- [key: string]: any;
130
- }
131
- interface StrictInputType extends InputType {
132
- name: string;
133
- type?: SBType;
134
- }
135
- interface Args {
136
- [name: string]: any;
137
- }
138
- type ArgTypes<TArgs = Args> = {
139
- [name in keyof TArgs]: InputType;
140
- };
141
- type StrictArgTypes<TArgs = Args> = {
142
- [name in keyof TArgs]: StrictInputType;
143
- };
144
- interface Globals {
145
- [name: string]: any;
146
- }
147
- type Renderer = {
148
- /** What is the type of the `component` annotation in this renderer? */
149
- component: unknown;
150
- /** What does the story function return in this renderer? */
151
- storyResult: unknown;
152
- /** What type of element does this renderer render to? */
153
- canvasElement: unknown;
154
- T?: unknown;
155
- };
156
- interface StoryContextForEnhancers<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryIdentifier {
157
- component?: (TRenderer & {
158
- T: any;
159
- })['component'];
160
- subcomponents?: Record<string, (TRenderer & {
161
- T: any;
162
- })['component']>;
163
- parameters: Parameters;
164
- initialArgs: TArgs;
165
- argTypes: StrictArgTypes<TArgs>;
166
- }
167
- interface StoryContextUpdate<TArgs = Args> {
168
- args?: TArgs;
169
- globals?: Globals;
170
- [key: string]: any;
171
- }
172
- type ViewMode$1 = 'story' | 'docs';
173
- interface StoryContextForLoaders<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContextForEnhancers<TRenderer, TArgs>, Required<StoryContextUpdate<TArgs>> {
174
- hooks: unknown;
175
- viewMode: ViewMode$1;
176
- originalStoryFn: StoryFn<TRenderer>;
177
- }
178
- interface StoryContext<TRenderer extends Renderer = Renderer, TArgs = Args> extends StoryContextForLoaders<TRenderer, TArgs> {
179
- loaded: Record<string, any>;
180
- abortSignal: AbortSignal;
181
- canvasElement: TRenderer['canvasElement'];
182
- }
183
- type LegacyStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (context: StoryContext<TRenderer, TArgs>) => TRenderer['storyResult'];
184
- type ArgsStoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = (args: TArgs, context: StoryContext<TRenderer, TArgs>) => (TRenderer & {
185
- T: TArgs;
186
- })['storyResult'];
187
- type StoryFn<TRenderer extends Renderer = Renderer, TArgs = Args> = LegacyStoryFn<TRenderer, TArgs> | ArgsStoryFn<TRenderer, TArgs>;
188
-
189
- interface API_BaseEntry {
190
- id: StoryId;
191
- depth: number;
192
- name: string;
193
- refId?: string;
194
- renderLabel?: (item: API_BaseEntry) => any;
195
- }
196
- interface API_RootEntry extends API_BaseEntry {
197
- type: 'root';
198
- startCollapsed?: boolean;
199
- children: StoryId[];
200
- }
201
- interface API_GroupEntry extends API_BaseEntry {
202
- type: 'group';
203
- parent?: StoryId;
204
- children: StoryId[];
205
- }
206
- interface API_ComponentEntry extends API_BaseEntry {
207
- type: 'component';
208
- parent?: StoryId;
209
- children: StoryId[];
210
- }
211
- interface API_DocsEntry extends API_BaseEntry {
212
- type: 'docs';
213
- parent: StoryId;
214
- title: ComponentTitle;
215
- importPath: Path;
216
- tags: Tag$1[];
217
- prepared: boolean;
218
- parameters?: {
219
- [parameterName: string]: any;
220
- };
221
- }
222
- interface API_StoryEntry extends API_BaseEntry {
223
- type: 'story';
224
- parent: StoryId;
225
- title: ComponentTitle;
226
- importPath: Path;
227
- tags: Tag$1[];
228
- prepared: boolean;
229
- parameters?: {
230
- [parameterName: string]: any;
231
- };
232
- args?: Args;
233
- argTypes?: ArgTypes;
234
- initialArgs?: Args;
235
- }
236
- type API_HashEntry = API_RootEntry | API_GroupEntry | API_ComponentEntry | API_DocsEntry | API_StoryEntry;
237
- /**
238
- * The `IndexHash` is our manager-side representation of the `StoryIndex`.
239
- * We create entries in the hash not only for each story or docs entry, but
240
- * also for each "group" of the component (split on '/'), as that's how things
241
- * are manipulated in the manager (i.e. in the sidebar)
242
- */
243
- interface API_IndexHash {
244
- [id: string]: API_HashEntry;
245
- }
246
- type API_StatusValue = 'pending' | 'success' | 'error' | 'warn' | 'unknown';
247
- interface API_StatusObject {
248
- status: API_StatusValue;
249
- title: string;
250
- description: string;
251
- data?: any;
252
- }
253
- type API_StatusState = Record<StoryId, Record<string, API_StatusObject>>;
254
- interface API_LoadedRefData {
255
- index?: API_IndexHash;
256
- indexError?: Error;
257
- previewInitialized: boolean;
258
- }
259
- interface Addon_SidebarBottomType {
260
- type: Addon_TypesEnum.experimental_SIDEBAR_BOTTOM;
261
- /**
262
- * The unique id of the tool.
263
- */
264
- id: string;
265
- /**
266
- * A React.FunctionComponent.
267
- */
268
- render: FC;
269
- }
270
- interface Addon_SidebarTopType {
271
- type: Addon_TypesEnum.experimental_SIDEBAR_TOP;
272
- /**
273
- * The unique id of the tool.
274
- */
275
- id: string;
276
- /**
277
- * A React.FunctionComponent.
278
- */
279
- render: FC;
280
- }
281
- declare enum Addon_TypesEnum {
282
- /**
283
- * This API is used to create a tab the toolbar above the canvas, This API might be removed in the future.
284
- * @unstable
285
- */
286
- TAB = "tab",
287
- /**
288
- * This adds panels to the addons side panel.
289
- */
290
- PANEL = "panel",
291
- /**
292
- * This adds items in the toolbar above the canvas - on the left side.
293
- */
294
- TOOL = "tool",
295
- /**
296
- * This adds items in the toolbar above the canvas - on the right side.
297
- */
298
- TOOLEXTRA = "toolextra",
299
- /**
300
- * This adds wrapper components around the canvas/iframe component storybook renders.
301
- * @unstable this API is not stable yet, and is likely to change in 8.0.
302
- */
303
- PREVIEW = "preview",
304
- /**
305
- * This adds pages that render instead of the canvas.
306
- * @unstable
307
- */
308
- experimental_PAGE = "page",
309
- /**
310
- * This adds items in the bottom of the sidebar.
311
- * @unstable
312
- */
313
- experimental_SIDEBAR_BOTTOM = "sidebar-bottom",
314
- /**
315
- * This adds items in the top of the sidebar.
316
- * @unstable This will get replaced with a new API in 8.0, use at your own risk.
317
- */
318
- experimental_SIDEBAR_TOP = "sidebar-top"
319
- }
320
- type Path = string;
321
-
322
51
  type Refs = State['refs'];
323
52
  type RefType = Refs[keyof Refs] & {
324
53
  status?: API_StatusState;
@@ -385,7 +114,6 @@ interface NodeProps {
385
114
  setFullyExpanded?: () => void;
386
115
  onSelectStoryId: (itemId: string) => void;
387
116
  status: State['status'][keyof State['status']];
388
- api: API;
389
117
  }
390
118
  declare const Node: React__default.NamedExoticComponent<NodeProps>;
391
119
  declare const LeafNodeStyleWrapper: _storybook_react_native_theming.StyledComponent<react_native.ViewProps & {
@@ -477,16 +205,20 @@ interface SidebarProps extends API_LoadedRefData {
477
205
  }
478
206
  declare const Sidebar: React__default.NamedExoticComponent<SidebarProps>;
479
207
 
480
- declare global {
481
- interface SymbolConstructor {
482
- readonly observable: symbol;
483
- }
484
- }
485
-
486
208
  declare const Layout: ({ storyHash, story, children, }: {
487
209
  storyHash: API_IndexHash | undefined;
488
- story?: StoryContext<R, Args>;
210
+ story?: StoryContext<ReactRenderer, Args>;
489
211
  children: ReactNode | ReactNode[];
490
212
  }) => react_jsx_runtime.JSX.Element;
491
213
 
492
- export { Button, ButtonIcon, ButtonProps, ButtonText, CombinedDataset, ComponentNode, Dataset, ExpandType, Explorer, ExplorerProps, GetSearchItemProps, GroupNode, Highlight, IconButton, Item, ItemRef, Layout, LayoutProvider, LeafNodeStyleWrapper, Node, NodeProps$1 as NodeProps, RefType, Refs, RootNode, RootNodeText, SearchChildrenFn, SearchItem, SearchResult, SearchResultProps, Selection, Sidebar, SidebarProps, StoryNode, StoryRef, Tree, isExpandType, useCombination, useLayout };
214
+ type ToStoriesHashOptions = {
215
+ provider: API_Provider<API>;
216
+ docsOptions: DocsOptions;
217
+ filters: State['filters'];
218
+ status: State['status'];
219
+ };
220
+ declare const transformStoryIndexToStoriesHash: (input: API_PreparedStoryIndex | StoryIndexV2 | StoryIndexV3, { provider, docsOptions, filters, status }: ToStoriesHashOptions) => API_IndexHash | any;
221
+ declare const transformStoryIndexV2toV3: (index: StoryIndexV2) => StoryIndexV3;
222
+ declare const transformStoryIndexV3toV4: (index: StoryIndexV3) => API_PreparedStoryIndex;
223
+
224
+ export { Button, ButtonIcon, ButtonProps, ButtonText, CombinedDataset, ComponentNode, Dataset, ExpandType, Explorer, ExplorerProps, GetSearchItemProps, GroupNode, Highlight, IconButton, Item, ItemRef, Layout, LayoutProvider, LeafNodeStyleWrapper, Node, NodeProps$1 as NodeProps, RefType, Refs, RootNode, RootNodeText, SearchChildrenFn, SearchItem, SearchResult, SearchResultProps, Selection, Sidebar, SidebarProps, StoryNode, StoryRef, Tree, isExpandType, transformStoryIndexToStoriesHash, transformStoryIndexV2toV3, transformStoryIndexV3toV4, useCombination, useLayout };