react-native-hold-menu-actions 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENCE +21 -0
- package/README.md +38 -0
- package/lib/commonjs/components/backdrop/Backdrop.js +104 -0
- package/lib/commonjs/components/backdrop/Backdrop.js.map +1 -0
- package/lib/commonjs/components/backdrop/constants.js +14 -0
- package/lib/commonjs/components/backdrop/constants.js.map +1 -0
- package/lib/commonjs/components/backdrop/index.js +16 -0
- package/lib/commonjs/components/backdrop/index.js.map +1 -0
- package/lib/commonjs/components/backdrop/styles.js +17 -0
- package/lib/commonjs/components/backdrop/styles.js.map +1 -0
- package/lib/commonjs/components/flatList/FlatList.js +35 -0
- package/lib/commonjs/components/flatList/FlatList.js.map +1 -0
- package/lib/commonjs/components/flatList/index.js +16 -0
- package/lib/commonjs/components/flatList/index.js.map +1 -0
- package/lib/commonjs/components/holdItem/HoldItem.js +369 -0
- package/lib/commonjs/components/holdItem/HoldItem.js.map +1 -0
- package/lib/commonjs/components/holdItem/index.js +16 -0
- package/lib/commonjs/components/holdItem/index.js.map +1 -0
- package/lib/commonjs/components/holdItem/styles.js +22 -0
- package/lib/commonjs/components/holdItem/styles.js.map +1 -0
- package/lib/commonjs/components/holdItem/types.d.js +2 -0
- package/lib/commonjs/components/holdItem/types.d.js.map +1 -0
- package/lib/commonjs/components/icon/Icon.js +43 -0
- package/lib/commonjs/components/icon/Icon.js.map +1 -0
- package/lib/commonjs/components/icon/index.js +16 -0
- package/lib/commonjs/components/icon/index.js.map +1 -0
- package/lib/commonjs/components/menu/Menu.js +57 -0
- package/lib/commonjs/components/menu/Menu.js.map +1 -0
- package/lib/commonjs/components/menu/MenuItem.js +85 -0
- package/lib/commonjs/components/menu/MenuItem.js.map +1 -0
- package/lib/commonjs/components/menu/MenuItems.js +35 -0
- package/lib/commonjs/components/menu/MenuItems.js.map +1 -0
- package/lib/commonjs/components/menu/MenuList.js +121 -0
- package/lib/commonjs/components/menu/MenuList.js.map +1 -0
- package/lib/commonjs/components/menu/Separator.js +47 -0
- package/lib/commonjs/components/menu/Separator.js.map +1 -0
- package/lib/commonjs/components/menu/calculations.js +31 -0
- package/lib/commonjs/components/menu/calculations.js.map +1 -0
- package/lib/commonjs/components/menu/constants.js +21 -0
- package/lib/commonjs/components/menu/constants.js.map +1 -0
- package/lib/commonjs/components/menu/index.js +16 -0
- package/lib/commonjs/components/menu/index.js.map +1 -0
- package/lib/commonjs/components/menu/styles.js +77 -0
- package/lib/commonjs/components/menu/styles.js.map +1 -0
- package/lib/commonjs/components/menu/types.d.js +2 -0
- package/lib/commonjs/components/menu/types.d.js.map +1 -0
- package/lib/commonjs/components/provider/Provider.js +98 -0
- package/lib/commonjs/components/provider/Provider.js.map +1 -0
- package/lib/commonjs/components/provider/index.js +16 -0
- package/lib/commonjs/components/provider/index.js.map +1 -0
- package/lib/commonjs/components/provider/reducer.js +50 -0
- package/lib/commonjs/components/provider/reducer.js.map +1 -0
- package/lib/commonjs/components/provider/types.d.js +2 -0
- package/lib/commonjs/components/provider/types.d.js.map +1 -0
- package/lib/commonjs/constants.js +60 -0
- package/lib/commonjs/constants.js.map +1 -0
- package/lib/commonjs/context/index.js +14 -0
- package/lib/commonjs/context/index.js.map +1 -0
- package/lib/commonjs/context/internal.js +13 -0
- package/lib/commonjs/context/internal.js.map +1 -0
- package/lib/commonjs/hooks/index.js +24 -0
- package/lib/commonjs/hooks/index.js.map +1 -0
- package/lib/commonjs/hooks/useDeviceOrientation.js +38 -0
- package/lib/commonjs/hooks/useDeviceOrientation.js.map +1 -0
- package/lib/commonjs/hooks/useInternal.js +15 -0
- package/lib/commonjs/hooks/useInternal.js.map +1 -0
- package/lib/commonjs/index.js +40 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/styleGuide.js +39 -0
- package/lib/commonjs/styleGuide.js.map +1 -0
- package/lib/commonjs/utils/calculations.js +73 -0
- package/lib/commonjs/utils/calculations.js.map +1 -0
- package/lib/commonjs/utils/validations.js +43 -0
- package/lib/commonjs/utils/validations.js.map +1 -0
- package/lib/module/components/backdrop/Backdrop.js +83 -0
- package/lib/module/components/backdrop/Backdrop.js.map +1 -0
- package/lib/module/components/backdrop/constants.js +4 -0
- package/lib/module/components/backdrop/constants.js.map +1 -0
- package/lib/module/components/backdrop/index.js +2 -0
- package/lib/module/components/backdrop/index.js.map +1 -0
- package/lib/module/components/backdrop/styles.js +7 -0
- package/lib/module/components/backdrop/styles.js.map +1 -0
- package/lib/module/components/flatList/FlatList.js +17 -0
- package/lib/module/components/flatList/FlatList.js.map +1 -0
- package/lib/module/components/flatList/index.js +2 -0
- package/lib/module/components/flatList/index.js.map +1 -0
- package/lib/module/components/holdItem/HoldItem.js +344 -0
- package/lib/module/components/holdItem/HoldItem.js.map +1 -0
- package/lib/module/components/holdItem/index.js +2 -0
- package/lib/module/components/holdItem/index.js.map +1 -0
- package/lib/module/components/holdItem/styles.js +12 -0
- package/lib/module/components/holdItem/styles.js.map +1 -0
- package/lib/module/components/holdItem/types.d.js +2 -0
- package/lib/module/components/holdItem/types.d.js.map +1 -0
- package/lib/module/components/icon/Icon.js +26 -0
- package/lib/module/components/icon/Icon.js.map +1 -0
- package/lib/module/components/icon/index.js +2 -0
- package/lib/module/components/icon/index.js.map +1 -0
- package/lib/module/components/menu/Menu.js +37 -0
- package/lib/module/components/menu/Menu.js.map +1 -0
- package/lib/module/components/menu/MenuItem.js +59 -0
- package/lib/module/components/menu/MenuItem.js.map +1 -0
- package/lib/module/components/menu/MenuItems.js +19 -0
- package/lib/module/components/menu/MenuItems.js.map +1 -0
- package/lib/module/components/menu/MenuList.js +93 -0
- package/lib/module/components/menu/MenuList.js.map +1 -0
- package/lib/module/components/menu/Separator.js +29 -0
- package/lib/module/components/menu/Separator.js.map +1 -0
- package/lib/module/components/menu/calculations.js +17 -0
- package/lib/module/components/menu/calculations.js.map +1 -0
- package/lib/module/components/menu/constants.js +8 -0
- package/lib/module/components/menu/constants.js.map +1 -0
- package/lib/module/components/menu/index.js +2 -0
- package/lib/module/components/menu/index.js.map +1 -0
- package/lib/module/components/menu/styles.js +63 -0
- package/lib/module/components/menu/styles.js.map +1 -0
- package/lib/module/components/menu/types.d.js +2 -0
- package/lib/module/components/menu/types.d.js.map +1 -0
- package/lib/module/components/provider/Provider.js +75 -0
- package/lib/module/components/provider/Provider.js.map +1 -0
- package/lib/module/components/provider/index.js +2 -0
- package/lib/module/components/provider/index.js.map +1 -0
- package/lib/module/components/provider/reducer.js +38 -0
- package/lib/module/components/provider/reducer.js.map +1 -0
- package/lib/module/components/provider/types.d.js +2 -0
- package/lib/module/components/provider/types.d.js.map +1 -0
- package/lib/module/constants.js +37 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/context/index.js +2 -0
- package/lib/module/context/index.js.map +1 -0
- package/lib/module/context/internal.js +4 -0
- package/lib/module/context/internal.js.map +1 -0
- package/lib/module/hooks/index.js +3 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/useDeviceOrientation.js +27 -0
- package/lib/module/hooks/useDeviceOrientation.js.map +1 -0
- package/lib/module/hooks/useInternal.js +4 -0
- package/lib/module/hooks/useInternal.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/styleGuide.js +30 -0
- package/lib/module/styleGuide.js.map +1 -0
- package/lib/module/utils/calculations.js +51 -0
- package/lib/module/utils/calculations.js.map +1 -0
- package/lib/module/utils/validations.js +38 -0
- package/lib/module/utils/validations.js.map +1 -0
- package/lib/typescript/components/backdrop/Backdrop.d.ts +3 -0
- package/lib/typescript/components/backdrop/constants.d.ts +2 -0
- package/lib/typescript/components/backdrop/index.d.ts +1 -0
- package/lib/typescript/components/backdrop/styles.d.ts +10 -0
- package/lib/typescript/components/flatList/FlatList.d.ts +5 -0
- package/lib/typescript/components/flatList/index.d.ts +2 -0
- package/lib/typescript/components/holdItem/HoldItem.d.ts +4 -0
- package/lib/typescript/components/holdItem/index.d.ts +2 -0
- package/lib/typescript/components/holdItem/styles.d.ts +15 -0
- package/lib/typescript/components/holdItem/types.d.ts +131 -0
- package/lib/typescript/components/icon/Icon.d.ts +7 -0
- package/lib/typescript/components/icon/index.d.ts +1 -0
- package/lib/typescript/components/menu/Menu.d.ts +3 -0
- package/lib/typescript/components/menu/MenuItem.d.ts +8 -0
- package/lib/typescript/components/menu/MenuItems.d.ts +6 -0
- package/lib/typescript/components/menu/MenuList.d.ts +3 -0
- package/lib/typescript/components/menu/Separator.d.ts +3 -0
- package/lib/typescript/components/menu/calculations.d.ts +4 -0
- package/lib/typescript/components/menu/constants.d.ts +7 -0
- package/lib/typescript/components/menu/index.d.ts +1 -0
- package/lib/typescript/components/menu/styles.d.ts +59 -0
- package/lib/typescript/components/menu/types.d.ts +28 -0
- package/lib/typescript/components/provider/Provider.d.ts +10 -0
- package/lib/typescript/components/provider/index.d.ts +2 -0
- package/lib/typescript/components/provider/reducer.d.ts +20 -0
- package/lib/typescript/components/provider/types.d.ts +33 -0
- package/lib/typescript/constants.d.ts +29 -0
- package/lib/typescript/context/index.d.ts +1 -0
- package/lib/typescript/context/internal.d.ts +16 -0
- package/lib/typescript/hooks/index.d.ts +2 -0
- package/lib/typescript/hooks/useDeviceOrientation.d.ts +3 -0
- package/lib/typescript/hooks/useInternal.d.ts +1 -0
- package/lib/typescript/index.d.ts +4 -0
- package/lib/typescript/styleGuide.d.ts +28 -0
- package/lib/typescript/utils/calculations.d.ts +14 -0
- package/lib/typescript/utils/validations.d.ts +3 -0
- package/package.json +106 -0
- package/src/components/backdrop/Backdrop.tsx +138 -0
- package/src/components/backdrop/constants.ts +8 -0
- package/src/components/backdrop/index.ts +1 -0
- package/src/components/backdrop/styles.ts +8 -0
- package/src/components/flatList/FlatList.tsx +23 -0
- package/src/components/flatList/index.ts +2 -0
- package/src/components/holdItem/HoldItem.tsx +449 -0
- package/src/components/holdItem/index.ts +2 -0
- package/src/components/holdItem/styles.ts +11 -0
- package/src/components/holdItem/types.d.ts +131 -0
- package/src/components/icon/Icon.tsx +33 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/menu/Menu.tsx +57 -0
- package/src/components/menu/MenuItem.tsx +79 -0
- package/src/components/menu/MenuItems.tsx +26 -0
- package/src/components/menu/MenuList.tsx +151 -0
- package/src/components/menu/Separator.tsx +28 -0
- package/src/components/menu/calculations.ts +49 -0
- package/src/components/menu/constants.ts +9 -0
- package/src/components/menu/index.ts +1 -0
- package/src/components/menu/styles.ts +64 -0
- package/src/components/menu/types.d.ts +28 -0
- package/src/components/provider/Provider.tsx +105 -0
- package/src/components/provider/index.ts +2 -0
- package/src/components/provider/reducer.ts +48 -0
- package/src/components/provider/types.d.ts +33 -0
- package/src/constants.ts +54 -0
- package/src/context/index.ts +1 -0
- package/src/context/internal.ts +19 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useDeviceOrientation.ts +28 -0
- package/src/hooks/useInternal.ts +4 -0
- package/src/index.ts +4 -0
- package/src/styleGuide.ts +31 -0
- package/src/utils/calculations.ts +110 -0
- package/src/utils/validations.ts +42 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import styleGuide from '../styleGuide';
|
|
2
|
+
import { MENU_WIDTH, MENU_TRANSFORM_ORIGIN_TOLERENCE, FONT_SCALE } from '../constants';
|
|
3
|
+
export const MenuItemHeight = () => {
|
|
4
|
+
'worklet';
|
|
5
|
+
|
|
6
|
+
return styleGuide.typography.callout.lineHeight * FONT_SCALE + styleGuide.spacing * 2.5;
|
|
7
|
+
};
|
|
8
|
+
export const calculateMenuHeight = (itemLength, separatorCount) => {
|
|
9
|
+
'worklet';
|
|
10
|
+
|
|
11
|
+
return MenuItemHeight() * itemLength + (itemLength - 1) + separatorCount * styleGuide.spacing;
|
|
12
|
+
};
|
|
13
|
+
export const menuAnimationAnchor = (anchorPoint, itemWidth, itemLength, itemsWithSeparatorLength) => {
|
|
14
|
+
'worklet';
|
|
15
|
+
|
|
16
|
+
const MenuHeight = calculateMenuHeight(itemLength, itemsWithSeparatorLength);
|
|
17
|
+
const splittetAnchorName = anchorPoint.split('-');
|
|
18
|
+
const Center1 = itemWidth;
|
|
19
|
+
const Center2 = 0;
|
|
20
|
+
const TyTop1 = -(MenuHeight / 2);
|
|
21
|
+
const TyTop2 = MenuHeight / 2;
|
|
22
|
+
const TxLeft1 = MENU_WIDTH / 2 * -1;
|
|
23
|
+
const TxLeft2 = MENU_WIDTH / 2 * 1;
|
|
24
|
+
return {
|
|
25
|
+
beginningTransformations: {
|
|
26
|
+
translateX: splittetAnchorName[1] === 'right' ? -TxLeft1 : splittetAnchorName[1] === 'left' ? TxLeft1 : Center1,
|
|
27
|
+
translateY: splittetAnchorName[0] === 'top' ? TyTop1 : splittetAnchorName[0] === 'bottom' ? TyTop1 : Center2
|
|
28
|
+
},
|
|
29
|
+
endingTransformations: {
|
|
30
|
+
translateX: splittetAnchorName[1] === 'right' ? -TxLeft2 : splittetAnchorName[1] === 'left' ? TxLeft2 : Center2,
|
|
31
|
+
translateY: splittetAnchorName[0] === 'top' ? TyTop2 : splittetAnchorName[0] === 'bottom' ? -TyTop2 : Center2
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
export const getTransformOrigin = (posX, itemWidth, windowWidth, bottom) => {
|
|
36
|
+
'worklet';
|
|
37
|
+
|
|
38
|
+
const distanceToLeft = Math.round(posX + itemWidth / 2);
|
|
39
|
+
const distanceToRight = Math.round(windowWidth - distanceToLeft);
|
|
40
|
+
let position = bottom ? 'bottom-right' : 'top-right';
|
|
41
|
+
const majority = Math.abs(distanceToLeft - distanceToRight);
|
|
42
|
+
|
|
43
|
+
if (majority < MENU_TRANSFORM_ORIGIN_TOLERENCE) {
|
|
44
|
+
position = bottom ? 'bottom-center' : 'top-center';
|
|
45
|
+
} else if (distanceToLeft < distanceToRight) {
|
|
46
|
+
position = bottom ? 'bottom-left' : 'top-left';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return position;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=calculations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["calculations.ts"],"names":["styleGuide","MENU_WIDTH","MENU_TRANSFORM_ORIGIN_TOLERENCE","FONT_SCALE","MenuItemHeight","typography","callout","lineHeight","spacing","calculateMenuHeight","itemLength","separatorCount","menuAnimationAnchor","anchorPoint","itemWidth","itemsWithSeparatorLength","MenuHeight","splittetAnchorName","split","Center1","Center2","TyTop1","TyTop2","TxLeft1","TxLeft2","beginningTransformations","translateX","translateY","endingTransformations","getTransformOrigin","posX","windowWidth","bottom","distanceToLeft","Math","round","distanceToRight","position","majority","abs"],"mappings":"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","sourcesContent":["import styleGuide from '../styleGuide';\nimport {\n MENU_WIDTH,\n MENU_TRANSFORM_ORIGIN_TOLERENCE,\n FONT_SCALE,\n} from '../constants';\n\nexport const MenuItemHeight = () => {\n 'worklet';\n return (\n styleGuide.typography.callout.lineHeight * FONT_SCALE +\n styleGuide.spacing * 2.5\n );\n};\n\nexport const calculateMenuHeight = (\n itemLength: number,\n separatorCount: number\n) => {\n 'worklet';\n return (\n MenuItemHeight() * itemLength +\n (itemLength - 1) +\n separatorCount * styleGuide.spacing\n );\n};\n\nexport type TransformOriginAnchorPosition =\n | 'top-right'\n | 'top-left'\n | 'top-center'\n | 'bottom-right'\n | 'bottom-left'\n | 'bottom-center';\n\nexport const menuAnimationAnchor = (\n anchorPoint: TransformOriginAnchorPosition,\n itemWidth: number,\n itemLength: number,\n itemsWithSeparatorLength: number\n) => {\n 'worklet';\n const MenuHeight = calculateMenuHeight(itemLength, itemsWithSeparatorLength);\n const splittetAnchorName: string[] = anchorPoint.split('-');\n\n const Center1 = itemWidth;\n const Center2 = 0;\n\n const TyTop1 = -(MenuHeight / 2);\n const TyTop2 = MenuHeight / 2;\n\n const TxLeft1 = (MENU_WIDTH / 2) * -1;\n const TxLeft2 = (MENU_WIDTH / 2) * 1;\n\n return {\n beginningTransformations: {\n translateX:\n splittetAnchorName[1] === 'right'\n ? -TxLeft1\n : splittetAnchorName[1] === 'left'\n ? TxLeft1\n : Center1,\n translateY:\n splittetAnchorName[0] === 'top'\n ? TyTop1\n : splittetAnchorName[0] === 'bottom'\n ? TyTop1\n : Center2,\n },\n endingTransformations: {\n translateX:\n splittetAnchorName[1] === 'right'\n ? -TxLeft2\n : splittetAnchorName[1] === 'left'\n ? TxLeft2\n : Center2,\n translateY:\n splittetAnchorName[0] === 'top'\n ? TyTop2\n : splittetAnchorName[0] === 'bottom'\n ? -TyTop2\n : Center2,\n },\n };\n};\n\nexport const getTransformOrigin = (\n posX: number,\n itemWidth: number,\n windowWidth: number,\n bottom?: boolean\n): TransformOriginAnchorPosition => {\n 'worklet';\n const distanceToLeft = Math.round(posX + itemWidth / 2);\n const distanceToRight = Math.round(windowWidth - distanceToLeft);\n\n let position: TransformOriginAnchorPosition = bottom\n ? 'bottom-right'\n : 'top-right';\n\n const majority = Math.abs(distanceToLeft - distanceToRight);\n\n if (majority < MENU_TRANSFORM_ORIGIN_TOLERENCE) {\n position = bottom ? 'bottom-center' : 'top-center';\n } else if (distanceToLeft < distanceToRight) {\n position = bottom ? 'bottom-left' : 'top-left';\n }\n\n return position;\n};\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function fieldAreSame(obj1, obj2) {
|
|
2
|
+
'worklet';
|
|
3
|
+
|
|
4
|
+
const keys = Object.keys(obj1);
|
|
5
|
+
return keys.every(key => {
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
const val1 = obj1[key]; // @ts-ignore
|
|
8
|
+
|
|
9
|
+
const val2 = obj2[key];
|
|
10
|
+
|
|
11
|
+
if (val1 !== val2) {
|
|
12
|
+
if (typeof val1 === 'function' && typeof val2 === 'function') return val1.toString() === val2.toString();
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return true;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function deepEqual(array1, array2) {
|
|
21
|
+
'worklet';
|
|
22
|
+
|
|
23
|
+
const areArrays = Array.isArray(array1) && Array.isArray(array2);
|
|
24
|
+
const areSameLength = areArrays && array2 && array1.length === array2.length;
|
|
25
|
+
|
|
26
|
+
if (areArrays && areSameLength && array2) {
|
|
27
|
+
return array1.every((menuItem, index) => {
|
|
28
|
+
const obj1 = menuItem;
|
|
29
|
+
const obj2 = array2[index];
|
|
30
|
+
return fieldAreSame(obj1, obj2);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { deepEqual };
|
|
38
|
+
//# sourceMappingURL=validations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["validations.ts"],"names":["fieldAreSame","obj1","obj2","keys","Object","every","key","val1","val2","toString","deepEqual","array1","array2","areArrays","Array","isArray","areSameLength","length","menuItem","index"],"mappings":"AAEA,SAASA,YAAT,CAAsBC,IAAtB,EAA2CC,IAA3C,EAAgE;AAC9D;;AAEA,QAAMC,IAAI,GAAGC,MAAM,CAACD,IAAP,CAAYF,IAAZ,CAAb;AAEA,SAAOE,IAAI,CAACE,KAAL,CAAWC,GAAG,IAAI;AACvB;AACA,UAAMC,IAAI,GAAGN,IAAI,CAACK,GAAD,CAAjB,CAFuB,CAGvB;;AACA,UAAME,IAAI,GAAGN,IAAI,CAACI,GAAD,CAAjB;;AAEA,QAAIC,IAAI,KAAKC,IAAb,EAAmB;AACjB,UAAI,OAAOD,IAAP,KAAgB,UAAhB,IAA8B,OAAOC,IAAP,KAAgB,UAAlD,EACE,OAAOD,IAAI,CAACE,QAAL,OAAoBD,IAAI,CAACC,QAAL,EAA3B;AACF,aAAO,KAAP;AACD;;AAED,WAAO,IAAP;AACD,GAbM,CAAP;AAcD;;AAED,SAASC,SAAT,CAAmBC,MAAnB,EAA4CC,MAA5C,EAAqE;AACnE;;AAEA,QAAMC,SAAS,GAAGC,KAAK,CAACC,OAAN,CAAcJ,MAAd,KAAyBG,KAAK,CAACC,OAAN,CAAcH,MAAd,CAA3C;AACA,QAAMI,aAAa,GAAGH,SAAS,IAAID,MAAb,IAAuBD,MAAM,CAACM,MAAP,KAAkBL,MAAM,CAACK,MAAtE;;AAEA,MAAIJ,SAAS,IAAIG,aAAb,IAA8BJ,MAAlC,EAA0C;AACxC,WAAOD,MAAM,CAACN,KAAP,CAAa,CAACa,QAAD,EAA0BC,KAA1B,KAAoC;AACtD,YAAMlB,IAAI,GAAGiB,QAAb;AACA,YAAMhB,IAAI,GAAGU,MAAM,CAACO,KAAD,CAAnB;AAEA,aAAOnB,YAAY,CAACC,IAAD,EAAOC,IAAP,CAAnB;AACD,KALM,CAAP;AAMD;;AAED,SAAO,KAAP;AACD;;AAED,SAASQ,SAAT","sourcesContent":["import { MenuItemProps } from '../components/menu/types';\n\nfunction fieldAreSame(obj1: MenuItemProps, obj2: MenuItemProps) {\n 'worklet';\n\n const keys = Object.keys(obj1);\n\n return keys.every(key => {\n // @ts-ignore\n const val1 = obj1[key];\n // @ts-ignore\n const val2 = obj2[key];\n\n if (val1 !== val2) {\n if (typeof val1 === 'function' && typeof val2 === 'function')\n return val1.toString() === val2.toString();\n return false;\n }\n\n return true;\n });\n}\n\nfunction deepEqual(array1: MenuItemProps[], array2: MenuItemProps[]) {\n 'worklet';\n\n const areArrays = Array.isArray(array1) && Array.isArray(array2);\n const areSameLength = areArrays && array2 && array1.length === array2.length;\n\n if (areArrays && areSameLength && array2) {\n return array1.every((menuItem: MenuItemProps, index) => {\n const obj1 = menuItem;\n const obj2 = array2[index];\n\n return fieldAreSame(obj1, obj2);\n });\n }\n\n return false;\n}\n\nexport { deepEqual };\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Backdrop } from './Backdrop';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlatListProps as RNFlatListProps } from 'react-native';
|
|
3
|
+
export declare type HoldMenuFlatListProps<T> = Omit<RNFlatListProps<T>, 'scrollEventThrottle'>;
|
|
4
|
+
declare const HoldMenuFlatList: React.MemoExoticComponent<(props: HoldMenuFlatListProps<any>) => JSX.Element>;
|
|
5
|
+
export default HoldMenuFlatList;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { HoldItemProps } from './types';
|
|
3
|
+
declare const HoldItem: React.MemoExoticComponent<({ items, bottom, containerStyles, disableMove, menuAnchorPosition, activateOn, hapticFeedback, actionParams, closeOnTap, longPressMinDurationMs, children, }: HoldItemProps) => JSX.Element>;
|
|
4
|
+
export default HoldItem;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { ViewStyle } from 'react-native';
|
|
2
|
+
import { MenuItemProps } from '../menu/types';
|
|
3
|
+
import { TransformOriginAnchorPosition } from '../../utils/calculations';
|
|
4
|
+
|
|
5
|
+
export type HoldItemProps = {
|
|
6
|
+
/**
|
|
7
|
+
* List of context menu items.
|
|
8
|
+
* @type MenuItemProps[]
|
|
9
|
+
* @default []
|
|
10
|
+
*/
|
|
11
|
+
items: MenuItemProps[];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Object of keys that same name with items to match parameters to onPress actions.
|
|
15
|
+
* @type { [name: string]: (string | number)[] }
|
|
16
|
+
* @examples
|
|
17
|
+
* ```js
|
|
18
|
+
* const items = [
|
|
19
|
+
* {text: 'Reply', onPress: (messageId) => {}},
|
|
20
|
+
* {text: 'Copy', onPress: (messageText) => {}},
|
|
21
|
+
* ]
|
|
22
|
+
* ...
|
|
23
|
+
* <HoldItem
|
|
24
|
+
* items={items}
|
|
25
|
+
* actionParams={{
|
|
26
|
+
* Reply: ['dd443224-7f43'],
|
|
27
|
+
* Copy: ['Hello World!']
|
|
28
|
+
* }}
|
|
29
|
+
* ><View/></HoldItem>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
actionParams?: {
|
|
33
|
+
[name: string]: any[];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
children: React.ReactElement | React.ReactElement[];
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Menu anchor position is calculated automaticly.
|
|
40
|
+
* But you can override the calculation by passing an anchor position.
|
|
41
|
+
* @type TransformOriginAnchorPosition
|
|
42
|
+
* @examples
|
|
43
|
+
* menuAnchorPosition="top-bottom"
|
|
44
|
+
*/
|
|
45
|
+
menuAnchorPosition?: TransformOriginAnchorPosition;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Disables moving holded item
|
|
49
|
+
* @type boolean
|
|
50
|
+
* @default false
|
|
51
|
+
* @examples
|
|
52
|
+
* disableMove={true}
|
|
53
|
+
*/
|
|
54
|
+
disableMove?: boolean;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* HoldItem wrapper component styles.
|
|
58
|
+
* You may need for some examples like dynamic width or hight like message boxes.
|
|
59
|
+
* See Whatsapp example.
|
|
60
|
+
* @type ViewStyles
|
|
61
|
+
* @default {}
|
|
62
|
+
* @examples
|
|
63
|
+
* containerStyles={{ maxWidth: '80%' }}
|
|
64
|
+
*/
|
|
65
|
+
containerStyles?: ViewStyle | ViewStyle[];
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Theme for menu background and texts
|
|
69
|
+
* @type string
|
|
70
|
+
* @examples
|
|
71
|
+
* theme="light"
|
|
72
|
+
*/
|
|
73
|
+
theme?: 'light' | 'dark';
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Set true if you want to open menu from bottom
|
|
77
|
+
* @type boolean
|
|
78
|
+
* @default false
|
|
79
|
+
* @examples
|
|
80
|
+
* bottom={true}
|
|
81
|
+
*/
|
|
82
|
+
bottom?: boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Set if you'd like a different tap activation
|
|
86
|
+
* @type string
|
|
87
|
+
* @default 'hold'
|
|
88
|
+
* @examples
|
|
89
|
+
* activateOn="hold"
|
|
90
|
+
*/
|
|
91
|
+
activateOn?: 'tap' | 'double-tap' | 'hold';
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Set if you'd like to enable haptic feedback on activation
|
|
95
|
+
* @type string
|
|
96
|
+
* @default 'Medium'
|
|
97
|
+
* @examples
|
|
98
|
+
* hapticFeedback="None"
|
|
99
|
+
*/
|
|
100
|
+
hapticFeedback?:
|
|
101
|
+
| 'None'
|
|
102
|
+
| 'Selection'
|
|
103
|
+
| 'Light'
|
|
104
|
+
| 'Medium'
|
|
105
|
+
| 'Heavy'
|
|
106
|
+
| 'Success'
|
|
107
|
+
| 'Warning'
|
|
108
|
+
| 'Error';
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Set true if you want to close menu when tap to HoldItem
|
|
112
|
+
* @type boolean
|
|
113
|
+
* @default false
|
|
114
|
+
* @examples
|
|
115
|
+
* closeOnTap={true}
|
|
116
|
+
*/
|
|
117
|
+
closeOnTap?: boolean;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Set delay before long tap will activate gesture. May be useful to increase this value in lists
|
|
121
|
+
* @type number
|
|
122
|
+
* @default 150
|
|
123
|
+
* @examples
|
|
124
|
+
* longPressMinDurationMs={250}
|
|
125
|
+
*/
|
|
126
|
+
longPressMinDurationMs?: number;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export type GestureHandlerProps = {
|
|
130
|
+
children: React.ReactElement | React.ReactElement[];
|
|
131
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Icon';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MenuItemProps } from './types';
|
|
3
|
+
declare type MenuItemComponentProps = {
|
|
4
|
+
item: MenuItemProps;
|
|
5
|
+
isLast?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const MenuItem: React.MemoExoticComponent<({ item, isLast }: MenuItemComponentProps) => JSX.Element>;
|
|
8
|
+
export default MenuItem;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Animated from 'react-native-reanimated';
|
|
2
|
+
import type { MenuInternalProps } from './types';
|
|
3
|
+
export declare const leftOrRight: (menuProps: Animated.SharedValue<MenuInternalProps>) => number;
|
|
4
|
+
export declare const getColor: (isTitle: boolean | undefined, isDestructive: boolean | undefined, themeValue: 'light' | 'dark') => "gray" | "rgba(0, 0, 0, 1)" | "rgb(255, 255, 255)" | "rgb(255, 59,48)" | "rgb(255, 69,58)";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const BORDER_LIGHT_COLOR = "rgba(0, 0, 0, 0.1)";
|
|
2
|
+
export declare const BORDER_DARK_COLOR = "rgba(255, 255, 255, 0.1)";
|
|
3
|
+
export declare const MENU_TITLE_COLOR = "gray";
|
|
4
|
+
export declare const MENU_TEXT_LIGHT_COLOR = "rgba(0, 0, 0, 1)";
|
|
5
|
+
export declare const MENU_TEXT_DARK_COLOR = "rgb(255, 255, 255)";
|
|
6
|
+
export declare const MENU_TEXT_DESTRUCTIVE_COLOR_LIGHT = "rgb(255, 59,48)";
|
|
7
|
+
export declare const MENU_TEXT_DESTRUCTIVE_COLOR_DARK = "rgb(255, 69,58)";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './Menu';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare const styles: {
|
|
2
|
+
menuWrapper: {
|
|
3
|
+
position: "absolute";
|
|
4
|
+
left: number;
|
|
5
|
+
zIndex: number;
|
|
6
|
+
};
|
|
7
|
+
menuContainer: {
|
|
8
|
+
position: "absolute";
|
|
9
|
+
top: number;
|
|
10
|
+
width: number;
|
|
11
|
+
borderRadius: number;
|
|
12
|
+
display: "flex";
|
|
13
|
+
flexDirection: "row";
|
|
14
|
+
justifyContent: "flex-start";
|
|
15
|
+
alignItems: "flex-start";
|
|
16
|
+
overflow: "hidden";
|
|
17
|
+
zIndex: number;
|
|
18
|
+
};
|
|
19
|
+
menuInnerContainer: {
|
|
20
|
+
display: "flex";
|
|
21
|
+
flexDirection: "column";
|
|
22
|
+
justifyContent: "flex-start";
|
|
23
|
+
alignItems: "center";
|
|
24
|
+
};
|
|
25
|
+
menuItem: {
|
|
26
|
+
width: string;
|
|
27
|
+
display: "flex";
|
|
28
|
+
flexDirection: "row";
|
|
29
|
+
justifyContent: "space-between";
|
|
30
|
+
alignItems: "center";
|
|
31
|
+
paddingHorizontal: number;
|
|
32
|
+
paddingVertical: number;
|
|
33
|
+
};
|
|
34
|
+
border: {
|
|
35
|
+
borderBottomWidth: number;
|
|
36
|
+
borderBottomColor: string;
|
|
37
|
+
};
|
|
38
|
+
menuItemText: {
|
|
39
|
+
fontSize: number;
|
|
40
|
+
lineHeight: number;
|
|
41
|
+
textAlign: "left";
|
|
42
|
+
width: string;
|
|
43
|
+
flex: number;
|
|
44
|
+
};
|
|
45
|
+
menuItemTitleText: {
|
|
46
|
+
fontSize: number;
|
|
47
|
+
lineHeight: number;
|
|
48
|
+
textAlign: "center";
|
|
49
|
+
width: string;
|
|
50
|
+
flex: number;
|
|
51
|
+
};
|
|
52
|
+
textDark: {
|
|
53
|
+
color: string;
|
|
54
|
+
};
|
|
55
|
+
textLight: {
|
|
56
|
+
color: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export default styles;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TransformOriginAnchorPosition } from '../../utils/calculations';
|
|
2
|
+
|
|
3
|
+
export type MenuItemProps = {
|
|
4
|
+
text: string;
|
|
5
|
+
icon?: string | (() => React.ReactElement);
|
|
6
|
+
onPress?: (...args: any[]) => void;
|
|
7
|
+
isTitle?: boolean;
|
|
8
|
+
isDestructive?: boolean;
|
|
9
|
+
withSeparator?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type MenuListProps = {
|
|
13
|
+
items: MenuItemProps[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type MenuInternalProps = {
|
|
17
|
+
items: MenuItemProps[];
|
|
18
|
+
itemHeight: number;
|
|
19
|
+
itemWidth: number;
|
|
20
|
+
itemY: number;
|
|
21
|
+
itemX: number;
|
|
22
|
+
anchorPosition: TransformOriginAnchorPosition;
|
|
23
|
+
menuHeight: number;
|
|
24
|
+
transformValue: number;
|
|
25
|
+
actionParams: {
|
|
26
|
+
[name: string]: (string | number)[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HoldMenuProviderProps } from './types';
|
|
3
|
+
import { StateProps, Action } from './reducer';
|
|
4
|
+
export interface Store {
|
|
5
|
+
state: StateProps;
|
|
6
|
+
dispatch?: React.Dispatch<Action>;
|
|
7
|
+
}
|
|
8
|
+
export declare let AnimatedIcon: any;
|
|
9
|
+
declare const Provider: React.MemoExoticComponent<({ children, theme: selectedTheme, iconComponent, safeAreaInsets, onOpen, onClose, }: HoldMenuProviderProps) => JSX.Element>;
|
|
10
|
+
export default Provider;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare type StateProps = {
|
|
2
|
+
active: number;
|
|
3
|
+
activeItem: string | null;
|
|
4
|
+
theme: 'light' | 'dark';
|
|
5
|
+
};
|
|
6
|
+
export declare enum ActionType {
|
|
7
|
+
Active = "Active",
|
|
8
|
+
End = "End",
|
|
9
|
+
Theme = "Theme"
|
|
10
|
+
}
|
|
11
|
+
export declare type Action = {
|
|
12
|
+
type: ActionType.Active;
|
|
13
|
+
activeItem: string | null;
|
|
14
|
+
} | {
|
|
15
|
+
type: ActionType.End;
|
|
16
|
+
} | {
|
|
17
|
+
type: ActionType.Theme;
|
|
18
|
+
};
|
|
19
|
+
export declare const reducer: (state: StateProps, action: Action) => StateProps;
|
|
20
|
+
export declare const initialState: StateProps;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface HoldMenuProviderProps {
|
|
2
|
+
/**
|
|
3
|
+
* Theme of hold menu. Effects to backdrop and context menu styles. Optional.
|
|
4
|
+
* @type "light" | "dark"
|
|
5
|
+
* @default "light"
|
|
6
|
+
* @examples
|
|
7
|
+
* theme="light"
|
|
8
|
+
*/
|
|
9
|
+
theme?: 'dark' | 'light';
|
|
10
|
+
iconComponent?: any;
|
|
11
|
+
children: React.ReactElement | React.ReactElement[];
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Set this to prevent the menu to be opened under the unsafe area.
|
|
15
|
+
* @type object
|
|
16
|
+
* @default
|
|
17
|
+
* { top: 0, bottom: 0, right: 0, left: 0 }
|
|
18
|
+
* @examples
|
|
19
|
+
* ```
|
|
20
|
+
* const insets = useSafeAreaInsets();
|
|
21
|
+
* safeAreaInsets={insets}
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
safeAreaInsets: {
|
|
25
|
+
top: number;
|
|
26
|
+
right: number;
|
|
27
|
+
bottom: number;
|
|
28
|
+
left: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
onOpen?: () => void;
|
|
32
|
+
onClose?: () => void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
declare const HOLD_ITEM_TRANSFORM_DURATION = 150;
|
|
2
|
+
declare const HOLD_ITEM_SCALE_DOWN_VALUE = 0.95;
|
|
3
|
+
declare const HOLD_ITEM_SCALE_DOWN_DURATION = 210;
|
|
4
|
+
declare const SPRING_CONFIGURATION: {
|
|
5
|
+
damping: number;
|
|
6
|
+
mass: number;
|
|
7
|
+
stiffness: number;
|
|
8
|
+
restDisplacementThreshold: number;
|
|
9
|
+
restSpeedThreshold: number;
|
|
10
|
+
};
|
|
11
|
+
declare const SPRING_CONFIGURATION_MENU: {
|
|
12
|
+
damping: number;
|
|
13
|
+
mass: number;
|
|
14
|
+
stiffness: number;
|
|
15
|
+
restDisplacementThreshold: number;
|
|
16
|
+
restSpeedThreshold: number;
|
|
17
|
+
};
|
|
18
|
+
declare enum CONTEXT_MENU_STATE {
|
|
19
|
+
UNDETERMINED = 0,
|
|
20
|
+
ACTIVE = 1,
|
|
21
|
+
END = 2
|
|
22
|
+
}
|
|
23
|
+
declare const WINDOW_HEIGHT: number, WINDOW_WIDTH: number;
|
|
24
|
+
declare const MENU_CONTAINER_WIDTH = 100;
|
|
25
|
+
declare const MENU_WIDTH: number;
|
|
26
|
+
declare const MENU_TRANSFORM_ORIGIN_TOLERENCE = 10;
|
|
27
|
+
declare const IS_IOS: boolean;
|
|
28
|
+
declare const FONT_SCALE: number;
|
|
29
|
+
export { CONTEXT_MENU_STATE, WINDOW_HEIGHT, WINDOW_WIDTH, MENU_WIDTH, MENU_CONTAINER_WIDTH, HOLD_ITEM_TRANSFORM_DURATION, HOLD_ITEM_SCALE_DOWN_VALUE, HOLD_ITEM_SCALE_DOWN_DURATION, SPRING_CONFIGURATION, SPRING_CONFIGURATION_MENU, MENU_TRANSFORM_ORIGIN_TOLERENCE, IS_IOS, FONT_SCALE, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { InternalContext } from './internal';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type Animated from 'react-native-reanimated';
|
|
3
|
+
import type { CONTEXT_MENU_STATE } from '../constants';
|
|
4
|
+
import { MenuInternalProps } from '../components/menu/types';
|
|
5
|
+
export declare type InternalContextType = {
|
|
6
|
+
state: Animated.SharedValue<CONTEXT_MENU_STATE>;
|
|
7
|
+
theme: Animated.SharedValue<'light' | 'dark'>;
|
|
8
|
+
menuProps: Animated.SharedValue<MenuInternalProps>;
|
|
9
|
+
safeAreaInsets?: {
|
|
10
|
+
top: number;
|
|
11
|
+
right: number;
|
|
12
|
+
bottom: number;
|
|
13
|
+
left: number;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const InternalContext: import("react").Context<InternalContextType>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useInternal: () => import("../context/internal").InternalContextType;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare const styleGuide: {
|
|
2
|
+
spacing: number;
|
|
3
|
+
dimensionWidth: number;
|
|
4
|
+
dimensionHeight: number;
|
|
5
|
+
palette: {
|
|
6
|
+
primary: string;
|
|
7
|
+
secondary: string;
|
|
8
|
+
common: {
|
|
9
|
+
white: string;
|
|
10
|
+
black: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
typography: {
|
|
14
|
+
body: {
|
|
15
|
+
fontSize: number;
|
|
16
|
+
lineHeight: number;
|
|
17
|
+
};
|
|
18
|
+
callout: {
|
|
19
|
+
fontSize: number;
|
|
20
|
+
lineHeight: number;
|
|
21
|
+
};
|
|
22
|
+
callout2: {
|
|
23
|
+
fontSize: number;
|
|
24
|
+
lineHeight: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export default styleGuide;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const MenuItemHeight: () => number;
|
|
2
|
+
export declare const calculateMenuHeight: (itemLength: number, separatorCount: number) => number;
|
|
3
|
+
export declare type TransformOriginAnchorPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
|
|
4
|
+
export declare const menuAnimationAnchor: (anchorPoint: TransformOriginAnchorPosition, itemWidth: number, itemLength: number, itemsWithSeparatorLength: number) => {
|
|
5
|
+
beginningTransformations: {
|
|
6
|
+
translateX: number;
|
|
7
|
+
translateY: number;
|
|
8
|
+
};
|
|
9
|
+
endingTransformations: {
|
|
10
|
+
translateX: number;
|
|
11
|
+
translateY: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const getTransformOrigin: (posX: number, itemWidth: number, windowWidth: number, bottom?: boolean | undefined) => TransformOriginAnchorPosition;
|