@draftbit/core 47.0.1-0e56b5.2 → 47.0.1-1d6a5b.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 (87) hide show
  1. package/lib/commonjs/components/Button.js +22 -31
  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 -29
  11. package/lib/commonjs/mappings/FlashList.js +45 -2
  12. package/lib/commonjs/mappings/FlatList.js +12 -0
  13. package/lib/commonjs/mappings/Touchable.js +20 -0
  14. package/lib/module/components/Button.js +16 -25
  15. package/lib/module/components/Checkbox/Checkbox.js +3 -2
  16. package/lib/module/components/DeprecatedButton.js +141 -0
  17. package/lib/module/components/DeprecatedCardWrapper.js +2 -2
  18. package/lib/module/components/DeprecatedFAB.js +3 -2
  19. package/lib/module/components/Picker/Picker.js +4 -3
  20. package/lib/module/components/Picker/PickerComponent.ios.js +1 -1
  21. package/lib/module/components/Touchable.js +10 -25
  22. package/lib/module/components/Touchable.web.js +2 -0
  23. package/lib/module/mappings/Button.js +11 -30
  24. package/lib/module/mappings/FlashList.js +46 -3
  25. package/lib/module/mappings/FlatList.js +13 -1
  26. package/lib/module/mappings/Touchable.js +13 -0
  27. package/lib/typescript/src/components/Button.d.ts +0 -2
  28. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  29. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts +2 -2
  30. package/lib/typescript/src/components/Checkbox/Checkbox.d.ts.map +1 -1
  31. package/lib/typescript/src/components/DeprecatedButton.d.ts +54 -0
  32. package/lib/typescript/src/components/DeprecatedButton.d.ts.map +1 -0
  33. package/lib/typescript/src/components/DeprecatedCardWrapper.d.ts.map +1 -1
  34. package/lib/typescript/src/components/DeprecatedFAB.d.ts +2 -2
  35. package/lib/typescript/src/components/DeprecatedFAB.d.ts.map +1 -1
  36. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  37. package/lib/typescript/src/components/Touchable.d.ts +2 -9
  38. package/lib/typescript/src/components/Touchable.d.ts.map +1 -1
  39. package/lib/typescript/src/components/Touchable.web.d.ts +3 -0
  40. package/lib/typescript/src/components/Touchable.web.d.ts.map +1 -0
  41. package/lib/typescript/src/mappings/Button.d.ts +4 -113
  42. package/lib/typescript/src/mappings/Button.d.ts.map +1 -1
  43. package/lib/typescript/src/mappings/FlashList.d.ts +112 -2
  44. package/lib/typescript/src/mappings/FlashList.d.ts.map +1 -1
  45. package/lib/typescript/src/mappings/FlatList.d.ts +42 -0
  46. package/lib/typescript/src/mappings/FlatList.d.ts.map +1 -1
  47. package/lib/typescript/src/mappings/Touchable.d.ts +22 -0
  48. package/lib/typescript/src/mappings/Touchable.d.ts.map +1 -0
  49. package/package.json +3 -3
  50. package/src/components/Button.js +18 -22
  51. package/src/components/Button.tsx +18 -49
  52. package/src/components/Checkbox/Checkbox.js +3 -2
  53. package/src/components/Checkbox/Checkbox.tsx +7 -5
  54. package/src/components/DeprecatedButton.js +95 -0
  55. package/src/components/DeprecatedButton.tsx +214 -0
  56. package/src/components/DeprecatedCardWrapper.js +2 -2
  57. package/src/components/DeprecatedCardWrapper.tsx +4 -3
  58. package/src/components/DeprecatedFAB.js +3 -2
  59. package/src/components/DeprecatedFAB.tsx +5 -5
  60. package/src/components/Picker/Picker.js +4 -3
  61. package/src/components/Picker/Picker.tsx +4 -4
  62. package/src/components/Picker/PickerComponent.ios.js +1 -1
  63. package/src/components/Picker/PickerComponent.ios.tsx +1 -1
  64. package/src/components/Touchable.js +11 -16
  65. package/src/components/Touchable.tsx +11 -42
  66. package/src/components/Touchable.web.js +2 -0
  67. package/src/components/Touchable.web.tsx +3 -0
  68. package/src/mappings/Button.js +10 -29
  69. package/src/mappings/Button.ts +10 -31
  70. package/src/mappings/FlashList.js +77 -31
  71. package/src/mappings/FlashList.ts +82 -30
  72. package/src/mappings/FlatList.js +13 -1
  73. package/src/mappings/FlatList.ts +16 -0
  74. package/src/mappings/Touchable.js +17 -0
  75. package/src/mappings/Touchable.ts +23 -0
  76. package/lib/commonjs/components/Pressable.js +0 -48
  77. package/lib/commonjs/mappings/Pressable.js +0 -52
  78. package/lib/module/components/Pressable.js +0 -40
  79. package/lib/module/mappings/Pressable.js +0 -45
  80. package/lib/typescript/src/components/Pressable.d.ts +0 -18
  81. package/lib/typescript/src/components/Pressable.d.ts.map +0 -1
  82. package/lib/typescript/src/mappings/Pressable.d.ts +0 -76
  83. package/lib/typescript/src/mappings/Pressable.d.ts.map +0 -1
  84. package/src/components/Pressable.js +0 -17
  85. package/src/components/Pressable.tsx +0 -67
  86. package/src/mappings/Pressable.js +0 -52
  87. package/src/mappings/Pressable.ts +0 -63
@@ -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
- ];
@@ -1,63 +0,0 @@
1
- import {
2
- COMPONENT_TYPES,
3
- createActionProp,
4
- Triggers,
5
- createNumberProp,
6
- StylesPanelSections,
7
- GROUPS,
8
- } from "@draftbit/types";
9
-
10
- const SEED_DATA_PROPS = {
11
- stylesPanelSections: [
12
- StylesPanelSections.Size,
13
- StylesPanelSections.Margins,
14
- StylesPanelSections.Borders,
15
- ],
16
- layout: {},
17
- triggers: [Triggers.OnPress, Triggers.OnLongPress],
18
- props: {
19
- onPress: createActionProp(),
20
- onLongPress: createActionProp(),
21
- activeOpacity: createNumberProp({
22
- label: "Active Opacity",
23
- description: "The opacity when the button is pressed.",
24
- defaultValue: 0.8,
25
- group: GROUPS.basic,
26
- }),
27
- disabledOpacity: createNumberProp({
28
- label: "Disabled Opacity",
29
- description: "The opacity when the button is disabled.",
30
- defaultValue: 0.8,
31
- group: GROUPS.basic,
32
- }),
33
- delayLongPress: createNumberProp({
34
- label: "Delay Long Press",
35
- description:
36
- "Duration (in milliseconds) from onPressIn before onLongPress is called.",
37
- group: GROUPS.basic,
38
- }),
39
- hitSlop: createNumberProp({
40
- label: "Hit Slop",
41
- description:
42
- "Sets additional distance outside of element in which a press can be detected.",
43
- group: GROUPS.basic,
44
- }),
45
- },
46
- };
47
-
48
- export const SEED_DATA = [
49
- {
50
- name: "Touchable",
51
- tag: "Touchable",
52
- description: "An interactive view with no styles",
53
- category: COMPONENT_TYPES.button,
54
- ...SEED_DATA_PROPS,
55
- },
56
- {
57
- name: "Pressable",
58
- tag: "Pressable",
59
- description: "An interactive view with no styles",
60
- category: COMPONENT_TYPES.deprecated,
61
- ...SEED_DATA_PROPS,
62
- },
63
- ];