@storybook/react-native-ui-lite 10.4.6 → 10.4.8-canary-20260711115827

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
@@ -5,7 +5,6 @@ import { State, StoriesHash } from "storybook/manager-api";
5
5
  import { API_IndexHash, API_LoadedRefData } from "storybook/internal/types";
6
6
  import { ReactRenderer } from "@storybook/react";
7
7
  import { Args, StoryContext } from "storybook/internal/csf";
8
-
9
8
  //#region src/TreeNode.d.ts
10
9
  interface NodeProps {
11
10
  children: React.ReactNode | React.ReactNode[];
@@ -106,26 +105,11 @@ interface SidebarProps extends API_LoadedRefData {
106
105
  setSelection: (selection: Selection) => void;
107
106
  onSearchActiveChange?: (active: boolean) => void;
108
107
  }
109
- declare const Sidebar: React.MemoExoticComponent<({
110
- storyId,
111
- refId,
112
- index,
113
- indexError,
114
- status,
115
- previewInitialized,
116
- refs,
117
- setSelection,
118
- onSearchActiveChange
119
- }: SidebarProps) => import("react/jsx-runtime").JSX.Element>;
108
+ declare const Sidebar: React.MemoExoticComponent<({ storyId, refId, index, indexError, status, previewInitialized, refs, setSelection, onSearchActiveChange }: SidebarProps) => import("react/jsx-runtime").JSX.Element>;
120
109
  //#endregion
121
110
  //#region src/Layout.d.ts
122
111
  declare const LiteUI: SBUI;
123
- declare const Layout: ({
124
- storyHash,
125
- story,
126
- storyBackgroundColor,
127
- children
128
- }: {
112
+ declare const Layout: ({ storyHash, story, storyBackgroundColor, children }: {
129
113
  storyHash: API_IndexHash | undefined;
130
114
  story?: StoryContext<ReactRenderer, Args>;
131
115
  storyBackgroundColor?: string;
package/dist/index.js CHANGED
@@ -694,8 +694,9 @@ const Tree = react.default.memo(function Tree({ isMain, refId, data, status, doc
694
694
  (0, react.useLayoutEffect)(() => {
695
695
  registerCallback(({ id: nextId, animated }) => {
696
696
  const targetId = nextId ?? selectedStoryId;
697
+ const ancestorIds = (0, _storybook_react_native_ui_common.getAncestorIds)(collapsedData, targetId);
697
698
  setExpanded({
698
- ids: [...(0, _storybook_react_native_ui_common.getAncestorIds)(collapsedData, targetId), targetId],
699
+ ids: [...ancestorIds, targetId],
699
700
  value: true
700
701
  });
701
702
  setPendingScrollTarget({
@@ -1164,46 +1165,47 @@ const SearchResults = react.default.memo(function SearchResults({ query, results
1164
1165
  }
1165
1166
  }
1166
1167
  }, []);
1168
+ const renderItem = (0, react.useCallback)(({ item: listItem }) => {
1169
+ switch (listItem.type) {
1170
+ case "header": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RecentlyOpenedTitle, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$3, { children: "Recently opened" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_react_native_ui_common.IconButton, {
1171
+ onPress: listItem.clearLastViewed,
1172
+ accessibilityLabel: "Clear recently opened"
1173
+ })] });
1174
+ case "noResults": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NoResults, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoResultsText, {
1175
+ style: noResultsFirstLineStyle,
1176
+ children: "No components found"
1177
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoResultsText, { children: "Find components by name or path." })] });
1178
+ case "expand": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MoreWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_react_native_ui_common.Button, {
1179
+ ...listItem.result,
1180
+ ...getItemProps({
1181
+ key: `${listItem.index}`,
1182
+ index: listItem.index,
1183
+ item: listItem.result
1184
+ }),
1185
+ size: "small",
1186
+ text: `Show ${listItem.result.moreCount} more results`
1187
+ }) });
1188
+ case "result": {
1189
+ const { item: resultItem } = listItem.result;
1190
+ const key = `${resultItem.refId}::${resultItem.id}`;
1191
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Result, {
1192
+ ...listItem.result,
1193
+ ...getItemProps({
1194
+ key,
1195
+ index: listItem.index,
1196
+ item: listItem.result
1197
+ }),
1198
+ isHighlighted: highlightedIndex === listItem.index
1199
+ });
1200
+ }
1201
+ }
1202
+ }, [getItemProps, highlightedIndex]);
1167
1203
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
1168
1204
  style: flexStyle$3,
1169
1205
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_legendapp_list_react_native.LegendList, {
1170
1206
  style: flexStyle$3,
1171
1207
  data: listData,
1172
- renderItem: (0, react.useCallback)(({ item: listItem }) => {
1173
- switch (listItem.type) {
1174
- case "header": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(RecentlyOpenedTitle, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Text$3, { children: "Recently opened" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_react_native_ui_common.IconButton, {
1175
- onPress: listItem.clearLastViewed,
1176
- accessibilityLabel: "Clear recently opened"
1177
- })] });
1178
- case "noResults": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(NoResults, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoResultsText, {
1179
- style: noResultsFirstLineStyle,
1180
- children: "No components found"
1181
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoResultsText, { children: "Find components by name or path." })] });
1182
- case "expand": return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MoreWrapper, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_react_native_ui_common.Button, {
1183
- ...listItem.result,
1184
- ...getItemProps({
1185
- key: `${listItem.index}`,
1186
- index: listItem.index,
1187
- item: listItem.result
1188
- }),
1189
- size: "small",
1190
- text: `Show ${listItem.result.moreCount} more results`
1191
- }) });
1192
- case "result": {
1193
- const { item: resultItem } = listItem.result;
1194
- const key = `${resultItem.refId}::${resultItem.id}`;
1195
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Result, {
1196
- ...listItem.result,
1197
- ...getItemProps({
1198
- key,
1199
- index: listItem.index,
1200
- item: listItem.result
1201
- }),
1202
- isHighlighted: highlightedIndex === listItem.index
1203
- });
1204
- }
1205
- }
1206
- }, [getItemProps, highlightedIndex]),
1208
+ renderItem,
1207
1209
  keyExtractor,
1208
1210
  contentContainerStyle,
1209
1211
  estimatedItemSize: 50,
@@ -1486,11 +1488,15 @@ const PanelRenderer = ({ panel }) => {
1486
1488
  return panel.render({ active: true });
1487
1489
  };
1488
1490
  const Tab = ({ active, onPress, text }) => {
1491
+ const testID = `addon-tab-${text.toLowerCase().replace(/[^a-z0-9]+/g, "-")}`;
1489
1492
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabButton, {
1490
1493
  active,
1491
1494
  onPress,
1495
+ testID,
1496
+ accessible: true,
1492
1497
  accessibilityRole: "tab",
1493
1498
  accessibilityState: { selected: active },
1499
+ accessibilityLabel: text,
1494
1500
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabText, {
1495
1501
  active,
1496
1502
  children: text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native-ui-lite",
3
- "version": "10.4.6",
3
+ "version": "10.4.8-canary-20260711115827",
4
4
  "description": "lightweight ui components for react native storybook",
5
5
  "keywords": [
6
6
  "react",
@@ -29,18 +29,18 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@gorhom/portal": "^1.0.14",
32
+ "@legendapp/list": "^3.3.2",
32
33
  "@nozbe/microfuzz": "^1.0.0",
33
- "@legendapp/list": "^3.0.6",
34
- "@storybook/react": "^10.4.6",
35
- "@storybook/react-native-theming": "^10.4.6",
36
- "@storybook/react-native-ui-common": "^10.4.6",
34
+ "@storybook/react": "^10.5.0",
35
+ "@storybook/react-native-theming": "10.4.8-canary-20260711115827",
36
+ "@storybook/react-native-ui-common": "10.4.8-canary-20260711115827",
37
37
  "polished": "^4.3.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/react": "~19.2.14",
41
- "storybook": "^10.4.6",
41
+ "storybook": "^10.5.0",
42
42
  "ts-dedent": "^2.3.0",
43
- "tsdown": "^0.22.3",
43
+ "tsdown": "^0.22.4",
44
44
  "typescript": "~6.0.3"
45
45
  },
46
46
  "peerDependencies": {
package/src/Layout.tsx CHANGED
@@ -173,6 +173,7 @@ export const Layout = ({
173
173
  const [uiHidden, setUiHidden] = useState(false);
174
174
 
175
175
  useLayoutEffect(() => {
176
+ // eslint-disable-next-line react-hooks/set-state-in-effect
176
177
  setUiHidden(story?.parameters?.storybookUIVisibility === 'hidden');
177
178
  }, [story?.parameters?.storybookUIVisibility]);
178
179
 
@@ -41,6 +41,7 @@ export const MobileAddonsPanel = forwardRef<MobileAddonsPanelRef, MobileAddonsPa
41
41
  const [isOpen, setIsOpen] = useState(false);
42
42
 
43
43
  useEffect(() => {
44
+ // eslint-disable-next-line react-hooks/set-state-in-effect
44
45
  setPanelHeight(defaultPanelHeight);
45
46
  }, [defaultPanelHeight]);
46
47
 
@@ -284,12 +285,17 @@ const PanelRenderer = ({ panel }: { panel: Addon_BaseType }) => {
284
285
  };
285
286
 
286
287
  const Tab = ({ active, onPress, text }: { active: boolean; onPress: () => void; text: string }) => {
288
+ const testID = `addon-tab-${text.toLowerCase().replace(/[^a-z0-9]+/g, '-')}`;
289
+
287
290
  return (
288
291
  <TabButton
289
292
  active={active}
290
293
  onPress={onPress}
294
+ testID={testID}
295
+ accessible
291
296
  accessibilityRole="tab"
292
297
  accessibilityState={{ selected: active }}
298
+ accessibilityLabel={text}
293
299
  >
294
300
  <TabText active={active}>{text}</TabText>
295
301
  </TabButton>