@storybook/react-native-ui 8.5.4 → 8.5.5-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 CHANGED
@@ -4742,7 +4742,7 @@ var MobileMenuDrawer = (0, import_react20.memo)(
4742
4742
  const handleIndicatorStyle = (0, import_react20.useMemo)(() => {
4743
4743
  return { backgroundColor: theme.textMutedColor };
4744
4744
  }, [theme.textMutedColor]);
4745
- const contentContainerStyle = (0, import_react20.useMemo)(() => {
4745
+ const contentContainerStyle2 = (0, import_react20.useMemo)(() => {
4746
4746
  return { paddingBottom: insets.bottom };
4747
4747
  }, [insets.bottom]);
4748
4748
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -4765,7 +4765,7 @@ var MobileMenuDrawer = (0, import_react20.memo)(
4765
4765
  import_bottom_sheet3.BottomSheetScrollView,
4766
4766
  {
4767
4767
  keyboardShouldPersistTaps: "handled",
4768
- contentContainerStyle,
4768
+ contentContainerStyle: contentContainerStyle2,
4769
4769
  children
4770
4770
  }
4771
4771
  )
@@ -5121,8 +5121,7 @@ var desktopLogoContainer = {
5121
5121
  paddingRight: 10,
5122
5122
  justifyContent: "space-between"
5123
5123
  };
5124
- var desktopContentContainerStyle = { flex: 1 };
5125
- var desktopContentStyle = { flex: 1, overflow: "hidden" };
5124
+ var contentContainerStyle = { flex: 1, overflow: "hidden" };
5126
5125
  var mobileContentStyle = { flex: 1, overflow: "hidden" };
5127
5126
  var placeholderObject = {};
5128
5127
  var placeholderArray = [];
@@ -5153,15 +5152,6 @@ var Layout = ({
5153
5152
  true
5154
5153
  );
5155
5154
  const [uiHidden, setUiHidden] = (0, import_react26.useState)(false);
5156
- const desktopContainerStyle = useStyle(
5157
- () => ({
5158
- flex: 1,
5159
- paddingTop: insets.top,
5160
- backgroundColor: theme.background.content,
5161
- flexDirection: "row"
5162
- }),
5163
- [theme.background.content, insets.top]
5164
- );
5165
5155
  const desktopSidebarStyle = useStyle(
5166
5156
  () => ({
5167
5157
  width: desktopSidebarOpen ? 240 : void 0,
@@ -5187,14 +5177,21 @@ var Layout = ({
5187
5177
  }),
5188
5178
  [desktopAddonsPanelOpen, theme.appBorderColor]
5189
5179
  );
5190
- const mobileContainerStyle = useStyle(
5191
- () => ({
5180
+ const containerStyle = useStyle(() => {
5181
+ if (isDesktop) {
5182
+ return {
5183
+ flex: 1,
5184
+ paddingTop: insets.top,
5185
+ backgroundColor: theme.background.content,
5186
+ flexDirection: "row"
5187
+ };
5188
+ }
5189
+ return {
5192
5190
  flex: 1,
5193
5191
  paddingTop: story?.parameters?.noSafeArea ? 0 : insets.top,
5194
5192
  backgroundColor: theme.background.content
5195
- }),
5196
- [theme.background.content, insets.top, story?.parameters?.noSafeArea]
5197
- );
5193
+ };
5194
+ }, [theme.background.content, insets.top, story?.parameters?.noSafeArea, isDesktop]);
5198
5195
  const fullScreenButtonStyle = useStyle(
5199
5196
  () => ({
5200
5197
  position: "absolute",
@@ -5208,7 +5205,7 @@ var Layout = ({
5208
5205
  }),
5209
5206
  [uiHidden, insets.bottom, theme.background.content, theme.appBorderColor]
5210
5207
  );
5211
- const containerStyle = useStyle(
5208
+ const menuContainerStyle = useStyle(
5212
5209
  () => ({
5213
5210
  marginBottom: insets.bottom
5214
5211
  }),
@@ -5228,61 +5225,54 @@ var Layout = ({
5228
5225
  const channel = import_manager_api2.addons.getChannel();
5229
5226
  channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
5230
5227
  }, []);
5231
- if (isDesktop) {
5232
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: desktopContainerStyle, children: [
5233
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: desktopSidebarStyle, children: desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5234
- import_react_native9.ScrollView,
5235
- {
5236
- keyboardShouldPersistTaps: "handled",
5237
- contentContainerStyle: desktopScrollViewContentContainerStyle,
5238
- children: [
5239
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: desktopLogoContainer, children: [
5240
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }),
5241
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(false), Icon: MenuIcon })
5242
- ] }),
5243
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5244
- Sidebar,
5245
- {
5246
- extra: placeholderArray,
5247
- previewInitialized: true,
5248
- indexError: void 0,
5249
- refs: placeholderObject,
5250
- setSelection,
5251
- status: placeholderObject,
5252
- index: storyHash,
5253
- storyId: story?.id,
5254
- refId: DEFAULT_REF_ID
5255
- }
5256
- )
5257
- ]
5258
- }
5259
- ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(true), Icon: MenuIcon }) }),
5260
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: desktopContentContainerStyle, children: [
5261
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: desktopContentStyle, children }),
5262
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: desktopAddonsPanelStyle, children: desktopAddonsPanelOpen ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonsTabs, { storyId: story?.id, onClose: () => setDesktopAddonsPanelOpen(false) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5263
- IconButton,
5264
- {
5265
- style: iconFloatRightStyle,
5266
- onPress: () => setDesktopAddonsPanelOpen(true),
5267
- Icon: BottomBarToggleIcon
5268
- }
5269
- ) })
5270
- ] })
5271
- ] });
5272
- }
5273
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: mobileContainerStyle, children: [
5228
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: containerStyle, children: [
5229
+ isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: desktopSidebarStyle, children: desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5230
+ import_react_native9.ScrollView,
5231
+ {
5232
+ keyboardShouldPersistTaps: "handled",
5233
+ contentContainerStyle: desktopScrollViewContentContainerStyle,
5234
+ children: [
5235
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: desktopLogoContainer, children: [
5236
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }),
5237
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(false), Icon: MenuIcon })
5238
+ ] }),
5239
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5240
+ Sidebar,
5241
+ {
5242
+ extra: placeholderArray,
5243
+ previewInitialized: true,
5244
+ indexError: void 0,
5245
+ refs: placeholderObject,
5246
+ setSelection,
5247
+ status: placeholderObject,
5248
+ index: storyHash,
5249
+ storyId: story?.id,
5250
+ refId: DEFAULT_REF_ID
5251
+ }
5252
+ )
5253
+ ]
5254
+ }
5255
+ ) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { onPress: () => setDesktopSidebarOpen(true), Icon: MenuIcon }) }) : null,
5274
5256
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_react_native9.View, { style: mobileContentStyle, children: [
5275
- children,
5276
- story?.parameters?.hideFullScreenButton ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5257
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: contentContainerStyle, children }),
5258
+ story?.parameters?.hideFullScreenButton || isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5277
5259
  import_react_native9.TouchableOpacity,
5278
5260
  {
5279
5261
  style: fullScreenButtonStyle,
5280
5262
  onPress: () => setUiHidden((prev) => !prev),
5281
5263
  children: uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CloseFullscreenIcon, { color: theme.color.mediumdark }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FullscreenIcon, { color: theme.color.mediumdark })
5282
5264
  }
5283
- )
5265
+ ),
5266
+ isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: desktopAddonsPanelStyle, children: desktopAddonsPanelOpen ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AddonsTabs, { storyId: story?.id, onClose: () => setDesktopAddonsPanelOpen(false) }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5267
+ IconButton,
5268
+ {
5269
+ style: iconFloatRightStyle,
5270
+ onPress: () => setDesktopAddonsPanelOpen(true),
5271
+ Icon: BottomBarToggleIcon
5272
+ }
5273
+ ) }) : null
5284
5274
  ] }),
5285
- !uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Container3, { style: containerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Nav, { children: [
5275
+ !uiHidden && !isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Container3, { style: menuContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Nav, { children: [
5286
5276
  /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
5287
5277
  Button2,
5288
5278
  {
@@ -5309,7 +5299,7 @@ var Layout = ({
5309
5299
  }
5310
5300
  )
5311
5301
  ] }) }) : null,
5312
- /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
5302
+ isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
5313
5303
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_react_native9.View, { style: mobileMenuDrawerContentStyle, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StorybookLogo, { theme }) }),
5314
5304
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5315
5305
  Sidebar,
@@ -5326,7 +5316,7 @@ var Layout = ({
5326
5316
  }
5327
5317
  )
5328
5318
  ] }),
5329
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
5319
+ isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
5330
5320
  ] });
5331
5321
  };
5332
5322
  var Nav = import_react_native_theming17.styled.View({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native-ui",
3
- "version": "8.5.4",
3
+ "version": "8.5.5-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.5.1",
62
62
  "@storybook/react": "^8.5.1",
63
- "@storybook/react-native-theming": "^8.5.4",
63
+ "@storybook/react-native-theming": "^8.5.5-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": "bd630c52410fd1d6090e9bb52ecb7ea269e556b8"
84
+ "gitHead": "24fa3902e20ab6412d60dcf326a3b8aa2c17dce6"
85
85
  }
package/src/Layout.tsx CHANGED
@@ -29,10 +29,7 @@ const desktopLogoContainer = {
29
29
  paddingRight: 10,
30
30
  justifyContent: 'space-between',
31
31
  } satisfies ViewStyle;
32
-
33
- const desktopContentContainerStyle = { flex: 1 } satisfies ViewStyle;
34
-
35
- const desktopContentStyle = { flex: 1, overflow: 'hidden' } satisfies ViewStyle;
32
+ const contentContainerStyle = { flex: 1, overflow: 'hidden' } satisfies ViewStyle;
36
33
 
37
34
  const mobileContentStyle = { flex: 1, overflow: 'hidden' } satisfies ViewStyle;
38
35
 
@@ -79,16 +76,6 @@ export const Layout = ({
79
76
 
80
77
  const [uiHidden, setUiHidden] = useState(false);
81
78
 
82
- const desktopContainerStyle = useStyle(
83
- () => ({
84
- flex: 1,
85
- paddingTop: insets.top,
86
- backgroundColor: theme.background.content,
87
- flexDirection: 'row',
88
- }),
89
- [theme.background.content, insets.top]
90
- );
91
-
92
79
  const desktopSidebarStyle = useStyle(
93
80
  () => ({
94
81
  width: desktopSidebarOpen ? 240 : undefined,
@@ -117,14 +104,22 @@ export const Layout = ({
117
104
  [desktopAddonsPanelOpen, theme.appBorderColor]
118
105
  );
119
106
 
120
- const mobileContainerStyle = useStyle(
121
- () => ({
107
+ const containerStyle = useStyle(() => {
108
+ if (isDesktop) {
109
+ return {
110
+ flex: 1,
111
+ paddingTop: insets.top,
112
+ backgroundColor: theme.background.content,
113
+ flexDirection: 'row',
114
+ };
115
+ }
116
+
117
+ return {
122
118
  flex: 1,
123
119
  paddingTop: story?.parameters?.noSafeArea ? 0 : insets.top,
124
120
  backgroundColor: theme.background.content,
125
- }),
126
- [theme.background.content, insets.top, story?.parameters?.noSafeArea]
127
- );
121
+ };
122
+ }, [theme.background.content, insets.top, story?.parameters?.noSafeArea, isDesktop]);
128
123
 
129
124
  const fullScreenButtonStyle = useStyle(
130
125
  () => ({
@@ -140,7 +135,7 @@ export const Layout = ({
140
135
  [uiHidden, insets.bottom, theme.background.content, theme.appBorderColor]
141
136
  );
142
137
 
143
- const containerStyle = useStyle(
138
+ const menuContainerStyle = useStyle(
144
139
  () => ({
145
140
  marginBottom: insets.bottom,
146
141
  }),
@@ -165,9 +160,9 @@ export const Layout = ({
165
160
  channel.emit(SET_CURRENT_STORY, { storyId: newStoryId });
166
161
  }, []);
167
162
 
168
- if (isDesktop) {
169
- return (
170
- <View style={desktopContainerStyle}>
163
+ return (
164
+ <View style={containerStyle}>
165
+ {isDesktop ? (
171
166
  <View style={desktopSidebarStyle}>
172
167
  {desktopSidebarOpen ? (
173
168
  <ScrollView
@@ -196,32 +191,12 @@ export const Layout = ({
196
191
  <IconButton onPress={() => setDesktopSidebarOpen(true)} Icon={MenuIcon} />
197
192
  )}
198
193
  </View>
194
+ ) : null}
199
195
 
200
- <View style={desktopContentContainerStyle}>
201
- <View style={desktopContentStyle}>{children}</View>
202
-
203
- <View style={desktopAddonsPanelStyle}>
204
- {desktopAddonsPanelOpen ? (
205
- <AddonsTabs storyId={story?.id} onClose={() => setDesktopAddonsPanelOpen(false)} />
206
- ) : (
207
- <IconButton
208
- style={iconFloatRightStyle}
209
- onPress={() => setDesktopAddonsPanelOpen(true)}
210
- Icon={BottomBarToggleIcon}
211
- />
212
- )}
213
- </View>
214
- </View>
215
- </View>
216
- );
217
- }
218
-
219
- return (
220
- <View style={mobileContainerStyle}>
221
196
  <View style={mobileContentStyle}>
222
- {children}
197
+ <View style={contentContainerStyle}>{children}</View>
223
198
 
224
- {story?.parameters?.hideFullScreenButton ? null : (
199
+ {story?.parameters?.hideFullScreenButton || isDesktop ? null : (
225
200
  <TouchableOpacity
226
201
  style={fullScreenButtonStyle}
227
202
  onPress={() => setUiHidden((prev) => !prev)}
@@ -233,10 +208,24 @@ export const Layout = ({
233
208
  )}
234
209
  </TouchableOpacity>
235
210
  )}
211
+
212
+ {isDesktop ? (
213
+ <View style={desktopAddonsPanelStyle}>
214
+ {desktopAddonsPanelOpen ? (
215
+ <AddonsTabs storyId={story?.id} onClose={() => setDesktopAddonsPanelOpen(false)} />
216
+ ) : (
217
+ <IconButton
218
+ style={iconFloatRightStyle}
219
+ onPress={() => setDesktopAddonsPanelOpen(true)}
220
+ Icon={BottomBarToggleIcon}
221
+ />
222
+ )}
223
+ </View>
224
+ ) : null}
236
225
  </View>
237
226
 
238
- {!uiHidden ? (
239
- <Container style={containerStyle}>
227
+ {!uiHidden && !isDesktop ? (
228
+ <Container style={menuContainerStyle}>
240
229
  <Nav>
241
230
  <Button
242
231
  testID="mobile-menu-button"
@@ -259,25 +248,27 @@ export const Layout = ({
259
248
  </Container>
260
249
  ) : null}
261
250
 
262
- <MobileMenuDrawer ref={mobileMenuDrawerRef}>
263
- <View style={mobileMenuDrawerContentStyle}>
264
- <StorybookLogo theme={theme} />
265
- </View>
251
+ {isDesktop ? null : (
252
+ <MobileMenuDrawer ref={mobileMenuDrawerRef}>
253
+ <View style={mobileMenuDrawerContentStyle}>
254
+ <StorybookLogo theme={theme} />
255
+ </View>
266
256
 
267
- <Sidebar
268
- extra={placeholderArray}
269
- previewInitialized
270
- indexError={undefined}
271
- refs={placeholderObject}
272
- setSelection={setSelection}
273
- status={placeholderObject}
274
- index={storyHash}
275
- storyId={story?.id}
276
- refId={DEFAULT_REF_ID}
277
- />
278
- </MobileMenuDrawer>
279
-
280
- <MobileAddonsPanel ref={addonPanelRef} storyId={story?.id} />
257
+ <Sidebar
258
+ extra={placeholderArray}
259
+ previewInitialized
260
+ indexError={undefined}
261
+ refs={placeholderObject}
262
+ setSelection={setSelection}
263
+ status={placeholderObject}
264
+ index={storyHash}
265
+ storyId={story?.id}
266
+ refId={DEFAULT_REF_ID}
267
+ />
268
+ </MobileMenuDrawer>
269
+ )}
270
+
271
+ {isDesktop ? null : <MobileAddonsPanel ref={addonPanelRef} storyId={story?.id} />}
281
272
  </View>
282
273
  );
283
274
  };