@storybook/react-native-ui 9.0.0-beta.9 → 9.0.0-rc.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 +295 -142
- package/dist/index.js +475 -4054
- package/package.json +7 -5
- package/src/Explorer.stories.tsx +1 -1
- package/src/Explorer.tsx +1 -1
- package/src/Layout.stories.tsx +1 -1
- package/src/Layout.tsx +44 -14
- package/src/MobileAddonsPanel.tsx +6 -6
- package/src/Refs.tsx +61 -61
- package/src/Search.tsx +5 -6
- package/src/SearchResults.tsx +9 -8
- package/src/SelectedNodeProvider.tsx +2 -1
- package/src/Sidebar.stories.tsx +1 -3
- package/src/Sidebar.tsx +2 -2
- package/src/Tree.stories.tsx +1 -1
- package/src/Tree.tsx +13 -8
- package/src/TreeNode.tsx +1 -2
- package/src/index.tsx +0 -6
- package/src/mockdata.large.ts +1 -1
- package/src/Button.stories.tsx +0 -134
- package/src/Button.tsx +0 -172
- package/src/IconButton.tsx +0 -10
- package/src/LayoutProvider.tsx +0 -32
- package/src/StorageProvider.tsx +0 -21
- package/src/hooks/useExpanded.ts +0 -64
- package/src/hooks/useLastViewed.ts +0 -48
- package/src/hooks/useStoreState.ts +0 -27
- package/src/types.ts +0 -66
- package/src/util/StoryHash.ts +0 -244
- package/src/util/status.tsx +0 -88
- package/src/util/tree.ts +0 -91
- package/src/util/useStyle.ts +0 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native-ui",
|
|
3
|
-
"version": "9.0.0-
|
|
3
|
+
"version": "9.0.0-rc.4",
|
|
4
4
|
"description": "ui components for react native storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -58,8 +58,10 @@
|
|
|
58
58
|
"typescript": "~5.8.3"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@storybook/react": "9.0.0-
|
|
62
|
-
"@storybook/react-native-theming": "^9.0.0-
|
|
61
|
+
"@storybook/react": "9.0.0-rc.4",
|
|
62
|
+
"@storybook/react-native-theming": "^9.0.0-rc.4",
|
|
63
|
+
"@storybook/react-native-ui-common": "^9.0.0-rc.4",
|
|
64
|
+
"es-toolkit": "^1.38.0",
|
|
63
65
|
"fuse.js": "^7.0.0",
|
|
64
66
|
"memoizerific": "^1.11.3",
|
|
65
67
|
"polished": "^4.3.1",
|
|
@@ -73,7 +75,7 @@
|
|
|
73
75
|
"react-native-reanimated": ">=3",
|
|
74
76
|
"react-native-safe-area-context": "*",
|
|
75
77
|
"react-native-svg": ">=14",
|
|
76
|
-
"storybook": "9.0.0-
|
|
78
|
+
"storybook": "9.0.0-rc.4"
|
|
77
79
|
},
|
|
78
80
|
"engines": {
|
|
79
81
|
"node": ">=18.0.0"
|
|
@@ -81,5 +83,5 @@
|
|
|
81
83
|
"publishConfig": {
|
|
82
84
|
"access": "public"
|
|
83
85
|
},
|
|
84
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "1d0249371caed6a6a90f42530d722040eb18c9dc"
|
|
85
87
|
}
|
package/src/Explorer.stories.tsx
CHANGED
package/src/Explorer.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
2
|
import React, { useRef } from 'react';
|
|
3
3
|
import { Ref } from './Refs';
|
|
4
|
-
import type { CombinedDataset, Selection } from '
|
|
4
|
+
import type { CombinedDataset, Selection } from '@storybook/react-native-ui-common';
|
|
5
5
|
import { View } from 'react-native';
|
|
6
6
|
|
|
7
7
|
export interface ExplorerProps {
|
package/src/Layout.stories.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { mockDataset } from './mockdata';
|
|
|
4
4
|
import { Text, View } from 'react-native';
|
|
5
5
|
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
6
6
|
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
7
|
-
import { LayoutProvider } from '
|
|
7
|
+
import { LayoutProvider } from '@storybook/react-native-ui-common';
|
|
8
8
|
|
|
9
9
|
const meta = {
|
|
10
10
|
component: Layout,
|
package/src/Layout.tsx
CHANGED
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { type API_IndexHash, type Args, type StoryContext } from 'storybook/internal/types';
|
|
1
|
+
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
2
|
+
import type { Args, StoryContext } from '@storybook/csf';
|
|
4
3
|
import type { ReactRenderer } from '@storybook/react';
|
|
5
|
-
import { styled, useTheme } from '@storybook/react-native-theming';
|
|
6
|
-
import {
|
|
4
|
+
import { styled, ThemeProvider, useTheme } from '@storybook/react-native-theming';
|
|
5
|
+
import {
|
|
6
|
+
IconButton,
|
|
7
|
+
LayoutProvider,
|
|
8
|
+
StorageProvider,
|
|
9
|
+
useLayout,
|
|
10
|
+
useStoreBooleanState,
|
|
11
|
+
useStyle,
|
|
12
|
+
type SBUI,
|
|
13
|
+
} from '@storybook/react-native-ui-common';
|
|
14
|
+
import { ReactNode, useCallback, useRef, useState } from 'react';
|
|
7
15
|
import { ScrollView, Text, TouchableOpacity, View, ViewStyle } from 'react-native';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { Sidebar } from './Sidebar';
|
|
14
|
-
import { StorybookLogo } from './StorybookLogo';
|
|
16
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
17
|
+
import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
18
|
+
import { SET_CURRENT_STORY } from 'storybook/internal/core-events';
|
|
19
|
+
import { addons } from 'storybook/internal/manager-api';
|
|
20
|
+
import type { API_IndexHash } from 'storybook/internal/types';
|
|
15
21
|
import { DEFAULT_REF_ID } from './constants';
|
|
16
|
-
import { useStoreBooleanState } from './hooks/useStoreState';
|
|
17
22
|
import { BottomBarToggleIcon } from './icon/BottomBarToggleIcon';
|
|
18
23
|
import { CloseFullscreenIcon } from './icon/CloseFullscreenIcon';
|
|
19
24
|
import { FullscreenIcon } from './icon/FullscreenIcon';
|
|
20
25
|
import { MenuIcon } from './icon/MenuIcon';
|
|
21
|
-
import {
|
|
26
|
+
import { AddonsTabs, MobileAddonsPanel, MobileAddonsPanelRef } from './MobileAddonsPanel';
|
|
27
|
+
import { MobileMenuDrawer, MobileMenuDrawerRef } from './MobileMenuDrawer';
|
|
22
28
|
import { SelectedNodeProvider } from './SelectedNodeProvider';
|
|
29
|
+
import { Sidebar } from './Sidebar';
|
|
30
|
+
import { StorybookLogo } from './StorybookLogo';
|
|
23
31
|
|
|
24
32
|
const desktopLogoContainer = {
|
|
25
33
|
flexDirection: 'row',
|
|
@@ -49,6 +57,28 @@ const mobileMenuDrawerContentStyle = {
|
|
|
49
57
|
paddingBottom: 4,
|
|
50
58
|
} satisfies ViewStyle;
|
|
51
59
|
|
|
60
|
+
const flex1 = { flex: 1 } satisfies ViewStyle;
|
|
61
|
+
|
|
62
|
+
export const FullUI: SBUI = ({ storage, theme, storyHash, story, children }) => {
|
|
63
|
+
return (
|
|
64
|
+
<ThemeProvider theme={theme}>
|
|
65
|
+
<SafeAreaProvider>
|
|
66
|
+
<GestureHandlerRootView style={flex1}>
|
|
67
|
+
<BottomSheetModalProvider>
|
|
68
|
+
<StorageProvider storage={storage}>
|
|
69
|
+
<LayoutProvider>
|
|
70
|
+
<Layout storyHash={storyHash} story={story}>
|
|
71
|
+
{children}
|
|
72
|
+
</Layout>
|
|
73
|
+
</LayoutProvider>
|
|
74
|
+
</StorageProvider>
|
|
75
|
+
</BottomSheetModalProvider>
|
|
76
|
+
</GestureHandlerRootView>
|
|
77
|
+
</SafeAreaProvider>
|
|
78
|
+
</ThemeProvider>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
52
82
|
export const Layout = ({
|
|
53
83
|
storyHash,
|
|
54
84
|
story,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BottomSheetModal } from '@gorhom/bottom-sheet';
|
|
2
2
|
import { addons } from 'storybook/internal/manager-api';
|
|
3
|
-
import { styled } from '@storybook/react-native-theming';
|
|
3
|
+
import { styled, useTheme } from '@storybook/react-native-theming';
|
|
4
4
|
import { Addon_TypesEnum } from 'storybook/internal/types';
|
|
5
5
|
import { forwardRef, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
6
6
|
import { Platform, StyleProp, Text, View, ViewStyle, useWindowDimensions } from 'react-native';
|
|
@@ -12,10 +12,8 @@ import Animated, {
|
|
|
12
12
|
useSharedValue,
|
|
13
13
|
} from 'react-native-reanimated';
|
|
14
14
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
15
|
-
import {
|
|
16
|
-
import { IconButton } from './IconButton';
|
|
15
|
+
import { IconButton, useStyle } from '@storybook/react-native-ui-common';
|
|
17
16
|
import { CloseIcon } from './icon/CloseIcon';
|
|
18
|
-
import { useStyle } from './util/useStyle';
|
|
19
17
|
|
|
20
18
|
export interface MobileAddonsPanelRef {
|
|
21
19
|
setAddonsPanelOpen: (isOpen: boolean) => void;
|
|
@@ -56,9 +54,9 @@ export const MobileAddonsPanel = forwardRef<MobileAddonsPanelRef, { storyId?: st
|
|
|
56
54
|
const { height } = useWindowDimensions();
|
|
57
55
|
|
|
58
56
|
const adjustedBottomSheetSize = useAnimatedStyle(() => {
|
|
59
|
-
const extraPadding = Platform.OS === 'android' ? 32 : 16;
|
|
57
|
+
const extraPadding = Platform.OS === 'android' ? 32 : 16 + insets.bottom;
|
|
60
58
|
return {
|
|
61
|
-
maxHeight: height - animatedPosition.value -
|
|
59
|
+
maxHeight: height - animatedPosition.value - extraPadding,
|
|
62
60
|
};
|
|
63
61
|
}, [animatedPosition, height, insets.bottom]);
|
|
64
62
|
|
|
@@ -108,6 +106,8 @@ export const MobileAddonsPanel = forwardRef<MobileAddonsPanelRef, { storyId?: st
|
|
|
108
106
|
}
|
|
109
107
|
);
|
|
110
108
|
|
|
109
|
+
MobileAddonsPanel.displayName = 'MobileAddonsPanel';
|
|
110
|
+
|
|
111
111
|
const addonsTabsContainerStyle = {
|
|
112
112
|
flex: 1,
|
|
113
113
|
} satisfies StyleProp<ViewStyle>;
|
package/src/Refs.tsx
CHANGED
|
@@ -3,8 +3,8 @@ import React, { useMemo, useCallback, useEffect, useState } from 'react';
|
|
|
3
3
|
import type { State } from 'storybook/internal/manager-api';
|
|
4
4
|
import { styled } from '@storybook/react-native-theming';
|
|
5
5
|
import { Tree } from './Tree';
|
|
6
|
-
import type { RefType } from '
|
|
7
|
-
import { getStateType } from '
|
|
6
|
+
import type { RefType } from '@storybook/react-native-ui-common';
|
|
7
|
+
import { getStateType } from '@storybook/react-native-ui-common';
|
|
8
8
|
|
|
9
9
|
export interface RefProps {
|
|
10
10
|
isLoading: boolean;
|
|
@@ -13,70 +13,70 @@ export interface RefProps {
|
|
|
13
13
|
setSelection: (selection: { refId: string; storyId: string }) => void;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
const Wrapper = styled.View<{ isMain: boolean }>((
|
|
16
|
+
const Wrapper = styled.View<{ isMain: boolean }>(() => ({
|
|
17
17
|
position: 'relative',
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
-
export const Ref: FC<RefType & RefProps & { status?: State['status'] }> = React.memo(
|
|
21
|
-
props
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const length = useMemo(() => (index ? Object.keys(index).length : 0), [index]);
|
|
20
|
+
export const Ref: FC<RefType & RefProps & { status?: State['status'] }> = React.memo(
|
|
21
|
+
function Ref(props) {
|
|
22
|
+
const {
|
|
23
|
+
index,
|
|
24
|
+
id: refId,
|
|
25
|
+
title = refId,
|
|
26
|
+
isLoading: isLoadingMain,
|
|
27
|
+
isBrowsing,
|
|
28
|
+
selectedStoryId,
|
|
29
|
+
loginUrl,
|
|
30
|
+
type,
|
|
31
|
+
expanded = true,
|
|
32
|
+
indexError,
|
|
33
|
+
previewInitialized,
|
|
34
|
+
setSelection,
|
|
35
|
+
} = props;
|
|
36
|
+
const length = useMemo(() => (index ? Object.keys(index).length : 0), [index]);
|
|
38
37
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const isLoadingInjected =
|
|
39
|
+
(type === 'auto-inject' && !previewInitialized) || type === 'server-checked';
|
|
40
|
+
const isLoading = isLoadingMain || isLoadingInjected || type === 'unknown';
|
|
41
|
+
const isError = !!indexError;
|
|
42
|
+
const isEmpty = !isLoading && length === 0;
|
|
43
|
+
const isAuthRequired = !!loginUrl && length === 0;
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
const state = getStateType(isLoading, isAuthRequired, isError, isEmpty);
|
|
46
|
+
const [isExpanded, setExpanded] = useState<boolean>(expanded);
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (index && selectedStoryId && index[selectedStoryId]) {
|
|
50
|
+
setExpanded(true);
|
|
51
|
+
}
|
|
52
|
+
}, [setExpanded, index, selectedStoryId]);
|
|
54
53
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
54
|
+
const onSelectStoryId = useCallback(
|
|
55
|
+
(storyId: string) => {
|
|
56
|
+
setSelection({ refId, storyId });
|
|
57
|
+
},
|
|
58
|
+
[refId, setSelection]
|
|
59
|
+
);
|
|
61
60
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
{isExpanded && (
|
|
64
|
+
<Wrapper data-title={title} isMain={true}>
|
|
65
|
+
{state === 'ready' && (
|
|
66
|
+
<Tree
|
|
67
|
+
status={props.status}
|
|
68
|
+
isBrowsing={isBrowsing}
|
|
69
|
+
isMain={true}
|
|
70
|
+
refId={refId}
|
|
71
|
+
data={index}
|
|
72
|
+
docsMode={false}
|
|
73
|
+
selectedStoryId={selectedStoryId}
|
|
74
|
+
onSelectStoryId={onSelectStoryId}
|
|
75
|
+
/>
|
|
76
|
+
)}
|
|
77
|
+
</Wrapper>
|
|
78
|
+
)}
|
|
79
|
+
</>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
);
|
package/src/Search.tsx
CHANGED
|
@@ -2,11 +2,11 @@ import { BottomSheetTextInput, useBottomSheetInternal } from '@gorhom/bottom-she
|
|
|
2
2
|
import { styled } from '@storybook/react-native-theming';
|
|
3
3
|
import type { IFuseOptions } from 'fuse.js';
|
|
4
4
|
import Fuse from 'fuse.js';
|
|
5
|
-
import React, { useCallback,
|
|
5
|
+
import React, { useCallback, useDeferredValue, useRef, useState } from 'react';
|
|
6
6
|
import { Platform, TextInput, View } from 'react-native';
|
|
7
7
|
import { CloseIcon } from './icon/CloseIcon';
|
|
8
8
|
import { SearchIcon } from './icon/SearchIcon';
|
|
9
|
-
import {
|
|
9
|
+
import { useSelectedNode } from './SelectedNodeProvider';
|
|
10
10
|
import {
|
|
11
11
|
type CombinedDataset,
|
|
12
12
|
type GetSearchItemProps,
|
|
@@ -15,9 +15,8 @@ import {
|
|
|
15
15
|
type SearchItem,
|
|
16
16
|
type SearchResult,
|
|
17
17
|
type Selection,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { useSelectedNode } from './SelectedNodeProvider';
|
|
18
|
+
searchItem,
|
|
19
|
+
} from '@storybook/react-native-ui-common';
|
|
21
20
|
|
|
22
21
|
const DEFAULT_MAX_SEARCH_RESULTS = 50;
|
|
23
22
|
|
|
@@ -112,7 +111,7 @@ export const Search = React.memo<{
|
|
|
112
111
|
const [inputValue, setInputValue] = useState(initialQuery);
|
|
113
112
|
const [isOpen, setIsOpen] = useState(false);
|
|
114
113
|
const [allComponents, showAllComponents] = useState(false);
|
|
115
|
-
const { isMobile } = useLayout();
|
|
114
|
+
// const { isMobile } = useLayout();
|
|
116
115
|
const { scrollToSelectedNode } = useSelectedNode();
|
|
117
116
|
|
|
118
117
|
const selectStory = useCallback(
|
package/src/SearchResults.tsx
CHANGED
|
@@ -2,16 +2,20 @@ import { styled } from '@storybook/react-native-theming';
|
|
|
2
2
|
import type { FC, PropsWithChildren, ReactNode } from 'react';
|
|
3
3
|
import React, { useCallback } from 'react';
|
|
4
4
|
import { transparentize } from 'polished';
|
|
5
|
-
import
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
isExpandType,
|
|
7
|
+
IconButton,
|
|
8
|
+
type GetSearchItemProps,
|
|
9
|
+
type SearchResult,
|
|
10
|
+
type SearchResultProps,
|
|
11
|
+
Button,
|
|
12
|
+
} from '@storybook/react-native-ui-common';
|
|
7
13
|
|
|
8
14
|
import { FuseResultMatch } from 'fuse.js';
|
|
9
15
|
import { PressableProps, View } from 'react-native';
|
|
10
|
-
|
|
11
|
-
import { IconButton } from './IconButton';
|
|
16
|
+
|
|
12
17
|
import { ComponentIcon } from './icon/ComponentIcon';
|
|
13
18
|
import { StoryIcon } from './icon/StoryIcon';
|
|
14
|
-
import { statusMapping } from './util/status';
|
|
15
19
|
|
|
16
20
|
const ResultsList = styled.View({
|
|
17
21
|
margin: 0,
|
|
@@ -144,8 +148,6 @@ const Result: FC<SearchResultProps> = React.memo(function Result({
|
|
|
144
148
|
const nameMatch = matches.find((match: FuseResultMatch) => match.key === 'name');
|
|
145
149
|
const pathMatches = matches.filter((match: FuseResultMatch) => match.key === 'path');
|
|
146
150
|
|
|
147
|
-
const [i] = item.status ? statusMapping[item.status] : [];
|
|
148
|
-
|
|
149
151
|
return (
|
|
150
152
|
<ResultRow {...props} onPress={press}>
|
|
151
153
|
<IconWrapper>
|
|
@@ -175,7 +177,6 @@ const Result: FC<SearchResultProps> = React.memo(function Result({
|
|
|
175
177
|
})}
|
|
176
178
|
</Path>
|
|
177
179
|
</ResultRowContent>
|
|
178
|
-
{item.status ? i : null}
|
|
179
180
|
</ResultRow>
|
|
180
181
|
);
|
|
181
182
|
});
|
|
@@ -36,7 +36,8 @@ export const SelectedNodeProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
|
36
36
|
nodeRef.current.measureLayout?.(scrollRef.current as any, (_x, y) => {
|
|
37
37
|
scrollRef.current?.scrollTo({ y: y - 100, animated: true });
|
|
38
38
|
});
|
|
39
|
-
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40
|
+
} catch (_error) {}
|
|
40
41
|
}
|
|
41
42
|
}, 500);
|
|
42
43
|
}, []);
|
package/src/Sidebar.stories.tsx
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { IndexHash, State } from 'storybook/internal/manager-api';
|
|
4
|
-
import { Button } from '
|
|
5
|
-
import { LayoutProvider } from './LayoutProvider';
|
|
4
|
+
import { Button, LayoutProvider, type RefType } from '@storybook/react-native-ui-common';
|
|
6
5
|
import { Sidebar } from './Sidebar';
|
|
7
6
|
import { DEFAULT_REF_ID } from './constants';
|
|
8
7
|
import { mockDataset } from './mockdata';
|
|
9
|
-
import type { RefType } from './types';
|
|
10
8
|
|
|
11
9
|
const index = mockDataset.withRoot as IndexHash;
|
|
12
10
|
const storyId = 'root-1-child-a2--grandchild-a1-1';
|
package/src/Sidebar.tsx
CHANGED
|
@@ -5,8 +5,8 @@ import type { API_LoadedRefData } from 'storybook/internal/types';
|
|
|
5
5
|
import { Explorer } from './Explorer';
|
|
6
6
|
import { Search } from './Search';
|
|
7
7
|
import { SearchResults } from './SearchResults';
|
|
8
|
-
import type { CombinedDataset, Selection } from '
|
|
9
|
-
import { useLastViewed } from '
|
|
8
|
+
import type { CombinedDataset, Selection } from '@storybook/react-native-ui-common';
|
|
9
|
+
import { useLastViewed } from '@storybook/react-native-ui-common';
|
|
10
10
|
import { DEFAULT_REF_ID } from './constants';
|
|
11
11
|
import { View } from 'react-native';
|
|
12
12
|
|
package/src/Tree.stories.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { useState } from 'react';
|
|
|
2
2
|
import type { ComponentEntry, IndexHash } from 'storybook/internal/manager-api';
|
|
3
3
|
import type { StoryObj, Meta } from '@storybook/react';
|
|
4
4
|
import { Tree } from './Tree';
|
|
5
|
-
import type { Dataset } from '
|
|
5
|
+
import type { Dataset } from '@storybook/react-native-ui-common';
|
|
6
6
|
import { index } from './mockdata.large';
|
|
7
7
|
import { DEFAULT_REF_ID } from './constants';
|
|
8
8
|
import { ScrollView, Text } from 'react-native';
|
package/src/Tree.tsx
CHANGED
|
@@ -8,16 +8,21 @@ import type {
|
|
|
8
8
|
import { styled } from '@storybook/react-native-theming';
|
|
9
9
|
import React, { useCallback, useMemo, useRef } from 'react';
|
|
10
10
|
import { View } from 'react-native';
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
IconButton,
|
|
13
|
+
ExpandAction,
|
|
14
|
+
ExpandedState,
|
|
15
|
+
useExpanded,
|
|
16
|
+
createId,
|
|
17
|
+
getAncestorIds,
|
|
18
|
+
getDescendantIds,
|
|
19
|
+
isStoryHoistable,
|
|
20
|
+
} from '@storybook/react-native-ui-common';
|
|
12
21
|
import { ComponentNode, GroupNode, StoryNode } from './TreeNode';
|
|
13
22
|
import { CollapseAllIcon } from './icon/CollapseAllIcon';
|
|
14
23
|
import { CollapseIcon } from './icon/CollapseIcon';
|
|
15
24
|
import { ExpandAllIcon } from './icon/ExpandAllIcon';
|
|
16
|
-
import { Item } from '
|
|
17
|
-
import type { ExpandAction, ExpandedState } from './hooks/useExpanded';
|
|
18
|
-
import { useExpanded } from './hooks/useExpanded';
|
|
19
|
-
import { getGroupStatus, statusMapping } from './util/status';
|
|
20
|
-
import { createId, getAncestorIds, getDescendantIds, isStoryHoistable } from './util/tree';
|
|
25
|
+
import type { Item } from '@storybook/react-native-ui-common';
|
|
21
26
|
import { useSelectedNode } from './SelectedNodeProvider';
|
|
22
27
|
|
|
23
28
|
interface NodeProps {
|
|
@@ -158,7 +163,7 @@ export const LeafNodeStyleWrapper = styled.View(({ theme }) => ({
|
|
|
158
163
|
borderRadius: 4,
|
|
159
164
|
}));
|
|
160
165
|
|
|
161
|
-
export const RootNode = styled.View((
|
|
166
|
+
export const RootNode = styled.View(() => ({
|
|
162
167
|
display: 'flex',
|
|
163
168
|
flexDirection: 'row',
|
|
164
169
|
alignItems: 'center',
|
|
@@ -177,7 +182,7 @@ export const RootNodeText = styled.Text(({ theme }) => ({
|
|
|
177
182
|
textTransform: 'uppercase',
|
|
178
183
|
}));
|
|
179
184
|
|
|
180
|
-
const CollapseButton = styled.TouchableOpacity((
|
|
185
|
+
const CollapseButton = styled.TouchableOpacity(() => ({
|
|
181
186
|
display: 'flex',
|
|
182
187
|
flexDirection: 'row',
|
|
183
188
|
paddingVertical: 0,
|
package/src/TreeNode.tsx
CHANGED
|
@@ -3,10 +3,9 @@ import { ComponentIcon } from './icon/ComponentIcon';
|
|
|
3
3
|
import { GroupIcon } from './icon/GroupIcon';
|
|
4
4
|
import { StoryIcon } from './icon/StoryIcon';
|
|
5
5
|
import { CollapseIcon } from './icon/CollapseIcon';
|
|
6
|
-
import { ComponentProps, FC, forwardRef, useMemo } from 'react';
|
|
6
|
+
import React, { ComponentProps, FC, forwardRef, useMemo } from 'react';
|
|
7
7
|
import { transparentize } from 'polished';
|
|
8
8
|
import { View } from 'react-native';
|
|
9
|
-
import React from 'react';
|
|
10
9
|
|
|
11
10
|
export interface NodeProps {
|
|
12
11
|
children: React.ReactNode | React.ReactNode[];
|
package/src/index.tsx
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
export * from './TreeNode';
|
|
2
2
|
export * from './Tree';
|
|
3
|
-
export * from './Button';
|
|
4
|
-
export * from './IconButton';
|
|
5
|
-
export * from './LayoutProvider';
|
|
6
3
|
export * from './Explorer';
|
|
7
4
|
export * from './Sidebar';
|
|
8
|
-
export * from './types';
|
|
9
5
|
export * from './Layout';
|
|
10
|
-
export * from './util/StoryHash';
|
|
11
|
-
export * from './StorageProvider';
|