@storybook/react-native-ui-lite 11.0.0-next.1 → 11.0.0-next.2

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
@@ -1,44 +1,30 @@
1
- import React, { ComponentProps, FC, ReactNode } from "react";
2
- import { View } from "react-native";
1
+ import React, { FC, ReactNode } from "react";
2
+ import { TouchableOpacityProps, View } from "react-native";
3
3
  import { CombinedDataset, ExpandAction, Item, SBUI, Selection } from "@storybook/react-native-ui-common";
4
- import { State, StoriesHash } from "storybook/manager-api";
4
+ import { IndexHash, State } 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
- //#region src/TreeNode.d.ts
9
- interface NodeProps {
10
- children: React.ReactNode | React.ReactNode[];
11
- isExpandable?: boolean;
12
- isExpanded?: boolean;
13
- }
14
- declare const BranchNode: import("@storybook/react-native-theming").StyledComponent<import("react-native").TouchableOpacityProps & React.RefAttributes<View> & {
15
- theme?: import("@storybook/react-native-theming").Theme;
16
- as?: React.ElementType;
17
- } & {
8
+ export interface StoryNodeRef extends React.ComponentRef<typeof View> {}
9
+ export interface BranchNodeProps extends TouchableOpacityProps {
18
10
  depth?: number;
19
11
  isExpandable?: boolean;
20
12
  isExpanded?: boolean;
21
13
  isComponent?: boolean;
22
14
  isSelected?: boolean;
23
- }, {}, {
24
- ref?: React.Ref<any>;
25
- }>;
26
- declare const GroupNode: FC<ComponentProps<typeof BranchNode> & {
27
- isExpanded?: boolean;
28
- isExpandable?: boolean;
29
- }>;
30
- declare const ComponentNode: FC<ComponentProps<typeof BranchNode>>;
31
- declare const StoryNode: React.NamedExoticComponent<Omit<import("react-native").TouchableOpacityProps & React.RefAttributes<View> & {
32
- theme?: import("@storybook/react-native-theming").Theme;
33
- as?: React.ElementType;
34
- } & {
15
+ }
16
+ export interface LeafNodeProps extends TouchableOpacityProps {
35
17
  depth?: number;
36
18
  selected?: boolean;
37
- } & {
38
- ref?: React.Ref<any>;
39
- }, "ref"> & React.RefAttributes<View>>;
40
- //#endregion
41
- //#region src/Tree.d.ts
19
+ }
20
+ export interface NodeProps {
21
+ children: React.ReactNode | React.ReactNode[];
22
+ isExpandable?: boolean;
23
+ isExpanded?: boolean;
24
+ }
25
+ export declare const GroupNode: FC<BranchNodeProps>;
26
+ export declare const ComponentNode: FC<BranchNodeProps>;
27
+ export declare const StoryNode: React.NamedExoticComponent<LeafNodeProps & React.RefAttributes<StoryNodeRef>>;
42
28
  interface NodeProps$1 {
43
29
  item: Item;
44
30
  refId: string;
@@ -54,49 +40,51 @@ interface NodeProps$1 {
54
40
  onSelectStoryId: (itemId: string) => void;
55
41
  status: State['status'][keyof State['status']];
56
42
  }
57
- declare const Node: React.NamedExoticComponent<NodeProps$1>;
58
- declare const LeafNodeStyleWrapper: import("@storybook/react-native-theming").StyledComponent<import("react-native").ViewProps & {
43
+ export declare const Node: React.NamedExoticComponent<NodeProps$1>;
44
+ export declare const LeafNodeStyleWrapper: import("@storybook/react-native-theming").StyledComponent<Omit<import("react-native").ViewProps, "ref"> & {
45
+ ref?: React.Ref<import("react-native").ViewInstance> | undefined;
46
+ } & {
59
47
  theme?: import("@storybook/react-native-theming").Theme;
60
48
  as?: React.ElementType;
61
49
  }, {}, {
62
- ref?: React.Ref<View>;
50
+ ref?: React.Ref<any>;
63
51
  }>;
64
- declare const RootNode: import("@storybook/react-native-theming").StyledComponent<import("react-native").ViewProps & {
52
+ export declare const RootNode: import("@storybook/react-native-theming").StyledComponent<Omit<import("react-native").ViewProps, "ref"> & {
53
+ ref?: React.Ref<import("react-native").ViewInstance> | undefined;
54
+ } & {
65
55
  theme?: import("@storybook/react-native-theming").Theme;
66
56
  as?: React.ElementType;
67
57
  }, {}, {
68
- ref?: React.Ref<View>;
58
+ ref?: React.Ref<any>;
69
59
  }>;
70
- declare const RootNodeText: import("@storybook/react-native-theming").StyledComponent<import("react-native").TextProps & {
60
+ export declare const RootNodeText: import("@storybook/react-native-theming").StyledComponent<Omit<import("react-native").TextProps, "ref"> & {
61
+ ref?: React.Ref<import("react-native").TextInstance> | undefined;
62
+ } & {
71
63
  theme?: import("@storybook/react-native-theming").Theme;
72
64
  as?: React.ElementType;
73
65
  }, {}, {
74
- ref?: React.Ref<import("react-native").Text>;
66
+ ref?: React.Ref<any>;
75
67
  }>;
76
- declare const Tree: React.NamedExoticComponent<{
68
+ export declare const Tree: React.NamedExoticComponent<{
77
69
  isBrowsing: boolean;
78
70
  isMain: boolean;
79
71
  status?: State["status"];
80
72
  refId: string;
81
- data: StoriesHash;
73
+ data: IndexHash;
82
74
  docsMode: boolean;
83
75
  selectedStoryId: string | null;
84
76
  onSelectStoryId: (storyId: string) => void;
85
77
  }>;
86
- //#endregion
87
- //#region src/Explorer.d.ts
88
- interface ExplorerProps {
78
+ export interface ExplorerProps {
89
79
  isLoading: boolean;
90
80
  isBrowsing: boolean;
91
81
  dataset: CombinedDataset;
92
82
  selected: Selection;
93
83
  setSelection: (selection: Selection) => void;
94
84
  }
95
- declare const Explorer: FC<ExplorerProps>;
96
- //#endregion
97
- //#region src/Sidebar.d.ts
98
- declare const useCombination: (index: SidebarProps["index"], indexError: SidebarProps["indexError"], previewInitialized: SidebarProps["previewInitialized"], status: SidebarProps["status"], refs: SidebarProps["refs"]) => CombinedDataset;
99
- interface SidebarProps extends API_LoadedRefData {
85
+ export declare const Explorer: FC<ExplorerProps>;
86
+ export declare const useCombination: (index: SidebarProps["index"], indexError: SidebarProps["indexError"], previewInitialized: SidebarProps["previewInitialized"], status: SidebarProps["status"], refs: SidebarProps["refs"]) => CombinedDataset;
87
+ export interface SidebarProps extends API_LoadedRefData {
100
88
  refs: State['refs'];
101
89
  status: State['status'];
102
90
  storyId?: string;
@@ -105,15 +93,12 @@ interface SidebarProps extends API_LoadedRefData {
105
93
  setSelection: (selection: Selection) => void;
106
94
  onSearchActiveChange?: (active: boolean) => void;
107
95
  }
108
- declare const Sidebar: React.MemoExoticComponent<({ storyId, refId, index, indexError, status, previewInitialized, refs, setSelection, onSearchActiveChange }: SidebarProps) => React.JSX.Element>;
109
- //#endregion
110
- //#region src/Layout.d.ts
111
- declare const LiteUI: SBUI;
112
- declare const Layout: ({ storyHash, story, storyBackgroundColor, children }: {
96
+ export declare const Sidebar: React.MemoExoticComponent<({ storyId, refId, index, indexError, status, previewInitialized, refs, setSelection, onSearchActiveChange }: SidebarProps) => React.JSX.Element>;
97
+ export declare const LiteUI: SBUI;
98
+ export declare const Layout: ({ storyHash, story, storyBackgroundColor, children }: {
113
99
  storyHash: API_IndexHash | undefined;
114
100
  story?: StoryContext<ReactRenderer, Args>;
115
101
  storyBackgroundColor?: string;
116
102
  children: ReactNode | ReactNode[];
117
103
  }) => import("react").JSX.Element;
118
- //#endregion
119
- export { ComponentNode, Explorer, ExplorerProps, GroupNode, Layout, LeafNodeStyleWrapper, LiteUI, Node, NodeProps, RootNode, RootNodeText, Sidebar, SidebarProps, StoryNode, Tree, useCombination };
104
+ export {};
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -16,11 +16,10 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
- //#endregion
24
23
  let _storybook_react_native_theming = require("@storybook/react-native-theming");
25
24
  let react = require("react");
26
25
  react = __toESM(react);
@@ -30,12 +29,12 @@ let react_jsx_runtime = require("react/jsx-runtime");
30
29
  let _storybook_react_native_ui_common = require("@storybook/react-native-ui-common");
31
30
  let _legendapp_list_react_native = require("@legendapp/list/react-native");
32
31
  let react_native_safe_area_context = require("react-native-safe-area-context");
33
- let _nozbe_microfuzz_react_js = require("@nozbe/microfuzz/react.js");
32
+ let _nozbe_microfuzz_react = require("@nozbe/microfuzz/react");
34
33
  let _gorhom_portal = require("@gorhom/portal");
35
34
  let storybook_internal_core_events = require("storybook/internal/core-events");
36
35
  let storybook_internal_types = require("storybook/internal/types");
37
36
  let storybook_manager_api = require("storybook/manager-api");
38
- //#region src/icon/iconDataUris.tsx
37
+ // src/icon/iconDataUris.tsx
39
38
  /**
40
39
  * Auto-generated file with icon data URIs
41
40
  * Generated on: 2025-05-17T12:14:23.666Z
@@ -245,8 +244,7 @@ function StoryIcon({ color, width = 12, height = 12, size }) {
245
244
  }
246
245
  });
247
246
  }
248
- //#endregion
249
- //#region src/TreeNode.tsx
247
+ // src/TreeNode.tsx
250
248
  const BranchNodeText = _storybook_react_native_theming.styled.Text(({ theme }) => ({
251
249
  textAlign: "left",
252
250
  fontSize: theme.typography.size.s2 + 1,
@@ -256,7 +254,6 @@ const BranchNodeText = _storybook_react_native_theming.styled.Text(({ theme }) =
256
254
  const BranchNode = _storybook_react_native_theming.styled.TouchableOpacity(({ depth = 0, isExpandable = false, theme }) => ({
257
255
  width: "100%",
258
256
  border: "none",
259
- cursor: "pointer",
260
257
  display: "flex",
261
258
  flexDirection: "row",
262
259
  alignItems: "center",
@@ -273,7 +270,6 @@ const BranchNode = _storybook_react_native_theming.styled.TouchableOpacity(({ de
273
270
  }
274
271
  }));
275
272
  const LeafNode = _storybook_react_native_theming.styled.TouchableOpacity(({ depth = 0, selected, theme }) => ({
276
- cursor: "pointer",
277
273
  color: "inherit",
278
274
  display: "flex",
279
275
  gap: 6,
@@ -367,8 +363,7 @@ const StoryNode = react.default.memo((0, react.forwardRef)(function StoryNode({
367
363
  });
368
364
  }));
369
365
  StoryNode.displayName = "StoryNode";
370
- //#endregion
371
- //#region src/SelectedNodeProvider.tsx
366
+ // src/SelectedNodeProvider.tsx
372
367
  const SelectedNodeContext = (0, react.createContext)({
373
368
  registerCallback: () => {},
374
369
  scrollCallback: () => {}
@@ -390,12 +385,10 @@ const SelectedNodeProvider = ({ children }) => {
390
385
  });
391
386
  };
392
387
  const useSelectedNode = () => (0, react.useContext)(SelectedNodeContext);
393
- //#endregion
394
- //#region src/DrawerKeyboardInsetContext.tsx
388
+ // src/DrawerKeyboardInsetContext.tsx
395
389
  const DrawerKeyboardInsetContext = (0, react.createContext)(0);
396
390
  const useDrawerKeyboardInset = () => (0, react.useContext)(DrawerKeyboardInsetContext);
397
- //#endregion
398
- //#region src/Tree.tsx
391
+ // src/Tree.tsx
399
392
  const Node = react.default.memo(function Node({ item, refId, isOrphan: _isOrphan, isDisplayed: _isDisplayed, isSelected, isFullyExpanded, color: _2, setFullyExpanded, isExpanded, setExpanded, onSelectStoryId }) {
400
393
  const id = (0, _storybook_react_native_ui_common.createId)(item.id, refId);
401
394
  if (item.type === "story") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LeafNodeStyleWrapper, {
@@ -431,7 +424,7 @@ const Node = react.default.memo(function Node({ item, refId, isOrphan: _isOrphan
431
424
  "aria-expanded": isExpanded,
432
425
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapseIcon, { isExpanded }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RootNodeText, { children: (0, _storybook_react_native_ui_common.startCase)(item.name) })]
433
426
  }), isExpanded && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_storybook_react_native_ui_common.IconButton, {
434
- "aria-label": isFullyExpanded ? "Expand" : "Collapse",
427
+ "aria-label": isFullyExpanded ? "Collapse all" : "Expand all",
435
428
  "data-action": "expand-all",
436
429
  "data-expanded": isFullyExpanded,
437
430
  hitSlop: {
@@ -447,23 +440,26 @@ const Node = react.default.memo(function Node({ item, refId, isOrphan: _isOrphan
447
440
  children: isFullyExpanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CollapseAllIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExpandAllIcon, {})
448
441
  })]
449
442
  }, id);
450
- if (item.type === "component" || item.type === "group") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(item.type === "component" ? ComponentNode : GroupNode, {
451
- id,
452
- "aria-controls": item.children && item.children[0],
453
- "aria-expanded": isExpanded,
454
- depth: item.depth,
455
- isComponent: item.type === "component",
456
- isExpandable: item.children && item.children.length > 0,
457
- isExpanded,
458
- onPress: (event) => {
459
- event.preventDefault();
460
- setExpanded({
461
- ids: [item.id],
462
- value: !isExpanded
463
- });
464
- },
465
- children: (0, _storybook_react_native_ui_common.startCase)(item.name)
466
- }, id);
443
+ if (item.type === "component" || item.type === "group") {
444
+ const BranchNode = item.type === "component" ? ComponentNode : GroupNode;
445
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BranchNode, {
446
+ id,
447
+ "aria-controls": item.children && item.children[0],
448
+ "aria-expanded": isExpanded,
449
+ depth: item.depth,
450
+ isComponent: item.type === "component",
451
+ isExpandable: item.children && item.children.length > 0,
452
+ isExpanded,
453
+ onPress: (event) => {
454
+ event.preventDefault();
455
+ setExpanded({
456
+ ids: [item.id],
457
+ value: !isExpanded
458
+ });
459
+ },
460
+ children: (0, _storybook_react_native_ui_common.startCase)(item.name)
461
+ }, id);
462
+ }
467
463
  return null;
468
464
  });
469
465
  const LeafNodeStyleWrapper = _storybook_react_native_theming.styled.View(({ theme }) => ({
@@ -505,7 +501,6 @@ const CollapseButton = _storybook_react_native_theming.styled.TouchableOpacity((
505
501
  borderRadius: 4,
506
502
  gap: 6,
507
503
  alignItems: "center",
508
- cursor: "pointer",
509
504
  minHeight: 34
510
505
  }));
511
506
  const flexStyle$5 = { flex: 1 };
@@ -757,8 +752,7 @@ const Root = react.default.memo(function Root({ setExpanded, isFullyExpanded, ex
757
752
  setFullyExpanded
758
753
  });
759
754
  });
760
- //#endregion
761
- //#region src/Refs.tsx
755
+ // src/Refs.tsx
762
756
  const Wrapper = _storybook_react_native_theming.styled.View(() => ({ flex: 1 }));
763
757
  const Ref = react.default.memo(function Ref(props) {
764
758
  const { index, id: refId, title = refId, isLoading: isLoadingMain, isBrowsing, selectedStoryId, loginUrl, type, expanded = true, indexError, previewInitialized, setSelection } = props;
@@ -794,12 +788,12 @@ const Ref = react.default.memo(function Ref(props) {
794
788
  })
795
789
  }) });
796
790
  });
797
- //#endregion
798
- //#region src/Explorer.tsx
791
+ // src/Explorer.tsx
799
792
  const containerStyle = { flex: 1 };
800
793
  const Explorer = react.default.memo(function Explorer({ isLoading, isBrowsing, dataset, selected, setSelection }) {
794
+ const containerRef = (0, react.useRef)(null);
801
795
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
802
- ref: (0, react.useRef)(null),
796
+ ref: containerRef,
803
797
  style: containerStyle,
804
798
  id: "storybook-explorer-tree",
805
799
  testID: "storybook-explorer-tree",
@@ -813,9 +807,9 @@ const Explorer = react.default.memo(function Explorer({ isLoading, isBrowsing, d
813
807
  }))
814
808
  });
815
809
  });
810
+ // src/constants.ts
816
811
  const DEFAULT_REF_ID = "storybook_internal";
817
- //#endregion
818
- //#region src/Search.tsx
812
+ // src/Search.tsx
819
813
  const DEFAULT_MAX_SEARCH_RESULTS = 50;
820
814
  const SearchIconWrapper = _storybook_react_native_theming.styled.View({
821
815
  position: "absolute",
@@ -856,7 +850,6 @@ const ClearIcon = _storybook_react_native_theming.styled.TouchableOpacity(({ the
856
850
  right: 0,
857
851
  zIndex: 1,
858
852
  color: theme.textMutedColor,
859
- cursor: "pointer",
860
853
  display: "flex",
861
854
  alignItems: "center",
862
855
  justifyContent: "center",
@@ -917,15 +910,17 @@ const Search = react.default.memo(function Search({ children, dataset, setSelect
917
910
  (0, react.useEffect)(() => {
918
911
  onSearchActiveChange?.(!isBrowsing);
919
912
  }, [isBrowsing, onSearchActiveChange]);
920
- const fuzzyResults = (0, _nozbe_microfuzz_react_js.useFuzzySearchList)({
913
+ const getText = (0, react.useCallback)((item) => [item.name, item.path?.join(" ") ?? ""], []);
914
+ const mapResultItem = (0, react.useCallback)(({ item, score, matches }) => ({
915
+ item,
916
+ score,
917
+ matches: matches ?? []
918
+ }), []);
919
+ const fuzzyResults = (0, _nozbe_microfuzz_react.useFuzzySearchList)({
921
920
  list: searchList,
922
921
  queryText,
923
- getText: (0, react.useCallback)((item) => [item.name, item.path?.join(" ") ?? ""], []),
924
- mapResultItem: (0, react.useCallback)(({ item, score, matches }) => ({
925
- item,
926
- score,
927
- matches: matches ?? []
928
- }), [])
922
+ getText,
923
+ mapResultItem
929
924
  });
930
925
  const results = (0, react.useMemo)(() => {
931
926
  if (!queryText) return [];
@@ -962,7 +957,8 @@ const Search = react.default.memo(function Search({ children, dataset, setSelect
962
957
  ref: inputRef,
963
958
  onChangeText: setInputValue,
964
959
  onFocus: () => setIsOpen(true),
965
- returnKeyType: "search"
960
+ returnKeyType: "search",
961
+ accessibilityLabel: "Find components"
966
962
  }),
967
963
  isOpen && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ClearIcon, {
968
964
  accessibilityRole: "button",
@@ -987,14 +983,12 @@ const Search = react.default.memo(function Search({ children, dataset, setSelect
987
983
  })]
988
984
  });
989
985
  });
990
- //#endregion
991
- //#region src/SearchResults.tsx
986
+ // src/SearchResults.tsx
992
987
  const noResultsFirstLineStyle = { marginBottom: 4 };
993
988
  const flexStyle$3 = { flex: 1 };
994
989
  const ResultRow = _storybook_react_native_theming.styled.TouchableOpacity(({ theme, isHighlighted }) => ({
995
990
  width: "100%",
996
991
  border: "none",
997
- cursor: "pointer",
998
992
  display: "flex",
999
993
  flexDirection: "row",
1000
994
  alignItems: "flex-start",
@@ -1214,8 +1208,7 @@ const SearchResults = react.default.memo(function SearchResults({ query, results
1214
1208
  })
1215
1209
  });
1216
1210
  });
1217
- //#endregion
1218
- //#region src/Sidebar.tsx
1211
+ // src/Sidebar.tsx
1219
1212
  const Container$1 = _storybook_react_native_theming.styled.View(({ theme }) => ({
1220
1213
  flex: 1,
1221
1214
  flexDirection: "column",
@@ -1303,14 +1296,12 @@ const Sidebar = react.default.memo(function Sidebar({ storyId = null, refId = DE
1303
1296
  })
1304
1297
  }) }) });
1305
1298
  });
1306
- //#endregion
1307
- //#region src/useAnimatedValue.ts
1299
+ // src/useAnimatedValue.ts
1308
1300
  function useAnimatedValue(initialValue, config) {
1309
1301
  const [value] = (0, react.useState)(new react_native.Animated.Value(initialValue, config));
1310
1302
  return value;
1311
1303
  }
1312
- //#endregion
1313
- //#region src/MobileAddonsPanel.tsx
1304
+ // src/MobileAddonsPanel.tsx
1314
1305
  const MobileAddonsPanel = (0, react.forwardRef)(({ storyId, parameters }, ref) => {
1315
1306
  const theme = (0, _storybook_react_native_theming.useTheme)();
1316
1307
  const { height } = (0, react_native.useWindowDimensions)();
@@ -1518,8 +1509,7 @@ const TabText = _storybook_react_native_theming.styled.Text(({ theme, active })
1518
1509
  fontSize: 12,
1519
1510
  lineHeight: 12
1520
1511
  }));
1521
- //#endregion
1522
- //#region src/MobileMenuDrawer.tsx
1512
+ // src/MobileMenuDrawer.tsx
1523
1513
  const flexStyle$1 = { flex: 1 };
1524
1514
  const portalContainerStyle = {
1525
1515
  flex: 1,
@@ -1742,8 +1732,7 @@ const MobileMenuDrawer = (0, react.memo)((0, react.forwardRef)(({ children, onVi
1742
1732
  })
1743
1733
  });
1744
1734
  }));
1745
- //#endregion
1746
- //#region src/ResizeHandle.tsx
1735
+ // src/ResizeHandle.tsx
1747
1736
  const ResizeHandle = (0, react.memo)(function ResizeHandle({ direction, onResize, onResizeStart, onResizeEnd }) {
1748
1737
  const theme = (0, _storybook_react_native_theming.useTheme)();
1749
1738
  const [active, setActive] = (0, react.useState)(false);
@@ -1810,8 +1799,7 @@ const ResizeHandle = (0, react.memo)(function ResizeHandle({ direction, onResize
1810
1799
  style
1811
1800
  });
1812
1801
  });
1813
- //#endregion
1814
- //#region src/StorybookLogo.tsx
1802
+ // src/StorybookLogo.tsx
1815
1803
  const WIDTH = 125;
1816
1804
  const HEIGHT = 25;
1817
1805
  const NoBrandLogo = ({ theme }) => theme.base === "light" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Logo, {
@@ -1850,15 +1838,16 @@ const BrandLogo = ({ theme }) => {
1850
1838
  else return image;
1851
1839
  };
1852
1840
  const BrandTitle = ({ theme }) => {
1841
+ const brandTitleStyle = (0, react.useMemo)(() => {
1842
+ return {
1843
+ width: WIDTH,
1844
+ height: HEIGHT,
1845
+ color: theme.color.defaultText,
1846
+ fontSize: theme.typography.size.m1
1847
+ };
1848
+ }, [theme]);
1853
1849
  const title = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.Text, {
1854
- style: (0, react.useMemo)(() => {
1855
- return {
1856
- width: WIDTH,
1857
- height: HEIGHT,
1858
- color: theme.color.defaultText,
1859
- fontSize: theme.typography.size.m1
1860
- };
1861
- }, [theme]),
1850
+ style: brandTitleStyle,
1862
1851
  numberOfLines: 1,
1863
1852
  ellipsizeMode: "tail",
1864
1853
  children: theme.brand.title
@@ -1880,8 +1869,7 @@ const StorybookLogo = ({ theme }) => {
1880
1869
  else if (title) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BrandTitle, { theme });
1881
1870
  else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NoBrandLogo, { theme });
1882
1871
  };
1883
- //#endregion
1884
- //#region src/Layout.tsx
1872
+ // src/Layout.tsx
1885
1873
  const desktopLogoContainer = {
1886
1874
  flexDirection: "row",
1887
1875
  alignItems: "center",
@@ -2031,6 +2019,7 @@ const Layout = ({ storyHash, story, storyBackgroundColor, children }) => {
2031
2019
  const setSelection = (0, react.useCallback)(({ storyId: newStoryId }) => {
2032
2020
  storybook_manager_api.addons.getChannel().emit(storybook_internal_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
2033
2021
  }, []);
2022
+ const storyPath = react_native.Platform.OS === "ios" && story ? `${story.title}/${story.name}` : void 0;
2034
2023
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.View, {
2035
2024
  style: containerStyle,
2036
2025
  accessibilityElementsHidden: isDrawerOpen,
@@ -2117,6 +2106,7 @@ const Layout = ({ storyHash, story, storyBackgroundColor, children }) => {
2117
2106
  onPress: () => mobileMenuDrawerRef.current?.setMobileMenuOpen(true),
2118
2107
  accessibilityRole: "button",
2119
2108
  accessibilityLabel: "Open story list",
2109
+ accessibilityValue: storyPath ? { text: storyPath } : void 0,
2120
2110
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MenuIcon, { color: theme.color.mediumdark }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native.Text, {
2121
2111
  style: navButtonTextStyle,
2122
2112
  numberOfLines: 1,
@@ -2187,7 +2177,6 @@ const Button = _storybook_react_native_theming.styled.TouchableOpacity(({ theme
2187
2177
  paddingHorizontal: 7,
2188
2178
  fontWeight: theme.typography.weight.bold
2189
2179
  }));
2190
- //#endregion
2191
2180
  exports.ComponentNode = ComponentNode;
2192
2181
  exports.Explorer = Explorer;
2193
2182
  exports.GroupNode = GroupNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/react-native-ui-lite",
3
- "version": "11.0.0-next.1",
3
+ "version": "11.0.0-next.2",
4
4
  "description": "lightweight ui components for react native storybook",
5
5
  "keywords": [
6
6
  "react",
@@ -29,25 +29,25 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@gorhom/portal": "^1.0.14",
32
- "@legendapp/list": "^3.3.3",
32
+ "@legendapp/list": "^3.7.2",
33
33
  "@nozbe/microfuzz": "^1.0.0",
34
- "@storybook/react": "^11.0.0-alpha.6",
35
- "@storybook/react-native-theming": "^11.0.0-next.1",
36
- "@storybook/react-native-ui-common": "^11.0.0-next.1",
34
+ "@storybook/react": "^11.0.0-beta.3",
35
+ "@storybook/react-native-theming": "^11.0.0-next.2",
36
+ "@storybook/react-native-ui-common": "^11.0.0-next.2",
37
37
  "polished": "^4.3.1"
38
38
  },
39
39
  "devDependencies": {
40
- "@types/react": "~19.2.14",
41
- "storybook": "^11.0.0-alpha.6",
40
+ "@types/react": "~19.3.0",
41
+ "storybook": "^11.0.0-beta.3",
42
42
  "ts-dedent": "^2.3.0",
43
- "tsdown": "^0.22.12",
43
+ "tsdown": "^0.23.7",
44
44
  "typescript": "~6.0.3"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": "*",
48
48
  "react-native": ">=0.57.0",
49
49
  "react-native-safe-area-context": "*",
50
- "storybook": "^11.0.0-alpha.6"
50
+ "storybook": "^11.0.0-beta.1"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=20.0.0"
package/src/Explorer.tsx CHANGED
@@ -21,7 +21,7 @@ export const Explorer: FC<ExplorerProps> = React.memo(function Explorer({
21
21
  selected,
22
22
  setSelection,
23
23
  }) {
24
- const containerRef = useRef<View>(null);
24
+ const containerRef = useRef<React.ComponentRef<typeof View>>(null);
25
25
 
26
26
  return (
27
27
  <View
package/src/Layout.tsx CHANGED
@@ -20,7 +20,14 @@ import {
20
20
  useRef,
21
21
  useState,
22
22
  } from 'react';
23
- import { Text, TouchableOpacity, useWindowDimensions, View, ViewStyle } from 'react-native';
23
+ import {
24
+ Platform,
25
+ Text,
26
+ TouchableOpacity,
27
+ useWindowDimensions,
28
+ View,
29
+ ViewStyle,
30
+ } from 'react-native';
24
31
  import { SafeAreaProvider, useSafeAreaInsets } from 'react-native-safe-area-context';
25
32
  import { SET_CURRENT_STORY } from 'storybook/internal/core-events';
26
33
  import type { Args, StoryContext } from 'storybook/internal/csf';
@@ -262,6 +269,10 @@ export const Layout = ({
262
269
  channel.emit(SET_CURRENT_STORY, { storyId: newStoryId });
263
270
  }, []);
264
271
 
272
+ // The story list button's label replaces its text on iOS, so expose the open story as its value
273
+ // there. Android still reads the text, and would append a value to the label.
274
+ const storyPath = Platform.OS === 'ios' && story ? `${story.title}/${story.name}` : undefined;
275
+
265
276
  return (
266
277
  <View
267
278
  style={containerStyle}
@@ -383,6 +394,7 @@ export const Layout = ({
383
394
  onPress={() => mobileMenuDrawerRef.current?.setMobileMenuOpen(true)}
384
395
  accessibilityRole="button"
385
396
  accessibilityLabel="Open story list"
397
+ accessibilityValue={storyPath ? { text: storyPath } : undefined}
386
398
  >
387
399
  <MenuIcon color={theme.color.mediumdark} />
388
400
  <Text style={navButtonTextStyle} numberOfLines={1}>
@@ -20,7 +20,7 @@ import {
20
20
  Pressable,
21
21
  View,
22
22
  ViewStyle,
23
- KeyboardEventListener,
23
+ KeyboardEvent,
24
24
  Platform,
25
25
  } from 'react-native';
26
26
  import { useSelectedNode } from './SelectedNodeProvider';
@@ -71,11 +71,11 @@ export const useAnimatedModalHeight = () => {
71
71
  setKeyboardHeight(0);
72
72
  };
73
73
 
74
- const handleKeyboardShow: KeyboardEventListener = (e) => {
74
+ const handleKeyboardShow = (e: KeyboardEvent) => {
75
75
  expand(e.endCoordinates.height);
76
76
  };
77
77
 
78
- const handleKeyboardHide: KeyboardEventListener = () => {
78
+ const handleKeyboardHide = () => {
79
79
  collapse();
80
80
  };
81
81
 
package/src/Search.tsx CHANGED
@@ -70,7 +70,6 @@ const ClearIcon = styled.TouchableOpacity(({ theme }) => ({
70
70
  right: 0,
71
71
  zIndex: 1,
72
72
  color: theme.textMutedColor,
73
- cursor: 'pointer',
74
73
  display: 'flex',
75
74
  alignItems: 'center',
76
75
  justifyContent: 'center',
@@ -97,7 +96,7 @@ export const Search = React.memo<{
97
96
  onSearchActiveChange,
98
97
  }) {
99
98
  const theme = useTheme();
100
- const inputRef = useRef<TextInput>(null);
99
+ const inputRef = useRef<React.ComponentRef<typeof TextInput>>(null);
101
100
  const [inputValue, setInputValue] = useState(initialQuery);
102
101
  const [isOpen, setIsOpen] = useState(false);
103
102
  const [allComponents, showAllComponents] = useState(false);
@@ -257,6 +256,7 @@ export const Search = React.memo<{
257
256
  onChangeText={setInputValue}
258
257
  onFocus={() => setIsOpen(true)}
259
258
  returnKeyType="search"
259
+ accessibilityLabel="Find components"
260
260
  />
261
261
 
262
262
  {isOpen && (
@@ -31,7 +31,6 @@ const ResultRow = styled.TouchableOpacity<{ isHighlighted: boolean }>(
31
31
  ({ theme, isHighlighted }) => ({
32
32
  width: '100%',
33
33
  border: 'none',
34
- cursor: 'pointer',
35
34
  display: 'flex',
36
35
  flexDirection: 'row',
37
36
  alignItems: 'flex-start',
package/src/Tree.tsx CHANGED
@@ -20,7 +20,7 @@ import type {
20
20
  ComponentEntry,
21
21
  GroupEntry,
22
22
  State,
23
- StoriesHash,
23
+ IndexHash,
24
24
  StoryEntry,
25
25
  } from 'storybook/manager-api';
26
26
  import { ComponentNode, GroupNode, StoryNode } from './TreeNode';
@@ -93,7 +93,7 @@ export const Node = React.memo<NodeProps>(function Node({
93
93
  </CollapseButton>
94
94
  {isExpanded && (
95
95
  <IconButton
96
- aria-label={isFullyExpanded ? 'Expand' : 'Collapse'}
96
+ aria-label={isFullyExpanded ? 'Collapse all' : 'Expand all'}
97
97
  data-action="expand-all"
98
98
  data-expanded={isFullyExpanded}
99
99
  hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
@@ -176,7 +176,6 @@ const CollapseButton = styled.TouchableOpacity(() => ({
176
176
  borderRadius: 4,
177
177
  gap: 6,
178
178
  alignItems: 'center',
179
- cursor: 'pointer',
180
179
  minHeight: 34,
181
180
  }));
182
181
 
@@ -217,7 +216,7 @@ export const Tree = React.memo<{
217
216
  isMain: boolean;
218
217
  status?: State['status'];
219
218
  refId: string;
220
- data: StoriesHash;
219
+ data: IndexHash;
221
220
  docsMode: boolean;
222
221
  selectedStoryId: string | null;
223
222
  onSelectStoryId: (storyId: string) => void;
package/src/TreeNode.tsx CHANGED
@@ -1,10 +1,30 @@
1
1
  import { styled, useTheme } from '@storybook/react-native-theming';
2
2
 
3
- import React, { ComponentProps, FC, forwardRef, useMemo } from 'react';
3
+ import React, { FC, forwardRef, useMemo } from 'react';
4
4
  import { transparentize } from 'polished';
5
- import { View } from 'react-native';
5
+ import { TouchableOpacityProps, View } from 'react-native';
6
6
  import { CollapseIcon, ComponentIcon, GroupIcon, StoryIcon } from './icon/iconDataUris';
7
7
 
8
+ // Declared here rather than inferred from the styled components. Since react-native 0.88 its default types are the
9
+ // generated ones, where TouchableOpacityProps and View's ref expand into types react-native doesn't export
10
+ // (WithAnimatedValue, ____ViewStyleProp_Internal, ReactNativeElement), so TypeScript can't name them in our emitted
11
+ // declarations. An interface keeps its own name, so these don't expand.
12
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
13
+ export interface StoryNodeRef extends React.ComponentRef<typeof View> {}
14
+
15
+ export interface BranchNodeProps extends TouchableOpacityProps {
16
+ depth?: number;
17
+ isExpandable?: boolean;
18
+ isExpanded?: boolean;
19
+ isComponent?: boolean;
20
+ isSelected?: boolean;
21
+ }
22
+
23
+ export interface LeafNodeProps extends TouchableOpacityProps {
24
+ depth?: number;
25
+ selected?: boolean;
26
+ }
27
+
8
28
  export interface NodeProps {
9
29
  children: React.ReactNode | React.ReactNode[];
10
30
  isExpandable?: boolean;
@@ -18,55 +38,47 @@ const BranchNodeText = styled.Text<{ isSelected?: boolean }>(({ theme }) => ({
18
38
  color: theme.color.defaultText,
19
39
  }));
20
40
 
21
- const BranchNode = styled.TouchableOpacity<{
22
- depth?: number;
23
- isExpandable?: boolean;
24
- isExpanded?: boolean;
25
- isComponent?: boolean;
26
- isSelected?: boolean;
27
- }>(({ depth = 0, isExpandable = false, theme }) => ({
28
- width: '100%',
29
- border: 'none',
30
- cursor: 'pointer',
31
- display: 'flex',
32
- flexDirection: 'row',
33
- alignItems: 'center',
34
- paddingLeft: (isExpandable ? 8 : 22) + depth * 18,
35
-
36
- backgroundColor: 'transparent',
37
- minHeight: 34,
38
- borderRadius: 4,
39
- gap: 6,
40
- paddingTop: 8,
41
- paddingBottom: 7,
42
-
43
- // will this actually do anything?
44
- '&:hover, &:focus': {
45
- backgroundColor: transparentize(0.93, theme.color.secondary),
46
- outline: 'none',
47
- },
48
- }));
49
-
50
- const LeafNode = styled.TouchableOpacity<{ depth?: number; selected?: boolean }>(
51
- ({ depth = 0, selected, theme }) => ({
52
- cursor: 'pointer',
53
- color: 'inherit',
41
+ const BranchNode = styled.TouchableOpacity<BranchNodeProps>(
42
+ ({ depth = 0, isExpandable = false, theme }) => ({
43
+ width: '100%',
44
+ border: 'none',
54
45
  display: 'flex',
55
- gap: 6,
56
46
  flexDirection: 'row',
57
47
  alignItems: 'center',
58
- paddingLeft: 22 + depth * 18,
48
+ paddingLeft: (isExpandable ? 8 : 22) + depth * 18,
49
+
50
+ backgroundColor: 'transparent',
51
+ minHeight: 34,
52
+ borderRadius: 4,
53
+ gap: 6,
59
54
  paddingTop: 8,
60
55
  paddingBottom: 7,
61
- backgroundColor: selected ? theme.color.secondary : undefined,
62
- // not sure 👇
63
- width: '100%',
64
- borderRadius: 4,
65
- paddingRight: 20,
66
- minHeight: 34,
56
+
57
+ // will this actually do anything?
58
+ '&:hover, &:focus': {
59
+ backgroundColor: transparentize(0.93, theme.color.secondary),
60
+ outline: 'none',
61
+ },
67
62
  })
68
63
  );
69
64
 
65
+ const LeafNode = styled.TouchableOpacity<LeafNodeProps>(({ depth = 0, selected, theme }) => ({
66
+ color: 'inherit',
67
+ display: 'flex',
68
+ gap: 6,
69
+ flexDirection: 'row',
70
+ alignItems: 'center',
71
+ paddingLeft: 22 + depth * 18,
72
+ paddingTop: 8,
73
+ paddingBottom: 7,
74
+ backgroundColor: selected ? theme.color.secondary : undefined,
75
+ // not sure 👇
76
+ width: '100%',
77
+ borderRadius: 4,
78
+ paddingRight: 20,
79
+ minHeight: 34,
80
+ }));
81
+
70
82
  const LeafNodeText = styled.Text<{ depth?: number; selected?: boolean }>(({ theme, selected }) => ({
71
83
  fontSize: theme.typography.size.s2 + 1,
72
84
  flexShrink: 1,
@@ -81,9 +93,7 @@ const Wrapper = styled.View({
81
93
  gap: 6,
82
94
  });
83
95
 
84
- export const GroupNode: FC<
85
- ComponentProps<typeof BranchNode> & { isExpanded?: boolean; isExpandable?: boolean }
86
- > = React.memo(function GroupNode({
96
+ export const GroupNode: FC<BranchNodeProps> = React.memo(function GroupNode({
87
97
  children,
88
98
  isExpanded = false,
89
99
  isExpandable = false,
@@ -106,32 +116,32 @@ export const GroupNode: FC<
106
116
  );
107
117
  });
108
118
 
109
- export const ComponentNode: FC<ComponentProps<typeof BranchNode>> = React.memo(
110
- function ComponentNode({ children, isExpanded, isExpandable, ...props }) {
111
- const theme = useTheme();
119
+ export const ComponentNode: FC<BranchNodeProps> = React.memo(function ComponentNode({
120
+ children,
121
+ isExpanded,
122
+ isExpandable,
123
+ ...props
124
+ }) {
125
+ const theme = useTheme();
112
126
 
113
- const color = useMemo(() => {
114
- return theme.color.secondary;
115
- }, [theme.color.secondary]);
127
+ const color = useMemo(() => {
128
+ return theme.color.secondary;
129
+ }, [theme.color.secondary]);
116
130
 
117
- return (
118
- <BranchNode isExpandable={isExpandable} accessibilityRole="button" {...props}>
119
- {/* workaround for macos icon color bug */}
120
- <Wrapper key={`component-${props.id}-${color}`}>
121
- {isExpandable && <CollapseIcon isExpanded={isExpanded} />}
122
- <ComponentIcon width={12} height={12} color={color} />
123
- </Wrapper>
124
- <BranchNodeText numberOfLines={1}>{children}</BranchNodeText>
125
- </BranchNode>
126
- );
127
- }
128
- );
131
+ return (
132
+ <BranchNode isExpandable={isExpandable} accessibilityRole="button" {...props}>
133
+ {/* workaround for macos icon color bug */}
134
+ <Wrapper key={`component-${props.id}-${color}`}>
135
+ {isExpandable && <CollapseIcon isExpanded={isExpanded} />}
136
+ <ComponentIcon width={12} height={12} color={color} />
137
+ </Wrapper>
138
+ <BranchNodeText numberOfLines={1}>{children}</BranchNodeText>
139
+ </BranchNode>
140
+ );
141
+ });
129
142
 
130
143
  export const StoryNode = React.memo(
131
- forwardRef<View, ComponentProps<typeof LeafNode>>(function StoryNode(
132
- { children, ...props },
133
- ref
134
- ) {
144
+ forwardRef<StoryNodeRef, LeafNodeProps>(function StoryNode({ children, ...props }, ref) {
135
145
  const theme = useTheme();
136
146
 
137
147
  const color = useMemo(() => {
@@ -1,6 +1,13 @@
1
1
  // taken from https://github.com/react-native-community/hooks/blob/main/src/useKeyboard.ts
2
2
  import { useEffect, useState } from 'react';
3
- import { Keyboard, KeyboardEventListener, KeyboardMetrics } from 'react-native';
3
+ import { Keyboard, KeyboardEvent, KeyboardMetrics } from 'react-native';
4
+
5
+ // react-native 0.88 no longer exports KeyboardEventListener
6
+ type KeyboardEventListener = (event: KeyboardEvent) => void;
7
+
8
+ // Only iOS keyboard events have startCoordinates
9
+ const startCoordinates = (e: KeyboardEvent): KeyboardMetrics | undefined =>
10
+ 'startCoordinates' in e ? e.startCoordinates : undefined;
4
11
 
5
12
  const emptyCoordinates = Object.freeze({
6
13
  screenX: 0,
@@ -22,20 +29,20 @@ export function useKeyboard() {
22
29
  const [keyboardHeight, setKeyboardHeight] = useState<number>(0);
23
30
 
24
31
  const handleKeyboardWillShow: KeyboardEventListener = (e) => {
25
- setCoordinates({ start: e.startCoordinates, end: e.endCoordinates });
32
+ setCoordinates({ start: startCoordinates(e), end: e.endCoordinates });
26
33
  };
27
34
  const handleKeyboardDidShow: KeyboardEventListener = (e) => {
28
35
  setShown(true);
29
- setCoordinates({ start: e.startCoordinates, end: e.endCoordinates });
36
+ setCoordinates({ start: startCoordinates(e), end: e.endCoordinates });
30
37
  setKeyboardHeight(e.endCoordinates.height);
31
38
  };
32
39
  const handleKeyboardWillHide: KeyboardEventListener = (e) => {
33
- setCoordinates({ start: e.startCoordinates, end: e.endCoordinates });
40
+ setCoordinates({ start: startCoordinates(e), end: e.endCoordinates });
34
41
  };
35
42
  const handleKeyboardDidHide: KeyboardEventListener = (e) => {
36
43
  setShown(false);
37
44
  if (e) {
38
- setCoordinates({ start: e.startCoordinates, end: e.endCoordinates });
45
+ setCoordinates({ start: startCoordinates(e), end: e.endCoordinates });
39
46
  } else {
40
47
  setCoordinates(initialValue);
41
48
  setKeyboardHeight(0);