@draftbit/core 46.2.4-99ac4e.1 → 46.2.4-a572b7.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 (64) hide show
  1. package/lib/commonjs/components/AnimatedCircularProgress.js +12 -2
  2. package/lib/commonjs/components/Banner.js +24 -4
  3. package/lib/commonjs/components/CardBlock.js +15 -5
  4. package/lib/commonjs/components/CardContainer.js +15 -5
  5. package/lib/commonjs/components/CardContainerRating.js +15 -5
  6. package/lib/commonjs/components/CardContainerShortImage.js +17 -5
  7. package/lib/commonjs/components/Carousel.js +34 -10
  8. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +24 -6
  9. package/lib/commonjs/components/Checkbox/context.js +1 -1
  10. package/lib/commonjs/components/CircleImage.js +16 -2
  11. package/lib/commonjs/components/CircularProgress.js +15 -7
  12. package/lib/commonjs/components/Config.js +1 -0
  13. package/lib/commonjs/components/Container.js +17 -5
  14. package/lib/commonjs/components/DeprecatedButton.js +4 -22
  15. package/lib/commonjs/components/DeprecatedCardWrapper.js +17 -2
  16. package/lib/commonjs/components/DeprecatedFAB.js +22 -4
  17. package/lib/commonjs/components/Elevation.js +15 -3
  18. package/lib/commonjs/components/FAB.js +20 -5
  19. package/lib/commonjs/components/FormRow.js +17 -3
  20. package/lib/commonjs/components/Image.js +16 -3
  21. package/lib/commonjs/components/NumberInput.js +13 -2
  22. package/lib/commonjs/components/Picker/PickerComponent.ios.js +42 -13
  23. package/lib/commonjs/components/Portal/PortalHost.js +27 -15
  24. package/lib/commonjs/components/RadioButton/RadioButtonGroup.js +16 -3
  25. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +24 -6
  26. package/lib/commonjs/components/SVG.js +48 -0
  27. package/lib/commonjs/components/ScreenContainer.js +23 -5
  28. package/lib/commonjs/components/Slider.js +24 -5
  29. package/lib/commonjs/components/StarRating.js +25 -5
  30. package/lib/commonjs/components/Surface.js +14 -3
  31. package/lib/commonjs/components/Text.js +37 -11
  32. package/lib/commonjs/components/TextField.js +63 -30
  33. package/lib/commonjs/components/Touchable.js +16 -2
  34. package/lib/commonjs/index.js +8 -0
  35. package/lib/commonjs/mappings/Image.js +2 -2
  36. package/lib/commonjs/mappings/MapView.js +1 -0
  37. package/lib/commonjs/mappings/SVG.js +25 -0
  38. package/lib/module/components/Config.js +1 -0
  39. package/lib/module/components/Picker/PickerComponent.android.js +23 -5
  40. package/lib/module/components/ProgressBar.js +23 -7
  41. package/lib/module/components/SVG.js +31 -0
  42. package/lib/module/components/Surface.js +16 -2
  43. package/lib/module/index.js +1 -0
  44. package/lib/module/mappings/Image.js +2 -2
  45. package/lib/module/mappings/MapView.js +1 -0
  46. package/lib/module/mappings/SVG.js +16 -0
  47. package/lib/typescript/src/components/Config.d.ts +1 -0
  48. package/lib/typescript/src/components/SVG.d.ts +8 -0
  49. package/lib/typescript/src/index.d.ts +1 -0
  50. package/lib/typescript/src/mappings/MapView.d.ts +1 -0
  51. package/lib/typescript/src/mappings/SVG.d.ts +24 -0
  52. package/package.json +4 -3
  53. package/src/components/Config.js +1 -0
  54. package/src/components/Config.ts +1 -0
  55. package/src/components/SVG.js +13 -0
  56. package/src/components/SVG.tsx +35 -0
  57. package/src/index.js +1 -0
  58. package/src/index.tsx +1 -0
  59. package/src/mappings/Image.js +2 -2
  60. package/src/mappings/Image.ts +2 -2
  61. package/src/mappings/MapView.js +1 -0
  62. package/src/mappings/MapView.ts +1 -0
  63. package/src/mappings/SVG.js +21 -0
  64. package/src/mappings/SVG.ts +26 -0
@@ -21,8 +21,7 @@ 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
+ /* Copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx */
26
25
  const Surface = _ref => {
27
26
  let {
28
27
  elevation: propElevation,
@@ -54,7 +53,19 @@ const Surface = _ref => {
54
53
  }
55
54
  };
56
55
 
57
- return /*#__PURE__*/React.createElement(_reactNative.Animated.View, _extends({}, rest, {
56
+ return /*#__PURE__*/React.createElement(_reactNative.Animated.View, { ...rest,
57
+ style: [{
58
+ backgroundColor: getBackgroundColor(),
59
+ elevation,
60
+ ...evalationStyles,
61
+ ...restStyle
62
+ }]
63
+ }, children);
64
+ };
65
+
66
+ var _default = (0, _theming.withTheme)(Surface);
67
+
68
+ exports.default = _default;, _extends({}, rest, {
58
69
  style: [{
59
70
  backgroundColor: getBackgroundColor(),
60
71
  elevation,
@@ -15,17 +15,7 @@ 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
-
20
- 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; }
21
-
22
18
  class Text extends React.Component {
23
- constructor() {
24
- super(...arguments);
25
-
26
- _defineProperty(this, "_root", void 0);
27
- }
28
-
29
19
  setNativeProps(args) {
30
20
  return this._root && this._root.setNativeProps(args);
31
21
  }
@@ -36,7 +26,43 @@ class Text extends React.Component {
36
26
  ...rest
37
27
  } = this.props;
38
28
  const writingDirection = _reactNative.I18nManager.isRTL ? "rtl" : "ltr";
39
- return /*#__PURE__*/React.createElement(_reactNative.Text, _extends({}, rest, {
29
+ return /*#__PURE__*/React.createElement(_reactNative.Text, { ...rest,
30
+ ref: c => {
31
+ this._root = c;
32
+ },
33
+ style: [{
34
+ textAlign: "left",
35
+ writingDirection
36
+ }, style]
37
+ });
38
+ }
39
+
40
+ }
41
+
42
+ const BaseLink = _ref => {
43
+ let {
44
+ style,
45
+ theme,
46
+ title,
47
+ ...props
48
+ } = _ref;
49
+ return /*#__PURE__*/React.createElement(Text, {
50
+ hitSlop: 8,
51
+ style: [{
52
+ color: theme.colors.primary
53
+ }, style],
54
+ theme: theme,
55
+ ...props
56
+ }, title);
57
+ };
58
+
59
+ exports.BaseLink = BaseLink;
60
+ const Link = (0, _theming.withTheme)(BaseLink);
61
+ exports.Link = Link;
62
+
63
+ var _default = (0, _theming.withTheme)(Text);
64
+
65
+ exports.default = _default;/React.createElement(_reactNative.Text, _extends({}, rest, {
40
66
  ref: c => {
41
67
  this._root = c;
42
68
  },
@@ -17,10 +17,6 @@ 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
-
22
- 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; }
23
-
24
20
  const AnimatedText = _reactNative.Animated.createAnimatedComponent(_reactNative.Text);
25
21
 
26
22
  const FOCUS_ANIMATION_DURATION = 150;
@@ -30,8 +26,7 @@ const ICON_SIZE = 24;
30
26
  class TextField extends React.Component {
31
27
  constructor() {
32
28
  super(...arguments);
33
-
34
- _defineProperty(this, "state", {
29
+ this.state = {
35
30
  labeled: new _reactNative.Animated.Value(this.props.value || this.props.error ? 0 : 1),
36
31
  focused: false,
37
32
  placeholder: this.props.error ? this.props.placeholder : "",
@@ -39,36 +34,35 @@ class TextField extends React.Component {
39
34
  measured: false,
40
35
  width: 0
41
36
  }
42
- });
43
-
44
- _defineProperty(this, "_timer", setTimeout(() => {}, 0));
37
+ };
38
+ this._timer = setTimeout(() => {}, 0);
45
39
 
46
- _defineProperty(this, "_showPlaceholder", () => {
40
+ this._showPlaceholder = () => {
47
41
  clearTimeout(this._timer); // Set the placeholder in a delay to offset the label animation
48
42
  // If we show it immediately, they'll overlap and look ugly
49
43
 
50
44
  this._timer = setTimeout(() => this.setState({
51
45
  placeholder: this.props.placeholder
52
46
  }), 50);
53
- });
47
+ };
54
48
 
55
- _defineProperty(this, "_hidePlaceholder", () => this.setState({
49
+ this._hidePlaceholder = () => this.setState({
56
50
  placeholder: ""
57
- }));
51
+ });
58
52
 
59
- _defineProperty(this, "_restoreLabel", () => _reactNative.Animated.timing(this.state.labeled, {
53
+ this._restoreLabel = () => _reactNative.Animated.timing(this.state.labeled, {
60
54
  toValue: 1,
61
55
  duration: FOCUS_ANIMATION_DURATION,
62
56
  useNativeDriver: true
63
- }).start());
57
+ }).start();
64
58
 
65
- _defineProperty(this, "_minmizeLabel", () => _reactNative.Animated.timing(this.state.labeled, {
59
+ this._minmizeLabel = () => _reactNative.Animated.timing(this.state.labeled, {
66
60
  toValue: 0,
67
61
  duration: BLUR_ANIMATION_DURATION,
68
62
  useNativeDriver: true
69
- }).start());
63
+ }).start();
70
64
 
71
- _defineProperty(this, "_handleFocus", () => {
65
+ this._handleFocus = () => {
72
66
  if (this.props.disabled) {
73
67
  return;
74
68
  }
@@ -76,9 +70,9 @@ class TextField extends React.Component {
76
70
  this.setState({
77
71
  focused: true
78
72
  });
79
- });
73
+ };
80
74
 
81
- _defineProperty(this, "_handleBlur", () => {
75
+ this._handleBlur = () => {
82
76
  if (this.props.disabled) {
83
77
  return;
84
78
  }
@@ -86,9 +80,9 @@ class TextField extends React.Component {
86
80
  this.setState({
87
81
  focused: false
88
82
  });
89
- });
83
+ };
90
84
 
91
- _defineProperty(this, "_handleChangeText", value => {
85
+ this._handleChangeText = value => {
92
86
  if (this.props.disabled) {
93
87
  return;
94
88
  }
@@ -104,9 +98,9 @@ class TextField extends React.Component {
104
98
  });
105
99
  this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
106
100
  }
107
- });
101
+ };
108
102
 
109
- _defineProperty(this, "_root", undefined);
103
+ this._root = undefined;
110
104
  }
111
105
 
112
106
  static getDerivedStateFromProps(nextProps, prevState) {
@@ -157,10 +151,11 @@ class TextField extends React.Component {
157
151
  focused: !prevState.focused
158
152
  }));
159
153
  }
160
-
161
154
  /**
162
155
  * @internal
163
156
  */
157
+
158
+
164
159
  setNativeProps(args) {
165
160
  return this._root && this._root.setNativeProps(args);
166
161
  }
@@ -203,7 +198,8 @@ class TextField extends React.Component {
203
198
  roundness,
204
199
  disabledOpacity
205
200
  },
206
- render = props => /*#__PURE__*/React.createElement(_reactNative.TextInput, props),
201
+ render = props => /*#__PURE__*/React.createElement(_reactNative.TextInput, { ...props
202
+ }),
207
203
  ...rest
208
204
  } = this.props;
209
205
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
@@ -357,9 +353,9 @@ class TextField extends React.Component {
357
353
 
358
354
  return /*#__PURE__*/React.createElement(_reactNative.View, {
359
355
  style: [styles.container, styleProp]
360
- }, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
356
+ }, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
361
357
  style: leftIconStyle
362
- })) : null, /*#__PURE__*/React.createElement(_reactNative.View, {
358
+ }) : null, /*#__PURE__*/React.createElement(_reactNative.View, {
363
359
  style: (0, _utilities.applyStyles)([containerStyle], {
364
360
  height: style === null || style === void 0 ? void 0 : style.height,
365
361
  backgroundColor: bgColor,
@@ -426,9 +422,9 @@ class TextField extends React.Component {
426
422
  style: {
427
423
  justifyContent: type === "solid" ? "center" : undefined
428
424
  }
429
- }, /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
425
+ }, /*#__PURE__*/React.createElement(Icon, { ...leftIconProps,
430
426
  style: leftIconStyle
431
- }))) : null, render({
427
+ })) : null, render({
432
428
  ref: c => {
433
429
  this._root = c;
434
430
  },
@@ -469,6 +465,43 @@ var _default = (0, _theming.withTheme)(TextField);
469
465
 
470
466
  exports.default = _default;
471
467
 
468
+ const styles = _reactNative.StyleSheet.create({
469
+ container: {
470
+ alignSelf: "stretch"
471
+ },
472
+ placeholder: {
473
+ position: "absolute",
474
+ left: 0
475
+ },
476
+ underline: {
477
+ position: "absolute",
478
+ left: 0,
479
+ right: 0,
480
+ bottom: 0,
481
+ height: 2
482
+ },
483
+ input: {
484
+ flexGrow: 1,
485
+ justifyContent: "center",
486
+ textAlignVertical: "center",
487
+ margin: 0,
488
+ textAlign: _reactNative.I18nManager.isRTL ? "right" : "left"
489
+ }
490
+ });? /*#__PURE__*/React.createElement(_reactNative.Text, {
491
+ style: [{
492
+ color: error ? colors.error : colors.light,
493
+ marginTop: 8,
494
+ marginLeft: assistiveTextLeftMargin
495
+ }]
496
+ }, assistiveText) : null);
497
+ }
498
+
499
+ }
500
+
501
+ var _default = (0, _theming.withTheme)(TextField);
502
+
503
+ exports.default = _default;
504
+
472
505
  const styles = _reactNative.StyleSheet.create({
473
506
  container: {
474
507
  alignSelf: "stretch"
@@ -11,8 +11,6 @@ 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
-
16
14
  function Touchable(_ref) {
17
15
  let {
18
16
  children,
@@ -21,6 +19,22 @@ function Touchable(_ref) {
21
19
  style,
22
20
  ...props
23
21
  } = _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;
24
38
  return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
25
39
  onPress: onPress,
26
40
  disabled: disabled,
@@ -291,6 +291,12 @@ Object.defineProperty(exports, "RowHeadlineImageIcon", {
291
291
  return _RowHeadlineImageIcon.default;
292
292
  }
293
293
  });
294
+ Object.defineProperty(exports, "SVG", {
295
+ enumerable: true,
296
+ get: function () {
297
+ return _SVG.default;
298
+ }
299
+ });
294
300
  Object.defineProperty(exports, "ScreenContainer", {
295
301
  enumerable: true,
296
302
  get: function () {
@@ -442,6 +448,8 @@ var _IconButton = _interopRequireDefault(require("./components/IconButton"));
442
448
 
443
449
  var _Image = _interopRequireDefault(require("./components/Image"));
444
450
 
451
+ var _SVG = _interopRequireDefault(require("./components/SVG"));
452
+
445
453
  var _NumberInput = _interopRequireDefault(require("./components/NumberInput"));
446
454
 
447
455
  var _ScreenContainer = _interopRequireDefault(require("./components/ScreenContainer"));
@@ -14,8 +14,8 @@ const SEED_DATA = {
14
14
  category: _types.COMPONENT_TYPES.media,
15
15
  stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
16
16
  layout: {
17
- width: 250,
18
- height: 250
17
+ width: 100,
18
+ height: 100
19
19
  },
20
20
  props: {
21
21
  source: (0, _types.createImageProp)(),
@@ -61,6 +61,7 @@ const SEED_DATA = {
61
61
  label: "Map Type",
62
62
  description: "The type of map to show",
63
63
  group: _types.GROUPS.basic,
64
+ editable: true,
64
65
  formType: _types.FORM_TYPES.flatArray,
65
66
  propType: _types.PROP_TYPES.STRING,
66
67
  required: false,
@@ -0,0 +1,25 @@
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: "SVG",
12
+ tag: "SVG",
13
+ description: "An SVG component",
14
+ packageName: "@draftbit/core",
15
+ category: _types.COMPONENT_TYPES.media,
16
+ layout: {
17
+ width: 100,
18
+ height: 100
19
+ },
20
+ stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
21
+ props: {
22
+ source: (0, _types.createSvgProp)()
23
+ }
24
+ };
25
+ exports.SEED_DATA = SEED_DATA;
@@ -54,6 +54,7 @@ export default {
54
54
  width: size.width,
55
55
  height: size.height
56
56
  }, "image-placeholder_1"),
57
+ placeholderSvgURL: "https://static.draftbit.com/images/placeholder-image.svg",
57
58
  squareImageUrl: buildImageUrl({
58
59
  width: 100,
59
60
  height: 100
@@ -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 { View, StyleSheet } from "react-native";
5
3
  import omit from "lodash.omit";
@@ -10,8 +8,6 @@ import TextField from "../TextField";
10
8
  import Touchable from "../Touchable";
11
9
 
12
10
  const Picker = _ref => {
13
- var _options$find$label, _options$find;
14
-
15
11
  let {
16
12
  style,
17
13
  options,
@@ -21,6 +17,9 @@ const Picker = _ref => {
21
17
  onValueChange: onValueChangeOverride = () => {},
22
18
  ...props
23
19
  } = _ref;
20
+
21
+ var _a, _b;
22
+
24
23
  const {
25
24
  viewStyles: {
26
25
  borderRadius,
@@ -67,7 +66,7 @@ const Picker = _ref => {
67
66
  };
68
67
 
69
68
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
70
- const selectedLabel = selectedValue && ((_options$find$label = (_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) !== null && _options$find$label !== void 0 ? _options$find$label : selectedValue);
69
+ const selectedLabel = selectedValue && ((_b = (_a = options.find(o => o.value === selectedValue)) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : selectedValue);
71
70
  return /*#__PURE__*/React.createElement(Touchable, {
72
71
  disabled: disabled,
73
72
  onPress: toggleFocus,
@@ -89,6 +88,25 @@ const Picker = _ref => {
89
88
  label: o.label,
90
89
  value: o.value,
91
90
  key: o.value
91
+ }))), /*#__PURE__*/React.createElement(View, {
92
+ pointerEvents: "none"
93
+ }, /*#__PURE__*/React.createElement(TextField, { ...props,
94
+ value: selectedLabel,
95
+ placeholder: placeholder,
96
+ // @ts-ignore
97
+ ref: textField,
98
+ disabled: disabled,
99
+ // @ts-expect-error
100
+ style: stylesWithoutMargin
101
+ }))));
102
+ };
103
+
104
+ const styles = StyleSheet.create({
105
+ container: {
106
+ alignSelf: "stretch"
107
+ }
108
+ });
109
+ export default withTheme(Picker); key: o.value
92
110
  }))), /*#__PURE__*/React.createElement(View, {
93
111
  pointerEvents: "none"
94
112
  }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
@@ -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 React, { Component } from "react";
6
2
  import { Animated, Easing, View, I18nManager } from "react-native";
7
3
  const INDETERMINATE_WIDTH_FACTOR = 0.3;
@@ -10,7 +6,7 @@ export default class ProgressBar extends Component {
10
6
  constructor(props) {
11
7
  super(props);
12
8
 
13
- _defineProperty(this, "handleLayout", event => {
9
+ this.handleLayout = event => {
14
10
  const {
15
11
  width = 150,
16
12
  onLayout
@@ -25,7 +21,7 @@ export default class ProgressBar extends Component {
25
21
  if (onLayout) {
26
22
  onLayout(event);
27
23
  }
28
- });
24
+ };
29
25
 
30
26
  const {
31
27
  progress: progressP = 0,
@@ -79,7 +75,6 @@ export default class ProgressBar extends Component {
79
75
  Animated[animationType](this.state.progress, { ...animationConfig,
80
76
  toValue: progress,
81
77
  velocity: 0,
82
- //adjust this value if animation fails - velocity is required
83
78
  useNativeDriver
84
79
  }).start();
85
80
  } else {
@@ -150,6 +145,27 @@ export default class ProgressBar extends Component {
150
145
  })
151
146
  }]
152
147
  };
148
+ return /*#__PURE__*/React.createElement(View, {
149
+ style: [containerStyle, style],
150
+ onLayout: this.handleLayout,
151
+ ...restProps
152
+ }, /*#__PURE__*/React.createElement(Animated.View, {
153
+ style: progressStyle
154
+ }), children);
155
+ }
156
+
157
+ }te.progress.interpolate({
158
+ inputRange: [0, 1],
159
+ outputRange: [innerWidth / (I18nManager.isRTL ? 2 : -2), 0]
160
+ })
161
+ }, {
162
+ // Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278
163
+ scaleX: this.state.progress.interpolate({
164
+ inputRange: [0, 1],
165
+ outputRange: [0.0001, 1]
166
+ })
167
+ }]
168
+ };
153
169
  return /*#__PURE__*/React.createElement(View, _extends({
154
170
  style: [containerStyle, style],
155
171
  onLayout: this.handleLayout
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ import { View, Platform, Image } from "react-native";
3
+ import { SvgUri } from "react-native-svg";
4
+ import Config from "./Config";
5
+
6
+ const SVG = _ref => {
7
+ let {
8
+ source = Config.placeholderSvgURL,
9
+ style
10
+ } = _ref;
11
+ return /*#__PURE__*/React.createElement(React.Fragment, null, Platform.OS === "ios" && /*#__PURE__*/React.createElement(View, {
12
+ style: style
13
+ }, /*#__PURE__*/React.createElement(SvgUri, {
14
+ width: "100%",
15
+ height: "100%",
16
+ uri: source
17
+ })), Platform.OS === "android" && /*#__PURE__*/React.createElement(View, {
18
+ style: style
19
+ }, /*#__PURE__*/React.createElement(SvgUri, {
20
+ width: "100%",
21
+ height: "100%",
22
+ uri: source
23
+ })), Platform.OS === "web" && /*#__PURE__*/React.createElement(Image, {
24
+ style: style,
25
+ source: {
26
+ uri: source
27
+ }
28
+ }));
29
+ };
30
+
31
+ export default SVG;
@@ -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
  /* Copied from https://github.com/callstack/react-native-paper/blob/main/src/components/Surface.tsx */
4
2
  import * as React from "react";
5
3
  import { Animated, StyleSheet } from "react-native";
@@ -38,6 +36,22 @@ const Surface = _ref => {
38
36
  }
39
37
  };
40
38
 
39
+ return /*#__PURE__*/React.createElement(Animated.View, { ...rest,
40
+ style: [{
41
+ backgroundColor: getBackgroundColor(),
42
+ elevation,
43
+ ...evalationStyles,
44
+ ...restStyle
45
+ }]
46
+ }, children);
47
+ };
48
+
49
+ export default withTheme(Surface); overlay(elevation, colors.surface);
50
+ } else {
51
+ return colors.surface;
52
+ }
53
+ };
54
+
41
55
  return /*#__PURE__*/React.createElement(Animated.View, _extends({}, rest, {
42
56
  style: [{
43
57
  backgroundColor: getBackgroundColor(),
@@ -17,6 +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 SVG } from "./components/SVG";
20
21
  export { default as NumberInput } from "./components/NumberInput";
21
22
  export { default as ScreenContainer } from "./components/ScreenContainer";
22
23
  export { default as StarRating } from "./components/StarRating";
@@ -6,8 +6,8 @@ export const SEED_DATA = {
6
6
  category: COMPONENT_TYPES.media,
7
7
  stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Position, StylesPanelSections.Effects],
8
8
  layout: {
9
- width: 250,
10
- height: 250
9
+ width: 100,
10
+ height: 100
11
11
  },
12
12
  props: {
13
13
  source: createImageProp(),
@@ -53,6 +53,7 @@ export const SEED_DATA = {
53
53
  label: "Map Type",
54
54
  description: "The type of map to show",
55
55
  group: GROUPS.basic,
56
+ editable: true,
56
57
  formType: FORM_TYPES.flatArray,
57
58
  propType: PROP_TYPES.STRING,
58
59
  required: false,
@@ -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
+ };
@@ -13,6 +13,7 @@ declare const _default: {
13
13
  width: number;
14
14
  height: number;
15
15
  }) => string;
16
+ placeholderSvgURL: string;
16
17
  squareImageUrl: string;
17
18
  FABSize: number;
18
19
  FABBorderRadius: number;
@@ -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,6 +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 SVG } from "./components/SVG";
20
21
  export { default as NumberInput } from "./components/NumberInput";
21
22
  export { default as ScreenContainer } from "./components/ScreenContainer";
22
23
  export { default as StarRating } from "./components/StarRating";
@@ -56,6 +56,7 @@ export declare const SEED_DATA: {
56
56
  label: string;
57
57
  description: string;
58
58
  group: string;
59
+ editable: boolean;
59
60
  formType: string;
60
61
  propType: string;
61
62
  required: boolean;