@draftbit/core 47.0.1-9fd6f2.2 → 47.0.1-c14479.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 +3 -3
- package/lib/commonjs/components/Checkbox/Checkbox.js +1 -3
- package/lib/commonjs/components/Checkbox/CheckboxGroupRow.js +1 -2
- package/lib/commonjs/components/Checkbox/CheckboxRow.js +1 -2
- package/lib/commonjs/components/DeprecatedButton.js +3 -27
- package/lib/commonjs/components/DeprecatedFAB.js +1 -2
- package/lib/commonjs/components/Pressable.js +37 -0
- package/lib/commonjs/components/Touchable.js +8 -3
- package/lib/commonjs/index.js +7 -0
- package/lib/commonjs/mappings/Button.js +39 -10
- package/lib/commonjs/mappings/Touchable.js +47 -7
- package/lib/module/components/Button.js +3 -3
- package/lib/module/components/Checkbox/Checkbox.js +2 -3
- package/lib/module/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/lib/module/components/Checkbox/CheckboxRow.js +2 -3
- package/lib/module/components/DeprecatedButton.js +4 -28
- package/lib/module/components/DeprecatedFAB.js +2 -3
- package/lib/module/components/Pressable.js +30 -0
- package/lib/module/components/Touchable.js +8 -3
- package/lib/module/index.js +1 -0
- package/lib/module/mappings/Button.js +40 -11
- package/lib/module/mappings/Touchable.js +49 -9
- 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/Checkbox/CheckboxGroupRow.d.ts.map +1 -1
- package/lib/typescript/src/components/Checkbox/CheckboxRow.d.ts.map +1 -1
- package/lib/typescript/src/components/DeprecatedButton.d.ts +2 -2
- package/lib/typescript/src/components/DeprecatedButton.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/Pressable.d.ts +16 -0
- package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
- package/lib/typescript/src/components/Touchable.d.ts +7 -2
- package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.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/Touchable.d.ts +59 -5
- package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/Button.js +3 -3
- package/src/components/Button.tsx +14 -4
- package/src/components/Checkbox/Checkbox.js +2 -3
- package/src/components/Checkbox/Checkbox.tsx +5 -7
- package/src/components/Checkbox/CheckboxGroupRow.js +2 -3
- package/src/components/Checkbox/CheckboxGroupRow.tsx +3 -3
- package/src/components/Checkbox/CheckboxRow.js +2 -3
- package/src/components/Checkbox/CheckboxRow.tsx +3 -3
- package/src/components/DeprecatedButton.js +4 -16
- package/src/components/DeprecatedButton.tsx +7 -31
- package/src/components/DeprecatedFAB.js +2 -3
- package/src/components/DeprecatedFAB.tsx +5 -5
- package/src/components/Pressable.js +12 -0
- package/src/components/Pressable.tsx +50 -0
- package/src/components/Touchable.js +3 -3
- package/src/components/Touchable.tsx +14 -4
- package/src/index.js +1 -0
- package/src/index.tsx +1 -0
- package/src/mappings/Button.js +39 -10
- package/src/mappings/Button.ts +41 -10
- package/src/mappings/Touchable.js +50 -7
- 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
|
|
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(
|
|
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(
|
|
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(
|
|
85
|
+
return /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({
|
|
87
86
|
onPress: handlePress,
|
|
88
87
|
style: [viewStyles, styles.mainParent, {
|
|
89
88
|
flexDirection: direction
|
|
@@ -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(
|
|
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
|
|
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(
|
|
109
|
+
}, /*#__PURE__*/React.createElement(_reactNative.Pressable, _extends({}, rest, {
|
|
111
110
|
onPress: onPress,
|
|
112
111
|
accessibilityState: {
|
|
113
112
|
disabled
|
|
@@ -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
|
+
}
|
|
@@ -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
|
-
|
|
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
|
|
33
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
29
34
|
}, style];
|
|
30
35
|
}
|
|
31
36
|
}, props), children);
|
package/lib/commonjs/index.js
CHANGED
|
@@ -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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
87
|
+
borderRadius: 8,
|
|
88
|
+
fontFamily: "system-700",
|
|
60
89
|
backgroundColor: "primary",
|
|
61
90
|
textAlign: "center"
|
|
62
91
|
},
|
|
@@ -5,16 +5,56 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.SEED_DATA = void 0;
|
|
7
7
|
var _types = require("@draftbit/types");
|
|
8
|
-
const
|
|
9
|
-
name: "Touchable",
|
|
10
|
-
tag: "Touchable",
|
|
11
|
-
description: "Simple button with no styles",
|
|
12
|
-
category: _types.COMPONENT_TYPES.button,
|
|
8
|
+
const SEED_DATA_PROPS = {
|
|
13
9
|
stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Borders],
|
|
14
10
|
layout: {},
|
|
15
|
-
triggers: [_types.Triggers.OnPress],
|
|
11
|
+
triggers: [_types.Triggers.OnPress, _types.Triggers.OnLongPress],
|
|
16
12
|
props: {
|
|
17
|
-
onPress: (0, _types.createActionProp)()
|
|
13
|
+
onPress: (0, _types.createActionProp)(),
|
|
14
|
+
onLongPress: (0, _types.createActionProp)(),
|
|
15
|
+
activeOpacity: (0, _types.createStaticNumberProp)({
|
|
16
|
+
label: "Active Opacity",
|
|
17
|
+
description: "The opacity when the button is pressed.",
|
|
18
|
+
defaultValue: 0.8,
|
|
19
|
+
min: 0,
|
|
20
|
+
max: 1,
|
|
21
|
+
step: 0.01,
|
|
22
|
+
precision: 2,
|
|
23
|
+
required: false
|
|
24
|
+
}),
|
|
25
|
+
disabledOpacity: (0, _types.createStaticNumberProp)({
|
|
26
|
+
label: "Disabled Opacity",
|
|
27
|
+
description: "The opacity when the button is disabled.",
|
|
28
|
+
defaultValue: 0.8,
|
|
29
|
+
min: 0,
|
|
30
|
+
max: 1,
|
|
31
|
+
step: 0.01,
|
|
32
|
+
precision: 2,
|
|
33
|
+
required: false
|
|
34
|
+
}),
|
|
35
|
+
delayLongPress: (0, _types.createStaticNumberProp)({
|
|
36
|
+
label: "Delay Long Press",
|
|
37
|
+
description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
|
|
38
|
+
required: false
|
|
39
|
+
}),
|
|
40
|
+
hitSlop: (0, _types.createStaticNumberProp)({
|
|
41
|
+
label: "Hit Slop",
|
|
42
|
+
description: "Sets additional distance outside of element in which a press can be detected.",
|
|
43
|
+
required: false
|
|
44
|
+
})
|
|
18
45
|
}
|
|
19
46
|
};
|
|
47
|
+
const SEED_DATA = [{
|
|
48
|
+
name: "Touchable",
|
|
49
|
+
tag: "Touchable",
|
|
50
|
+
description: "An interactive view with no styles",
|
|
51
|
+
category: _types.COMPONENT_TYPES.deprecated,
|
|
52
|
+
...SEED_DATA_PROPS
|
|
53
|
+
}, {
|
|
54
|
+
name: "Pressable",
|
|
55
|
+
tag: "Pressable",
|
|
56
|
+
description: "An interactive view with no styles",
|
|
57
|
+
category: _types.COMPONENT_TYPES.button,
|
|
58
|
+
...SEED_DATA_PROPS
|
|
59
|
+
}];
|
|
20
60
|
exports.SEED_DATA = SEED_DATA;
|
|
@@ -13,10 +13,11 @@ function Base(_ref) {
|
|
|
13
13
|
Icon,
|
|
14
14
|
icon,
|
|
15
15
|
title,
|
|
16
|
-
onPress,
|
|
17
16
|
loading,
|
|
18
17
|
disabled,
|
|
19
18
|
style,
|
|
19
|
+
activeOpacity,
|
|
20
|
+
disabledOpacity,
|
|
20
21
|
...props
|
|
21
22
|
} = _ref;
|
|
22
23
|
const {
|
|
@@ -53,14 +54,13 @@ function Base(_ref) {
|
|
|
53
54
|
buttonStyles.justifyContent = "flex-end";
|
|
54
55
|
}
|
|
55
56
|
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
56
|
-
onPress: onPress,
|
|
57
57
|
disabled: disabled || loading,
|
|
58
58
|
style: _ref2 => {
|
|
59
59
|
let {
|
|
60
60
|
pressed
|
|
61
61
|
} = _ref2;
|
|
62
62
|
return [styles.base, {
|
|
63
|
-
opacity: pressed
|
|
63
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
64
64
|
}, buttonStyles];
|
|
65
65
|
}
|
|
66
66
|
}, props), loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
|
|
@@ -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: {
|
|
@@ -1,11 +1,10 @@
|
|
|
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 { StyleSheet, View, Platform } from "react-native";
|
|
3
|
+
import { StyleSheet, View, Platform, Pressable } from "react-native";
|
|
4
4
|
import Checkbox from "./Checkbox";
|
|
5
5
|
import Text from "../Text";
|
|
6
6
|
import { useCheckboxGroupContext } from "./context";
|
|
7
7
|
import { Direction as GroupDirection } from "./context";
|
|
8
|
-
import Touchable from "../Touchable";
|
|
9
8
|
import { extractStyles } from "../../utilities";
|
|
10
9
|
export let Direction;
|
|
11
10
|
(function (Direction) {
|
|
@@ -64,7 +63,7 @@ const CheckboxGroupRow = _ref => {
|
|
|
64
63
|
textStyles,
|
|
65
64
|
viewStyles
|
|
66
65
|
} = extractStyles(style);
|
|
67
|
-
return /*#__PURE__*/React.createElement(
|
|
66
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
68
67
|
onPress: handlePress,
|
|
69
68
|
style: [styles.mainParent, {
|
|
70
69
|
flexDirection: direction
|
|
@@ -1,11 +1,10 @@
|
|
|
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 { StyleSheet, View, Platform } from "react-native";
|
|
3
|
+
import { StyleSheet, View, Platform, Pressable } from "react-native";
|
|
4
4
|
import { isString } from "lodash";
|
|
5
5
|
import { extractStyles } from "../../utilities";
|
|
6
6
|
import { usePrevious } from "../../hooks";
|
|
7
7
|
import Text from "../Text";
|
|
8
|
-
import Touchable from "../Touchable";
|
|
9
8
|
import Checkbox from "./Checkbox";
|
|
10
9
|
export let Direction;
|
|
11
10
|
(function (Direction) {
|
|
@@ -73,7 +72,7 @@ const CheckboxRow = _ref => {
|
|
|
73
72
|
textStyles,
|
|
74
73
|
viewStyles
|
|
75
74
|
} = extractStyles(style);
|
|
76
|
-
return /*#__PURE__*/React.createElement(
|
|
75
|
+
return /*#__PURE__*/React.createElement(Pressable, _extends({
|
|
77
76
|
onPress: handlePress,
|
|
78
77
|
style: [viewStyles, styles.mainParent, {
|
|
79
78
|
flexDirection: direction
|
|
@@ -1,9 +1,8 @@
|
|
|
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, Text, StyleSheet } from "react-native";
|
|
3
|
+
import { ActivityIndicator, View, Text, StyleSheet, Pressable } from "react-native";
|
|
4
4
|
import color from "color";
|
|
5
5
|
import Config from "./Config";
|
|
6
|
-
import Touchable from "./Touchable";
|
|
7
6
|
import Elevation from "./Elevation";
|
|
8
7
|
import { withTheme } from "../theming";
|
|
9
8
|
const Button = _ref => {
|
|
@@ -18,7 +17,6 @@ const Button = _ref => {
|
|
|
18
17
|
children,
|
|
19
18
|
onPress,
|
|
20
19
|
elevation = 0,
|
|
21
|
-
style,
|
|
22
20
|
theme: {
|
|
23
21
|
colors,
|
|
24
22
|
disabledOpacity,
|
|
@@ -72,41 +70,19 @@ const Button = _ref => {
|
|
|
72
70
|
marginRight: -8,
|
|
73
71
|
width: Config.buttonIconSize
|
|
74
72
|
}];
|
|
75
|
-
const {
|
|
76
|
-
margin,
|
|
77
|
-
marginEnd,
|
|
78
|
-
marginTop,
|
|
79
|
-
marginLeft,
|
|
80
|
-
marginRight,
|
|
81
|
-
marginBottom,
|
|
82
|
-
marginHorizontal,
|
|
83
|
-
marginVertical,
|
|
84
|
-
...innerStyles
|
|
85
|
-
} = StyleSheet.flatten(style || {});
|
|
86
|
-
const margins = {
|
|
87
|
-
margin,
|
|
88
|
-
marginEnd,
|
|
89
|
-
marginTop,
|
|
90
|
-
marginLeft,
|
|
91
|
-
marginRight,
|
|
92
|
-
marginBottom,
|
|
93
|
-
marginHorizontal,
|
|
94
|
-
marginVertical
|
|
95
|
-
};
|
|
96
73
|
return /*#__PURE__*/React.createElement(Elevation, {
|
|
97
74
|
style: {
|
|
98
75
|
elevation,
|
|
99
|
-
alignSelf: "stretch"
|
|
100
|
-
...margins
|
|
76
|
+
alignSelf: "stretch"
|
|
101
77
|
}
|
|
102
|
-
}, /*#__PURE__*/React.createElement(
|
|
78
|
+
}, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
|
|
103
79
|
onPress: onPress,
|
|
104
80
|
accessibilityState: {
|
|
105
81
|
disabled
|
|
106
82
|
},
|
|
107
83
|
accessibilityRole: "button",
|
|
108
84
|
disabled: disabled || loading,
|
|
109
|
-
style: [styles.button, buttonStyle
|
|
85
|
+
style: [styles.button, buttonStyle]
|
|
110
86
|
}), /*#__PURE__*/React.createElement(View, {
|
|
111
87
|
style: styles.content
|
|
112
88
|
}, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
|
|
@@ -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
|
|
@@ -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
|
+
}
|
|
@@ -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
|
-
|
|
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
|
|
26
|
+
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1
|
|
22
27
|
}, style];
|
|
23
28
|
}
|
|
24
29
|
}, props), children);
|
package/lib/module/index.js
CHANGED
|
@@ -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";
|