@draftbit/core 47.0.1-9fd6f2.2 → 47.0.1-cc5ccc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/lib/commonjs/components/Button.js +27 -15
  2. package/lib/commonjs/components/Checkbox/Checkbox.js +1 -3
  3. package/lib/commonjs/components/DeprecatedCardWrapper.js +2 -2
  4. package/lib/commonjs/components/DeprecatedFAB.js +1 -2
  5. package/lib/commonjs/components/Picker/Picker.js +3 -4
  6. package/lib/commonjs/components/Picker/PickerComponent.ios.js +2 -2
  7. package/lib/commonjs/components/Pressable.js +48 -0
  8. package/lib/commonjs/components/Touchable.js +27 -11
  9. package/lib/commonjs/mappings/Button.js +13 -10
  10. package/lib/commonjs/mappings/Pressable.js +52 -0
  11. package/lib/module/components/Button.js +21 -9
  12. package/lib/module/components/Checkbox/Checkbox.js +2 -3
  13. package/lib/module/components/DeprecatedCardWrapper.js +2 -2
  14. package/lib/module/components/DeprecatedFAB.js +2 -3
  15. package/lib/module/components/Picker/Picker.js +3 -4
  16. package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
  17. package/lib/module/components/Pressable.js +40 -0
  18. package/lib/module/components/Touchable.js +25 -10
  19. package/lib/module/mappings/Button.js +14 -11
  20. package/lib/module/mappings/Pressable.js +45 -0
  21. package/lib/typescript/src/components/Button.d.ts +2 -0
  22. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  23. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  24. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  25. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
  26. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  27. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  28. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  29. package/lib/typescript/src/components/Pressable.d.ts +18 -0
  30. package/lib/typescript/src/components/Pressable.d.ts.map +1 -0
  31. package/lib/typescript/src/components/Touchable.d.ts +9 -2
  32. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  33. package/lib/typescript/src/mappings/Button.d.ts +113 -4
  34. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  35. package/lib/typescript/src/mappings/Pressable.d.ts +76 -0
  36. package/lib/typescript/src/mappings/Pressable.d.ts.map +1 -0
  37. package/package.json +3 -3
  38. package/src/components/Button.js +18 -11
  39. package/src/components/Button.tsx +45 -11
  40. package/src/components/Checkbox/Checkbox.js +2 -3
  41. package/src/components/Checkbox/Checkbox.tsx +5 -7
  42. package/src/components/DeprecatedCardWrapper.js +2 -2
  43. package/src/components/DeprecatedCardWrapper.tsx +3 -4
  44. package/src/components/DeprecatedFAB.js +2 -3
  45. package/src/components/DeprecatedFAB.tsx +5 -5
  46. package/src/components/Picker/Picker.js +3 -4
  47. package/src/components/Picker/Picker.tsx +4 -4
  48. package/src/components/Picker/PickerComponent.ios.js +1 -1
  49. package/src/components/Picker/PickerComponent.ios.tsx +1 -1
  50. package/src/components/Pressable.js +17 -0
  51. package/src/components/Pressable.tsx +67 -0
  52. package/src/components/Touchable.js +16 -11
  53. package/src/components/Touchable.tsx +42 -11
  54. package/src/mappings/Button.js +13 -10
  55. package/src/mappings/Button.ts +13 -10
  56. package/src/mappings/Pressable.js +52 -0
  57. package/src/mappings/Pressable.ts +63 -0
  58. package/lib/commonjs/components/DeprecatedButton.js +0 -151
  59. package/lib/commonjs/components/Touchable.web.js +0 -9
  60. package/lib/commonjs/mappings/Touchable.js +0 -20
  61. package/lib/module/components/DeprecatedButton.js +0 -141
  62. package/lib/module/components/Touchable.web.js +0 -2
  63. package/lib/module/mappings/Touchable.js +0 -13
  64. package/lib/typescript/src/components/DeprecatedButton.d.ts +0 -54
  65. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +0 -1
  66. package/lib/typescript/src/components/Touchable.web.d.ts +0 -3
  67. package/lib/typescript/src/components/Touchable.web.d.ts.map +0 -1
  68. package/lib/typescript/src/mappings/Touchable.d.ts +0 -22
  69. package/lib/typescript/src/mappings/Touchable.d.ts.map +0 -1
  70. package/src/components/DeprecatedButton.js +0 -95
  71. package/src/components/DeprecatedButton.tsx +0 -214
  72. package/src/components/Touchable.web.js +0 -2
  73. package/src/components/Touchable.web.tsx +0 -3
  74. package/src/mappings/Touchable.js +0 -17
  75. package/src/mappings/Touchable.ts +0 -23
@@ -1,7 +1,8 @@
1
- import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections } from "@draftbit/types";
2
- const SEED_DATA_TRIGGERS = [Triggers.OnPress];
1
+ import { COMPONENT_TYPES, createIconProp, createTextProp, createDisabledProp, createLoadingProp, createActionProp, Triggers, StylesPanelSections, createNumberProp } from "@draftbit/types";
2
+ const SEED_DATA_TRIGGERS = [Triggers.OnPress, Triggers.OnLongPress];
3
3
  const SEED_DATA_PROPS = {
4
4
  onPress: createActionProp(),
5
+ onLongPress: createActionProp(),
5
6
  icon: createIconProp({
6
7
  defaultValue: null,
7
8
  required: false
@@ -12,12 +13,11 @@ const SEED_DATA_PROPS = {
12
13
  defaultValue: "Get Started"
13
14
  }),
14
15
  disabled: createDisabledProp(),
15
- loading: createLoadingProp()
16
- };
17
- const LAYOUT = {
18
- backgroundColor: "transparent",
19
- borderRadius: 8,
20
- fontFamily: "system-700"
16
+ loading: createLoadingProp(),
17
+ activeOpacity: createNumberProp(),
18
+ disabledOpacity: createNumberProp(),
19
+ delayLongPress: createNumberProp(),
20
+ hitSlop: createNumberProp()
21
21
  };
22
22
  export const SEED_DATA = [{
23
23
  name: "Button Outline",
@@ -25,8 +25,9 @@ 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,
29
28
  backgroundColor: "transparent",
29
+ borderRadius: 8,
30
+ fontFamily: "system-700",
30
31
  borderWidth: 1,
31
32
  textAlign: "center"
32
33
  },
@@ -38,7 +39,8 @@ export const SEED_DATA = [{
38
39
  category: COMPONENT_TYPES.deprecated,
39
40
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
40
41
  layout: {
41
- ...LAYOUT,
42
+ borderRadius: 8,
43
+ fontFamily: "system-700",
42
44
  backgroundColor: "primary",
43
45
  textAlign: "center"
44
46
  },
@@ -50,7 +52,8 @@ export const SEED_DATA = [{
50
52
  category: COMPONENT_TYPES.button,
51
53
  stylesPanelSections: [StylesPanelSections.Typography, StylesPanelSections.Background, StylesPanelSections.Borders, StylesPanelSections.Size, StylesPanelSections.MarginsAndPaddings, StylesPanelSections.Position, StylesPanelSections.Effects],
52
54
  layout: {
53
- ...LAYOUT,
55
+ borderRadius: 8,
56
+ fontFamily: "system-700",
54
57
  backgroundColor: "primary",
55
58
  textAlign: "center"
56
59
  },
@@ -0,0 +1,45 @@
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,3 +1,5 @@
1
+ import { PressableStateCallbackType, StyleProp, ViewStyle } from "react-native";
2
+ export declare type StyleType = (state: PressableStateCallbackType) => StyleProp<ViewStyle>;
1
3
  declare const ButtonSolid: any;
2
4
  export { ButtonSolid };
3
5
  declare const Button: any;
@@ -1 +1 @@
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
+ {"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,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { TouchableHighlightProps, StyleProp, ViewStyle } from "react-native";
2
+ import { StyleProp, ViewStyle, PressableProps } 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 & TouchableHighlightProps & IconSlot>;
18
+ declare const Checkbox: React.FC<CheckboxProps & PressableProps & 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,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,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,K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,CAAC,aAAa,GAAG,cAAc,GAAG,QAAQ,CAoFjE,CAAC;AAqBF,eAAe,QAAQ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"DeprecatedCardWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedCardWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAE3C,aAAK,KAAK,GAAG;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,CAAC;;;;AAiCF,wBAA+B"}
1
+ {"version":3,"file":"DeprecatedCardWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedCardWrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAa,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAE3C,aAAK,KAAK,GAAG;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,KAAK,EAAE,OAAO,KAAK,CAAC;CACrB,CAAC;;;;AAiCF,wBAA+B"}
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- import { TouchableHighlightProps, StyleProp, ViewStyle } from "react-native";
2
+ import { StyleProp, ViewStyle, PressableProps } from "react-native";
3
3
  import type { Theme } from "../styles/DefaultTheme";
4
4
  import type { IconSlot } from "../interfaces/Icon";
5
5
  /**
@@ -48,7 +48,7 @@ declare type Props = {
48
48
  elevation?: number;
49
49
  theme: Theme;
50
50
  style?: StyleProp<ViewStyle>;
51
- } & TouchableHighlightProps & IconSlot;
51
+ } & PressableProps & IconSlot;
52
52
  declare const _default: React.ComponentType<import("@draftbit/react-theme-provider").$Without<React.PropsWithChildren<Props>, "theme"> & {
53
53
  theme?: import("@draftbit/react-theme-provider").$DeepPartial<any> | undefined;
54
54
  }> & import("@draftbit/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<React.PropsWithChildren<Props>> & React.FC<React.PropsWithChildren<Props>>, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"DeprecatedFAB.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedFAB.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,uBAAuB,EACvB,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAQtB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,GAAG,uBAAuB,GACzB,QAAQ,CAAC;;;;AAkKX,wBAA8B"}
1
+ {"version":3,"file":"DeprecatedFAB.d.ts","sourceRoot":"","sources":["../../../../src/components/DeprecatedFAB.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,SAAS,EACT,SAAS,EAGT,cAAc,EACf,MAAM,cAAc,CAAC;AAOtB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,aAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;IAC/D,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,GAAG,cAAc,GAChB,QAAQ,CAAC;;;;AAkKX,wBAA8B"}
@@ -1 +1 @@
1
- {"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../../../../src/components/Picker/Picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAKL,SAAS,EACT,SAAS,EAEV,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,KAAK,EAAE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-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
@@ -0,0 +1 @@
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,11 +1,18 @@
1
1
  import React from "react";
2
- import { ViewStyle, PressableProps } from "react-native";
2
+ import { PressableProps, PressableStateCallbackType, StyleProp, ViewStyle } from "react-native";
3
3
  declare type Props = {
4
4
  disabled?: boolean;
5
5
  children: React.ReactNode;
6
6
  style?: ViewStyle;
7
7
  onPress?: () => void;
8
+ onLongPress?: () => void;
9
+ delayLongPress?: number;
10
+ hitSlop?: number;
11
+ pressRetentionOffset?: number;
12
+ activeOpacity?: number;
13
+ disabledOpacity?: number;
8
14
  } & PressableProps;
9
- export default function Touchable({ children, disabled, onPress, style, ...props }: Props): JSX.Element;
15
+ export declare type StyleType = (state: PressableStateCallbackType) => StyleProp<ViewStyle>;
16
+ export default function Touchable({ children, disabled, onPress, onLongPress, hitSlop, delayLongPress, activeOpacity, disabledOpacity, style, ...props }: Props): JSX.Element;
10
17
  export {};
11
18
  //# sourceMappingURL=Touchable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/components/Touchable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAa,SAAS,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEpE,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;CACtB,GAAG,cAAc,CAAC;AAEnB,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,eAmBP"}
1
+ {"version":3,"file":"Touchable.d.ts","sourceRoot":"","sources":["../../../../src/components/Touchable.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"}
@@ -5,10 +5,10 @@ export declare const SEED_DATA: ({
5
5
  stylesPanelSections: string[];
6
6
  layout: {
7
7
  backgroundColor: string;
8
- borderWidth: number;
9
- textAlign: string;
10
8
  borderRadius: number;
11
9
  fontFamily: string;
10
+ borderWidth: number;
11
+ textAlign: string;
12
12
  };
13
13
  triggers: string[];
14
14
  props: {
@@ -22,6 +22,16 @@ export declare const SEED_DATA: ({
22
22
  defaultValue: null;
23
23
  group: string;
24
24
  };
25
+ onLongPress: {
26
+ label: string;
27
+ description: string;
28
+ editable: boolean;
29
+ required: boolean;
30
+ formType: string;
31
+ propType: string;
32
+ defaultValue: null;
33
+ group: string;
34
+ };
25
35
  icon: {
26
36
  label: string;
27
37
  description: string;
@@ -53,6 +63,50 @@ export declare const SEED_DATA: ({
53
63
  propType: string;
54
64
  defaultValue: null;
55
65
  };
66
+ activeOpacity: {
67
+ label: string;
68
+ description: string;
69
+ formType: string;
70
+ propType: string;
71
+ group: string;
72
+ defaultValue: null;
73
+ editable: boolean;
74
+ required: boolean;
75
+ step: number;
76
+ };
77
+ disabledOpacity: {
78
+ label: string;
79
+ description: string;
80
+ formType: string;
81
+ propType: string;
82
+ group: string;
83
+ defaultValue: null;
84
+ editable: boolean;
85
+ required: boolean;
86
+ step: number;
87
+ };
88
+ delayLongPress: {
89
+ label: string;
90
+ description: string;
91
+ formType: string;
92
+ propType: string;
93
+ group: string;
94
+ defaultValue: null;
95
+ editable: boolean;
96
+ required: boolean;
97
+ step: number;
98
+ };
99
+ hitSlop: {
100
+ label: string;
101
+ description: string;
102
+ formType: string;
103
+ propType: string;
104
+ group: string;
105
+ defaultValue: null;
106
+ editable: boolean;
107
+ required: boolean;
108
+ step: number;
109
+ };
56
110
  };
57
111
  } | {
58
112
  name: string;
@@ -60,10 +114,11 @@ export declare const SEED_DATA: ({
60
114
  category: string;
61
115
  stylesPanelSections: string[];
62
116
  layout: {
63
- backgroundColor: string;
64
- textAlign: string;
65
117
  borderRadius: number;
66
118
  fontFamily: string;
119
+ backgroundColor: string;
120
+ textAlign: string;
121
+ borderWidth?: undefined;
67
122
  };
68
123
  triggers: string[];
69
124
  props: {
@@ -77,6 +132,16 @@ export declare const SEED_DATA: ({
77
132
  defaultValue: null;
78
133
  group: string;
79
134
  };
135
+ onLongPress: {
136
+ label: string;
137
+ description: string;
138
+ editable: boolean;
139
+ required: boolean;
140
+ formType: string;
141
+ propType: string;
142
+ defaultValue: null;
143
+ group: string;
144
+ };
80
145
  icon: {
81
146
  label: string;
82
147
  description: string;
@@ -108,6 +173,50 @@ export declare const SEED_DATA: ({
108
173
  propType: string;
109
174
  defaultValue: null;
110
175
  };
176
+ activeOpacity: {
177
+ label: string;
178
+ description: string;
179
+ formType: string;
180
+ propType: string;
181
+ group: string;
182
+ defaultValue: null;
183
+ editable: boolean;
184
+ required: boolean;
185
+ step: number;
186
+ };
187
+ disabledOpacity: {
188
+ label: string;
189
+ description: string;
190
+ formType: string;
191
+ propType: string;
192
+ group: string;
193
+ defaultValue: null;
194
+ editable: boolean;
195
+ required: boolean;
196
+ step: number;
197
+ };
198
+ delayLongPress: {
199
+ label: string;
200
+ description: string;
201
+ formType: string;
202
+ propType: string;
203
+ group: string;
204
+ defaultValue: null;
205
+ editable: boolean;
206
+ required: boolean;
207
+ step: number;
208
+ };
209
+ hitSlop: {
210
+ label: string;
211
+ description: string;
212
+ formType: string;
213
+ propType: string;
214
+ group: string;
215
+ defaultValue: null;
216
+ editable: boolean;
217
+ required: boolean;
218
+ step: number;
219
+ };
111
220
  };
112
221
  })[];
113
222
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Button.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiErB,CAAC"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Button.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAoErB,CAAC"}
@@ -0,0 +1,76 @@
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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Pressable.d.ts","sourceRoot":"","sources":["../../../../src/mappings/Pressable.ts"],"names":[],"mappings":"AA+CA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAerB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftbit/core",
3
- "version": "47.0.1-9fd6f2.2+9fd6f28",
3
+ "version": "47.0.1-cc5ccc.2+cc5ccc0",
4
4
  "description": "Core (non-native) Components",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -41,7 +41,7 @@
41
41
  "dependencies": {
42
42
  "@date-io/date-fns": "^1.3.13",
43
43
  "@draftbit/react-theme-provider": "^2.1.1",
44
- "@draftbit/types": "^47.0.1-9fd6f2.2+9fd6f28",
44
+ "@draftbit/types": "^47.0.1-cc5ccc.2+cc5ccc0",
45
45
  "@material-ui/core": "^4.11.0",
46
46
  "@material-ui/pickers": "^3.2.10",
47
47
  "@react-native-community/slider": "4.2.4",
@@ -91,5 +91,5 @@
91
91
  ]
92
92
  ]
93
93
  },
94
- "gitHead": "9fd6f289b4dc38787b6d90b479ef5977e85ba64e"
94
+ "gitHead": "cc5ccc0cb02f87cb9672ab134b665d254375c75f"
95
95
  }
@@ -1,4 +1,4 @@
1
- import * as React from "react";
1
+ import React, { useCallback } from "react";
2
2
  import { Text, Pressable, Platform, StyleSheet, ActivityIndicator, } from "react-native";
3
3
  import { withTheme } from "../theming";
4
4
  const CONSTANTS = {
@@ -7,7 +7,7 @@ const CONSTANTS = {
7
7
  padding: 8,
8
8
  icon: 24,
9
9
  };
10
- function Base({ Icon, icon, title, onPress, loading, disabled, style, ...props }) {
10
+ function Base({ Icon, icon, title, onPress, onLongPress, activeOpacity, disabledOpacity, loading, disabled, style, ...props }) {
11
11
  const { color, fontFamily, fontWeight, fontSize, lineHeight, letterSpacing, textTransform, textAlign, textDecorationLine, textDecorationColor, textDecorationStyle, ...buttonStyles } = StyleSheet.flatten(style || {});
12
12
  const titleStyles = {
13
13
  color,
@@ -28,15 +28,22 @@ function Base({ Icon, icon, title, onPress, loading, disabled, style, ...props }
28
28
  if (textAlign === "right") {
29
29
  buttonStyles.justifyContent = "flex-end";
30
30
  }
31
- return (React.createElement(Pressable, { onPress: onPress, disabled: disabled || loading, style: ({ pressed }) => {
32
- return [
33
- styles.base,
34
- {
35
- opacity: pressed || disabled ? 0.75 : 1,
36
- },
37
- buttonStyles,
38
- ];
39
- }, ...props },
31
+ const getOpacity = useCallback((pressed) => {
32
+ if (disabled) {
33
+ return disabledOpacity;
34
+ }
35
+ else {
36
+ if (pressed)
37
+ return activeOpacity;
38
+ else
39
+ return 1;
40
+ }
41
+ }, [activeOpacity, disabled, disabledOpacity]);
42
+ const _style = useCallback(({ pressed }) => [
43
+ buttonStyles,
44
+ { opacity: getOpacity(pressed) },
45
+ ], [getOpacity, buttonStyles]);
46
+ return (React.createElement(Pressable, { onPress: onPress, onLongPress: onLongPress, disabled: disabled || loading, style: (styles.base, _style), ...props },
40
47
  loading ? (React.createElement(ActivityIndicator, { size: "small", color: color, style: styles.loading })) : null,
41
48
  icon && !loading ? (React.createElement(Icon, { name: icon, color: color, style: styles.icon, size: CONSTANTS.icon })) : null,
42
49
  React.createElement(Text, { style: titleStyles }, title)));
@@ -1,11 +1,14 @@
1
- import * as React from "react";
1
+ import React, { useCallback } from "react";
2
2
  import {
3
3
  Text,
4
4
  Pressable,
5
+ PressableProps,
6
+ PressableStateCallbackType,
5
7
  Platform,
6
8
  StyleSheet,
9
+ StyleProp,
7
10
  TextStyle,
8
- PressableProps,
11
+ ViewStyle,
9
12
  ActivityIndicator,
10
13
  } from "react-native";
11
14
 
@@ -27,6 +30,12 @@ type BaseProps = {
27
30
  loading: boolean;
28
31
  style?: TextStyle;
29
32
  onPress: () => void;
33
+ onLongPress?: () => void;
34
+ activeOpacity?: number;
35
+ disabledOpacity?: number;
36
+ delayLongPress?: number;
37
+ hitSlop?: number;
38
+ pressRetentionOffset?: number;
30
39
  icon?: string;
31
40
  } & PressableProps &
32
41
  IconSlot;
@@ -37,16 +46,29 @@ type Props = {
37
46
  loading: boolean;
38
47
  style?: TextStyle;
39
48
  onPress: () => void;
49
+ onLongPress?: () => void;
50
+ activeOpacity?: number;
51
+ disabledOpacity?: number;
52
+ delayLongPress?: number;
53
+ hitSlop?: number;
54
+ pressRetentionOffset?: number;
40
55
  icon?: string;
41
56
  theme: Theme;
42
57
  } & PressableProps &
43
58
  IconSlot;
44
59
 
60
+ export type StyleType = (
61
+ state: PressableStateCallbackType
62
+ ) => StyleProp<ViewStyle>;
63
+
45
64
  function Base({
46
65
  Icon,
47
66
  icon,
48
67
  title,
49
68
  onPress,
69
+ onLongPress,
70
+ activeOpacity,
71
+ disabledOpacity,
50
72
  loading,
51
73
  disabled,
52
74
  style,
@@ -89,19 +111,31 @@ function Base({
89
111
  buttonStyles.justifyContent = "flex-end";
90
112
  }
91
113
 
114
+ const getOpacity = useCallback(
115
+ (pressed: boolean) => {
116
+ if (disabled) {
117
+ return disabledOpacity;
118
+ } else {
119
+ if (pressed) return activeOpacity;
120
+ else return 1;
121
+ }
122
+ },
123
+ [activeOpacity, disabled, disabledOpacity]
124
+ );
125
+ const _style = useCallback<StyleType>(
126
+ ({ pressed }) => [
127
+ buttonStyles as ViewStyle,
128
+ { opacity: getOpacity(pressed) },
129
+ ],
130
+ [getOpacity, buttonStyles]
131
+ );
132
+
92
133
  return (
93
134
  <Pressable
94
135
  onPress={onPress}
136
+ onLongPress={onLongPress}
95
137
  disabled={disabled || loading}
96
- style={({ pressed }) => {
97
- return [
98
- styles.base,
99
- {
100
- opacity: pressed || disabled ? 0.75 : 1,
101
- },
102
- buttonStyles,
103
- ];
104
- }}
138
+ style={(styles.base, _style)}
105
139
  {...props}
106
140
  >
107
141
  {loading ? (