@draftbit/core 46.7.1 → 46.7.3

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 (55) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +23 -4
  2. package/lib/commonjs/components/AnimatedCircularProgress.js +12 -1
  3. package/lib/commonjs/components/AvatarEdit.js +15 -4
  4. package/lib/commonjs/components/Button.js +33 -10
  5. package/lib/commonjs/components/CardBlock.js +13 -4
  6. package/lib/commonjs/components/CardContainer.js +13 -4
  7. package/lib/commonjs/components/Checkbox/Checkbox.js +22 -4
  8. package/lib/commonjs/components/Container.js +15 -4
  9. package/lib/commonjs/components/DeprecatedButton.js +20 -3
  10. package/lib/commonjs/components/DeprecatedCardWrapper.js +15 -1
  11. package/lib/commonjs/components/Divider.js +14 -1
  12. package/lib/commonjs/components/Image.js +17 -2
  13. package/lib/commonjs/components/Picker/Picker.js +9 -4
  14. package/lib/commonjs/components/Portal/PortalHost.js +44 -15
  15. package/lib/commonjs/components/Portal/PortalManager.js +34 -8
  16. package/lib/commonjs/components/ProgressBar.js +37 -7
  17. package/lib/commonjs/components/Slider.js +21 -4
  18. package/lib/commonjs/components/Surface.js +14 -2
  19. package/lib/commonjs/components/TextField.js +76 -28
  20. package/lib/commonjs/components/Touchable.js +15 -2
  21. package/lib/commonjs/constants.js +1 -1
  22. package/lib/commonjs/hooks.js +1 -2
  23. package/lib/commonjs/mappings/StarRating.js +6 -2
  24. package/lib/commonjs/utilities.js +1 -2
  25. package/lib/module/components/Accordion/AccordionItem.js +4 -25
  26. package/lib/module/components/Button.js +33 -10
  27. package/lib/module/components/CardBlock.js +14 -4
  28. package/lib/module/components/CardContainerRating.js +14 -4
  29. package/lib/module/components/CardContainerShortImage.js +18 -4
  30. package/lib/module/components/Checkbox/CheckboxGroupRow.js +24 -5
  31. package/lib/module/components/Checkbox/context.js +1 -1
  32. package/lib/module/components/CircleImage.js +16 -1
  33. package/lib/module/components/DeprecatedCardWrapper.js +18 -1
  34. package/lib/module/components/Divider.js +18 -1
  35. package/lib/module/components/Elevation.js +14 -2
  36. package/lib/module/components/FieldSearchBarFull.js +1 -2
  37. package/lib/module/components/FormRow.js +17 -2
  38. package/lib/module/components/Image.js +18 -2
  39. package/lib/module/components/Layout.js +42 -21
  40. package/lib/module/components/NumberInput.js +12 -3
  41. package/lib/module/components/Picker/PickerComponent.ios.js +36 -11
  42. package/lib/module/components/Portal/PortalConsumer.js +22 -7
  43. package/lib/module/components/RadioButton/RadioButton.js +13 -1
  44. package/lib/module/components/RadioButton/RadioButtonGroup.js +16 -2
  45. package/lib/module/components/RadioButton/RadioButtonRow.js +24 -5
  46. package/lib/module/components/Slider.js +21 -4
  47. package/lib/module/components/StepIndicator.js +58 -18
  48. package/lib/module/components/TextField.js +78 -28
  49. package/lib/module/components/ToggleButton.js +16 -2
  50. package/lib/module/components/Touchable.js +15 -2
  51. package/lib/module/constants.js +1 -2
  52. package/lib/module/mappings/FieldSearchBarFull.js +4 -1
  53. package/lib/module/styles/overlay.js +1 -3
  54. package/lib/module/utilities.js +1 -2
  55. package/package.json +3 -3
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { View, StyleSheet } from "react-native";
4
3
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -11,7 +10,6 @@ import TextField from "../TextField";
11
10
  import Touchable from "../Touchable";
12
11
  import { extractStyles } from "../../utilities";
13
12
  const Picker = _ref => {
14
- var _options$find$label, _options$find;
15
13
  let {
16
14
  Icon,
17
15
  style,
@@ -25,6 +23,7 @@ const Picker = _ref => {
25
23
  },
26
24
  ...props
27
25
  } = _ref;
26
+ var _a, _b;
28
27
  const {
29
28
  viewStyles: {
30
29
  borderRadius,
@@ -65,26 +64,24 @@ const Picker = _ref => {
65
64
  };
66
65
 
67
66
  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);
67
+ 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);
69
68
  return /*#__PURE__*/React.createElement(View, {
70
69
  style: [styles.container, viewStyles]
71
70
  }, /*#__PURE__*/React.createElement(Touchable, {
72
71
  disabled: disabled,
73
72
  onPress: toggleVisibility
74
- }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
73
+ }, /*#__PURE__*/React.createElement(TextField, {
74
+ ...props,
75
75
  value: String(selectedLabel),
76
- placeholder: placeholder
76
+ placeholder: placeholder,
77
77
  // @ts-ignore
78
- ,
79
- ref: textField // cannot determine if ref is of correct type due to component being wrapped in a withTheme()
80
- ,
78
+ ref: textField,
81
79
  disabled: disabled,
82
- pointerEvents: "none"
80
+ pointerEvents: "none",
83
81
  // @ts-expect-error
84
- ,
85
82
  style: stylesWithoutMargin,
86
83
  Icon: Icon
87
- }))), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
84
+ })), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
88
85
  style: [styles.picker, {
89
86
  backgroundColor: colors.divider
90
87
  }]
@@ -128,4 +125,32 @@ const styles = StyleSheet.create({
128
125
  alignSelf: "flex-end"
129
126
  }
130
127
  });
128
+ export default withTheme(Picker);nValueChange
129
+ }, options.map(o => /*#__PURE__*/React.createElement(NativePicker.Item, {
130
+ label: o.label,
131
+ value: o.value,
132
+ key: o.value
133
+ })))))));
134
+ };
135
+ const styles = StyleSheet.create({
136
+ container: {
137
+ alignSelf: "stretch"
138
+ },
139
+ picker: {
140
+ position: "absolute",
141
+ bottom: 0,
142
+ left: 0,
143
+ right: 0,
144
+ flexDirection: "row",
145
+ justifyContent: "center"
146
+ },
147
+ pickerContainer: {
148
+ backgroundColor: "white",
149
+ flexDirection: "column",
150
+ width: "100%"
151
+ },
152
+ closeButton: {
153
+ alignSelf: "flex-end"
154
+ }
155
+ });
131
156
  export default withTheme(Picker);
@@ -1,14 +1,29 @@
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); }
4
1
  import * as React from "react";
5
2
  export default class PortalConsumer extends React.Component {
6
- constructor() {
7
- super(...arguments);
8
- _defineProperty(this, "key", void 0);
9
- }
10
3
  async componentDidMount() {
11
4
  this.checkManager();
5
+ // Delay updating to prevent React from going to infinite loop
6
+ await Promise.resolve();
7
+ this.key = this.props.manager.mount(this.props.children);
8
+ }
9
+ componentDidUpdate() {
10
+ this.checkManager();
11
+ this.props.manager.update(this.key, this.props.children);
12
+ }
13
+ componentWillUnmount() {
14
+ this.checkManager();
15
+ this.props.manager.unmount(this.key);
16
+ }
17
+ checkManager() {
18
+ if (!this.props.manager) {
19
+ throw new Error("Looks like you forgot to wrap your root component with `Provider` component from `react-native-paper`.\n\n" + "Please read our getting-started guide and make sure you've followed all the required steps.\n\n" + "https://callstack.github.io/react-native-paper/getting-started.html");
20
+ }
21
+ }
22
+ render() {
23
+ return null;
24
+ }
25
+ }sync componentDidMount() {
26
+ this.checkManager();
12
27
 
13
28
  // Delay updating to prevent React from going to infinite loop
14
29
  await Promise.resolve();
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import Config from "../Config";
4
3
  import IconButton from "../IconButton";
@@ -30,6 +29,19 @@ const RadioButton = _ref => {
30
29
  onPress === null || onPress === void 0 ? void 0 : onPress(realValue);
31
30
  onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(realValue);
32
31
  };
32
+ return /*#__PURE__*/React.createElement(IconButton, {
33
+ Icon: Icon,
34
+ icon: isSelected ? selectedIcon : unselectedIcon,
35
+ color: isSelected ? color : unselectedColor,
36
+ disabled: disabled,
37
+ onPress: handlePress,
38
+ size: size,
39
+ style: style,
40
+ ...rest
41
+ });
42
+ };
43
+ export default RadioButton;: onValueChange(realValue);
44
+ };
33
45
  return /*#__PURE__*/React.createElement(IconButton, _extends({
34
46
  Icon: Icon,
35
47
  icon: isSelected ? selectedIcon : unselectedIcon,
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { View } from "react-native";
4
3
  import { getValueForRadioButton } from "../../utilities";
@@ -42,7 +41,22 @@ const RadioButtonGroup = _ref => {
42
41
  alignItems: "center"
43
42
  });
44
43
  }
45
- return /*#__PURE__*/React.createElement(View, _extends({
44
+ return /*#__PURE__*/React.createElement(View, {
45
+ style: [{
46
+ minHeight: 40
47
+ }, style],
48
+ ...rest
49
+ }, /*#__PURE__*/React.createElement(Provider, {
50
+ value: {
51
+ value: internalValue,
52
+ onValueChange: handleValueChange,
53
+ direction
54
+ }
55
+ }, /*#__PURE__*/React.createElement(View, {
56
+ style: _containerStyle
57
+ }, children)));
58
+ };
59
+ export default RadioButtonGroup;xtends({
46
60
  style: [{
47
61
  minHeight: 40
48
62
  }, style]
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { StyleSheet, View, Platform } from "react-native";
4
3
  import RadioButton from "./RadioButton";
@@ -7,7 +6,7 @@ import { useRadioButtonGroupContext } from "./context";
7
6
  import { Direction as GroupDirection } from "./context";
8
7
  import Touchable from "../Touchable";
9
8
  import { extractStyles, getValueForRadioButton } from "../../utilities";
10
- export let Direction;
9
+ export var Direction;
11
10
  (function (Direction) {
12
11
  Direction["Row"] = "row";
13
12
  Direction["RowReverse"] = "row-reverse";
@@ -63,13 +62,14 @@ const RadioButtonRow = _ref => {
63
62
  textStyles,
64
63
  viewStyles
65
64
  } = extractStyles(style);
66
- return /*#__PURE__*/React.createElement(Touchable, _extends({
65
+ return /*#__PURE__*/React.createElement(Touchable, {
67
66
  onPress: handlePress,
68
67
  style: [styles.mainParent, {
69
68
  flexDirection: direction
70
69
  }, viewStyles],
71
- disabled: disabled
72
- }, rest), /*#__PURE__*/React.createElement(View, {
70
+ disabled: disabled,
71
+ ...rest
72
+ }, /*#__PURE__*/React.createElement(View, {
73
73
  style: [styles.label, {
74
74
  alignItems: direction === Direction.Row ? "flex-start" : "flex-end"
75
75
  }, labelContainerStyle]
@@ -106,4 +106,23 @@ const styles = StyleSheet.create({
106
106
  flex: 3
107
107
  }
108
108
  });
109
+ export default RadioButtonRow;.create({
110
+ mainParent: {
111
+ alignItems: "center",
112
+ justifyContent: "space-around",
113
+ paddingStart: 20,
114
+ minHeight: 50,
115
+ paddingEnd: 20,
116
+ display: "flex",
117
+ ...Platform.select({
118
+ web: {
119
+ cursor: "pointer",
120
+ userSelect: "none"
121
+ }
122
+ })
123
+ },
124
+ label: {
125
+ flex: 3
126
+ }
127
+ });
109
128
  export default RadioButtonRow;
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { View, StyleSheet } from "react-native";
4
3
  import NativeSlider from "@react-native-community/slider";
@@ -64,9 +63,10 @@ function Slider(_ref) {
64
63
  setInternalValue(newValue);
65
64
  onValueChange(newValue);
66
65
  };
67
- return /*#__PURE__*/React.createElement(View, _extends({
68
- style: [styles.container, style]
69
- }, rest), leftIcon ? /*#__PURE__*/React.createElement(Icon, {
66
+ return /*#__PURE__*/React.createElement(View, {
67
+ style: [styles.container, style],
68
+ ...rest
69
+ }, leftIcon ? /*#__PURE__*/React.createElement(Icon, {
70
70
  color: leftIconThemeColor,
71
71
  name: leftIcon,
72
72
  size: 24
@@ -98,4 +98,21 @@ const styles = StyleSheet.create({
98
98
  marginHorizontal: 12
99
99
  }
100
100
  });
101
+ export default withTheme(Slider);Icon ? /*#__PURE__*/React.createElement(Icon, {
102
+ color: rightIconThemeColor,
103
+ name: rightIcon,
104
+ size: 24
105
+ }) : null);
106
+ }
107
+ const styles = StyleSheet.create({
108
+ container: {
109
+ height: 40,
110
+ flexDirection: "row",
111
+ alignItems: "center"
112
+ },
113
+ slider: {
114
+ flex: 1,
115
+ marginHorizontal: 12
116
+ }
117
+ });
101
118
  export default withTheme(Slider);
@@ -1,6 +1,3 @@
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); }
4
1
  // @ts-nocheck
5
2
  import React, { Component } from "react";
6
3
  import { View, Text, StyleSheet, Animated, TouchableWithoutFeedback } from "react-native";
@@ -12,7 +9,7 @@ const STEP_STATUS = {
12
9
  export default class StepIndicator extends Component {
13
10
  constructor(props) {
14
11
  super(props);
15
- _defineProperty(this, "renderProgressBarBackground", () => {
12
+ this.renderProgressBarBackground = () => {
16
13
  const {
17
14
  stepCount,
18
15
  direction
@@ -55,8 +52,8 @@ export default class StepIndicator extends Component {
55
52
  },
56
53
  style: progressBarBackgroundStyle
57
54
  });
58
- });
59
- _defineProperty(this, "renderProgressBar", () => {
55
+ };
56
+ this.renderProgressBar = () => {
60
57
  const {
61
58
  stepCount,
62
59
  direction
@@ -86,8 +83,8 @@ export default class StepIndicator extends Component {
86
83
  return /*#__PURE__*/React.createElement(Animated.View, {
87
84
  style: progressBarStyle
88
85
  });
89
- });
90
- _defineProperty(this, "renderStepIndicator", () => {
86
+ };
87
+ this.renderStepIndicator = () => {
91
88
  let steps = [];
92
89
  const {
93
90
  stepCount,
@@ -118,8 +115,8 @@ export default class StepIndicator extends Component {
118
115
  height: this.state.customStyles.currentStepIndicatorSize
119
116
  }]
120
117
  }, steps);
121
- });
122
- _defineProperty(this, "renderStepLabels", () => {
118
+ };
119
+ this.renderStepLabels = () => {
123
120
  const {
124
121
  labels,
125
122
  direction,
@@ -161,8 +158,8 @@ export default class StepIndicator extends Component {
161
158
  alignItems: this.state.customStyles.labelAlign
162
159
  }]
163
160
  }, labelViews);
164
- });
165
- _defineProperty(this, "renderStep", position => {
161
+ };
162
+ this.renderStep = position => {
166
163
  const {
167
164
  renderStepIndicator
168
165
  } = this.props;
@@ -229,8 +226,8 @@ export default class StepIndicator extends Component {
229
226
  }) : /*#__PURE__*/React.createElement(Text, {
230
227
  style: indicatorLabelStyle
231
228
  }, "".concat(position + 1)));
232
- });
233
- _defineProperty(this, "getStepStatus", stepPosition => {
229
+ };
230
+ this.getStepStatus = stepPosition => {
234
231
  const {
235
232
  currentPosition
236
233
  } = this.props;
@@ -241,8 +238,8 @@ export default class StepIndicator extends Component {
241
238
  } else {
242
239
  return STEP_STATUS.UNFINISHED;
243
240
  }
244
- });
245
- _defineProperty(this, "onCurrentPositionChanged", position => {
241
+ };
242
+ this.onCurrentPositionChanged = position => {
246
243
  let {
247
244
  stepCount
248
245
  } = this.props;
@@ -262,7 +259,7 @@ export default class StepIndicator extends Component {
262
259
  toValue: this.state.customStyles.currentStepIndicatorSize / 2,
263
260
  duration: 100
264
261
  })])]).start();
265
- });
262
+ };
266
263
  const defaultStyles = {
267
264
  stepIndicatorSize: 30,
268
265
  currentStepIndicatorSize: 40,
@@ -328,7 +325,6 @@ export default class StepIndicator extends Component {
328
325
  // ),
329
326
  // }));
330
327
  // }
331
-
332
328
  if (prevProps.currentPosition !== this.props.currentPosition) {
333
329
  this.onCurrentPositionChanged(this.props.currentPosition);
334
330
  }
@@ -369,6 +365,50 @@ const styles = StyleSheet.create({
369
365
  justifyContent: "center"
370
366
  }
371
367
  });
368
+ StepIndicator.defaultProps = {
369
+ currentPosition: 0,
370
+ stepCount: 5,
371
+ customStyles: {},
372
+ direction: "horizontal"
373
+ };rrentPositionChanged(this.props.currentPosition);
374
+ }
375
+ }
376
+ }
377
+ const styles = StyleSheet.create({
378
+ container: {
379
+ backgroundColor: "transparent"
380
+ },
381
+ stepIndicatorContainer: {
382
+ flexDirection: "row",
383
+ alignItems: "center",
384
+ justifyContent: "space-around",
385
+ backgroundColor: "transparent"
386
+ },
387
+ stepLabelsContainer: {
388
+ justifyContent: "space-around"
389
+ },
390
+ step: {
391
+ alignItems: "center",
392
+ justifyContent: "center",
393
+ zIndex: 2
394
+ },
395
+ stepContainer: {
396
+ flex: 1,
397
+ flexDirection: "row",
398
+ alignItems: "center",
399
+ justifyContent: "center"
400
+ },
401
+ stepLabel: {
402
+ fontSize: 12,
403
+ textAlign: "center",
404
+ fontWeight: "500"
405
+ },
406
+ stepLabelItem: {
407
+ flex: 1,
408
+ alignItems: "center",
409
+ justifyContent: "center"
410
+ }
411
+ });
372
412
  StepIndicator.defaultProps = {
373
413
  currentPosition: 0,
374
414
  stepCount: 5,
@@ -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
- 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; }
3
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
4
- 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); }
5
1
  import * as React from "react";
6
2
  import { View, Animated, TextInput as NativeTextInput, StyleSheet, Text, I18nManager } from "react-native";
7
3
  import { withTheme } from "../theming";
@@ -13,7 +9,7 @@ const ICON_SIZE = 24;
13
9
  class TextField extends React.Component {
14
10
  constructor() {
15
11
  super(...arguments);
16
- _defineProperty(this, "state", {
12
+ this.state = {
17
13
  nativeProps: {},
18
14
  labeled: new Animated.Value(this.props.value || this.props.error ? 0 : 1),
19
15
  focused: false,
@@ -22,47 +18,46 @@ class TextField extends React.Component {
22
18
  measured: false,
23
19
  width: 0
24
20
  }
25
- });
26
- _defineProperty(this, "_timer", setTimeout(() => {}, 0));
27
- _defineProperty(this, "_showPlaceholder", () => {
21
+ };
22
+ this._timer = setTimeout(() => {}, 0);
23
+ this._showPlaceholder = () => {
28
24
  clearTimeout(this._timer);
29
-
30
25
  // Set the placeholder in a delay to offset the label animation
31
26
  // If we show it immediately, they'll overlap and look ugly
32
27
  this._timer = setTimeout(() => this.setState({
33
28
  placeholder: this.props.placeholder
34
29
  }), 50);
35
- });
36
- _defineProperty(this, "_hidePlaceholder", () => this.setState({
30
+ };
31
+ this._hidePlaceholder = () => this.setState({
37
32
  placeholder: ""
38
- }));
39
- _defineProperty(this, "_restoreLabel", () => Animated.timing(this.state.labeled, {
33
+ });
34
+ this._restoreLabel = () => Animated.timing(this.state.labeled, {
40
35
  toValue: 1,
41
36
  duration: FOCUS_ANIMATION_DURATION,
42
37
  useNativeDriver: true
43
- }).start());
44
- _defineProperty(this, "_minmizeLabel", () => Animated.timing(this.state.labeled, {
38
+ }).start();
39
+ this._minmizeLabel = () => Animated.timing(this.state.labeled, {
45
40
  toValue: 0,
46
41
  duration: BLUR_ANIMATION_DURATION,
47
42
  useNativeDriver: true
48
- }).start());
49
- _defineProperty(this, "_handleFocus", () => {
43
+ }).start();
44
+ this._handleFocus = () => {
50
45
  if (this.props.disabled) {
51
46
  return;
52
47
  }
53
48
  this.setState({
54
49
  focused: true
55
50
  });
56
- });
57
- _defineProperty(this, "_handleBlur", () => {
51
+ };
52
+ this._handleBlur = () => {
58
53
  if (this.props.disabled) {
59
54
  return;
60
55
  }
61
56
  this.setState({
62
57
  focused: false
63
58
  });
64
- });
65
- _defineProperty(this, "_handleChangeText", value => {
59
+ };
60
+ this._handleChangeText = value => {
66
61
  if (this.props.disabled) {
67
62
  return;
68
63
  }
@@ -77,8 +72,8 @@ class TextField extends React.Component {
77
72
  });
78
73
  this.props.onChangeText && this.props.onChangeText(value.nativeEvent.text);
79
74
  }
80
- });
81
- _defineProperty(this, "_root", undefined);
75
+ };
76
+ this._root = undefined;
82
77
  }
83
78
  static getDerivedStateFromProps(nextProps, prevState) {
84
79
  return {
@@ -165,7 +160,9 @@ class TextField extends React.Component {
165
160
  roundness,
166
161
  disabledOpacity
167
162
  },
168
- render = props => /*#__PURE__*/React.createElement(NativeTextInput, props),
163
+ render = props => /*#__PURE__*/React.createElement(NativeTextInput, {
164
+ ...props
165
+ }),
169
166
  ...rest
170
167
  } = this.props;
171
168
  const MINIMIZED_LABEL_Y_OFFSET = -(typography.caption.lineHeight + 4);
@@ -305,9 +302,10 @@ class TextField extends React.Component {
305
302
  } = StyleSheet.flatten(style || {});
306
303
  return /*#__PURE__*/React.createElement(View, {
307
304
  style: [styles.container, styleProp]
308
- }, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
305
+ }, leftIconName && leftIconMode === "outset" ? /*#__PURE__*/React.createElement(Icon, {
306
+ ...leftIconProps,
309
307
  style: leftIconStyle
310
- })) : null, /*#__PURE__*/React.createElement(View, {
308
+ }) : null, /*#__PURE__*/React.createElement(View, {
311
309
  style: applyStyles([containerStyle], {
312
310
  height: style === null || style === void 0 ? void 0 : style.height,
313
311
  backgroundColor: bgColor,
@@ -375,9 +373,10 @@ class TextField extends React.Component {
375
373
  style: {
376
374
  justifyContent: type === "solid" ? "center" : undefined
377
375
  }
378
- }, /*#__PURE__*/React.createElement(Icon, _extends({}, leftIconProps, {
376
+ }, /*#__PURE__*/React.createElement(Icon, {
377
+ ...leftIconProps,
379
378
  style: leftIconStyle
380
- }))) : null, render({
379
+ })) : null, render({
381
380
  ref: c => {
382
381
  this._root = c;
383
382
  },
@@ -414,6 +413,57 @@ class TextField extends React.Component {
414
413
  }
415
414
  }
416
415
  export default withTheme(TextField);
416
+ const styles = StyleSheet.create({
417
+ container: {
418
+ alignSelf: "stretch"
419
+ },
420
+ placeholder: {
421
+ position: "absolute",
422
+ left: 0
423
+ },
424
+ underline: {
425
+ position: "absolute",
426
+ left: 0,
427
+ right: 0,
428
+ bottom: 0,
429
+ height: 2
430
+ },
431
+ input: {
432
+ flexGrow: 1,
433
+ justifyContent: "center",
434
+ textAlignVertical: "center",
435
+ margin: 0,
436
+ textAlign: I18nManager.isRTL ? "right" : "left"
437
+ }
438
+ });ionColor: activeColor,
439
+ multiline,
440
+ numberOfLines,
441
+ onFocus: this._handleFocus,
442
+ onBlur: this._handleBlur,
443
+ underlineColorAndroid: "transparent",
444
+ style: inputStyles,
445
+ ...rest,
446
+ ...this.state.nativeProps,
447
+ value: this.state.value
448
+ })), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
449
+ name: rightIconName,
450
+ size: ICON_SIZE,
451
+ color: colors.light,
452
+ style: {
453
+ position: "absolute",
454
+ right: 16,
455
+ marginTop: type === "solid" ? MINIMIZED_LABEL_FONT_SIZE + 4 : 16
456
+ }
457
+ }) : null, assistiveText ? /*#__PURE__*/React.createElement(Text, {
458
+ style: [{
459
+ color: error ? colors.error : colors.light,
460
+ marginTop: 8,
461
+ marginLeft: assistiveTextLeftMargin
462
+ }]
463
+ }, assistiveText) : null);
464
+ }
465
+ }
466
+ export default withTheme(TextField);
417
467
  const styles = StyleSheet.create({
418
468
  container: {
419
469
  alignSelf: "stretch"
@@ -1,4 +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
1
  import * as React from "react";
3
2
  import { withTheme } from "../theming";
4
3
  import { StyleSheet } from "react-native";
@@ -38,13 +37,28 @@ const ToggleButton = _ref => {
38
37
  setInternalValue(!internalValue);
39
38
  onPress(!internalValue);
40
39
  };
41
- return /*#__PURE__*/React.createElement(IconButton, _extends({
40
+ return /*#__PURE__*/React.createElement(IconButton, {
42
41
  Icon: Icon,
43
42
  icon: icon,
44
43
  size: iconSize,
45
44
  color: internalValue ? colors[color] : colors[colorSecondary],
46
45
  onPress: handlePress,
47
46
  disabled: disabled,
47
+ style: [styles.mainContainer, {
48
+ width,
49
+ height,
50
+ backgroundColor: internalValue ? colors[colorSecondary] : colors[color],
51
+ borderColor: colors[borderColor]
52
+ }, style],
53
+ ...rest
54
+ });
55
+ };
56
+ const styles = StyleSheet.create({
57
+ mainContainer: {
58
+ borderWidth: 1
59
+ }
60
+ });
61
+ export default withTheme(ToggleButton);: disabled,
48
62
  style: [styles.mainContainer, {
49
63
  width,
50
64
  height,
@@ -1,4 +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
1
  import React from "react";
3
2
  import { Pressable } from "react-native";
4
3
  export default function Touchable(_ref) {
@@ -13,8 +12,22 @@ export default function Touchable(_ref) {
13
12
  style,
14
13
  ...props
15
14
  } = _ref;
16
- return /*#__PURE__*/React.createElement(Pressable, _extends({
15
+ return /*#__PURE__*/React.createElement(Pressable, {
17
16
  disabled: disabled,
17
+ onPress: onPress,
18
+ delayLongPress: delayLongPress ? delayLongPress : 500,
19
+ hitSlop: hitSlop ? hitSlop : 8,
20
+ style: _ref2 => {
21
+ let {
22
+ pressed
23
+ } = _ref2;
24
+ return [{
25
+ opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
26
+ }, style];
27
+ },
28
+ ...props
29
+ }, children);
30
+ } disabled: disabled,
18
31
  onPress: onPress,
19
32
  delayLongPress: delayLongPress ? delayLongPress : 500,
20
33
  hitSlop: hitSlop ? hitSlop : 8,
@@ -1,8 +1,7 @@
1
1
  import { Platform } from "react-native";
2
-
3
2
  // @ts-ignore
4
3
  const expo = global.__expo;
5
- const DEFAULT_STATUSBAR_HEIGHT_EXPO = expo !== null && expo !== void 0 && expo.Constants ? expo.Constants.statusBarHeight : 0;
4
+ const DEFAULT_STATUSBAR_HEIGHT_EXPO = (expo === null || expo === void 0 ? void 0 : expo.Constants) ? expo.Constants.statusBarHeight : 0;
6
5
  export const APPROX_STATUSBAR_HEIGHT = Platform.select({
7
6
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
8
7
  ios: Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0