@storybook/react-native-ui-common 10.2.0 → 10.2.2-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
@@ -7,7 +7,6 @@ import * as react_native from 'react-native';
7
7
  import { TouchableOpacityProps, PressableProps, ViewStyle, TextStyle, ImageStyle, StyleProp } from 'react-native';
8
8
  import { StoryContext, Args } from 'storybook/internal/csf';
9
9
  import { ReactRenderer } from '@storybook/react';
10
- import * as Fuse from 'fuse.js';
11
10
  import { State, StoriesHash, API, IndexHash } from 'storybook/manager-api';
12
11
  import { StatusesByStoryIdAndTypeId, StatusValue, API_IndexHash, API_PreparedStoryIndex, StoryIndexV2, StoryIndexV3, API_Provider, DocsOptions } from 'storybook/internal/types';
13
12
 
@@ -60,6 +59,8 @@ declare const StorageProvider: FC<PropsWithChildren<{
60
59
  }>>;
61
60
  declare const useStorage: () => Storage;
62
61
 
62
+ type HighlightRange = [number, number];
63
+ type HighlightRanges = HighlightRange[];
63
64
  type Refs = State['refs'];
64
65
  type RefType = Refs[keyof Refs] & {
65
66
  allStatuses?: StatusesByStoryIdAndTypeId;
@@ -92,7 +93,11 @@ type SearchItem = Item & {
92
93
  status?: StatusValue;
93
94
  showAll?: () => void;
94
95
  };
95
- type SearchResult = Fuse.FuseResult<SearchItem>;
96
+ interface SearchResult {
97
+ item: SearchItem;
98
+ score: number | null;
99
+ matches: HighlightRanges[];
100
+ }
96
101
  type SearchResultProps = SearchResult & {
97
102
  icon: string;
98
103
  isHighlighted: boolean;
@@ -189,4 +194,4 @@ declare const useLastViewed: (selection: Selection) => {
189
194
 
190
195
  declare const useStoreBooleanState: (key: string, defaultValue: boolean) => ReturnType<typeof useState<boolean>>;
191
196
 
192
- export { Button, ButtonIcon, type ButtonProps, ButtonText, type CombinedDataset, type Dataset, type ExpandAction, type ExpandType, type ExpandedProps, type ExpandedState, type GetSearchItemProps, type Highlight, IconButton, type Item, type ItemRef, LayoutProvider, type RefType, type Refs, type SBUI, type SearchChildrenFn, type SearchItem, type SearchResult, type SearchResultProps, type Selection, type Storage, StorageProvider, type StoryRef, createId, cycle, get, getAncestorIds, getDescendantIds, getParent, getParents, getPath, getStateType, intersect, isAncestor, isExpandType, isStoryHoistable, merge, noArrayMerge, prevent, removeNoiseFromName, searchItem, transformStoryIndexToStoriesHash, transformStoryIndexV2toV3, transformStoryIndexV3toV4, transformStoryIndexV4toV5, useExpanded, useLastViewed, useLayout, useStorage, useStoreBooleanState, useStyle };
197
+ export { Button, ButtonIcon, type ButtonProps, ButtonText, type CombinedDataset, type Dataset, type ExpandAction, type ExpandType, type ExpandedProps, type ExpandedState, type GetSearchItemProps, type Highlight, type HighlightRange, type HighlightRanges, IconButton, type Item, type ItemRef, LayoutProvider, type RefType, type Refs, type SBUI, type SearchChildrenFn, type SearchItem, type SearchResult, type SearchResultProps, type Selection, type Storage, StorageProvider, type StoryRef, createId, cycle, get, getAncestorIds, getDescendantIds, getParent, getParents, getPath, getStateType, intersect, isAncestor, isExpandType, isStoryHoistable, merge, noArrayMerge, prevent, removeNoiseFromName, searchItem, transformStoryIndexToStoriesHash, transformStoryIndexV2toV3, transformStoryIndexV3toV4, transformStoryIndexV4toV5, useExpanded, useLastViewed, useLayout, useStorage, useStoreBooleanState, useStyle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native-ui-common",
3
- "version": "10.2.0",
3
+ "version": "10.2.2-alpha.0",
4
4
  "description": "common ui components for react native storybook",
5
5
  "keywords": [
6
6
  "react",
@@ -37,10 +37,10 @@
37
37
  "typescript": "~5.9.3"
38
38
  },
39
39
  "dependencies": {
40
- "@storybook/react": "10.2.0-beta.1",
41
- "@storybook/react-native-theming": "^10.2.0",
40
+ "@nozbe/microfuzz": "^1.0.0",
41
+ "@storybook/react": "^10.2.2",
42
+ "@storybook/react-native-theming": "^10.2.2-alpha.0",
42
43
  "es-toolkit": "^1.41.0",
43
- "fuse.js": "^7.1.0",
44
44
  "memoizerific": "^1.11.3",
45
45
  "ts-dedent": "^2.2.0"
46
46
  },
@@ -55,5 +55,5 @@
55
55
  "publishConfig": {
56
56
  "access": "public"
57
57
  },
58
- "gitHead": "eca4a572e630d6536b62685bdd62114994c7515d"
58
+ "gitHead": "5e99a2f9de73aa3b88e6517f1016e933cac67c19"
59
59
  }
package/src/types.ts CHANGED
@@ -2,7 +2,6 @@ import type { Args, StoryContext } from 'storybook/internal/csf';
2
2
  import type { ReactRenderer } from '@storybook/react';
3
3
  import { Theme } from '@storybook/react-native-theming';
4
4
  import { Storage } from './StorageProvider';
5
- import * as Fuse from 'fuse.js';
6
5
  import { ReactElement, ReactNode } from 'react';
7
6
  import { PressableProps } from 'react-native';
8
7
  import type { State, StoriesHash } from 'storybook/manager-api';
@@ -12,6 +11,11 @@ import type {
12
11
  StatusValue,
13
12
  } from 'storybook/internal/types';
14
13
 
14
+ // Microfuzz highlight range: [startIndex, endIndex] (inclusive)
15
+ export type HighlightRange = [number, number];
16
+ // Array of highlight ranges per getText field
17
+ export type HighlightRanges = HighlightRange[];
18
+
15
19
  export type Refs = State['refs'];
16
20
  export type RefType = Refs[keyof Refs] & { allStatuses?: StatusesByStoryIdAndTypeId };
17
21
  export type Item = StoriesHash[keyof StoriesHash];
@@ -51,7 +55,13 @@ export type SearchItem = Item & {
51
55
  showAll?: () => void;
52
56
  };
53
57
 
54
- export type SearchResult = Fuse.FuseResult<SearchItem>;
58
+ // Native microfuzz result format
59
+ export interface SearchResult {
60
+ item: SearchItem;
61
+ score: number | null;
62
+ // matches[0] = name highlights, matches[1] = path highlights
63
+ matches: HighlightRanges[];
64
+ }
55
65
 
56
66
  export type SearchResultProps = SearchResult & {
57
67
  icon: string;
@@ -67,7 +77,7 @@ export type GetSearchItemProps = (args: {
67
77
 
68
78
  export type SearchChildrenFn = (args: {
69
79
  query: string;
70
- results: SearchResult[]; // TODO fix this type
80
+ results: SearchResult[];
71
81
  isBrowsing: boolean;
72
82
  closeMenu: (cb?: () => void) => void;
73
83
  getItemProps: GetSearchItemProps;