@draftbit/core 47.0.1-cc5ccc.2 → 47.0.1-ed6e56.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 (99) hide show
  1. package/lib/commonjs/components/Button.js +15 -27
  2. package/lib/commonjs/components/Checkbox/Checkbox.js +3 -1
  3. package/lib/commonjs/components/DatePicker/DatePicker.js +1 -0
  4. package/lib/commonjs/components/DatePicker/DatePickerComponent.js +3 -9
  5. package/lib/commonjs/components/DatePicker/DatePickerComponent.web.js +0 -1
  6. package/lib/commonjs/components/DatePicker/DatePickerInput.js +133 -0
  7. package/lib/commonjs/components/DeprecatedButton.js +151 -0
  8. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
  9. package/lib/commonjs/components/DeprecatedFAB.js +2 -1
  10. package/lib/commonjs/components/Picker/Picker.js +4 -3
  11. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  12. package/lib/commonjs/components/Touchable.js +11 -27
  13. package/lib/commonjs/components/Touchable.web.js +9 -0
  14. package/lib/commonjs/mappings/Button.js +10 -13
  15. package/lib/commonjs/mappings/Touchable.js +20 -0
  16. package/lib/module/components/Button.js +9 -21
  17. package/lib/module/components/Checkbox/Checkbox.js +3 -2
  18. package/lib/module/components/DatePicker/DatePicker.js +1 -0
  19. package/lib/module/components/DatePicker/DatePickerComponent.js +3 -9
  20. package/lib/module/components/DatePicker/DatePickerComponent.web.js +0 -1
  21. package/lib/module/components/DatePicker/DatePickerInput.js +123 -0
  22. package/lib/module/components/DeprecatedButton.js +141 -0
  23. package/lib/module/components/DeprecatedCardWrapper.js +2 -2
  24. package/lib/module/components/DeprecatedFAB.js +3 -2
  25. package/lib/module/components/Picker/Picker.js +4 -3
  26. package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
  27. package/lib/module/components/Touchable.js +10 -25
  28. package/lib/module/components/Touchable.web.js +2 -0
  29. package/lib/module/mappings/Button.js +11 -14
  30. package/lib/module/mappings/Touchable.js +13 -0
  31. package/lib/typescript/src/components/Button.d.ts +0 -2
  32. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  33. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  34. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  35. package/lib/typescript/src/components/DatePicker/DatePicker.d.ts.map +1 -1
  36. package/lib/typescript/src/components/DatePicker/DatePickerComponent.d.ts.map +1 -1
  37. package/lib/typescript/src/components/DatePicker/DatePickerComponent.web.d.ts.map +1 -1
  38. package/lib/typescript/src/components/DatePicker/DatePickerComponentType.d.ts +2 -0
  39. package/lib/typescript/src/components/DatePicker/DatePickerComponentType.d.ts.map +1 -1
  40. package/lib/typescript/src/components/DatePicker/DatePickerInput.d.ts +18 -0
  41. package/lib/typescript/src/components/DatePicker/DatePickerInput.d.ts.map +1 -0
  42. package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
  43. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
  44. package/lib/typescript/src/components/DeprecatedCardWrapper.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/Picker/Picker.d.ts.map +1 -1
  48. package/lib/typescript/src/components/Touchable.d.ts +2 -9
  49. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  50. package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
  51. package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
  52. package/lib/typescript/src/mappings/Button.d.ts +4 -113
  53. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  54. package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
  55. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
  56. package/package.json +6 -6
  57. package/src/components/Button.js +11 -18
  58. package/src/components/Button.tsx +11 -45
  59. package/src/components/Checkbox/Checkbox.js +3 -2
  60. package/src/components/Checkbox/Checkbox.tsx +7 -5
  61. package/src/components/DatePicker/DatePicker.js +1 -1
  62. package/src/components/DatePicker/DatePicker.tsx +1 -0
  63. package/src/components/DatePicker/DatePickerComponent.js +3 -5
  64. package/src/components/DatePicker/DatePickerComponent.tsx +3 -11
  65. package/src/components/DatePicker/DatePickerComponent.web.js +1 -1
  66. package/src/components/DatePicker/DatePickerComponent.web.tsx +0 -1
  67. package/src/components/DatePicker/DatePickerComponentType.ts +9 -0
  68. package/src/components/DatePicker/DatePickerInput.js +97 -0
  69. package/src/components/DatePicker/DatePickerInput.tsx +195 -0
  70. package/src/components/DeprecatedButton.js +95 -0
  71. package/src/components/DeprecatedButton.tsx +214 -0
  72. package/src/components/DeprecatedCardWrapper.js +2 -2
  73. package/src/components/DeprecatedCardWrapper.tsx +4 -3
  74. package/src/components/DeprecatedFAB.js +3 -2
  75. package/src/components/DeprecatedFAB.tsx +5 -5
  76. package/src/components/Picker/Picker.js +4 -3
  77. package/src/components/Picker/Picker.tsx +4 -4
  78. package/src/components/Picker/PickerComponent.ios.js +1 -1
  79. package/src/components/Picker/PickerComponent.ios.tsx +1 -1
  80. package/src/components/Touchable.js +11 -16
  81. package/src/components/Touchable.tsx +11 -42
  82. package/src/components/Touchable.web.js +2 -0
  83. package/src/components/Touchable.web.tsx +3 -0
  84. package/src/mappings/Button.js +10 -13
  85. package/src/mappings/Button.ts +10 -13
  86. package/src/mappings/Touchable.js +17 -0
  87. package/src/mappings/Touchable.ts +23 -0
  88. package/lib/commonjs/components/Pressable.js +0 -48
  89. package/lib/commonjs/mappings/Pressable.js +0 -52
  90. package/lib/module/components/Pressable.js +0 -40
  91. package/lib/module/mappings/Pressable.js +0 -45
  92. package/lib/typescript/src/components/Pressable.d.ts +0 -18
  93. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  94. package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
  95. package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
  96. package/src/components/Pressable.js +0 -17
  97. package/src/components/Pressable.tsx +0 -67
  98. package/src/mappings/Pressable.js +0 -52
  99. package/src/mappings/Pressable.ts +0 -63
@@ -0,0 +1,20 @@
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 = {
9
+ name: "Touchable",
10
+ tag: "Touchable",
11
+ description: "Simple button with no styles",
12
+ category: _types.COMPONENT_TYPES.button,
13
+ stylesPanelSections: [_types.StylesPanelSections.Size, _types.StylesPanelSections.Margins, _types.StylesPanelSections.Borders],
14
+ layout: {},
15
+ triggers: [_types.Triggers.OnPress],
16
+ props: {
17
+ onPress: (0, _types.createActionProp)()
18
+ }
19
+ };
20
+ 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 React, { useCallback } from "react";
2
+ import * as React from "react";
3
3
  import { Text, Pressable, Platform, StyleSheet, ActivityIndicator } from "react-native";
4
4
  import { withTheme } from "../theming";
5
5
  const CONSTANTS = {
@@ -14,9 +14,6 @@ function Base(_ref) {
14
14
  icon,
15
15
  title,
16
16
  onPress,
17
- onLongPress,
18
- activeOpacity,
19
- disabledOpacity,
20
17
  loading,
21
18
  disabled,
22
19
  style,
@@ -55,26 +52,17 @@ function Base(_ref) {
55
52
  if (textAlign === "right") {
56
53
  buttonStyles.justifyContent = "flex-end";
57
54
  }
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]);
73
55
  return /*#__PURE__*/React.createElement(Pressable, _extends({
74
56
  onPress: onPress,
75
- onLongPress: onLongPress,
76
57
  disabled: disabled || loading,
77
- style: (styles.base, _style)
58
+ style: _ref2 => {
59
+ let {
60
+ pressed
61
+ } = _ref2;
62
+ return [styles.base, {
63
+ opacity: pressed || disabled ? 0.75 : 1
64
+ }, buttonStyles];
65
+ }
78
66
  }, props), loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
79
67
  size: "small",
80
68
  color: color,
@@ -1,7 +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 { View, StyleSheet, Pressable } from "react-native";
3
+ import { View, StyleSheet } from "react-native";
4
4
  import { useTheme } from "../../theming";
5
+ import Touchable from "../Touchable";
5
6
  import { usePrevious } from "../../hooks";
6
7
  const Checkbox = _ref => {
7
8
  let {
@@ -50,7 +51,7 @@ const Checkbox = _ref => {
50
51
  onUncheck === null || onUncheck === void 0 ? void 0 : onUncheck();
51
52
  }
52
53
  };
53
- return /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
54
+ return /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
54
55
  onPress: handlePress,
55
56
  disabled: disabled,
56
57
  accessibilityState: {
@@ -343,6 +343,7 @@ const DatePicker = _ref => {
343
343
  }, /*#__PURE__*/React.createElement(DateTimePicker, {
344
344
  value: getValidDate(),
345
345
  mode: mode,
346
+ displayMode: "default",
346
347
  isVisible: pickerVisible,
347
348
  toggleVisibility: toggleVisibility,
348
349
  onChange: (_event, data) => {
@@ -1,19 +1,18 @@
1
1
  import React from "react";
2
- import { Platform } from "react-native";
3
- import DateTimePicker from "@react-native-community/datetimepicker";
4
2
  import DateTimePickerModal from "react-native-modal-datetime-picker";
5
3
  const DatePickerComponent = _ref => {
6
4
  let {
7
5
  value,
8
6
  onChange,
7
+ displayMode = "default",
9
8
  mode,
10
9
  toggleVisibility
11
10
  } = _ref;
12
- return Platform.OS === "ios" || Platform.OS === "android" ? /*#__PURE__*/React.createElement(DateTimePickerModal, {
11
+ return /*#__PURE__*/React.createElement(DateTimePickerModal, {
13
12
  date: value,
14
13
  mode: mode,
15
14
  isVisible: true,
16
- display: Platform.OS === "ios" ? "spinner" : "default",
15
+ display: displayMode,
17
16
  onCancel: () => {
18
17
  console.log("Picker cancelled before selecting anything.");
19
18
  toggleVisibility();
@@ -21,11 +20,6 @@ const DatePickerComponent = _ref => {
21
20
  onConfirm: data => {
22
21
  onChange(null, data);
23
22
  }
24
- }) : /*#__PURE__*/React.createElement(DateTimePicker, {
25
- value: value,
26
- mode: mode,
27
- onChange: onChange,
28
- display: "default"
29
23
  });
30
24
  };
31
25
  export default DatePickerComponent;
@@ -36,7 +36,6 @@ const DatePickerComponent = _ref => {
36
36
  onChange(null, d);
37
37
  },
38
38
  onClose: () => toggleVisibility(),
39
- variant: "dialog",
40
39
  TextFieldComponent: () => null
41
40
  })));
42
41
  };
@@ -0,0 +1,123 @@
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 * as React from "react";
3
+ import { View, TextInput, Platform } from "react-native";
4
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
5
+ import dateFormat from "dateformat";
6
+ import Portal from "../Portal/Portal";
7
+ import Touchable from "../Touchable";
8
+ import DateTimePicker from "./DatePickerComponent";
9
+ const MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
10
+ const DatePickerInput = _ref => {
11
+ let {
12
+ style,
13
+ date,
14
+ onDateChange = () => {},
15
+ defaultValue,
16
+ disabled = false,
17
+ mode = "date",
18
+ format,
19
+ androidDisplay = "default",
20
+ iosDisplay = "default",
21
+ webDisplay = "dialog",
22
+ placeholder,
23
+ ...props
24
+ } = _ref;
25
+ const [value, setValue] = React.useState(date || defaultValue);
26
+ React.useEffect(() => {
27
+ if (defaultValue != null) {
28
+ setValue(defaultValue);
29
+ }
30
+ }, [defaultValue]);
31
+ const [pickerVisible, setPickerVisible] = React.useState(false);
32
+ const [focused, setFocused] = React.useState(false);
33
+ const getValidDate = () => {
34
+ if (!value) {
35
+ return new Date();
36
+ }
37
+ return typeof (value === null || value === void 0 ? void 0 : value.getMonth) === "function" ? value : new Date();
38
+ };
39
+ const formatDate = () => {
40
+ if (!value) return "";
41
+ let newDate = getValidDate();
42
+ if (format) return dateFormat(newDate, format);
43
+ if (mode === "time") {
44
+ return "".concat(newDate.toLocaleTimeString());
45
+ }
46
+ if (mode === "datetime") {
47
+ return "".concat(newDate.toLocaleString());
48
+ }
49
+ return "".concat(MONTHS[newDate.getMonth()], " ").concat(newDate.getDate(), ", ").concat(newDate.getFullYear());
50
+ };
51
+ const toggleVisibility = async () => {
52
+ setPickerVisible(!pickerVisible);
53
+ focused ? _handleBlur() : _handleFocus();
54
+ };
55
+ const insets = useSafeAreaInsets();
56
+ React.useEffect(() => {
57
+ setValue(date);
58
+ }, [date]);
59
+ const _handleFocus = () => {
60
+ if (disabled) {
61
+ return;
62
+ }
63
+ setFocused(true);
64
+ };
65
+ const _handleBlur = () => {
66
+ if (disabled) {
67
+ return;
68
+ }
69
+ setFocused(false);
70
+ };
71
+ return /*#__PURE__*/React.createElement(View, null, /*#__PURE__*/React.createElement(Touchable, {
72
+ disabled: disabled,
73
+ onPress: toggleVisibility
74
+ }, /*#__PURE__*/React.createElement(TextInput, _extends({
75
+ value: formatDate(),
76
+ placeholder: placeholder,
77
+ editable: !disabled,
78
+ onFocus: _handleFocus,
79
+ onBlur: _handleBlur,
80
+ style: style
81
+ }, props))), pickerVisible && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(View, {
82
+ style: {
83
+ paddingTop: insets.top,
84
+ paddingBottom: insets.bottom,
85
+ paddingLeft: insets.left,
86
+ paddingRight: insets.right
87
+ }
88
+ }, Platform.OS === "web" && /*#__PURE__*/React.createElement(DateTimePicker, {
89
+ value: getValidDate(),
90
+ mode: mode,
91
+ isVisible: pickerVisible,
92
+ toggleVisibility: toggleVisibility,
93
+ onChange: (_event, data) => {
94
+ toggleVisibility();
95
+ setValue(data);
96
+ onDateChange(data);
97
+ }
98
+ }), Platform.OS === "ios" && /*#__PURE__*/React.createElement(DateTimePicker, {
99
+ value: getValidDate(),
100
+ mode: mode,
101
+ displayMode: iosDisplay,
102
+ isVisible: pickerVisible,
103
+ toggleVisibility: toggleVisibility,
104
+ onChange: (_event, data) => {
105
+ toggleVisibility();
106
+ setValue(data);
107
+ onDateChange(data);
108
+ }
109
+ }), Platform.OS === "android" && /*#__PURE__*/React.createElement(DateTimePicker, {
110
+ value: getValidDate(),
111
+ mode: mode,
112
+ variant: webDisplay,
113
+ displayMode: androidDisplay,
114
+ isVisible: pickerVisible,
115
+ toggleVisibility: toggleVisibility,
116
+ onChange: (_event, data) => {
117
+ toggleVisibility();
118
+ setValue(data);
119
+ onDateChange(data);
120
+ }
121
+ }))));
122
+ };
123
+ export default DatePickerInput;
@@ -0,0 +1,141 @@
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 * as React from "react";
3
+ import { ActivityIndicator, View, Text, StyleSheet } from "react-native";
4
+ import color from "color";
5
+ import Config from "./Config";
6
+ import Touchable from "./Touchable";
7
+ import Elevation from "./Elevation";
8
+ import { withTheme } from "../theming";
9
+ const Button = _ref => {
10
+ let {
11
+ Icon,
12
+ icon,
13
+ disabled = false,
14
+ type = "solid",
15
+ loading = false,
16
+ labelColor,
17
+ color: colorOverride,
18
+ children,
19
+ onPress,
20
+ elevation = 0,
21
+ style,
22
+ theme: {
23
+ colors,
24
+ disabledOpacity,
25
+ roundness,
26
+ typography
27
+ },
28
+ ...rest
29
+ } = _ref;
30
+ let backgroundColor, borderColor, textColor, borderWidth;
31
+ const buttonColor = colorOverride || colors.primary;
32
+ if (type === "solid") {
33
+ backgroundColor = buttonColor;
34
+ if (disabled) {
35
+ textColor = color(colors.surface).alpha(disabledOpacity).rgb().string();
36
+ } else {
37
+ textColor = labelColor || colors.surface;
38
+ }
39
+ } else {
40
+ backgroundColor = "transparent";
41
+ if (disabled) {
42
+ textColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
43
+ } else {
44
+ textColor = labelColor || buttonColor;
45
+ }
46
+ }
47
+ if (type === "outline") {
48
+ if (disabled) {
49
+ borderColor = color(buttonColor).alpha(disabledOpacity).rgb().string();
50
+ } else {
51
+ borderColor = buttonColor;
52
+ }
53
+ borderWidth = StyleSheet.hairlineWidth;
54
+ } else {
55
+ borderColor = "transparent";
56
+ borderWidth = 0;
57
+ }
58
+ const buttonStyle = {
59
+ backgroundColor,
60
+ borderColor,
61
+ borderWidth,
62
+ borderRadius: roundness
63
+ };
64
+ const textStyle = {
65
+ textAlign: "center",
66
+ color: textColor,
67
+ marginVertical: 16,
68
+ marginHorizontal: 16
69
+ };
70
+ const iconStyle = [styles.icon, {
71
+ marginLeft: 16,
72
+ marginRight: -8,
73
+ width: Config.buttonIconSize
74
+ }];
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
+ return /*#__PURE__*/React.createElement(Elevation, {
97
+ style: {
98
+ elevation,
99
+ alignSelf: "stretch",
100
+ ...margins
101
+ }
102
+ }, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
103
+ onPress: onPress,
104
+ accessibilityState: {
105
+ disabled
106
+ },
107
+ accessibilityRole: "button",
108
+ disabled: disabled || loading,
109
+ style: [styles.button, buttonStyle, innerStyles]
110
+ }), /*#__PURE__*/React.createElement(View, {
111
+ style: styles.content
112
+ }, icon && loading !== true ? /*#__PURE__*/React.createElement(View, {
113
+ style: iconStyle
114
+ }, /*#__PURE__*/React.createElement(Icon, {
115
+ name: icon,
116
+ size: Config.buttonIconSize,
117
+ color: textColor
118
+ })) : null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
119
+ size: "small",
120
+ color: textColor,
121
+ style: iconStyle
122
+ }) : null, /*#__PURE__*/React.createElement(Text, {
123
+ numberOfLines: 1,
124
+ style: [textStyle, typography.button]
125
+ }, children))));
126
+ };
127
+ const styles = StyleSheet.create({
128
+ button: {
129
+ minWidth: 64,
130
+ borderStyle: "solid"
131
+ },
132
+ content: {
133
+ flexDirection: "row",
134
+ alignItems: "center",
135
+ justifyContent: "center"
136
+ },
137
+ icon: {
138
+ width: Config.buttonIconSize
139
+ }
140
+ });
141
+ export default withTheme(Button);
@@ -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 { Pressable } from "react-native";
4
+ import Touchable from "./Touchable";
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(Pressable, _extends({
24
+ return /*#__PURE__*/React.createElement(Touchable, _extends({
25
25
  disabled: !onPress,
26
26
  onPress: onPress,
27
27
  style: [style, {
@@ -1,9 +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 { ActivityIndicator, View, StyleSheet, Pressable } from "react-native";
3
+ import { ActivityIndicator, View, StyleSheet } 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";
7
8
  import Elevation from "./Elevation";
8
9
  import { withTheme } from "../theming";
9
10
  const FAB = _ref => {
@@ -97,7 +98,7 @@ const FAB = _ref => {
97
98
  style: [{
98
99
  elevation
99
100
  }, style]
100
- }, /*#__PURE__*/React.createElement(Pressable, _extends({}, rest, {
101
+ }, /*#__PURE__*/React.createElement(Touchable, _extends({}, rest, {
101
102
  onPress: onPress,
102
103
  accessibilityState: {
103
104
  disabled
@@ -1,11 +1,12 @@
1
1
  import * as React from "react";
2
- import { View, StyleSheet, Text, Platform, Dimensions, Pressable } from "react-native";
2
+ import { View, StyleSheet, Text, Platform, Dimensions } 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 "../Button";
8
+ import Button from "../DeprecatedButton";
9
+ import Touchable from "../Touchable";
9
10
  import { extractStyles, extractBorderAndMarginStyles, borderStyleNames, marginStyleNames } from "../../utilities";
10
11
  function normalizeOptions(options) {
11
12
  if (options.length === 0) {
@@ -197,7 +198,7 @@ const Picker = _ref => {
197
198
  /* marginsContainer */
198
199
  React.createElement(View, {
199
200
  style: [styles.marginsContainer, marginStyles]
200
- }, /*#__PURE__*/React.createElement(Pressable, {
201
+ }, /*#__PURE__*/React.createElement(Touchable, {
201
202
  disabled: disabled,
202
203
  onPress: togglePickerVisible,
203
204
  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 "../Button";
9
+ import Button from "../DeprecatedButton";
10
10
  import TextField from "../TextField";
11
11
  import Touchable from "../Touchable";
12
12
  import { extractStyles } from "../../utilities";
@@ -1,40 +1,25 @@
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 React, { useCallback } from "react";
2
+ import React from "react";
3
3
  import { Pressable } from "react-native";
4
4
  export default function Touchable(_ref) {
5
5
  let {
6
6
  children,
7
7
  disabled,
8
8
  onPress,
9
- onLongPress,
10
- hitSlop,
11
- delayLongPress,
12
- activeOpacity,
13
- disabledOpacity,
14
9
  style,
15
10
  ...props
16
11
  } = _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
12
  return /*#__PURE__*/React.createElement(Pressable, _extends({
33
13
  onPress: onPress,
34
- onLongPress: onLongPress,
35
14
  disabled: disabled,
36
- delayLongPress: delayLongPress ? delayLongPress : 500,
37
- hitSlop: hitSlop ? hitSlop : 8,
38
- style: _style
15
+ hitSlop: 8,
16
+ style: _ref2 => {
17
+ let {
18
+ pressed
19
+ } = _ref2;
20
+ return [{
21
+ opacity: pressed || disabled ? 0.75 : 1
22
+ }, style];
23
+ }
39
24
  }, props), children);
40
25
  }
@@ -0,0 +1,2 @@
1
+ import { TouchableOpacity } from "react-native";
2
+ export default TouchableOpacity;
@@ -1,8 +1,7 @@
1
- import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, createNumberProp } from "@draftbit/types";
2
- const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
1
+ import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections } from "@draftbit/types";
2
+ const SEED_DATA_TRIGGERS = [Triggers.OnPress];
3
3
  const SEED_DATA_PROPS = {
4
4
  onPress: createActionProp(),
5
- onLongPress: createActionProp(),
6
5
  icon: createIconProp({
7
6
  defaultValue: null,
8
7
  required: false
@@ -13,11 +12,12 @@ const SEED_DATA_PROPS = {
13
12
  defaultValue: "Get Started"
14
13
  }),
15
14
  disabled: createDisabledProp(),
16
- loading: createLoadingProp(),
17
- activeOpacity: createNumberProp(),
18
- disabledOpacity: createNumberProp(),
19
- delayLongPress: createNumberProp(),
20
- hitSlop: createNumberProp()
15
+ loading: createLoadingProp()
16
+ };
17
+ const LAYOUT = {
18
+ backgroundColor: "transparent",
19
+ borderRadius: 8,
20
+ fontFamily: "system-700"
21
21
  };
22
22
  export const SEED_DATA = [{
23
23
  name: "Button Outline",
@@ -25,9 +25,8 @@ export const SEED_DATA = [{
25
25
  category: COMPONENT_TYPES.deprecated,
26
26
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
27
27
  layout: {
28
+ ...LAYOUT,
28
29
  backgroundColor: "transparent",
29
- borderRadius: 8,
30
- fontFamily: "system-700",
31
30
  borderWidth: 1,
32
31
  textAlign: "center"
33
32
  },
@@ -39,8 +38,7 @@ export const SEED_DATA = [{
39
38
  category: COMPONENT_TYPES.deprecated,
40
39
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
41
40
  layout: {
42
- borderRadius: 8,
43
- fontFamily: "system-700",
41
+ ...LAYOUT,
44
42
  backgroundColor: "primary",
45
43
  textAlign: "center"
46
44
  },
@@ -52,8 +50,7 @@ export const SEED_DATA = [{
52
50
  category: COMPONENT_TYPES.button,
53
51
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
54
52
  layout: {
55
- borderRadius: 8,
56
- fontFamily: "system-700",
53
+ ...LAYOUT,
57
54
  backgroundColor: "primary",
58
55
  textAlign: "center"
59
56
  },
@@ -0,0 +1,13 @@
1
+ import { COMPONENT_TYPES, createActionProp, Triggers, StylesPanelSections } from "@draftbit/types";
2
+ export const SEED_DATA = {
3
+ name: "Touchable",
4
+ tag: "Touchable",
5
+ description: "Simple button with no styles",
6
+ category: COMPONENT_TYPES.button,
7
+ stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Borders],
8
+ layout: {},
9
+ triggers: [Triggers.OnPress],
10
+ props: {
11
+ onPress: createActionProp()
12
+ }
13
+ };
@@ -1,5 +1,3 @@
1
- import { PressableStateCallbackType, StyleProp, ViewStyle } from "react-native";
2
- export declare type StyleType = (state: PressableStateCallbackType) => StyleProp<ViewStyle>;
3
1
  declare const ButtonSolid: any;
4
2
  export { ButtonSolid };
5
3
  declare const Button: any;
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"AACA,OAAO,EAIL,0BAA0B,EAG1B,SAAS,EAET,SAAS,EAEV,MAAM,cAAc,CAAC;AA+CtB,oBAAY,SAAS,GAAG,CACtB,KAAK,EAAE,0BAA0B,KAC9B,SAAS,CAAC,SAAS,CAAC,CAAC;AA+G1B,QAAA,MAAM,WAAW,EAAE,GAAsB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,QAAA,MAAM,MAAM,EAAE,GAAsB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,CAAC;AAmBlB,QAAA,MAAM,aAAa,EAAE,GAAwB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button.tsx"],"names":[],"mappings":"AA0IA,QAAA,MAAM,WAAW,EAAE,GAAsB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,QAAA,MAAM,MAAM,EAAE,GAAsB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,CAAC;AAmBlB,QAAA,MAAM,aAAa,EAAE,GAAwB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { StyleProp, ViewStyle, PressableProps } from "react-native";
2
+ import { TouchableHighlightProps, StyleProp, ViewStyle } from "react-native";
3
3
  import type { IconSlot } from "../../interfaces/Icon";
4
4
  export interface CheckboxProps {
5
5
  status?: boolean;
@@ -15,6 +15,6 @@ export interface CheckboxProps {
15
15
  size?: number;
16
16
  style?: StyleProp<ViewStyle>;
17
17
  }
18
- declare const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot>;
18
+ declare const Checkbox: React.FC<CheckboxProps & TouchableHighlightProps & IconSlot>;
19
19
  export default Checkbox;
20
20
  //# sourceMappingURL=Checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,SAAS,EACT,SAAS,EAET,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED,QAAA,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,GAAG,cAAc,GAAG,QAAQ,CAoFjE,CAAC;AAqBF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAGL,uBAAuB,EACvB,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAKtD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,Q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;IACrC,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,GAAG,QAAQ,GACV,cAAc,CAAC;;;;AAggBjB,wBAAqC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/DatePicker/DatePickerComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,wBAAwB,IAAI,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAE9E,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CA4BjE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"DatePickerComponent.d.ts","sourceRoot":"","sources":["../../../../../src/components/DatePicker/DatePickerComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,wBAAwB,IAAI,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAE9E,QAAA,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAsBjE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}