@draftbit/core 46.11.1-0339d0.2 → 46.11.1-138467.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Card.js.map +1 -1
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +23 -6
- package/lib/commonjs/components/Checkbox/CheckboxRow.js.map +1 -1
- package/lib/commonjs/components/Picker/Picker.js +13 -4
- package/lib/commonjs/components/Picker/Picker.js.map +1 -1
- package/lib/commonjs/components/TabView/TabView.js +1 -1
- package/lib/commonjs/components/TabView/TabView.js.map +1 -1
- package/lib/commonjs/index.js +0 -19
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/mappings/Layout.js +4 -4
- package/lib/commonjs/mappings/Layout.js.map +1 -1
- package/lib/commonjs/mappings/Picker.js.map +1 -1
- package/lib/commonjs/utilities.js +2 -35
- package/lib/commonjs/utilities.js.map +1 -1
- package/lib/module/components/Picker/Picker.js +13 -4
- package/lib/module/components/Picker/Picker.js.map +1 -1
- package/lib/module/components/TabView/TabView.js +1 -1
- package/lib/module/components/TabView/TabView.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/mappings/Layout.js +4 -4
- package/lib/module/mappings/Layout.js.map +1 -1
- package/lib/module/utilities.js +0 -24
- package/lib/module/utilities.js.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +0 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/utilities.d.ts +0 -8
- package/lib/typescript/src/utilities.d.ts.map +1 -1
- package/package.json +3 -4
- package/src/components/Picker/Picker.js +16 -4
- package/src/components/Picker/Picker.tsx +25 -5
- package/src/components/TabView/TabView.js +1 -1
- package/src/components/TabView/TabView.tsx +1 -1
- package/src/index.js +0 -1
- package/src/index.tsx +0 -6
- package/src/mappings/Layout.js +4 -4
- package/src/mappings/Layout.ts +4 -4
- package/src/utilities.js +0 -50
- package/src/utilities.ts +0 -90
- package/lib/commonjs/components/SwipeableView/SwipeableView.js +0 -155
- package/lib/commonjs/components/SwipeableView/SwipeableView.js.map +0 -1
- package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js +0 -13
- package/lib/commonjs/components/SwipeableView/SwipeableViewButton.js.map +0 -1
- package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js +0 -13
- package/lib/commonjs/components/SwipeableView/SwipeableViewSwipeHandler.js.map +0 -1
- package/lib/commonjs/components/SwipeableView/index.js +0 -28
- package/lib/commonjs/components/SwipeableView/index.js.map +0 -1
- package/lib/commonjs/mappings/NativeBase/Layout.js +0 -97
- package/lib/commonjs/mappings/NativeBase/Layout.js.map +0 -1
- package/lib/commonjs/mappings/SwipeableView.js +0 -182
- package/lib/commonjs/mappings/SwipeableView.js.map +0 -1
- package/lib/module/components/SwipeableView/SwipeableView.js +0 -147
- package/lib/module/components/SwipeableView/SwipeableView.js.map +0 -1
- package/lib/module/components/SwipeableView/SwipeableViewButton.js +0 -6
- package/lib/module/components/SwipeableView/SwipeableViewButton.js.map +0 -1
- package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js +0 -6
- package/lib/module/components/SwipeableView/SwipeableViewSwipeHandler.js.map +0 -1
- package/lib/module/components/SwipeableView/index.js +0 -4
- package/lib/module/components/SwipeableView/index.js.map +0 -1
- package/lib/module/mappings/NativeBase/Layout.js +0 -90
- package/lib/module/mappings/NativeBase/Layout.js.map +0 -1
- package/lib/module/mappings/SwipeableView.js +0 -175
- package/lib/module/mappings/SwipeableView.js.map +0 -1
- package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts +0 -29
- package/lib/typescript/src/components/SwipeableView/SwipeableView.d.ts.map +0 -1
- package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts +0 -13
- package/lib/typescript/src/components/SwipeableView/SwipeableViewButton.d.ts.map +0 -1
- package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts +0 -13
- package/lib/typescript/src/components/SwipeableView/SwipeableViewSwipeHandler.d.ts.map +0 -1
- package/lib/typescript/src/components/SwipeableView/index.d.ts +0 -4
- package/lib/typescript/src/components/SwipeableView/index.d.ts.map +0 -1
- package/lib/typescript/src/mappings/NativeBase/Layout.d.ts +0 -107
- package/lib/typescript/src/mappings/NativeBase/Layout.d.ts.map +0 -1
- package/lib/typescript/src/mappings/SwipeableView.d.ts +0 -371
- package/lib/typescript/src/mappings/SwipeableView.d.ts.map +0 -1
- package/src/components/SwipeableView/SwipeableView.js +0 -117
- package/src/components/SwipeableView/SwipeableView.tsx +0 -299
- package/src/components/SwipeableView/SwipeableViewButton.js +0 -5
- package/src/components/SwipeableView/SwipeableViewButton.tsx +0 -18
- package/src/components/SwipeableView/SwipeableViewSwipeHandler.js +0 -5
- package/src/components/SwipeableView/SwipeableViewSwipeHandler.tsx +0 -20
- package/src/components/SwipeableView/index.js +0 -3
- package/src/components/SwipeableView/index.tsx +0 -3
- package/src/mappings/NativeBase/Layout.js +0 -111
- package/src/mappings/NativeBase/Layout.ts +0 -130
- package/src/mappings/SwipeableView.js +0 -181
- package/src/mappings/SwipeableView.ts +0 -210
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
StyleProp,
|
|
5
|
-
ViewStyle,
|
|
6
|
-
TextStyle,
|
|
7
|
-
StyleSheet,
|
|
8
|
-
Text,
|
|
9
|
-
} from "react-native";
|
|
10
|
-
import Pressable from "../Pressable";
|
|
11
|
-
import {
|
|
12
|
-
extractBorderAndMarginStyles,
|
|
13
|
-
extractEffectStyles,
|
|
14
|
-
extractFlexItemStyles,
|
|
15
|
-
extractPositionStyles,
|
|
16
|
-
extractSizeStyles,
|
|
17
|
-
extractStyles,
|
|
18
|
-
} from "../../utilities";
|
|
19
|
-
import { SwipeRow } from "react-native-swipe-list-view";
|
|
20
|
-
import { IconSlot } from "../../interfaces/Icon";
|
|
21
|
-
import type { Theme } from "../../styles/DefaultTheme";
|
|
22
|
-
import { withTheme } from "../../theming";
|
|
23
|
-
import { SwipeableViewButtonProps } from "./SwipeableViewButton";
|
|
24
|
-
import { SwipeableViewSwipeHandlerProps } from "./SwipeableViewSwipeHandler";
|
|
25
|
-
|
|
26
|
-
export interface SwipeableViewProps extends IconSlot {
|
|
27
|
-
closeOnPress?: boolean;
|
|
28
|
-
leftOpenValue?: number;
|
|
29
|
-
rightOpenValue?: number;
|
|
30
|
-
leftActivationValue?: number;
|
|
31
|
-
rightActivationValue?: number;
|
|
32
|
-
swipeActivationPercentage?: number;
|
|
33
|
-
stopLeftSwipe?: number;
|
|
34
|
-
stopRightSwipe?: number;
|
|
35
|
-
directionalDistanceChangeThreshold?: number;
|
|
36
|
-
friction?: number;
|
|
37
|
-
tension?: number;
|
|
38
|
-
disableLeftSwipe?: boolean;
|
|
39
|
-
disableRightSwipe?: boolean;
|
|
40
|
-
swipeToOpenVelocityContribution?: number;
|
|
41
|
-
swipeToOpenPercent?: number;
|
|
42
|
-
swipeToClosePercent?: number;
|
|
43
|
-
style?: StyleProp<ViewStyle | TextStyle>;
|
|
44
|
-
theme: Theme;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const SwipeableView: React.FC<React.PropsWithChildren<SwipeableViewProps>> = ({
|
|
48
|
-
theme,
|
|
49
|
-
style,
|
|
50
|
-
children,
|
|
51
|
-
Icon,
|
|
52
|
-
closeOnPress,
|
|
53
|
-
leftOpenValue,
|
|
54
|
-
rightOpenValue,
|
|
55
|
-
leftActivationValue,
|
|
56
|
-
rightActivationValue,
|
|
57
|
-
swipeActivationPercentage = 80,
|
|
58
|
-
stopLeftSwipe,
|
|
59
|
-
stopRightSwipe,
|
|
60
|
-
friction = 20,
|
|
61
|
-
...rest
|
|
62
|
-
}) => {
|
|
63
|
-
const instanceOfSwipeableViewButtonProps = (
|
|
64
|
-
object: any
|
|
65
|
-
): object is SwipeableViewButtonProps => {
|
|
66
|
-
return "title" in object && "side" in object && "onPress" in object;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const instanceOfSwipeableViewSwipeHandlerProps = (
|
|
70
|
-
object: any
|
|
71
|
-
): object is SwipeableViewSwipeHandlerProps => {
|
|
72
|
-
return "title" in object && "side" in object && "onSwipe" in object;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const { viewStyles, textStyles } = extractStyles(style);
|
|
76
|
-
|
|
77
|
-
const { borderStyles, marginStyles } =
|
|
78
|
-
extractBorderAndMarginStyles(viewStyles);
|
|
79
|
-
|
|
80
|
-
const parentContainerStyles = StyleSheet.flatten([
|
|
81
|
-
borderStyles,
|
|
82
|
-
marginStyles,
|
|
83
|
-
extractFlexItemStyles(viewStyles),
|
|
84
|
-
extractPositionStyles(viewStyles),
|
|
85
|
-
extractEffectStyles(viewStyles),
|
|
86
|
-
extractSizeStyles(viewStyles),
|
|
87
|
-
]);
|
|
88
|
-
|
|
89
|
-
//Remove styles already consumed from viewStyles
|
|
90
|
-
Object.keys(parentContainerStyles).forEach((key) => delete viewStyles[key]);
|
|
91
|
-
const surfaceContainerStyles = viewStyles;
|
|
92
|
-
|
|
93
|
-
const [componentWidth, setComponentWidth] = React.useState<number | null>(
|
|
94
|
-
null
|
|
95
|
-
);
|
|
96
|
-
const leftButtons = React.useMemo(
|
|
97
|
-
() =>
|
|
98
|
-
React.Children.toArray(children).filter(
|
|
99
|
-
(child) =>
|
|
100
|
-
React.isValidElement(child) &&
|
|
101
|
-
instanceOfSwipeableViewButtonProps(child.props) &&
|
|
102
|
-
child.props.side === "left"
|
|
103
|
-
) as React.ReactElement<SwipeableViewButtonProps>[],
|
|
104
|
-
[children]
|
|
105
|
-
);
|
|
106
|
-
|
|
107
|
-
const rightButtons = React.useMemo(
|
|
108
|
-
() =>
|
|
109
|
-
React.Children.toArray(children).filter(
|
|
110
|
-
(child) =>
|
|
111
|
-
React.isValidElement(child) &&
|
|
112
|
-
instanceOfSwipeableViewButtonProps(child.props) &&
|
|
113
|
-
child.props.side === "right"
|
|
114
|
-
) as React.ReactElement<SwipeableViewButtonProps>[],
|
|
115
|
-
[children]
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
const leftSwipeHandlers = React.useMemo(
|
|
119
|
-
() =>
|
|
120
|
-
React.Children.toArray(children).filter(
|
|
121
|
-
(child) =>
|
|
122
|
-
React.isValidElement(child) &&
|
|
123
|
-
instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
|
|
124
|
-
child.props.side === "left"
|
|
125
|
-
) as React.ReactElement<SwipeableViewSwipeHandlerProps>[],
|
|
126
|
-
[children]
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
const rightSwipeHandlers = React.useMemo(
|
|
130
|
-
() =>
|
|
131
|
-
React.Children.toArray(children).filter(
|
|
132
|
-
(child) =>
|
|
133
|
-
React.isValidElement(child) &&
|
|
134
|
-
instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
|
|
135
|
-
child.props.side === "right"
|
|
136
|
-
) as React.ReactElement<SwipeableViewSwipeHandlerProps>[],
|
|
137
|
-
[children]
|
|
138
|
-
);
|
|
139
|
-
|
|
140
|
-
const remainingChildren = React.useMemo(
|
|
141
|
-
() =>
|
|
142
|
-
React.Children.toArray(children).filter(
|
|
143
|
-
(child) =>
|
|
144
|
-
React.isValidElement(child) &&
|
|
145
|
-
!instanceOfSwipeableViewSwipeHandlerProps(child.props) &&
|
|
146
|
-
!instanceOfSwipeableViewButtonProps(child.props)
|
|
147
|
-
),
|
|
148
|
-
[children]
|
|
149
|
-
);
|
|
150
|
-
|
|
151
|
-
if (leftButtons.length > 2 || rightButtons.length > 2) {
|
|
152
|
-
throw Error("Cannot have more than 2 buttons per side");
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (leftSwipeHandlers.length > 1 || rightSwipeHandlers.length > 1) {
|
|
156
|
-
throw Error("Cannot have more than 1 swiper handler per side");
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
(leftButtons.length && leftSwipeHandlers.length) ||
|
|
161
|
-
(rightButtons.length && rightSwipeHandlers.length)
|
|
162
|
-
) {
|
|
163
|
-
throw Error("Cannot combine swiper handler and buttons on the same side");
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
//Renders a single button/item. Used for both buttons and swipe handler
|
|
167
|
-
const renderBehindItem = (
|
|
168
|
-
props: SwipeableViewSwipeHandlerProps | SwipeableViewButtonProps,
|
|
169
|
-
index: number
|
|
170
|
-
) => (
|
|
171
|
-
<Pressable
|
|
172
|
-
key={index.toString()}
|
|
173
|
-
onPress={(props as any).onPress}
|
|
174
|
-
style={[
|
|
175
|
-
styles.buttonContainer,
|
|
176
|
-
{ backgroundColor: props.backgroundColor || theme.colors.primary },
|
|
177
|
-
]}
|
|
178
|
-
>
|
|
179
|
-
{props.icon && (
|
|
180
|
-
<Icon
|
|
181
|
-
name={props.icon}
|
|
182
|
-
size={props.iconSize || 25}
|
|
183
|
-
color={props.color || theme.colors.surface}
|
|
184
|
-
/>
|
|
185
|
-
)}
|
|
186
|
-
<Text
|
|
187
|
-
style={[textStyles, { color: props.color || theme.colors.surface }]}
|
|
188
|
-
>
|
|
189
|
-
{props.title}
|
|
190
|
-
</Text>
|
|
191
|
-
</Pressable>
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
const isLeftSwipeHandler = !!leftSwipeHandlers.length;
|
|
195
|
-
const isRightSwipeHandler = !!rightSwipeHandlers.length;
|
|
196
|
-
|
|
197
|
-
const defaultLeftOpenValue = componentWidth ? componentWidth / 2 : 0;
|
|
198
|
-
const defaultRightOpenValue = componentWidth ? -componentWidth / 2 : 0;
|
|
199
|
-
|
|
200
|
-
return (
|
|
201
|
-
<View
|
|
202
|
-
onLayout={(event) => {
|
|
203
|
-
setComponentWidth(event.nativeEvent.layout.width);
|
|
204
|
-
}}
|
|
205
|
-
style={[styles.parentContainer, parentContainerStyles]}
|
|
206
|
-
>
|
|
207
|
-
{/*@ts-ignore*/}
|
|
208
|
-
<SwipeRow
|
|
209
|
-
leftOpenValue={
|
|
210
|
-
isLeftSwipeHandler ? 0 : leftOpenValue || defaultLeftOpenValue //If in swiping mode, don't keep open
|
|
211
|
-
}
|
|
212
|
-
rightOpenValue={
|
|
213
|
-
isRightSwipeHandler ? 0 : rightOpenValue || defaultRightOpenValue
|
|
214
|
-
}
|
|
215
|
-
leftActivationValue={
|
|
216
|
-
leftActivationValue || isLeftSwipeHandler
|
|
217
|
-
? defaultLeftOpenValue * (swipeActivationPercentage / 100) //When swipe passes activation percentage then it should be considered activated (call onSwipe)
|
|
218
|
-
: defaultLeftOpenValue
|
|
219
|
-
}
|
|
220
|
-
rightActivationValue={
|
|
221
|
-
rightActivationValue || isRightSwipeHandler
|
|
222
|
-
? defaultRightOpenValue * (swipeActivationPercentage / 100)
|
|
223
|
-
: defaultRightOpenValue
|
|
224
|
-
}
|
|
225
|
-
stopLeftSwipe={stopLeftSwipe || defaultLeftOpenValue}
|
|
226
|
-
stopRightSwipe={stopRightSwipe || defaultRightOpenValue}
|
|
227
|
-
onLeftAction={
|
|
228
|
-
isLeftSwipeHandler
|
|
229
|
-
? () => leftSwipeHandlers[0].props.onSwipe?.()
|
|
230
|
-
: undefined
|
|
231
|
-
}
|
|
232
|
-
onRightAction={
|
|
233
|
-
isRightSwipeHandler
|
|
234
|
-
? () => rightSwipeHandlers[0].props.onSwipe?.()
|
|
235
|
-
: undefined
|
|
236
|
-
}
|
|
237
|
-
closeOnRowPress={closeOnPress}
|
|
238
|
-
friction={friction}
|
|
239
|
-
{...rest}
|
|
240
|
-
>
|
|
241
|
-
<View style={styles.behindContainer}>
|
|
242
|
-
<View style={styles.behindContainerItem}>
|
|
243
|
-
{(isLeftSwipeHandler ? leftSwipeHandlers : leftButtons).map(
|
|
244
|
-
(item, index) => renderBehindItem(item.props, index)
|
|
245
|
-
)}
|
|
246
|
-
</View>
|
|
247
|
-
<View style={styles.behindContainerItem}>
|
|
248
|
-
{(isRightSwipeHandler ? rightSwipeHandlers : rightButtons).map(
|
|
249
|
-
(item, index) => renderBehindItem(item.props, index)
|
|
250
|
-
)}
|
|
251
|
-
</View>
|
|
252
|
-
</View>
|
|
253
|
-
<View
|
|
254
|
-
style={[
|
|
255
|
-
styles.surfaceContainer,
|
|
256
|
-
{
|
|
257
|
-
backgroundColor: theme.colors.background,
|
|
258
|
-
},
|
|
259
|
-
surfaceContainerStyles,
|
|
260
|
-
]}
|
|
261
|
-
>
|
|
262
|
-
{remainingChildren}
|
|
263
|
-
</View>
|
|
264
|
-
</SwipeRow>
|
|
265
|
-
</View>
|
|
266
|
-
);
|
|
267
|
-
};
|
|
268
|
-
|
|
269
|
-
const styles = StyleSheet.create({
|
|
270
|
-
parentContainer: {
|
|
271
|
-
overflow: "hidden",
|
|
272
|
-
minHeight: 50,
|
|
273
|
-
},
|
|
274
|
-
behindContainer: {
|
|
275
|
-
flex: 1,
|
|
276
|
-
width: "100%",
|
|
277
|
-
height: "100%",
|
|
278
|
-
flexDirection: "row",
|
|
279
|
-
},
|
|
280
|
-
behindContainerItem: {
|
|
281
|
-
flex: 1,
|
|
282
|
-
flexDirection: "row",
|
|
283
|
-
},
|
|
284
|
-
buttonContainer: {
|
|
285
|
-
flex: 1,
|
|
286
|
-
alignItems: "center",
|
|
287
|
-
justifyContent: "center",
|
|
288
|
-
},
|
|
289
|
-
surfaceContainer: {
|
|
290
|
-
flexDirection: "row",
|
|
291
|
-
width: "100%",
|
|
292
|
-
height: "100%",
|
|
293
|
-
padding: 10,
|
|
294
|
-
alignItems: "center",
|
|
295
|
-
overflow: "hidden",
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
export default withTheme(SwipeableView);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export interface SwipeableViewButtonProps {
|
|
4
|
-
title: string;
|
|
5
|
-
side: "left" | "right";
|
|
6
|
-
onPress: (() => void) | null; //Not optional in order to always exist in props
|
|
7
|
-
icon?: string;
|
|
8
|
-
iconSize?: number;
|
|
9
|
-
backgroundColor?: string;
|
|
10
|
-
color?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//Renders nothing, acts as a wrapper be used by SwipeableView
|
|
14
|
-
const SwipeableViewButton: React.FC<SwipeableViewButtonProps> = () => {
|
|
15
|
-
return null;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export default SwipeableViewButton;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export interface SwipeableViewSwipeHandlerProps {
|
|
4
|
-
title: string;
|
|
5
|
-
side: "left" | "right";
|
|
6
|
-
onSwipe: (() => void) | null; //Not optional in order to always exist in props
|
|
7
|
-
icon?: string;
|
|
8
|
-
iconSize?: number;
|
|
9
|
-
backgroundColor?: string;
|
|
10
|
-
color?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
//Renders nothing, acts as a wrapper to be used by SwipeableView
|
|
14
|
-
const SwipeableViewSwipeHandler: React.FC<
|
|
15
|
-
SwipeableViewSwipeHandlerProps
|
|
16
|
-
> = () => {
|
|
17
|
-
return null;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default SwipeableViewSwipeHandler;
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { COMPONENT_TYPES, createBoolProp, CONTAINER_COMPONENT_STYLES_SECTIONS, createStaticNumberProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
|
-
const SHARED_SEED_DATA = {
|
|
3
|
-
category: COMPONENT_TYPES.testing /*.layout*/,
|
|
4
|
-
packageName: "native-base",
|
|
5
|
-
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
6
|
-
};
|
|
7
|
-
const CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX = CONTAINER_COMPONENT_STYLES_SECTIONS.filter((item) => item !== StylesPanelSections.LayoutFlexItems &&
|
|
8
|
-
item !== StylesPanelSections.LayoutContent);
|
|
9
|
-
export const SEED_DATA = [
|
|
10
|
-
{
|
|
11
|
-
name: "Aspect Ratio",
|
|
12
|
-
tag: "AspectRatio",
|
|
13
|
-
description: "Controls the size of the undefined dimension of a node or child component using an aspect ratio",
|
|
14
|
-
...SHARED_SEED_DATA,
|
|
15
|
-
props: {
|
|
16
|
-
ratio: createStaticNumberProp({
|
|
17
|
-
label: "Ratio",
|
|
18
|
-
description: "The aspect ratio of the container in decimal format (ex: 3/4 -> 1.33)",
|
|
19
|
-
defaultValue: 1.33,
|
|
20
|
-
}),
|
|
21
|
-
},
|
|
22
|
-
stylesPanelSections: [
|
|
23
|
-
StylesPanelSections.Background,
|
|
24
|
-
StylesPanelSections.Size,
|
|
25
|
-
StylesPanelSections.Margins,
|
|
26
|
-
StylesPanelSections.Position,
|
|
27
|
-
StylesPanelSections.Borders,
|
|
28
|
-
StylesPanelSections.Effects,
|
|
29
|
-
],
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name: "Box",
|
|
33
|
-
tag: "Box",
|
|
34
|
-
description: "This is a generic component for low level layout needs. It is similar to a div in HTML",
|
|
35
|
-
...SHARED_SEED_DATA,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
name: "Center",
|
|
39
|
-
tag: "Center",
|
|
40
|
-
description: "Center aligns its contents to the center within itself",
|
|
41
|
-
...SHARED_SEED_DATA,
|
|
42
|
-
stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "Circle",
|
|
46
|
-
tag: "Circle",
|
|
47
|
-
description: "Center aligns its contents to the center within itself with a round border radius",
|
|
48
|
-
...SHARED_SEED_DATA,
|
|
49
|
-
stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
name: "Column",
|
|
53
|
-
tag: "Column",
|
|
54
|
-
description: "Column aligns items vertically",
|
|
55
|
-
layout: {
|
|
56
|
-
flexDirection: "column",
|
|
57
|
-
},
|
|
58
|
-
...SHARED_SEED_DATA,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "Row",
|
|
62
|
-
tag: "Row",
|
|
63
|
-
description: "Column aligns items horizontally",
|
|
64
|
-
layout: {
|
|
65
|
-
flexDirection: "row",
|
|
66
|
-
},
|
|
67
|
-
...SHARED_SEED_DATA,
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
name: "Spacer",
|
|
71
|
-
tag: "Spacer",
|
|
72
|
-
description: "An adjustable, empty space that can be used to tune the spacing between child elements within Flex",
|
|
73
|
-
layout: {
|
|
74
|
-
flex: 1,
|
|
75
|
-
},
|
|
76
|
-
...SHARED_SEED_DATA,
|
|
77
|
-
stylesPanelSections: [
|
|
78
|
-
StylesPanelSections.LayoutSelectedItem,
|
|
79
|
-
StylesPanelSections.Background,
|
|
80
|
-
StylesPanelSections.Margins,
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: "Stack",
|
|
85
|
-
tag: "Stack",
|
|
86
|
-
description: "Stack aligns items vertically or horizontally based on the direction prop",
|
|
87
|
-
...SHARED_SEED_DATA,
|
|
88
|
-
props: {
|
|
89
|
-
isDisabled: createBoolProp({
|
|
90
|
-
label: "Disabled",
|
|
91
|
-
description: "If true, the Stack will be disabled",
|
|
92
|
-
}),
|
|
93
|
-
isInvalid: createBoolProp({
|
|
94
|
-
label: "Invalid",
|
|
95
|
-
description: "If true, the Stack will be invalid",
|
|
96
|
-
}),
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: "ZStack",
|
|
101
|
-
tag: "ZStack",
|
|
102
|
-
description: "ZStack aligns items to the z-axis",
|
|
103
|
-
...SHARED_SEED_DATA,
|
|
104
|
-
props: {
|
|
105
|
-
reversed: createBoolProp({
|
|
106
|
-
label: "Reversed",
|
|
107
|
-
description: "Determines whether to reverse the direction of items",
|
|
108
|
-
}),
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
];
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
COMPONENT_TYPES,
|
|
3
|
-
createBoolProp,
|
|
4
|
-
CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
5
|
-
createStaticNumberProp,
|
|
6
|
-
StylesPanelSections,
|
|
7
|
-
} from "@draftbit/types";
|
|
8
|
-
|
|
9
|
-
const SHARED_SEED_DATA = {
|
|
10
|
-
category: COMPONENT_TYPES.testing /*.layout*/,
|
|
11
|
-
packageName: "native-base",
|
|
12
|
-
stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX =
|
|
16
|
-
CONTAINER_COMPONENT_STYLES_SECTIONS.filter(
|
|
17
|
-
(item) =>
|
|
18
|
-
item !== StylesPanelSections.LayoutFlexItems &&
|
|
19
|
-
item !== StylesPanelSections.LayoutContent
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export const SEED_DATA = [
|
|
23
|
-
{
|
|
24
|
-
name: "Aspect Ratio",
|
|
25
|
-
tag: "AspectRatio",
|
|
26
|
-
description:
|
|
27
|
-
"Controls the size of the undefined dimension of a node or child component using an aspect ratio",
|
|
28
|
-
...SHARED_SEED_DATA,
|
|
29
|
-
props: {
|
|
30
|
-
ratio: createStaticNumberProp({
|
|
31
|
-
label: "Ratio",
|
|
32
|
-
description:
|
|
33
|
-
"The aspect ratio of the container in decimal format (ex: 3/4 -> 1.33)",
|
|
34
|
-
defaultValue: 1.33,
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
37
|
-
stylesPanelSections: [
|
|
38
|
-
StylesPanelSections.Background,
|
|
39
|
-
StylesPanelSections.Size,
|
|
40
|
-
StylesPanelSections.Margins,
|
|
41
|
-
StylesPanelSections.Position,
|
|
42
|
-
StylesPanelSections.Borders,
|
|
43
|
-
StylesPanelSections.Effects,
|
|
44
|
-
],
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name: "Box",
|
|
48
|
-
tag: "Box",
|
|
49
|
-
description:
|
|
50
|
-
"This is a generic component for low level layout needs. It is similar to a div in HTML",
|
|
51
|
-
...SHARED_SEED_DATA,
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
name: "Center",
|
|
55
|
-
tag: "Center",
|
|
56
|
-
description: "Center aligns its contents to the center within itself",
|
|
57
|
-
...SHARED_SEED_DATA,
|
|
58
|
-
stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: "Circle",
|
|
62
|
-
tag: "Circle",
|
|
63
|
-
description:
|
|
64
|
-
"Center aligns its contents to the center within itself with a round border radius",
|
|
65
|
-
...SHARED_SEED_DATA,
|
|
66
|
-
stylesPanelSections: CONTAINER_COMPONENT_STYLES_WITHOUT_FLEX,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "Column",
|
|
70
|
-
tag: "Column",
|
|
71
|
-
description: "Column aligns items vertically",
|
|
72
|
-
layout: {
|
|
73
|
-
flexDirection: "column",
|
|
74
|
-
},
|
|
75
|
-
...SHARED_SEED_DATA,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
name: "Row",
|
|
79
|
-
tag: "Row",
|
|
80
|
-
description: "Column aligns items horizontally",
|
|
81
|
-
layout: {
|
|
82
|
-
flexDirection: "row",
|
|
83
|
-
},
|
|
84
|
-
...SHARED_SEED_DATA,
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "Spacer",
|
|
88
|
-
tag: "Spacer",
|
|
89
|
-
description:
|
|
90
|
-
"An adjustable, empty space that can be used to tune the spacing between child elements within Flex",
|
|
91
|
-
layout: {
|
|
92
|
-
flex: 1,
|
|
93
|
-
},
|
|
94
|
-
...SHARED_SEED_DATA,
|
|
95
|
-
stylesPanelSections: [
|
|
96
|
-
StylesPanelSections.LayoutSelectedItem,
|
|
97
|
-
StylesPanelSections.Background,
|
|
98
|
-
StylesPanelSections.Margins,
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
name: "Stack",
|
|
103
|
-
tag: "Stack",
|
|
104
|
-
description:
|
|
105
|
-
"Stack aligns items vertically or horizontally based on the direction prop",
|
|
106
|
-
...SHARED_SEED_DATA,
|
|
107
|
-
props: {
|
|
108
|
-
isDisabled: createBoolProp({
|
|
109
|
-
label: "Disabled",
|
|
110
|
-
description: "If true, the Stack will be disabled",
|
|
111
|
-
}),
|
|
112
|
-
isInvalid: createBoolProp({
|
|
113
|
-
label: "Invalid",
|
|
114
|
-
description: "If true, the Stack will be invalid",
|
|
115
|
-
}),
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
{
|
|
119
|
-
name: "ZStack",
|
|
120
|
-
tag: "ZStack",
|
|
121
|
-
description: "ZStack aligns items to the z-axis",
|
|
122
|
-
...SHARED_SEED_DATA,
|
|
123
|
-
props: {
|
|
124
|
-
reversed: createBoolProp({
|
|
125
|
-
label: "Reversed",
|
|
126
|
-
description: "Determines whether to reverse the direction of items",
|
|
127
|
-
}),
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
];
|