@storybook/react-native 6.5.0-rc.1 → 6.5.0-rc.3
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 +5 -0
- package/dist/hooks.js +10 -3
- package/dist/index.d.ts +1 -1
- package/dist/preview/View.d.ts +9 -7
- package/dist/preview/View.js +3 -1
- package/dist/preview/components/OnDeviceUI/OnDeviceUI.js +61 -40
- package/dist/preview/components/OnDeviceUI/Panel.d.ts +7 -5
- package/dist/preview/components/OnDeviceUI/Panel.js +9 -4
- package/dist/preview/components/OnDeviceUI/absolute-positioned-keyboard-aware-view.d.ts +1 -1
- package/dist/preview/components/OnDeviceUI/addons/Addons.d.ts +3 -2
- package/dist/preview/components/OnDeviceUI/addons/Addons.js +7 -22
- package/dist/preview/components/OnDeviceUI/addons/List.js +6 -15
- package/dist/preview/components/OnDeviceUI/addons/Wrapper.js +10 -14
- package/dist/preview/components/OnDeviceUI/animation.d.ts +34 -11
- package/dist/preview/components/OnDeviceUI/animation.js +49 -18
- package/dist/preview/components/OnDeviceUI/navigation/Navigation.d.ts +3 -1
- package/dist/preview/components/OnDeviceUI/navigation/Navigation.js +5 -5
- package/dist/preview/components/OnDeviceUI/navigation/NavigationBar.d.ts +8 -0
- package/dist/preview/components/OnDeviceUI/navigation/NavigationBar.js +14 -0
- package/dist/preview/components/OnDeviceUI/navigation/VisibilityButton.js +10 -10
- package/dist/preview/components/Shared/layout.d.ts +12 -0
- package/dist/preview/components/Shared/layout.js +27 -0
- package/dist/preview/components/Shared/tabs.d.ts +20 -0
- package/dist/preview/components/Shared/tabs.js +35 -0
- package/dist/preview/components/Shared/theme.d.ts +183 -13
- package/dist/preview/components/Shared/theme.js +177 -13
- package/dist/preview/components/StoryListView/StoryListView.js +57 -65
- package/dist/types/types-6.0.d.ts +10 -10
- package/dist/types/types.d.ts +3 -3
- package/package.json +6 -6
- package/scripts/__snapshots__/loader.test.js.snap +35 -35
- package/dist/preview/components/OnDeviceUI/navigation/Bar.d.ts +0 -9
- package/dist/preview/components/OnDeviceUI/navigation/Bar.js +0 -17
- package/dist/preview/components/OnDeviceUI/navigation/Button.d.ts +0 -10
- package/dist/preview/components/OnDeviceUI/navigation/Button.js +0 -17
- package/dist/preview/components/Shared/text.d.ts +0 -3
- package/dist/preview/components/Shared/text.js +0 -18
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
4
|
import GestureRecognizer from 'react-native-swipe-gestures';
|
|
5
|
-
import
|
|
5
|
+
import { NavigationBar } from './NavigationBar';
|
|
6
6
|
import VisibilityButton from './VisibilityButton';
|
|
7
7
|
const SWIPE_CONFIG = {
|
|
8
8
|
velocityThreshold: 0.2,
|
|
@@ -14,7 +14,7 @@ const navStyle = {
|
|
|
14
14
|
right: 0,
|
|
15
15
|
bottom: 0,
|
|
16
16
|
};
|
|
17
|
-
const Navigation = ({ tabOpen, onChangeTab, isUIVisible, setIsUIVisible }) => {
|
|
17
|
+
const Navigation = ({ tabOpen, onChangeTab, isUIVisible, setIsUIVisible, onLayout }) => {
|
|
18
18
|
const insets = useSafeAreaInsets();
|
|
19
19
|
const handleToggleUI = () => {
|
|
20
20
|
setIsUIVisible((oldIsUIVisible) => !oldIsUIVisible);
|
|
@@ -29,9 +29,9 @@ const Navigation = ({ tabOpen, onChangeTab, isUIVisible, setIsUIVisible }) => {
|
|
|
29
29
|
onChangeTab(tabOpen - 1);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
return (React.createElement(View, { style: navStyle },
|
|
32
|
+
return (React.createElement(View, { style: navStyle, onLayout: onLayout },
|
|
33
33
|
isUIVisible && (React.createElement(GestureRecognizer, { onSwipeLeft: handleSwipeLeft, onSwipeRight: handleSwipeRight, config: SWIPE_CONFIG },
|
|
34
|
-
React.createElement(
|
|
35
|
-
React.createElement(VisibilityButton, { onPress: handleToggleUI, style: {
|
|
34
|
+
React.createElement(NavigationBar, { index: tabOpen, onPress: onChangeTab, style: { paddingBottom: insets.bottom } }))),
|
|
35
|
+
React.createElement(VisibilityButton, { onPress: handleToggleUI, style: { paddingBottom: insets.bottom } })));
|
|
36
36
|
};
|
|
37
37
|
export default React.memo(Navigation);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
export interface NavigationBarProps {
|
|
4
|
+
index: number;
|
|
5
|
+
onPress: (id: number) => void;
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
}
|
|
8
|
+
export declare const NavigationBar: React.MemoExoticComponent<({ index, onPress, style }: NavigationBarProps) => JSX.Element>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from '@emotion/native';
|
|
3
|
+
import { NAVIGATOR, PREVIEW, ADDONS } from './constants';
|
|
4
|
+
import { TabBar, TabButton } from '../../Shared/tabs';
|
|
5
|
+
const NavigationTabBar = styled(TabBar)(({ theme }) => ({
|
|
6
|
+
paddingHorizontal: theme.tokens.spacing2,
|
|
7
|
+
backgroundColor: theme.navigation.backgroundColor,
|
|
8
|
+
borderColor: theme.navigation.borderColor,
|
|
9
|
+
borderTopWidth: theme.navigation.borderWidth,
|
|
10
|
+
}));
|
|
11
|
+
export const NavigationBar = React.memo(({ index, onPress, style }) => (React.createElement(NavigationTabBar, { style: style },
|
|
12
|
+
React.createElement(TabButton, { onPress: onPress, testID: "BottomMenu.Navigator", id: NAVIGATOR, active: index === NAVIGATOR }, "NAVIGATOR"),
|
|
13
|
+
React.createElement(TabButton, { onPress: onPress, testID: "BottomMenu.Preview", id: PREVIEW, active: index === PREVIEW }, "PREVIEW"),
|
|
14
|
+
React.createElement(TabButton, { onPress: onPress, testID: "BottomMenu.Addons", id: ADDONS, active: index === ADDONS }, "ADDONS"))));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from '@emotion/native';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
|
-
const Touchable = styled.TouchableOpacity({
|
|
4
|
+
const Touchable = styled.TouchableOpacity(({ theme }) => ({
|
|
5
5
|
backgroundColor: 'transparent',
|
|
6
6
|
position: 'absolute',
|
|
7
|
-
right:
|
|
8
|
-
bottom:
|
|
7
|
+
right: theme.tokens.spacing2,
|
|
8
|
+
bottom: theme.tokens.spacing4,
|
|
9
9
|
zIndex: 100,
|
|
10
|
-
});
|
|
10
|
+
}));
|
|
11
11
|
const HIDE_ICON_SIZE = 14;
|
|
12
12
|
const HIDE_ICON_BORDER_WIDTH = 1;
|
|
13
13
|
const Inner = styled.View(({ theme }) => ({
|
|
@@ -16,22 +16,22 @@ const Inner = styled.View(({ theme }) => ({
|
|
|
16
16
|
left: 0,
|
|
17
17
|
width: HIDE_ICON_SIZE,
|
|
18
18
|
height: HIDE_ICON_SIZE,
|
|
19
|
-
borderRadius:
|
|
19
|
+
borderRadius: theme.navigation.visibilityBorderRadius,
|
|
20
20
|
overflow: 'hidden',
|
|
21
|
-
borderColor: theme.
|
|
21
|
+
borderColor: theme.navigation.visibilityInnerBorderColor,
|
|
22
22
|
borderWidth: HIDE_ICON_BORDER_WIDTH * 2,
|
|
23
23
|
}));
|
|
24
|
-
const Outer = styled.View({
|
|
24
|
+
const Outer = styled.View(({ theme }) => ({
|
|
25
25
|
position: 'absolute',
|
|
26
26
|
top: 0,
|
|
27
27
|
left: 0,
|
|
28
28
|
width: HIDE_ICON_SIZE,
|
|
29
29
|
height: HIDE_ICON_SIZE,
|
|
30
|
-
borderRadius:
|
|
30
|
+
borderRadius: theme.navigation.visibilityBorderRadius,
|
|
31
31
|
overflow: 'hidden',
|
|
32
|
-
borderColor:
|
|
32
|
+
borderColor: theme.navigation.visibilityOuterBorderColor,
|
|
33
33
|
borderWidth: HIDE_ICON_BORDER_WIDTH,
|
|
34
|
-
});
|
|
34
|
+
}));
|
|
35
35
|
const hideIconStyles = {
|
|
36
36
|
width: HIDE_ICON_SIZE,
|
|
37
37
|
height: HIDE_ICON_SIZE,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A general (flex)box layout component that accepts props for flexbox layout
|
|
3
|
+
* styles, such as `flex`, `alignItems`, `marginVertical`, etc.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <Box flex flexDirection='row' alignItems='center' marginVertical={42}>
|
|
8
|
+
* <MyContent />
|
|
9
|
+
* </Box>
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const Box: any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import styled from '@emotion/native';
|
|
13
|
+
/**
|
|
14
|
+
* A general (flex)box layout component that accepts props for flexbox layout
|
|
15
|
+
* styles, such as `flex`, `alignItems`, `marginVertical`, etc.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <Box flex flexDirection='row' alignItems='center' marginVertical={42}>
|
|
20
|
+
* <MyContent />
|
|
21
|
+
* </Box>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export const Box = styled.View((_a) => {
|
|
25
|
+
var { flex } = _a, layoutProps = __rest(_a, ["flex"]);
|
|
26
|
+
return (Object.assign({ flex: flex === true ? 1 : flex === false ? 0 : flex }, layoutProps));
|
|
27
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
interface TabButtonProps {
|
|
4
|
+
id: number | string;
|
|
5
|
+
active: boolean;
|
|
6
|
+
onPress: (id: number | string) => void;
|
|
7
|
+
testID?: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const TabButton: React.MemoExoticComponent<({ onPress, id, active, children, testID }: TabButtonProps) => JSX.Element>;
|
|
11
|
+
interface TabBarProps {
|
|
12
|
+
/**
|
|
13
|
+
* Should the tab bar contents scroll horizontally?
|
|
14
|
+
*/
|
|
15
|
+
scrollable?: boolean;
|
|
16
|
+
style?: StyleProp<ViewStyle>;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare const TabBar: React.MemoExoticComponent<({ scrollable, style, children }: TabBarProps) => JSX.Element>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ScrollView, View } from 'react-native';
|
|
3
|
+
import styled from '@emotion/native';
|
|
4
|
+
import { useTheme } from '../../../hooks';
|
|
5
|
+
const TabButtonText = styled.Text(({ theme, active }) => ({
|
|
6
|
+
color: active ? theme.tabs.activeTextColor : theme.tabs.inactiveTextColor,
|
|
7
|
+
paddingVertical: theme.tabs.paddingVertical,
|
|
8
|
+
paddingHorizontal: theme.tabs.paddingHorizontal,
|
|
9
|
+
fontSize: theme.tabs.fontSize,
|
|
10
|
+
fontWeight: theme.tabs.fontWeight,
|
|
11
|
+
}));
|
|
12
|
+
const hitSlop = { top: 8, left: 0, right: 0, bottom: 20 };
|
|
13
|
+
const TabButtonTouchable = styled.TouchableOpacity(({ theme, active }) => ({
|
|
14
|
+
borderWidth: theme.tabs.borderWidth,
|
|
15
|
+
borderColor: active ? theme.tabs.activeBorderColor : theme.tabs.inactiveBorderColor,
|
|
16
|
+
borderRadius: theme.tabs.borderRadius,
|
|
17
|
+
backgroundColor: active ? theme.tabs.activeBackgroundColor : theme.tabs.inactiveBackgroundColor,
|
|
18
|
+
}));
|
|
19
|
+
export const TabButton = React.memo(({ onPress, id, active, children, testID }) => {
|
|
20
|
+
return (React.createElement(TabButtonTouchable, { active: active, testID: testID, onPress: () => onPress(id), activeOpacity: 0.8, hitSlop: hitSlop },
|
|
21
|
+
React.createElement(TabButtonText, { active: active }, children)));
|
|
22
|
+
});
|
|
23
|
+
export const TabBar = React.memo(({ scrollable = false, style, children }) => {
|
|
24
|
+
const theme = useTheme();
|
|
25
|
+
if (scrollable) {
|
|
26
|
+
children = (React.createElement(ScrollView, { showsHorizontalScrollIndicator: false, horizontal: true, contentContainerStyle: { paddingHorizontal: theme.tokens.spacing2 } }, children));
|
|
27
|
+
}
|
|
28
|
+
return (React.createElement(View, { style: style },
|
|
29
|
+
React.createElement(TabBarContainer, null, children)));
|
|
30
|
+
});
|
|
31
|
+
const TabBarContainer = styled.View({
|
|
32
|
+
flexDirection: 'row',
|
|
33
|
+
paddingVertical: 6,
|
|
34
|
+
justifyItems: 'center',
|
|
35
|
+
});
|
|
@@ -1,15 +1,185 @@
|
|
|
1
|
-
|
|
1
|
+
import { ShadowStyleIOS, ViewStyle, TextStyle } from 'react-native';
|
|
2
|
+
type ShadowStyle = ShadowStyleIOS | Pick<ViewStyle, 'elevation'>;
|
|
3
|
+
type FontWeight = TextStyle['fontWeight'];
|
|
4
|
+
/**
|
|
5
|
+
* Primitive tokens used to build the theme.
|
|
6
|
+
*
|
|
7
|
+
* Ideally components should not use these values directly, and should prefer
|
|
8
|
+
* to use more semantic values from the theme.
|
|
9
|
+
*/
|
|
10
|
+
interface ThemeTokens {
|
|
11
|
+
spacing1: number;
|
|
12
|
+
spacing2: number;
|
|
13
|
+
spacing3: number;
|
|
14
|
+
spacing4: number;
|
|
15
|
+
spacing5: number;
|
|
16
|
+
spacing6: number;
|
|
17
|
+
fontSize: {
|
|
18
|
+
small: number;
|
|
19
|
+
smaller: number;
|
|
20
|
+
normal: number;
|
|
21
|
+
};
|
|
22
|
+
color: {
|
|
23
|
+
black: string;
|
|
24
|
+
white: string;
|
|
25
|
+
grey200: string;
|
|
26
|
+
grey700: string;
|
|
27
|
+
red500: string;
|
|
28
|
+
blue100: string;
|
|
29
|
+
blue200: string;
|
|
30
|
+
blue250: string;
|
|
31
|
+
blue300: string;
|
|
32
|
+
blue400: string;
|
|
33
|
+
blue600: string;
|
|
34
|
+
green500: string;
|
|
35
|
+
};
|
|
36
|
+
borderRadius: {
|
|
37
|
+
small: number;
|
|
38
|
+
medium: number;
|
|
39
|
+
large: number;
|
|
40
|
+
round: number;
|
|
41
|
+
};
|
|
42
|
+
borderWidthNormal: number;
|
|
43
|
+
/** Elevation shadows */
|
|
44
|
+
elevation: {
|
|
45
|
+
floating: ShadowStyle;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
interface ThemeButton {
|
|
49
|
+
textColor: string;
|
|
2
50
|
backgroundColor: string;
|
|
3
|
-
storyListBackgroundColor: string;
|
|
4
|
-
listItemTextColor: string;
|
|
5
|
-
listItemActiveColor: string;
|
|
6
|
-
listItemActiveTextColor: string;
|
|
7
|
-
sectionActiveColor: string;
|
|
8
|
-
headerTextColor: string;
|
|
9
|
-
labelColor: string;
|
|
10
51
|
borderColor: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
52
|
+
borderWidth: number;
|
|
53
|
+
borderRadius: number;
|
|
54
|
+
}
|
|
55
|
+
export interface Theme {
|
|
56
|
+
tokens: ThemeTokens;
|
|
57
|
+
backgroundColor: string;
|
|
58
|
+
text: {
|
|
59
|
+
primaryColor: string;
|
|
60
|
+
secondaryColor: string;
|
|
61
|
+
linkColor: string;
|
|
62
|
+
};
|
|
63
|
+
preview: {
|
|
64
|
+
containerBackgroundColor: string;
|
|
65
|
+
backgroundColor: string;
|
|
66
|
+
};
|
|
67
|
+
/** Navigation bar and related area */
|
|
68
|
+
navigation: {
|
|
69
|
+
backgroundColor: string;
|
|
70
|
+
borderColor: string;
|
|
71
|
+
borderWidth: number;
|
|
72
|
+
visibilityBorderRadius: number;
|
|
73
|
+
visibilityInnerBorderColor: string;
|
|
74
|
+
visibilityOuterBorderColor: string;
|
|
75
|
+
};
|
|
76
|
+
/** Side panels (Story list, addons) */
|
|
77
|
+
panel: {
|
|
78
|
+
backgroundColor: string;
|
|
79
|
+
borderWidth: number;
|
|
80
|
+
borderColor: string;
|
|
81
|
+
paddingVertical: number;
|
|
82
|
+
paddingHorizontal: number;
|
|
83
|
+
};
|
|
84
|
+
/** Story list and list items */
|
|
85
|
+
storyList: {
|
|
86
|
+
fontSize: number;
|
|
87
|
+
headerPaddingHorizontal: number;
|
|
88
|
+
headerPaddingVertical: number;
|
|
89
|
+
headerTextColor: string;
|
|
90
|
+
headerFontWeight: FontWeight;
|
|
91
|
+
storyPaddingHorizontal: number;
|
|
92
|
+
storyPaddingVertical: number;
|
|
93
|
+
storyIndent: number;
|
|
94
|
+
storyTextColor: string;
|
|
95
|
+
storyFontWeight: FontWeight;
|
|
96
|
+
storySelectedBackgroundColor: string;
|
|
97
|
+
storySelectedTextColor: string;
|
|
98
|
+
storySelectedFontWeight: FontWeight;
|
|
99
|
+
sectionSpacing: number;
|
|
100
|
+
sectionActiveBackgroundColor: string;
|
|
101
|
+
sectionBorderRadius: number;
|
|
102
|
+
search: {
|
|
103
|
+
fontSize: number;
|
|
104
|
+
textColor: string;
|
|
105
|
+
placeholderTextColor: string;
|
|
106
|
+
borderRadius: number;
|
|
107
|
+
borderColor: string;
|
|
108
|
+
borderWidth: number;
|
|
109
|
+
backgroundColor: string;
|
|
110
|
+
paddingVertical: number;
|
|
111
|
+
paddingHorizontal: number;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/** Buttons */
|
|
115
|
+
button: {
|
|
116
|
+
fontSize: number;
|
|
117
|
+
fontWeight: FontWeight;
|
|
118
|
+
paddingVertical: number;
|
|
119
|
+
paddingHorizontal: number;
|
|
120
|
+
primary: ThemeButton;
|
|
121
|
+
secondary: ThemeButton;
|
|
122
|
+
};
|
|
123
|
+
/** Tabs (navigation and addons) */
|
|
124
|
+
tabs: {
|
|
125
|
+
fontSize: number;
|
|
126
|
+
fontWeight: FontWeight;
|
|
127
|
+
paddingVertical: number;
|
|
128
|
+
paddingHorizontal: number;
|
|
129
|
+
borderWidth: number;
|
|
130
|
+
borderRadius: number;
|
|
131
|
+
activeBorderColor: string;
|
|
132
|
+
activeBackgroundColor: string;
|
|
133
|
+
activeTextColor: string;
|
|
134
|
+
inactiveBorderColor: string;
|
|
135
|
+
inactiveBackgroundColor: string;
|
|
136
|
+
inactiveTextColor: string;
|
|
137
|
+
};
|
|
138
|
+
/** Inputs (text, radio, slider, etc.) */
|
|
139
|
+
inputs: {
|
|
140
|
+
errorTextColor: string;
|
|
141
|
+
labelFontSize: number;
|
|
142
|
+
labelTextColor: string;
|
|
143
|
+
text: {
|
|
144
|
+
fontSize: number;
|
|
145
|
+
textColor: string;
|
|
146
|
+
borderWidth: number;
|
|
147
|
+
borderColor: string;
|
|
148
|
+
backgroundColor: string;
|
|
149
|
+
borderRadius: number;
|
|
150
|
+
paddingVertical: number;
|
|
151
|
+
paddingHorizontal: number;
|
|
152
|
+
};
|
|
153
|
+
radio: {
|
|
154
|
+
fontSize: number;
|
|
155
|
+
height: number;
|
|
156
|
+
borderWidth: number;
|
|
157
|
+
borderColor: string;
|
|
158
|
+
backgroundColor: string;
|
|
159
|
+
paddingVertical: number;
|
|
160
|
+
paddingHorizontal: number;
|
|
161
|
+
activeBackgroundColor: string;
|
|
162
|
+
itemSpacing: number;
|
|
163
|
+
labelSpacing: number;
|
|
164
|
+
};
|
|
165
|
+
swatch: {
|
|
166
|
+
fontSize: number;
|
|
167
|
+
height: number;
|
|
168
|
+
borderWidth: number;
|
|
169
|
+
borderColor: string;
|
|
170
|
+
backgroundColor: string;
|
|
171
|
+
outerBorderRadius: number;
|
|
172
|
+
innerBorderRadius: number;
|
|
173
|
+
paddingVertical: number;
|
|
174
|
+
paddingHorizontal: number;
|
|
175
|
+
nameTextWeight: FontWeight;
|
|
176
|
+
};
|
|
177
|
+
slider: {
|
|
178
|
+
fontSize: number;
|
|
179
|
+
labelTextColor: string;
|
|
180
|
+
valueTextColor: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export declare const theme: Theme;
|
|
185
|
+
export {};
|
|
@@ -1,15 +1,179 @@
|
|
|
1
|
+
const tokens = {
|
|
2
|
+
spacing1: 4,
|
|
3
|
+
spacing2: 8,
|
|
4
|
+
spacing3: 12,
|
|
5
|
+
spacing4: 16,
|
|
6
|
+
spacing5: 20,
|
|
7
|
+
spacing6: 24,
|
|
8
|
+
fontSize: {
|
|
9
|
+
small: 12,
|
|
10
|
+
smaller: 14,
|
|
11
|
+
normal: 16,
|
|
12
|
+
},
|
|
13
|
+
color: {
|
|
14
|
+
black: '#001a23',
|
|
15
|
+
white: '#ffffff',
|
|
16
|
+
grey200: '#dee2e3',
|
|
17
|
+
grey700: '#859499',
|
|
18
|
+
red500: '#ff4400',
|
|
19
|
+
blue100: '#f6f9fc',
|
|
20
|
+
blue200: '#e0eaf5',
|
|
21
|
+
blue250: '#dcebf9',
|
|
22
|
+
blue300: '#b2cbe6',
|
|
23
|
+
blue400: '#a3c1e0',
|
|
24
|
+
blue600: '#1ea7fd',
|
|
25
|
+
green500: '#66bf3c',
|
|
26
|
+
},
|
|
27
|
+
borderRadius: {
|
|
28
|
+
small: 4,
|
|
29
|
+
medium: 6,
|
|
30
|
+
large: 8,
|
|
31
|
+
round: 100,
|
|
32
|
+
},
|
|
33
|
+
borderWidthNormal: 1,
|
|
34
|
+
elevation: {
|
|
35
|
+
floating: {
|
|
36
|
+
shadowColor: '#000000',
|
|
37
|
+
shadowOpacity: 0.2,
|
|
38
|
+
shadowOffset: { width: 0, height: 0 },
|
|
39
|
+
shadowRadius: 16,
|
|
40
|
+
elevation: 10,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const text = {
|
|
45
|
+
primaryColor: tokens.color.black,
|
|
46
|
+
secondaryColor: tokens.color.grey700,
|
|
47
|
+
linkColor: '#0000ff',
|
|
48
|
+
};
|
|
1
49
|
export const theme = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
50
|
+
tokens,
|
|
51
|
+
text,
|
|
52
|
+
backgroundColor: tokens.color.white,
|
|
53
|
+
preview: {
|
|
54
|
+
containerBackgroundColor: tokens.color.white,
|
|
55
|
+
backgroundColor: tokens.color.white,
|
|
56
|
+
},
|
|
57
|
+
navigation: {
|
|
58
|
+
backgroundColor: tokens.color.white,
|
|
59
|
+
borderColor: tokens.color.grey200,
|
|
60
|
+
borderWidth: tokens.borderWidthNormal,
|
|
61
|
+
visibilityBorderRadius: tokens.borderRadius.small,
|
|
62
|
+
visibilityInnerBorderColor: tokens.color.grey700,
|
|
63
|
+
visibilityOuterBorderColor: tokens.color.white,
|
|
64
|
+
},
|
|
65
|
+
panel: {
|
|
66
|
+
backgroundColor: tokens.color.blue100,
|
|
67
|
+
borderWidth: tokens.borderWidthNormal,
|
|
68
|
+
borderColor: tokens.color.blue200,
|
|
69
|
+
paddingVertical: 0,
|
|
70
|
+
paddingHorizontal: tokens.spacing2,
|
|
71
|
+
},
|
|
72
|
+
storyList: {
|
|
73
|
+
fontSize: tokens.fontSize.normal,
|
|
74
|
+
headerPaddingHorizontal: tokens.spacing2,
|
|
75
|
+
headerPaddingVertical: tokens.spacing2,
|
|
76
|
+
headerTextColor: text.primaryColor,
|
|
77
|
+
headerFontWeight: '500',
|
|
78
|
+
storyPaddingHorizontal: tokens.spacing2,
|
|
79
|
+
storyPaddingVertical: tokens.spacing1 * 1.5,
|
|
80
|
+
storyIndent: tokens.spacing6,
|
|
81
|
+
storyTextColor: text.primaryColor,
|
|
82
|
+
storyFontWeight: '400',
|
|
83
|
+
storySelectedBackgroundColor: tokens.color.blue600,
|
|
84
|
+
storySelectedTextColor: tokens.color.white,
|
|
85
|
+
storySelectedFontWeight: '700',
|
|
86
|
+
sectionSpacing: tokens.spacing2,
|
|
87
|
+
sectionActiveBackgroundColor: tokens.color.blue200,
|
|
88
|
+
sectionBorderRadius: tokens.borderRadius.medium,
|
|
89
|
+
search: {
|
|
90
|
+
fontSize: tokens.fontSize.normal,
|
|
91
|
+
textColor: text.primaryColor,
|
|
92
|
+
placeholderTextColor: text.secondaryColor,
|
|
93
|
+
borderRadius: tokens.borderRadius.round,
|
|
94
|
+
borderColor: tokens.color.blue400,
|
|
95
|
+
borderWidth: tokens.borderWidthNormal,
|
|
96
|
+
backgroundColor: tokens.color.white,
|
|
97
|
+
paddingVertical: tokens.spacing2,
|
|
98
|
+
paddingHorizontal: tokens.spacing3,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
button: {
|
|
102
|
+
fontSize: tokens.fontSize.smaller,
|
|
103
|
+
fontWeight: '600',
|
|
104
|
+
paddingVertical: tokens.spacing2,
|
|
105
|
+
paddingHorizontal: tokens.spacing5,
|
|
106
|
+
primary: {
|
|
107
|
+
textColor: text.primaryColor,
|
|
108
|
+
backgroundColor: tokens.color.blue250,
|
|
109
|
+
borderColor: tokens.color.blue300,
|
|
110
|
+
borderWidth: tokens.borderWidthNormal,
|
|
111
|
+
borderRadius: tokens.borderRadius.medium,
|
|
112
|
+
},
|
|
113
|
+
secondary: {
|
|
114
|
+
textColor: text.primaryColor,
|
|
115
|
+
backgroundColor: 'transparent',
|
|
116
|
+
borderColor: tokens.color.blue300,
|
|
117
|
+
borderWidth: tokens.borderWidthNormal,
|
|
118
|
+
borderRadius: tokens.borderRadius.medium,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
tabs: {
|
|
122
|
+
fontSize: tokens.fontSize.small,
|
|
123
|
+
fontWeight: '500',
|
|
124
|
+
paddingVertical: tokens.spacing2,
|
|
125
|
+
paddingHorizontal: tokens.spacing2 * 1.25,
|
|
126
|
+
borderWidth: tokens.borderWidthNormal,
|
|
127
|
+
borderRadius: tokens.borderRadius.round,
|
|
128
|
+
activeBorderColor: tokens.color.blue300,
|
|
129
|
+
activeBackgroundColor: tokens.color.blue250,
|
|
130
|
+
activeTextColor: text.primaryColor,
|
|
131
|
+
inactiveBorderColor: 'transparent',
|
|
132
|
+
inactiveBackgroundColor: 'transparent',
|
|
133
|
+
inactiveTextColor: text.secondaryColor,
|
|
134
|
+
},
|
|
135
|
+
inputs: {
|
|
136
|
+
errorTextColor: tokens.color.red500,
|
|
137
|
+
labelFontSize: tokens.fontSize.smaller,
|
|
138
|
+
labelTextColor: text.primaryColor,
|
|
139
|
+
text: {
|
|
140
|
+
fontSize: tokens.fontSize.smaller,
|
|
141
|
+
textColor: text.primaryColor,
|
|
142
|
+
borderWidth: tokens.borderWidthNormal,
|
|
143
|
+
borderColor: tokens.color.blue400,
|
|
144
|
+
backgroundColor: tokens.color.white,
|
|
145
|
+
borderRadius: tokens.borderRadius.medium,
|
|
146
|
+
paddingVertical: tokens.spacing1 * 1.5,
|
|
147
|
+
paddingHorizontal: tokens.spacing1 * 1.5,
|
|
148
|
+
},
|
|
149
|
+
radio: {
|
|
150
|
+
fontSize: tokens.fontSize.smaller,
|
|
151
|
+
height: 20,
|
|
152
|
+
borderWidth: tokens.borderWidthNormal,
|
|
153
|
+
borderColor: tokens.color.blue400,
|
|
154
|
+
backgroundColor: tokens.color.white,
|
|
155
|
+
paddingVertical: 3,
|
|
156
|
+
paddingHorizontal: 3,
|
|
157
|
+
activeBackgroundColor: tokens.color.green500,
|
|
158
|
+
itemSpacing: tokens.spacing1,
|
|
159
|
+
labelSpacing: tokens.spacing2,
|
|
160
|
+
},
|
|
161
|
+
swatch: {
|
|
162
|
+
fontSize: tokens.fontSize.smaller,
|
|
163
|
+
height: 40,
|
|
164
|
+
borderWidth: tokens.borderWidthNormal,
|
|
165
|
+
borderColor: tokens.color.blue400,
|
|
166
|
+
backgroundColor: tokens.color.white,
|
|
167
|
+
outerBorderRadius: tokens.borderRadius.medium,
|
|
168
|
+
innerBorderRadius: tokens.borderRadius.small,
|
|
169
|
+
paddingVertical: tokens.spacing1,
|
|
170
|
+
paddingHorizontal: tokens.spacing1,
|
|
171
|
+
nameTextWeight: '600',
|
|
172
|
+
},
|
|
173
|
+
slider: {
|
|
174
|
+
fontSize: tokens.fontSize.smaller,
|
|
175
|
+
labelTextColor: text.secondaryColor,
|
|
176
|
+
valueTextColor: text.primaryColor,
|
|
177
|
+
},
|
|
178
|
+
},
|
|
15
179
|
};
|