@draftbit/core 46.2.4-17908.5 → 46.2.4-27c60f.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/lib/commonjs/components/Config.js +1 -1
- package/lib/commonjs/components/{SVG.js → Svg.js} +6 -7
- package/lib/commonjs/index.js +7 -15
- package/lib/commonjs/mappings/{SVG.js → Svg.js} +2 -0
- package/lib/module/components/Button.js +32 -11
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +24 -6
- package/lib/module/components/Checkbox/context.js +1 -1
- package/lib/module/components/Config.js +1 -1
- package/lib/module/components/Picker/PickerComponent.android.js +23 -5
- package/lib/module/components/Portal/PortalHost.js +26 -15
- package/lib/module/components/ProgressBar.js +23 -7
- package/lib/module/components/StepIndicator.js +33 -16
- package/lib/module/components/{SVG.js → Svg.js} +6 -7
- package/lib/module/components/TextField.js +62 -30
- package/lib/module/components/ToggleButton.js +17 -3
- package/lib/module/components/Touchable.js +18 -2
- package/lib/module/index.js +2 -3
- package/lib/module/mappings/Svg.js +16 -0
- package/lib/typescript/src/components/Svg.d.ts +8 -0
- package/lib/typescript/src/index.d.ts +1 -2
- package/lib/typescript/src/mappings/{SVG.d.ts → Svg.d.ts} +2 -0
- package/package.json +4 -6
- package/src/components/Config.js +1 -1
- package/src/components/Config.ts +1 -1
- package/src/components/{SVG.js → Svg.js} +5 -6
- package/src/components/{SVG.tsx → Svg.tsx} +9 -9
- package/src/index.js +1 -2
- package/src/index.tsx +1 -2
- package/src/mappings/Svg.js +21 -0
- package/src/mappings/Svg.ts +26 -0
- package/lib/commonjs/components/Youtube.js +0 -73
- package/lib/commonjs/mappings/Youtube.js +0 -42
- package/lib/module/components/Youtube.js +0 -59
- package/lib/module/mappings/SVG.js +0 -14
- package/lib/module/mappings/Youtube.js +0 -33
- package/lib/typescript/src/components/SVG.d.ts +0 -8
- package/lib/typescript/src/components/Youtube.d.ts +0 -44
- package/lib/typescript/src/mappings/Youtube.d.ts +0 -36
- package/src/components/Youtube.js +0 -38
- package/src/components/Youtube.tsx +0 -66
- package/src/mappings/SVG.js +0 -14
- package/src/mappings/SVG.ts +0 -15
- package/src/mappings/Youtube.js +0 -33
- package/src/mappings/Youtube.ts +0 -39
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
4
|
-
|
|
5
1
|
import * as React from "react";
|
|
6
2
|
import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
|
|
7
3
|
import { withTheme } from "../theming";
|
|
@@ -14,8 +10,7 @@ const ICON_SIZE = 24;
|
|
|
14
10
|
class TextField extends React.Component {
|
|
15
11
|
constructor() {
|
|
16
12
|
super(...arguments);
|
|
17
|
-
|
|
18
|
-
_defineProperty(this, "state", {
|
|
13
|
+
this.state = {
|
|
19
14
|
labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
|
|
20
15
|
focused: false,
|
|
21
16
|
placeholder: this.props.error ? this.props.placeholder : "",
|
|
@@ -23,36 +18,35 @@ class TextField extends React.Component {
|
|
|
23
18
|
measured: false,
|
|
24
19
|
width: 0
|
|
25
20
|
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
_defineProperty(this, "_timer", setTimeout(() => {}, 0));
|
|
21
|
+
};
|
|
22
|
+
this._timer = setTimeout(() => {}, 0);
|
|
29
23
|
|
|
30
|
-
|
|
24
|
+
this._showPlaceholder = () => {
|
|
31
25
|
clearTimeout(this._timer); // Set the placeholder in a delay to offset the label animation
|
|
32
26
|
// If we show it immediately, they'll overlap and look ugly
|
|
33
27
|
|
|
34
28
|
this._timer = setTimeout(() => this.setState({
|
|
35
29
|
placeholder: this.props.placeholder
|
|
36
30
|
}), 50);
|
|
37
|
-
}
|
|
31
|
+
};
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
this._hidePlaceholder = () => this.setState({
|
|
40
34
|
placeholder: ""
|
|
41
|
-
})
|
|
35
|
+
});
|
|
42
36
|
|
|
43
|
-
|
|
37
|
+
this._restoreLabel = () => Animated.timing(this.state.labeled, {
|
|
44
38
|
toValue: 1,
|
|
45
39
|
duration: FOCUS_ANIMATION_DURATION,
|
|
46
40
|
useNativeDriver: true
|
|
47
|
-
}).start()
|
|
41
|
+
}).start();
|
|
48
42
|
|
|
49
|
-
|
|
43
|
+
this._minmizeLabel = () => Animated.timing(this.state.labeled, {
|
|
50
44
|
toValue: 0,
|
|
51
45
|
duration: BLUR_ANIMATION_DURATION,
|
|
52
46
|
useNativeDriver: true
|
|
53
|
-
}).start()
|
|
47
|
+
}).start();
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+
this._handleFocus = () => {
|
|
56
50
|
if (this.props.disabled) {
|
|
57
51
|
return;
|
|
58
52
|
}
|
|
@@ -60,9 +54,9 @@ class TextField extends React.Component {
|
|
|
60
54
|
this.setState({
|
|
61
55
|
focused: true
|
|
62
56
|
});
|
|
63
|
-
}
|
|
57
|
+
};
|
|
64
58
|
|
|
65
|
-
|
|
59
|
+
this._handleBlur = () => {
|
|
66
60
|
if (this.props.disabled) {
|
|
67
61
|
return;
|
|
68
62
|
}
|
|
@@ -70,9 +64,9 @@ class TextField extends React.Component {
|
|
|
70
64
|
this.setState({
|
|
71
65
|
focused: false
|
|
72
66
|
});
|
|
73
|
-
}
|
|
67
|
+
};
|
|
74
68
|
|
|
75
|
-
|
|
69
|
+
this._handleChangeText = value => {
|
|
76
70
|
if (this.props.disabled) {
|
|
77
71
|
return;
|
|
78
72
|
}
|
|
@@ -88,9 +82,9 @@ class TextField extends React.Component {
|
|
|
88
82
|
});
|
|
89
83
|
this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
|
|
90
84
|
}
|
|
91
|
-
}
|
|
85
|
+
};
|
|
92
86
|
|
|
93
|
-
|
|
87
|
+
this._root = undefined;
|
|
94
88
|
}
|
|
95
89
|
|
|
96
90
|
static getDerivedStateFromProps(nextProps, prevState) {
|
|
@@ -141,10 +135,11 @@ class TextField extends React.Component {
|
|
|
141
135
|
focused: !prevState.focused
|
|
142
136
|
}));
|
|
143
137
|
}
|
|
144
|
-
|
|
145
138
|
/**
|
|
146
139
|
* @internal
|
|
147
140
|
*/
|
|
141
|
+
|
|
142
|
+
|
|
148
143
|
setNativeProps(args) {
|
|
149
144
|
return this._root && this._root.setNativeProps(args);
|
|
150
145
|
}
|
|
@@ -187,7 +182,8 @@ class TextField extends React.Component {
|
|
|
187
182
|
roundness,
|
|
188
183
|
disabledOpacity
|
|
189
184
|
},
|
|
190
|
-
render = props => /*#__PURE__*/React.createElement(NativeTextInput, props
|
|
185
|
+
render = props => /*#__PURE__*/React.createElement(NativeTextInput, { ...props
|
|
186
|
+
}),
|
|
191
187
|
...rest
|
|
192
188
|
} = this.props;
|
|
193
189
|
const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
|
|
@@ -339,9 +335,9 @@ class TextField extends React.Component {
|
|
|
339
335
|
} = StyleSheet.flatten(style || {});
|
|
340
336
|
return /*#__PURE__*/React.createElement(View, {
|
|
341
337
|
style: [styles.container, styleProp]
|
|
342
|
-
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon,
|
|
338
|
+
}, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
|
|
343
339
|
style: leftIconStyle
|
|
344
|
-
})
|
|
340
|
+
}) : null, /*#__PURE__*/React.createElement(View, {
|
|
345
341
|
style: applyStyles([containerStyle], {
|
|
346
342
|
height: style === null || style === void 0 ? void 0 : style.height,
|
|
347
343
|
backgroundColor: bgColor,
|
|
@@ -408,9 +404,9 @@ class TextField extends React.Component {
|
|
|
408
404
|
style: {
|
|
409
405
|
justifyContent: type === "solid" ? "center" : undefined
|
|
410
406
|
}
|
|
411
|
-
}, /*#__PURE__*/React.createElement(Icon,
|
|
407
|
+
}, /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
|
|
412
408
|
style: leftIconStyle
|
|
413
|
-
}))
|
|
409
|
+
})) : null, render({
|
|
414
410
|
ref: c => {
|
|
415
411
|
this._root = c;
|
|
416
412
|
},
|
|
@@ -447,6 +443,42 @@ class TextField extends React.Component {
|
|
|
447
443
|
|
|
448
444
|
}
|
|
449
445
|
|
|
446
|
+
export default withTheme(TextField);
|
|
447
|
+
const styles = StyleSheet.create({
|
|
448
|
+
container: {
|
|
449
|
+
alignSelf: "stretch"
|
|
450
|
+
},
|
|
451
|
+
placeholder: {
|
|
452
|
+
position: "absolute",
|
|
453
|
+
left: 0
|
|
454
|
+
},
|
|
455
|
+
underline: {
|
|
456
|
+
position: "absolute",
|
|
457
|
+
left: 0,
|
|
458
|
+
right: 0,
|
|
459
|
+
bottom: 0,
|
|
460
|
+
height: 2
|
|
461
|
+
},
|
|
462
|
+
input: {
|
|
463
|
+
flexGrow: 1,
|
|
464
|
+
justifyContent: "center",
|
|
465
|
+
textAlignVertical: "center",
|
|
466
|
+
margin: 0,
|
|
467
|
+
textAlign: I18nManager.isRTL ? "right" : "left"
|
|
468
|
+
}
|
|
469
|
+
}); "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
|
|
470
|
+
}
|
|
471
|
+
}) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
|
|
472
|
+
style: [{
|
|
473
|
+
color: error ? colors.error : colors.light,
|
|
474
|
+
marginTop: 8,
|
|
475
|
+
marginLeft: assistiveTextLeftMargin
|
|
476
|
+
}]
|
|
477
|
+
}, assistiveText) : null);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
}
|
|
481
|
+
|
|
450
482
|
export default withTheme(TextField);
|
|
451
483
|
const styles = StyleSheet.create({
|
|
452
484
|
container: {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import * as React from "react";
|
|
4
2
|
import { withTheme } from "../theming";
|
|
5
3
|
import { StyleSheet } from "react-native";
|
|
@@ -42,13 +40,29 @@ const ToggleButton = _ref => {
|
|
|
42
40
|
onPress(!internalValue);
|
|
43
41
|
};
|
|
44
42
|
|
|
45
|
-
return /*#__PURE__*/React.createElement(IconButton,
|
|
43
|
+
return /*#__PURE__*/React.createElement(IconButton, {
|
|
46
44
|
Icon: Icon,
|
|
47
45
|
icon: icon,
|
|
48
46
|
size: iconSize,
|
|
49
47
|
color: internalValue ? colors[color] : colors[colorSecondary],
|
|
50
48
|
onPress: handlePress,
|
|
51
49
|
disabled: disabled,
|
|
50
|
+
style: [styles.mainContainer, {
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
|
|
54
|
+
borderColor: colors[borderColor]
|
|
55
|
+
}, style],
|
|
56
|
+
...rest
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
mainContainer: {
|
|
62
|
+
borderWidth: 1
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
export default withTheme(ToggleButton);: disabled,
|
|
52
66
|
style: [styles.mainContainer, {
|
|
53
67
|
width,
|
|
54
68
|
height,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
-
|
|
3
1
|
import React from "react";
|
|
4
2
|
import { Pressable } from "react-native";
|
|
5
3
|
export default function Touchable(_ref) {
|
|
@@ -10,6 +8,24 @@ export default function Touchable(_ref) {
|
|
|
10
8
|
style,
|
|
11
9
|
...props
|
|
12
10
|
} = _ref;
|
|
11
|
+
return /*#__PURE__*/React.createElement(Pressable, {
|
|
12
|
+
onPress: onPress,
|
|
13
|
+
disabled: disabled,
|
|
14
|
+
hitSlop: 8,
|
|
15
|
+
style: _ref2 => {
|
|
16
|
+
let {
|
|
17
|
+
pressed
|
|
18
|
+
} = _ref2;
|
|
19
|
+
return [{
|
|
20
|
+
opacity: pressed || disabled ? 0.75 : 1
|
|
21
|
+
}, style];
|
|
22
|
+
},
|
|
23
|
+
...props
|
|
24
|
+
}, children);
|
|
25
|
+
}s,
|
|
26
|
+
style,
|
|
27
|
+
...props
|
|
28
|
+
} = _ref;
|
|
13
29
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
14
30
|
onPress: onPress,
|
|
15
31
|
disabled: disabled,
|
package/lib/module/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export { default as FAB } from "./components/FAB";
|
|
|
17
17
|
export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
|
|
18
18
|
export { default as IconButton } from "./components/IconButton";
|
|
19
19
|
export { default as Image } from "./components/Image";
|
|
20
|
-
export { default as
|
|
20
|
+
export { default as Svg } from "./components/Svg";
|
|
21
21
|
export { default as NumberInput } from "./components/NumberInput";
|
|
22
22
|
export { default as ScreenContainer } from "./components/ScreenContainer";
|
|
23
23
|
export { default as StarRating } from "./components/StarRating";
|
|
@@ -50,5 +50,4 @@ export { default as RowHeadlineImageCaption } from "./components/RowHeadlineImag
|
|
|
50
50
|
export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIcon";
|
|
51
51
|
export { default as Slider } from "./components/Slider";
|
|
52
52
|
export { default as Stepper } from "./components/Stepper";
|
|
53
|
-
export { useAuthState } from "./components/useAuthState";
|
|
54
|
-
export { default as Youtube } from "./components/Youtube"; // a comment to fix sourcemap comment issue
|
|
53
|
+
export { useAuthState } from "./components/useAuthState"; // a comment to fix sourcemap comment issue
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createSvgProp, StylesPanelSections } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "SVG",
|
|
4
|
+
tag: "SVG",
|
|
5
|
+
description: "An SVG component",
|
|
6
|
+
packageName: "@draftbit/core",
|
|
7
|
+
category: COMPONENT_TYPES.media,
|
|
8
|
+
layout: {
|
|
9
|
+
width: 100,
|
|
10
|
+
height: 100
|
|
11
|
+
},
|
|
12
|
+
stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Effects],
|
|
13
|
+
props: {
|
|
14
|
+
source: createSvgProp()
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { StyleProp, ImageStyle } from "react-native";
|
|
3
|
+
declare type SvgComponentProps = {
|
|
4
|
+
source: string;
|
|
5
|
+
style?: StyleProp<ImageStyle>;
|
|
6
|
+
};
|
|
7
|
+
declare const Svg: React.FC<React.PropsWithChildren<SvgComponentProps>>;
|
|
8
|
+
export default Svg;
|
|
@@ -17,7 +17,7 @@ export { default as FAB } from "./components/FAB";
|
|
|
17
17
|
export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
|
|
18
18
|
export { default as IconButton } from "./components/IconButton";
|
|
19
19
|
export { default as Image } from "./components/Image";
|
|
20
|
-
export { default as
|
|
20
|
+
export { default as Svg } from "./components/Svg";
|
|
21
21
|
export { default as NumberInput } from "./components/NumberInput";
|
|
22
22
|
export { default as ScreenContainer } from "./components/ScreenContainer";
|
|
23
23
|
export { default as StarRating } from "./components/StarRating";
|
|
@@ -49,4 +49,3 @@ export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIc
|
|
|
49
49
|
export { default as Slider } from "./components/Slider";
|
|
50
50
|
export { default as Stepper } from "./components/Stepper";
|
|
51
51
|
export { useAuthState } from "./components/useAuthState";
|
|
52
|
-
export { default as Youtube } from "./components/Youtube";
|
|
@@ -2,11 +2,13 @@ export declare const SEED_DATA: {
|
|
|
2
2
|
name: string;
|
|
3
3
|
tag: string;
|
|
4
4
|
description: string;
|
|
5
|
+
packageName: string;
|
|
5
6
|
category: string;
|
|
6
7
|
layout: {
|
|
7
8
|
width: number;
|
|
8
9
|
height: number;
|
|
9
10
|
};
|
|
11
|
+
stylesPanelSections: string[];
|
|
10
12
|
props: {
|
|
11
13
|
source: {
|
|
12
14
|
label: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@draftbit/core",
|
|
3
|
-
"version": "46.2.4-
|
|
3
|
+
"version": "46.2.4-27c60f.5+27c60f05",
|
|
4
4
|
"description": "Core (non-native) Components",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@date-io/date-fns": "^1.3.13",
|
|
43
43
|
"@draftbit/react-theme-provider": "^2.1.1",
|
|
44
|
-
"@draftbit/types": "^46.2.4",
|
|
44
|
+
"@draftbit/types": "^46.2.4-27c60f.5+27c60f05",
|
|
45
45
|
"@material-ui/core": "^4.11.0",
|
|
46
46
|
"@material-ui/pickers": "^3.2.10",
|
|
47
47
|
"@react-native-community/slider": "4.2.3",
|
|
@@ -55,9 +55,7 @@
|
|
|
55
55
|
"react-native-modal-datetime-picker": "^13.0.0",
|
|
56
56
|
"react-native-svg": "^12.3.0",
|
|
57
57
|
"react-native-typography": "^1.4.1",
|
|
58
|
-
"react-native-web-swiper": "^2.2.3"
|
|
59
|
-
"react-native-web-webview": "^1.0.2",
|
|
60
|
-
"react-native-youtube-iframe": "^2.2.2"
|
|
58
|
+
"react-native-web-swiper": "^2.2.3"
|
|
61
59
|
},
|
|
62
60
|
"devDependencies": {
|
|
63
61
|
"@types/color": "^3.0.1",
|
|
@@ -82,5 +80,5 @@
|
|
|
82
80
|
]
|
|
83
81
|
]
|
|
84
82
|
},
|
|
85
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "27c60f058cdf2ad225d81be3b0c7ddc10b2e8f04"
|
|
86
84
|
}
|
package/src/components/Config.js
CHANGED
|
@@ -42,7 +42,7 @@ export default {
|
|
|
42
42
|
cardIconElevation: 1,
|
|
43
43
|
placeholderImageURL: "https://static.draftbit.com/images/placeholder-image" + getExtension(),
|
|
44
44
|
getPlaceholderImageUrl: (size) => buildImageUrl({ width: size.width, height: size.height }, "image-placeholder_1"),
|
|
45
|
-
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-
|
|
45
|
+
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-image.svg",
|
|
46
46
|
squareImageUrl: buildImageUrl({ width: 100, height: 100 }, "Avatar"),
|
|
47
47
|
FABSize: 40,
|
|
48
48
|
FABBorderRadius: 20,
|
package/src/components/Config.ts
CHANGED
|
@@ -60,7 +60,7 @@ export default {
|
|
|
60
60
|
{ width: size.width, height: size.height },
|
|
61
61
|
"image-placeholder_1"
|
|
62
62
|
),
|
|
63
|
-
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-
|
|
63
|
+
placeholderSvgURL: "https://static.draftbit.com/images/placeholder-image.svg",
|
|
64
64
|
squareImageUrl: buildImageUrl({ width: 100, height: 100 }, "Avatar"),
|
|
65
65
|
FABSize: 40,
|
|
66
66
|
FABBorderRadius: 20,
|
|
@@ -2,13 +2,12 @@ import * as React from "react";
|
|
|
2
2
|
import { View, Platform, Image } from "react-native";
|
|
3
3
|
import { SvgUri } from "react-native-svg";
|
|
4
4
|
import Config from "./Config";
|
|
5
|
-
const
|
|
6
|
-
let svgSource = source === null || source === undefined ? Config.placeholderSvgURL : source;
|
|
5
|
+
const Svg = ({ source = Config.placeholderSvgURL, style, }) => {
|
|
7
6
|
return (React.createElement(React.Fragment, null,
|
|
8
7
|
Platform.OS === "ios" && (React.createElement(View, { style: style },
|
|
9
|
-
React.createElement(SvgUri, { width: "100%", height: "100%", uri:
|
|
8
|
+
React.createElement(SvgUri, { width: "100%", height: "100%", uri: source }))),
|
|
10
9
|
Platform.OS === "android" && (React.createElement(View, { style: style },
|
|
11
|
-
React.createElement(SvgUri, { width: "100%", height: "100%", uri:
|
|
12
|
-
Platform.OS === "web" && (React.createElement(Image, { style: style, source: { uri:
|
|
10
|
+
React.createElement(SvgUri, { width: "100%", height: "100%", uri: source }))),
|
|
11
|
+
Platform.OS === "web" && (React.createElement(Image, { style: style, source: { uri: source } }))));
|
|
13
12
|
};
|
|
14
|
-
export default
|
|
13
|
+
export default Svg;
|
|
@@ -4,32 +4,32 @@ import { SvgUri } from "react-native-svg";
|
|
|
4
4
|
|
|
5
5
|
import Config from "./Config";
|
|
6
6
|
|
|
7
|
-
type
|
|
7
|
+
type SvgComponentProps = {
|
|
8
8
|
source: string;
|
|
9
9
|
style?: StyleProp<ImageStyle>;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const Svg: React.FC<React.PropsWithChildren<SvgComponentProps>> = ({
|
|
13
|
+
source = Config.placeholderSvgURL,
|
|
14
|
+
style,
|
|
15
|
+
}) => {
|
|
16
16
|
return (
|
|
17
17
|
<>
|
|
18
18
|
{Platform.OS === "ios" && (
|
|
19
19
|
<View style={style}>
|
|
20
|
-
<SvgUri width="100%" height="100%" uri={
|
|
20
|
+
<SvgUri width="100%" height="100%" uri={source} />
|
|
21
21
|
</View>
|
|
22
22
|
)}
|
|
23
23
|
{Platform.OS === "android" && (
|
|
24
24
|
<View style={style}>
|
|
25
|
-
<SvgUri width="100%" height="100%" uri={
|
|
25
|
+
<SvgUri width="100%" height="100%" uri={source} />
|
|
26
26
|
</View>
|
|
27
27
|
)}
|
|
28
28
|
{Platform.OS === "web" && (
|
|
29
|
-
<Image style={style} source={{ uri:
|
|
29
|
+
<Image style={style} source={{ uri: source }} />
|
|
30
30
|
)}
|
|
31
31
|
</>
|
|
32
32
|
);
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
export default
|
|
35
|
+
export default Svg;
|
package/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@ export { default as FAB } from "./components/FAB";
|
|
|
17
17
|
export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
|
|
18
18
|
export { default as IconButton } from "./components/IconButton";
|
|
19
19
|
export { default as Image } from "./components/Image";
|
|
20
|
-
export { default as
|
|
20
|
+
export { default as Svg } from "./components/Svg";
|
|
21
21
|
export { default as NumberInput } from "./components/NumberInput";
|
|
22
22
|
export { default as ScreenContainer } from "./components/ScreenContainer";
|
|
23
23
|
export { default as StarRating } from "./components/StarRating";
|
|
@@ -50,5 +50,4 @@ export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIc
|
|
|
50
50
|
export { default as Slider } from "./components/Slider";
|
|
51
51
|
export { default as Stepper } from "./components/Stepper";
|
|
52
52
|
export { useAuthState } from "./components/useAuthState";
|
|
53
|
-
export { default as Youtube } from "./components/Youtube";
|
|
54
53
|
// a comment to fix sourcemap comment issue
|
package/src/index.tsx
CHANGED
|
@@ -18,7 +18,7 @@ export { default as FAB } from "./components/FAB";
|
|
|
18
18
|
export { default as FieldSearchBarFull } from "./components/FieldSearchBarFull";
|
|
19
19
|
export { default as IconButton } from "./components/IconButton";
|
|
20
20
|
export { default as Image } from "./components/Image";
|
|
21
|
-
export { default as
|
|
21
|
+
export { default as Svg } from "./components/Svg";
|
|
22
22
|
export { default as NumberInput } from "./components/NumberInput";
|
|
23
23
|
export { default as ScreenContainer } from "./components/ScreenContainer";
|
|
24
24
|
export { default as StarRating } from "./components/StarRating";
|
|
@@ -70,6 +70,5 @@ export { default as RowHeadlineImageIcon } from "./components/RowHeadlineImageIc
|
|
|
70
70
|
export { default as Slider } from "./components/Slider";
|
|
71
71
|
export { default as Stepper } from "./components/Stepper";
|
|
72
72
|
export { useAuthState } from "./components/useAuthState";
|
|
73
|
-
export { default as Youtube } from "./components/Youtube";
|
|
74
73
|
|
|
75
74
|
// a comment to fix sourcemap comment issue
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { COMPONENT_TYPES, createSvgProp, StylesPanelSections, } from "@draftbit/types";
|
|
2
|
+
export const SEED_DATA = {
|
|
3
|
+
name: "SVG",
|
|
4
|
+
tag: "SVG",
|
|
5
|
+
description: "An SVG component",
|
|
6
|
+
packageName: "@draftbit/core",
|
|
7
|
+
category: COMPONENT_TYPES.media,
|
|
8
|
+
layout: {
|
|
9
|
+
width: 100,
|
|
10
|
+
height: 100,
|
|
11
|
+
},
|
|
12
|
+
stylesPanelSections: [
|
|
13
|
+
StylesPanelSections.Size,
|
|
14
|
+
StylesPanelSections.Margins,
|
|
15
|
+
StylesPanelSections.Position,
|
|
16
|
+
StylesPanelSections.Effects,
|
|
17
|
+
],
|
|
18
|
+
props: {
|
|
19
|
+
source: createSvgProp(),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COMPONENT_TYPES,
|
|
3
|
+
createSvgProp,
|
|
4
|
+
StylesPanelSections,
|
|
5
|
+
} from "@draftbit/types";
|
|
6
|
+
|
|
7
|
+
export const SEED_DATA = {
|
|
8
|
+
name: "SVG",
|
|
9
|
+
tag: "SVG",
|
|
10
|
+
description: "An SVG component",
|
|
11
|
+
packageName: "@draftbit/core",
|
|
12
|
+
category: COMPONENT_TYPES.media,
|
|
13
|
+
layout: {
|
|
14
|
+
width: 100,
|
|
15
|
+
height: 100,
|
|
16
|
+
},
|
|
17
|
+
stylesPanelSections: [
|
|
18
|
+
StylesPanelSections.Size,
|
|
19
|
+
StylesPanelSections.Margins,
|
|
20
|
+
StylesPanelSections.Position,
|
|
21
|
+
StylesPanelSections.Effects,
|
|
22
|
+
],
|
|
23
|
+
props: {
|
|
24
|
+
source: createSvgProp(),
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.SEED_DATA = void 0;
|
|
7
|
-
|
|
8
|
-
var _types = require("@draftbit/types");
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _reactNativeYoutubeIframe = _interopRequireDefault(require("react-native-youtube-iframe"));
|
|
13
|
-
|
|
14
|
-
var _utilities = require("../utilities");
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
|
-
const Youtube = _ref => {
|
|
19
|
-
let {
|
|
20
|
-
videoId,
|
|
21
|
-
playlist,
|
|
22
|
-
style,
|
|
23
|
-
mute,
|
|
24
|
-
autoplay
|
|
25
|
-
} = _ref;
|
|
26
|
-
const {
|
|
27
|
-
viewStyles: {
|
|
28
|
-
height,
|
|
29
|
-
width
|
|
30
|
-
}
|
|
31
|
-
} = (0, _utilities.extractStyles)(style);
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(_reactNativeYoutubeIframe.default, {
|
|
33
|
-
height: height,
|
|
34
|
-
width: width,
|
|
35
|
-
play: autoplay,
|
|
36
|
-
videoId: videoId,
|
|
37
|
-
playList: playlist,
|
|
38
|
-
mute: mute
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var _default = Youtube;
|
|
43
|
-
exports.default = _default;
|
|
44
|
-
const SEED_DATA = {
|
|
45
|
-
name: "Youtube",
|
|
46
|
-
tag: "Youtube",
|
|
47
|
-
description: "Youtube Component",
|
|
48
|
-
category: _types.COMPONENT_TYPES.media,
|
|
49
|
-
layout: {
|
|
50
|
-
width: "100%"
|
|
51
|
-
},
|
|
52
|
-
props: {
|
|
53
|
-
videoId: (0, _types.createTextProp)({
|
|
54
|
-
label: "VideoId",
|
|
55
|
-
description: "Youtube Video ID"
|
|
56
|
-
}),
|
|
57
|
-
playlist: (0, _types.createTextProp)({
|
|
58
|
-
label: "PlayList",
|
|
59
|
-
description: "Playlist ID"
|
|
60
|
-
}),
|
|
61
|
-
mute: (0, _types.createBoolProp)({
|
|
62
|
-
label: "Mute",
|
|
63
|
-
description: "Whether to mute video",
|
|
64
|
-
defaultValue: false
|
|
65
|
-
}),
|
|
66
|
-
autoplay: (0, _types.createBoolProp)({
|
|
67
|
-
label: "Autoplay",
|
|
68
|
-
description: "Whether to Autoplay video",
|
|
69
|
-
defaultValue: false
|
|
70
|
-
})
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.SEED_DATA = void 0;
|
|
7
|
-
|
|
8
|
-
var _types = require("@draftbit/types");
|
|
9
|
-
|
|
10
|
-
const SEED_DATA = {
|
|
11
|
-
name: "Youtube",
|
|
12
|
-
tag: "Youtube",
|
|
13
|
-
description: "Given a VideoId orPlaylist and play Youtube video",
|
|
14
|
-
doc_link: "https://lonelycpp.github.io/react-native-youtube-iframe",
|
|
15
|
-
code_link: "https://github.com/LonelyCpp/react-native-youtube-iframe",
|
|
16
|
-
category: _types.COMPONENT_TYPES.media,
|
|
17
|
-
stylesPanelSections: [_types.StylesPanelSections.Size],
|
|
18
|
-
layout: {
|
|
19
|
-
height: 250
|
|
20
|
-
},
|
|
21
|
-
props: {
|
|
22
|
-
videoId: (0, _types.createTextProp)({
|
|
23
|
-
label: "Video ID",
|
|
24
|
-
description: "VideoId of the Youtube video.",
|
|
25
|
-
defaultValue: "nwMUpDESXrI"
|
|
26
|
-
}),
|
|
27
|
-
playlist: (0, _types.createTextProp)({
|
|
28
|
-
label: "Playlist",
|
|
29
|
-
description: "Playlist of the Youtube videos.",
|
|
30
|
-
defaultValue: "PLUa6TiXzjIrwowt6P-uGCJm8ovm-9S1Ks"
|
|
31
|
-
}),
|
|
32
|
-
mute: (0, _types.createStaticBoolProp)({
|
|
33
|
-
label: "Mute Audio",
|
|
34
|
-
description: "Mute the audio of the video."
|
|
35
|
-
}),
|
|
36
|
-
autoplay: (0, _types.createStaticBoolProp)({
|
|
37
|
-
label: "Auto Play",
|
|
38
|
-
description: "Autoplay the video on load."
|
|
39
|
-
})
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
exports.SEED_DATA = SEED_DATA;
|