@draftbit/core 46.2.4-0b78ac.5 → 46.2.4-17908.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.
Files changed (33) hide show
  1. package/lib/commonjs/components/AnimatedCircularProgress.js +2 -12
  2. package/lib/commonjs/components/Carousel.js +10 -34
  3. package/lib/commonjs/components/Checkbox/context.js +1 -1
  4. package/lib/commonjs/components/Container.js +5 -17
  5. package/lib/commonjs/components/FormRow.js +3 -17
  6. package/lib/commonjs/components/Picker/Picker.js +6 -7
  7. package/lib/commonjs/components/RadioButton/RadioButton.js +3 -14
  8. package/lib/commonjs/components/RadioButton/context.js +1 -1
  9. package/lib/commonjs/components/Slider.js +5 -24
  10. package/lib/commonjs/components/StarRating.js +5 -25
  11. package/lib/commonjs/components/StepIndicator.js +16 -34
  12. package/lib/commonjs/components/Touchable.js +2 -16
  13. package/lib/commonjs/components/Youtube.js +73 -0
  14. package/lib/commonjs/index.js +8 -0
  15. package/lib/commonjs/mappings/SVG.js +0 -1
  16. package/lib/commonjs/mappings/Youtube.js +42 -0
  17. package/lib/module/components/Youtube.js +59 -0
  18. package/lib/module/index.js +2 -1
  19. package/lib/module/mappings/SVG.js +1 -2
  20. package/lib/module/mappings/Youtube.js +33 -0
  21. package/lib/typescript/src/components/Youtube.d.ts +44 -0
  22. package/lib/typescript/src/index.d.ts +1 -0
  23. package/lib/typescript/src/mappings/SVG.d.ts +0 -1
  24. package/lib/typescript/src/mappings/Youtube.d.ts +36 -0
  25. package/package.json +5 -3
  26. package/src/components/Youtube.js +38 -0
  27. package/src/components/Youtube.tsx +66 -0
  28. package/src/index.js +1 -0
  29. package/src/index.tsx +1 -0
  30. package/src/mappings/SVG.js +1 -7
  31. package/src/mappings/SVG.ts +1 -11
  32. package/src/mappings/Youtube.js +33 -0
  33. package/src/mappings/Youtube.ts +39 -0
@@ -17,6 +17,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
17
17
 
18
18
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
19
 
20
+ 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); }
21
+
20
22
  const AnimatedProgress = _reactNative.Animated.createAnimatedComponent(_CircularProgress.default);
21
23
 
22
24
  const AnimatedCircularProgress = _ref => {
@@ -67,18 +69,6 @@ const AnimatedCircularProgress = _ref => {
67
69
  React.useEffect(() => {
68
70
  animate();
69
71
  }, [fill, animate]);
70
- return /*#__PURE__*/React.createElement(AnimatedProgress, { ...other,
71
- style: other.style,
72
- childrenContainerStyle: other.childrenContainerStyle,
73
- fill: fillAnimation,
74
- tintColor: animateColor()
75
- });
76
- };
77
-
78
- var _default = AnimatedCircularProgress;
79
- exports.default = _default;eEffect(() => {
80
- animate();
81
- }, [fill, animate]);
82
72
  return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
83
73
  style: other.style,
84
74
  childrenContainerStyle: other.childrenContainerStyle,
@@ -19,6 +19,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
+ 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); }
23
+
22
24
  const screenWidth = _reactNative.Dimensions.get("window").width;
23
25
 
24
26
  function Pager(_ref) {
@@ -48,6 +50,8 @@ function Pager(_ref) {
48
50
  }
49
51
 
50
52
  function Carousel(_ref2) {
53
+ var _data$length;
54
+
51
55
  let {
52
56
  data,
53
57
  children,
@@ -55,12 +59,9 @@ function Carousel(_ref2) {
55
59
  style,
56
60
  ...rest
57
61
  } = _ref2;
58
-
59
- var _a;
60
-
61
62
  const [index, setIndex] = React.useState(0);
62
63
  const length = React.Children.count(children);
63
- const itemsLength = ((_a = data === null || data === void 0 ? void 0 : data.length) !== null && _a !== void 0 ? _a : 0) + length;
64
+ const itemsLength = ((_data$length = data === null || data === void 0 ? void 0 : data.length) !== null && _data$length !== void 0 ? _data$length : 0) + length;
64
65
  const slides = Array.isArray(data) ? data : [];
65
66
 
66
67
  const {
@@ -70,10 +71,9 @@ function Carousel(_ref2) {
70
71
 
71
72
  const slideWidth = width || screenWidth;
72
73
  const slideHeight = height || 250;
73
- return /*#__PURE__*/React.createElement(_reactNative.View, {
74
- style: [styles.container, style],
75
- ...rest
76
- }, /*#__PURE__*/React.createElement(_reactNative.ScrollView, {
74
+ return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
75
+ style: [styles.container, style]
76
+ }, rest), /*#__PURE__*/React.createElement(_reactNative.ScrollView, {
77
77
  pagingEnabled: true,
78
78
  horizontal: true,
79
79
  decelerationRate: "fast",
@@ -101,9 +101,9 @@ function Carousel(_ref2) {
101
101
  }]
102
102
  });
103
103
  }) : null, React.Children.map(children, child => {
104
- var _a;
104
+ var _child$props;
105
105
 
106
- const s = ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.style) || {};
106
+ const s = (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style) || {};
107
107
  return /*#__PURE__*/React.createElement(_reactNative.View, {
108
108
  style: {
109
109
  width: slideWidth
@@ -144,28 +144,4 @@ const styles = _reactNative.StyleSheet.create({
144
144
 
145
145
  var _default = (0, _theming.withTheme)(Carousel);
146
146
 
147
- exports.default = _default;e({
148
- container: {
149
- backgroundColor: "#eee"
150
- },
151
- pager: {
152
- position: "absolute",
153
- bottom: 12,
154
- left: 0,
155
- right: 0,
156
- flexDirection: "row",
157
- justifyContent: "center",
158
- alignItems: "center"
159
- },
160
- bullet: {
161
- marginHorizontal: 2,
162
- width: 10,
163
- height: 10,
164
- borderRadius: 20,
165
- backgroundColor: "#000"
166
- }
167
- });
168
-
169
- var _default = (0, _theming.withTheme)(Carousel);
170
-
171
147
  exports.default = _default;
@@ -8,7 +8,7 @@ exports.useCheckboxGroupContext = useCheckboxGroupContext;
8
8
 
9
9
  var _react = require("react");
10
10
 
11
- var Direction;
11
+ let Direction;
12
12
  exports.Direction = Direction;
13
13
 
14
14
  (function (Direction) {
@@ -19,6 +19,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
+ 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); }
23
+
22
24
  const Container = _ref => {
23
25
  let {
24
26
  useThemeGutterPadding,
@@ -80,10 +82,9 @@ const Container = _ref => {
80
82
  };
81
83
  const Wrap = elevation ? _Elevation.default : _reactNative.View;
82
84
  if (elevation) containerStyle.elevation = elevation;
83
- return /*#__PURE__*/React.createElement(Wrap, {
84
- style: [containerStyle, style],
85
- ...rest
86
- }, backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
85
+ return /*#__PURE__*/React.createElement(Wrap, _extends({
86
+ style: [containerStyle, style]
87
+ }, rest), backgroundImage ? /*#__PURE__*/React.createElement(_reactNative.ImageBackground, {
87
88
  source: typeof backgroundImage === "string" ? {
88
89
  uri: backgroundImage
89
90
  } : backgroundImage,
@@ -100,17 +101,4 @@ const Container = _ref => {
100
101
 
101
102
  var _default = (0, _theming.withTheme)(Container);
102
103
 
103
- exports.default = _default;izeMode: backgroundImageResizeMode,
104
- style: {
105
- flex: 1
106
- }
107
- }, /*#__PURE__*/React.createElement(_reactNative.View, {
108
- style: innerStyle
109
- }, children)) : /*#__PURE__*/React.createElement(_reactNative.View, {
110
- style: innerStyle
111
- }, children));
112
- };
113
-
114
- var _default = (0, _theming.withTheme)(Container);
115
-
116
104
  exports.default = _default;
@@ -19,6 +19,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
19
19
 
20
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
21
 
22
+ 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); }
23
+
22
24
  function FormRow(_ref) {
23
25
  let {
24
26
  disabled,
@@ -33,27 +35,11 @@ function FormRow(_ref) {
33
35
  textStyles,
34
36
  viewStyles
35
37
  } = (0, _utilities.extractStyles)(style);
36
- return /*#__PURE__*/React.createElement(_Touchable.default, {
38
+ return /*#__PURE__*/React.createElement(_Touchable.default, _extends({
37
39
  disabled: disabled,
38
40
  onPress: onPress,
39
41
  style: [styles.row, {
40
42
  flexDirection: direction
41
- }, viewStyles],
42
- ...rest
43
- }, /*#__PURE__*/React.createElement(_reactNative.Text, {
44
- style: textStyles
45
- }, label), children);
46
- }
47
-
48
- const styles = _reactNative.StyleSheet.create({
49
- row: {
50
- marginLeft: 8,
51
- marginRight: 8,
52
- flexDirection: "row",
53
- justifyContent: "space-between",
54
- alignItems: "center"
55
- }
56
- });rection: direction
57
43
  }, viewStyles]
58
44
  }, rest), /*#__PURE__*/React.createElement(_reactNative.Text, {
59
45
  style: textStyles
@@ -66,6 +66,8 @@ const disabledColor = "rgb(240, 240, 240)";
66
66
  const errorColor = "rgba(255, 69, 100, 1)";
67
67
 
68
68
  const Picker = _ref => {
69
+ var _find$label, _find;
70
+
69
71
  let {
70
72
  error,
71
73
  options = [],
@@ -87,9 +89,6 @@ const Picker = _ref => {
87
89
  rightIconName,
88
90
  type = "solid"
89
91
  } = _ref;
90
-
91
- var _a, _b;
92
-
93
92
  const androidPickerRef = React.useRef(undefined);
94
93
  const [internalValue, setInternalValue] = React.useState(value || defaultValue);
95
94
  const [pickerVisible, setPickerVisible] = React.useState(false);
@@ -109,10 +108,10 @@ const Picker = _ref => {
109
108
  }
110
109
  }, [defaultValue]);
111
110
  React.useEffect(() => {
112
- var _a;
113
-
114
111
  if (pickerVisible && androidPickerRef.current) {
115
- (_a = androidPickerRef === null || androidPickerRef === void 0 ? void 0 : androidPickerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
112
+ var _androidPickerRef$cur;
113
+
114
+ androidPickerRef === null || androidPickerRef === void 0 ? void 0 : (_androidPickerRef$cur = androidPickerRef.current) === null || _androidPickerRef$cur === void 0 ? void 0 : _androidPickerRef$cur.focus();
116
115
  }
117
116
  }, [pickerVisible, androidPickerRef]);
118
117
  const normalizedOptions = normalizeOptions(options);
@@ -160,7 +159,7 @@ const Picker = _ref => {
160
159
  ...extractedMarginStyles
161
160
  };
162
161
  const stylesWithoutBordersAndMargins = (0, _lodash.omit)(viewStyles, [..._utilities.borderStyleNames, ..._utilities.marginStyleNames, ...additionalBorderStyles, ...additionalMarginStyles]);
163
- const selectedLabel = internalValue && ((_b = (_a = pickerOptions.find(option => option.value === internalValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : internalValue);
162
+ const selectedLabel = internalValue && ((_find$label = (_find = pickerOptions.find(option => option.value === internalValue)) === null || _find === void 0 ? void 0 : _find.label) !== null && _find$label !== void 0 ? _find$label : internalValue);
164
163
  const labelText = label ? /*#__PURE__*/React.createElement(_reactNative.Text, {
165
164
  style: {
166
165
  textAlign: textStyles.textAlign,
@@ -21,6 +21,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
21
21
 
22
22
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
23
 
24
+ 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); }
25
+
24
26
  const RadioButton = _ref => {
25
27
  let {
26
28
  Icon,
@@ -49,20 +51,7 @@ const RadioButton = _ref => {
49
51
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
50
52
  };
51
53
 
52
- return /*#__PURE__*/React.createElement(_IconButton.default, {
53
- Icon: Icon,
54
- icon: isSelected ? selectedIcon : unselectedIcon,
55
- color: isSelected ? color : unselectedColor,
56
- disabled: disabled,
57
- onPress: handlePress,
58
- size: size,
59
- style: style,
60
- ...rest
61
- });
62
- };
63
-
64
- var _default = RadioButton;
65
- exports.default = _default;turn /*#__PURE__*/React.createElement(_IconButton.default, _extends({
54
+ return /*#__PURE__*/React.createElement(_IconButton.default, _extends({
66
55
  Icon: Icon,
67
56
  icon: isSelected ? selectedIcon : unselectedIcon,
68
57
  color: isSelected ? color : unselectedColor,
@@ -8,7 +8,7 @@ exports.useRadioButtonGroupContext = useRadioButtonGroupContext;
8
8
 
9
9
  var _react = require("react");
10
10
 
11
- var Direction;
11
+ let Direction;
12
12
  exports.Direction = Direction;
13
13
 
14
14
  (function (Direction) {
@@ -23,6 +23,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
23
23
 
24
24
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
25
 
26
+ 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); }
27
+
26
28
  function maybeParseValue(value) {
27
29
  if (value === undefined) {
28
30
  return undefined;
@@ -89,10 +91,9 @@ function Slider(_ref) {
89
91
  onValueChange(newValue);
90
92
  };
91
93
 
92
- return /*#__PURE__*/React.createElement(_reactNative.View, {
93
- style: [styles.container, style],
94
- ...rest
95
- }, leftIcon ? /*#__PURE__*/React.createElement(Icon, {
94
+ return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
95
+ style: [styles.container, style]
96
+ }, rest), leftIcon ? /*#__PURE__*/React.createElement(Icon, {
96
97
  color: leftIconThemeColor,
97
98
  name: leftIcon,
98
99
  size: 24
@@ -128,24 +129,4 @@ const styles = _reactNative.StyleSheet.create({
128
129
 
129
130
  var _default = (0, _theming.withTheme)(Slider);
130
131
 
131
- exports.default = _default;: rightIconThemeColor,
132
- name: rightIcon,
133
- size: 24
134
- }) : null);
135
- }
136
-
137
- const styles = _reactNative.StyleSheet.create({
138
- container: {
139
- height: 40,
140
- flexDirection: "row",
141
- alignItems: "center"
142
- },
143
- slider: {
144
- flex: 1,
145
- marginHorizontal: 12
146
- }
147
- });
148
-
149
- var _default = (0, _theming.withTheme)(Slider);
150
-
151
132
  exports.default = _default;
@@ -15,6 +15,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
+ 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); }
19
+
18
20
  const StarRating = _ref => {
19
21
  let {
20
22
  Icon,
@@ -45,10 +47,9 @@ const StarRating = _ref => {
45
47
  !!onPress && onPress(r);
46
48
  }, [onPress]);
47
49
  const ratingRounded = Math.round(localRating * 2) / 2;
48
- return /*#__PURE__*/React.createElement(_reactNative.View, {
49
- style: [styles.container, style],
50
- ...rest
51
- }, [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(_reactNative.View, {
50
+ return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
51
+ style: [styles.container, style]
52
+ }, rest), [...Array(maxStars)].map((_, i) => /*#__PURE__*/React.createElement(_reactNative.View, {
52
53
  key: i,
53
54
  style: {
54
55
  display: "flex"
@@ -92,25 +93,4 @@ const styles = _reactNative.StyleSheet.create({
92
93
 
93
94
  var _default = (0, _theming.withTheme)(StarRating);
94
95
 
95
- exports.default = _default;ignItems: "center"
96
- },
97
- touchContainer: {
98
- display: "flex",
99
- flexDirection: "row",
100
- position: "absolute",
101
- top: 0,
102
- right: 0,
103
- left: 0,
104
- bottom: 0,
105
- zIndex: 1
106
- },
107
- pressable: {
108
- flex: 1,
109
- height: "100%",
110
- width: "50%"
111
- }
112
- });
113
-
114
- var _default = (0, _theming.withTheme)(StarRating);
115
-
116
96
  exports.default = _default;
@@ -13,7 +13,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
13
13
 
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
 
16
- // @ts-nocheck
16
+ 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; }
17
+
17
18
  const STEP_STATUS = {
18
19
  CURRENT: "current",
19
20
  FINISHED: "finished",
@@ -24,7 +25,7 @@ class StepIndicator extends _react.Component {
24
25
  constructor(props) {
25
26
  super(props);
26
27
 
27
- this.renderProgressBarBackground = () => {
28
+ _defineProperty(this, "renderProgressBarBackground", () => {
28
29
  const {
29
30
  stepCount,
30
31
  direction
@@ -69,9 +70,9 @@ class StepIndicator extends _react.Component {
69
70
  },
70
71
  style: progressBarBackgroundStyle
71
72
  });
72
- };
73
+ });
73
74
 
74
- this.renderProgressBar = () => {
75
+ _defineProperty(this, "renderProgressBar", () => {
75
76
  const {
76
77
  stepCount,
77
78
  direction
@@ -103,9 +104,9 @@ class StepIndicator extends _react.Component {
103
104
  return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
104
105
  style: progressBarStyle
105
106
  });
106
- };
107
+ });
107
108
 
108
- this.renderStepIndicator = () => {
109
+ _defineProperty(this, "renderStepIndicator", () => {
109
110
  let steps = [];
110
111
  const {
111
112
  stepCount,
@@ -138,9 +139,9 @@ class StepIndicator extends _react.Component {
138
139
  height: this.state.customStyles.currentStepIndicatorSize
139
140
  }]
140
141
  }, steps);
141
- };
142
+ });
142
143
 
143
- this.renderStepLabels = () => {
144
+ _defineProperty(this, "renderStepLabels", () => {
144
145
  const {
145
146
  labels,
146
147
  direction,
@@ -182,9 +183,9 @@ class StepIndicator extends _react.Component {
182
183
  alignItems: this.state.customStyles.labelAlign
183
184
  }]
184
185
  }, labelViews);
185
- };
186
+ });
186
187
 
187
- this.renderStep = position => {
188
+ _defineProperty(this, "renderStep", position => {
188
189
  const {
189
190
  renderStepIndicator
190
191
  } = this.props;
@@ -256,9 +257,9 @@ class StepIndicator extends _react.Component {
256
257
  }) : /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
257
258
  style: indicatorLabelStyle
258
259
  }, "".concat(position + 1)));
259
- };
260
+ });
260
261
 
261
- this.getStepStatus = stepPosition => {
262
+ _defineProperty(this, "getStepStatus", stepPosition => {
262
263
  const {
263
264
  currentPosition
264
265
  } = this.props;
@@ -270,9 +271,9 @@ class StepIndicator extends _react.Component {
270
271
  } else {
271
272
  return STEP_STATUS.UNFINISHED;
272
273
  }
273
- };
274
+ });
274
275
 
275
- this.onCurrentPositionChanged = position => {
276
+ _defineProperty(this, "onCurrentPositionChanged", position => {
276
277
  let {
277
278
  stepCount
278
279
  } = this.props;
@@ -295,7 +296,7 @@ class StepIndicator extends _react.Component {
295
296
  toValue: this.state.customStyles.currentStepIndicatorSize / 2,
296
297
  duration: 100
297
298
  })])]).start();
298
- };
299
+ });
299
300
 
300
301
  const defaultStyles = {
301
302
  stepIndicatorSize: 30,
@@ -410,25 +411,6 @@ const styles = _reactNative.StyleSheet.create({
410
411
  }
411
412
  });
412
413
 
413
- StepIndicator.defaultProps = {
414
- currentPosition: 0,
415
- stepCount: 5,
416
- customStyles: {},
417
- direction: "horizontal"
418
- }; justifyContent: "center"
419
- },
420
- stepLabel: {
421
- fontSize: 12,
422
- textAlign: "center",
423
- fontWeight: "500"
424
- },
425
- stepLabelItem: {
426
- flex: 1,
427
- alignItems: "center",
428
- justifyContent: "center"
429
- }
430
- });
431
-
432
414
  StepIndicator.defaultProps = {
433
415
  currentPosition: 0,
434
416
  stepCount: 5,
@@ -11,6 +11,8 @@ var _reactNative = require("react-native");
11
11
 
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
13
 
14
+ 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); }
15
+
14
16
  function Touchable(_ref) {
15
17
  let {
16
18
  children,
@@ -19,22 +21,6 @@ function Touchable(_ref) {
19
21
  style,
20
22
  ...props
21
23
  } = _ref;
22
- return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, {
23
- onPress: onPress,
24
- disabled: disabled,
25
- hitSlop: 8,
26
- style: _ref2 => {
27
- let {
28
- pressed
29
- } = _ref2;
30
- return [{
31
- opacity: pressed || disabled ? 0.75 : 1
32
- }, style];
33
- },
34
- ...props
35
- }, children);
36
- }rops
37
- } = _ref;
38
24
  return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
39
25
  onPress: onPress,
40
26
  disabled: disabled,
@@ -0,0 +1,73 @@
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;
@@ -393,6 +393,12 @@ Object.defineProperty(exports, "Touchable", {
393
393
  return _Touchable.default;
394
394
  }
395
395
  });
396
+ Object.defineProperty(exports, "Youtube", {
397
+ enumerable: true,
398
+ get: function () {
399
+ return _Youtube.default;
400
+ }
401
+ });
396
402
  Object.defineProperty(exports, "injectIcon", {
397
403
  enumerable: true,
398
404
  get: function () {
@@ -512,6 +518,8 @@ var _Stepper = _interopRequireDefault(require("./components/Stepper"));
512
518
 
513
519
  var _useAuthState = require("./components/useAuthState");
514
520
 
521
+ var _Youtube = _interopRequireDefault(require("./components/Youtube"));
522
+
515
523
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
516
524
 
517
525
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -16,7 +16,6 @@ const SEED_DATA = {
16
16
  width: 100,
17
17
  height: 100
18
18
  },
19
- stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
20
19
  props: {
21
20
  source: (0, _types.createSvgProp)()
22
21
  }
@@ -0,0 +1,42 @@
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;
@@ -0,0 +1,59 @@
1
+ import { COMPONENT_TYPES, createBoolProp, createTextProp } from "@draftbit/types";
2
+ import React from "react";
3
+ import YoutubePlayer from "react-native-youtube-iframe";
4
+ import { extractStyles } from "../utilities";
5
+
6
+ const Youtube = _ref => {
7
+ let {
8
+ videoId,
9
+ playlist,
10
+ style,
11
+ mute,
12
+ autoplay
13
+ } = _ref;
14
+ const {
15
+ viewStyles: {
16
+ height,
17
+ width
18
+ }
19
+ } = extractStyles(style);
20
+ return /*#__PURE__*/React.createElement(YoutubePlayer, {
21
+ height: height,
22
+ width: width,
23
+ play: autoplay,
24
+ videoId: videoId,
25
+ playList: playlist,
26
+ mute: mute
27
+ });
28
+ };
29
+
30
+ export default Youtube;
31
+ export const SEED_DATA = {
32
+ name: "Youtube",
33
+ tag: "Youtube",
34
+ description: "Youtube Component",
35
+ category: COMPONENT_TYPES.media,
36
+ layout: {
37
+ width: "100%"
38
+ },
39
+ props: {
40
+ videoId: createTextProp({
41
+ label: "VideoId",
42
+ description: "Youtube Video ID"
43
+ }),
44
+ playlist: createTextProp({
45
+ label: "PlayList",
46
+ description: "Playlist ID"
47
+ }),
48
+ mute: createBoolProp({
49
+ label: "Mute",
50
+ description: "Whether to mute video",
51
+ defaultValue: false
52
+ }),
53
+ autoplay: createBoolProp({
54
+ label: "Autoplay",
55
+ description: "Whether to Autoplay video",
56
+ defaultValue: false
57
+ })
58
+ }
59
+ };
@@ -50,4 +50,5 @@ 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"; // a comment to fix sourcemap comment issue
53
+ export { useAuthState } from "./components/useAuthState";
54
+ export { default as Youtube } from "./components/Youtube"; // a comment to fix sourcemap comment issue
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createSvgProp, StylesPanelSections } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createSvgProp } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "SVG",
4
4
  tag: "SVG",
@@ -8,7 +8,6 @@ export const SEED_DATA = {
8
8
  width: 100,
9
9
  height: 100
10
10
  },
11
- stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Effects],
12
11
  props: {
13
12
  source: createSvgProp()
14
13
  }
@@ -0,0 +1,33 @@
1
+ import { COMPONENT_TYPES, createStaticBoolProp, createTextProp, StylesPanelSections } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Youtube",
4
+ tag: "Youtube",
5
+ description: "Given a VideoId orPlaylist and play Youtube video",
6
+ doc_link: "https://lonelycpp.github.io/react-native-youtube-iframe",
7
+ code_link: "https://github.com/LonelyCpp/react-native-youtube-iframe",
8
+ category: COMPONENT_TYPES.media,
9
+ stylesPanelSections: [StylesPanelSections.Size],
10
+ layout: {
11
+ height: 250
12
+ },
13
+ props: {
14
+ videoId: createTextProp({
15
+ label: "Video ID",
16
+ description: "VideoId of the Youtube video.",
17
+ defaultValue: "nwMUpDESXrI"
18
+ }),
19
+ playlist: createTextProp({
20
+ label: "Playlist",
21
+ description: "Playlist of the Youtube videos.",
22
+ defaultValue: "PLUa6TiXzjIrwowt6P-uGCJm8ovm-9S1Ks"
23
+ }),
24
+ mute: createStaticBoolProp({
25
+ label: "Mute Audio",
26
+ description: "Mute the audio of the video."
27
+ }),
28
+ autoplay: createStaticBoolProp({
29
+ label: "Auto Play",
30
+ description: "Autoplay the video on load."
31
+ })
32
+ }
33
+ };
@@ -0,0 +1,44 @@
1
+ /// <reference types="react" />
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ declare type Props = {
4
+ videoId: string;
5
+ playlist: string;
6
+ style: StyleProp<ViewStyle>;
7
+ mute: boolean;
8
+ autoplay: boolean;
9
+ };
10
+ declare const Youtube: ({ videoId, playlist, style, mute, autoplay }: Props) => JSX.Element;
11
+ export default Youtube;
12
+ export declare const SEED_DATA: {
13
+ name: string;
14
+ tag: string;
15
+ description: string;
16
+ category: string;
17
+ layout: {
18
+ width: string;
19
+ };
20
+ props: {
21
+ videoId: any;
22
+ playlist: any;
23
+ mute: {
24
+ label: string;
25
+ description: string;
26
+ formType: string;
27
+ propType: string;
28
+ defaultValue: boolean;
29
+ editable: boolean;
30
+ required: boolean;
31
+ group: string;
32
+ };
33
+ autoplay: {
34
+ label: string;
35
+ description: string;
36
+ formType: string;
37
+ propType: string;
38
+ defaultValue: boolean;
39
+ editable: boolean;
40
+ required: boolean;
41
+ group: string;
42
+ };
43
+ };
44
+ };
@@ -49,3 +49,4 @@ 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";
@@ -7,7 +7,6 @@ export declare const SEED_DATA: {
7
7
  width: number;
8
8
  height: number;
9
9
  };
10
- stylesPanelSections: string[];
11
10
  props: {
12
11
  source: {
13
12
  label: string;
@@ -0,0 +1,36 @@
1
+ export declare const SEED_DATA: {
2
+ name: string;
3
+ tag: string;
4
+ description: string;
5
+ doc_link: string;
6
+ code_link: string;
7
+ category: string;
8
+ stylesPanelSections: string[];
9
+ layout: {
10
+ height: number;
11
+ };
12
+ props: {
13
+ videoId: any;
14
+ playlist: any;
15
+ mute: {
16
+ label: string;
17
+ description: string;
18
+ formType: string;
19
+ propType: string;
20
+ defaultValue: boolean;
21
+ editable: boolean;
22
+ required: boolean;
23
+ group: string;
24
+ };
25
+ autoplay: {
26
+ label: string;
27
+ description: string;
28
+ formType: string;
29
+ propType: string;
30
+ defaultValue: boolean;
31
+ editable: boolean;
32
+ required: boolean;
33
+ group: string;
34
+ };
35
+ };
36
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.2.4-0b78ac.5+0b78accb",
3
+ "version": "46.2.4-017908.5+017908e8",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -55,7 +55,9 @@
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"
58
+ "react-native-web-swiper": "^2.2.3",
59
+ "react-native-web-webview": "^1.0.2",
60
+ "react-native-youtube-iframe": "^2.2.2"
59
61
  },
60
62
  "devDependencies": {
61
63
  "@types/color": "^3.0.1",
@@ -80,5 +82,5 @@
80
82
  ]
81
83
  ]
82
84
  },
83
- "gitHead": "0b78accbd6bab9f7f970582fec5cc22b4a53904a"
85
+ "gitHead": "017908e83d703431ff70ab9fe9a241a7e86d5ee1"
84
86
  }
@@ -0,0 +1,38 @@
1
+ import { COMPONENT_TYPES, createBoolProp, createTextProp, } from "@draftbit/types";
2
+ import React from "react";
3
+ import YoutubePlayer from "react-native-youtube-iframe";
4
+ import { extractStyles } from "../utilities";
5
+ const Youtube = ({ videoId, playlist, style, mute, autoplay }) => {
6
+ const { viewStyles: { height, width }, } = extractStyles(style);
7
+ return (React.createElement(YoutubePlayer, { height: height, width: width, play: autoplay, videoId: videoId, playList: playlist, mute: mute }));
8
+ };
9
+ export default Youtube;
10
+ export const SEED_DATA = {
11
+ name: "Youtube",
12
+ tag: "Youtube",
13
+ description: "Youtube Component",
14
+ category: COMPONENT_TYPES.media,
15
+ layout: {
16
+ width: "100%",
17
+ },
18
+ props: {
19
+ videoId: createTextProp({
20
+ label: "VideoId",
21
+ description: "Youtube Video ID",
22
+ }),
23
+ playlist: createTextProp({
24
+ label: "PlayList",
25
+ description: "Playlist ID",
26
+ }),
27
+ mute: createBoolProp({
28
+ label: "Mute",
29
+ description: "Whether to mute video",
30
+ defaultValue: false,
31
+ }),
32
+ autoplay: createBoolProp({
33
+ label: "Autoplay",
34
+ description: "Whether to Autoplay video",
35
+ defaultValue: false,
36
+ }),
37
+ },
38
+ };
@@ -0,0 +1,66 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createBoolProp,
4
+ createTextProp,
5
+ } from "@draftbit/types";
6
+ import React from "react";
7
+ import { StyleProp, ViewStyle } from "react-native";
8
+ import YoutubePlayer from "react-native-youtube-iframe";
9
+ import { extractStyles } from "../utilities";
10
+
11
+ type Props = {
12
+ videoId: string;
13
+ playlist: string;
14
+ style: StyleProp<ViewStyle>;
15
+ mute: boolean;
16
+ autoplay: boolean;
17
+ };
18
+
19
+ const Youtube = ({ videoId, playlist, style, mute, autoplay }: Props) => {
20
+ const {
21
+ viewStyles: { height, width },
22
+ } = extractStyles(style);
23
+
24
+ return (
25
+ <YoutubePlayer
26
+ height={height}
27
+ width={width}
28
+ play={autoplay}
29
+ videoId={videoId}
30
+ playList={playlist}
31
+ mute={mute}
32
+ />
33
+ );
34
+ };
35
+
36
+ export default Youtube;
37
+
38
+ export const SEED_DATA = {
39
+ name: "Youtube",
40
+ tag: "Youtube",
41
+ description: "Youtube Component",
42
+ category: COMPONENT_TYPES.media,
43
+ layout: {
44
+ width: "100%",
45
+ },
46
+ props: {
47
+ videoId: createTextProp({
48
+ label: "VideoId",
49
+ description: "Youtube Video ID",
50
+ }),
51
+ playlist: createTextProp({
52
+ label: "PlayList",
53
+ description: "Playlist ID",
54
+ }),
55
+ mute: createBoolProp({
56
+ label: "Mute",
57
+ description: "Whether to mute video",
58
+ defaultValue: false,
59
+ }),
60
+ autoplay: createBoolProp({
61
+ label: "Autoplay",
62
+ description: "Whether to Autoplay video",
63
+ defaultValue: false,
64
+ }),
65
+ },
66
+ };
package/src/index.js CHANGED
@@ -50,4 +50,5 @@ 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";
53
54
  // a comment to fix sourcemap comment issue
package/src/index.tsx CHANGED
@@ -70,5 +70,6 @@ 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";
73
74
 
74
75
  // a comment to fix sourcemap comment issue
@@ -1,4 +1,4 @@
1
- import { COMPONENT_TYPES, createSvgProp, StylesPanelSections, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createSvgProp } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "SVG",
4
4
  tag: "SVG",
@@ -8,12 +8,6 @@ export const SEED_DATA = {
8
8
  width: 100,
9
9
  height: 100,
10
10
  },
11
- stylesPanelSections: [
12
- StylesPanelSections.Size,
13
- StylesPanelSections.Margins,
14
- StylesPanelSections.Position,
15
- StylesPanelSections.Effects,
16
- ],
17
11
  props: {
18
12
  source: createSvgProp(),
19
13
  },
@@ -1,8 +1,4 @@
1
- import {
2
- COMPONENT_TYPES,
3
- createSvgProp,
4
- StylesPanelSections,
5
- } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createSvgProp } from "@draftbit/types";
6
2
 
7
3
  export const SEED_DATA = {
8
4
  name: "SVG",
@@ -13,12 +9,6 @@ export const SEED_DATA = {
13
9
  width: 100,
14
10
  height: 100,
15
11
  },
16
- stylesPanelSections: [
17
- StylesPanelSections.Size,
18
- StylesPanelSections.Margins,
19
- StylesPanelSections.Position,
20
- StylesPanelSections.Effects,
21
- ],
22
12
  props: {
23
13
  source: createSvgProp(),
24
14
  },
@@ -0,0 +1,33 @@
1
+ import { COMPONENT_TYPES, createStaticBoolProp, createTextProp, StylesPanelSections, } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Youtube",
4
+ tag: "Youtube",
5
+ description: "Given a VideoId orPlaylist and play Youtube video",
6
+ doc_link: "https://lonelycpp.github.io/react-native-youtube-iframe",
7
+ code_link: "https://github.com/LonelyCpp/react-native-youtube-iframe",
8
+ category: COMPONENT_TYPES.media,
9
+ stylesPanelSections: [StylesPanelSections.Size],
10
+ layout: {
11
+ height: 250,
12
+ },
13
+ props: {
14
+ videoId: createTextProp({
15
+ label: "Video ID",
16
+ description: "VideoId of the Youtube video.",
17
+ defaultValue: "nwMUpDESXrI",
18
+ }),
19
+ playlist: createTextProp({
20
+ label: "Playlist",
21
+ description: "Playlist of the Youtube videos.",
22
+ defaultValue: "PLUa6TiXzjIrwowt6P-uGCJm8ovm-9S1Ks",
23
+ }),
24
+ mute: createStaticBoolProp({
25
+ label: "Mute Audio",
26
+ description: "Mute the audio of the video.",
27
+ }),
28
+ autoplay: createStaticBoolProp({
29
+ label: "Auto Play",
30
+ description: "Autoplay the video on load.",
31
+ }),
32
+ },
33
+ };
@@ -0,0 +1,39 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createStaticBoolProp,
4
+ createTextProp,
5
+ StylesPanelSections,
6
+ } from "@draftbit/types";
7
+
8
+ export const SEED_DATA = {
9
+ name: "Youtube",
10
+ tag: "Youtube",
11
+ description: "Given a VideoId orPlaylist and play Youtube video",
12
+ doc_link: "https://lonelycpp.github.io/react-native-youtube-iframe",
13
+ code_link: "https://github.com/LonelyCpp/react-native-youtube-iframe",
14
+ category: COMPONENT_TYPES.media,
15
+ stylesPanelSections: [StylesPanelSections.Size],
16
+ layout: {
17
+ height: 250,
18
+ },
19
+ props: {
20
+ videoId: createTextProp({
21
+ label: "Video ID",
22
+ description: "VideoId of the Youtube video.",
23
+ defaultValue: "nwMUpDESXrI",
24
+ }),
25
+ playlist: createTextProp({
26
+ label: "Playlist",
27
+ description: "Playlist of the Youtube videos.",
28
+ defaultValue: "PLUa6TiXzjIrwowt6P-uGCJm8ovm-9S1Ks",
29
+ }),
30
+ mute: createStaticBoolProp({
31
+ label: "Mute Audio",
32
+ description: "Mute the audio of the video.",
33
+ }),
34
+ autoplay: createStaticBoolProp({
35
+ label: "Auto Play",
36
+ description: "Autoplay the video on load.",
37
+ }),
38
+ },
39
+ };