@momo-kits/foundation 0.169.17-beta.10 → 0.169.17-beta.13
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/Application/BottomSheet.tsx +2 -2
- package/Application/BottomTab/BottomTabBar.styles.ts +1 -1
- package/Application/BottomTab/DuoTabBar.styles.ts +1 -1
- package/Application/BottomTab/TabBarIcon.tsx +1 -1
- package/Application/BottomTab/index.tsx +1 -15
- package/Application/Components/HeaderExtendHeader.tsx +1 -3
- package/Application/Components/HeaderRight.tsx +3 -24
- package/Application/Components/SearchHeader.tsx +2 -3
- package/Application/ModalScreen.tsx +2 -2
- package/Application/StackScreen.tsx +6 -2
- package/Application/TooltipPortal.tsx +3 -3
- package/Application/headerLayout.ts +3 -7
- package/Application/hooks.ts +1 -1
- package/Application/modalLayout.ts +4 -12
- package/Application/types.tabs.ts +0 -8
- package/Button/index.tsx +2 -2
- package/Divider/DashDivider.tsx +2 -2
- package/Divider/index.tsx +3 -3
- package/FoundationList/index.tsx +1 -1
- package/Icon/types.ts +1 -2
- package/Image/index.tsx +70 -7
- package/Image/styles.ts +2 -0
- package/Image/types.ts +9 -1
- package/Input/Input.tsx +2 -2
- package/Input/InputMoney.tsx +7 -2
- package/Input/InputMoneyView.tsx +2 -2
- package/Input/InputOTP.tsx +2 -2
- package/Input/InputPhoneNumber.tsx +40 -22
- package/Input/InputSearch.tsx +2 -2
- package/Input/InputTextArea.tsx +2 -2
- package/Input/SearchTextTyping.tsx +2 -2
- package/Input/SystemTextInput.tsx +2 -1
- package/Input/TextTyping.tsx +7 -2
- package/Input/index.tsx +1 -14
- package/Layout/Screen.tsx +5 -11
- package/Layout/Section.tsx +3 -14
- package/Layout/screenFooter.tsx +21 -181
- package/Layout/screenHeader.tsx +41 -56
- package/Layout/screenTypes.ts +1 -16
- package/Layout/styles.ts +0 -10
- package/Layout/types.ts +0 -6
- package/Pagination/types.ts +6 -2
- package/package.json +28 -26
- package/Application/BottomTab/Legacy/BottomTabBar.styles.ts +0 -60
- package/Application/BottomTab/Legacy/BottomTabBar.tsx +0 -270
- package/Application/BottomTab/Legacy/CustomBottomTabItem.tsx +0 -153
- package/Application/BottomTab/Legacy/DuoBarCompression.tsx +0 -135
- package/Application/BottomTab/Legacy/DuoRailTabBar.tsx +0 -149
- package/Application/BottomTab/Legacy/DuoTabBar.parts.tsx +0 -202
- package/Application/BottomTab/Legacy/DuoTabBar.styles.ts +0 -123
- package/Application/BottomTab/Legacy/DuoTabBar.tsx +0 -151
- package/Application/BottomTab/Legacy/TabBarIcon.tsx +0 -113
- package/Application/BottomTab/Legacy/TabScreen.tsx +0 -177
- package/Application/BottomTab/Legacy/badge.ts +0 -41
- package/Application/BottomTab/Legacy/hooks.ts +0 -358
- package/Application/BottomTab/Legacy/index.styles.ts +0 -30
- package/Application/BottomTab/Legacy/index.tsx +0 -230
- package/Application/Components/useHeaderRightWidth.ts +0 -46
- package/Input/CountryCodeView.tsx +0 -93
- package/Layout/__tests__/screenFooter.test.ts +0 -56
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
3
|
-
import { Colors, Spacing, Styles } from '../Consts';
|
|
4
|
-
import { Image } from '../Image';
|
|
5
|
-
import { Text } from '../Text';
|
|
6
|
-
import { Typography } from '../Text/types';
|
|
7
|
-
import styles from './styles';
|
|
8
|
-
|
|
9
|
-
const FLAG_SIZE = 24;
|
|
10
|
-
|
|
11
|
-
type CountryCodeViewProps = {
|
|
12
|
-
countryCode: string;
|
|
13
|
-
countryFlag: string;
|
|
14
|
-
typography: Typography;
|
|
15
|
-
textColor: string;
|
|
16
|
-
dividerHeight: number;
|
|
17
|
-
componentId: string;
|
|
18
|
-
isDisabled: boolean;
|
|
19
|
-
onPress?: () => void;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Flag, dial code and divider ahead of a phone number. Only becomes a button
|
|
24
|
-
* when `onPress` is given, so the default render stays a plain view.
|
|
25
|
-
*/
|
|
26
|
-
const CountryCodeView: React.FC<CountryCodeViewProps> = ({
|
|
27
|
-
countryCode,
|
|
28
|
-
countryFlag,
|
|
29
|
-
typography,
|
|
30
|
-
textColor,
|
|
31
|
-
dividerHeight,
|
|
32
|
-
componentId,
|
|
33
|
-
isDisabled,
|
|
34
|
-
onPress,
|
|
35
|
-
}) => {
|
|
36
|
-
const content = (
|
|
37
|
-
<>
|
|
38
|
-
<Image
|
|
39
|
-
source={{ uri: countryFlag }}
|
|
40
|
-
style={innerStyle.iconFlag}
|
|
41
|
-
resizeMode="contain"
|
|
42
|
-
accessibilityLabel={`${componentId}|leading-icon`}
|
|
43
|
-
/>
|
|
44
|
-
<View style={{ width: Spacing.XS }} />
|
|
45
|
-
<Text typography={typography} color={textColor}>
|
|
46
|
-
{countryCode}
|
|
47
|
-
</Text>
|
|
48
|
-
</>
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const renderContent = () => {
|
|
52
|
-
if (!onPress) {
|
|
53
|
-
return content;
|
|
54
|
-
}
|
|
55
|
-
return (
|
|
56
|
-
<TouchableOpacity
|
|
57
|
-
style={Styles.row}
|
|
58
|
-
onPress={onPress}
|
|
59
|
-
disabled={isDisabled}
|
|
60
|
-
accessibilityRole="button"
|
|
61
|
-
accessibilityLabel={`${componentId}|leading-icon-touch|${countryCode}`}
|
|
62
|
-
accessibilityState={{ disabled: isDisabled }}
|
|
63
|
-
>
|
|
64
|
-
{content}
|
|
65
|
-
</TouchableOpacity>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
return (
|
|
70
|
-
<View style={[styles.leadingIconContainer, Styles.row]}>
|
|
71
|
-
{renderContent()}
|
|
72
|
-
<View
|
|
73
|
-
style={[
|
|
74
|
-
styles.phoneNumberDivider,
|
|
75
|
-
{
|
|
76
|
-
height: dividerHeight,
|
|
77
|
-
backgroundColor: Colors.black_04,
|
|
78
|
-
},
|
|
79
|
-
]}
|
|
80
|
-
/>
|
|
81
|
-
</View>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const innerStyle = StyleSheet.create({
|
|
86
|
-
iconFlag: {
|
|
87
|
-
width: FLAG_SIZE,
|
|
88
|
-
height: FLAG_SIZE,
|
|
89
|
-
marginHorizontal: Spacing.XXS,
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
export { CountryCodeView };
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { getFooterGeometry, getFooterStyle } from '../screenFooter';
|
|
2
|
-
|
|
3
|
-
// the grid row pulls in every foundation component; geometry does not render
|
|
4
|
-
jest.mock('../Section', () => ({ __esModule: true, default: () => null }));
|
|
5
|
-
|
|
6
|
-
const PHONE = { width: 390, height: 844, contentWidth: 390 };
|
|
7
|
-
const FOLD_PORTRAIT = { width: 760, height: 900, contentWidth: 760 };
|
|
8
|
-
const FOLD_LANDSCAPE = { width: 860, height: 700, contentWidth: 860 };
|
|
9
|
-
const TABLET = { width: 1194, height: 834, contentWidth: 1194 };
|
|
10
|
-
const ANCHORED = {
|
|
11
|
-
footerStyle: 'anchored' as const,
|
|
12
|
-
hasImageBackground: false,
|
|
13
|
-
};
|
|
14
|
-
const SHEET = { footerStyle: 'sheet' as const, hasImageBackground: false };
|
|
15
|
-
|
|
16
|
-
describe('getFooterGeometry', () => {
|
|
17
|
-
it('keeps the phone footer below 600pt, landscape included', () => {
|
|
18
|
-
expect(getFooterGeometry({ ...PHONE, ...SHEET }).kind).toBe('phone');
|
|
19
|
-
const landscape = { width: 844, height: 390, contentWidth: 844 };
|
|
20
|
-
expect(getFooterGeometry({ ...landscape, ...SHEET }).kind).toBe('phone');
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('caps the width at 600pt below an 800pt window, 800pt from it', () => {
|
|
24
|
-
expect(getFooterGeometry({ ...FOLD_PORTRAIT, ...ANCHORED })).toEqual({
|
|
25
|
-
kind: 'anchored',
|
|
26
|
-
width: 600,
|
|
27
|
-
});
|
|
28
|
-
expect(getFooterGeometry({ ...FOLD_LANDSCAPE, ...SHEET })).toEqual({
|
|
29
|
-
kind: 'sheet',
|
|
30
|
-
width: 800,
|
|
31
|
-
});
|
|
32
|
-
expect(getFooterGeometry({ ...TABLET, ...SHEET }).width).toBe(800);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('keeps the width inside the content area minus its margins', () => {
|
|
36
|
-
const duoInner = { width: 669, height: 900, contentWidth: 585 };
|
|
37
|
-
expect(getFooterGeometry({ ...duoInner, ...ANCHORED }).width).toBe(561);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('drops the sheet for an image background', () => {
|
|
41
|
-
const input = { ...FOLD_LANDSCAPE, ...SHEET, hasImageBackground: true };
|
|
42
|
-
expect(getFooterGeometry(input).kind).toBe('anchored');
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
describe('getFooterStyle', () => {
|
|
47
|
-
it('lets the screen prop win over the host config', () => {
|
|
48
|
-
expect(getFooterStyle('anchored', 'sheet')).toBe('anchored');
|
|
49
|
-
expect(getFooterStyle(undefined, 'sheet')).toBe('sheet');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('falls back to anchored for a missing or unknown value', () => {
|
|
53
|
-
expect(getFooterStyle()).toBe('anchored');
|
|
54
|
-
expect(getFooterStyle(undefined, 'floating')).toBe('anchored');
|
|
55
|
-
});
|
|
56
|
-
});
|