@draftbit/core 46.5.2-b02f9e.2 → 46.6.0

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 (143) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +23 -4
  2. package/lib/commonjs/components/AspectRatio.js +1 -17
  3. package/lib/commonjs/components/Banner.js +23 -4
  4. package/lib/commonjs/components/Button.js +36 -13
  5. package/lib/commonjs/components/CardBlock.js +4 -13
  6. package/lib/commonjs/components/CardContainer.js +13 -4
  7. package/lib/commonjs/components/CardContainerShortImage.js +15 -4
  8. package/lib/commonjs/components/Checkbox/Checkbox.js +1 -3
  9. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +17 -2
  10. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
  11. package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
  12. package/lib/commonjs/components/Container.js +15 -4
  13. package/lib/commonjs/components/DatePicker/DatePicker.js +13 -9
  14. package/lib/commonjs/components/DeprecatedButton.js +3 -27
  15. package/lib/commonjs/components/DeprecatedCardWrapper.js +15 -1
  16. package/lib/commonjs/components/DeprecatedFAB.js +3 -22
  17. package/lib/commonjs/components/Elevation.js +14 -2
  18. package/lib/commonjs/components/FAB.js +18 -4
  19. package/lib/commonjs/components/FieldSearchBarFull.js +1 -2
  20. package/lib/commonjs/components/Image.js +17 -2
  21. package/lib/commonjs/components/Layout.js +40 -19
  22. package/lib/commonjs/components/Picker/Picker.js +9 -4
  23. package/lib/commonjs/components/Picker/PickerComponent.ios.js +36 -11
  24. package/lib/commonjs/components/Picker/PickerComponent.web.js +20 -3
  25. package/lib/commonjs/components/Portal/PortalConsumer.js +7 -22
  26. package/lib/commonjs/components/Portal/PortalManager.js +34 -8
  27. package/lib/commonjs/components/Pressable.js +50 -0
  28. package/lib/commonjs/components/ProgressBar.js +37 -7
  29. package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +9 -1
  30. package/lib/commonjs/components/ScreenContainer.js +20 -4
  31. package/lib/commonjs/components/Surface.js +14 -2
  32. package/lib/commonjs/components/Swiper/Swiper.js +2 -0
  33. package/lib/commonjs/components/Switch.js +19 -10
  34. package/lib/commonjs/components/TextField.js +76 -28
  35. package/lib/commonjs/components/ToggleButton.js +15 -2
  36. package/lib/commonjs/components/Touchable.js +23 -5
  37. package/lib/commonjs/constants.js +1 -1
  38. package/lib/commonjs/index.js +7 -0
  39. package/lib/commonjs/mappings/Button.js +39 -10
  40. package/lib/commonjs/mappings/FlashList.js +45 -2
  41. package/lib/commonjs/mappings/FlatList.js +12 -0
  42. package/lib/commonjs/mappings/Swiper.js +2 -0
  43. package/lib/commonjs/mappings/Touchable.js +47 -7
  44. package/lib/commonjs/styles/overlay.js +3 -1
  45. package/lib/module/components/AvatarEdit.js +15 -4
  46. package/lib/module/components/Button.js +36 -13
  47. package/lib/module/components/Carousel.js +32 -8
  48. package/lib/module/components/Checkbox/Checkbox.js +26 -6
  49. package/lib/module/components/Checkbox/CheckboxGroup.js +16 -2
  50. package/lib/module/components/Checkbox/CheckboxGroupRow.js +25 -7
  51. package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
  52. package/lib/module/components/CircularProgress.js +28 -8
  53. package/lib/module/components/DatePicker/DatePicker.js +27 -13
  54. package/lib/module/components/DeprecatedButton.js +24 -30
  55. package/lib/module/components/DeprecatedFAB.js +2 -3
  56. package/lib/module/components/Elevation.js +14 -2
  57. package/lib/module/components/FieldSearchBarFull.js +1 -2
  58. package/lib/module/components/Image.js +18 -2
  59. package/lib/module/components/Layout.js +42 -21
  60. package/lib/module/components/NumberInput.js +12 -3
  61. package/lib/module/components/Picker/Picker.js +10 -4
  62. package/lib/module/components/Picker/PickerComponent.ios.js +36 -11
  63. package/lib/module/components/Picker/PickerComponent.web.js +21 -3
  64. package/lib/module/components/Portal/PortalConsumer.js +22 -7
  65. package/lib/module/components/Pressable.js +30 -0
  66. package/lib/module/components/RadioButton/RadioButtonRow.js +24 -5
  67. package/lib/module/components/ScreenContainer.js +21 -4
  68. package/lib/module/components/Swiper/Swiper.js +2 -0
  69. package/lib/module/components/Switch.js +21 -10
  70. package/lib/module/components/Text.js +50 -4
  71. package/lib/module/components/TextField.js +78 -28
  72. package/lib/module/components/Touchable.js +8 -3
  73. package/lib/module/constants.js +1 -2
  74. package/lib/module/index.js +1 -0
  75. package/lib/module/mappings/Button.js +40 -11
  76. package/lib/module/mappings/FieldSearchBarFull.js +4 -1
  77. package/lib/module/mappings/FlashList.js +46 -3
  78. package/lib/module/mappings/FlatList.js +13 -1
  79. package/lib/module/mappings/StarRating.js +7 -2
  80. package/lib/module/mappings/Swiper.js +3 -1
  81. package/lib/module/mappings/Touchable.js +49 -9
  82. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  83. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  84. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  85. package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
  86. package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
  87. package/lib/typescript/src/components/DeprecatedButton.d.ts +2 -2
  88. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -1
  89. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  90. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  91. package/lib/typescript/src/components/Pressable.d.ts +10 -0
  92. package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
  93. package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -1
  94. package/lib/typescript/src/components/Swiper/Swiper.d.ts.map +1 -1
  95. package/lib/typescript/src/components/Touchable.d.ts +5 -6
  96. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  97. package/lib/typescript/src/index.d.ts +1 -0
  98. package/lib/typescript/src/index.d.ts.map +1 -1
  99. package/lib/typescript/src/mappings/Button.d.ts +113 -4
  100. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  101. package/lib/typescript/src/mappings/FlashList.d.ts +112 -2
  102. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  103. package/lib/typescript/src/mappings/FlatList.d.ts +42 -0
  104. package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
  105. package/lib/typescript/src/mappings/Swiper.d.ts +11 -0
  106. package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
  107. package/lib/typescript/src/mappings/Touchable.d.ts +59 -5
  108. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
  109. package/lib/typescript/src/styles/overlay.d.ts +1 -1
  110. package/lib/typescript/src/styles/overlay.d.ts.map +1 -1
  111. package/lib/typescript/src/styles/shadow.d.ts +2 -2
  112. package/package.json +7 -7
  113. package/src/components/Button.js +3 -3
  114. package/src/components/Button.tsx +14 -4
  115. package/src/components/Checkbox/Checkbox.js +2 -3
  116. package/src/components/Checkbox/Checkbox.tsx +5 -7
  117. package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
  118. package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
  119. package/src/components/Checkbox/CheckboxRow.js +2 -3
  120. package/src/components/Checkbox/CheckboxRow.tsx +3 -3
  121. package/src/components/DeprecatedButton.js +4 -16
  122. package/src/components/DeprecatedButton.tsx +7 -31
  123. package/src/components/DeprecatedFAB.js +2 -3
  124. package/src/components/DeprecatedFAB.tsx +5 -5
  125. package/src/components/Pressable.js +12 -0
  126. package/src/components/Pressable.tsx +44 -0
  127. package/src/components/Swiper/Swiper.js +2 -2
  128. package/src/components/Swiper/Swiper.tsx +3 -0
  129. package/src/components/Touchable.js +3 -3
  130. package/src/components/Touchable.tsx +11 -7
  131. package/src/index.js +1 -0
  132. package/src/index.tsx +1 -0
  133. package/src/mappings/Button.js +39 -10
  134. package/src/mappings/Button.ts +41 -10
  135. package/src/mappings/FlashList.js +77 -31
  136. package/src/mappings/FlashList.ts +82 -30
  137. package/src/mappings/FlatList.js +13 -1
  138. package/src/mappings/FlatList.ts +16 -0
  139. package/src/mappings/Swiper.js +3 -1
  140. package/src/mappings/Swiper.ts +4 -0
  141. package/src/mappings/Touchable.js +50 -7
  142. package/src/mappings/Touchable.ts +53 -6
  143. package/src/styles/overlay.tsx +2 -2
@@ -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 { Picker as NativePicker } from "@react-native-picker/picker";
@@ -8,7 +7,6 @@ import { extractStyles } from "../../utilities";
8
7
  import TextField from "../TextField";
9
8
  import Touchable from "../Touchable";
10
9
  const Picker = _ref => {
11
- var _options$find$label, _options$find;
12
10
  let {
13
11
  style,
14
12
  options,
@@ -18,6 +16,7 @@ const Picker = _ref => {
18
16
  onValueChange: onValueChangeOverride = () => {},
19
17
  ...props
20
18
  } = _ref;
19
+ var _a, _b;
21
20
  const {
22
21
  viewStyles: {
23
22
  borderRadius,
@@ -62,7 +61,7 @@ const Picker = _ref => {
62
61
  };
63
62
 
64
63
  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);
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);
66
65
  return /*#__PURE__*/React.createElement(Touchable, {
67
66
  disabled: disabled,
68
67
  onPress: toggleFocus,
@@ -85,6 +84,25 @@ const Picker = _ref => {
85
84
  label: o.label,
86
85
  value: o.value,
87
86
  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
88
106
  }))), /*#__PURE__*/React.createElement(View, {
89
107
  pointerEvents: "none"
90
108
  }, /*#__PURE__*/React.createElement(TextField, _extends({}, props, {
@@ -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();
@@ -0,0 +1,30 @@
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
+ import React from "react";
3
+ import { Pressable as NativePressable } from "react-native";
4
+ export default function Pressable(_ref) {
5
+ let {
6
+ children,
7
+ disabled,
8
+ onPress,
9
+ activeOpacity,
10
+ disabledOpacity,
11
+ delayLongPress,
12
+ hitSlop,
13
+ style,
14
+ ...props
15
+ } = _ref;
16
+ return /*#__PURE__*/React.createElement(NativePressable, _extends({
17
+ onPress: onPress,
18
+ disabled: disabled,
19
+ delayLongPress: delayLongPress ? delayLongPress : 500,
20
+ hitSlop: hitSlop ? hitSlop : 8,
21
+ style: _ref2 => {
22
+ let {
23
+ pressed
24
+ } = _ref2;
25
+ return [{
26
+ opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
27
+ }, style];
28
+ }
29
+ }, props), children);
30
+ }
@@ -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 { StyleSheet, ScrollView, View } from "react-native";
4
3
  import { SafeAreaView } from "react-native-safe-area-context";
@@ -22,12 +21,13 @@ function ScreenContainer(_ref) {
22
21
  if (hasSafeArea || hasBottomSafeArea) {
23
22
  edges.push("bottom");
24
23
  }
25
- return /*#__PURE__*/React.createElement(SafeAreaView, _extends({
24
+ return /*#__PURE__*/React.createElement(SafeAreaView, {
26
25
  edges: edges,
27
26
  style: [styles.container, {
28
27
  backgroundColor
29
- }]
30
- }, rest), scrollable ? /*#__PURE__*/React.createElement(ScrollView, {
28
+ }],
29
+ ...rest
30
+ }, scrollable ? /*#__PURE__*/React.createElement(ScrollView, {
31
31
  contentContainerStyle: [styles.scrollViewContainer, {
32
32
  backgroundColor
33
33
  }, style]
@@ -46,4 +46,21 @@ const styles = StyleSheet.create({
46
46
  flex: undefined
47
47
  }
48
48
  });
49
+ export default withTheme(ScreenContainer);olor
50
+ }, style]
51
+ }, children) : /*#__PURE__*/React.createElement(View, {
52
+ style: [styles.container, {
53
+ backgroundColor
54
+ }, style]
55
+ }, children));
56
+ }
57
+ const styles = StyleSheet.create({
58
+ container: {
59
+ flex: 1
60
+ },
61
+ scrollViewContainer: {
62
+ flexGrow: 1,
63
+ flex: undefined
64
+ }
65
+ });
49
66
  export default withTheme(ScreenContainer);
@@ -18,6 +18,7 @@ const Swiper = _ref => {
18
18
  keyExtractor,
19
19
  renderItem,
20
20
  children,
21
+ onIndexChanged,
21
22
  style
22
23
  } = _ref;
23
24
  return /*#__PURE__*/React.createElement(View, {
@@ -27,6 +28,7 @@ const Swiper = _ref => {
27
28
  loop: loop,
28
29
  timeout: timeout,
29
30
  vertical: vertical,
31
+ onIndexChanged: onIndexChanged,
30
32
  controlsProps: {
31
33
  prevTitle,
32
34
  nextTitle,
@@ -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 { Switch as NativeSwitch } from "react-native";
4
3
  import { withTheme } from "../theming";
@@ -29,7 +28,6 @@ function Switch(_ref) {
29
28
  setChecked(value);
30
29
  }
31
30
  }, [value, checked]);
32
-
33
31
  // This special logic is to handle weird APIs like Airtable that return
34
32
  // true or undefined for a boolean
35
33
  const previousDefaultValue = usePrevious(defaultValue);
@@ -38,24 +36,24 @@ function Switch(_ref) {
38
36
  setChecked(Boolean(defaultValue));
39
37
  }
40
38
  }, [defaultValue, previousDefaultValue]);
41
- return /*#__PURE__*/React.createElement(NativeSwitch, _extends({
39
+ return /*#__PURE__*/React.createElement(NativeSwitch, {
42
40
  value: checked,
43
41
  disabled: disabled,
44
42
  trackColor: {
45
43
  false: inactiveTrackThemeColor,
46
44
  true: activeTrackThemeColor
47
45
  },
48
- thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor
46
+ thumbColor: value ? activeThumbThemeColor : inactiveThumbThemeColor,
49
47
  // @ts-ignore react-native-web only
50
- ,
51
48
  activeThumbColor: activeThumbThemeColor,
52
49
  ios_backgroundColor: inactiveTrackThemeColor,
53
50
  style: style,
54
51
  onValueChange: bool => {
55
52
  setChecked(bool);
56
53
  onValueChange && onValueChange(bool);
57
- }
58
- }, rest));
54
+ },
55
+ ...rest
56
+ });
59
57
  }
60
58
  function Row(_ref2) {
61
59
  let {
@@ -84,7 +82,7 @@ function Row(_ref2) {
84
82
  setChecked(defaultValue);
85
83
  }
86
84
  }, [defaultValue]);
87
- return /*#__PURE__*/React.createElement(FormRow, _extends({
85
+ return /*#__PURE__*/React.createElement(FormRow, {
88
86
  disabled: disabled,
89
87
  onPress: () => {
90
88
  setChecked(!checked);
@@ -92,8 +90,9 @@ function Row(_ref2) {
92
90
  },
93
91
  label: label,
94
92
  direction: direction,
95
- style: style
96
- }, rest), /*#__PURE__*/React.createElement(Switch, {
93
+ style: style,
94
+ ...rest
95
+ }, /*#__PURE__*/React.createElement(Switch, {
97
96
  theme: theme,
98
97
  value: checked,
99
98
  disabled: disabled,
@@ -106,4 +105,16 @@ function Row(_ref2) {
106
105
  }
107
106
  const SwitchRow = withTheme(Row);
108
107
  export { SwitchRow };
108
+ export default withTheme(Switch);: theme,
109
+ value: checked,
110
+ disabled: disabled,
111
+ onValueChange: onValueChange,
112
+ activeTrackColor: activeTrackColor,
113
+ inactiveTrackColor: inactiveTrackColor,
114
+ activeThumbColor: activeThumbColor,
115
+ inactiveThumbColor: inactiveThumbColor
116
+ }));
117
+ }
118
+ const SwitchRow = withTheme(Row);
119
+ export { SwitchRow };
109
120
  export default withTheme(Switch);
@@ -1,10 +1,56 @@
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 { Text as NativeText, I18nManager } from "react-native";
7
3
  import { withTheme } from "../theming";
4
+ class Text extends React.Component {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.state = {
8
+ nativeProps: {}
9
+ };
10
+ }
11
+ setNativeProps(args) {
12
+ this.state.nativeProps = args || {};
13
+ }
14
+ render() {
15
+ const {
16
+ style,
17
+ ...rest
18
+ } = this.props;
19
+ const writingDirection = I18nManager.isRTL ? "rtl" : "ltr";
20
+ return /*#__PURE__*/React.createElement(NativeText, {
21
+ ...rest,
22
+ ...this.state.nativeProps,
23
+ ref: c => {
24
+ this._root = c;
25
+ },
26
+ style: [{
27
+ textAlign: "left",
28
+ writingDirection
29
+ }, style]
30
+ });
31
+ }
32
+ }
33
+ export const BaseLink = _ref => {
34
+ let {
35
+ style,
36
+ theme,
37
+ title,
38
+ ...props
39
+ } = _ref;
40
+ return /*#__PURE__*/React.createElement(Text, {
41
+ hitSlop: 8,
42
+ style: [{
43
+ color: theme.colors.primary
44
+ }, style],
45
+ theme: theme,
46
+ ...props
47
+ }, title);
48
+ };
49
+ const Link = withTheme(BaseLink);
50
+ export { Link };
51
+ export default withTheme(Text); as React from "react";
52
+ import { Text as NativeText, I18nManager } from "react-native";
53
+ import { withTheme } from "../theming";
8
54
  class Text extends React.Component {
9
55
  constructor() {
10
56
  super(...arguments);
@@ -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"
@@ -6,19 +6,24 @@ export default function Touchable(_ref) {
6
6
  children,
7
7
  disabled,
8
8
  onPress,
9
+ activeOpacity,
10
+ disabledOpacity,
11
+ delayLongPress,
12
+ hitSlop,
9
13
  style,
10
14
  ...props
11
15
  } = _ref;
12
16
  return /*#__PURE__*/React.createElement(Pressable, _extends({
13
- onPress: onPress,
14
17
  disabled: disabled,
15
- hitSlop: 8,
18
+ onPress: onPress,
19
+ delayLongPress: delayLongPress ? delayLongPress : 500,
20
+ hitSlop: hitSlop ? hitSlop : 8,
16
21
  style: _ref2 => {
17
22
  let {
18
23
  pressed
19
24
  } = _ref2;
20
25
  return [{
21
- opacity: pressed || disabled ? 0.75 : 1
26
+ opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
22
27
  }, style];
23
28
  }
24
29
  }, props), children);
@@ -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
@@ -26,6 +26,7 @@ export { default as Switch, SwitchRow } from "./components/Switch";
26
26
  export { default as TextField } from "./components/TextField";
27
27
  export { default as ToggleButton } from "./components/ToggleButton";
28
28
  export { default as Touchable } from "./components/Touchable";
29
+ export { default as Pressable } from "./components/Pressable";
29
30
  export { AccordionGroup, AccordionItem } from "./components/Accordion";
30
31
  export { ActionSheet, ActionSheetItem, ActionSheetCancel } from "./components/ActionSheet";
31
32
  export { Swiper, SwiperItem } from "./components/Swiper";