@storybook/react-native 6.5.5-alpha.0 → 6.5.5
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/hooks.d.ts +3 -4
- package/dist/hooks.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/preview/View.d.ts +2 -3
- package/dist/preview/View.js +7 -34
- package/dist/preview/components/OnDeviceUI/OnDeviceUI.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/OnDeviceUI.js +9 -24
- package/dist/preview/components/OnDeviceUI/Panel.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/Panel.js +2 -1
- package/dist/preview/components/OnDeviceUI/absolute-positioned-keyboard-aware-view.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/absolute-positioned-keyboard-aware-view.js +3 -3
- package/dist/preview/components/OnDeviceUI/addons/Addons.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/addons/Addons.js +4 -7
- package/dist/preview/components/OnDeviceUI/addons/AddonsSkeleton.js +7 -16
- package/dist/preview/components/OnDeviceUI/addons/List.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/addons/List.js +6 -5
- package/dist/preview/components/OnDeviceUI/addons/Wrapper.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/addons/Wrapper.js +3 -3
- package/dist/preview/components/OnDeviceUI/navigation/Navigation.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/navigation/Navigation.js +4 -8
- package/dist/preview/components/OnDeviceUI/navigation/NavigationBar.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/navigation/NavigationBar.js +2 -4
- package/dist/preview/components/OnDeviceUI/navigation/NavigationButton.d.ts +2 -3
- package/dist/preview/components/OnDeviceUI/navigation/NavigationButton.js +4 -10
- package/dist/preview/components/Shared/icons.d.ts +19 -4
- package/dist/preview/components/Shared/icons.js +9 -5
- package/dist/preview/components/Shared/layout.d.ts +15 -1
- package/dist/preview/components/Shared/layout.js +4 -24
- package/dist/preview/components/Shared/tabs.d.ts +2 -2
- package/dist/preview/components/Shared/tabs.js +6 -7
- package/dist/preview/components/StoryListView/StoryListView.d.ts +1 -1
- package/dist/preview/components/StoryListView/StoryListView.js +31 -44
- package/dist/preview/components/StoryView/StoryView.d.ts +1 -1
- package/dist/preview/components/StoryView/StoryView.js +3 -3
- package/dist/preview/executeLoadable.js +4 -1
- package/dist/preview/start.js +2 -2
- package/package.json +8 -7
- package/scripts/__snapshots__/loader.test.js.snap +24 -6
- package/scripts/handle-args.js +5 -1
- package/scripts/loader.js +71 -36
- package/template/cli/storybook.requires.js +54 -0
- package/dist/preview/components/Shared/theme.d.ts +0 -189
- package/dist/preview/components/Shared/theme.js +0 -321
|
@@ -25,8 +25,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
26
|
};
|
|
27
27
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
exports.Icon = void 0;
|
|
29
|
-
var
|
|
28
|
+
exports.BackgroundIcon = exports.Icon = void 0;
|
|
29
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
30
30
|
var react_native_1 = require("react-native");
|
|
31
31
|
var native_1 = __importDefault(require("@emotion/native"));
|
|
32
32
|
var iconSources = {
|
|
@@ -61,8 +61,12 @@ var iconSources = {
|
|
|
61
61
|
var StyledImage = (0, native_1.default)(react_native_1.Image)();
|
|
62
62
|
var StyledImageBackground = (0, native_1.default)(react_native_1.ImageBackground)();
|
|
63
63
|
function Icon(_a) {
|
|
64
|
-
var name = _a.name,
|
|
65
|
-
|
|
66
|
-
return (react_1.default.createElement(IconComponent, __assign({ source: __assign(__assign({}, iconSources[name]), { width: 16, height: 16 }) }, props)));
|
|
64
|
+
var name = _a.name, props = __rest(_a, ["name"]);
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)(StyledImage, __assign({ source: __assign(__assign({}, iconSources[name]), { width: 16, height: 16 }) }, props)));
|
|
67
66
|
}
|
|
68
67
|
exports.Icon = Icon;
|
|
68
|
+
function BackgroundIcon(_a) {
|
|
69
|
+
var name = _a.name, props = __rest(_a, ["name"]);
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(StyledImageBackground, __assign({ source: __assign(__assign({}, iconSources[name]), { width: 16, height: 16 }) }, props)));
|
|
71
|
+
}
|
|
72
|
+
exports.BackgroundIcon = BackgroundIcon;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ViewProps, ViewStyle } from 'react-native';
|
|
3
|
+
interface BoxProps extends ViewProps, Omit<ViewStyle, 'flex'> {
|
|
4
|
+
/**
|
|
5
|
+
* Flex value, can be `true` to mean the commonly used `flex={1}`.
|
|
6
|
+
*/
|
|
7
|
+
flex?: boolean | number;
|
|
8
|
+
}
|
|
1
9
|
/**
|
|
2
10
|
* A general (flex)box layout component that accepts props for flexbox layout
|
|
3
11
|
* styles, such as `flex`, `alignItems`, `marginVertical`, etc.
|
|
@@ -9,4 +17,10 @@
|
|
|
9
17
|
* </Box>
|
|
10
18
|
* ```
|
|
11
19
|
*/
|
|
12
|
-
export declare const Box:
|
|
20
|
+
export declare const Box: import("@emotion/native").StyledComponent<ViewProps & {
|
|
21
|
+
theme?: import("@emotion/react").Theme;
|
|
22
|
+
as?: import("react").ElementType<any>;
|
|
23
|
+
} & BoxProps, {}, {
|
|
24
|
+
ref?: import("react").Ref<import("react-native").View>;
|
|
25
|
+
}>;
|
|
26
|
+
export {};
|
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
-
var t = {};
|
|
15
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
-
t[p] = s[p];
|
|
17
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
-
t[p[i]] = s[p[i]];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
25
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
4
|
};
|
|
@@ -39,6 +17,8 @@ var native_1 = __importDefault(require("@emotion/native"));
|
|
|
39
17
|
* ```
|
|
40
18
|
*/
|
|
41
19
|
exports.Box = native_1.default.View(function (_a) {
|
|
42
|
-
var flex = _a.flex
|
|
43
|
-
return (
|
|
20
|
+
var flex = _a.flex;
|
|
21
|
+
return ({
|
|
22
|
+
flex: flex === true ? 1 : flex === false ? 0 : flex,
|
|
23
|
+
});
|
|
44
24
|
});
|
|
@@ -7,7 +7,7 @@ interface TabButtonProps {
|
|
|
7
7
|
testID?: string;
|
|
8
8
|
children: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export declare const TabButton: React.MemoExoticComponent<({ onPress, id, active, children, testID }: TabButtonProps) => JSX.Element>;
|
|
10
|
+
export declare const TabButton: React.MemoExoticComponent<({ onPress, id, active, children, testID }: TabButtonProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
11
|
interface TabBarProps {
|
|
12
12
|
/**
|
|
13
13
|
* Should the tab bar contents scroll horizontally?
|
|
@@ -16,5 +16,5 @@ interface TabBarProps {
|
|
|
16
16
|
style?: StyleProp<ViewStyle>;
|
|
17
17
|
children: React.ReactNode;
|
|
18
18
|
}
|
|
19
|
-
export declare const TabBar: React.MemoExoticComponent<({ scrollable, style, children }: TabBarProps) => JSX.Element>;
|
|
19
|
+
export declare const TabBar: React.MemoExoticComponent<({ scrollable, style, children }: TabBarProps) => import("react/jsx-runtime").JSX.Element>;
|
|
20
20
|
export {};
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.TabBar = exports.TabButton = void 0;
|
|
7
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
8
|
var react_1 = __importDefault(require("react"));
|
|
8
9
|
var react_native_1 = require("react-native");
|
|
9
10
|
var native_1 = __importDefault(require("@emotion/native"));
|
|
@@ -30,20 +31,18 @@ var TabButtonTouchable = native_1.default.TouchableOpacity(function (_a) {
|
|
|
30
31
|
});
|
|
31
32
|
exports.TabButton = react_1.default.memo(function (_a) {
|
|
32
33
|
var onPress = _a.onPress, id = _a.id, active = _a.active, children = _a.children, testID = _a.testID;
|
|
33
|
-
return (
|
|
34
|
-
react_1.default.createElement(TabButtonText, { active: active }, children)));
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(TabButtonTouchable, { active: active, testID: testID, onPress: function () { return onPress(id); }, activeOpacity: 0.8, hitSlop: hitSlop, children: (0, jsx_runtime_1.jsx)(TabButtonText, { active: active, children: children }) }));
|
|
35
35
|
});
|
|
36
36
|
exports.TabBar = react_1.default.memo(function (_a) {
|
|
37
37
|
var _b = _a.scrollable, scrollable = _b === void 0 ? false : _b, style = _a.style, children = _a.children;
|
|
38
38
|
var theme = (0, hooks_1.useTheme)();
|
|
39
39
|
if (scrollable) {
|
|
40
|
-
children = (
|
|
40
|
+
children = ((0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { showsHorizontalScrollIndicator: false, horizontal: true, contentContainerStyle: { paddingHorizontal: theme.tokens.spacing2 }, children: children }));
|
|
41
41
|
}
|
|
42
|
-
return (
|
|
43
|
-
react_1.default.createElement(TabBarContainer, null, children)));
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: style, children: (0, jsx_runtime_1.jsx)(TabBarContainer, { children: children }) }));
|
|
44
43
|
});
|
|
45
|
-
var TabBarContainer = native_1.default.View({
|
|
44
|
+
var TabBarContainer = native_1.default.View(function () { return ({
|
|
46
45
|
flexDirection: 'row',
|
|
47
46
|
paddingVertical: 6,
|
|
48
47
|
justifyItems: 'center',
|
|
49
|
-
});
|
|
48
|
+
}); });
|
|
@@ -3,5 +3,5 @@ import React from 'react';
|
|
|
3
3
|
interface Props {
|
|
4
4
|
storyIndex: StoryIndex;
|
|
5
5
|
}
|
|
6
|
-
declare const _default: React.MemoExoticComponent<({ storyIndex }: Props) => JSX.Element>;
|
|
6
|
+
declare const _default: React.MemoExoticComponent<({ storyIndex }: Props) => import("react/jsx-runtime").JSX.Element>;
|
|
7
7
|
export default _default;
|
|
@@ -37,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
40
41
|
var native_1 = __importDefault(require("@emotion/native"));
|
|
41
42
|
var addons_1 = require("@storybook/addons");
|
|
42
43
|
var core_events_1 = __importDefault(require("@storybook/core-events"));
|
|
@@ -88,9 +89,7 @@ var SearchContainer = native_1.default.View(function (_a) {
|
|
|
88
89
|
});
|
|
89
90
|
var SearchBar = function (props) {
|
|
90
91
|
var theme = (0, hooks_1.useTheme)();
|
|
91
|
-
return (
|
|
92
|
-
react_1.default.createElement(icons_1.Icon, { name: "search", opacity: 0.5, color: 'white' }),
|
|
93
|
-
react_1.default.createElement(SearchInput, __assign({}, props, { autoCapitalize: "none", autoComplete: "off", autoCorrect: false, spellCheck: false, clearButtonMode: "while-editing", disableFullscreenUI: true, placeholderTextColor: theme.storyList.search.placeholderTextColor, returnKeyType: "search" }))));
|
|
92
|
+
return ((0, jsx_runtime_1.jsxs)(SearchContainer, { children: [(0, jsx_runtime_1.jsx)(icons_1.Icon, { name: "search", opacity: 0.5 }), (0, jsx_runtime_1.jsx)(SearchInput, __assign({}, props, { autoCapitalize: "none", autoComplete: "off", autoCorrect: false, spellCheck: false, clearButtonMode: "while-editing", disableFullscreenUI: true, placeholderTextColor: theme.storyList.search.placeholderTextColor, returnKeyType: "search" }))] }));
|
|
94
93
|
};
|
|
95
94
|
var HeaderContainer = native_1.default.TouchableOpacity({
|
|
96
95
|
flexDirection: 'row',
|
|
@@ -111,16 +110,12 @@ var HeaderContainer = native_1.default.TouchableOpacity({
|
|
|
111
110
|
var SectionHeader = react_1.default.memo(function (_a) {
|
|
112
111
|
var name = _a.name, onPress = _a.onPress, isChildSelected = _a.isChildSelected, _b = _a.icon, icon = _b === void 0 ? 'grid' : _b, expanded = _a.expanded;
|
|
113
112
|
var selected = (0, hooks_1.useIsStorySectionSelected)(name) || isChildSelected;
|
|
114
|
-
return (
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
} },
|
|
121
|
-
react_1.default.createElement(react_native_1.Text, { style: { fontSize: 8, color: 'grey', lineHeight: 8 } }, '➤')),
|
|
122
|
-
react_1.default.createElement(icons_1.Icon, { name: icon, width: 12, height: 12, marginRight: 6 }),
|
|
123
|
-
react_1.default.createElement(SectionHeaderText, { numberOfLines: 2, selected: selected }, name)));
|
|
113
|
+
return ((0, jsx_runtime_1.jsxs)(HeaderContainer, { selected: selected, childSelected: isChildSelected, onPress: onPress, activeOpacity: 0.8, children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: {
|
|
114
|
+
transform: [{ rotate: expanded ? '90deg' : '0deg' }],
|
|
115
|
+
marginRight: 6,
|
|
116
|
+
alignItems: 'center',
|
|
117
|
+
justifyContent: 'center',
|
|
118
|
+
}, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: { fontSize: 8, color: 'grey', lineHeight: 8 }, children: '➤' }) }), (0, jsx_runtime_1.jsx)(icons_1.Icon, { name: icon, width: 12, height: 12, marginRight: 6 }), (0, jsx_runtime_1.jsx)(SectionHeaderText, { numberOfLines: 2, selected: selected, children: name })] }, name));
|
|
124
119
|
});
|
|
125
120
|
var ItemTouchable = native_1.default.TouchableOpacity({
|
|
126
121
|
flexDirection: 'row',
|
|
@@ -143,9 +138,7 @@ var ListItem = function (_a) {
|
|
|
143
138
|
var storyId = _a.storyId, kind = _a.kind, title = _a.title, isLastItem = _a.isLastItem, onPress = _a.onPress, isSiblingSelected = _a.isSiblingSelected;
|
|
144
139
|
var selected = (0, hooks_1.useIsStorySelected)(storyId);
|
|
145
140
|
var sectionSelected = (0, hooks_1.useIsStorySectionSelected)(kind) || isSiblingSelected;
|
|
146
|
-
return (
|
|
147
|
-
react_1.default.createElement(icons_1.Icon, { width: 14, height: 14, name: selected ? 'story-white' : 'story-blue', marginRight: 6 }),
|
|
148
|
-
react_1.default.createElement(StoryNameText, { selected: selected }, title)));
|
|
141
|
+
return ((0, jsx_runtime_1.jsxs)(ItemTouchable, { onPress: onPress, activeOpacity: 0.8, testID: "Storybook.ListItem.".concat(kind, ".").concat(title), accessibilityLabel: "Storybook.ListItem.".concat(title), selected: selected, sectionSelected: sectionSelected, isLastItem: isLastItem, children: [(0, jsx_runtime_1.jsx)(icons_1.Icon, { width: 14, height: 14, name: selected ? 'story-white' : 'story-blue', marginRight: 6 }), (0, jsx_runtime_1.jsx)(StoryNameText, { selected: selected, children: title })] }, title));
|
|
149
142
|
};
|
|
150
143
|
var styles = react_native_1.StyleSheet.create({
|
|
151
144
|
sectionList: { flex: 1 },
|
|
@@ -161,24 +154,20 @@ var RenderItem = function (_a) {
|
|
|
161
154
|
var firstChild = (0, getNestedStories_1.findFirstChildStory)(item);
|
|
162
155
|
var firstChildSelected = (0, hooks_1.useIsStorySelected)(firstChild === null || firstChild === void 0 ? void 0 : firstChild.id);
|
|
163
156
|
var _d = (0, react_1.useState)(false), showChildren = _d[0], setShowChildren = _d[1];
|
|
164
|
-
return (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
((_b = item.stories) === null || _b === void 0 ? void 0 : _b.map(function (story, idx) { return (react_1.default.createElement(ListItem, { key: story.id, storyId: story.id, title: story.name, kind: item.name, isSiblingSelected: isChildSelected, isLastItem: idx === item.stories.length - 1, onPress: function () { return changeStory(story.id); } })); })),
|
|
179
|
-
showChildren &&
|
|
180
|
-
((_c = item.children) === null || _c === void 0 ? void 0 : _c.map(function (child, idx) { return (react_1.default.createElement(react_native_1.View, { key: "".concat(child.title, "-").concat(idx), style: { marginLeft: 16 } },
|
|
181
|
-
react_1.default.createElement(RenderItem, { item: child, changeStory: changeStory }))); }))));
|
|
157
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SectionHeader, { name: item.name, isChildSelected: isChildSelected, onPress: function () {
|
|
158
|
+
if (firstChildSelected && showChildren) {
|
|
159
|
+
setShowChildren(false);
|
|
160
|
+
}
|
|
161
|
+
else if (!showChildren && firstChild) {
|
|
162
|
+
setShowChildren(true);
|
|
163
|
+
changeStory(firstChild.id);
|
|
164
|
+
}
|
|
165
|
+
else if (showChildren && !firstChildSelected && firstChild) {
|
|
166
|
+
changeStory(firstChild.id);
|
|
167
|
+
}
|
|
168
|
+
}, icon: item.children.length ? 'folder' : 'grid', expanded: showChildren }), showChildren &&
|
|
169
|
+
((_b = item.stories) === null || _b === void 0 ? void 0 : _b.map(function (story, idx) { return ((0, jsx_runtime_1.jsx)(ListItem, { storyId: story.id, title: story.name, kind: item.name, isSiblingSelected: isChildSelected, isLastItem: idx === item.stories.length - 1, onPress: function () { return changeStory(story.id); } }, story.id)); })), showChildren &&
|
|
170
|
+
((_c = item.children) === null || _c === void 0 ? void 0 : _c.map(function (child, idx) { return ((0, jsx_runtime_1.jsx)(react_native_1.View, { style: { marginLeft: 16 }, children: (0, jsx_runtime_1.jsx)(RenderItem, { item: child, changeStory: changeStory }) }, "".concat(child.title, "-").concat(idx))); }))] }));
|
|
182
171
|
};
|
|
183
172
|
var StoryListView = function (_a) {
|
|
184
173
|
var storyIndex = _a.storyIndex;
|
|
@@ -199,16 +188,14 @@ var StoryListView = function (_a) {
|
|
|
199
188
|
};
|
|
200
189
|
var renderItem = react_1.default.useCallback(function (_a) {
|
|
201
190
|
var item = _a.item;
|
|
202
|
-
return
|
|
191
|
+
return (0, jsx_runtime_1.jsx)(RenderItem, { item: item, changeStory: changeStory });
|
|
203
192
|
}, []);
|
|
204
|
-
return (
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
},
|
|
212
|
-
], testID: "Storybook.ListView", renderItem: renderItem, keyExtractor: keyExtractor, data: data })));
|
|
193
|
+
return ((0, jsx_runtime_1.jsxs)(layout_1.Box, { flex: true, children: [(0, jsx_runtime_1.jsx)(SearchBar, { testID: "Storybook.ListView.SearchBar", onChangeText: handleChangeSearchText, placeholder: "Find by name" }), (0, jsx_runtime_1.jsx)(react_native_1.FlatList, { style: styles.sectionList, contentContainerStyle: [
|
|
194
|
+
styles.sectionListContentContainer,
|
|
195
|
+
{
|
|
196
|
+
paddingVertical: theme.panel.paddingVertical,
|
|
197
|
+
paddingHorizontal: theme.panel.paddingHorizontal,
|
|
198
|
+
},
|
|
199
|
+
], testID: "Storybook.ListView", renderItem: renderItem, keyExtractor: keyExtractor, data: data })] }));
|
|
213
200
|
};
|
|
214
201
|
exports.default = react_1.default.memo(StoryListView);
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
18
|
var react_1 = __importDefault(require("react"));
|
|
18
19
|
var react_native_1 = require("react-native");
|
|
19
20
|
var hooks_1 = require("../../../hooks");
|
|
@@ -39,9 +40,8 @@ var StoryView = function () {
|
|
|
39
40
|
var backgroundColor = (0, hooks_1.useTheme)().backgroundColor;
|
|
40
41
|
if (context && context.unboundStoryFn) {
|
|
41
42
|
var StoryComponent = context.unboundStoryFn;
|
|
42
|
-
return (
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(layout_1.Box, { flex: true, testID: id, onStartShouldSetResponder: dismissOnStartResponder, backgroundColor: backgroundColor, children: StoryComponent && (0, jsx_runtime_1.jsx)(StoryComponent, __assign({}, context)) }, id));
|
|
43
44
|
}
|
|
44
|
-
return (
|
|
45
|
-
react_1.default.createElement(react_native_1.Text, null, "Please open the sidebar and select a story to preview.")));
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(layout_1.Box, { flex: true, padding: 16, alignItems: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { children: "Please open the sidebar and select a story to preview." }) }));
|
|
46
46
|
};
|
|
47
47
|
exports.default = react_1.default.memo(StoryView);
|
|
@@ -24,7 +24,10 @@ function executeLoadable(loadable) {
|
|
|
24
24
|
req.keys().forEach(function (filename) {
|
|
25
25
|
try {
|
|
26
26
|
var fileExports = req(filename);
|
|
27
|
-
exportsMap.set(
|
|
27
|
+
exportsMap.set(
|
|
28
|
+
// NOTE context.resolve is not yet implemented for metro
|
|
29
|
+
// typeof req.resolve === 'function' ? req.resolve(filename) : filename,
|
|
30
|
+
filename, fileExports);
|
|
28
31
|
}
|
|
29
32
|
catch (error) {
|
|
30
33
|
var errorString = error.message && error.stack ? "".concat(error.message, "\n ").concat(error.stack) : error.toString();
|
package/dist/preview/start.js
CHANGED
|
@@ -15,12 +15,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.start = exports.render = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
19
|
var addons_1 = require("@storybook/addons");
|
|
19
20
|
var channels_1 = __importDefault(require("@storybook/channels"));
|
|
20
21
|
var client_api_1 = require("@storybook/client-api");
|
|
21
22
|
var core_events_1 = __importDefault(require("@storybook/core-events"));
|
|
22
23
|
var preview_web_1 = require("@storybook/preview-web");
|
|
23
|
-
var react_1 = __importDefault(require("react"));
|
|
24
24
|
var executeLoadable_1 = require("./executeLoadable");
|
|
25
25
|
var View_1 = require("./View");
|
|
26
26
|
var render = function (args, context) {
|
|
@@ -28,7 +28,7 @@ var render = function (args, context) {
|
|
|
28
28
|
if (!Component) {
|
|
29
29
|
throw new Error("Unable to render story ".concat(id, " as the component annotation is missing from the default export"));
|
|
30
30
|
}
|
|
31
|
-
return
|
|
31
|
+
return (0, jsx_runtime_1.jsx)(Component, __assign({}, args));
|
|
32
32
|
};
|
|
33
33
|
exports.render = render;
|
|
34
34
|
function start() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react-native",
|
|
3
|
-
"version": "6.5.5
|
|
3
|
+
"version": "6.5.5",
|
|
4
4
|
"description": "A better way to develop React Native Components for your app",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"preset": "react-native"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@emotion/
|
|
56
|
-
"@emotion/
|
|
55
|
+
"@emotion/native": "^11.11.0",
|
|
56
|
+
"@emotion/react": "^11.11.1",
|
|
57
57
|
"@storybook/addons": "^6.5.14",
|
|
58
58
|
"@storybook/channel-websocket": "^6.5.14",
|
|
59
59
|
"@storybook/channels": "^6.5.14",
|
|
@@ -63,10 +63,10 @@
|
|
|
63
63
|
"@storybook/core-events": "^6.5.14",
|
|
64
64
|
"@storybook/csf": "0.0.2--canary.4566f4d.1",
|
|
65
65
|
"@storybook/preview-web": "^6.5.14",
|
|
66
|
+
"@storybook/react-native-theming": "^6.5.5",
|
|
66
67
|
"chokidar": "^3.5.1",
|
|
67
68
|
"commander": "^8.2.0",
|
|
68
69
|
"deepmerge": "^4.3.0",
|
|
69
|
-
"emotion-theming": "^10.0.19",
|
|
70
70
|
"glob": "^7.1.7",
|
|
71
71
|
"jotai": "^2.0.2",
|
|
72
72
|
"prettier": "^2.4.1",
|
|
@@ -75,10 +75,11 @@
|
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/jest": "^29.4.3",
|
|
78
|
-
"@types/react": "~18.
|
|
78
|
+
"@types/react": "~18.2.14",
|
|
79
79
|
"babel-jest": "^29.4.3",
|
|
80
80
|
"jest": "^29.4.3",
|
|
81
|
-
"react-test-renderer": "18.2.0"
|
|
81
|
+
"react-test-renderer": "18.2.0",
|
|
82
|
+
"typescript": "^5.1.3"
|
|
82
83
|
},
|
|
83
84
|
"peerDependencies": {
|
|
84
85
|
"@react-native-async-storage/async-storage": ">=1",
|
|
@@ -92,5 +93,5 @@
|
|
|
92
93
|
"publishConfig": {
|
|
93
94
|
"access": "public"
|
|
94
95
|
},
|
|
95
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "ad15a9640397fbaf3536c1b8469c7b13b70676d8"
|
|
96
97
|
}
|
|
@@ -41,11 +41,14 @@ import "@storybook/addon-ondevice-actions/register";
|
|
|
41
41
|
} catch{}
|
|
42
42
|
|
|
43
43
|
|
|
44
|
+
|
|
44
45
|
const getStories=() => {
|
|
45
|
-
|
|
46
|
+
return {"./scripts/mocks/file-extensions/FakeStory.stories.tsx": require("./FakeStory.stories.tsx")};
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
configure(getStories, module, false)
|
|
50
|
+
|
|
51
|
+
|
|
49
52
|
"
|
|
50
53
|
`;
|
|
51
54
|
|
|
@@ -90,11 +93,14 @@ import "@storybook/addon-ondevice-actions/register";
|
|
|
90
93
|
} catch{}
|
|
91
94
|
|
|
92
95
|
|
|
96
|
+
|
|
93
97
|
const getStories=() => {
|
|
94
|
-
|
|
98
|
+
return {"./scripts/mocks/configuration-objects/components/FakeStory.stories.tsx": require("./components/FakeStory.stories.tsx")};
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
configure(getStories, module, false)
|
|
102
|
+
|
|
103
|
+
|
|
98
104
|
"
|
|
99
105
|
`;
|
|
100
106
|
|
|
@@ -139,11 +145,14 @@ import "@storybook/addon-ondevice-actions/register";
|
|
|
139
145
|
} catch{}
|
|
140
146
|
|
|
141
147
|
|
|
148
|
+
|
|
142
149
|
const getStories=() => {
|
|
143
|
-
|
|
150
|
+
return {"./scripts/mocks/exclude-config-files/include-components/FakeStory.stories.tsx": require("./include-components/FakeStory.stories.tsx")};
|
|
144
151
|
}
|
|
145
152
|
|
|
146
153
|
configure(getStories, module, false)
|
|
154
|
+
|
|
155
|
+
|
|
147
156
|
"
|
|
148
157
|
`;
|
|
149
158
|
|
|
@@ -188,11 +197,14 @@ import "@storybook/addon-ondevice-actions/register";
|
|
|
188
197
|
} catch{}
|
|
189
198
|
|
|
190
199
|
|
|
200
|
+
|
|
191
201
|
const getStories=() => {
|
|
192
|
-
|
|
202
|
+
return {"./scripts/mocks/all-config-files/FakeStory.stories.tsx": require("./FakeStory.stories.tsx")};
|
|
193
203
|
}
|
|
194
204
|
|
|
195
205
|
configure(getStories, module, false)
|
|
206
|
+
|
|
207
|
+
|
|
196
208
|
"
|
|
197
209
|
`;
|
|
198
210
|
|
|
@@ -219,11 +231,14 @@ import "@storybook/addon-ondevice-actions/register";
|
|
|
219
231
|
} catch{}
|
|
220
232
|
|
|
221
233
|
|
|
234
|
+
|
|
222
235
|
const getStories=() => {
|
|
223
|
-
|
|
236
|
+
return {"./scripts/mocks/no-preview/FakeStory.stories.tsx": require("./FakeStory.stories.tsx")};
|
|
224
237
|
}
|
|
225
238
|
|
|
226
239
|
configure(getStories, module, false)
|
|
240
|
+
|
|
241
|
+
|
|
227
242
|
"
|
|
228
243
|
`;
|
|
229
244
|
|
|
@@ -243,10 +258,13 @@ exports[`loader writeRequires when there is no story glob or addons writes no st
|
|
|
243
258
|
|
|
244
259
|
|
|
245
260
|
|
|
261
|
+
|
|
246
262
|
const getStories=() => {
|
|
247
|
-
|
|
263
|
+
return {};
|
|
248
264
|
}
|
|
249
265
|
|
|
250
266
|
configure(getStories, module, false)
|
|
267
|
+
|
|
268
|
+
|
|
251
269
|
"
|
|
252
270
|
`;
|
package/scripts/handle-args.js
CHANGED
|
@@ -8,7 +8,11 @@ function getArguments() {
|
|
|
8
8
|
'The path to your config folder relative to your project-dir',
|
|
9
9
|
'./.storybook'
|
|
10
10
|
)
|
|
11
|
-
.option('-a, --absolute', 'Use absolute paths for story imports')
|
|
11
|
+
.option('-a, --absolute', 'Use absolute paths for story imports')
|
|
12
|
+
.option(
|
|
13
|
+
'-unstable_useRequireContext, --unstable_useRequireContext',
|
|
14
|
+
'Use experimental require.context to load stories'
|
|
15
|
+
);
|
|
12
16
|
|
|
13
17
|
program.parse();
|
|
14
18
|
|