@storybook/react-native 8.5.3 → 8.5.4

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
@@ -1,5 +1,5 @@
1
1
  import * as _storybook_core_types from '@storybook/core/types';
2
- import { StoryIndex, PreparedStory, NormalizedStoriesSpecifier, StorybookConfig as StorybookConfig$1 } from '@storybook/core/types';
2
+ import { StoryIndex, PreparedStory, NormalizedStoriesSpecifier, Addon_StorySortParameterV7, StorybookConfig as StorybookConfig$1 } from '@storybook/core/types';
3
3
  import { ReactRenderer } from '@storybook/react';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
  import { Channel } from '@storybook/core/channels';
@@ -67,13 +67,17 @@ interface ReactNativeOptions {
67
67
  */
68
68
  playFn?: boolean;
69
69
  }
70
- declare function prepareStories({ storyEntries, options, }: {
70
+ declare function prepareStories({ storyEntries, options, storySort, }: {
71
71
  storyEntries: Array<NormalizedStoriesSpecifier & {
72
72
  req: any;
73
73
  }>;
74
74
  options?: ReactNativeOptions;
75
+ storySort?: Addon_StorySortParameterV7;
75
76
  }): {
76
- index: StoryIndex;
77
+ index: {
78
+ v: number;
79
+ entries: Record<string, _storybook_core_types.IndexEntry>;
80
+ };
77
81
  importMap: Record<string, any>;
78
82
  };
79
83
  declare const getProjectAnnotations: (view: View, annotations: any[]) => () => Promise<_storybook_core_types.NormalizedProjectAnnotations<ReactRenderer>>;
package/dist/index.js CHANGED
@@ -813,6 +813,7 @@ var StoryView = () => {
813
813
  {
814
814
  style: containerStyle,
815
815
  testID: id,
816
+ accessibilityLabel: id,
816
817
  onStartShouldSetResponder: dismissOnStartResponder,
817
818
  children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ErrorBoundary, { onError, children: StoryComponent && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StoryComponent, { ...context }) })
818
819
  },
@@ -1070,10 +1071,11 @@ if (import_react_native4.Platform.OS === "web" && typeof globalThis.setImmediate
1070
1071
  }
1071
1072
  function prepareStories({
1072
1073
  storyEntries,
1073
- options
1074
+ options,
1075
+ storySort
1074
1076
  }) {
1075
1077
  let index = {
1076
- v: 4,
1078
+ v: 5,
1077
1079
  entries: {}
1078
1080
  };
1079
1081
  let importMap = {};
@@ -1148,7 +1150,17 @@ function prepareStories({
1148
1150
  }
1149
1151
  });
1150
1152
  });
1151
- return { index, importMap };
1153
+ const sortableStories = Object.values(index.entries);
1154
+ (0, import_preview_api2.sortStoriesV7)(
1155
+ sortableStories,
1156
+ storySort,
1157
+ Object.values(index.entries).map((entry) => entry.importPath)
1158
+ );
1159
+ const sorted = sortableStories.reduce((acc, item) => {
1160
+ acc[item.id] = item;
1161
+ return acc;
1162
+ }, {});
1163
+ return { index: { v: 5, entries: sorted }, importMap };
1152
1164
  }
1153
1165
  var getProjectAnnotations = (view, annotations) => async () => (0, import_preview_api2.composeConfigs)([
1154
1166
  {
@@ -1172,7 +1184,12 @@ function start({
1172
1184
  storyEntries,
1173
1185
  options
1174
1186
  }) {
1175
- const { index, importMap } = prepareStories({ storyEntries, options });
1187
+ const composedAnnotations = (0, import_preview_api2.composeConfigs)(annotations);
1188
+ const { index, importMap } = prepareStories({
1189
+ storyEntries,
1190
+ options,
1191
+ storySort: composedAnnotations.parameters?.options?.storySort
1192
+ });
1176
1193
  const channel = (0, import_channels2.createBrowserChannel)({ page: "preview" });
1177
1194
  import_manager_api2.addons.setChannel(channel);
1178
1195
  import_preview_api2.addons.setChannel(channel);
@@ -1243,7 +1260,13 @@ function start({
1243
1260
  return view;
1244
1261
  }
1245
1262
  function updateView(viewInstance, annotations, normalizedStories, options) {
1246
- const { importMap, index } = prepareStories({ storyEntries: normalizedStories, options });
1263
+ const composedAnnotations = (0, import_preview_api2.composeConfigs)(annotations);
1264
+ const storySort = composedAnnotations.parameters?.options?.storySort;
1265
+ const { importMap, index } = prepareStories({
1266
+ storyEntries: normalizedStories,
1267
+ options,
1268
+ storySort
1269
+ });
1247
1270
  viewInstance._preview.onStoriesChanged({
1248
1271
  importFn: async (importPath) => importMap[importPath]
1249
1272
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native",
3
- "version": "8.5.3",
3
+ "version": "8.5.4",
4
4
  "description": "A better way to develop React Native Components for your app",
5
5
  "keywords": [
6
6
  "react",
@@ -49,8 +49,8 @@
49
49
  "@storybook/csf": "^0.1.13",
50
50
  "@storybook/global": "^5.0.0",
51
51
  "@storybook/react": "^8.5.1",
52
- "@storybook/react-native-theming": "^8.5.3",
53
- "@storybook/react-native-ui": "^8.5.3",
52
+ "@storybook/react-native-theming": "^8.5.4",
53
+ "@storybook/react-native-ui": "^8.5.4",
54
54
  "commander": "^8.2.0",
55
55
  "dedent": "^1.5.1",
56
56
  "deepmerge": "^4.3.0",
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "2d73f40145234a3ab4bdbabb6d63136fc59a17d9"
91
+ "gitHead": "bd630c52410fd1d6090e9bb52ecb7ea269e556b8"
92
92
  }