@draftbit/core 47.0.1-54c307.2 → 47.0.1-cc5ccc.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.
- package/lib/commonjs/components/Button.js +27 -15
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -3
- package/lib/commonjs/components/DatePicker/DatePicker.js +1 -1
- package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
- package/lib/commonjs/components/DeprecatedFAB.js +1 -2
- package/lib/commonjs/components/Picker/Picker.js +3 -4
- package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
- package/lib/commonjs/components/Pressable.js +48 -0
- package/lib/commonjs/components/Touchable.js +27 -11
- package/lib/commonjs/mappings/Button.js +13 -10
- package/lib/commonjs/mappings/Pressable.js +52 -0
- package/lib/module/components/Button.js +21 -9
- package/lib/module/components/Checkbox/Checkbox.js +2 -3
- package/lib/module/components/DatePicker/DatePicker.js +1 -1
- package/lib/module/components/DeprecatedCardWrapper.js +2 -2
- package/lib/module/components/DeprecatedFAB.js +2 -3
- package/lib/module/components/Picker/Picker.js +3 -4
- package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
- package/lib/module/components/Pressable.js +40 -0
- package/lib/module/components/Touchable.js +25 -10
- package/lib/module/mappings/Button.js +14 -11
- package/lib/module/mappings/Pressable.js +45 -0
- package/lib/typescript/src/components/Button.d.ts +2 -0
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
- package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
- package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
- package/lib/typescript/src/components/Pressable.d.ts +18 -0
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/Touchable.d.ts +9 -2
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Button.d.ts +113 -4
- package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
- package/lib/typescript/src/mappings/Pressable.d.ts +76 -0
- package/lib/typescript/src/mappings/Pressable.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Button.js +18 -11
- package/src/components/Button.tsx +45 -11
- package/src/components/Checkbox/Checkbox.js +2 -3
- package/src/components/Checkbox/Checkbox.tsx +5 -7
- package/src/components/DatePicker/DatePicker.js +1 -1
- package/src/components/DatePicker/DatePicker.tsx +1 -1
- package/src/components/DeprecatedCardWrapper.js +2 -2
- package/src/components/DeprecatedCardWrapper.tsx +3 -4
- package/src/components/DeprecatedFAB.js +2 -3
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Picker/Picker.js +3 -4
- package/src/components/Picker/Picker.tsx +4 -4
- package/src/components/Picker/PickerComponent.ios.js +1 -1
- package/src/components/Picker/PickerComponent.ios.tsx +1 -1
- package/src/components/Pressable.js +17 -0
- package/src/components/Pressable.tsx +67 -0
- package/src/components/Touchable.js +16 -11
- package/src/components/Touchable.tsx +42 -11
- package/src/mappings/Button.js +13 -10
- package/src/mappings/Button.ts +13 -10
- package/src/mappings/Pressable.js +52 -0
- package/src/mappings/Pressable.ts +63 -0
- package/lib/commonjs/components/DeprecatedButton.js +0 -151
- package/lib/commonjs/components/Touchable.web.js +0 -9
- package/lib/commonjs/mappings/Touchable.js +0 -20
- package/lib/module/components/DeprecatedButton.js +0 -141
- package/lib/module/components/Touchable.web.js +0 -2
- package/lib/module/mappings/Touchable.js +0 -13
- package/lib/typescript/src/components/DeprecatedButton.d.ts +0 -54
- package/lib/typescript/src/components/DeprecatedButton.d.ts.map +0 -1
- package/lib/typescript/src/components/Touchable.web.d.ts +0 -3
- package/lib/typescript/src/components/Touchable.web.d.ts.map +0 -1
- package/lib/typescript/src/mappings/Touchable.d.ts +0 -22
- package/lib/typescript/src/mappings/Touchable.d.ts.map +0 -1
- package/src/components/DeprecatedButton.js +0 -95
- package/src/components/DeprecatedButton.tsx +0 -214
- package/src/components/Touchable.web.js +0 -2
- package/src/components/Touchable.web.tsx +0 -3
- package/src/mappings/Touchable.js +0 -17
- package/src/mappings/Touchable.ts +0 -23
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ButtonSolid = exports.ButtonOutline = exports.Button = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _theming = require("../theming");
|
|
10
10
|
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); }
|
|
@@ -22,6 +22,9 @@ function Base(_ref) {
|
|
|
22
22
|
icon,
|
|
23
23
|
title,
|
|
24
24
|
onPress,
|
|
25
|
+
onLongPress,
|
|
26
|
+
activeOpacity,
|
|
27
|
+
disabledOpacity,
|
|
25
28
|
loading,
|
|
26
29
|
disabled,
|
|
27
30
|
style,
|
|
@@ -60,27 +63,36 @@ function Base(_ref) {
|
|
|
60
63
|
if (textAlign === "right") {
|
|
61
64
|
buttonStyles.justifyContent = "flex-end";
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
const getOpacity = (0, _react.useCallback)(pressed => {
|
|
67
|
+
if (disabled) {
|
|
68
|
+
return disabledOpacity;
|
|
69
|
+
} else {
|
|
70
|
+
if (pressed) return activeOpacity;else return 1;
|
|
71
|
+
}
|
|
72
|
+
}, [activeOpacity, disabled, disabledOpacity]);
|
|
73
|
+
const _style = (0, _react.useCallback)(_ref2 => {
|
|
74
|
+
let {
|
|
75
|
+
pressed
|
|
76
|
+
} = _ref2;
|
|
77
|
+
return [buttonStyles, {
|
|
78
|
+
opacity: getOpacity(pressed)
|
|
79
|
+
}];
|
|
80
|
+
}, [getOpacity, buttonStyles]);
|
|
81
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
|
|
64
82
|
onPress: onPress,
|
|
83
|
+
onLongPress: onLongPress,
|
|
65
84
|
disabled: disabled || loading,
|
|
66
|
-
style:
|
|
67
|
-
|
|
68
|
-
pressed
|
|
69
|
-
} = _ref2;
|
|
70
|
-
return [styles.base, {
|
|
71
|
-
opacity: pressed || disabled ? 0.75 : 1
|
|
72
|
-
}, buttonStyles];
|
|
73
|
-
}
|
|
74
|
-
}, props), loading ? /*#__PURE__*/React.createElement(_reactNative.ActivityIndicator, {
|
|
85
|
+
style: (styles.base, _style)
|
|
86
|
+
}, props), loading ? /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
|
|
75
87
|
size: "small",
|
|
76
88
|
color: color,
|
|
77
89
|
style: styles.loading
|
|
78
|
-
}) : null, icon && !loading ? /*#__PURE__*/
|
|
90
|
+
}) : null, icon && !loading ? /*#__PURE__*/_react.default.createElement(Icon, {
|
|
79
91
|
name: icon,
|
|
80
92
|
color: color,
|
|
81
93
|
style: styles.icon,
|
|
82
94
|
size: CONSTANTS.icon
|
|
83
|
-
}) : null, /*#__PURE__*/
|
|
95
|
+
}) : null, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
|
|
84
96
|
style: titleStyles
|
|
85
97
|
}, title));
|
|
86
98
|
}
|
|
@@ -90,7 +102,7 @@ const Solid = _ref3 => {
|
|
|
90
102
|
theme,
|
|
91
103
|
...props
|
|
92
104
|
} = _ref3;
|
|
93
|
-
return /*#__PURE__*/
|
|
105
|
+
return /*#__PURE__*/_react.default.createElement(Base, _extends({
|
|
94
106
|
style: [{
|
|
95
107
|
color: "#FFF",
|
|
96
108
|
borderRadius: theme.roundness,
|
|
@@ -108,7 +120,7 @@ const Outline = _ref4 => {
|
|
|
108
120
|
theme,
|
|
109
121
|
...props
|
|
110
122
|
} = _ref4;
|
|
111
|
-
return /*#__PURE__*/
|
|
123
|
+
return /*#__PURE__*/_react.default.createElement(Base, _extends({
|
|
112
124
|
style: [styles.outline, {
|
|
113
125
|
borderRadius: theme.roundness,
|
|
114
126
|
borderColor: theme.colors.primary,
|
|
@@ -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(
|
|
61
|
+
return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({}, rest, {
|
|
64
62
|
onPress: handlePress,
|
|
65
63
|
disabled: disabled,
|
|
66
64
|
accessibilityState: {
|
|
@@ -328,7 +328,7 @@ const DatePicker = _ref => {
|
|
|
328
328
|
onFocus: _handleFocus,
|
|
329
329
|
onBlur: _handleBlur,
|
|
330
330
|
underlineColorAndroid: "transparent",
|
|
331
|
-
style: [inputStyles, textStyles
|
|
331
|
+
style: [inputStyles, textStyles]
|
|
332
332
|
}, props))), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
333
333
|
name: rightIconName,
|
|
334
334
|
size: ICON_SIZE,
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _theming = require("../theming");
|
|
9
|
-
var
|
|
9
|
+
var _reactNative = require("react-native");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
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
12
|
const getWidth = numColumns => {
|
|
@@ -28,7 +28,7 @@ const Card = _ref => {
|
|
|
28
28
|
...rest
|
|
29
29
|
} = _ref;
|
|
30
30
|
const width = getWidth(numColumns);
|
|
31
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
|
|
32
32
|
disabled: !onPress,
|
|
33
33
|
onPress: onPress,
|
|
34
34
|
style: [style, {
|
|
@@ -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(
|
|
109
|
+
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({}, rest, {
|
|
111
110
|
onPress: onPress,
|
|
112
111
|
accessibilityState: {
|
|
113
112
|
disabled
|
|
@@ -11,8 +11,7 @@ var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
|
11
11
|
var _picker = require("@react-native-picker/picker");
|
|
12
12
|
var _theming = require("../../theming");
|
|
13
13
|
var _Portal = _interopRequireDefault(require("../Portal/Portal"));
|
|
14
|
-
var
|
|
15
|
-
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
14
|
+
var _Button = require("../Button");
|
|
16
15
|
var _utilities = require("../../utilities");
|
|
17
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
17
|
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); }
|
|
@@ -207,7 +206,7 @@ const Picker = _ref => {
|
|
|
207
206
|
/* marginsContainer */
|
|
208
207
|
React.createElement(_reactNative.View, {
|
|
209
208
|
style: [styles.marginsContainer, marginStyles]
|
|
210
|
-
}, /*#__PURE__*/React.createElement(
|
|
209
|
+
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, {
|
|
211
210
|
disabled: disabled,
|
|
212
211
|
onPress: togglePickerVisible,
|
|
213
212
|
style: styles.touchableContainer
|
|
@@ -226,7 +225,7 @@ const Picker = _ref => {
|
|
|
226
225
|
}]
|
|
227
226
|
}, /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaView, {
|
|
228
227
|
style: styles.iosSafeArea
|
|
229
|
-
}, /*#__PURE__*/React.createElement(
|
|
228
|
+
}, /*#__PURE__*/React.createElement(_Button.Button, {
|
|
230
229
|
Icon: Icon,
|
|
231
230
|
type: "text",
|
|
232
231
|
onPress: togglePickerVisible,
|
|
@@ -11,7 +11,7 @@ var _lodash = _interopRequireDefault(require("lodash.omit"));
|
|
|
11
11
|
var _picker = require("@react-native-picker/picker");
|
|
12
12
|
var _theming = require("../../theming");
|
|
13
13
|
var _Portal = _interopRequireDefault(require("../Portal/Portal"));
|
|
14
|
-
var
|
|
14
|
+
var _Button = require("../Button");
|
|
15
15
|
var _TextField = _interopRequireDefault(require("../TextField"));
|
|
16
16
|
var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
17
17
|
var _utilities = require("../../utilities");
|
|
@@ -99,7 +99,7 @@ const Picker = _ref => {
|
|
|
99
99
|
}]
|
|
100
100
|
}, /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaView, {
|
|
101
101
|
style: styles.pickerContainer
|
|
102
|
-
}, /*#__PURE__*/React.createElement(
|
|
102
|
+
}, /*#__PURE__*/React.createElement(_Button.Button, {
|
|
103
103
|
Icon: Icon,
|
|
104
104
|
type: "text",
|
|
105
105
|
onPress: toggleVisibility,
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = Pressable;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
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
|
+
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 Pressable(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
children,
|
|
15
|
+
disabled,
|
|
16
|
+
onPress,
|
|
17
|
+
onLongPress,
|
|
18
|
+
hitSlop,
|
|
19
|
+
delayLongPress,
|
|
20
|
+
activeOpacity,
|
|
21
|
+
disabledOpacity,
|
|
22
|
+
style,
|
|
23
|
+
...props
|
|
24
|
+
} = _ref;
|
|
25
|
+
const getOpacity = (0, _react.useCallback)(pressed => {
|
|
26
|
+
if (disabled) {
|
|
27
|
+
return disabledOpacity;
|
|
28
|
+
} else {
|
|
29
|
+
if (pressed) return activeOpacity;else return 1;
|
|
30
|
+
}
|
|
31
|
+
}, [activeOpacity, disabled, disabledOpacity]);
|
|
32
|
+
const _style = (0, _react.useCallback)(_ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
pressed
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return [style, {
|
|
37
|
+
opacity: getOpacity(pressed)
|
|
38
|
+
}];
|
|
39
|
+
}, [getOpacity, style]);
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
|
|
41
|
+
onPress: onPress,
|
|
42
|
+
onLongPress: onLongPress,
|
|
43
|
+
disabled: disabled,
|
|
44
|
+
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
45
|
+
hitSlop: hitSlop ? hitSlop : 8,
|
|
46
|
+
style: _style
|
|
47
|
+
}, props), children);
|
|
48
|
+
}
|
|
@@ -4,29 +4,45 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = Touchable;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
function
|
|
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
|
+
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
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); }
|
|
11
12
|
function Touchable(_ref) {
|
|
12
13
|
let {
|
|
13
14
|
children,
|
|
14
15
|
disabled,
|
|
15
16
|
onPress,
|
|
17
|
+
onLongPress,
|
|
18
|
+
hitSlop,
|
|
19
|
+
delayLongPress,
|
|
20
|
+
activeOpacity,
|
|
21
|
+
disabledOpacity,
|
|
16
22
|
style,
|
|
17
23
|
...props
|
|
18
24
|
} = _ref;
|
|
25
|
+
const getOpacity = (0, _react.useCallback)(pressed => {
|
|
26
|
+
if (disabled) {
|
|
27
|
+
return disabledOpacity;
|
|
28
|
+
} else {
|
|
29
|
+
if (pressed) return activeOpacity;else return 1;
|
|
30
|
+
}
|
|
31
|
+
}, [activeOpacity, disabled, disabledOpacity]);
|
|
32
|
+
const _style = (0, _react.useCallback)(_ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
pressed
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return [style, {
|
|
37
|
+
opacity: getOpacity(pressed)
|
|
38
|
+
}];
|
|
39
|
+
}, [getOpacity, style]);
|
|
19
40
|
return /*#__PURE__*/_react.default.createElement(_reactNative.Pressable, _extends({
|
|
20
41
|
onPress: onPress,
|
|
42
|
+
onLongPress: onLongPress,
|
|
21
43
|
disabled: disabled,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
pressed
|
|
26
|
-
} = _ref2;
|
|
27
|
-
return [{
|
|
28
|
-
opacity: pressed || disabled ? 0.75 : 1
|
|
29
|
-
}, style];
|
|
30
|
-
}
|
|
44
|
+
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
45
|
+
hitSlop: hitSlop ? hitSlop : 8,
|
|
46
|
+
style: _style
|
|
31
47
|
}, props), children);
|
|
32
48
|
}
|
|
@@ -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,11 @@ const SEED_DATA_PROPS = {
|
|
|
18
19
|
defaultValue: "Get Started"
|
|
19
20
|
}),
|
|
20
21
|
disabled: (0, _types.createDisabledProp)(),
|
|
21
|
-
loading: (0, _types.createLoadingProp)()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
fontFamily: "system-700"
|
|
22
|
+
loading: (0, _types.createLoadingProp)(),
|
|
23
|
+
activeOpacity: (0, _types.createNumberProp)(),
|
|
24
|
+
disabledOpacity: (0, _types.createNumberProp)(),
|
|
25
|
+
delayLongPress: (0, _types.createNumberProp)(),
|
|
26
|
+
hitSlop: (0, _types.createNumberProp)()
|
|
27
27
|
};
|
|
28
28
|
const SEED_DATA = [{
|
|
29
29
|
name: "Button Outline",
|
|
@@ -31,8 +31,9 @@ const SEED_DATA = [{
|
|
|
31
31
|
category: _types.COMPONENT_TYPES.deprecated,
|
|
32
32
|
stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
33
33
|
layout: {
|
|
34
|
-
...LAYOUT,
|
|
35
34
|
backgroundColor: "transparent",
|
|
35
|
+
borderRadius: 8,
|
|
36
|
+
fontFamily: "system-700",
|
|
36
37
|
borderWidth: 1,
|
|
37
38
|
textAlign: "center"
|
|
38
39
|
},
|
|
@@ -44,7 +45,8 @@ const SEED_DATA = [{
|
|
|
44
45
|
category: _types.COMPONENT_TYPES.deprecated,
|
|
45
46
|
stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
46
47
|
layout: {
|
|
47
|
-
|
|
48
|
+
borderRadius: 8,
|
|
49
|
+
fontFamily: "system-700",
|
|
48
50
|
backgroundColor: "primary",
|
|
49
51
|
textAlign: "center"
|
|
50
52
|
},
|
|
@@ -56,7 +58,8 @@ const SEED_DATA = [{
|
|
|
56
58
|
category: _types.COMPONENT_TYPES.button,
|
|
57
59
|
stylesPanelSections: [_types.StylesPanelSections.Typography, _types.StylesPanelSections.Background, _types.StylesPanelSections.Borders, _types.StylesPanelSections.Size, _types.StylesPanelSections.MarginsAndPaddings, _types.StylesPanelSections.Position, _types.StylesPanelSections.Effects],
|
|
58
60
|
layout: {
|
|
59
|
-
|
|
61
|
+
borderRadius: 8,
|
|
62
|
+
fontFamily: "system-700",
|
|
60
63
|
backgroundColor: "primary",
|
|
61
64
|
textAlign: "center"
|
|
62
65
|
},
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.SEED_DATA = void 0;
|
|
7
|
+
var _types = require("@draftbit/types");
|
|
8
|
+
const SEED_DATA_PROPS = {
|
|
9
|
+
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Borders],
|
|
10
|
+
layout: {},
|
|
11
|
+
triggers: [_types.Triggers.OnPress, _types.Triggers.OnLongPress],
|
|
12
|
+
props: {
|
|
13
|
+
onPress: (0, _types.createActionProp)(),
|
|
14
|
+
onLongPress: (0, _types.createActionProp)(),
|
|
15
|
+
activeOpacity: (0, _types.createNumberProp)({
|
|
16
|
+
label: "Active Opacity",
|
|
17
|
+
description: "The opacity when the button is pressed.",
|
|
18
|
+
defaultValue: 0.8,
|
|
19
|
+
group: _types.GROUPS.basic
|
|
20
|
+
}),
|
|
21
|
+
disabledOpacity: (0, _types.createNumberProp)({
|
|
22
|
+
label: "Disabled Opacity",
|
|
23
|
+
description: "The opacity when the button is disabled.",
|
|
24
|
+
defaultValue: 0.8,
|
|
25
|
+
group: _types.GROUPS.basic
|
|
26
|
+
}),
|
|
27
|
+
delayLongPress: (0, _types.createNumberProp)({
|
|
28
|
+
label: "Delay Long Press",
|
|
29
|
+
description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
30
|
+
group: _types.GROUPS.basic
|
|
31
|
+
}),
|
|
32
|
+
hitSlop: (0, _types.createNumberProp)({
|
|
33
|
+
label: "Hit Slop",
|
|
34
|
+
description: "Sets additional distance outside of element in which a press can be detected.",
|
|
35
|
+
group: _types.GROUPS.basic
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const SEED_DATA = [{
|
|
40
|
+
name: "Touchable",
|
|
41
|
+
tag: "Touchable",
|
|
42
|
+
description: "An interactive view with no styles",
|
|
43
|
+
category: _types.COMPONENT_TYPES.button,
|
|
44
|
+
...SEED_DATA_PROPS
|
|
45
|
+
}, {
|
|
46
|
+
name: "Pressable",
|
|
47
|
+
tag: "Pressable",
|
|
48
|
+
description: "An interactive view with no styles",
|
|
49
|
+
category: _types.COMPONENT_TYPES.deprecated,
|
|
50
|
+
...SEED_DATA_PROPS
|
|
51
|
+
}];
|
|
52
|
+
exports.SEED_DATA = SEED_DATA;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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
|
|
2
|
+
import React, { useCallback } from "react";
|
|
3
3
|
import { Text, Pressable, Platform, StyleSheet, ActivityIndicator } from "react-native";
|
|
4
4
|
import { withTheme } from "../theming";
|
|
5
5
|
const CONSTANTS = {
|
|
@@ -14,6 +14,9 @@ function Base(_ref) {
|
|
|
14
14
|
icon,
|
|
15
15
|
title,
|
|
16
16
|
onPress,
|
|
17
|
+
onLongPress,
|
|
18
|
+
activeOpacity,
|
|
19
|
+
disabledOpacity,
|
|
17
20
|
loading,
|
|
18
21
|
disabled,
|
|
19
22
|
style,
|
|
@@ -52,17 +55,26 @@ function Base(_ref) {
|
|
|
52
55
|
if (textAlign === "right") {
|
|
53
56
|
buttonStyles.justifyContent = "flex-end";
|
|
54
57
|
}
|
|
58
|
+
const getOpacity = useCallback(pressed => {
|
|
59
|
+
if (disabled) {
|
|
60
|
+
return disabledOpacity;
|
|
61
|
+
} else {
|
|
62
|
+
if (pressed) return activeOpacity;else return 1;
|
|
63
|
+
}
|
|
64
|
+
}, [activeOpacity, disabled, disabledOpacity]);
|
|
65
|
+
const _style = useCallback(_ref2 => {
|
|
66
|
+
let {
|
|
67
|
+
pressed
|
|
68
|
+
} = _ref2;
|
|
69
|
+
return [buttonStyles, {
|
|
70
|
+
opacity: getOpacity(pressed)
|
|
71
|
+
}];
|
|
72
|
+
}, [getOpacity, buttonStyles]);
|
|
55
73
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
56
74
|
onPress: onPress,
|
|
75
|
+
onLongPress: onLongPress,
|
|
57
76
|
disabled: disabled || loading,
|
|
58
|
-
style:
|
|
59
|
-
let {
|
|
60
|
-
pressed
|
|
61
|
-
} = _ref2;
|
|
62
|
-
return [styles.base, {
|
|
63
|
-
opacity: pressed || disabled ? 0.75 : 1
|
|
64
|
-
}, buttonStyles];
|
|
65
|
-
}
|
|
77
|
+
style: (styles.base, _style)
|
|
66
78
|
}, props), loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
67
79
|
size: "small",
|
|
68
80
|
color: color,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
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
2
|
import * as React from "react";
|
|
3
|
-
import { View, StyleSheet } from "react-native";
|
|
3
|
+
import { View, StyleSheet, Pressable } from "react-native";
|
|
4
4
|
import { useTheme } from "../../theming";
|
|
5
|
-
import Touchable from "../Touchable";
|
|
6
5
|
import { usePrevious } from "../../hooks";
|
|
7
6
|
const Checkbox = _ref => {
|
|
8
7
|
let {
|
|
@@ -51,7 +50,7 @@ const Checkbox = _ref => {
|
|
|
51
50
|
onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
|
|
52
51
|
}
|
|
53
52
|
};
|
|
54
|
-
return /*#__PURE__*/React.createElement(
|
|
53
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
|
55
54
|
onPress: handlePress,
|
|
56
55
|
disabled: disabled,
|
|
57
56
|
accessibilityState: {
|
|
@@ -319,7 +319,7 @@ const DatePicker = _ref => {
|
|
|
319
319
|
onFocus: _handleFocus,
|
|
320
320
|
onBlur: _handleBlur,
|
|
321
321
|
underlineColorAndroid: "transparent",
|
|
322
|
-
style: [inputStyles, textStyles
|
|
322
|
+
style: [inputStyles, textStyles]
|
|
323
323
|
}, props))), rightIconName ? /*#__PURE__*/React.createElement(Icon, {
|
|
324
324
|
name: rightIconName,
|
|
325
325
|
size: ICON_SIZE,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
2
|
import React from "react";
|
|
3
3
|
import { withTheme } from "../theming";
|
|
4
|
-
import
|
|
4
|
+
import { Pressable } from "react-native";
|
|
5
5
|
const getWidth = numColumns => {
|
|
6
6
|
switch (numColumns) {
|
|
7
7
|
case 1:
|
|
@@ -21,7 +21,7 @@ const Card = _ref => {
|
|
|
21
21
|
...rest
|
|
22
22
|
} = _ref;
|
|
23
23
|
const width = getWidth(numColumns);
|
|
24
|
-
return /*#__PURE__*/React.createElement(
|
|
24
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
25
25
|
disabled: !onPress,
|
|
26
26
|
onPress: onPress,
|
|
27
27
|
style: [style, {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
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
2
|
import * as React from "react";
|
|
3
|
-
import { ActivityIndicator, View, StyleSheet } from "react-native";
|
|
3
|
+
import { ActivityIndicator, View, StyleSheet, Pressable } from "react-native";
|
|
4
4
|
import color from "color";
|
|
5
5
|
import Config from "./Config";
|
|
6
6
|
import Text from "./Text";
|
|
7
|
-
import Touchable from "./Touchable";
|
|
8
7
|
import Elevation from "./Elevation";
|
|
9
8
|
import { withTheme } from "../theming";
|
|
10
9
|
const FAB = _ref => {
|
|
@@ -98,7 +97,7 @@ const FAB = _ref => {
|
|
|
98
97
|
style: [{
|
|
99
98
|
elevation
|
|
100
99
|
}, style]
|
|
101
|
-
}, /*#__PURE__*/React.createElement(
|
|
100
|
+
}, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
|
102
101
|
onPress: onPress,
|
|
103
102
|
accessibilityState: {
|
|
104
103
|
disabled
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { View, StyleSheet, Text, Platform, Dimensions } from "react-native";
|
|
2
|
+
import { View, StyleSheet, Text, Platform, Dimensions, Pressable } from "react-native";
|
|
3
3
|
import { omit, pickBy, identity, isObject } from "lodash";
|
|
4
4
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
5
5
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
6
6
|
import { withTheme } from "../../theming";
|
|
7
7
|
import Portal from "../Portal/Portal";
|
|
8
|
-
import Button from "../
|
|
9
|
-
import Touchable from "../Touchable";
|
|
8
|
+
import { Button } from "../Button";
|
|
10
9
|
import { extractStyles, extractBorderAndMarginStyles, borderStyleNames, marginStyleNames } from "../../utilities";
|
|
11
10
|
function normalizeOptions(options) {
|
|
12
11
|
if (options.length === 0) {
|
|
@@ -198,7 +197,7 @@ const Picker = _ref => {
|
|
|
198
197
|
/* marginsContainer */
|
|
199
198
|
React.createElement(View, {
|
|
200
199
|
style: [styles.marginsContainer, marginStyles]
|
|
201
|
-
}, /*#__PURE__*/React.createElement(
|
|
200
|
+
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
202
201
|
disabled: disabled,
|
|
203
202
|
onPress: togglePickerVisible,
|
|
204
203
|
style: styles.touchableContainer
|
|
@@ -6,7 +6,7 @@ import omit from "lodash.omit";
|
|
|
6
6
|
import { Picker as NativePicker } from "@react-native-picker/picker";
|
|
7
7
|
import { withTheme } from "../../theming";
|
|
8
8
|
import Portal from "../Portal/Portal";
|
|
9
|
-
import Button from "../
|
|
9
|
+
import { Button } from "../Button";
|
|
10
10
|
import TextField from "../TextField";
|
|
11
11
|
import Touchable from "../Touchable";
|
|
12
12
|
import { extractStyles } from "../../utilities";
|
|
@@ -0,0 +1,40 @@
|
|
|
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, { useCallback } 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
|
+
onLongPress,
|
|
10
|
+
hitSlop,
|
|
11
|
+
delayLongPress,
|
|
12
|
+
activeOpacity,
|
|
13
|
+
disabledOpacity,
|
|
14
|
+
style,
|
|
15
|
+
...props
|
|
16
|
+
} = _ref;
|
|
17
|
+
const getOpacity = useCallback(pressed => {
|
|
18
|
+
if (disabled) {
|
|
19
|
+
return disabledOpacity;
|
|
20
|
+
} else {
|
|
21
|
+
if (pressed) return activeOpacity;else return 1;
|
|
22
|
+
}
|
|
23
|
+
}, [activeOpacity, disabled, disabledOpacity]);
|
|
24
|
+
const _style = useCallback(_ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
pressed
|
|
27
|
+
} = _ref2;
|
|
28
|
+
return [style, {
|
|
29
|
+
opacity: getOpacity(pressed)
|
|
30
|
+
}];
|
|
31
|
+
}, [getOpacity, style]);
|
|
32
|
+
return /*#__PURE__*/React.createElement(NativePressable, _extends({
|
|
33
|
+
onPress: onPress,
|
|
34
|
+
onLongPress: onLongPress,
|
|
35
|
+
disabled: disabled,
|
|
36
|
+
delayLongPress: delayLongPress ? delayLongPress : 500,
|
|
37
|
+
hitSlop: hitSlop ? hitSlop : 8,
|
|
38
|
+
style: _style
|
|
39
|
+
}, props), children);
|
|
40
|
+
}
|