@draftbit/core 46.6.4 → 46.6.5-8b9fed.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/lib/commonjs/components/Carousel.js +1 -2
  2. package/lib/commonjs/components/Config.js +3 -3
  3. package/lib/commonjs/components/DatePicker/DatePicker.js +3 -3
  4. package/lib/commonjs/components/Picker/Picker.js +3 -3
  5. package/lib/commonjs/components/Picker/PickerComponent.android.js +2 -2
  6. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  7. package/lib/commonjs/components/Picker/PickerComponent.web.js +2 -2
  8. package/lib/commonjs/components/RadioButton/RadioButton.js +1 -1
  9. package/lib/commonjs/components/RadioButton/RadioButtonRow.js +1 -1
  10. package/lib/commonjs/components/StepIndicator.js +1 -1
  11. package/lib/commonjs/components/Stepper.js +2 -1
  12. package/lib/commonjs/utilities.js +1 -1
  13. package/lib/module/components/AnimatedCircularProgress.js +1 -13
  14. package/lib/module/components/Carousel.js +7 -32
  15. package/lib/module/components/Config.js +3 -3
  16. package/lib/module/components/DatePicker/DatePicker.js +3 -3
  17. package/lib/module/components/Picker/Picker.js +3 -3
  18. package/lib/module/components/Picker/PickerComponent.android.js +2 -2
  19. package/lib/module/components/Picker/PickerComponent.ios.js +2 -2
  20. package/lib/module/components/Picker/PickerComponent.web.js +3 -21
  21. package/lib/module/components/Portal/PortalConsumer.js +8 -0
  22. package/lib/module/components/RadioButton/RadioButton.js +1 -1
  23. package/lib/module/components/RadioButton/RadioButtonRow.js +1 -1
  24. package/lib/module/components/StepIndicator.js +1 -1
  25. package/lib/module/components/Stepper.js +4 -1
  26. package/lib/module/utilities.js +1 -1
  27. package/package.json +3 -3
@@ -39,7 +39,6 @@ function Pager(_ref) {
39
39
  }));
40
40
  }
41
41
  function Carousel(_ref2) {
42
- var _data$length;
43
42
  let {
44
43
  data,
45
44
  children,
@@ -49,7 +48,7 @@ function Carousel(_ref2) {
49
48
  } = _ref2;
50
49
  const [index, setIndex] = React.useState(0);
51
50
  const length = React.Children.count(children);
52
- const itemsLength = ((_data$length = data === null || data === void 0 ? void 0 : data.length) !== null && _data$length !== void 0 ? _data$length : 0) + length;
51
+ const itemsLength = ((data === null || data === void 0 ? void 0 : data.length) ?? 0) + length;
53
52
  const slides = Array.isArray(data) ? data : [];
54
53
  const {
55
54
  width,
@@ -25,13 +25,13 @@ const getFilters = options => {
25
25
  height
26
26
  } = options;
27
27
  const filters = ["c_scale", "q_auto", "dpr_auto"];
28
- if (width) filters.push("w_".concat(width));
29
- if (height) filters.push("h_".concat(height));
28
+ if (width) filters.push(`w_${width}`);
29
+ if (height) filters.push(`h_${height}`);
30
30
  return filters.join(",");
31
31
  };
32
32
  const buildImageUrl = (options, name) => {
33
33
  const filters = getFilters(options);
34
- return ["https://res.cloudinary.com/altos/image/upload", filters, "".concat(name, ".png")].join("/");
34
+ return ["https://res.cloudinary.com/altos/image/upload", filters, `${name}.png`].join("/");
35
35
  };
36
36
  const getExtension = () => {
37
37
  return _reactNative.Platform.OS === "web" ? ".svg" : ".png";
@@ -79,12 +79,12 @@ const DatePicker = _ref => {
79
79
  let newDate = getValidDate();
80
80
  if (format) return (0, _dateformat.default)(newDate, format);
81
81
  if (mode === "time") {
82
- return "".concat(newDate.toLocaleTimeString());
82
+ return `${newDate.toLocaleTimeString()}`;
83
83
  }
84
84
  if (mode === "datetime") {
85
- return "".concat(newDate.toLocaleString());
85
+ return `${newDate.toLocaleString()}`;
86
86
  }
87
- return "".concat(MONTHS[newDate.getMonth()], " ").concat(newDate.getDate(), ", ").concat(newDate.getFullYear());
87
+ return `${MONTHS[newDate.getMonth()]} ${newDate.getDate()}, ${newDate.getFullYear()}`;
88
88
  };
89
89
  const toggleVisibility = async () => {
90
90
  setPickerVisible(!pickerVisible);
@@ -46,7 +46,7 @@ const unstyledColor = "rgba(165, 173, 183, 1)";
46
46
  const disabledColor = "rgb(240, 240, 240)";
47
47
  const errorColor = "rgba(255, 69, 100, 1)";
48
48
  const Picker = _ref => {
49
- var _find$label, _find;
49
+ var _find;
50
50
  let {
51
51
  error,
52
52
  options = [],
@@ -137,7 +137,7 @@ const Picker = _ref => {
137
137
  ...extractedMarginStyles
138
138
  };
139
139
  const stylesWithoutBordersAndMargins = (0, _lodash.omit)(viewStyles, [..._utilities.borderStyleNames, ..._utilities.marginStyleNames, ...additionalBorderStyles, ...additionalMarginStyles]);
140
- 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);
140
+ const selectedLabel = internalValue && (((_find = pickerOptions.find(option => option.value === internalValue)) === null || _find === void 0 ? void 0 : _find.label) ?? internalValue);
141
141
  const labelText = label ? /*#__PURE__*/React.createElement(_reactNative.Text, {
142
142
  style: {
143
143
  textAlign: textStyles.textAlign,
@@ -220,7 +220,7 @@ const Picker = _ref => {
220
220
  style: styles.primaryTextContainer
221
221
  }, labelText, /*#__PURE__*/React.createElement(_reactNative.Text, {
222
222
  style: primaryTextStyle
223
- }, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(_Portal.default, null, /*#__PURE__*/React.createElement(_reactNative.View, {
223
+ }, String(selectedLabel ?? placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(_Portal.default, null, /*#__PURE__*/React.createElement(_reactNative.View, {
224
224
  style: [styles.iosPicker, {
225
225
  backgroundColor: colors.divider
226
226
  }]
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
17
17
  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; }
18
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
19
  const Picker = _ref => {
20
- var _options$find$label, _options$find;
20
+ var _options$find;
21
21
  let {
22
22
  style,
23
23
  options,
@@ -71,7 +71,7 @@ const Picker = _ref => {
71
71
  };
72
72
 
73
73
  const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
74
- 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);
74
+ const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
75
75
  return /*#__PURE__*/React.createElement(_Touchable.default, {
76
76
  disabled: disabled,
77
77
  onPress: toggleFocus,
@@ -20,7 +20,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
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
  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); }
22
22
  const Picker = _ref => {
23
- var _options$find$label, _options$find;
23
+ var _options$find;
24
24
  let {
25
25
  Icon,
26
26
  style,
@@ -74,7 +74,7 @@ const Picker = _ref => {
74
74
  };
75
75
 
76
76
  const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
77
- 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);
77
+ const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
78
78
  return /*#__PURE__*/React.createElement(_reactNative.View, {
79
79
  style: [styles.container, viewStyles]
80
80
  }, /*#__PURE__*/React.createElement(_Touchable.default, {
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
17
17
  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; }
18
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
19
  const Picker = _ref => {
20
- var _options$find$label, _options$find;
20
+ var _options$find;
21
21
  let {
22
22
  style,
23
23
  options,
@@ -71,7 +71,7 @@ const Picker = _ref => {
71
71
  };
72
72
 
73
73
  const stylesWithoutMargin = style && (0, _lodash.default)(_reactNative.StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
74
- 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);
74
+ const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
75
75
  return /*#__PURE__*/React.createElement(_Touchable.default, {
76
76
  disabled: disabled,
77
77
  onPress: toggleFocus,
@@ -34,7 +34,7 @@ const RadioButton = _ref => {
34
34
  } = (0, _context.useRadioButtonGroupContext)();
35
35
  const realValue = (0, _utilities.getValueForRadioButton)(value);
36
36
  const realContextValue = (0, _utilities.getValueForRadioButton)(contextValue);
37
- const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
37
+ const isSelected = selected ?? realContextValue === realValue;
38
38
  const handlePress = () => {
39
39
  onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
40
40
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
@@ -63,7 +63,7 @@ const RadioButtonRow = _ref => {
63
63
  } = (0, _context.useRadioButtonGroupContext)();
64
64
  const realValue = (0, _utilities.getValueForRadioButton)(value);
65
65
  const realContextValue = (0, _utilities.getValueForRadioButton)(contextValue);
66
- const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
66
+ const isSelected = selected ?? realContextValue === realValue;
67
67
  const handlePress = () => {
68
68
  onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
69
69
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
@@ -235,7 +235,7 @@ class StepIndicator extends _react.Component {
235
235
  stepStatus: this.getStepStatus(position)
236
236
  }) : /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
237
237
  style: indicatorLabelStyle
238
- }, "".concat(position + 1)));
238
+ }, `${position + 1}`));
239
239
  });
240
240
  _defineProperty(this, "getStepStatus", stepPosition => {
241
241
  const {
@@ -33,7 +33,7 @@ const Stepper = _ref => {
33
33
  viewStyles,
34
34
  textStyles
35
35
  } = (0, _utilities.extractStyles)(style);
36
- const [value, setValue] = (0, _react.useState)(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
36
+ const [value, setValue] = (0, _react.useState)(defaultValue ?? 0);
37
37
  const isValidValue = valueArg => valueArg >= min && valueArg <= max;
38
38
  const handlePlusOrMinus = type => {
39
39
  const newValue = type === "plus" ? value + 1 : value - 1;
@@ -82,4 +82,5 @@ const Stepper = _ref => {
82
82
  }));
83
83
  };
84
84
  var _default = (0, _theming.withTheme)(Stepper);
85
+ exports.default = _default;g.withTheme)(Stepper);
85
86
  exports.default = _default;
@@ -88,6 +88,6 @@ function getValueForRadioButton(value) {
88
88
  } else if ((0, _lodash.isNumber)(value)) {
89
89
  return String(value);
90
90
  } else {
91
- throw new Error("Invalid value: ".concat(value));
91
+ throw new Error(`Invalid value: ${value}`);
92
92
  }
93
93
  }
@@ -1,3 +1,4 @@
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); }
1
2
  import * as React from "react";
2
3
  import { Animated, Easing } from "react-native";
3
4
  import CircularProgress from "./CircularProgress";
@@ -45,19 +46,6 @@ const AnimatedCircularProgress = _ref => {
45
46
  React.useEffect(() => {
46
47
  animate();
47
48
  }, [fill, animate]);
48
- return /*#__PURE__*/React.createElement(AnimatedProgress, {
49
- ...other,
50
- style: other.style,
51
- childrenContainerStyle: other.childrenContainerStyle,
52
- fill: fillAnimation,
53
- tintColor: animateColor()
54
- });
55
- };
56
- export default AnimatedCircularProgress;imation;
57
- };
58
- React.useEffect(() => {
59
- animate();
60
- }, [fill, animate]);
61
49
  return /*#__PURE__*/React.createElement(AnimatedProgress, _extends({}, other, {
62
50
  style: other.style,
63
51
  childrenContainerStyle: other.childrenContainerStyle,
@@ -1,3 +1,4 @@
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); }
1
2
  import * as React from "react";
2
3
  import { withTheme } from "../theming";
3
4
  import { ScrollView, View, StyleSheet, Dimensions } from "react-native";
@@ -36,10 +37,9 @@ function Carousel(_ref2) {
36
37
  style,
37
38
  ...rest
38
39
  } = _ref2;
39
- var _a;
40
40
  const [index, setIndex] = React.useState(0);
41
41
  const length = React.Children.count(children);
42
- const itemsLength = ((_a = data === null || data === void 0 ? void 0 : data.length) !== null && _a !== void 0 ? _a : 0) + length;
42
+ const itemsLength = ((data === null || data === void 0 ? void 0 : data.length) ?? 0) + length;
43
43
  const slides = Array.isArray(data) ? data : [];
44
44
  const {
45
45
  width,
@@ -47,10 +47,9 @@ function Carousel(_ref2) {
47
47
  } = StyleSheet.flatten(style || {});
48
48
  const slideWidth = width || screenWidth;
49
49
  const slideHeight = height || 250;
50
- return /*#__PURE__*/React.createElement(View, {
51
- style: [styles.container, style],
52
- ...rest
53
- }, /*#__PURE__*/React.createElement(ScrollView, {
50
+ return /*#__PURE__*/React.createElement(View, _extends({
51
+ style: [styles.container, style]
52
+ }, rest), /*#__PURE__*/React.createElement(ScrollView, {
54
53
  pagingEnabled: true,
55
54
  horizontal: true,
56
55
  decelerationRate: "fast",
@@ -78,8 +77,8 @@ function Carousel(_ref2) {
78
77
  }]
79
78
  });
80
79
  }) : null, React.Children.map(children, child => {
81
- var _a;
82
- const s = ((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.style) || {};
80
+ var _child$props;
81
+ const s = (child === null || child === void 0 ? void 0 : (_child$props = child.props) === null || _child$props === void 0 ? void 0 : _child$props.style) || {};
83
82
  return /*#__PURE__*/React.createElement(View, {
84
83
  style: {
85
84
  width: slideWidth
@@ -117,28 +116,4 @@ const styles = StyleSheet.create({
117
116
  backgroundColor: "#000"
118
117
  }
119
118
  });
120
- export default withTheme(Carousel);gth
121
- }));
122
- }
123
- const styles = StyleSheet.create({
124
- container: {
125
- backgroundColor: "#eee"
126
- },
127
- pager: {
128
- position: "absolute",
129
- bottom: 12,
130
- left: 0,
131
- right: 0,
132
- flexDirection: "row",
133
- justifyContent: "center",
134
- alignItems: "center"
135
- },
136
- bullet: {
137
- marginHorizontal: 2,
138
- width: 10,
139
- height: 10,
140
- borderRadius: 20,
141
- backgroundColor: "#000"
142
- }
143
- });
144
119
  export default withTheme(Carousel);
@@ -19,13 +19,13 @@ const getFilters = options => {
19
19
  height
20
20
  } = options;
21
21
  const filters = ["c_scale", "q_auto", "dpr_auto"];
22
- if (width) filters.push("w_".concat(width));
23
- if (height) filters.push("h_".concat(height));
22
+ if (width) filters.push(`w_${width}`);
23
+ if (height) filters.push(`h_${height}`);
24
24
  return filters.join(",");
25
25
  };
26
26
  const buildImageUrl = (options, name) => {
27
27
  const filters = getFilters(options);
28
- return ["https://res.cloudinary.com/altos/image/upload", filters, "".concat(name, ".png")].join("/");
28
+ return ["https://res.cloudinary.com/altos/image/upload", filters, `${name}.png`].join("/");
29
29
  };
30
30
  const getExtension = () => {
31
31
  return Platform.OS === "web" ? ".svg" : ".png";
@@ -70,12 +70,12 @@ const DatePicker = _ref => {
70
70
  let newDate = getValidDate();
71
71
  if (format) return dateFormat(newDate, format);
72
72
  if (mode === "time") {
73
- return "".concat(newDate.toLocaleTimeString());
73
+ return `${newDate.toLocaleTimeString()}`;
74
74
  }
75
75
  if (mode === "datetime") {
76
- return "".concat(newDate.toLocaleString());
76
+ return `${newDate.toLocaleString()}`;
77
77
  }
78
- return "".concat(MONTHS[newDate.getMonth()], " ").concat(newDate.getDate(), ", ").concat(newDate.getFullYear());
78
+ return `${MONTHS[newDate.getMonth()]} ${newDate.getDate()}, ${newDate.getFullYear()}`;
79
79
  };
80
80
  const toggleVisibility = async () => {
81
81
  setPickerVisible(!pickerVisible);
@@ -37,7 +37,7 @@ const unstyledColor = "rgba(165, 173, 183, 1)";
37
37
  const disabledColor = "rgb(240, 240, 240)";
38
38
  const errorColor = "rgba(255, 69, 100, 1)";
39
39
  const Picker = _ref => {
40
- var _find$label, _find;
40
+ var _find;
41
41
  let {
42
42
  error,
43
43
  options = [],
@@ -128,7 +128,7 @@ const Picker = _ref => {
128
128
  ...extractedMarginStyles
129
129
  };
130
130
  const stylesWithoutBordersAndMargins = omit(viewStyles, [...borderStyleNames, ...marginStyleNames, ...additionalBorderStyles, ...additionalMarginStyles]);
131
- 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);
131
+ const selectedLabel = internalValue && (((_find = pickerOptions.find(option => option.value === internalValue)) === null || _find === void 0 ? void 0 : _find.label) ?? internalValue);
132
132
  const labelText = label ? /*#__PURE__*/React.createElement(Text, {
133
133
  style: {
134
134
  textAlign: textStyles.textAlign,
@@ -211,7 +211,7 @@ const Picker = _ref => {
211
211
  style: styles.primaryTextContainer
212
212
  }, labelText, /*#__PURE__*/React.createElement(Text, {
213
213
  style: primaryTextStyle
214
- }, String(selectedLabel !== null && selectedLabel !== void 0 ? selectedLabel : placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
214
+ }, String(selectedLabel ?? placeholder))), rightIcon)), assistiveTextLabel), isIos && pickerVisible ? /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
215
215
  style: [styles.iosPicker, {
216
216
  backgroundColor: colors.divider
217
217
  }]
@@ -8,7 +8,7 @@ import { extractStyles } from "../../utilities";
8
8
  import TextField from "../TextField";
9
9
  import Touchable from "../Touchable";
10
10
  const Picker = _ref => {
11
- var _options$find$label, _options$find;
11
+ var _options$find;
12
12
  let {
13
13
  style,
14
14
  options,
@@ -62,7 +62,7 @@ const Picker = _ref => {
62
62
  };
63
63
 
64
64
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
65
- 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);
65
+ const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
66
66
  return /*#__PURE__*/React.createElement(Touchable, {
67
67
  disabled: disabled,
68
68
  onPress: toggleFocus,
@@ -11,7 +11,7 @@ import TextField from "../TextField";
11
11
  import Touchable from "../Touchable";
12
12
  import { extractStyles } from "../../utilities";
13
13
  const Picker = _ref => {
14
- var _options$find$label, _options$find;
14
+ var _options$find;
15
15
  let {
16
16
  Icon,
17
17
  style,
@@ -65,7 +65,7 @@ const Picker = _ref => {
65
65
  };
66
66
 
67
67
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
68
- 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);
68
+ const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
69
69
  return /*#__PURE__*/React.createElement(View, {
70
70
  style: [styles.container, viewStyles]
71
71
  }, /*#__PURE__*/React.createElement(Touchable, {
@@ -1,3 +1,4 @@
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); }
1
2
  import * as React from "react";
2
3
  import { View, StyleSheet } from "react-native";
3
4
  import { Picker as NativePicker } from "@react-native-picker/picker";
@@ -7,6 +8,7 @@ import { extractStyles } from "../../utilities";
7
8
  import TextField from "../TextField";
8
9
  import Touchable from "../Touchable";
9
10
  const Picker = _ref => {
11
+ var _options$find;
10
12
  let {
11
13
  style,
12
14
  options,
@@ -16,7 +18,6 @@ const Picker = _ref => {
16
18
  onValueChange: onValueChangeOverride = () => {},
17
19
  ...props
18
20
  } = _ref;
19
- var _a, _b;
20
21
  const {
21
22
  viewStyles: {
22
23
  borderRadius,
@@ -61,7 +62,7 @@ const Picker = _ref => {
61
62
  };
62
63
 
63
64
  const stylesWithoutMargin = style && omit(StyleSheet.flatten(style), ["margin", "marginTop", "marginRight", "marginBottom", "marginLeft"]);
64
- 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);
65
+ const selectedLabel = selectedValue && (((_options$find = options.find(o => o.value === selectedValue)) === null || _options$find === void 0 ? void 0 : _options$find.label) ?? selectedValue);
65
66
  return /*#__PURE__*/React.createElement(Touchable, {
66
67
  disabled: disabled,
67
68
  onPress: toggleFocus,
@@ -84,25 +85,6 @@ const Picker = _ref => {
84
85
  label: o.label,
85
86
  value: o.value,
86
87
  key: o.value
87
- }))), /*#__PURE__*/React.createElement(View, {
88
- pointerEvents: "none"
89
- }, /*#__PURE__*/React.createElement(TextField, {
90
- ...props,
91
- value: selectedLabel,
92
- placeholder: placeholder,
93
- // @ts-ignore
94
- ref: textField,
95
- disabled: disabled,
96
- // @ts-expect-error
97
- style: stylesWithoutMargin
98
- }))));
99
- };
100
- const styles = StyleSheet.create({
101
- container: {
102
- alignSelf: "stretch"
103
- }
104
- });
105
- export default withTheme(Picker);y: o.value
106
88
  }))), /*#__PURE__*/React.createElement(View, {
107
89
  pointerEvents: "none"
108
90
  }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
@@ -1,7 +1,15 @@
1
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
3
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
1
4
  import * as React from "react";
2
5
  export default class PortalConsumer extends React.Component {
6
+ constructor() {
7
+ super(...arguments);
8
+ _defineProperty(this, "key", void 0);
9
+ }
3
10
  async componentDidMount() {
4
11
  this.checkManager();
12
+
5
13
  // Delay updating to prevent React from going to infinite loop
6
14
  await Promise.resolve();
7
15
  this.key = this.props.manager.mount(this.props.children);
@@ -25,7 +25,7 @@ const RadioButton = _ref => {
25
25
  } = useRadioButtonGroupContext();
26
26
  const realValue = getValueForRadioButton(value);
27
27
  const realContextValue = getValueForRadioButton(contextValue);
28
- const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
28
+ const isSelected = selected ?? realContextValue === realValue;
29
29
  const handlePress = () => {
30
30
  onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
31
31
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
@@ -54,7 +54,7 @@ const RadioButtonRow = _ref => {
54
54
  } = useRadioButtonGroupContext();
55
55
  const realValue = getValueForRadioButton(value);
56
56
  const realContextValue = getValueForRadioButton(contextValue);
57
- const isSelected = selected !== null && selected !== void 0 ? selected : realContextValue === realValue;
57
+ const isSelected = selected ?? realContextValue === realValue;
58
58
  const handlePress = () => {
59
59
  onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
60
60
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
@@ -228,7 +228,7 @@ export default class StepIndicator extends Component {
228
228
  stepStatus: this.getStepStatus(position)
229
229
  }) : /*#__PURE__*/React.createElement(Text, {
230
230
  style: indicatorLabelStyle
231
- }, "".concat(position + 1)));
231
+ }, `${position + 1}`));
232
232
  });
233
233
  _defineProperty(this, "getStepStatus", stepPosition => {
234
234
  const {
@@ -24,7 +24,7 @@ const Stepper = _ref => {
24
24
  viewStyles,
25
25
  textStyles
26
26
  } = extractStyles(style);
27
- const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : 0);
27
+ const [value, setValue] = useState(defaultValue ?? 0);
28
28
  const isValidValue = valueArg => valueArg >= min && valueArg <= max;
29
29
  const handlePlusOrMinus = type => {
30
30
  const newValue = type === "plus" ? value + 1 : value - 1;
@@ -72,4 +72,7 @@ const Stepper = _ref => {
72
72
  }
73
73
  }));
74
74
  };
75
+ export default withTheme(Stepper); }
76
+ }));
77
+ };
75
78
  export default withTheme(Stepper);
@@ -75,6 +75,6 @@ export function getValueForRadioButton(value) {
75
75
  } else if (isNumber(value)) {
76
76
  return String(value);
77
77
  } else {
78
- throw new Error("Invalid value: ".concat(value));
78
+ throw new Error(`Invalid value: ${value}`);
79
79
  }
80
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "46.6.4",
3
+ "version": "46.6.5-8b9fed.2+8b9fede",
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.6.4",
44
+ "@draftbit/types": "^46.6.5-8b9fed.2+8b9fede",
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",
@@ -91,5 +91,5 @@
91
91
  ]
92
92
  ]
93
93
  },
94
- "gitHead": "8f1d849053aaf071a68dcb102d80b96b0641bcf4"
94
+ "gitHead": "8b9fede6741c1a5842108844661f76b191111547"
95
95
  }