@storybook/react-native-ui 8.5.1 → 8.5.2-alpha.1
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.js +31 -31
- package/package.json +3 -3
- package/src/Layout.tsx +24 -24
- package/src/MobileAddonsPanel.tsx +3 -2
- package/src/MobileMenuDrawer.tsx +10 -8
- package/src/Search.tsx +3 -3
package/dist/index.js
CHANGED
|
@@ -4129,7 +4129,8 @@ var Search = import_react10.default.memo(function Search2({ children, dataset, s
|
|
|
4129
4129
|
},
|
|
4130
4130
|
[allComponents, dataset.hash, getLastViewed, makeFuse]
|
|
4131
4131
|
);
|
|
4132
|
-
const
|
|
4132
|
+
const deferredQuery = (0, import_react10.useDeferredValue)(inputValue);
|
|
4133
|
+
const input = deferredQuery ? deferredQuery.trim() : "";
|
|
4133
4134
|
const results = input ? getResults(input) : [];
|
|
4134
4135
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react_native3.View, { style: { flex: 1 }, children: [
|
|
4135
4136
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(SearchField, { children: [
|
|
@@ -4530,8 +4531,9 @@ var MobileAddonsPanel = (0, import_react15.forwardRef)(
|
|
|
4530
4531
|
}));
|
|
4531
4532
|
const { height } = (0, import_react_native6.useWindowDimensions)();
|
|
4532
4533
|
const adjustedBottomSheetSize = (0, import_react_native_reanimated.useAnimatedStyle)(() => {
|
|
4534
|
+
const extraPadding = import_react_native6.Platform.OS === "android" ? 32 : 16;
|
|
4533
4535
|
return {
|
|
4534
|
-
maxHeight: height - animatedPosition.value - insets.bottom
|
|
4536
|
+
maxHeight: height - animatedPosition.value - insets.bottom - extraPadding
|
|
4535
4537
|
};
|
|
4536
4538
|
}, [animatedPosition, height, insets.bottom]);
|
|
4537
4539
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -4654,7 +4656,7 @@ var TabText = import_react_native_theming12.styled.Text(({ theme, active }) => (
|
|
|
4654
4656
|
}));
|
|
4655
4657
|
|
|
4656
4658
|
// src/MobileMenuDrawer.tsx
|
|
4657
|
-
var import_bottom_sheet3 = require("@gorhom/bottom-sheet");
|
|
4659
|
+
var import_bottom_sheet3 = __toESM(require("@gorhom/bottom-sheet"));
|
|
4658
4660
|
var import_react16 = require("react");
|
|
4659
4661
|
var import_react_native7 = require("react-native");
|
|
4660
4662
|
var import_react_native_reanimated2 = require("react-native-reanimated");
|
|
@@ -4680,27 +4682,25 @@ var MobileMenuDrawer = (0, import_react16.forwardRef)(
|
|
|
4680
4682
|
(0, import_react16.useImperativeHandle)(ref, () => ({
|
|
4681
4683
|
setMobileMenuOpen: (open) => {
|
|
4682
4684
|
if (open) {
|
|
4683
|
-
menuBottomSheetRef.current?.
|
|
4685
|
+
menuBottomSheetRef.current?.expand();
|
|
4684
4686
|
} else {
|
|
4685
4687
|
import_react_native7.Keyboard.dismiss();
|
|
4686
|
-
menuBottomSheetRef.current?.
|
|
4688
|
+
menuBottomSheetRef.current?.close();
|
|
4687
4689
|
}
|
|
4688
4690
|
}
|
|
4689
4691
|
}));
|
|
4690
4692
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4691
|
-
import_bottom_sheet3.
|
|
4693
|
+
import_bottom_sheet3.default,
|
|
4692
4694
|
{
|
|
4693
4695
|
ref: menuBottomSheetRef,
|
|
4694
|
-
index: 1,
|
|
4696
|
+
index: -1,
|
|
4695
4697
|
animateOnMount: !reducedMotion,
|
|
4696
4698
|
snapPoints: ["50%", "75%"],
|
|
4697
|
-
enableDismissOnClose: true,
|
|
4698
4699
|
enableHandlePanningGesture: true,
|
|
4699
4700
|
enableContentPanningGesture: true,
|
|
4700
4701
|
enableDynamicSizing: false,
|
|
4701
4702
|
keyboardBehavior: "extend",
|
|
4702
4703
|
keyboardBlurBehavior: "restore",
|
|
4703
|
-
stackBehavior: "replace",
|
|
4704
4704
|
backdropComponent: BottomSheetBackdropComponent,
|
|
4705
4705
|
backgroundStyle: { backgroundColor: theme.background.content },
|
|
4706
4706
|
handleIndicatorStyle: { backgroundColor: theme.textMutedColor },
|
|
@@ -5200,27 +5200,6 @@ var Layout = ({
|
|
|
5200
5200
|
}
|
|
5201
5201
|
)
|
|
5202
5202
|
] }),
|
|
5203
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
|
|
5204
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: { paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }) }),
|
|
5205
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5206
|
-
Sidebar,
|
|
5207
|
-
{
|
|
5208
|
-
extra: [],
|
|
5209
|
-
previewInitialized: true,
|
|
5210
|
-
indexError: void 0,
|
|
5211
|
-
refs: {},
|
|
5212
|
-
setSelection: ({ storyId: newStoryId }) => {
|
|
5213
|
-
const channel = import_manager_api2.addons.getChannel();
|
|
5214
|
-
channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
|
|
5215
|
-
},
|
|
5216
|
-
status: {},
|
|
5217
|
-
index: storyHash,
|
|
5218
|
-
storyId: story?.id,
|
|
5219
|
-
refId: DEFAULT_REF_ID
|
|
5220
|
-
}
|
|
5221
|
-
)
|
|
5222
|
-
] }),
|
|
5223
|
-
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id }),
|
|
5224
5203
|
!uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Container3, { style: { marginBottom: insets.bottom }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Nav, { children: [
|
|
5225
5204
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
5226
5205
|
Button2,
|
|
@@ -5249,7 +5228,28 @@ var Layout = ({
|
|
|
5249
5228
|
Icon: BottomBarToggleIcon
|
|
5250
5229
|
}
|
|
5251
5230
|
)
|
|
5252
|
-
] }) }) : null
|
|
5231
|
+
] }) }) : null,
|
|
5232
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
|
|
5233
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: { paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }) }),
|
|
5234
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
5235
|
+
Sidebar,
|
|
5236
|
+
{
|
|
5237
|
+
extra: [],
|
|
5238
|
+
previewInitialized: true,
|
|
5239
|
+
indexError: void 0,
|
|
5240
|
+
refs: {},
|
|
5241
|
+
setSelection: ({ storyId: newStoryId }) => {
|
|
5242
|
+
const channel = import_manager_api2.addons.getChannel();
|
|
5243
|
+
channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
|
|
5244
|
+
},
|
|
5245
|
+
status: {},
|
|
5246
|
+
index: storyHash,
|
|
5247
|
+
storyId: story?.id,
|
|
5248
|
+
refId: DEFAULT_REF_ID
|
|
5249
|
+
}
|
|
5250
|
+
)
|
|
5251
|
+
] }),
|
|
5252
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
|
|
5253
5253
|
]
|
|
5254
5254
|
}
|
|
5255
5255
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native-ui",
|
|
3
|
-
"version": "8.5.1",
|
|
3
|
+
"version": "8.5.2-alpha.1",
|
|
4
4
|
"description": "ui components for react native storybook",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@storybook/core": "^8.4.2",
|
|
62
62
|
"@storybook/react": "^8.4.2",
|
|
63
|
-
"@storybook/react-native-theming": "^8.5.1",
|
|
63
|
+
"@storybook/react-native-theming": "^8.5.2-alpha.1",
|
|
64
64
|
"fuse.js": "^7.0.0",
|
|
65
65
|
"memoizerific": "^1.11.3",
|
|
66
66
|
"polished": "^4.3.1",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "6829dc629b4ca18e2869267a9c9e0afed094f2f3"
|
|
85
85
|
}
|
package/src/Layout.tsx
CHANGED
|
@@ -169,30 +169,6 @@ export const Layout = ({
|
|
|
169
169
|
)}
|
|
170
170
|
</View>
|
|
171
171
|
|
|
172
|
-
<MobileMenuDrawer ref={mobileMenuDrawerRef}>
|
|
173
|
-
<View style={{ paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }}>
|
|
174
|
-
<StorybookLogo theme={theme} />
|
|
175
|
-
</View>
|
|
176
|
-
|
|
177
|
-
<Sidebar
|
|
178
|
-
extra={[]}
|
|
179
|
-
previewInitialized
|
|
180
|
-
indexError={undefined}
|
|
181
|
-
refs={{}}
|
|
182
|
-
setSelection={({ storyId: newStoryId }) => {
|
|
183
|
-
const channel = addons.getChannel();
|
|
184
|
-
|
|
185
|
-
channel.emit(SET_CURRENT_STORY, { storyId: newStoryId });
|
|
186
|
-
}}
|
|
187
|
-
status={{}}
|
|
188
|
-
index={storyHash}
|
|
189
|
-
storyId={story?.id}
|
|
190
|
-
refId={DEFAULT_REF_ID}
|
|
191
|
-
/>
|
|
192
|
-
</MobileMenuDrawer>
|
|
193
|
-
|
|
194
|
-
<MobileAddonsPanel ref={addonPanelRef} storyId={story?.id} />
|
|
195
|
-
|
|
196
172
|
{!uiHidden ? (
|
|
197
173
|
<Container style={{ marginBottom: insets.bottom }}>
|
|
198
174
|
<Nav>
|
|
@@ -218,6 +194,30 @@ export const Layout = ({
|
|
|
218
194
|
</Nav>
|
|
219
195
|
</Container>
|
|
220
196
|
) : null}
|
|
197
|
+
|
|
198
|
+
<MobileMenuDrawer ref={mobileMenuDrawerRef}>
|
|
199
|
+
<View style={{ paddingLeft: 16, paddingTop: 4, paddingBottom: 4 }}>
|
|
200
|
+
<StorybookLogo theme={theme} />
|
|
201
|
+
</View>
|
|
202
|
+
|
|
203
|
+
<Sidebar
|
|
204
|
+
extra={[]}
|
|
205
|
+
previewInitialized
|
|
206
|
+
indexError={undefined}
|
|
207
|
+
refs={{}}
|
|
208
|
+
setSelection={({ storyId: newStoryId }) => {
|
|
209
|
+
const channel = addons.getChannel();
|
|
210
|
+
|
|
211
|
+
channel.emit(SET_CURRENT_STORY, { storyId: newStoryId });
|
|
212
|
+
}}
|
|
213
|
+
status={{}}
|
|
214
|
+
index={storyHash}
|
|
215
|
+
storyId={story?.id}
|
|
216
|
+
refId={DEFAULT_REF_ID}
|
|
217
|
+
/>
|
|
218
|
+
</MobileMenuDrawer>
|
|
219
|
+
|
|
220
|
+
<MobileAddonsPanel ref={addonPanelRef} storyId={story?.id} />
|
|
221
221
|
</View>
|
|
222
222
|
);
|
|
223
223
|
};
|
|
@@ -3,7 +3,7 @@ import { addons } from '@storybook/core/manager-api';
|
|
|
3
3
|
import { styled } from '@storybook/react-native-theming';
|
|
4
4
|
import { Addon_TypesEnum } from '@storybook/core/types';
|
|
5
5
|
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
6
|
-
import { Text, View, useWindowDimensions } from 'react-native';
|
|
6
|
+
import { Platform, Text, View, useWindowDimensions } from 'react-native';
|
|
7
7
|
import { ScrollView } from 'react-native-gesture-handler';
|
|
8
8
|
import Animated, {
|
|
9
9
|
useAnimatedKeyboard,
|
|
@@ -47,8 +47,9 @@ export const MobileAddonsPanel = forwardRef<MobileAddonsPanelRef, { storyId?: st
|
|
|
47
47
|
const { height } = useWindowDimensions();
|
|
48
48
|
|
|
49
49
|
const adjustedBottomSheetSize = useAnimatedStyle(() => {
|
|
50
|
+
const extraPadding = Platform.OS === 'android' ? 32 : 16;
|
|
50
51
|
return {
|
|
51
|
-
maxHeight: height - animatedPosition.value - insets.bottom,
|
|
52
|
+
maxHeight: height - animatedPosition.value - insets.bottom - extraPadding,
|
|
52
53
|
};
|
|
53
54
|
}, [animatedPosition, height, insets.bottom]);
|
|
54
55
|
|
package/src/MobileMenuDrawer.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import BottomSheet, {
|
|
2
2
|
BottomSheetBackdrop,
|
|
3
3
|
BottomSheetBackdropProps,
|
|
4
4
|
BottomSheetModal,
|
|
@@ -39,28 +39,30 @@ export const MobileMenuDrawer = forwardRef<MobileMenuDrawerRef, MobileMenuDrawer
|
|
|
39
39
|
useImperativeHandle(ref, () => ({
|
|
40
40
|
setMobileMenuOpen: (open: boolean) => {
|
|
41
41
|
if (open) {
|
|
42
|
-
menuBottomSheetRef.current?.present();
|
|
42
|
+
// menuBottomSheetRef.current?.present();
|
|
43
|
+
menuBottomSheetRef.current?.expand();
|
|
43
44
|
} else {
|
|
44
45
|
Keyboard.dismiss();
|
|
45
46
|
|
|
46
|
-
menuBottomSheetRef.current?.dismiss();
|
|
47
|
+
// menuBottomSheetRef.current?.dismiss();
|
|
48
|
+
menuBottomSheetRef.current?.close();
|
|
47
49
|
}
|
|
48
50
|
},
|
|
49
51
|
}));
|
|
50
52
|
|
|
51
53
|
return (
|
|
52
|
-
<
|
|
54
|
+
<BottomSheet
|
|
53
55
|
ref={menuBottomSheetRef}
|
|
54
|
-
index={1}
|
|
56
|
+
index={-1}
|
|
55
57
|
animateOnMount={!reducedMotion}
|
|
56
58
|
snapPoints={['50%', '75%']}
|
|
57
|
-
enableDismissOnClose
|
|
59
|
+
// enableDismissOnClose
|
|
58
60
|
enableHandlePanningGesture
|
|
59
61
|
enableContentPanningGesture
|
|
60
62
|
enableDynamicSizing={false}
|
|
61
63
|
keyboardBehavior="extend"
|
|
62
64
|
keyboardBlurBehavior="restore"
|
|
63
|
-
stackBehavior="replace"
|
|
65
|
+
// stackBehavior="replace"
|
|
64
66
|
backdropComponent={BottomSheetBackdropComponent}
|
|
65
67
|
backgroundStyle={{ backgroundColor: theme.background.content }}
|
|
66
68
|
handleIndicatorStyle={{ backgroundColor: theme.textMutedColor }}
|
|
@@ -73,7 +75,7 @@ export const MobileMenuDrawer = forwardRef<MobileMenuDrawerRef, MobileMenuDrawer
|
|
|
73
75
|
>
|
|
74
76
|
{children}
|
|
75
77
|
</BottomSheetScrollView>
|
|
76
|
-
</
|
|
78
|
+
</BottomSheet>
|
|
77
79
|
);
|
|
78
80
|
}
|
|
79
81
|
);
|
package/src/Search.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { BottomSheetTextInput } from '@gorhom/bottom-sheet';
|
|
|
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, useRef, useState } from 'react';
|
|
5
|
+
import React, { useCallback, useDeferredValue, useRef, useState } from 'react';
|
|
6
6
|
import { TextInput, View } from 'react-native';
|
|
7
7
|
import { CloseIcon } from './icon/CloseIcon';
|
|
8
8
|
import { SearchIcon } from './icon/SearchIcon';
|
|
@@ -219,8 +219,8 @@ export const Search = React.memo<{
|
|
|
219
219
|
},
|
|
220
220
|
[allComponents, dataset.hash, getLastViewed, makeFuse]
|
|
221
221
|
);
|
|
222
|
-
|
|
223
|
-
const input =
|
|
222
|
+
const deferredQuery = useDeferredValue(inputValue);
|
|
223
|
+
const input = deferredQuery ? deferredQuery.trim() : '';
|
|
224
224
|
const results = input ? getResults(input) : [];
|
|
225
225
|
|
|
226
226
|
return (
|