@hero-design/rn 7.10.2 → 7.11.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.
- package/.turbo/turbo-build.log +8 -8
- package/es/index.js +353 -79
- package/lib/assets/fonts/hero-icons.ttf +0 -0
- package/lib/index.js +352 -77
- package/package.json +2 -2
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +4 -0
- package/src/components/FAB/ActionGroup/index.tsx +16 -5
- package/src/components/PinInput/PinCell.tsx +34 -0
- package/src/components/PinInput/StyledPinInput.tsx +88 -0
- package/src/components/PinInput/__tests__/PinCell.spec.tsx +48 -0
- package/src/components/PinInput/__tests__/StyledPinInput.spec.tsx +22 -0
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +186 -0
- package/src/components/PinInput/__tests__/__snapshots__/StyledPinInput.spec.tsx.snap +58 -0
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +1028 -0
- package/src/components/PinInput/__tests__/index.spec.tsx +91 -0
- package/src/components/PinInput/index.tsx +173 -0
- package/src/components/TextInput/__tests__/index.spec.tsx +15 -0
- package/src/components/TextInput/index.tsx +20 -16
- package/src/components/Typography/Text/StyledText.tsx +1 -1
- package/src/components/Typography/Text/__tests__/StyledText.spec.tsx +1 -0
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +22 -0
- package/src/components/Typography/Text/index.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +35 -0
- package/src/theme/components/pinInput.ts +45 -0
- package/src/theme/components/typography.ts +2 -0
- package/src/theme/global/colors.ts +1 -1
- package/src/theme/global/space.ts +10 -10
- package/src/theme/index.ts +6 -3
- package/types/components/Alert/StyledAlert.d.ts +0 -0
- package/types/components/Alert/__tests__/index.spec.d.ts +0 -0
- package/types/components/Alert/index.d.ts +0 -0
- package/types/components/Avatar/StyledAvatar.d.ts +0 -0
- package/types/components/Avatar/__tests__/StyledAvatar.spec.d.ts +0 -0
- package/types/components/Avatar/__tests__/index.spec.d.ts +0 -0
- package/types/components/Avatar/index.d.ts +0 -0
- package/types/components/Badge/Status.d.ts +0 -0
- package/types/components/Badge/StyledBadge.d.ts +0 -0
- package/types/components/Badge/__tests__/Badge.spec.d.ts +0 -0
- package/types/components/Badge/__tests__/Status.spec.d.ts +0 -0
- package/types/components/Badge/index.d.ts +0 -0
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
- package/types/components/BottomNavigation/__tests__/index.spec.d.ts +0 -0
- package/types/components/BottomNavigation/index.d.ts +0 -0
- package/types/components/BottomSheet/Footer.d.ts +0 -0
- package/types/components/BottomSheet/Header.d.ts +0 -0
- package/types/components/BottomSheet/StyledBottomSheet.d.ts +0 -0
- package/types/components/BottomSheet/__tests__/index.spec.d.ts +0 -0
- package/types/components/BottomSheet/index.d.ts +0 -0
- package/types/components/Button/Button.d.ts +0 -0
- package/types/components/Button/IconButton.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +0 -0
- package/types/components/Button/LoadingIndicator/index.d.ts +0 -0
- package/types/components/Button/StyledButton.d.ts +0 -0
- package/types/components/Button/UtilityButton/__tests__/index.spec.d.ts +0 -0
- package/types/components/Button/UtilityButton/index.d.ts +0 -0
- package/types/components/Button/UtilityButton/styled.d.ts +0 -0
- package/types/components/Button/__tests__/Button.spec.d.ts +0 -0
- package/types/components/Button/__tests__/IconButton.spec.d.ts +0 -0
- package/types/components/Button/__tests__/StyledButton.spec.d.ts +0 -0
- package/types/components/Button/index.d.ts +0 -0
- package/types/components/Card/DataCard/StyledDataCard.d.ts +0 -0
- package/types/components/Card/DataCard/__tests__/StyledDataCard.spec.d.ts +0 -0
- package/types/components/Card/DataCard/__tests__/index.spec.d.ts +0 -0
- package/types/components/Card/DataCard/index.d.ts +0 -0
- package/types/components/Card/StyledCard.d.ts +0 -0
- package/types/components/Card/__tests__/StyledCard.spec.d.ts +0 -0
- package/types/components/Card/__tests__/index.spec.d.ts +0 -0
- package/types/components/Card/index.d.ts +0 -0
- package/types/components/Checkbox/StyledCheckbox.d.ts +0 -0
- package/types/components/Checkbox/__tests__/StyledCheckbox.spec.d.ts +0 -0
- package/types/components/Checkbox/__tests__/index.spec.d.ts +0 -0
- package/types/components/Checkbox/index.d.ts +0 -0
- package/types/components/Collapse/StyledCollapse.d.ts +0 -0
- package/types/components/Collapse/__tests__/StyledCollapse.spec.d.ts +0 -0
- package/types/components/Collapse/__tests__/index.spec.d.ts +0 -0
- package/types/components/Collapse/index.d.ts +0 -0
- package/types/components/ContentNavigator/StyledContentNavigator.d.ts +0 -0
- package/types/components/ContentNavigator/__tests__/StyledContentNavigator.spec.d.ts +0 -0
- package/types/components/ContentNavigator/__tests__/index.spec.d.ts +0 -0
- package/types/components/ContentNavigator/index.d.ts +0 -0
- package/types/components/Divider/StyledDivider.d.ts +0 -0
- package/types/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -0
- package/types/components/Divider/index.d.ts +0 -0
- package/types/components/Drawer/StyledDrawer.d.ts +0 -0
- package/types/components/Drawer/__tests__/index.spec.d.ts +0 -0
- package/types/components/Drawer/index.d.ts +0 -0
- package/types/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
- package/types/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
- package/types/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
- package/types/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -0
- package/types/components/FAB/ActionGroup/index.d.ts +0 -0
- package/types/components/FAB/AnimatedFABIcon.d.ts +0 -0
- package/types/components/FAB/FAB.d.ts +0 -0
- package/types/components/FAB/StyledFAB.d.ts +0 -0
- package/types/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -0
- package/types/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -0
- package/types/components/FAB/__tests__/index.spec.d.ts +0 -0
- package/types/components/FAB/index.d.ts +0 -0
- package/types/components/Icon/HeroIcon/index.d.ts +0 -0
- package/types/components/Icon/IconList.d.ts +0 -0
- package/types/components/Icon/__tests__/index.spec.d.ts +0 -0
- package/types/components/Icon/index.d.ts +0 -0
- package/types/components/Icon/utils.d.ts +0 -0
- package/types/components/List/BasicListItem.d.ts +0 -0
- package/types/components/List/ListItem.d.ts +0 -0
- package/types/components/List/StyledBasicListItem.d.ts +0 -0
- package/types/components/List/StyledListItem.d.ts +0 -0
- package/types/components/List/__tests__/BasicListItem.spec.d.ts +0 -0
- package/types/components/List/__tests__/ListItem.spec.d.ts +0 -0
- package/types/components/List/__tests__/StyledBasicListItem.spec.d.ts +0 -0
- package/types/components/List/__tests__/StyledListItem.spec.d.ts +0 -0
- package/types/components/List/index.d.ts +0 -0
- package/types/components/PinInput/PinCell.d.ts +8 -0
- package/types/components/PinInput/StyledPinInput.d.ts +73 -0
- package/types/components/PinInput/__tests__/PinCell.spec.d.ts +1 -0
- package/types/components/PinInput/__tests__/StyledPinInput.spec.d.ts +1 -0
- package/types/components/PinInput/__tests__/index.spec.d.ts +1 -0
- package/types/components/PinInput/index.d.ts +48 -0
- package/types/components/Progress/ProgressBar.d.ts +0 -0
- package/types/components/Progress/ProgressCircle.d.ts +0 -0
- package/types/components/Progress/StyledProgressBar.d.ts +0 -0
- package/types/components/Progress/StyledProgressCircle.d.ts +0 -0
- package/types/components/Progress/__tests__/index.spec.d.ts +0 -0
- package/types/components/Progress/index.d.ts +0 -0
- package/types/components/Progress/types.d.ts +0 -0
- package/types/components/Radio/Radio.d.ts +0 -0
- package/types/components/Radio/RadioGroup.d.ts +0 -0
- package/types/components/Radio/StyledRadio.d.ts +0 -0
- package/types/components/Radio/__tests__/Radio.spec.d.ts +0 -0
- package/types/components/Radio/__tests__/RadioGroup.spec.d.ts +0 -0
- package/types/components/Radio/__tests__/StyledRadio.spec.d.ts +0 -0
- package/types/components/Radio/index.d.ts +0 -0
- package/types/components/Radio/types.d.ts +0 -0
- package/types/components/SectionHeading/StyledHeading.d.ts +0 -0
- package/types/components/SectionHeading/__tests__/StyledHeading.spec.d.ts +0 -0
- package/types/components/SectionHeading/__tests__/index.spec.d.ts +0 -0
- package/types/components/SectionHeading/index.d.ts +0 -0
- package/types/components/Select/Footer.d.ts +0 -0
- package/types/components/Select/MultiSelect/Option.d.ts +0 -0
- package/types/components/Select/MultiSelect/OptionList.d.ts +0 -0
- package/types/components/Select/MultiSelect/__tests__/Option.spec.d.ts +0 -0
- package/types/components/Select/MultiSelect/__tests__/OptionList.spec.d.ts +0 -0
- package/types/components/Select/MultiSelect/__tests__/index.spec.d.ts +0 -0
- package/types/components/Select/MultiSelect/index.d.ts +0 -0
- package/types/components/Select/SingleSelect/Option.d.ts +0 -0
- package/types/components/Select/SingleSelect/OptionList.d.ts +0 -0
- package/types/components/Select/SingleSelect/__tests__/Option.spec.d.ts +0 -0
- package/types/components/Select/SingleSelect/__tests__/OptionList.spec.d.ts +0 -0
- package/types/components/Select/SingleSelect/__tests__/index.spec.d.ts +0 -0
- package/types/components/Select/SingleSelect/index.d.ts +0 -0
- package/types/components/Select/StyledSelect.d.ts +0 -0
- package/types/components/Select/__tests__/StyledSelect.spec.d.ts +0 -0
- package/types/components/Select/helpers.d.ts +0 -0
- package/types/components/Select/index.d.ts +0 -0
- package/types/components/Select/types.d.ts +0 -0
- package/types/components/Spinner/AnimatedSpinner.d.ts +0 -0
- package/types/components/Spinner/StyledSpinner.d.ts +0 -0
- package/types/components/Spinner/__tests__/AnimatedSpinner.spec.d.ts +0 -0
- package/types/components/Spinner/__tests__/StyledSpinner.spec.d.ts +0 -0
- package/types/components/Spinner/__tests__/index.spec.d.ts +0 -0
- package/types/components/Spinner/index.d.ts +0 -0
- package/types/components/Switch/StyledSwitch.d.ts +0 -0
- package/types/components/Switch/__tests__/StyledHeading.spec.d.ts +0 -0
- package/types/components/Switch/__tests__/index.spec.d.ts +0 -0
- package/types/components/Switch/index.d.ts +0 -0
- package/types/components/Tabs/ActiveTabIndicator.d.ts +0 -0
- package/types/components/Tabs/ScrollableTabs.d.ts +0 -0
- package/types/components/Tabs/StyledScrollableTabs.d.ts +0 -0
- package/types/components/Tabs/StyledTabs.d.ts +0 -0
- package/types/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +0 -0
- package/types/components/Tabs/__tests__/index.spec.d.ts +0 -0
- package/types/components/Tabs/index.d.ts +0 -0
- package/types/components/Tabs/utils.d.ts +0 -0
- package/types/components/Tag/StyledTag.d.ts +0 -0
- package/types/components/Tag/__tests__/Tag.spec.d.ts +0 -0
- package/types/components/Tag/index.d.ts +0 -0
- package/types/components/TextInput/StyledTextInput.d.ts +0 -0
- package/types/components/TextInput/__tests__/StyledTextInput.spec.d.ts +0 -0
- package/types/components/TextInput/__tests__/index.spec.d.ts +0 -0
- package/types/components/TextInput/index.d.ts +0 -0
- package/types/components/Toast/StyledToast.d.ts +0 -0
- package/types/components/Toast/Toast.d.ts +0 -0
- package/types/components/Toast/ToastContainer.d.ts +0 -0
- package/types/components/Toast/ToastContext.d.ts +0 -0
- package/types/components/Toast/ToastProvider.d.ts +0 -0
- package/types/components/Toast/__tests__/Toast.spec.d.ts +0 -0
- package/types/components/Toast/__tests__/ToastContainer.spec.d.ts +0 -0
- package/types/components/Toast/index.d.ts +0 -0
- package/types/components/Toast/types.d.ts +0 -0
- package/types/components/Toolbar/StyledToolbar.d.ts +0 -0
- package/types/components/Toolbar/ToolbarGroup.d.ts +0 -0
- package/types/components/Toolbar/ToolbarItem.d.ts +0 -0
- package/types/components/Toolbar/__tests__/ToolbarGroup.spec.d.ts +0 -0
- package/types/components/Toolbar/__tests__/ToolbarItem.spec.d.ts +0 -0
- package/types/components/Toolbar/index.d.ts +0 -0
- package/types/components/Typography/Text/StyledText.d.ts +1 -1
- package/types/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -0
- package/types/components/Typography/Text/__tests__/index.spec.d.ts +0 -0
- package/types/components/Typography/Text/index.d.ts +1 -1
- package/types/components/Typography/index.d.ts +0 -0
- package/types/index.d.ts +2 -1
- package/types/testHelpers/renderWithTheme.d.ts +0 -0
- package/types/theme/__tests__/index.spec.d.ts +0 -0
- package/types/theme/components/alert.d.ts +0 -0
- package/types/theme/components/avatar.d.ts +0 -0
- package/types/theme/components/badge.d.ts +0 -0
- package/types/theme/components/bottomNavigation.d.ts +0 -0
- package/types/theme/components/bottomSheet.d.ts +0 -0
- package/types/theme/components/button.d.ts +0 -0
- package/types/theme/components/card.d.ts +0 -0
- package/types/theme/components/checkbox.d.ts +0 -0
- package/types/theme/components/contentNavigator.d.ts +0 -0
- package/types/theme/components/divider.d.ts +0 -0
- package/types/theme/components/drawer.d.ts +0 -0
- package/types/theme/components/fab.d.ts +0 -0
- package/types/theme/components/icon.d.ts +0 -0
- package/types/theme/components/list.d.ts +0 -0
- package/types/theme/components/pinInput.d.ts +35 -0
- package/types/theme/components/progress.d.ts +0 -0
- package/types/theme/components/radio.d.ts +0 -0
- package/types/theme/components/sectionHeading.d.ts +0 -0
- package/types/theme/components/select.d.ts +0 -0
- package/types/theme/components/spinner.d.ts +0 -0
- package/types/theme/components/switch.d.ts +0 -0
- package/types/theme/components/tabs.d.ts +0 -0
- package/types/theme/components/tag.d.ts +0 -0
- package/types/theme/components/textInput.d.ts +0 -0
- package/types/theme/components/toast.d.ts +0 -0
- package/types/theme/components/toolbar.d.ts +0 -0
- package/types/theme/components/typography.d.ts +2 -0
- package/types/theme/global/borders.d.ts +0 -0
- package/types/theme/global/colors.d.ts +0 -0
- package/types/theme/global/index.d.ts +0 -0
- package/types/theme/global/scale.d.ts +0 -0
- package/types/theme/global/space.d.ts +0 -0
- package/types/theme/global/typography.d.ts +0 -0
- package/types/theme/index.d.ts +4 -2
- package/types/types.d.ts +0 -0
- package/types/utils/__tests__/scale.spec.d.ts +0 -0
- package/types/utils/helpers.d.ts +0 -0
- package/types/utils/hooks.d.ts +0 -0
- package/types/utils/scale.d.ts +0 -0
- package/src/components/TextInput/__tests__/.log/ti-10343.log +0 -62
- package/src/components/TextInput/__tests__/.log/tsserver.log +0 -15584
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import styled from '@emotion/native';
|
|
2
|
+
import { Text, TextInput, View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export const StyledWrapper = styled(View)(() => ({
|
|
5
|
+
alignContent: 'flex-start',
|
|
6
|
+
}));
|
|
7
|
+
|
|
8
|
+
export const StyledPinWrapper = styled(View)(() => ({
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
}));
|
|
11
|
+
|
|
12
|
+
export type State = 'default' | 'disabled' | 'error';
|
|
13
|
+
|
|
14
|
+
export const StyledCell = styled(View)<{
|
|
15
|
+
themeFocused: boolean;
|
|
16
|
+
themeState: State;
|
|
17
|
+
}>(({ theme, themeFocused, themeState }) => ({
|
|
18
|
+
justifyContent: 'center',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
width: theme.__hd__.pinInput.sizes.cellWidth,
|
|
21
|
+
height: theme.__hd__.pinInput.sizes.cellHeight,
|
|
22
|
+
borderWidth: themeFocused
|
|
23
|
+
? theme.__hd__.pinInput.borderWidths.focused
|
|
24
|
+
: theme.__hd__.pinInput.borderWidths.default,
|
|
25
|
+
borderRadius: theme.__hd__.pinInput.radii.cell,
|
|
26
|
+
borderColor: theme.__hd__.pinInput.colors[themeState],
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
export const StyledCellText = styled(Text)<{
|
|
30
|
+
themeState: State;
|
|
31
|
+
}>(({ theme, themeState }) => ({
|
|
32
|
+
fontFamily: theme.__hd__.pinInput.fonts.cellText,
|
|
33
|
+
fontSize: theme.__hd__.pinInput.fontSizes.cellText,
|
|
34
|
+
color: theme.__hd__.pinInput.colors[themeState],
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
export const StyledSpacer = styled(View)(({ theme }) => ({
|
|
38
|
+
marginLeft: theme.__hd__.pinInput.space.spacer,
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
export const StyledMask = styled(View)<{
|
|
42
|
+
themeState: State;
|
|
43
|
+
}>(({ theme, themeState }) => ({
|
|
44
|
+
width: theme.__hd__.pinInput.sizes.mask,
|
|
45
|
+
height: theme.__hd__.pinInput.sizes.mask,
|
|
46
|
+
borderWidth: theme.__hd__.pinInput.borderWidths.default,
|
|
47
|
+
borderRadius: theme.__hd__.pinInput.radii.mask,
|
|
48
|
+
borderColor: theme.__hd__.pinInput.colors[themeState],
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
export const StyledFilledMask = styled(View)<{
|
|
52
|
+
themeState: State;
|
|
53
|
+
}>(({ theme, themeState }) => ({
|
|
54
|
+
width: theme.__hd__.pinInput.sizes.mask,
|
|
55
|
+
height: theme.__hd__.pinInput.sizes.mask,
|
|
56
|
+
borderWidth: theme.__hd__.pinInput.borderWidths.default,
|
|
57
|
+
borderRadius: theme.__hd__.pinInput.radii.mask,
|
|
58
|
+
borderColor: theme.__hd__.pinInput.colors[themeState],
|
|
59
|
+
backgroundColor: theme.__hd__.pinInput.colors[themeState],
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
export const StyledHiddenInput = styled(TextInput)<{ themePinLength: number }>(
|
|
63
|
+
({ themePinLength, theme }) => {
|
|
64
|
+
const { cellWidth } = theme.__hd__.pinInput.sizes;
|
|
65
|
+
const spacerWidth = theme.__hd__.pinInput.space.spacer;
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
opacity: 0,
|
|
70
|
+
left: 0,
|
|
71
|
+
top: 0,
|
|
72
|
+
width: themePinLength * cellWidth + (themePinLength - 1) * spacerWidth,
|
|
73
|
+
height: '100%',
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export const StyledErrorContainer = styled(View)(({ theme }) => ({
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
paddingTop: theme.__hd__.pinInput.space.errorMessagePadding,
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
export const StyledErrorMessage = styled(Text)(({ theme }) => ({
|
|
84
|
+
fontFamily: theme.__hd__.pinInput.fonts.errorMessage,
|
|
85
|
+
fontSize: theme.__hd__.pinInput.fontSizes.errorMessage,
|
|
86
|
+
color: theme.__hd__.pinInput.colors.error,
|
|
87
|
+
paddingLeft: theme.__hd__.pinInput.space.errorMessagePadding,
|
|
88
|
+
}));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
|
+
import PinCell from '../PinCell';
|
|
4
|
+
|
|
5
|
+
describe('PinCell', () => {
|
|
6
|
+
it('renders mask when value is an empty string', () => {
|
|
7
|
+
const { getByTestId } = renderWithTheme(<PinCell value="" />);
|
|
8
|
+
|
|
9
|
+
expect(getByTestId('pin-cell-mask')).toBeDefined();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('renders text when secure is false', () => {
|
|
13
|
+
const { queryAllByText } = renderWithTheme(
|
|
14
|
+
<PinCell value="1" secure={false} />
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
expect(queryAllByText('1')).toHaveLength(1);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('renders filled mask when secure is true', () => {
|
|
21
|
+
const { getByTestId, queryAllByText } = renderWithTheme(
|
|
22
|
+
<PinCell value="1" secure />
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(queryAllByText('1')).toHaveLength(0);
|
|
26
|
+
expect(getByTestId('pin-cell-filled-mask')).toBeDefined();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// this covers tests for Styled-Components in PinCell
|
|
30
|
+
// including StyledCell, StyledMask, StyledCellText, StyledFilledMask
|
|
31
|
+
it.each`
|
|
32
|
+
focused | state
|
|
33
|
+
${true} | ${'default'}
|
|
34
|
+
${true} | ${'error'}
|
|
35
|
+
${false} | ${'default'}
|
|
36
|
+
${false} | ${'disabled'}
|
|
37
|
+
${false} | ${'error'}
|
|
38
|
+
`(
|
|
39
|
+
'renders correctly when focused is $focused, state is $state',
|
|
40
|
+
({ focused, state }) => {
|
|
41
|
+
const { toJSON } = renderWithTheme(
|
|
42
|
+
<PinCell value="1" secure={false} focused={focused} state={state} />
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
expect(toJSON()).toMatchSnapshot();
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
3
|
+
import { StyledHiddenInput } from '../StyledPinInput';
|
|
4
|
+
|
|
5
|
+
describe('StyledHiddenInput', () => {
|
|
6
|
+
it.each`
|
|
7
|
+
themePinLength | width
|
|
8
|
+
${4} | ${208}
|
|
9
|
+
${6} | ${320}
|
|
10
|
+
${8} | ${432}
|
|
11
|
+
`(
|
|
12
|
+
'has correct width when pin length is $themePinLength',
|
|
13
|
+
({ themePinLength, width }) => {
|
|
14
|
+
const wrapper = renderWithTheme(
|
|
15
|
+
<StyledHiddenInput themePinLength={themePinLength} />
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
expect(wrapper.toJSON()).toHaveStyle({ width });
|
|
19
|
+
expect(wrapper.toJSON()).toMatchSnapshot();
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
});
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`PinCell renders correctly when focused is false, state is default 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"alignItems": "center",
|
|
9
|
+
"borderColor": "#292a2b",
|
|
10
|
+
"borderRadius": 8,
|
|
11
|
+
"borderWidth": 1,
|
|
12
|
+
"height": 48,
|
|
13
|
+
"justifyContent": "center",
|
|
14
|
+
"width": 40,
|
|
15
|
+
},
|
|
16
|
+
undefined,
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
themeFocused={false}
|
|
20
|
+
themeState="default"
|
|
21
|
+
>
|
|
22
|
+
<Text
|
|
23
|
+
style={
|
|
24
|
+
Array [
|
|
25
|
+
Object {
|
|
26
|
+
"color": "#292a2b",
|
|
27
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
28
|
+
"fontSize": 28,
|
|
29
|
+
},
|
|
30
|
+
undefined,
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
themeState="default"
|
|
34
|
+
>
|
|
35
|
+
1
|
|
36
|
+
</Text>
|
|
37
|
+
</View>
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
exports[`PinCell renders correctly when focused is false, state is disabled 1`] = `
|
|
41
|
+
<View
|
|
42
|
+
style={
|
|
43
|
+
Array [
|
|
44
|
+
Object {
|
|
45
|
+
"alignItems": "center",
|
|
46
|
+
"borderColor": "#bfc1c5",
|
|
47
|
+
"borderRadius": 8,
|
|
48
|
+
"borderWidth": 1,
|
|
49
|
+
"height": 48,
|
|
50
|
+
"justifyContent": "center",
|
|
51
|
+
"width": 40,
|
|
52
|
+
},
|
|
53
|
+
undefined,
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
themeFocused={false}
|
|
57
|
+
themeState="disabled"
|
|
58
|
+
>
|
|
59
|
+
<Text
|
|
60
|
+
style={
|
|
61
|
+
Array [
|
|
62
|
+
Object {
|
|
63
|
+
"color": "#bfc1c5",
|
|
64
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
65
|
+
"fontSize": 28,
|
|
66
|
+
},
|
|
67
|
+
undefined,
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
themeState="disabled"
|
|
71
|
+
>
|
|
72
|
+
1
|
|
73
|
+
</Text>
|
|
74
|
+
</View>
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
exports[`PinCell renders correctly when focused is false, state is error 1`] = `
|
|
78
|
+
<View
|
|
79
|
+
style={
|
|
80
|
+
Array [
|
|
81
|
+
Object {
|
|
82
|
+
"alignItems": "center",
|
|
83
|
+
"borderColor": "#de350b",
|
|
84
|
+
"borderRadius": 8,
|
|
85
|
+
"borderWidth": 1,
|
|
86
|
+
"height": 48,
|
|
87
|
+
"justifyContent": "center",
|
|
88
|
+
"width": 40,
|
|
89
|
+
},
|
|
90
|
+
undefined,
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
themeFocused={false}
|
|
94
|
+
themeState="error"
|
|
95
|
+
>
|
|
96
|
+
<Text
|
|
97
|
+
style={
|
|
98
|
+
Array [
|
|
99
|
+
Object {
|
|
100
|
+
"color": "#de350b",
|
|
101
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
102
|
+
"fontSize": 28,
|
|
103
|
+
},
|
|
104
|
+
undefined,
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
themeState="error"
|
|
108
|
+
>
|
|
109
|
+
1
|
|
110
|
+
</Text>
|
|
111
|
+
</View>
|
|
112
|
+
`;
|
|
113
|
+
|
|
114
|
+
exports[`PinCell renders correctly when focused is true, state is default 1`] = `
|
|
115
|
+
<View
|
|
116
|
+
style={
|
|
117
|
+
Array [
|
|
118
|
+
Object {
|
|
119
|
+
"alignItems": "center",
|
|
120
|
+
"borderColor": "#292a2b",
|
|
121
|
+
"borderRadius": 8,
|
|
122
|
+
"borderWidth": 2,
|
|
123
|
+
"height": 48,
|
|
124
|
+
"justifyContent": "center",
|
|
125
|
+
"width": 40,
|
|
126
|
+
},
|
|
127
|
+
undefined,
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
themeFocused={true}
|
|
131
|
+
themeState="default"
|
|
132
|
+
>
|
|
133
|
+
<Text
|
|
134
|
+
style={
|
|
135
|
+
Array [
|
|
136
|
+
Object {
|
|
137
|
+
"color": "#292a2b",
|
|
138
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
139
|
+
"fontSize": 28,
|
|
140
|
+
},
|
|
141
|
+
undefined,
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
themeState="default"
|
|
145
|
+
>
|
|
146
|
+
1
|
|
147
|
+
</Text>
|
|
148
|
+
</View>
|
|
149
|
+
`;
|
|
150
|
+
|
|
151
|
+
exports[`PinCell renders correctly when focused is true, state is error 1`] = `
|
|
152
|
+
<View
|
|
153
|
+
style={
|
|
154
|
+
Array [
|
|
155
|
+
Object {
|
|
156
|
+
"alignItems": "center",
|
|
157
|
+
"borderColor": "#de350b",
|
|
158
|
+
"borderRadius": 8,
|
|
159
|
+
"borderWidth": 2,
|
|
160
|
+
"height": 48,
|
|
161
|
+
"justifyContent": "center",
|
|
162
|
+
"width": 40,
|
|
163
|
+
},
|
|
164
|
+
undefined,
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
themeFocused={true}
|
|
168
|
+
themeState="error"
|
|
169
|
+
>
|
|
170
|
+
<Text
|
|
171
|
+
style={
|
|
172
|
+
Array [
|
|
173
|
+
Object {
|
|
174
|
+
"color": "#de350b",
|
|
175
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
176
|
+
"fontSize": 28,
|
|
177
|
+
},
|
|
178
|
+
undefined,
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
themeState="error"
|
|
182
|
+
>
|
|
183
|
+
1
|
|
184
|
+
</Text>
|
|
185
|
+
</View>
|
|
186
|
+
`;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`StyledHiddenInput has correct width when pin length is 4 1`] = `
|
|
4
|
+
<TextInput
|
|
5
|
+
style={
|
|
6
|
+
Array [
|
|
7
|
+
Object {
|
|
8
|
+
"height": "100%",
|
|
9
|
+
"left": 0,
|
|
10
|
+
"opacity": 0,
|
|
11
|
+
"position": "absolute",
|
|
12
|
+
"top": 0,
|
|
13
|
+
"width": 208,
|
|
14
|
+
},
|
|
15
|
+
undefined,
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
themePinLength={4}
|
|
19
|
+
/>
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
exports[`StyledHiddenInput has correct width when pin length is 6 1`] = `
|
|
23
|
+
<TextInput
|
|
24
|
+
style={
|
|
25
|
+
Array [
|
|
26
|
+
Object {
|
|
27
|
+
"height": "100%",
|
|
28
|
+
"left": 0,
|
|
29
|
+
"opacity": 0,
|
|
30
|
+
"position": "absolute",
|
|
31
|
+
"top": 0,
|
|
32
|
+
"width": 320,
|
|
33
|
+
},
|
|
34
|
+
undefined,
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
themePinLength={6}
|
|
38
|
+
/>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`StyledHiddenInput has correct width when pin length is 8 1`] = `
|
|
42
|
+
<TextInput
|
|
43
|
+
style={
|
|
44
|
+
Array [
|
|
45
|
+
Object {
|
|
46
|
+
"height": "100%",
|
|
47
|
+
"left": 0,
|
|
48
|
+
"opacity": 0,
|
|
49
|
+
"position": "absolute",
|
|
50
|
+
"top": 0,
|
|
51
|
+
"width": 432,
|
|
52
|
+
},
|
|
53
|
+
undefined,
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
themePinLength={8}
|
|
57
|
+
/>
|
|
58
|
+
`;
|