@storybook/react-native 6.0.1-beta.0 → 6.0.1-beta.10

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.
Files changed (78) hide show
  1. package/dist/document-polyfill/DOM/Document.d.ts +14 -0
  2. package/dist/document-polyfill/DOM/Document.js +37 -0
  3. package/dist/document-polyfill/DOM/Element.d.ts +37 -0
  4. package/dist/document-polyfill/DOM/Element.js +58 -0
  5. package/dist/document-polyfill/DOM/HTMLCanvasElement.d.ts +4 -0
  6. package/dist/document-polyfill/DOM/HTMLCanvasElement.js +4 -0
  7. package/dist/document-polyfill/DOM/HTMLImageElement.d.ts +4 -0
  8. package/dist/document-polyfill/DOM/HTMLImageElement.js +4 -0
  9. package/dist/document-polyfill/DOM/HTMLVideoElement.d.ts +4 -0
  10. package/dist/document-polyfill/DOM/HTMLVideoElement.js +4 -0
  11. package/dist/document-polyfill/DOM/Node.d.ts +26 -0
  12. package/dist/document-polyfill/DOM/Node.js +33 -0
  13. package/dist/{preview/global.js → document-polyfill/index.d.ts} +0 -0
  14. package/dist/document-polyfill/index.js +3 -0
  15. package/dist/document-polyfill/module.d.ts +0 -0
  16. package/dist/document-polyfill/module.js +1 -0
  17. package/dist/{types-6.0.js → document-polyfill/module.native.d.ts} +0 -0
  18. package/dist/document-polyfill/module.native.js +2 -0
  19. package/dist/index.d.ts +16 -13
  20. package/dist/index.js +18 -18
  21. package/dist/preview/View.d.ts +40 -0
  22. package/dist/preview/View.js +90 -0
  23. package/dist/preview/components/OnDeviceUI/OnDeviceUI.d.ts +6 -3
  24. package/dist/preview/components/OnDeviceUI/OnDeviceUI.js +33 -38
  25. package/dist/preview/components/OnDeviceUI/Panel.js +1 -0
  26. package/dist/preview/components/OnDeviceUI/animation.d.ts +16 -6
  27. package/dist/preview/components/OnDeviceUI/animation.js +4 -3
  28. package/dist/preview/components/OnDeviceUI/navigation/Bar.d.ts +3 -1
  29. package/dist/preview/components/OnDeviceUI/navigation/Bar.js +1 -1
  30. package/dist/preview/components/OnDeviceUI/navigation/Navigation.d.ts +4 -3
  31. package/dist/preview/components/OnDeviceUI/navigation/Navigation.js +15 -10
  32. package/dist/preview/components/OnDeviceUI/navigation/VisibilityButton.d.ts +3 -1
  33. package/dist/preview/components/OnDeviceUI/navigation/VisibilityButton.js +34 -5
  34. package/dist/preview/components/Shared/icons.d.ts +5 -0
  35. package/dist/preview/components/Shared/icons.js +21 -0
  36. package/dist/preview/components/Shared/text.d.ts +3 -32
  37. package/dist/preview/components/Shared/text.js +3 -4
  38. package/dist/preview/components/Shared/theme.d.ts +4 -0
  39. package/dist/preview/components/Shared/theme.js +4 -0
  40. package/dist/preview/components/StoryListView/StoryListView.d.ts +7 -4
  41. package/dist/preview/components/StoryListView/StoryListView.js +46 -27
  42. package/dist/preview/components/StoryView/StoryView.d.ts +5 -3
  43. package/dist/preview/components/StoryView/StoryView.js +6 -24
  44. package/dist/preview/executeLoadable.d.ts +24 -0
  45. package/dist/preview/executeLoadable.js +79 -0
  46. package/dist/preview/rn-host-detect.d.ts +1 -0
  47. package/dist/preview/rn-host-detect.js +62 -0
  48. package/dist/preview/start.d.ts +16 -0
  49. package/dist/preview/start.js +83 -0
  50. package/dist/types/types-6.0.d.ts +72 -0
  51. package/dist/types/types-6.0.js +1 -0
  52. package/dist/types/types.d.ts +14 -0
  53. package/dist/types/types.js +1 -0
  54. package/package.json +16 -13
  55. package/scripts/__snapshots__/loader.test.js.snap +82 -7
  56. package/scripts/loader.js +40 -10
  57. package/scripts/loader.test.js +47 -5
  58. package/scripts/mocks/file-extensions/FakeComponent.tsx +1 -0
  59. package/scripts/mocks/file-extensions/FakeStory.stories.tsx +10 -0
  60. package/scripts/mocks/file-extensions/main.ts +13 -0
  61. package/scripts/mocks/file-extensions/preview.tsx +23 -0
  62. package/scripts/mocks/preview-files/js/preview.js +24 -0
  63. package/scripts/mocks/preview-files/jsx/preview.jsx +24 -0
  64. package/scripts/mocks/preview-files/ts/preview.ts +9 -0
  65. package/scripts/mocks/preview-files/tsx/preview.tsx +9 -0
  66. package/scripts/mocks/wrong-extension-preview/FakeComponent.tsx +1 -0
  67. package/scripts/mocks/wrong-extension-preview/FakeStory.stories.tsx +10 -0
  68. package/scripts/mocks/wrong-extension-preview/main.js +9 -0
  69. package/scripts/mocks/wrong-extension-preview/preview.txt +24 -0
  70. package/scripts/watcher.js +7 -4
  71. package/dist/preview/Preview.d.ts +0 -55
  72. package/dist/preview/Preview.js +0 -117
  73. package/dist/preview/global.d.ts +0 -8
  74. package/dist/preview/index.d.ts +0 -1
  75. package/dist/preview/index.js +0 -1
  76. package/dist/preview/loadCsf.d.ts +0 -16
  77. package/dist/preview/loadCsf.js +0 -175
  78. package/dist/types-6.0.d.ts +0 -34
@@ -1,28 +1,38 @@
1
1
  import { Animated } from 'react-native';
2
+ import { EdgeInsets } from 'react-native-safe-area-context';
2
3
  import { PreviewDimens } from './absolute-positioned-keyboard-aware-view';
3
4
  export declare const getNavigatorPanelPosition: (animatedValue: Animated.Value, previewWidth: number, wide: boolean) => {
4
5
  transform: {
5
- translateX: Animated.AnimatedInterpolation;
6
+ translateX: Animated.AnimatedInterpolation<string | number>;
6
7
  }[];
7
8
  width: number;
8
9
  }[];
9
10
  export declare const getAddonPanelPosition: (animatedValue: Animated.Value, previewWidth: number, wide: boolean) => {
10
11
  transform: {
11
- translateX: Animated.AnimatedInterpolation;
12
+ translateX: Animated.AnimatedInterpolation<string | number>;
12
13
  }[];
13
14
  width: number;
14
15
  }[];
15
- export declare const getPreviewPosition: (animatedValue: Animated.Value, { width: previewWidth, height: previewHeight }: PreviewDimens, slideBetweenAnimation: boolean, wide: boolean) => {
16
+ declare type PreviewPositionArgs = {
17
+ animatedValue: Animated.Value;
18
+ previewDimensions: PreviewDimens;
19
+ slideBetweenAnimation: boolean;
20
+ wide: boolean;
21
+ noSafeArea: boolean;
22
+ insets: EdgeInsets;
23
+ };
24
+ export declare const getPreviewPosition: ({ animatedValue, previewDimensions: { width: previewWidth, height: previewHeight }, slideBetweenAnimation, wide, noSafeArea, insets, }: PreviewPositionArgs) => {
16
25
  transform: ({
17
- translateX: Animated.AnimatedInterpolation;
26
+ translateX: Animated.AnimatedInterpolation<string | number>;
18
27
  translateY?: undefined;
19
28
  } | {
20
- translateY: Animated.AnimatedInterpolation;
29
+ translateY: Animated.AnimatedInterpolation<string | number>;
21
30
  translateX?: undefined;
22
31
  })[];
23
32
  };
24
33
  export declare const getPreviewScale: (animatedValue: Animated.Value, slideBetweenAnimation: boolean, wide: boolean) => {
25
34
  transform: {
26
- scale: Animated.AnimatedInterpolation;
35
+ scale: Animated.AnimatedInterpolation<string | number>;
27
36
  }[];
28
37
  };
38
+ export {};
@@ -38,10 +38,11 @@ export const getAddonPanelPosition = (animatedValue, previewWidth, wide) => {
38
38
  },
39
39
  ];
40
40
  };
41
- export const getPreviewPosition = (animatedValue, { width: previewWidth, height: previewHeight }, slideBetweenAnimation, wide) => {
41
+ export const getPreviewPosition = ({ animatedValue, previewDimensions: { width: previewWidth, height: previewHeight }, slideBetweenAnimation, wide, noSafeArea, insets, }) => {
42
42
  const scale = wide ? PREVIEW_WIDE_SCREEN : PREVIEW_SCALE;
43
43
  const translateX = previewWidth / 2 - (previewWidth * scale) / 2 - TRANSLATE_X_OFFSET;
44
- const translateY = -(previewHeight / 2 - (previewHeight * scale) / 2 - TRANSLATE_Y_OFFSET);
44
+ const marginTop = noSafeArea ? 0 : insets.top;
45
+ const translateY = -(previewHeight / 2 - (previewHeight * scale) / 2 - TRANSLATE_Y_OFFSET) + marginTop;
45
46
  return {
46
47
  transform: [
47
48
  {
@@ -53,7 +54,7 @@ export const getPreviewPosition = (animatedValue, { width: previewWidth, height:
53
54
  {
54
55
  translateY: animatedValue.interpolate({
55
56
  inputRange: [NAVIGATOR, PREVIEW, ADDONS],
56
- outputRange: [translateY, slideBetweenAnimation ? translateY : 0, translateY],
57
+ outputRange: [translateY, slideBetweenAnimation ? translateY : marginTop, translateY],
57
58
  }),
58
59
  },
59
60
  ],
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
+ import { ViewStyle } from 'react-native';
2
3
  export interface Props {
3
4
  index: number;
4
5
  onPress: (id: number) => void;
6
+ style: ViewStyle;
5
7
  }
6
- declare const _default: React.MemoExoticComponent<({ index, onPress }: Props) => JSX.Element>;
8
+ declare const _default: React.MemoExoticComponent<({ index, onPress, style }: Props) => JSX.Element>;
7
9
  export default _default;
@@ -10,7 +10,7 @@ const Container = styled.View(({ theme }) => ({
10
10
  borderBottomWidth: 1,
11
11
  borderColor: theme.borderColor || '#e6e6e6',
12
12
  }));
13
- const Bar = ({ index, onPress }) => (React.createElement(Container, null,
13
+ const Bar = ({ index, onPress, style }) => (React.createElement(Container, { style: style },
14
14
  React.createElement(Button, { onPress: onPress, testID: "BottomMenu.Navigator", id: NAVIGATOR, active: index === NAVIGATOR }, "NAVIGATOR"),
15
15
  React.createElement(Button, { onPress: onPress, testID: "BottomMenu.Preview", id: PREVIEW, active: index === PREVIEW }, "PREVIEW"),
16
16
  React.createElement(Button, { onPress: onPress, testID: "BottomMenu.Addons", id: ADDONS, active: index === ADDONS }, "ADDONS")));
@@ -1,8 +1,9 @@
1
- import React from 'react';
1
+ import React, { Dispatch, SetStateAction } from 'react';
2
2
  interface Props {
3
- initialUiVisible?: boolean;
4
3
  tabOpen: number;
5
4
  onChangeTab: (index: number) => void;
5
+ isUIVisible: boolean;
6
+ setIsUIVisible: Dispatch<SetStateAction<boolean>>;
6
7
  }
7
- declare const _default: React.MemoExoticComponent<({ tabOpen, onChangeTab, initialUiVisible }: Props) => JSX.Element>;
8
+ declare const _default: React.MemoExoticComponent<({ tabOpen, onChangeTab, isUIVisible, setIsUIVisible }: Props) => JSX.Element>;
8
9
  export default _default;
@@ -1,5 +1,6 @@
1
- import React, { useState } from 'react';
2
- import { View, SafeAreaView } from 'react-native';
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
3
4
  import GestureRecognizer from 'react-native-swipe-gestures';
4
5
  import Bar from './Bar';
5
6
  import VisibilityButton from './VisibilityButton';
@@ -7,8 +8,14 @@ const SWIPE_CONFIG = {
7
8
  velocityThreshold: 0.2,
8
9
  directionalOffsetThreshold: 80,
9
10
  };
10
- const Navigation = ({ tabOpen, onChangeTab, initialUiVisible }) => {
11
- const [isUIVisible, setIsUIVisible] = useState(initialUiVisible !== undefined ? initialUiVisible : true);
11
+ const navStyle = {
12
+ position: 'absolute',
13
+ left: 0,
14
+ right: 0,
15
+ bottom: 0,
16
+ };
17
+ const Navigation = ({ tabOpen, onChangeTab, isUIVisible, setIsUIVisible }) => {
18
+ const insets = useSafeAreaInsets();
12
19
  const handleToggleUI = () => {
13
20
  setIsUIVisible((oldIsUIVisible) => !oldIsUIVisible);
14
21
  };
@@ -22,11 +29,9 @@ const Navigation = ({ tabOpen, onChangeTab, initialUiVisible }) => {
22
29
  onChangeTab(tabOpen - 1);
23
30
  }
24
31
  };
25
- return (React.createElement(View, null,
26
- React.createElement(SafeAreaView, null,
27
- isUIVisible && (React.createElement(GestureRecognizer, { onSwipeLeft: handleSwipeLeft, onSwipeRight: handleSwipeRight, config: SWIPE_CONFIG },
28
- React.createElement(Bar, { index: tabOpen, onPress: onChangeTab }))),
29
- React.createElement(View, null,
30
- React.createElement(VisibilityButton, { onPress: handleToggleUI })))));
32
+ return (React.createElement(View, { style: navStyle },
33
+ isUIVisible && (React.createElement(GestureRecognizer, { onSwipeLeft: handleSwipeLeft, onSwipeRight: handleSwipeRight, config: SWIPE_CONFIG },
34
+ React.createElement(Bar, { index: tabOpen, onPress: onChangeTab, style: { paddingBottom: insets.bottom } }))),
35
+ React.createElement(VisibilityButton, { onPress: handleToggleUI, style: { marginBottom: insets.bottom } })));
31
36
  };
32
37
  export default React.memo(Navigation);
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
2
3
  interface Props {
3
4
  onPress: () => void;
5
+ style?: StyleProp<ViewStyle>;
4
6
  }
5
- declare const _default: React.MemoExoticComponent<({ onPress }: Props) => JSX.Element>;
7
+ declare const _default: React.MemoExoticComponent<({ onPress, style }: Props) => JSX.Element>;
6
8
  export default _default;
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import styled from '@emotion/native';
3
+ import { View } from 'react-native';
3
4
  const Touchable = styled.TouchableOpacity({
4
5
  backgroundColor: 'transparent',
5
6
  position: 'absolute',
@@ -7,10 +8,38 @@ const Touchable = styled.TouchableOpacity({
7
8
  bottom: 12,
8
9
  zIndex: 100,
9
10
  });
10
- const HideIcon = styled.Text(({ theme }) => ({
11
- fontSize: 14,
12
- color: theme.buttonTextColor || '#999999',
11
+ const HIDE_ICON_SIZE = 14;
12
+ const HIDE_ICON_BORDER_WIDTH = 1;
13
+ const Inner = styled.View(({ theme }) => ({
14
+ position: 'absolute',
15
+ top: 0,
16
+ left: 0,
17
+ width: HIDE_ICON_SIZE,
18
+ height: HIDE_ICON_SIZE,
19
+ borderRadius: HIDE_ICON_BORDER_WIDTH,
20
+ overflow: 'hidden',
21
+ borderColor: theme.buttonTextColor || '#999999',
22
+ borderWidth: HIDE_ICON_BORDER_WIDTH * 2,
13
23
  }));
14
- const VisibilityButton = ({ onPress }) => (React.createElement(Touchable, { onPress: onPress, testID: "Storybook.OnDeviceUI.toggleUI", accessibilityLabel: "Storybook.OnDeviceUI.toggleUI", hitSlop: { top: 5, left: 5, bottom: 5, right: 5 } },
15
- React.createElement(HideIcon, null, "\u25A1")));
24
+ const Outer = styled.View({
25
+ position: 'absolute',
26
+ top: 0,
27
+ left: 0,
28
+ width: HIDE_ICON_SIZE,
29
+ height: HIDE_ICON_SIZE,
30
+ borderRadius: HIDE_ICON_BORDER_WIDTH,
31
+ overflow: 'hidden',
32
+ borderColor: 'white',
33
+ borderWidth: HIDE_ICON_BORDER_WIDTH,
34
+ });
35
+ const hideIconStyles = {
36
+ width: HIDE_ICON_SIZE,
37
+ height: HIDE_ICON_SIZE,
38
+ marginRight: 4,
39
+ };
40
+ const HideIcon = () => (React.createElement(View, { style: hideIconStyles },
41
+ React.createElement(Inner, null),
42
+ React.createElement(Outer, null)));
43
+ const VisibilityButton = ({ onPress, style }) => (React.createElement(Touchable, { onPress: onPress, style: style, testID: "Storybook.OnDeviceUI.toggleUI", accessibilityLabel: "Storybook.OnDeviceUI.toggleUI", hitSlop: { top: 5, left: 5, bottom: 5, right: 5 } },
44
+ React.createElement(HideIcon, null)));
16
45
  export default React.memo(VisibilityButton);
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const GridIcon: () => JSX.Element;
3
+ export declare const StoryIcon: ({ selected }: {
4
+ selected: boolean;
5
+ }) => JSX.Element;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { Image, StyleSheet } from 'react-native';
3
+ export const GridIcon = () => {
4
+ return (React.createElement(Image, { source: {
5
+ uri: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAAALdQTFRFAAAAIJ//Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqj9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Haf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqb9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqf9Hqj9Hqf9Hmz01QAAAD10Uk5TAAAEGjNefYqLXDUFAjSY0e79/9KZAghmyMkBQbz6vUIBBnD1cQcOo6Sp76qBePTHVOoC+RQTX4mCDZsBMmX5zDcAAAHcSURBVHic7ZrrcoIwEIVX8W5VpAiUaq33GyJqrfby/s9VacsCDoj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tR73y/h/SR3nQ/DCj8AAAAABJRU5ErkJggg==';
10
+ export const StoryIcon = ({ selected }) => {
11
+ return (React.createElement(Image, { source: {
12
+ uri: selected ? whiteOutline : blueOutline,
13
+ }, style: styles.navigatorIcon }));
14
+ };
15
+ const styles = StyleSheet.create({
16
+ navigatorIcon: {
17
+ width: 18,
18
+ height: 18,
19
+ marginRight: 5,
20
+ },
21
+ });
@@ -1,32 +1,3 @@
1
- /// <reference types="react" />
2
- export declare const Header: import("@emotion/styled-base").StyledComponent<import("react-native").TextProps & import("react").RefAttributes<import("react-native").Text>, {
3
- selected: boolean;
4
- }, {
5
- backgroundColor: string;
6
- headerTextColor: string;
7
- labelColor: string;
8
- borderColor: string;
9
- previewBorderColor: string;
10
- buttonTextColor: string;
11
- buttonActiveTextColor: string;
12
- }>;
13
- export declare const Name: import("@emotion/styled-base").StyledComponent<import("react-native").TextProps & import("react").RefAttributes<import("react-native").Text>, {
14
- selected: boolean;
15
- }, {
16
- backgroundColor: string;
17
- headerTextColor: string;
18
- labelColor: string;
19
- borderColor: string;
20
- previewBorderColor: string;
21
- buttonTextColor: string;
22
- buttonActiveTextColor: string;
23
- }>;
24
- export declare const Label: import("@emotion/styled-base").StyledComponent<import("react-native").TextProps & import("react").RefAttributes<import("react-native").Text>, Pick<import("react-native").TextProps & import("react").RefAttributes<import("react-native").Text>, keyof import("react-native").TextProps>, {
25
- backgroundColor: string;
26
- headerTextColor: string;
27
- labelColor: string;
28
- borderColor: string;
29
- previewBorderColor: string;
30
- buttonTextColor: string;
31
- buttonActiveTextColor: string;
32
- }>;
1
+ export declare const Header: any;
2
+ export declare const Name: any;
3
+ export declare const Label: any;
@@ -1,12 +1,11 @@
1
1
  import styled from '@emotion/native';
2
2
  export const Header = styled.Text(({ theme }) => ({
3
- fontSize: 20,
3
+ fontSize: 18,
4
4
  color: theme.headerTextColor || 'black',
5
5
  }), ({ selected }) => (selected ? { fontWeight: 'bold' } : {}));
6
- export const Name = styled.Text(({ theme }) => ({
6
+ export const Name = styled.Text({
7
7
  fontSize: 16,
8
- color: theme.headerTextColor || 'black',
9
- }), ({ selected }) => (selected ? { fontWeight: 'bold' } : {}));
8
+ }, ({ selected, theme }) => selected ? { fontWeight: 'bold', color: 'white' } : { color: theme.headerTextColor || 'black' });
10
9
  export const Label = styled.Text(({ theme }) => ({
11
10
  fontSize: 18,
12
11
  color: theme.labelColor || 'black',
@@ -1,9 +1,13 @@
1
1
  export declare const theme: {
2
2
  backgroundColor: string;
3
+ storyListBackgroundColor: string;
4
+ listItemActiveColor: string;
5
+ listItemActiveTextColor: string;
3
6
  headerTextColor: string;
4
7
  labelColor: string;
5
8
  borderColor: string;
6
9
  previewBorderColor: string;
7
10
  buttonTextColor: string;
8
11
  buttonActiveTextColor: string;
12
+ secondaryLabelColor: string;
9
13
  };
@@ -1,9 +1,13 @@
1
1
  export const theme = {
2
2
  backgroundColor: 'white',
3
+ storyListBackgroundColor: '#f6f9fc',
4
+ listItemActiveColor: '#1ea7fd',
5
+ listItemActiveTextColor: 'white',
3
6
  headerTextColor: 'black',
4
7
  labelColor: 'black',
5
8
  borderColor: '#e6e6e6',
6
9
  previewBorderColor: '#b3b3b3',
7
10
  buttonTextColor: '#999999',
8
11
  buttonActiveTextColor: '#444444',
12
+ secondaryLabelColor: '#999999',
9
13
  };
@@ -1,7 +1,10 @@
1
- import { StoreItem, StoryStore } from '@storybook/client-api';
1
+ /// <reference types="react" />
2
+ import { StoryIndex } from '@storybook/client-api';
3
+ import { StoryContext } from '@storybook/csf';
4
+ import { ReactNativeFramework } from 'src/types/types-6.0';
2
5
  interface Props {
3
- storyStore: StoryStore;
4
- selectedStory: StoreItem;
6
+ storyIndex: StoryIndex;
7
+ selectedStoryContext: StoryContext<ReactNativeFramework>;
5
8
  }
6
- declare const StoryListView: ({ selectedStory, storyStore }: Props) => JSX.Element;
9
+ declare const StoryListView: ({ selectedStoryContext, storyIndex }: Props) => JSX.Element;
7
10
  export default StoryListView;
@@ -2,22 +2,29 @@ import styled from '@emotion/native';
2
2
  import { addons } from '@storybook/addons';
3
3
  import Events from '@storybook/core-events';
4
4
  import React, { useMemo, useState } from 'react';
5
- import { SectionList, StyleSheet } from 'react-native';
5
+ import { SectionList, StyleSheet, View } from 'react-native';
6
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
7
+ import { GridIcon, StoryIcon } from '../Shared/icons';
6
8
  import { Header, Name } from '../Shared/text';
7
9
  const SearchBar = styled.TextInput({
8
- borderRadius: 4,
10
+ borderRadius: 16,
11
+ borderWidth: 2,
9
12
  fontSize: 16,
10
- margin: 5,
11
- padding: 5,
13
+ marginVertical: 4,
14
+ marginHorizontal: 8,
15
+ paddingVertical: 8,
16
+ paddingHorizontal: 15,
12
17
  }, ({ theme }) => ({
13
- backgroundColor: theme.borderColor,
18
+ borderColor: theme.borderColor,
14
19
  color: theme.buttonActiveTextColor,
15
20
  }));
16
21
  const HeaderContainer = styled.View({
17
22
  paddingVertical: 5,
18
23
  paddingHorizontal: 5,
24
+ flexDirection: 'row',
25
+ alignItems: 'center',
19
26
  });
20
- const StoryListContainer = styled.View(Object.assign(Object.assign({ top: 0 }, StyleSheet.absoluteFillObject), {
27
+ const StoryListContainer = styled.View(({ theme }) => (Object.assign(Object.assign({ top: 0 }, StyleSheet.absoluteFillObject), {
21
28
  // for this to work I need to get the top margin from safeareview context
22
29
  // shadowColor: '#000',
23
30
  // shadowOffset: {
@@ -27,34 +34,40 @@ const StoryListContainer = styled.View(Object.assign(Object.assign({ top: 0 }, S
27
34
  // shadowOpacity: 0.2,
28
35
  // shadowRadius: 1.41,
29
36
  // elevation: 2,
30
- borderRightWidth: StyleSheet.hairlineWidth, borderRightColor: 'lightgrey', backgroundColor: 'white' }));
31
- const SectionHeader = ({ title, selected }) => (React.createElement(HeaderContainer, { key: title },
32
- React.createElement(Header, { selected: selected }, title)));
37
+ borderRightWidth: StyleSheet.hairlineWidth, borderRightColor: theme.borderColor, backgroundColor: theme.storyListBackgroundColor })));
38
+ const SectionHeader = React.memo(({ title, selected }) => (React.createElement(HeaderContainer, { key: title },
39
+ React.createElement(GridIcon, null),
40
+ React.createElement(Header, { selected: selected }, title))));
33
41
  const ItemTouchable = styled.TouchableOpacity({
34
- paddingHorizontal: 16,
35
- paddingVertical: 5,
36
- });
37
- const ListItem = ({ kind, title, selected, onPress }) => (React.createElement(ItemTouchable, { key: title, onPress: onPress, activeOpacity: 0.8, testID: `Storybook.ListItem.${kind}.${title}`, accessibilityLabel: `Storybook.ListItem.${title}` },
38
- React.createElement(Name, { selected: selected }, title)));
39
- const getStories = (storyStore) => {
40
- if (!storyStore) {
42
+ padding: 5,
43
+ paddingLeft: 40,
44
+ flexDirection: 'row',
45
+ alignItems: 'center',
46
+ }, ({ selected, theme }) => (selected ? { backgroundColor: theme.listItemActiveColor } : {}));
47
+ const ListItem = React.memo(({ kind, title, selected, onPress }) => (React.createElement(ItemTouchable, { key: title, onPress: onPress, activeOpacity: 0.8, testID: `Storybook.ListItem.${kind}.${title}`, accessibilityLabel: `Storybook.ListItem.${title}`, selected: selected },
48
+ React.createElement(StoryIcon, { selected: selected }),
49
+ React.createElement(Name, { selected: selected }, title))), (prevProps, nextProps) => prevProps.selected === nextProps.selected);
50
+ const getStories = (storyIndex) => {
51
+ if (!storyIndex) {
41
52
  return [];
42
53
  }
43
- return Object.values(storyStore
44
- .raw()
45
- .reduce((acc, story) => {
46
- acc[story.kind] = {
47
- title: story.kind,
48
- data: (acc[story.kind] ? acc[story.kind].data : []).concat(story),
54
+ const groupedStories = Object.values(storyIndex.stories).reduce((acc, story) => {
55
+ var _a, _b;
56
+ acc[story.title] = {
57
+ title: story.title,
58
+ data: ((_b = (_a = acc[story.title]) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : []).concat(story),
49
59
  };
50
60
  return acc;
51
- }, {}));
61
+ }, {});
62
+ return Object.values(groupedStories);
52
63
  };
53
64
  const styles = StyleSheet.create({
54
65
  sectionList: { flex: 1 },
55
66
  });
56
- const StoryListView = ({ selectedStory, storyStore }) => {
57
- const originalData = useMemo(() => getStories(storyStore), [storyStore]);
67
+ const tabBarHeight = 40;
68
+ const StoryListView = ({ selectedStoryContext, storyIndex }) => {
69
+ const insets = useSafeAreaInsets();
70
+ const originalData = useMemo(() => getStories(storyIndex), [storyIndex]);
58
71
  const [data, setData] = useState(originalData);
59
72
  const handleChangeSearchText = (text) => {
60
73
  const query = text.trim();
@@ -79,8 +92,14 @@ const StoryListView = ({ selectedStory, storyStore }) => {
79
92
  const channel = addons.getChannel();
80
93
  channel.emit(Events.SET_CURRENT_STORY, { storyId });
81
94
  };
95
+ const safeStyle = { flex: 1, marginTop: insets.top, paddingBottom: insets.bottom + tabBarHeight };
82
96
  return (React.createElement(StoryListContainer, null,
83
- React.createElement(SearchBar, { testID: "Storybook.ListView.SearchBar", clearButtonMode: "while-editing", disableFullscreenUI: true, onChangeText: handleChangeSearchText, placeholder: "Filter", returnKeyType: "search" }),
84
- React.createElement(SectionList, { style: styles.sectionList, testID: "Storybook.ListView", renderItem: ({ item }) => (React.createElement(ListItem, { title: item.name, kind: item.kind, selected: selectedStory && item.id === selectedStory.id, onPress: () => changeStory(item.id) })), renderSectionHeader: ({ section: { title } }) => (React.createElement(SectionHeader, { title: title, selected: selectedStory && title === selectedStory.kind })), keyExtractor: (item, index) => item.id + index, sections: data, stickySectionHeadersEnabled: false })));
97
+ React.createElement(View, { style: safeStyle },
98
+ React.createElement(SearchBar, { testID: "Storybook.ListView.SearchBar", clearButtonMode: "while-editing", disableFullscreenUI: true, onChangeText: handleChangeSearchText, placeholder: "Filter", returnKeyType: "search" }),
99
+ React.createElement(SectionList
100
+ // contentInset={{ bottom: insets.bottom, top: 0 }}
101
+ , {
102
+ // contentInset={{ bottom: insets.bottom, top: 0 }}
103
+ style: styles.sectionList, testID: "Storybook.ListView", renderItem: ({ item }) => (React.createElement(ListItem, { title: item.name, kind: item.title, selected: selectedStoryContext && item.id === selectedStoryContext.id, onPress: () => changeStory(item.id) })), renderSectionHeader: ({ section: { title } }) => (React.createElement(SectionHeader, { title: title, selected: selectedStoryContext && title === selectedStoryContext.title })), keyExtractor: (item, index) => item.id + index, sections: data, stickySectionHeadersEnabled: false }))));
85
104
  };
86
105
  export default StoryListView;
@@ -1,6 +1,8 @@
1
- import { StoreItem } from '@storybook/client-api';
1
+ /// <reference types="react" />
2
+ import type { StoryContext } from '@storybook/csf';
3
+ import { ReactNativeFramework } from 'src/types/types-6.0';
2
4
  interface Props {
3
- story?: StoreItem;
5
+ context?: StoryContext<ReactNativeFramework>;
4
6
  }
5
- declare const StoryView: ({ story }: Props) => JSX.Element;
7
+ declare const StoryView: ({ context }: Props) => JSX.Element;
6
8
  export default StoryView;
@@ -1,13 +1,4 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import React, { useState, useEffect } from 'react';
1
+ import React from 'react';
11
2
  import { Text, View, StyleSheet } from 'react-native';
12
3
  const styles = StyleSheet.create({
13
4
  container: { flex: 1 },
@@ -19,20 +10,11 @@ const styles = StyleSheet.create({
19
10
  justifyContent: 'center',
20
11
  },
21
12
  });
22
- const StoryView = ({ story }) => {
23
- const [context, setContext] = useState(undefined);
24
- const id = story === null || story === void 0 ? void 0 : story.id;
25
- useEffect(() => {
26
- const loadContext = () => __awaiter(void 0, void 0, void 0, function* () {
27
- if (story && story.unboundStoryFn && story.applyLoaders) {
28
- setContext(yield story.applyLoaders());
29
- }
30
- });
31
- loadContext();
32
- }, [story, id]);
33
- if (story && story.unboundStoryFn) {
34
- const { unboundStoryFn } = story;
35
- return (React.createElement(View, { key: id, testID: id, style: styles.container }, context && context.id === story.id ? unboundStoryFn(context) : null));
13
+ const StoryView = ({ context }) => {
14
+ const id = context === null || context === void 0 ? void 0 : context.id;
15
+ if (context && context.unboundStoryFn) {
16
+ const { unboundStoryFn: StoryComponent } = context;
17
+ return (React.createElement(View, { key: id, testID: id, style: styles.container }, StoryComponent && React.createElement(StoryComponent, Object.assign({}, context))));
36
18
  }
37
19
  return (React.createElement(View, { style: styles.helpContainer },
38
20
  React.createElement(Text, null, "Please open navigator and select a story to preview.")));
@@ -0,0 +1,24 @@
1
+ /// <reference types="webpack-env" />
2
+ /// <reference types="node" />
3
+ import { ModuleExports } from '@storybook/store';
4
+ import { Loadable } from '../types/types';
5
+ /**
6
+ * Executes a Loadable (function that returns exports or require context(s))
7
+ * and returns a map of filename => module exports
8
+ *
9
+ * @param loadable Loadable
10
+ * @returns Map<Path, ModuleExports>
11
+ */
12
+ export declare function executeLoadable(loadable: Loadable): Map<string, ModuleExports>;
13
+ /**
14
+ * Executes a Loadable (function that returns exports or require context(s))
15
+ * and compares it's output to the last time it was run (as stored on a node module)
16
+ *
17
+ * @param loadable Loadable
18
+ * @param m NodeModule
19
+ * @returns { added: Map<Path, ModuleExports>, removed: Map<Path, ModuleExports> }
20
+ */
21
+ export declare function executeLoadableForChanges(loadable: Loadable, m?: NodeModule): {
22
+ added: Map<string, ModuleExports>;
23
+ removed: Map<string, ModuleExports>;
24
+ };
@@ -0,0 +1,79 @@
1
+ import { logger } from '@storybook/client-logger';
2
+ /**
3
+ * Executes a Loadable (function that returns exports or require context(s))
4
+ * and returns a map of filename => module exports
5
+ *
6
+ * @param loadable Loadable
7
+ * @returns Map<Path, ModuleExports>
8
+ */
9
+ export function executeLoadable(loadable) {
10
+ let reqs = null;
11
+ // todo discuss / improve type check
12
+ if (Array.isArray(loadable)) {
13
+ reqs = loadable;
14
+ }
15
+ else if (loadable.keys) {
16
+ reqs = [loadable];
17
+ }
18
+ let exportsMap = new Map();
19
+ if (reqs) {
20
+ reqs.forEach((req) => {
21
+ req.keys().forEach((filename) => {
22
+ try {
23
+ const fileExports = req(filename);
24
+ exportsMap.set(typeof req.resolve === 'function' ? req.resolve(filename) : filename, fileExports);
25
+ }
26
+ catch (error) {
27
+ const errorString = error.message && error.stack ? `${error.message}\n ${error.stack}` : error.toString();
28
+ logger.error(`Unexpected error while loading ${filename}: ${errorString}`);
29
+ }
30
+ });
31
+ });
32
+ }
33
+ else {
34
+ const exported = loadable();
35
+ if (Array.isArray(exported) /*FIXME && exported.every((obj) => obj.default != null)*/) {
36
+ const csfExports = exported.filter((obj) => obj.default != null);
37
+ exportsMap = new Map(csfExports.map((fileExports, index) => [`exports-map-${index}`, fileExports]));
38
+ }
39
+ // else if (exported) {
40
+ // logger.warn(
41
+ // `Loader function passed to 'configure' should return void or an array of module exports that all contain a 'default' export. Received: ${JSON.stringify(
42
+ // exported
43
+ // )}`
44
+ // );
45
+ // }
46
+ }
47
+ return exportsMap;
48
+ }
49
+ global.lastExportsMap = new Map();
50
+ /**
51
+ * Executes a Loadable (function that returns exports or require context(s))
52
+ * and compares it's output to the last time it was run (as stored on a node module)
53
+ *
54
+ * @param loadable Loadable
55
+ * @param m NodeModule
56
+ * @returns { added: Map<Path, ModuleExports>, removed: Map<Path, ModuleExports> }
57
+ */
58
+ export function executeLoadableForChanges(loadable, m) {
59
+ var _a;
60
+ if ((_a = m === null || m === void 0 ? void 0 : m.hot) === null || _a === void 0 ? void 0 : _a.accept) {
61
+ m.hot.accept();
62
+ }
63
+ const lastExportsMap = global.lastExportsMap;
64
+ const exportsMap = executeLoadable(loadable);
65
+ const added = new Map();
66
+ Array.from(exportsMap.entries())
67
+ // Ignore files that do not have a default export
68
+ .filter(([, fileExports]) => !!fileExports.default)
69
+ // Ignore exports that are equal (by reference) to last time, this means the file hasn't changed
70
+ .filter(([fileName, fileExports]) => lastExportsMap.get(fileName) !== fileExports)
71
+ .forEach(([fileName, fileExports]) => added.set(fileName, fileExports));
72
+ const removed = new Map();
73
+ Array.from(lastExportsMap.keys())
74
+ .filter((fileName) => !exportsMap.has(fileName))
75
+ .forEach((fileName) => removed.set(fileName, lastExportsMap.get(fileName)));
76
+ // Save the value for the dispose() call above
77
+ global.lastExportsMap = exportsMap;
78
+ return { added, removed };
79
+ }