@draftbit/core 47.0.1-54c307.2 → 47.0.1-9e8c6d.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/lib/commonjs/components/Button.js +3 -3
  2. package/lib/commonjs/components/Checkbox/Checkbox.js +1 -3
  3. package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
  4. package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
  5. package/lib/commonjs/components/DatePicker/DatePicker.js +1 -1
  6. package/lib/commonjs/components/DeprecatedButton.js +3 -27
  7. package/lib/commonjs/components/DeprecatedFAB.js +1 -2
  8. package/lib/commonjs/components/Layout.js +40 -19
  9. package/lib/commonjs/components/Portal/PortalConsumer.js +22 -7
  10. package/lib/commonjs/components/Pressable.js +37 -0
  11. package/lib/commonjs/components/ProgressBar.js +37 -7
  12. package/lib/commonjs/components/Swiper/Swiper.js +2 -0
  13. package/lib/commonjs/components/Touchable.js +8 -3
  14. package/lib/commonjs/constants.js +1 -1
  15. package/lib/commonjs/index.js +7 -0
  16. package/lib/commonjs/mappings/Button.js +39 -10
  17. package/lib/commonjs/mappings/FlashList.js +45 -2
  18. package/lib/commonjs/mappings/FlatList.js +12 -0
  19. package/lib/commonjs/mappings/Swiper.js +2 -0
  20. package/lib/commonjs/mappings/Touchable.js +47 -7
  21. package/lib/module/components/Button.js +3 -3
  22. package/lib/module/components/Checkbox/Checkbox.js +2 -3
  23. package/lib/module/components/Checkbox/CheckboxGroupRow.js +2 -3
  24. package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
  25. package/lib/module/components/DatePicker/DatePicker.js +1 -1
  26. package/lib/module/components/DeprecatedButton.js +4 -28
  27. package/lib/module/components/DeprecatedFAB.js +2 -3
  28. package/lib/module/components/Pressable.js +30 -0
  29. package/lib/module/components/Swiper/Swiper.js +2 -0
  30. package/lib/module/components/Touchable.js +8 -3
  31. package/lib/module/constants.js +1 -0
  32. package/lib/module/index.js +1 -0
  33. package/lib/module/mappings/Button.js +40 -11
  34. package/lib/module/mappings/FlashList.js +46 -3
  35. package/lib/module/mappings/FlatList.js +13 -1
  36. package/lib/module/mappings/Swiper.js +3 -1
  37. package/lib/module/mappings/Touchable.js +49 -9
  38. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  39. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  40. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  41. package/lib/typescript/src/components/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
  42. package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
  43. package/lib/typescript/src/components/DeprecatedButton.d.ts +2 -2
  44. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -1
  45. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  46. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  47. package/lib/typescript/src/components/Pressable.d.ts +10 -0
  48. package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
  49. package/lib/typescript/src/components/Swiper/Swiper.d.ts +2 -1
  50. package/lib/typescript/src/components/Swiper/Swiper.d.ts.map +1 -1
  51. package/lib/typescript/src/components/Touchable.d.ts +5 -6
  52. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  53. package/lib/typescript/src/index.d.ts +1 -0
  54. package/lib/typescript/src/index.d.ts.map +1 -1
  55. package/lib/typescript/src/mappings/Button.d.ts +113 -4
  56. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  57. package/lib/typescript/src/mappings/FlashList.d.ts +112 -2
  58. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  59. package/lib/typescript/src/mappings/FlatList.d.ts +42 -0
  60. package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
  61. package/lib/typescript/src/mappings/Swiper.d.ts +11 -0
  62. package/lib/typescript/src/mappings/Swiper.d.ts.map +1 -1
  63. package/lib/typescript/src/mappings/Touchable.d.ts +59 -5
  64. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
  65. package/package.json +3 -3
  66. package/src/components/Button.js +3 -3
  67. package/src/components/Button.tsx +14 -4
  68. package/src/components/Checkbox/Checkbox.js +2 -3
  69. package/src/components/Checkbox/Checkbox.tsx +5 -7
  70. package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
  71. package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
  72. package/src/components/Checkbox/CheckboxRow.js +2 -3
  73. package/src/components/Checkbox/CheckboxRow.tsx +3 -3
  74. package/src/components/DatePicker/DatePicker.js +1 -1
  75. package/src/components/DatePicker/DatePicker.tsx +1 -1
  76. package/src/components/DeprecatedButton.js +4 -16
  77. package/src/components/DeprecatedButton.tsx +7 -31
  78. package/src/components/DeprecatedFAB.js +2 -3
  79. package/src/components/DeprecatedFAB.tsx +5 -5
  80. package/src/components/Pressable.js +12 -0
  81. package/src/components/Pressable.tsx +44 -0
  82. package/src/components/Swiper/Swiper.js +2 -2
  83. package/src/components/Swiper/Swiper.tsx +3 -0
  84. package/src/components/Touchable.js +3 -3
  85. package/src/components/Touchable.tsx +11 -7
  86. package/src/index.js +1 -0
  87. package/src/index.tsx +1 -0
  88. package/src/mappings/Button.js +39 -10
  89. package/src/mappings/Button.ts +41 -10
  90. package/src/mappings/FlashList.js +77 -31
  91. package/src/mappings/FlashList.ts +82 -30
  92. package/src/mappings/FlatList.js +13 -1
  93. package/src/mappings/FlatList.ts +16 -0
  94. package/src/mappings/Swiper.js +3 -1
  95. package/src/mappings/Swiper.ts +4 -0
  96. package/src/mappings/Touchable.js +50 -7
  97. package/src/mappings/Touchable.ts +53 -6
@@ -21,10 +21,11 @@ function Base(_ref) {
21
21
  Icon,
22
22
  icon,
23
23
  title,
24
- onPress,
25
24
  loading,
26
25
  disabled,
27
26
  style,
27
+ activeOpacity,
28
+ disabledOpacity,
28
29
  ...props
29
30
  } = _ref;
30
31
  const {
@@ -61,14 +62,13 @@ function Base(_ref) {
61
62
  buttonStyles.justifyContent = "flex-end";
62
63
  }
63
64
  return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
64
- onPress: onPress,
65
65
  disabled: disabled || loading,
66
66
  style: _ref2 => {
67
67
  let {
68
68
  pressed
69
69
  } = _ref2;
70
70
  return [styles.base, {
71
- opacity: pressed || disabled ? 0.75 : 1
71
+ opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
72
72
  }, buttonStyles];
73
73
  }
74
74
  }, props), loading ? /*#__PURE__*/React.createElement(_reactNative.ActivityIndicator, {
@@ -7,9 +7,7 @@ exports.default = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _theming = require("../../theming");
10
- var _Touchable = _interopRequireDefault(require("../Touchable"));
11
10
  var _hooks = require("../../hooks");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
11
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
13
  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); }
@@ -60,7 +58,7 @@ const Checkbox = _ref => {
60
58
  onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
61
59
  }
62
60
  };
63
- return /*#__PURE__*/React.createElement(_Touchable.default, _extends({}, rest, {
61
+ return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({}, rest, {
64
62
  onPress: handlePress,
65
63
  disabled: disabled,
66
64
  accessibilityState: {
@@ -9,7 +9,6 @@ var _reactNative = require("react-native");
9
9
  var _Checkbox = _interopRequireDefault(require("./Checkbox"));
10
10
  var _Text = _interopRequireDefault(require("../Text"));
11
11
  var _context = require("./context");
12
- var _Touchable = _interopRequireDefault(require("../Touchable"));
13
12
  var _utilities = require("../../utilities");
14
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -73,7 +72,7 @@ const CheckboxGroupRow = _ref => {
73
72
  textStyles,
74
73
  viewStyles
75
74
  } = (0, _utilities.extractStyles)(style);
76
- return /*#__PURE__*/React.createElement(_Touchable.default, _extends({
75
+ return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
77
76
  onPress: handlePress,
78
77
  style: [styles.mainParent, {
79
78
  flexDirection: direction
@@ -10,7 +10,6 @@ var _lodash = require("lodash");
10
10
  var _utilities = require("../../utilities");
11
11
  var _hooks = require("../../hooks");
12
12
  var _Text = _interopRequireDefault(require("../Text"));
13
- var _Touchable = _interopRequireDefault(require("../Touchable"));
14
13
  var _Checkbox = _interopRequireDefault(require("./Checkbox"));
15
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
15
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -83,7 +82,7 @@ const CheckboxRow = _ref => {
83
82
  textStyles,
84
83
  viewStyles
85
84
  } = (0, _utilities.extractStyles)(style);
86
- return /*#__PURE__*/React.createElement(_Touchable.default, _extends({
85
+ return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
87
86
  onPress: handlePress,
88
87
  style: [viewStyles, styles.mainParent, {
89
88
  flexDirection: direction
@@ -328,7 +328,7 @@ const DatePicker = _ref => {
328
328
  onFocus: _handleFocus,
329
329
  onBlur: _handleBlur,
330
330
  underlineColorAndroid: "transparent",
331
- style: [inputStyles, textStyles, viewStyles]
331
+ style: [inputStyles, textStyles]
332
332
  }, props))), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
333
333
  name: rightIconName,
334
334
  size: ICON_SIZE,
@@ -8,7 +8,6 @@ var React = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  var _color = _interopRequireDefault(require("color"));
10
10
  var _Config = _interopRequireDefault(require("./Config"));
11
- var _Touchable = _interopRequireDefault(require("./Touchable"));
12
11
  var _Elevation = _interopRequireDefault(require("./Elevation"));
13
12
  var _theming = require("../theming");
14
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -27,7 +26,6 @@ const Button = _ref => {
27
26
  children,
28
27
  onPress,
29
28
  elevation = 0,
30
- style,
31
29
  theme: {
32
30
  colors,
33
31
  disabledOpacity,
@@ -81,41 +79,19 @@ const Button = _ref => {
81
79
  marginRight: -8,
82
80
  width: _Config.default.buttonIconSize
83
81
  }];
84
- const {
85
- margin,
86
- marginEnd,
87
- marginTop,
88
- marginLeft,
89
- marginRight,
90
- marginBottom,
91
- marginHorizontal,
92
- marginVertical,
93
- ...innerStyles
94
- } = _reactNative.StyleSheet.flatten(style || {});
95
- const margins = {
96
- margin,
97
- marginEnd,
98
- marginTop,
99
- marginLeft,
100
- marginRight,
101
- marginBottom,
102
- marginHorizontal,
103
- marginVertical
104
- };
105
82
  return /*#__PURE__*/React.createElement(_Elevation.default, {
106
83
  style: {
107
84
  elevation,
108
- alignSelf: "stretch",
109
- ...margins
85
+ alignSelf: "stretch"
110
86
  }
111
- }, /*#__PURE__*/React.createElement(_Touchable.default, _extends({}, rest, {
87
+ }, /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({}, rest, {
112
88
  onPress: onPress,
113
89
  accessibilityState: {
114
90
  disabled
115
91
  },
116
92
  accessibilityRole: "button",
117
93
  disabled: disabled || loading,
118
- style: [styles.button, buttonStyle, innerStyles]
94
+ style: [styles.button, buttonStyle]
119
95
  }), /*#__PURE__*/React.createElement(_reactNative.View, {
120
96
  style: styles.content
121
97
  }, icon && loading !== true ? /*#__PURE__*/React.createElement(_reactNative.View, {
@@ -9,7 +9,6 @@ var _reactNative = require("react-native");
9
9
  var _color = _interopRequireDefault(require("color"));
10
10
  var _Config = _interopRequireDefault(require("./Config"));
11
11
  var _Text = _interopRequireDefault(require("./Text"));
12
- var _Touchable = _interopRequireDefault(require("./Touchable"));
13
12
  var _Elevation = _interopRequireDefault(require("./Elevation"));
14
13
  var _theming = require("../theming");
15
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -107,7 +106,7 @@ const FAB = _ref => {
107
106
  style: [{
108
107
  elevation
109
108
  }, style]
110
- }, /*#__PURE__*/React.createElement(_Touchable.default, _extends({}, rest, {
109
+ }, /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({}, rest, {
111
110
  onPress: onPress,
112
111
  accessibilityState: {
113
112
  disabled
@@ -13,7 +13,6 @@ var React = _interopRequireWildcard(require("react"));
13
13
  var _reactNative = require("react-native");
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
- 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); }
17
16
  function Center(_ref) {
18
17
  let {
19
18
  width = 240,
@@ -23,15 +22,16 @@ function Center(_ref) {
23
22
  style,
24
23
  ...rest
25
24
  } = _ref;
26
- return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
25
+ return /*#__PURE__*/React.createElement(_reactNative.View, {
27
26
  style: [{
28
27
  justifyContent: "center",
29
28
  alignItems: "center",
30
29
  width,
31
30
  height,
32
31
  backgroundColor: bgColor
33
- }, style]
34
- }, rest), children);
32
+ }, style],
33
+ ...rest
34
+ }, children);
35
35
  }
36
36
  function Circle(_ref2) {
37
37
  let {
@@ -42,7 +42,7 @@ function Circle(_ref2) {
42
42
  ...rest
43
43
  } = _ref2;
44
44
  const borderRadius = 1000;
45
- return /*#__PURE__*/React.createElement(Center, _extends({
45
+ return /*#__PURE__*/React.createElement(Center, {
46
46
  width: size,
47
47
  height: size,
48
48
  bgColor: bgColor,
@@ -50,8 +50,9 @@ function Circle(_ref2) {
50
50
  backgroundColor: bgColor,
51
51
  borderRadius,
52
52
  overflow: "hidden"
53
- }]
54
- }, rest), children);
53
+ }],
54
+ ...rest
55
+ }, children);
55
56
  }
56
57
  function Square(_ref3) {
57
58
  let {
@@ -61,12 +62,13 @@ function Square(_ref3) {
61
62
  style,
62
63
  ...rest
63
64
  } = _ref3;
64
- return /*#__PURE__*/React.createElement(Center, _extends({
65
+ return /*#__PURE__*/React.createElement(Center, {
65
66
  style: style,
66
67
  width: size,
67
68
  height: size,
68
- bgColor: bgColor
69
- }, rest), children);
69
+ bgColor: bgColor,
70
+ ...rest
71
+ }, children);
70
72
  }
71
73
  function Row(_ref4) {
72
74
  let {
@@ -76,15 +78,14 @@ function Row(_ref4) {
76
78
  style,
77
79
  ...rest
78
80
  } = _ref4;
79
- return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
80
- style: [style,
81
- // style goes first b/c we can't override these
82
- {
81
+ return /*#__PURE__*/React.createElement(_reactNative.View, {
82
+ style: [style, {
83
83
  alignItems,
84
84
  flexDirection: "row",
85
85
  justifyContent: justifyContent
86
- }]
87
- }, rest), children);
86
+ }],
87
+ ...rest
88
+ }, children);
88
89
  }
89
90
  function Spacer(_ref5) {
90
91
  let {
@@ -96,16 +97,36 @@ function Spacer(_ref5) {
96
97
  style,
97
98
  ...rest
98
99
  } = _ref5;
99
- return /*#__PURE__*/React.createElement(_reactNative.View, _extends({
100
+ return /*#__PURE__*/React.createElement(_reactNative.View, {
100
101
  style: [style, {
101
102
  paddingRight: right,
102
103
  paddingTop: top,
103
104
  paddingLeft: left,
104
105
  paddingBottom: bottom
105
- }]
106
- }, rest), children);
106
+ }],
107
+ ...rest
108
+ }, children);
107
109
  }
108
110
  function Stack(_ref6) {
111
+ let {
112
+ children,
113
+ justifyContent = "flex-start",
114
+ alignItems = "flex-start",
115
+ style,
116
+ ...rest
117
+ } = _ref6;
118
+ return (
119
+ /*#__PURE__*/
120
+ // style must go first since we don't want justifyContent, alignItems overridden
121
+ React.createElement(_reactNative.View, {
122
+ style: [style, {
123
+ justifyContent,
124
+ alignItems
125
+ }],
126
+ ...rest
127
+ }, children)
128
+ );
129
+ }Stack(_ref6) {
109
130
  let {
110
131
  children,
111
132
  justifyContent = "flex-start",
@@ -7,16 +7,31 @@ exports.default = void 0;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
9
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
- 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; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
12
- 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); }
13
10
  class PortalConsumer extends React.Component {
14
- constructor() {
15
- super(...arguments);
16
- _defineProperty(this, "key", void 0);
17
- }
18
11
  async componentDidMount() {
19
12
  this.checkManager();
13
+ // Delay updating to prevent React from going to infinite loop
14
+ await Promise.resolve();
15
+ this.key = this.props.manager.mount(this.props.children);
16
+ }
17
+ componentDidUpdate() {
18
+ this.checkManager();
19
+ this.props.manager.update(this.key, this.props.children);
20
+ }
21
+ componentWillUnmount() {
22
+ this.checkManager();
23
+ this.props.manager.unmount(this.key);
24
+ }
25
+ checkManager() {
26
+ if (!this.props.manager) {
27
+ 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");
28
+ }
29
+ }
30
+ render() {
31
+ return null;
32
+ }
33
+ }
34
+ exports.default = PortalConsumer;s.checkManager();
20
35
 
21
36
  // Delay updating to prevent React from going to infinite loop
22
37
  await Promise.resolve();
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Pressable;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ 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); }
11
+ function Pressable(_ref) {
12
+ let {
13
+ children,
14
+ disabled,
15
+ onPress,
16
+ activeOpacity,
17
+ disabledOpacity,
18
+ delayLongPress,
19
+ hitSlop,
20
+ style,
21
+ ...props
22
+ } = _ref;
23
+ return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
24
+ onPress: onPress,
25
+ disabled: disabled,
26
+ delayLongPress: delayLongPress ? delayLongPress : 500,
27
+ hitSlop: hitSlop ? hitSlop : 8,
28
+ style: _ref2 => {
29
+ let {
30
+ pressed
31
+ } = _ref2;
32
+ return [{
33
+ opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
34
+ }, style];
35
+ }
36
+ }, props), children);
37
+ }
@@ -8,16 +8,12 @@ var _react = _interopRequireWildcard(require("react"));
8
8
  var _reactNative = require("react-native");
9
9
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10
10
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
- 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); }
12
- 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; }
13
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
14
- 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); }
15
11
  const INDETERMINATE_WIDTH_FACTOR = 0.3;
16
12
  const BAR_WIDTH_ZERO_POSITION = INDETERMINATE_WIDTH_FACTOR / (1 + INDETERMINATE_WIDTH_FACTOR);
17
13
  class ProgressBar extends _react.Component {
18
14
  constructor(props) {
19
15
  super(props);
20
- _defineProperty(this, "handleLayout", event => {
16
+ this.handleLayout = event => {
21
17
  const {
22
18
  width = 150,
23
19
  onLayout
@@ -30,7 +26,7 @@ class ProgressBar extends _react.Component {
30
26
  if (onLayout) {
31
27
  onLayout(event);
32
28
  }
33
- });
29
+ };
34
30
  const {
35
31
  progress: progressP = 0,
36
32
  indeterminate = false
@@ -78,7 +74,6 @@ class ProgressBar extends _react.Component {
78
74
  ...animationConfig,
79
75
  toValue: progress,
80
76
  velocity: 0,
81
- //adjust this value if animation fails - velocity is required
82
77
  useNativeDriver
83
78
  }).start();
84
79
  } else {
@@ -147,6 +142,41 @@ class ProgressBar extends _react.Component {
147
142
  })
148
143
  }]
149
144
  };
145
+ return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
146
+ style: [containerStyle, style],
147
+ onLayout: this.handleLayout,
148
+ ...restProps
149
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
150
+ style: progressStyle
151
+ }), children);
152
+ }
153
+ }
154
+ exports.default = ProgressBar;,
155
+ overflow: "hidden",
156
+ backgroundColor: unfilledColor
157
+ };
158
+ const progressStyle = {
159
+ backgroundColor: color,
160
+ // Always take up full height of container.
161
+ height: "100%",
162
+ transform: [{
163
+ translateX: this.state.animationValue.interpolate({
164
+ inputRange: [0, 1],
165
+ outputRange: [innerWidth * -INDETERMINATE_WIDTH_FACTOR, innerWidth]
166
+ })
167
+ }, {
168
+ translateX: this.state.progress.interpolate({
169
+ inputRange: [0, 1],
170
+ outputRange: [innerWidth / (_reactNative.I18nManager.isRTL ? 2 : -2), 0]
171
+ })
172
+ }, {
173
+ // Interpolation a temp workaround for https://github.com/facebook/react-native/issues/6278
174
+ scaleX: this.state.progress.interpolate({
175
+ inputRange: [0, 1],
176
+ outputRange: [0.0001, 1]
177
+ })
178
+ }]
179
+ };
150
180
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
151
181
  style: [containerStyle, style],
152
182
  onLayout: this.handleLayout
@@ -25,6 +25,7 @@ const Swiper = _ref => {
25
25
  keyExtractor,
26
26
  renderItem,
27
27
  children,
28
+ onIndexChanged,
28
29
  style
29
30
  } = _ref;
30
31
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, {
@@ -34,6 +35,7 @@ const Swiper = _ref => {
34
35
  loop: loop,
35
36
  timeout: timeout,
36
37
  vertical: vertical,
38
+ onIndexChanged: onIndexChanged,
37
39
  controlsProps: {
38
40
  prevTitle,
39
41
  nextTitle,
@@ -13,19 +13,24 @@ function Touchable(_ref) {
13
13
  children,
14
14
  disabled,
15
15
  onPress,
16
+ activeOpacity,
17
+ disabledOpacity,
18
+ delayLongPress,
19
+ hitSlop,
16
20
  style,
17
21
  ...props
18
22
  } = _ref;
19
23
  return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
20
- onPress: onPress,
21
24
  disabled: disabled,
22
- hitSlop: 8,
25
+ onPress: onPress,
26
+ delayLongPress: delayLongPress ? delayLongPress : 500,
27
+ hitSlop: hitSlop ? hitSlop : 8,
23
28
  style: _ref2 => {
24
29
  let {
25
30
  pressed
26
31
  } = _ref2;
27
32
  return [{
28
- opacity: pressed || disabled ? 0.75 : 1
33
+ opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
29
34
  }, style];
30
35
  }
31
36
  }, props), children);
@@ -12,4 +12,4 @@ const APPROX_STATUSBAR_HEIGHT = _reactNative.Platform.select({
12
12
  android: DEFAULT_STATUSBAR_HEIGHT_EXPO,
13
13
  ios: _reactNative.Platform.Version < 11 ? DEFAULT_STATUSBAR_HEIGHT_EXPO : 0
14
14
  });
15
- exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;
15
+ exports.APPROX_STATUSBAR_HEIGHT = APPROX_STATUSBAR_HEIGHT;AR_HEIGHT;
@@ -225,6 +225,12 @@ Object.defineProperty(exports, "Picker", {
225
225
  return _Picker.default;
226
226
  }
227
227
  });
228
+ Object.defineProperty(exports, "Pressable", {
229
+ enumerable: true,
230
+ get: function () {
231
+ return _Pressable.default;
232
+ }
233
+ });
228
234
  Object.defineProperty(exports, "ProgressBar", {
229
235
  enumerable: true,
230
236
  get: function () {
@@ -438,6 +444,7 @@ var _Switch = _interopRequireWildcard(require("./components/Switch"));
438
444
  var _TextField = _interopRequireDefault(require("./components/TextField"));
439
445
  var _ToggleButton = _interopRequireDefault(require("./components/ToggleButton"));
440
446
  var _Touchable = _interopRequireDefault(require("./components/Touchable"));
447
+ var _Pressable = _interopRequireDefault(require("./components/Pressable"));
441
448
  var _Accordion = require("./components/Accordion");
442
449
  var _ActionSheet = require("./components/ActionSheet");
443
450
  var _Swiper = require("./components/Swiper");
@@ -5,9 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SEED_DATA = void 0;
7
7
  var _types = require("@draftbit/types");
8
- const SEED_DATA_TRIGGERS = [_types.Triggers.OnPress];
8
+ const SEED_DATA_TRIGGERS = [_types.Triggers.OnPress, _types.Triggers.OnLongPress];
9
9
  const SEED_DATA_PROPS = {
10
10
  onPress: (0, _types.createActionProp)(),
11
+ onLongPress: (0, _types.createActionProp)(),
11
12
  icon: (0, _types.createIconProp)({
12
13
  defaultValue: null,
13
14
  required: false
@@ -18,12 +19,37 @@ const SEED_DATA_PROPS = {
18
19
  defaultValue: "Get Started"
19
20
  }),
20
21
  disabled: (0, _types.createDisabledProp)(),
21
- loading: (0, _types.createLoadingProp)()
22
- };
23
- const LAYOUT = {
24
- backgroundColor: "transparent",
25
- borderRadius: 8,
26
- fontFamily: "system-700"
22
+ loading: (0, _types.createLoadingProp)(),
23
+ activeOpacity: (0, _types.createStaticNumberProp)({
24
+ label: "Active Opacity",
25
+ description: "Opacity of the button when active.",
26
+ defaultValue: 0.8,
27
+ min: 0,
28
+ max: 1,
29
+ step: 0.01,
30
+ precision: 2,
31
+ required: false
32
+ }),
33
+ disabledOpacity: (0, _types.createStaticNumberProp)({
34
+ label: "Disabled Opacity",
35
+ description: "Opacity of the button when disabled.",
36
+ defaultValue: 0.8,
37
+ min: 0,
38
+ max: 1,
39
+ step: 0.01,
40
+ precision: 2,
41
+ required: false
42
+ }),
43
+ delayLongPress: (0, _types.createStaticNumberProp)({
44
+ label: "Delay Long Press",
45
+ description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
46
+ required: false
47
+ }),
48
+ hitSlop: (0, _types.createStaticNumberProp)({
49
+ label: "Hit Slop",
50
+ description: "Sets additional distance outside of element in which a press can be detected",
51
+ required: false
52
+ })
27
53
  };
28
54
  const SEED_DATA = [{
29
55
  name: "Button Outline",
@@ -31,7 +57,8 @@ const SEED_DATA = [{
31
57
  category: _types.COMPONENT_TYPES.deprecated,
32
58
  stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
33
59
  layout: {
34
- ...LAYOUT,
60
+ borderRadius: 8,
61
+ fontFamily: "system-700",
35
62
  backgroundColor: "transparent",
36
63
  borderWidth: 1,
37
64
  textAlign: "center"
@@ -44,7 +71,8 @@ const SEED_DATA = [{
44
71
  category: _types.COMPONENT_TYPES.deprecated,
45
72
  stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
46
73
  layout: {
47
- ...LAYOUT,
74
+ borderRadius: 8,
75
+ fontFamily: "system-700",
48
76
  backgroundColor: "primary",
49
77
  textAlign: "center"
50
78
  },
@@ -56,7 +84,8 @@ const SEED_DATA = [{
56
84
  category: _types.COMPONENT_TYPES.button,
57
85
  stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
58
86
  layout: {
59
- ...LAYOUT,
87
+ borderRadius: 8,
88
+ fontFamily: "system-700",
60
89
  backgroundColor: "primary",
61
90
  textAlign: "center"
62
91
  },