@storybook/react-native-ui-lite 10.2.2-alpha.2 → 10.2.2-alpha.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.js CHANGED
@@ -384,7 +384,7 @@ var GroupNode = import_react2.default.memo(function GroupNode2({
384
384
  const color = (0, import_react2.useMemo)(() => {
385
385
  return theme.base === "dark" ? theme.color.primary : theme.color.ultraviolet;
386
386
  }, [theme.base, theme.color.primary, theme.color.ultraviolet]);
387
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(BranchNode, { isExpandable, ...props, children: [
387
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(BranchNode, { isExpandable, accessibilityRole: "button", ...props, children: [
388
388
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Wrapper, { children: [
389
389
  isExpandable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollapseIcon, { isExpanded }),
390
390
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(GroupIcon, { width: 14, height: 14, color })
@@ -398,7 +398,7 @@ var ComponentNode = import_react2.default.memo(
398
398
  const color = (0, import_react2.useMemo)(() => {
399
399
  return theme.color.secondary;
400
400
  }, [theme.color.secondary]);
401
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(BranchNode, { isExpandable, ...props, children: [
401
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(BranchNode, { isExpandable, accessibilityRole: "button", ...props, children: [
402
402
  /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(Wrapper, { children: [
403
403
  isExpandable && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CollapseIcon, { isExpanded }),
404
404
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ComponentIcon, { width: 12, height: 12, color })
@@ -413,7 +413,7 @@ var StoryNode = import_react2.default.memo(
413
413
  const color = (0, import_react2.useMemo)(() => {
414
414
  return props.selected ? theme.color.lightest : theme.color.seafoam;
415
415
  }, [props.selected, theme.color.lightest, theme.color.seafoam]);
416
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(LeafNode, { ...props, ref, children: [
416
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(LeafNode, { ...props, ref, accessibilityRole: "button", children: [
417
417
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(StoryIcon, { width: 14, height: 14, color }) }, `story-${props.id}-${color}`),
418
418
  /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(LeafNodeText, { selected: props.selected, numberOfLines: 1, children })
419
419
  ] });
@@ -464,10 +464,22 @@ var useSelectedNode = () => (0, import_react3.useContext)(SelectedNodeContext);
464
464
 
465
465
  // src/Tree.tsx
466
466
  var import_jsx_runtime4 = require("react/jsx-runtime");
467
- var TextItem = import_react_native_theming3.styled.Text(({ theme }) => ({
468
- fontSize: theme.typography.size.s2 + 1,
469
- color: theme.color.defaultText
470
- }));
467
+ var CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
468
+ function words(str) {
469
+ return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
470
+ }
471
+ function startCase(str) {
472
+ const words$1 = words(str.trim());
473
+ let result = "";
474
+ for (let i = 0; i < words$1.length; i++) {
475
+ const word = words$1[i];
476
+ if (result) {
477
+ result += " ";
478
+ }
479
+ result += word[0].toUpperCase() + word.slice(1).toLowerCase();
480
+ }
481
+ return result;
482
+ }
471
483
  var Node = import_react4.default.memo(function Node2({
472
484
  item,
473
485
  refId,
@@ -483,7 +495,7 @@ var Node = import_react4.default.memo(function Node2({
483
495
  }) {
484
496
  const id = (0, import_react_native_ui_common.createId)(item.id, refId);
485
497
  if (item.type === "story") {
486
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LeafNodeStyleWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
498
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LeafNodeStyleWrapper, { accessible: false, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
487
499
  StoryNode,
488
500
  {
489
501
  selected: isSelected,
@@ -508,10 +520,11 @@ var Node = import_react4.default.memo(function Node2({
508
520
  event.preventDefault();
509
521
  setExpanded({ ids: [item.id], value: !isExpanded });
510
522
  },
523
+ accessibilityRole: "button",
511
524
  "aria-expanded": isExpanded,
512
525
  children: [
513
526
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CollapseIcon, { isExpanded }),
514
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(TextItem, { children: item.renderLabel?.(item, {}) || item.name })
527
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RootNodeText, { children: startCase(item.name) })
515
528
  ]
516
529
  }
517
530
  ),
@@ -547,7 +560,7 @@ var Node = import_react4.default.memo(function Node2({
547
560
  event.preventDefault();
548
561
  setExpanded({ ids: [item.id], value: !isExpanded });
549
562
  },
550
- children: item.renderLabel?.(item) || item.name
563
+ children: startCase(item.name)
551
564
  },
552
565
  id
553
566
  );
@@ -576,7 +589,7 @@ var RootNode = import_react_native_theming3.styled.View(() => ({
576
589
  minHeight: 34
577
590
  }));
578
591
  var RootNodeText = import_react_native_theming3.styled.Text(({ theme }) => ({
579
- fontSize: theme.typography.size.s1 - 1,
592
+ fontSize: theme.typography.size.s2,
580
593
  fontWeight: theme.typography.weight.bold,
581
594
  color: theme.textMutedColor,
582
595
  lineHeight: 16,
@@ -917,17 +930,26 @@ var Explorer = import_react6.default.memo(function Explorer2({
917
930
  setSelection
918
931
  }) {
919
932
  const containerRef = (0, import_react6.useRef)(null);
920
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react_native3.View, { ref: containerRef, style: containerStyle, children: dataset.entries.map(([refId, ref]) => /* @__PURE__ */ (0, import_react7.createElement)(
921
- Ref,
933
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
934
+ import_react_native3.View,
922
935
  {
923
- ...ref,
924
- key: refId,
925
- isLoading,
926
- isBrowsing,
927
- selectedStoryId: selected?.refId === ref.id ? selected.storyId : null,
928
- setSelection
936
+ ref: containerRef,
937
+ style: containerStyle,
938
+ id: "storybook-explorer-tree",
939
+ testID: "storybook-explorer-tree",
940
+ children: dataset.entries.map(([refId, ref]) => /* @__PURE__ */ (0, import_react7.createElement)(
941
+ Ref,
942
+ {
943
+ ...ref,
944
+ key: refId,
945
+ isLoading,
946
+ isBrowsing,
947
+ selectedStoryId: selected?.refId === ref.id ? selected.storyId : null,
948
+ setSelection
949
+ }
950
+ ))
929
951
  }
930
- )) });
952
+ );
931
953
  });
932
954
 
933
955
  // src/Sidebar.tsx
@@ -1119,6 +1141,8 @@ var Search = import_react9.default.memo(function Search2({ children, dataset, se
1119
1141
  isOpen && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1120
1142
  ClearIcon,
1121
1143
  {
1144
+ accessibilityRole: "button",
1145
+ accessibilityLabel: "Clear search",
1122
1146
  onPress: () => {
1123
1147
  setInputValue("");
1124
1148
  inputRef.current.clear();
@@ -1268,16 +1292,25 @@ var Result = import_react10.default.memo(function Result2({
1268
1292
  );
1269
1293
  const nameHighlights = matches?.[0];
1270
1294
  const pathString = item.path?.join(" ") ?? "";
1271
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(ResultRow, { ...props, onPress: press, children: [
1272
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(IconWrapper, { children: [
1273
- item.type === "component" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ComponentIcon, { width: 14, height: 14, color: theme.color.secondary }),
1274
- item.type === "story" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StoryIcon, { width: 14, height: 14, color: theme.color.seafoam })
1275
- ] }),
1276
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(ResultRowContent, { testID: "search-result-item--label", children: [
1277
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Highlight, { text: item.name, ranges: nameHighlights, children: item.name }) }),
1278
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Path, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PathText, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Highlight, { text: pathString, ranges: matches?.[1], children: item.path?.join(" / ") }) }) })
1279
- ] })
1280
- ] });
1295
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1296
+ ResultRow,
1297
+ {
1298
+ ...props,
1299
+ onPress: press,
1300
+ accessibilityRole: "button",
1301
+ accessibilityLabel: `${item.name}, ${item.path?.join(" / ") ?? ""}`,
1302
+ children: [
1303
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(IconWrapper, { children: [
1304
+ item.type === "component" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ComponentIcon, { width: 14, height: 14, color: theme.color.secondary }),
1305
+ item.type === "story" && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StoryIcon, { width: 14, height: 14, color: theme.color.seafoam })
1306
+ ] }),
1307
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(ResultRowContent, { testID: "search-result-item--label", children: [
1308
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Title, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Highlight, { text: item.name, ranges: nameHighlights, children: item.name }) }),
1309
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Path, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(PathText, { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Highlight, { text: pathString, ranges: matches?.[1], children: item.path?.join(" / ") }) }) })
1310
+ ] })
1311
+ ]
1312
+ }
1313
+ );
1281
1314
  });
1282
1315
  var Text = import_react_native_theming6.styled.Text(({ theme }) => ({
1283
1316
  color: theme.color.defaultText
@@ -1340,7 +1373,13 @@ var SearchResults = import_react10.default.memo(function SearchResults2({
1340
1373
  case "header":
1341
1374
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(RecentlyOpenedTitle, { children: [
1342
1375
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "Recently opened" }),
1343
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react_native_ui_common4.IconButton, { onPress: listItem.clearLastViewed })
1376
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1377
+ import_react_native_ui_common4.IconButton,
1378
+ {
1379
+ onPress: listItem.clearLastViewed,
1380
+ accessibilityLabel: "Clear recently opened"
1381
+ }
1382
+ )
1344
1383
  ] });
1345
1384
  case "noResults":
1346
1385
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(NoResults, { children: [
@@ -1422,8 +1461,24 @@ var Swap = import_react11.default.memo(function Swap2({
1422
1461
  const aStyle = (0, import_react11.useMemo)(() => condition ? flexStyle4 : noneStyle, [condition]);
1423
1462
  const bStyle = (0, import_react11.useMemo)(() => condition ? noneStyle : flexStyle4, [condition]);
1424
1463
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
1425
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native6.View, { style: aStyle, children: a }),
1426
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_react_native6.View, { style: bStyle, children: b })
1464
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1465
+ import_react_native6.View,
1466
+ {
1467
+ style: aStyle,
1468
+ accessibilityElementsHidden: !condition,
1469
+ importantForAccessibility: condition ? "auto" : "no-hide-descendants",
1470
+ children: a
1471
+ }
1472
+ ),
1473
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1474
+ import_react_native6.View,
1475
+ {
1476
+ style: bStyle,
1477
+ accessibilityElementsHidden: condition,
1478
+ importantForAccessibility: condition ? "no-hide-descendants" : "auto",
1479
+ children: b
1480
+ }
1481
+ )
1427
1482
  ] });
1428
1483
  });
1429
1484
  var useCombination = (index, indexError, previewInitialized, status, refs) => {
@@ -1630,6 +1685,9 @@ var MobileAddonsPanel = (0, import_react13.forwardRef)(
1630
1685
  height: panelHeight,
1631
1686
  transform: [{ translateY: positionBottomAnimation }]
1632
1687
  },
1688
+ pointerEvents: isOpen ? "auto" : "none",
1689
+ accessibilityElementsHidden: !isOpen,
1690
+ importantForAccessibility: isOpen ? "auto" : "no-hide-descendants",
1633
1691
  children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1634
1692
  import_react_native8.View,
1635
1693
  {
@@ -1739,7 +1797,8 @@ var AddonsTabs = ({ onClose, storyId }) => {
1739
1797
  style: closeIconStyle,
1740
1798
  hitSlop,
1741
1799
  Icon: CloseIcon,
1742
- onPress: () => onClose?.()
1800
+ onPress: () => onClose?.(),
1801
+ accessibilityLabel: "Close addons panel"
1743
1802
  }
1744
1803
  )
1745
1804
  ] }),
@@ -1755,7 +1814,16 @@ var AddonsTabs = ({ onClose, storyId }) => {
1755
1814
  ] });
1756
1815
  };
1757
1816
  var Tab = ({ active, onPress, text }) => {
1758
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TabButton, { active, onPress, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TabText, { active, children: text }) });
1817
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1818
+ TabButton,
1819
+ {
1820
+ active,
1821
+ onPress,
1822
+ accessibilityRole: "tab",
1823
+ accessibilityState: { selected: active },
1824
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TabText, { active, children: text })
1825
+ }
1826
+ );
1759
1827
  };
1760
1828
  var TabButton = import_react_native_theming8.styled.TouchableOpacity(({ theme, active }) => ({
1761
1829
  borderBottomWidth: active ? 2 : 0,
@@ -1840,139 +1908,154 @@ var useAnimatedModalHeight = () => {
1840
1908
  return animatedHeight;
1841
1909
  };
1842
1910
  var MobileMenuDrawer = (0, import_react14.memo)(
1843
- (0, import_react14.forwardRef)(({ children }, ref) => {
1844
- const [isVisible, setIsVisible] = (0, import_react14.useState)(false);
1845
- const { scrollCallback } = useSelectedNode();
1846
- const theme = (0, import_react_native_theming9.useTheme)();
1847
- const { height } = (0, import_react_native9.useWindowDimensions)();
1848
- const animatedHeight = useAnimatedModalHeight();
1849
- const slideAnim = useAnimatedValue(height);
1850
- const dragY = useAnimatedValue(0);
1851
- const openDrawer = (0, import_react14.useCallback)(() => {
1852
- dragY.setValue(0);
1853
- slideAnim.setValue(height);
1854
- setIsVisible(true);
1855
- import_react_native9.Animated.timing(slideAnim, {
1856
- toValue: 0,
1857
- duration: 300,
1858
- easing: import_react_native9.Easing.out(import_react_native9.Easing.quad),
1859
- useNativeDriver: true
1860
- }).start(({ finished }) => {
1861
- if (finished) {
1862
- scrollCallback({ animated: false, id: void 0 });
1863
- }
1864
- });
1865
- }, [dragY, height, scrollCallback, slideAnim]);
1866
- const closeDrawer = (0, import_react14.useCallback)(() => {
1867
- import_react_native9.Keyboard.dismiss();
1868
- import_react_native9.Animated.timing(slideAnim, {
1869
- toValue: height,
1870
- duration: 300,
1871
- easing: import_react_native9.Easing.in(import_react_native9.Easing.quad),
1872
- useNativeDriver: true
1873
- }).start(({ finished }) => {
1874
- if (finished) {
1875
- setIsVisible(false);
1876
- }
1877
- });
1878
- }, [height, slideAnim]);
1879
- const panResponder = (0, import_react14.useMemo)(
1880
- () => import_react_native9.PanResponder.create({
1881
- onStartShouldSetPanResponder: () => true,
1882
- onMoveShouldSetPanResponder: (_, gestureState) => {
1883
- return gestureState.dy > 0;
1884
- },
1885
- onPanResponderMove: (_, gestureState) => {
1886
- if (gestureState.dy > 0) {
1887
- dragY.setValue(gestureState.dy);
1911
+ (0, import_react14.forwardRef)(
1912
+ ({ children, onVisibilityChange }, ref) => {
1913
+ const [isVisible, setIsVisible] = (0, import_react14.useState)(false);
1914
+ const { scrollCallback } = useSelectedNode();
1915
+ const theme = (0, import_react_native_theming9.useTheme)();
1916
+ const { height } = (0, import_react_native9.useWindowDimensions)();
1917
+ const animatedHeight = useAnimatedModalHeight();
1918
+ const slideAnim = useAnimatedValue(height);
1919
+ const dragY = useAnimatedValue(0);
1920
+ const openDrawer = (0, import_react14.useCallback)(() => {
1921
+ dragY.setValue(0);
1922
+ slideAnim.setValue(height);
1923
+ setIsVisible(true);
1924
+ onVisibilityChange?.(true);
1925
+ import_react_native9.Animated.timing(slideAnim, {
1926
+ toValue: 0,
1927
+ duration: 300,
1928
+ easing: import_react_native9.Easing.out(import_react_native9.Easing.quad),
1929
+ useNativeDriver: true
1930
+ }).start(({ finished }) => {
1931
+ if (finished) {
1932
+ scrollCallback({ animated: false, id: void 0 });
1888
1933
  }
1889
- },
1890
- onPanResponderRelease: (_, gestureState) => {
1891
- if (gestureState.dy > 50) {
1892
- closeDrawer();
1934
+ });
1935
+ }, [dragY, height, onVisibilityChange, scrollCallback, slideAnim]);
1936
+ const closeDrawer = (0, import_react14.useCallback)(() => {
1937
+ import_react_native9.Keyboard.dismiss();
1938
+ onVisibilityChange?.(false);
1939
+ import_react_native9.Animated.timing(slideAnim, {
1940
+ toValue: height,
1941
+ duration: 300,
1942
+ easing: import_react_native9.Easing.in(import_react_native9.Easing.quad),
1943
+ useNativeDriver: true
1944
+ }).start(({ finished }) => {
1945
+ if (finished) {
1946
+ setIsVisible(false);
1947
+ }
1948
+ });
1949
+ }, [height, onVisibilityChange, slideAnim]);
1950
+ const panResponder = (0, import_react14.useMemo)(
1951
+ () => import_react_native9.PanResponder.create({
1952
+ onStartShouldSetPanResponder: () => true,
1953
+ onMoveShouldSetPanResponder: (_, gestureState) => {
1954
+ return gestureState.dy > 0;
1955
+ },
1956
+ onPanResponderMove: (_, gestureState) => {
1957
+ if (gestureState.dy > 0) {
1958
+ dragY.setValue(gestureState.dy);
1959
+ }
1960
+ },
1961
+ onPanResponderRelease: (_, gestureState) => {
1962
+ if (gestureState.dy > 50) {
1963
+ closeDrawer();
1964
+ } else {
1965
+ import_react_native9.Animated.timing(dragY, {
1966
+ toValue: 0,
1967
+ duration: 300,
1968
+ easing: import_react_native9.Easing.out(import_react_native9.Easing.quad),
1969
+ useNativeDriver: true
1970
+ }).start();
1971
+ }
1972
+ }
1973
+ }),
1974
+ [closeDrawer, dragY]
1975
+ );
1976
+ (0, import_react14.useImperativeHandle)(ref, () => ({
1977
+ setMobileMenuOpen: (open) => {
1978
+ if (open) {
1979
+ openDrawer();
1893
1980
  } else {
1894
- import_react_native9.Animated.timing(dragY, {
1895
- toValue: 0,
1896
- duration: 300,
1897
- easing: import_react_native9.Easing.out(import_react_native9.Easing.quad),
1898
- useNativeDriver: true
1899
- }).start();
1981
+ closeDrawer();
1900
1982
  }
1901
1983
  }
1902
- }),
1903
- [closeDrawer, dragY]
1904
- );
1905
- (0, import_react14.useImperativeHandle)(ref, () => ({
1906
- setMobileMenuOpen: (open) => {
1907
- if (open) {
1908
- openDrawer();
1909
- } else {
1910
- closeDrawer();
1984
+ }));
1985
+ const handleStyle = (0, import_react14.useMemo)(
1986
+ () => ({
1987
+ width: 40,
1988
+ height: 5,
1989
+ backgroundColor: theme.color.mediumdark,
1990
+ borderRadius: 2.5,
1991
+ alignSelf: "center"
1992
+ }),
1993
+ [theme.color.mediumdark]
1994
+ );
1995
+ const drawerContainerStyle = (0, import_react14.useMemo)(
1996
+ () => ({
1997
+ flex: 1,
1998
+ borderTopColor: theme.appBorderColor,
1999
+ borderTopWidth: 1,
2000
+ borderStyle: "solid",
2001
+ backgroundColor: theme.background.content,
2002
+ elevation: 8,
2003
+ boxShadow: `0 16px 32px 0 ${theme.color.border}`
2004
+ }),
2005
+ [theme.appBorderColor, theme.background.content, theme.color.border]
2006
+ );
2007
+ const dragHandleWrapperStyle = (0, import_react14.useMemo)(
2008
+ () => ({
2009
+ alignItems: "center",
2010
+ justifyContent: "center",
2011
+ paddingBottom: 16,
2012
+ paddingTop: 10,
2013
+ backgroundColor: theme.background.content
2014
+ }),
2015
+ [theme.background.content]
2016
+ );
2017
+ const childrenWrapperStyle = (0, import_react14.useMemo)(
2018
+ () => ({
2019
+ flex: 1,
2020
+ backgroundColor: theme.background.content
2021
+ }),
2022
+ [theme.background.content]
2023
+ );
2024
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_portal.Portal, { hostName: "storybook-lite-ui-root", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2025
+ import_react_native9.Animated.View,
2026
+ {
2027
+ style: [portalContainerStyle, { transform: [{ translateY: slideAnim }] }],
2028
+ pointerEvents: isVisible ? "auto" : "none",
2029
+ accessibilityElementsHidden: !isVisible,
2030
+ importantForAccessibility: isVisible ? "auto" : "no-hide-descendants",
2031
+ accessibilityViewIsModal: isVisible,
2032
+ children: [
2033
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.View, { style: flexStyle5, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2034
+ import_react_native9.Pressable,
2035
+ {
2036
+ style: flexStyle5,
2037
+ onPress: closeDrawer,
2038
+ accessibilityRole: "button",
2039
+ accessibilityLabel: "Close story list"
2040
+ }
2041
+ ) }),
2042
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2043
+ import_react_native9.Animated.View,
2044
+ {
2045
+ style: {
2046
+ height: animatedHeight
2047
+ },
2048
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native9.Animated.View, { style: [drawerContainerStyle, { transform: [{ translateY: dragY }] }], children: [
2049
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.View, { ...panResponder.panHandlers, style: dragHandleWrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.View, { style: handleStyle }) }),
2050
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.View, { style: childrenWrapperStyle, children })
2051
+ ] })
2052
+ }
2053
+ )
2054
+ ]
1911
2055
  }
1912
- }
1913
- }));
1914
- const handleStyle = (0, import_react14.useMemo)(
1915
- () => ({
1916
- width: 40,
1917
- height: 5,
1918
- backgroundColor: theme.color.mediumdark,
1919
- borderRadius: 2.5,
1920
- alignSelf: "center"
1921
- }),
1922
- [theme.color.mediumdark]
1923
- );
1924
- const drawerContainerStyle = (0, import_react14.useMemo)(
1925
- () => ({
1926
- flex: 1,
1927
- borderTopColor: theme.appBorderColor,
1928
- borderTopWidth: 1,
1929
- borderStyle: "solid",
1930
- backgroundColor: theme.background.content,
1931
- elevation: 8,
1932
- boxShadow: `0 16px 32px 0 ${theme.color.border}`
1933
- }),
1934
- [theme.appBorderColor, theme.background.content, theme.color.border]
1935
- );
1936
- const dragHandleWrapperStyle = (0, import_react14.useMemo)(
1937
- () => ({
1938
- alignItems: "center",
1939
- justifyContent: "center",
1940
- paddingBottom: 16,
1941
- paddingTop: 10,
1942
- backgroundColor: theme.background.content
1943
- }),
1944
- [theme.background.content]
1945
- );
1946
- const childrenWrapperStyle = (0, import_react14.useMemo)(
1947
- () => ({
1948
- flex: 1,
1949
- backgroundColor: theme.background.content
1950
- }),
1951
- [theme.background.content]
1952
- );
1953
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_portal.Portal, { hostName: "storybook-lite-ui-root", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1954
- import_react_native9.Animated.View,
1955
- {
1956
- style: [portalContainerStyle, { transform: [{ translateY: slideAnim }] }],
1957
- pointerEvents: isVisible ? "auto" : "none",
1958
- children: [
1959
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.View, { style: flexStyle5, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.Pressable, { style: flexStyle5, onPress: closeDrawer }) }),
1960
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1961
- import_react_native9.Animated.View,
1962
- {
1963
- style: {
1964
- height: animatedHeight
1965
- },
1966
- children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_react_native9.Animated.View, { style: [drawerContainerStyle, { transform: [{ translateY: dragY }] }], children: [
1967
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.View, { ...panResponder.panHandlers, style: dragHandleWrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.View, { style: handleStyle }) }),
1968
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_native9.View, { style: childrenWrapperStyle, children })
1969
- ] })
1970
- }
1971
- )
1972
- ]
1973
- }
1974
- ) });
1975
- })
2056
+ ) });
2057
+ }
2058
+ )
1976
2059
  );
1977
2060
 
1978
2061
  // src/ResizeHandle.tsx
@@ -2086,6 +2169,8 @@ var BrandLogo = ({ theme }) => {
2086
2169
  onPress: () => {
2087
2170
  if (theme.brand.url) import_react_native11.Linking.openURL(theme.brand.url);
2088
2171
  },
2172
+ accessibilityRole: "link",
2173
+ accessibilityLabel: theme.brand.title ?? "Brand logo",
2089
2174
  children: image
2090
2175
  }
2091
2176
  );
@@ -2110,6 +2195,8 @@ var BrandTitle = ({ theme }) => {
2110
2195
  onPress: () => {
2111
2196
  if (theme.brand.url) import_react_native11.Linking.openURL(theme.brand.url);
2112
2197
  },
2198
+ accessibilityRole: "link",
2199
+ accessibilityLabel: theme.brand.title,
2113
2200
  children: title
2114
2201
  }
2115
2202
  );
@@ -2258,118 +2345,147 @@ var Layout = ({
2258
2345
  );
2259
2346
  const mobileMenuDrawerRef = (0, import_react17.useRef)(null);
2260
2347
  const addonPanelRef = (0, import_react17.useRef)(null);
2348
+ const [isDrawerOpen, setIsDrawerOpen] = (0, import_react17.useState)(false);
2261
2349
  const setSelection = (0, import_react17.useCallback)(({ storyId: newStoryId }) => {
2262
2350
  const channel = import_manager_api2.addons.getChannel();
2263
2351
  channel.emit(import_core_events.SET_CURRENT_STORY, { storyId: newStoryId });
2264
2352
  }, []);
2265
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native12.View, { style: containerStyle2, children: [
2266
- isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2267
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: desktopSidebarStyle, pointerEvents: isResizing ? "none" : "auto", children: desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2268
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native12.View, { style: desktopLogoContainer, children: [
2269
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StorybookLogo, { theme }),
2270
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_ui_common7.IconButton, { onPress: () => setDesktopSidebarOpen(false), Icon: MenuIcon })
2353
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2354
+ import_react_native12.View,
2355
+ {
2356
+ style: containerStyle2,
2357
+ accessibilityElementsHidden: isDrawerOpen,
2358
+ importantForAccessibility: isDrawerOpen ? "no-hide-descendants" : "auto",
2359
+ children: [
2360
+ isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2361
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: desktopSidebarStyle, pointerEvents: isResizing ? "none" : "auto", children: desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2362
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native12.View, { style: desktopLogoContainer, children: [
2363
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StorybookLogo, { theme }),
2364
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2365
+ import_react_native_ui_common7.IconButton,
2366
+ {
2367
+ onPress: () => setDesktopSidebarOpen(false),
2368
+ Icon: MenuIcon,
2369
+ accessibilityLabel: "Close sidebar"
2370
+ }
2371
+ )
2372
+ ] }),
2373
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: flexStyle6, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2374
+ Sidebar,
2375
+ {
2376
+ previewInitialized: true,
2377
+ indexError: void 0,
2378
+ refs: placeholderObject,
2379
+ setSelection,
2380
+ status: placeholderObject,
2381
+ index: storyHash,
2382
+ storyId: story?.id,
2383
+ refId: DEFAULT_REF_ID
2384
+ }
2385
+ ) })
2386
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2387
+ import_react_native_ui_common7.IconButton,
2388
+ {
2389
+ onPress: () => setDesktopSidebarOpen(true),
2390
+ Icon: MenuIcon,
2391
+ accessibilityLabel: "Open sidebar"
2392
+ }
2393
+ ) }),
2394
+ desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2395
+ ResizeHandle,
2396
+ {
2397
+ direction: "horizontal",
2398
+ onResize: handleSidebarResize,
2399
+ onResizeStart,
2400
+ onResizeEnd
2401
+ }
2402
+ ) : null
2403
+ ] }) : null,
2404
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native12.View, { style: mobileContentStyle, children: [
2405
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: contentContainerStyle, pointerEvents: isResizing ? "none" : "auto", children }),
2406
+ story?.parameters?.hideFullScreenButton || isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2407
+ import_react_native12.TouchableOpacity,
2408
+ {
2409
+ style: fullScreenButtonStyle,
2410
+ hitSlop: { top: 10, bottom: 10, left: 10, right: 10 },
2411
+ onPress: () => setUiHidden((prev) => !prev),
2412
+ accessibilityRole: "button",
2413
+ accessibilityLabel: uiHidden ? "Exit fullscreen" : "Enter fullscreen",
2414
+ children: uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseFullscreenIcon, { color: theme.color.mediumdark }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FullscreenIcon, { color: theme.color.mediumdark })
2415
+ }
2416
+ ),
2417
+ isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2418
+ desktopAddonsPanelOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2419
+ ResizeHandle,
2420
+ {
2421
+ direction: "vertical",
2422
+ onResize: handleAddonsPanelResize,
2423
+ onResizeStart,
2424
+ onResizeEnd
2425
+ }
2426
+ ) : null,
2427
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: desktopAddonsPanelStyle, pointerEvents: isResizing ? "none" : "auto", children: desktopAddonsPanelOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AddonsTabs, { storyId: story?.id, onClose: () => setDesktopAddonsPanelOpen(false) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2428
+ import_react_native_ui_common7.IconButton,
2429
+ {
2430
+ style: iconFloatRightStyle,
2431
+ onPress: () => setDesktopAddonsPanelOpen(true),
2432
+ Icon: BottomBarToggleIcon,
2433
+ accessibilityLabel: "Open addons panel"
2434
+ }
2435
+ ) })
2436
+ ] }) : null
2271
2437
  ] }),
2272
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: flexStyle6, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2273
- Sidebar,
2274
- {
2275
- previewInitialized: true,
2276
- indexError: void 0,
2277
- refs: placeholderObject,
2278
- setSelection,
2279
- status: placeholderObject,
2280
- index: storyHash,
2281
- storyId: story?.id,
2282
- refId: DEFAULT_REF_ID
2283
- }
2284
- ) })
2285
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native_ui_common7.IconButton, { onPress: () => setDesktopSidebarOpen(true), Icon: MenuIcon }) }),
2286
- desktopSidebarOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2287
- ResizeHandle,
2288
- {
2289
- direction: "horizontal",
2290
- onResize: handleSidebarResize,
2291
- onResizeStart,
2292
- onResizeEnd
2293
- }
2294
- ) : null
2295
- ] }) : null,
2296
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native12.View, { style: mobileContentStyle, children: [
2297
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: contentContainerStyle, pointerEvents: isResizing ? "none" : "auto", children }),
2298
- story?.parameters?.hideFullScreenButton || isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2299
- import_react_native12.TouchableOpacity,
2300
- {
2301
- style: fullScreenButtonStyle,
2302
- hitSlop: { top: 10, bottom: 10, left: 10, right: 10 },
2303
- onPress: () => setUiHidden((prev) => !prev),
2304
- children: uiHidden ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseFullscreenIcon, { color: theme.color.mediumdark }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(FullscreenIcon, { color: theme.color.mediumdark })
2305
- }
2306
- ),
2307
- isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
2308
- desktopAddonsPanelOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2309
- ResizeHandle,
2310
- {
2311
- direction: "vertical",
2312
- onResize: handleAddonsPanelResize,
2313
- onResizeStart,
2314
- onResizeEnd
2315
- }
2316
- ) : null,
2317
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: desktopAddonsPanelStyle, pointerEvents: isResizing ? "none" : "auto", children: desktopAddonsPanelOpen ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(AddonsTabs, { storyId: story?.id, onClose: () => setDesktopAddonsPanelOpen(false) }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2318
- import_react_native_ui_common7.IconButton,
2319
- {
2320
- style: iconFloatRightStyle,
2321
- onPress: () => setDesktopAddonsPanelOpen(true),
2322
- Icon: BottomBarToggleIcon
2323
- }
2324
- ) })
2325
- ] }) : null
2326
- ] }),
2327
- !uiHidden && !isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Container2, { style: navContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Nav, { children: [
2328
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2329
- Button2,
2330
- {
2331
- testID: "mobile-menu-button",
2332
- style: navButtonStyle,
2333
- hitSlop: navButtonHitSlop,
2334
- onPress: () => mobileMenuDrawerRef.current?.setMobileMenuOpen(true),
2335
- children: [
2336
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuIcon, { color: theme.color.mediumdark }),
2337
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native12.Text, { style: navButtonTextStyle, numberOfLines: 1, children: [
2338
- story?.title,
2339
- "/",
2340
- story?.name
2341
- ] })
2342
- ]
2343
- }
2344
- ),
2345
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2346
- import_react_native_ui_common7.IconButton,
2347
- {
2348
- testID: "mobile-addons-button",
2349
- hitSlop: addonButtonHitSlop,
2350
- onPress: () => addonPanelRef.current.setAddonsPanelOpen(true),
2351
- Icon: BottomBarToggleIcon
2352
- }
2353
- )
2354
- ] }) }) : null,
2355
- isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, children: [
2356
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: mobileMenuDrawerContentStyle, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StorybookLogo, { theme }) }),
2357
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2358
- Sidebar,
2359
- {
2360
- previewInitialized: true,
2361
- indexError: void 0,
2362
- refs: placeholderObject,
2363
- setSelection,
2364
- status: placeholderObject,
2365
- index: storyHash,
2366
- storyId: story?.id,
2367
- refId: DEFAULT_REF_ID
2368
- }
2369
- )
2370
- ] }),
2371
- isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
2372
- ] });
2438
+ !uiHidden && !isDesktop ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Container2, { style: navContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Nav, { children: [
2439
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2440
+ Button2,
2441
+ {
2442
+ testID: "mobile-menu-button",
2443
+ style: navButtonStyle,
2444
+ hitSlop: navButtonHitSlop,
2445
+ onPress: () => mobileMenuDrawerRef.current?.setMobileMenuOpen(true),
2446
+ accessibilityRole: "button",
2447
+ accessibilityLabel: "Open story list",
2448
+ children: [
2449
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MenuIcon, { color: theme.color.mediumdark }),
2450
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_react_native12.Text, { style: navButtonTextStyle, numberOfLines: 1, children: [
2451
+ story?.title,
2452
+ "/",
2453
+ story?.name
2454
+ ] })
2455
+ ]
2456
+ }
2457
+ ),
2458
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2459
+ import_react_native_ui_common7.IconButton,
2460
+ {
2461
+ testID: "mobile-addons-button",
2462
+ hitSlop: addonButtonHitSlop,
2463
+ onPress: () => addonPanelRef.current.setAddonsPanelOpen(true),
2464
+ Icon: BottomBarToggleIcon,
2465
+ accessibilityLabel: "Open addons panel"
2466
+ }
2467
+ )
2468
+ ] }) }) : null,
2469
+ isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(MobileMenuDrawer, { ref: mobileMenuDrawerRef, onVisibilityChange: setIsDrawerOpen, children: [
2470
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react_native12.View, { style: mobileMenuDrawerContentStyle, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(StorybookLogo, { theme }) }),
2471
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2472
+ Sidebar,
2473
+ {
2474
+ previewInitialized: true,
2475
+ indexError: void 0,
2476
+ refs: placeholderObject,
2477
+ setSelection,
2478
+ status: placeholderObject,
2479
+ index: storyHash,
2480
+ storyId: story?.id,
2481
+ refId: DEFAULT_REF_ID
2482
+ }
2483
+ )
2484
+ ] }),
2485
+ isDesktop ? null : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MobileAddonsPanel, { ref: addonPanelRef, storyId: story?.id })
2486
+ ]
2487
+ }
2488
+ );
2373
2489
  };
2374
2490
  var Nav = import_react_native_theming11.styled.View({
2375
2491
  display: "flex",