@draftbit/core 46.5.2-b58416.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 (138) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +23 -4
  2. package/lib/commonjs/components/Banner.js +23 -4
  3. package/lib/commonjs/components/Button.js +36 -13
  4. package/lib/commonjs/components/CardContainer.js +13 -4
  5. package/lib/commonjs/components/CardContainerShortImage.js +15 -4
  6. package/lib/commonjs/components/Checkbox/Checkbox.js +22 -6
  7. package/lib/commonjs/components/Checkbox/CheckboxGroup.js +17 -2
  8. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
  9. package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
  10. package/lib/commonjs/components/Container.js +15 -4
  11. package/lib/commonjs/components/DeprecatedButton.js +3 -27
  12. package/lib/commonjs/components/DeprecatedCardWrapper.js +15 -1
  13. package/lib/commonjs/components/DeprecatedFAB.js +1 -2
  14. package/lib/commonjs/components/Elevation.js +14 -2
  15. package/lib/commonjs/components/FAB.js +18 -4
  16. package/lib/commonjs/components/FieldSearchBarFull.js +1 -2
  17. package/lib/commonjs/components/Image.js +17 -2
  18. package/lib/commonjs/components/Layout.js +40 -19
  19. package/lib/commonjs/components/Picker/Picker.js +9 -4
  20. package/lib/commonjs/components/Picker/PickerComponent.ios.js +36 -11
  21. package/lib/commonjs/components/Picker/PickerComponent.web.js +20 -3
  22. package/lib/commonjs/components/Portal/PortalManager.js +34 -8
  23. package/lib/commonjs/components/Pressable.js +50 -0
  24. package/lib/commonjs/components/ProgressBar.js +37 -7
  25. package/lib/commonjs/components/RadioButton/RadioButtonFieldGroup.js +9 -1
  26. package/lib/commonjs/components/ScreenContainer.js +20 -4
  27. package/lib/commonjs/components/StepIndicator.js +57 -18
  28. package/lib/commonjs/components/Surface.js +14 -2
  29. package/lib/commonjs/components/Swiper/Swiper.js +2 -0
  30. package/lib/commonjs/components/Switch.js +19 -10
  31. package/lib/commonjs/components/TextField.js +76 -28
  32. package/lib/commonjs/components/ToggleButton.js +15 -2
  33. package/lib/commonjs/components/Touchable.js +23 -5
  34. package/lib/commonjs/index.js +7 -0
  35. package/lib/commonjs/mappings/Button.js +39 -10
  36. package/lib/commonjs/mappings/FlashList.js +45 -2
  37. package/lib/commonjs/mappings/FlatList.js +12 -0
  38. package/lib/commonjs/mappings/Swiper.js +2 -0
  39. package/lib/commonjs/mappings/Touchable.js +47 -7
  40. package/lib/module/components/AvatarEdit.js +15 -4
  41. package/lib/module/components/Button.js +36 -13
  42. package/lib/module/components/Carousel.js +32 -8
  43. package/lib/module/components/Checkbox/Checkbox.js +26 -6
  44. package/lib/module/components/Checkbox/CheckboxGroup.js +16 -2
  45. package/lib/module/components/Checkbox/CheckboxGroupRow.js +25 -7
  46. package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
  47. package/lib/module/components/CircularProgress.js +28 -8
  48. package/lib/module/components/DatePicker/DatePicker.js +27 -13
  49. package/lib/module/components/DeprecatedButton.js +24 -30
  50. package/lib/module/components/DeprecatedFAB.js +2 -3
  51. package/lib/module/components/Elevation.js +14 -2
  52. package/lib/module/components/FieldSearchBarFull.js +1 -2
  53. package/lib/module/components/Image.js +18 -2
  54. package/lib/module/components/Layout.js +42 -21
  55. package/lib/module/components/NumberInput.js +12 -3
  56. package/lib/module/components/Picker/Picker.js +10 -4
  57. package/lib/module/components/Picker/PickerComponent.ios.js +36 -11
  58. package/lib/module/components/Picker/PickerComponent.web.js +21 -3
  59. package/lib/module/components/Portal/PortalConsumer.js +22 -7
  60. package/lib/module/components/Pressable.js +30 -0
  61. package/lib/module/components/RadioButton/RadioButtonRow.js +24 -5
  62. package/lib/module/components/ScreenContainer.js +21 -4
  63. package/lib/module/components/Swiper/Swiper.js +2 -0
  64. package/lib/module/components/Switch.js +21 -10
  65. package/lib/module/components/Text.js +50 -4
  66. package/lib/module/components/TextField.js +78 -28
  67. package/lib/module/components/Touchable.js +8 -3
  68. package/lib/module/constants.js +1 -2
  69. package/lib/module/index.js +1 -0
  70. package/lib/module/mappings/Button.js +40 -11
  71. package/lib/module/mappings/FieldSearchBarFull.js +4 -1
  72. package/lib/module/mappings/FlashList.js +46 -3
  73. package/lib/module/mappings/FlatList.js +13 -1
  74. package/lib/module/mappings/StarRating.js +7 -2
  75. package/lib/module/mappings/Swiper.js +3 -1
  76. package/lib/module/mappings/Touchable.js +49 -9
  77. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  78. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  79. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  80. package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
  81. package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
  82. package/lib/typescript/src/components/DeprecatedButton.d.ts +2 -2
  83. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -1
  84. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  85. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  86. package/lib/typescript/src/components/Pressable.d.ts +10 -0
  87. package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
  88. package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -1
  89. package/lib/typescript/src/components/Swiper/Swiper.d.ts.map +1 -1
  90. package/lib/typescript/src/components/Touchable.d.ts +5 -6
  91. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  92. package/lib/typescript/src/index.d.ts +1 -0
  93. package/lib/typescript/src/index.d.ts.map +1 -1
  94. package/lib/typescript/src/mappings/Button.d.ts +113 -4
  95. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  96. package/lib/typescript/src/mappings/FlashList.d.ts +112 -2
  97. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  98. package/lib/typescript/src/mappings/FlatList.d.ts +42 -0
  99. package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
  100. package/lib/typescript/src/mappings/Swiper.d.ts +11 -0
  101. package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
  102. package/lib/typescript/src/mappings/Touchable.d.ts +59 -5
  103. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
  104. package/lib/typescript/src/styles/overlay.d.ts +1 -1
  105. package/lib/typescript/src/styles/overlay.d.ts.map +1 -1
  106. package/lib/typescript/src/styles/shadow.d.ts +2 -2
  107. package/package.json +7 -7
  108. package/src/components/Button.js +3 -3
  109. package/src/components/Button.tsx +14 -4
  110. package/src/components/Checkbox/Checkbox.js +2 -3
  111. package/src/components/Checkbox/Checkbox.tsx +5 -7
  112. package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
  113. package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
  114. package/src/components/Checkbox/CheckboxRow.js +2 -3
  115. package/src/components/Checkbox/CheckboxRow.tsx +3 -3
  116. package/src/components/DeprecatedButton.js +4 -16
  117. package/src/components/DeprecatedButton.tsx +7 -31
  118. package/src/components/DeprecatedFAB.js +2 -3
  119. package/src/components/DeprecatedFAB.tsx +5 -5
  120. package/src/components/Pressable.js +12 -0
  121. package/src/components/Pressable.tsx +44 -0
  122. package/src/components/Swiper/Swiper.js +2 -2
  123. package/src/components/Swiper/Swiper.tsx +3 -0
  124. package/src/components/Touchable.js +3 -3
  125. package/src/components/Touchable.tsx +11 -7
  126. package/src/index.js +1 -0
  127. package/src/index.tsx +1 -0
  128. package/src/mappings/Button.js +39 -10
  129. package/src/mappings/Button.ts +41 -10
  130. package/src/mappings/FlashList.js +77 -31
  131. package/src/mappings/FlashList.ts +82 -30
  132. package/src/mappings/FlatList.js +13 -1
  133. package/src/mappings/FlatList.ts +16 -0
  134. package/src/mappings/Swiper.js +3 -1
  135. package/src/mappings/Swiper.ts +4 -0
  136. package/src/mappings/Touchable.js +50 -7
  137. package/src/mappings/Touchable.ts +53 -6
  138. package/src/styles/overlay.tsx +2 -2
@@ -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";
@@ -1,7 +1,8 @@
1
- import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections } from "@draftbit/types";
2
- const SEED_DATA_TRIGGERS = [Triggers.OnPress];
1
+ import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, createStaticNumberProp } from "@draftbit/types";
2
+ const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
3
3
  const SEED_DATA_PROPS = {
4
4
  onPress: createActionProp(),
5
+ onLongPress: createActionProp(),
5
6
  icon: createIconProp({
6
7
  defaultValue: null,
7
8
  required: false
@@ -12,12 +13,37 @@ const SEED_DATA_PROPS = {
12
13
  defaultValue: "Get Started"
13
14
  }),
14
15
  disabled: createDisabledProp(),
15
- loading: createLoadingProp()
16
- };
17
- const LAYOUT = {
18
- backgroundColor: "transparent",
19
- borderRadius: 8,
20
- fontFamily: "system-700"
16
+ loading: createLoadingProp(),
17
+ activeOpacity: createStaticNumberProp({
18
+ label: "Active Opacity",
19
+ description: "Opacity of the button when active.",
20
+ defaultValue: 0.8,
21
+ min: 0,
22
+ max: 1,
23
+ step: 0.01,
24
+ precision: 2,
25
+ required: false
26
+ }),
27
+ disabledOpacity: createStaticNumberProp({
28
+ label: "Disabled Opacity",
29
+ description: "Opacity of the button when disabled.",
30
+ defaultValue: 0.8,
31
+ min: 0,
32
+ max: 1,
33
+ step: 0.01,
34
+ precision: 2,
35
+ required: false
36
+ }),
37
+ delayLongPress: createStaticNumberProp({
38
+ label: "Delay Long Press",
39
+ description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
40
+ required: false
41
+ }),
42
+ hitSlop: createStaticNumberProp({
43
+ label: "Hit Slop",
44
+ description: "Sets additional distance outside of element in which a press can be detected",
45
+ required: false
46
+ })
21
47
  };
22
48
  export const SEED_DATA = [{
23
49
  name: "Button Outline",
@@ -25,7 +51,8 @@ export const SEED_DATA = [{
25
51
  category: COMPONENT_TYPES.deprecated,
26
52
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
27
53
  layout: {
28
- ...LAYOUT,
54
+ borderRadius: 8,
55
+ fontFamily: "system-700",
29
56
  backgroundColor: "transparent",
30
57
  borderWidth: 1,
31
58
  textAlign: "center"
@@ -38,7 +65,8 @@ export const SEED_DATA = [{
38
65
  category: COMPONENT_TYPES.deprecated,
39
66
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
40
67
  layout: {
41
- ...LAYOUT,
68
+ borderRadius: 8,
69
+ fontFamily: "system-700",
42
70
  backgroundColor: "primary",
43
71
  textAlign: "center"
44
72
  },
@@ -50,7 +78,8 @@ export const SEED_DATA = [{
50
78
  category: COMPONENT_TYPES.button,
51
79
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
52
80
  layout: {
53
- ...LAYOUT,
81
+ borderRadius: 8,
82
+ fontFamily: "system-700",
54
83
  backgroundColor: "primary",
55
84
  textAlign: "center"
56
85
  },
@@ -8,7 +8,6 @@ export const SEED_DATA = [{
8
8
  preview_image_url: "{CLOUDINARY_URL}/Field_SearchBar_Full.png",
9
9
  supports_list_render: false,
10
10
  triggers: [Triggers.OnChange],
11
- // TODO Triggers.OnSubmit for multiple triggers
12
11
  props: {
13
12
  icon: {
14
13
  group: GROUPS.basic,
@@ -46,4 +45,8 @@ export const SEED_DATA = [{
46
45
  }
47
46
  },
48
47
  layout: {}
48
+ }];alue: "searchBarValue"
49
+ }
50
+ },
51
+ layout: {}
49
52
  }];