@draftbit/core 47.0.1-cc5ccc.2 → 47.0.1-df014a.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 (88) 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/DeprecatedButton.js +151 -0
  4. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
  5. package/lib/commonjs/components/DeprecatedFAB.js +2 -1
  6. package/lib/commonjs/components/Picker/Picker.js +4 -3
  7. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  8. package/lib/commonjs/components/Touchable.js +11 -27
  9. package/lib/commonjs/components/Touchable.web.js +9 -0
  10. package/lib/commonjs/mappings/Button.js +10 -13
  11. package/lib/commonjs/mappings/DatePickerModal.js +74 -0
  12. package/lib/commonjs/mappings/Touchable.js +20 -0
  13. package/lib/module/components/AvatarEdit.js +15 -4
  14. package/lib/module/components/Button.js +9 -21
  15. package/lib/module/components/CardBlock.js +14 -4
  16. package/lib/module/components/Checkbox/Checkbox.js +3 -2
  17. package/lib/module/components/CircleImage.js +16 -1
  18. package/lib/module/components/DeprecatedButton.js +141 -0
  19. package/lib/module/components/DeprecatedCardWrapper.js +20 -3
  20. package/lib/module/components/DeprecatedFAB.js +3 -2
  21. package/lib/module/components/FAB.js +22 -4
  22. package/lib/module/components/Picker/Picker.js +4 -3
  23. package/lib/module/components/Picker/PickerComponent.ios.js +37 -12
  24. package/lib/module/components/Picker/PickerComponent.web.js +21 -3
  25. package/lib/module/components/Switch.js +21 -10
  26. package/lib/module/components/TextField.js +78 -28
  27. package/lib/module/components/Touchable.js +28 -26
  28. package/lib/module/components/Touchable.web.js +2 -0
  29. package/lib/module/mappings/Button.js +11 -14
  30. package/lib/module/mappings/DatePickerModal.js +65 -0
  31. package/lib/module/mappings/Touchable.js +13 -0
  32. package/lib/typescript/src/components/Button.d.ts +0 -2
  33. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  34. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  35. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  36. package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
  37. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
  38. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
  39. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  40. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  41. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  42. package/lib/typescript/src/components/Touchable.d.ts +2 -9
  43. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  44. package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
  45. package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
  46. package/lib/typescript/src/mappings/Button.d.ts +4 -113
  47. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  48. package/lib/typescript/src/mappings/DatePickerModal.d.ts +153 -0
  49. package/lib/typescript/src/mappings/DatePickerModal.d.ts.map +1 -0
  50. package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
  51. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
  52. package/package.json +3 -3
  53. package/src/components/Button.js +11 -18
  54. package/src/components/Button.tsx +11 -45
  55. package/src/components/Checkbox/Checkbox.js +3 -2
  56. package/src/components/Checkbox/Checkbox.tsx +7 -5
  57. package/src/components/DeprecatedButton.js +95 -0
  58. package/src/components/DeprecatedButton.tsx +214 -0
  59. package/src/components/DeprecatedCardWrapper.js +2 -2
  60. package/src/components/DeprecatedCardWrapper.tsx +4 -3
  61. package/src/components/DeprecatedFAB.js +3 -2
  62. package/src/components/DeprecatedFAB.tsx +5 -5
  63. package/src/components/Picker/Picker.js +4 -3
  64. package/src/components/Picker/Picker.tsx +4 -4
  65. package/src/components/Picker/PickerComponent.ios.js +1 -1
  66. package/src/components/Picker/PickerComponent.ios.tsx +1 -1
  67. package/src/components/Touchable.js +11 -16
  68. package/src/components/Touchable.tsx +11 -42
  69. package/src/components/Touchable.web.js +2 -0
  70. package/src/components/Touchable.web.tsx +3 -0
  71. package/src/mappings/Button.js +10 -13
  72. package/src/mappings/Button.ts +10 -13
  73. package/src/mappings/DatePickerModal.js +73 -0
  74. package/src/mappings/DatePickerModal.ts +91 -0
  75. package/src/mappings/Touchable.js +17 -0
  76. package/src/mappings/Touchable.ts +23 -0
  77. package/lib/commonjs/components/Pressable.js +0 -48
  78. package/lib/commonjs/mappings/Pressable.js +0 -52
  79. package/lib/module/components/Pressable.js +0 -40
  80. package/lib/module/mappings/Pressable.js +0 -45
  81. package/lib/typescript/src/components/Pressable.d.ts +0 -18
  82. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  83. package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
  84. package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
  85. package/src/components/Pressable.js +0 -17
  86. package/src/components/Pressable.tsx +0 -67
  87. package/src/mappings/Pressable.js +0 -52
  88. package/src/mappings/Pressable.ts +0 -63
@@ -0,0 +1,73 @@
1
+ import { COMPONENT_TYPES, FORM_TYPES, FIELD_NAME, Triggers, StylesPanelSections, createBoolProp, createTextProp, createTextEnumProp, createStaticBoolProp, createStaticNumberProp, } from "@draftbit/types";
2
+ export const SHARED_SEED_DATA = {
3
+ triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
4
+ category: COMPONENT_TYPES.input,
5
+ StylesPanelSections: [
6
+ StylesPanelSections.Typography,
7
+ StylesPanelSections.Background,
8
+ StylesPanelSections.Size,
9
+ StylesPanelSections.MarginsAndPaddings,
10
+ StylesPanelSections.Position,
11
+ ],
12
+ layout: null,
13
+ };
14
+ export const SHARED_SEED_DATA_PROPS = {
15
+ locale: {},
16
+ visible: createBoolProp({
17
+ label: "Visible",
18
+ description: "If true, show the modal. If false, hide the modal.",
19
+ required: true,
20
+ }),
21
+ label: createTextProp({
22
+ label: "Label",
23
+ description: "Label used as the header in the component, defaults to `Select Date`",
24
+ }),
25
+ saveLabel: createTextProp({
26
+ label: "Save Label",
27
+ description: "Label used to confirm a date selection. Defaults to `Save`.",
28
+ }),
29
+ saveLabelDisabled: createStaticBoolProp({
30
+ label: "Disable Save Label",
31
+ description: "Flag indicating if the save label should be disabled and unable to receive events",
32
+ }),
33
+ uppercase: createStaticBoolProp({
34
+ label: "Uppercase",
35
+ description: "Flag indicating if the text in the component should be uppercase. Defaults to true.",
36
+ }),
37
+ startYear: createStaticNumberProp({
38
+ label: "Start Year",
39
+ description: "The start year when the component is rendered. Defaults to 1800.",
40
+ required: false,
41
+ }),
42
+ endYear: createStaticNumberProp({
43
+ label: "End Year",
44
+ description: "The end year when the component is rendered. Defaults to 2200.",
45
+ required: false,
46
+ }),
47
+ };
48
+ export const SEED_DATA = [
49
+ {
50
+ name: "Single Date Picker Modal",
51
+ tag: "SingleDatePickerModal",
52
+ description: "A modal allowing date selection.",
53
+ ...SHARED_SEED_DATA,
54
+ props: {
55
+ mode: createTextEnumProp({
56
+ label: "Mode",
57
+ description: "The selection mode of the date picker",
58
+ required: true,
59
+ options: ["single", "multiple", "range"],
60
+ editable: false,
61
+ defaultValue: "single",
62
+ formType: FORM_TYPES.flatArray,
63
+ }),
64
+ fieldName: {
65
+ ...FIELD_NAME,
66
+ handlerPropName: "onConfirm",
67
+ valuePropName: "date",
68
+ defaultValue: "date",
69
+ },
70
+ ...SHARED_SEED_DATA_PROPS,
71
+ },
72
+ },
73
+ ];
@@ -0,0 +1,91 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ FORM_TYPES,
4
+ FIELD_NAME,
5
+ Triggers,
6
+ StylesPanelSections,
7
+ createBoolProp,
8
+ createTextProp,
9
+ createTextEnumProp,
10
+ createStaticBoolProp,
11
+ createStaticNumberProp,
12
+ } from "@draftbit/types";
13
+
14
+ export const SHARED_SEED_DATA = {
15
+ triggers: [Triggers.OnDismiss, Triggers.OnConfirm, Triggers.OnChange],
16
+ category: COMPONENT_TYPES.input,
17
+ StylesPanelSections: [
18
+ StylesPanelSections.Typography,
19
+ StylesPanelSections.Background,
20
+ StylesPanelSections.Size,
21
+ StylesPanelSections.MarginsAndPaddings,
22
+ StylesPanelSections.Position,
23
+ ],
24
+ layout: null,
25
+ };
26
+ export const SHARED_SEED_DATA_PROPS = {
27
+ locale: {},
28
+ visible: createBoolProp({
29
+ label: "Visible",
30
+ description: "If true, show the modal. If false, hide the modal.",
31
+ required: true,
32
+ }),
33
+ label: createTextProp({
34
+ label: "Label",
35
+ description:
36
+ "Label used as the header in the component, defaults to `Select Date`",
37
+ }),
38
+ saveLabel: createTextProp({
39
+ label: "Save Label",
40
+ description: "Label used to confirm a date selection. Defaults to `Save`.",
41
+ }),
42
+ saveLabelDisabled: createStaticBoolProp({
43
+ label: "Disable Save Label",
44
+ description:
45
+ "Flag indicating if the save label should be disabled and unable to receive events",
46
+ }),
47
+ uppercase: createStaticBoolProp({
48
+ label: "Uppercase",
49
+ description:
50
+ "Flag indicating if the text in the component should be uppercase. Defaults to true.",
51
+ }),
52
+ startYear: createStaticNumberProp({
53
+ label: "Start Year",
54
+ description:
55
+ "The start year when the component is rendered. Defaults to 1800.",
56
+ required: false,
57
+ }),
58
+ endYear: createStaticNumberProp({
59
+ label: "End Year",
60
+ description:
61
+ "The end year when the component is rendered. Defaults to 2200.",
62
+ required: false,
63
+ }),
64
+ };
65
+
66
+ export const SEED_DATA = [
67
+ {
68
+ name: "Single Date Picker Modal",
69
+ tag: "SingleDatePickerModal",
70
+ description: "A modal allowing date selection.",
71
+ ...SHARED_SEED_DATA,
72
+ props: {
73
+ mode: createTextEnumProp({
74
+ label: "Mode",
75
+ description: "The selection mode of the date picker",
76
+ required: true,
77
+ options: ["single", "multiple", "range"],
78
+ editable: false,
79
+ defaultValue: "single",
80
+ formType: FORM_TYPES.flatArray,
81
+ }),
82
+ fieldName: {
83
+ ...FIELD_NAME,
84
+ handlerPropName: "onConfirm",
85
+ valuePropName: "date",
86
+ defaultValue: "date",
87
+ },
88
+ ...SHARED_SEED_DATA_PROPS,
89
+ },
90
+ },
91
+ ];
@@ -0,0 +1,17 @@
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: [
8
+ StylesPanelSections.Size,
9
+ StylesPanelSections.Margins,
10
+ StylesPanelSections.Borders,
11
+ ],
12
+ layout: {},
13
+ triggers: [Triggers.OnPress],
14
+ props: {
15
+ onPress: createActionProp(),
16
+ },
17
+ };
@@ -0,0 +1,23 @@
1
+ import {
2
+ COMPONENT_TYPES,
3
+ createActionProp,
4
+ Triggers,
5
+ StylesPanelSections,
6
+ } from "@draftbit/types";
7
+
8
+ export const SEED_DATA = {
9
+ name: "Touchable",
10
+ tag: "Touchable",
11
+ description: "Simple button with no styles",
12
+ category: COMPONENT_TYPES.button,
13
+ stylesPanelSections: [
14
+ StylesPanelSections.Size,
15
+ StylesPanelSections.Margins,
16
+ StylesPanelSections.Borders,
17
+ ],
18
+ layout: {},
19
+ triggers: [Triggers.OnPress],
20
+ props: {
21
+ onPress: createActionProp(),
22
+ },
23
+ };
@@ -1,48 +0,0 @@
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
- }
@@ -1,52 +0,0 @@
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,40 +0,0 @@
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
- }
@@ -1,45 +0,0 @@
1
- import { COMPONENT_TYPES, createActionProp, Triggers, createNumberProp, StylesPanelSections, GROUPS } from "@draftbit/types";
2
- const SEED_DATA_PROPS = {
3
- stylesPanelSections: [StylesPanelSections.Size, StylesPanelSections.Margins, StylesPanelSections.Borders],
4
- layout: {},
5
- triggers: [Triggers.OnPress, Triggers.OnLongPress],
6
- props: {
7
- onPress: createActionProp(),
8
- onLongPress: createActionProp(),
9
- activeOpacity: createNumberProp({
10
- label: "Active Opacity",
11
- description: "The opacity when the button is pressed.",
12
- defaultValue: 0.8,
13
- group: GROUPS.basic
14
- }),
15
- disabledOpacity: createNumberProp({
16
- label: "Disabled Opacity",
17
- description: "The opacity when the button is disabled.",
18
- defaultValue: 0.8,
19
- group: GROUPS.basic
20
- }),
21
- delayLongPress: createNumberProp({
22
- label: "Delay Long Press",
23
- description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
24
- group: GROUPS.basic
25
- }),
26
- hitSlop: createNumberProp({
27
- label: "Hit Slop",
28
- description: "Sets additional distance outside of element in which a press can be detected.",
29
- group: GROUPS.basic
30
- })
31
- }
32
- };
33
- export const SEED_DATA = [{
34
- name: "Touchable",
35
- tag: "Touchable",
36
- description: "An interactive view with no styles",
37
- category: COMPONENT_TYPES.button,
38
- ...SEED_DATA_PROPS
39
- }, {
40
- name: "Pressable",
41
- tag: "Pressable",
42
- description: "An interactive view with no styles",
43
- category: COMPONENT_TYPES.deprecated,
44
- ...SEED_DATA_PROPS
45
- }];
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- import { PressableProps, PressableStateCallbackType, StyleProp, ViewStyle } from "react-native";
3
- declare type Props = {
4
- disabled?: boolean;
5
- children: React.ReactNode;
6
- style?: ViewStyle;
7
- onPress?: () => void;
8
- onLongPress?: () => void;
9
- delayLongPress?: number;
10
- hitSlop?: number;
11
- pressRetentionOffset?: number;
12
- activeOpacity?: number;
13
- disabledOpacity?: number;
14
- } & PressableProps;
15
- export declare type StyleType = (state: PressableStateCallbackType) => StyleProp<ViewStyle>;
16
- export default function Pressable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }: Props): JSX.Element;
17
- export {};
18
- //# sourceMappingURL=Pressable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/components/Pressable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAEL,cAAc,EACd,0BAA0B,EAC1B,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,cAAc,CAAC;AAEnB,oBAAY,SAAS,GAAG,CACtB,KAAK,EAAE,0BAA0B,KAC9B,SAAS,CAAC,SAAS,CAAC,CAAC;AAE1B,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,WAAW,EACX,OAAO,EACP,cAAc,EACd,aAAa,EACb,eAAe,EACf,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,eA6BP"}
@@ -1,76 +0,0 @@
1
- export declare const SEED_DATA: {
2
- stylesPanelSections: string[];
3
- layout: {};
4
- triggers: string[];
5
- props: {
6
- onPress: {
7
- label: string;
8
- description: string;
9
- editable: boolean;
10
- required: boolean;
11
- formType: string;
12
- propType: string;
13
- defaultValue: null;
14
- group: string;
15
- };
16
- onLongPress: {
17
- label: string;
18
- description: string;
19
- editable: boolean;
20
- required: boolean;
21
- formType: string;
22
- propType: string;
23
- defaultValue: null;
24
- group: string;
25
- };
26
- activeOpacity: {
27
- label: string;
28
- description: string;
29
- formType: string;
30
- propType: string;
31
- group: string;
32
- defaultValue: null;
33
- editable: boolean;
34
- required: boolean;
35
- step: number;
36
- };
37
- disabledOpacity: {
38
- label: string;
39
- description: string;
40
- formType: string;
41
- propType: string;
42
- group: string;
43
- defaultValue: null;
44
- editable: boolean;
45
- required: boolean;
46
- step: number;
47
- };
48
- delayLongPress: {
49
- label: string;
50
- description: string;
51
- formType: string;
52
- propType: string;
53
- group: string;
54
- defaultValue: null;
55
- editable: boolean;
56
- required: boolean;
57
- step: number;
58
- };
59
- hitSlop: {
60
- label: string;
61
- description: string;
62
- formType: string;
63
- propType: string;
64
- group: string;
65
- defaultValue: null;
66
- editable: boolean;
67
- required: boolean;
68
- step: number;
69
- };
70
- };
71
- name: string;
72
- tag: string;
73
- description: string;
74
- category: string;
75
- }[];
76
- //# sourceMappingURL=Pressable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Pressable.ts"],"names":[],"mappings":"AA+CA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAerB,CAAC"}
@@ -1,17 +0,0 @@
1
- import React, { useCallback } from "react";
2
- import { Pressable as NativePressable, } from "react-native";
3
- export default function Pressable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }) {
4
- const getOpacity = useCallback((pressed) => {
5
- if (disabled) {
6
- return disabledOpacity;
7
- }
8
- else {
9
- if (pressed)
10
- return activeOpacity;
11
- else
12
- return 1;
13
- }
14
- }, [activeOpacity, disabled, disabledOpacity]);
15
- const _style = useCallback(({ pressed }) => [style, { opacity: getOpacity(pressed) }], [getOpacity, style]);
16
- return (React.createElement(NativePressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled, delayLongPress: delayLongPress ? delayLongPress : 500, hitSlop: hitSlop ? hitSlop : 8, style: _style, ...props }, children));
17
- }
@@ -1,67 +0,0 @@
1
- import React, { useCallback } from "react";
2
- import {
3
- Pressable as NativePressable,
4
- PressableProps,
5
- PressableStateCallbackType,
6
- StyleProp,
7
- ViewStyle,
8
- } from "react-native";
9
-
10
- type Props = {
11
- disabled?: boolean;
12
- children: React.ReactNode;
13
- style?: ViewStyle;
14
- onPress?: () => void;
15
- onLongPress?: () => void;
16
- delayLongPress?: number;
17
- hitSlop?: number;
18
- pressRetentionOffset?: number;
19
- activeOpacity?: number;
20
- disabledOpacity?: number;
21
- } & PressableProps;
22
-
23
- export type StyleType = (
24
- state: PressableStateCallbackType
25
- ) => StyleProp<ViewStyle>;
26
-
27
- export default function Pressable({
28
- children,
29
- disabled,
30
- onPress,
31
- onLongPress,
32
- hitSlop,
33
- delayLongPress,
34
- activeOpacity,
35
- disabledOpacity,
36
- style,
37
- ...props
38
- }: Props) {
39
- const getOpacity = useCallback(
40
- (pressed: boolean) => {
41
- if (disabled) {
42
- return disabledOpacity;
43
- } else {
44
- if (pressed) return activeOpacity;
45
- else return 1;
46
- }
47
- },
48
- [activeOpacity, disabled, disabledOpacity]
49
- );
50
- const _style = useCallback<StyleType>(
51
- ({ pressed }) => [style as ViewStyle, { opacity: getOpacity(pressed) }],
52
- [getOpacity, style]
53
- );
54
- return (
55
- <NativePressable
56
- onPress={onPress}
57
- onLongPress={onLongPress}
58
- disabled={disabled}
59
- delayLongPress={delayLongPress ? delayLongPress : 500}
60
- hitSlop={hitSlop ? hitSlop : 8}
61
- style={_style}
62
- {...props}
63
- >
64
- {children}
65
- </NativePressable>
66
- );
67
- }
@@ -1,52 +0,0 @@
1
- import { COMPONENT_TYPES, createActionProp, Triggers, createNumberProp, StylesPanelSections, GROUPS, } from "@draftbit/types";
2
- const SEED_DATA_PROPS = {
3
- stylesPanelSections: [
4
- StylesPanelSections.Size,
5
- StylesPanelSections.Margins,
6
- StylesPanelSections.Borders,
7
- ],
8
- layout: {},
9
- triggers: [Triggers.OnPress, Triggers.OnLongPress],
10
- props: {
11
- onPress: createActionProp(),
12
- onLongPress: createActionProp(),
13
- activeOpacity: createNumberProp({
14
- label: "Active Opacity",
15
- description: "The opacity when the button is pressed.",
16
- defaultValue: 0.8,
17
- group: GROUPS.basic,
18
- }),
19
- disabledOpacity: createNumberProp({
20
- label: "Disabled Opacity",
21
- description: "The opacity when the button is disabled.",
22
- defaultValue: 0.8,
23
- group: GROUPS.basic,
24
- }),
25
- delayLongPress: createNumberProp({
26
- label: "Delay Long Press",
27
- description: "Duration (in milliseconds) from onPressIn before onLongPress is called.",
28
- group: GROUPS.basic,
29
- }),
30
- hitSlop: createNumberProp({
31
- label: "Hit Slop",
32
- description: "Sets additional distance outside of element in which a press can be detected.",
33
- group: GROUPS.basic,
34
- }),
35
- },
36
- };
37
- export const SEED_DATA = [
38
- {
39
- name: "Touchable",
40
- tag: "Touchable",
41
- description: "An interactive view with no styles",
42
- category: COMPONENT_TYPES.button,
43
- ...SEED_DATA_PROPS,
44
- },
45
- {
46
- name: "Pressable",
47
- tag: "Pressable",
48
- description: "An interactive view with no styles",
49
- category: COMPONENT_TYPES.deprecated,
50
- ...SEED_DATA_PROPS,
51
- },
52
- ];