@ovotech/element-native 5.5.0 → 5.6.0
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/dist/components/Accordion/styles.d.ts +9 -0
- package/dist/components/ActionList/Action.d.ts +23 -0
- package/dist/components/ActionList/Action.js +29 -0
- package/dist/components/ActionList/ActionList.d.ts +11 -27
- package/dist/components/ActionList/ActionList.js +9 -25
- package/dist/components/ActionList/ActionListItems/DataListItem.d.ts +23 -0
- package/dist/components/ActionList/ActionListItems/DataListItem.js +21 -0
- package/dist/components/ActionList/ActionListItems/EditableListItem.d.ts +43 -0
- package/dist/components/ActionList/ActionListItems/EditableListItem.js +134 -0
- package/dist/components/ActionList/ActionListItems/NavigationListItem.d.ts +16 -0
- package/dist/components/ActionList/ActionListItems/NavigationListItem.js +30 -0
- package/dist/components/ActionList/ActionListItems/ProgressRing.d.ts +7 -0
- package/dist/components/ActionList/ActionListItems/ProgressRing.js +66 -0
- package/dist/components/ActionList/ActionListItems/ToggleListItem.d.ts +9 -0
- package/dist/components/ActionList/ActionListItems/ToggleListItem.js +13 -0
- package/dist/components/ActionList/ActionListItems/styles.d.ts +10433 -0
- package/dist/components/ActionList/ActionListItems/styles.js +171 -0
- package/dist/components/ActionList/components/ActionListHeading.d.ts +9 -0
- package/dist/components/ActionList/components/ActionListHeading.js +11 -0
- package/dist/components/ActionList/index.d.ts +6 -1
- package/dist/components/ActionList/index.js +11 -2
- package/dist/components/ActionList/styled.d.ts +1187 -7
- package/dist/components/ActionList/styled.js +24 -9
- package/dist/components/Badge/Badge.d.ts +3 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.styles.d.ts +12 -0
- package/dist/components/Card/Card.d.ts +7 -4
- package/dist/components/Card/Card.js +44 -22
- package/dist/components/Card/Card.styles.d.ts +11 -1
- package/dist/components/Card/Card.styles.js +7 -11
- package/dist/components/Cards/AccountCard/AccountCard.styles.d.ts +24 -0
- package/dist/components/Cards/BalanceCard/BalanceCard.styles.d.ts +46 -1
- package/dist/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.d.ts +13 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.js +45 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.d.ts +580 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +11 -0
- package/dist/components/Cards/DisruptiveCard/index.d.ts +1 -0
- package/dist/components/Cards/DisruptiveCard/index.js +17 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.d.ts +12 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.js +65 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.d.ts +1741 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.js +27 -0
- package/dist/components/Cards/HeroImageCard/index.d.ts +1 -0
- package/dist/components/Cards/HeroImageCard/index.js +17 -0
- package/dist/components/Cards/IconDataCard/IconDataCard.styles.d.ts +12 -0
- package/dist/components/Cards/IconTextCard/IconTextCard.js +3 -16
- package/dist/components/Cards/IconTextCard/IconTextCard.styles.d.ts +10 -576
- package/dist/components/Cards/IconTextCard/IconTextCard.styles.js +1 -6
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.d.ts +14 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.js +26 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.d.ts +2903 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +34 -0
- package/dist/components/Cards/IllustrationTextCard/index.d.ts +1 -0
- package/dist/components/Cards/IllustrationTextCard/index.js +17 -0
- package/dist/components/Cards/LinkTextCard/LinkTextCard.d.ts +2 -2
- package/dist/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
- package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.d.ts +20 -2
- package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
- package/dist/components/Cards/ProgressBarCard/ProgressBarCard.styles.d.ts +28 -1
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.d.ts +12 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.js +27 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.d.ts +2897 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +31 -0
- package/dist/components/Cards/QuickLinkCard/index.d.ts +1 -0
- package/dist/components/Cards/QuickLinkCard/index.js +17 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.d.ts +12 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.js +24 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.d.ts +2902 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +38 -0
- package/dist/components/Cards/ServicesImageCard/index.d.ts +1 -0
- package/dist/components/Cards/ServicesImageCard/index.js +17 -0
- package/dist/components/Cards/components.d.ts +15 -0
- package/dist/components/Cards/components.js +24 -0
- package/dist/components/Cards/index.d.ts +5 -0
- package/dist/components/Cards/index.js +11 -1
- package/dist/components/Cards/shared.styles.d.ts +2835 -505
- package/dist/components/Cards/shared.styles.js +18 -2
- package/dist/components/Cards/utils.d.ts +1 -0
- package/dist/components/Cards/utils.js +13 -1
- package/dist/components/Checkbox/Checkbox.d.ts +2 -13
- package/dist/components/Checkbox/Checkbox.js +3 -49
- package/dist/components/Checkbox/styled.d.ts +3483 -0
- package/dist/components/Checkbox/styled.js +52 -0
- package/dist/components/Checkbox/types.d.ts +16 -0
- package/dist/components/Checkbox/types.js +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +2 -1
- package/dist/components/CurrencyInput/CurrencyInput.js +11 -4
- package/dist/components/CurrencyInput/styled.d.ts +2318 -0
- package/dist/components/CurrencyInput/styled.js +39 -0
- package/dist/components/DataTable/styles.d.ts +39 -0
- package/dist/components/Disclosure/Disclosure.d.ts +3 -0
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Divider/Divider.js +3 -1
- package/dist/components/Em/Em.d.ts +3 -0
- package/dist/components/EmailInput/EmailInput.d.ts +4 -1
- package/dist/components/EmailInput/EmailInput.js +18 -2
- package/dist/components/EmptyState/EmptyState.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.js +17 -0
- package/dist/components/EmptyState/EmptyState.test.d.ts +1 -0
- package/dist/components/EmptyState/EmptyState.test.js +92 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EmptyState/index.js +17 -0
- package/dist/components/EmptyState/styles.d.ts +1156 -0
- package/dist/components/EmptyState/styles.js +23 -0
- package/dist/components/EmptyState/types.d.ts +18 -0
- package/dist/components/EmptyState/types.js +2 -0
- package/dist/components/ErrorText/ErrorText.d.ts +3 -0
- package/dist/components/Field/Field.d.ts +3 -2
- package/dist/components/Field/Field.js +3 -2
- package/dist/components/Grid/Col.d.ts +3 -0
- package/dist/components/HintText/HintText.d.ts +3 -0
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Input/Input.js +6 -97
- package/dist/components/Input/styled.d.ts +1747 -0
- package/dist/components/Input/styled.js +96 -0
- package/dist/components/LabelText/LabelText.d.ts +3 -0
- package/dist/components/LargeValueReference/LargeValueReference.d.ts +11 -0
- package/dist/components/LargeValueReference/LargeValueReference.js +49 -0
- package/dist/components/LargeValueReference/index.d.ts +1 -0
- package/dist/components/LargeValueReference/index.js +17 -0
- package/dist/components/LargeValueReference/styles.d.ts +1741 -0
- package/dist/components/LargeValueReference/styles.js +29 -0
- package/dist/components/LineThrough/LineThrough.d.ts +3 -0
- package/dist/components/List/styled.d.ts +12 -0
- package/dist/components/Margin/Margin.d.ts +3 -0
- package/dist/components/NavHeader/NavHeader.styles.d.ts +33 -0
- package/dist/components/Notification/Notification.styles.d.ts +27 -0
- package/dist/components/PasswordInput/PasswordInput.styled.d.ts +4 -3
- package/dist/components/PasswordInput/PasswordInput.styled.js +5 -3
- package/dist/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
- package/dist/components/RadioCard/RadioCard.d.ts +2 -1
- package/dist/components/RadioCard/RadioCard.js +7 -57
- package/dist/components/RadioCard/RadioCard.styles.d.ts +2901 -0
- package/dist/components/RadioCard/RadioCard.styles.js +97 -0
- package/dist/components/SelectField/Select.d.ts +5 -579
- package/dist/components/SelectField/Select.js +7 -107
- package/dist/components/SelectField/SelectField.d.ts +2 -2
- package/dist/components/SelectField/SelectField.js +2 -2
- package/dist/components/SelectField/styled.d.ts +4642 -0
- package/dist/components/SelectField/styled.js +118 -0
- package/dist/components/SkeletonText/SkeletonText.js +4 -4
- package/dist/components/Strong/Strong.d.ts +3 -0
- package/dist/components/SubLabelText/SubLabelText.d.ts +3 -0
- package/dist/components/Tabs/Tab.d.ts +3 -0
- package/dist/components/TextareaInput/TextareaInput.js +12 -6
- package/dist/components/Toggle/Toggle.d.ts +3 -1
- package/dist/components/Toggle/Toggle.js +4 -6
- package/dist/components/Toggle/styles.d.ts +13 -0
- package/dist/components/Toggle/styles.js +3 -3
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +3 -0
- package/dist/esm/components/ActionList/Action.js +26 -0
- package/dist/esm/components/ActionList/ActionList.js +12 -28
- package/dist/esm/components/ActionList/ActionListItems/DataListItem.js +17 -0
- package/dist/esm/components/ActionList/ActionListItems/EditableListItem.js +131 -0
- package/dist/esm/components/ActionList/ActionListItems/NavigationListItem.js +26 -0
- package/dist/esm/components/ActionList/ActionListItems/ProgressRing.js +29 -0
- package/dist/esm/components/ActionList/ActionListItems/ToggleListItem.js +9 -0
- package/dist/esm/components/ActionList/ActionListItems/styles.js +135 -0
- package/dist/esm/components/ActionList/components/ActionListHeading.js +7 -0
- package/dist/esm/components/ActionList/index.js +6 -1
- package/dist/esm/components/ActionList/styled.js +23 -8
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Card/Card.js +45 -23
- package/dist/esm/components/Card/Card.styles.js +8 -12
- package/dist/esm/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
- package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.js +41 -0
- package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +5 -0
- package/dist/esm/components/Cards/DisruptiveCard/index.js +1 -0
- package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.js +28 -0
- package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.styles.js +21 -0
- package/dist/esm/components/Cards/HeroImageCard/index.js +1 -0
- package/dist/esm/components/Cards/IconTextCard/IconTextCard.js +5 -18
- package/dist/esm/components/Cards/IconTextCard/IconTextCard.styles.js +0 -5
- package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.js +22 -0
- package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +28 -0
- package/dist/esm/components/Cards/IllustrationTextCard/index.js +1 -0
- package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
- package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
- package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.js +23 -0
- package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +25 -0
- package/dist/esm/components/Cards/QuickLinkCard/index.js +1 -0
- package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.js +20 -0
- package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +32 -0
- package/dist/esm/components/Cards/ServicesImageCard/index.js +1 -0
- package/dist/esm/components/Cards/components.js +19 -0
- package/dist/esm/components/Cards/index.js +5 -0
- package/dist/esm/components/Cards/shared.styles.js +17 -1
- package/dist/esm/components/Cards/utils.js +11 -0
- package/dist/esm/components/Checkbox/Checkbox.js +2 -45
- package/dist/esm/components/Checkbox/styled.js +46 -0
- package/dist/esm/components/Checkbox/types.js +1 -0
- package/dist/esm/components/CurrencyInput/CurrencyInput.js +12 -5
- package/dist/esm/components/CurrencyInput/styled.js +33 -0
- package/dist/esm/components/Divider/Divider.js +3 -1
- package/dist/esm/components/EmailInput/EmailInput.js +18 -2
- package/dist/esm/components/EmptyState/EmptyState.js +13 -0
- package/dist/esm/components/EmptyState/EmptyState.test.js +90 -0
- package/dist/esm/components/EmptyState/index.js +1 -0
- package/dist/esm/components/EmptyState/styles.js +17 -0
- package/dist/esm/components/EmptyState/types.js +1 -0
- package/dist/esm/components/Field/Field.js +3 -2
- package/dist/esm/components/Input/Input.js +6 -64
- package/dist/esm/components/Input/styled.js +60 -0
- package/dist/esm/components/LargeValueReference/LargeValueReference.js +45 -0
- package/dist/esm/components/LargeValueReference/index.js +1 -0
- package/dist/esm/components/LargeValueReference/styles.js +23 -0
- package/dist/esm/components/PasswordInput/PasswordInput.styled.js +5 -3
- package/dist/esm/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
- package/dist/esm/components/RadioCard/RadioCard.js +5 -52
- package/dist/esm/components/RadioCard/RadioCard.styles.js +61 -0
- package/dist/esm/components/SelectField/Select.js +7 -74
- package/dist/esm/components/SelectField/SelectField.js +3 -3
- package/dist/esm/components/SelectField/styled.js +82 -0
- package/dist/esm/components/SkeletonText/SkeletonText.js +4 -4
- package/dist/esm/components/TextareaInput/TextareaInput.js +12 -6
- package/dist/esm/components/Toggle/Toggle.js +4 -6
- package/dist/esm/components/Toggle/styles.js +3 -3
- package/dist/esm/components/index.js +3 -0
- package/dist/esm/hooks/use-font-scaling.js +32 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/test/utils.js +12 -0
- package/dist/esm/utils/utils.js +12 -1
- package/dist/hooks/use-font-scaling.d.ts +26 -0
- package/dist/hooks/use-font-scaling.js +35 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/styled.native.d.ts +18 -0
- package/dist/test/utils.d.ts +4 -0
- package/dist/test/utils.js +28 -0
- package/dist/utils/utils.d.ts +11 -1
- package/dist/utils/utils.js +12 -0
- package/package.json +4 -4
- package/dist/components/ErrorWrapper/styles.d.ts +0 -0
- package/dist/components/ErrorWrapper/styles.js +0 -1
- package/dist/esm/components/ErrorWrapper/styles.js +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { StyleSheet } from 'react-native';
|
|
3
|
+
import Svg, { Defs, LinearGradient, Rect, Stop } from 'react-native-svg';
|
|
4
|
+
import { Stack } from '../..';
|
|
5
|
+
import { useBreakpoint } from '../../../hooks';
|
|
6
|
+
import { useTheme } from '../../../styled.native';
|
|
7
|
+
import { P } from '../../P';
|
|
8
|
+
import { ContainerWithCardBadge, ResponsiveHeading } from '../components';
|
|
9
|
+
import { TitleContainer } from '../shared.styles';
|
|
10
|
+
import { checkIsSmall } from '../utils';
|
|
11
|
+
import { CardWithHeroImage, OverlayContentContainer, OverlayWrapper, } from './HeroImageCard.styles';
|
|
12
|
+
const GradientBlock = ({ children }) => {
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const { largeAndUp } = useBreakpoint();
|
|
15
|
+
return (_jsxs(OverlayWrapper, { largeAndUp: largeAndUp, children: [_jsxs(Svg, { pointerEvents: "none", style: StyleSheet.absoluteFill, children: [_jsx(Defs, { children: _jsxs(LinearGradient, { id: "grad", x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx(Stop, { offset: "0", stopColor: theme.color.brand.fixed.dark, stopOpacity: 0 }), _jsx(Stop, { offset: "1", stopColor: theme.color.brand.fixed.dark, stopOpacity: 1 })] }) }), _jsx(Rect, { width: "100%", height: "100%", fill: "url(#grad)" })] }), _jsx(OverlayContentContainer, { children: children })] }));
|
|
16
|
+
};
|
|
17
|
+
export const HeroImageCard = ({ image, badgeText, heading, subHeading, size = 'default', isSquare = false, }) => {
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
const hasBadge = !!badgeText;
|
|
20
|
+
const CardContent = (_jsx(CardWithHeroImage, { background: image
|
|
21
|
+
? typeof image === 'string'
|
|
22
|
+
? { uri: image }
|
|
23
|
+
: image
|
|
24
|
+
: theme.color.brand.dim, isSmall: true, isSquare: isSquare, children: _jsx(GradientBlock, { children: _jsxs(Stack, { spaceBetween: 2, children: [_jsx(TitleContainer, { children: _jsx(ResponsiveHeading, { heading: heading, size: size }) }), !checkIsSmall(size) && _jsx(P, { inverted: true, children: subHeading })] }) }) }));
|
|
25
|
+
if (!hasBadge)
|
|
26
|
+
return CardContent;
|
|
27
|
+
return (_jsx(ContainerWithCardBadge, { badgeText: badgeText, children: CardContent }));
|
|
28
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import styled from '../../../styled.native';
|
|
3
|
+
import { CardWithMinHeight } from '../shared.styles';
|
|
4
|
+
export const CardWithHeroImage = styled(CardWithMinHeight)(({ theme, isSquare }) => (Object.assign({ paddingTop: theme.space[900], justifyContent: 'flex-end' }, (isSquare && {
|
|
5
|
+
aspectRatio: '1 / 1',
|
|
6
|
+
height: 'auto',
|
|
7
|
+
}))));
|
|
8
|
+
export const OverlayWrapper = styled(View)(({ theme, largeAndUp }) => ({
|
|
9
|
+
position: 'absolute',
|
|
10
|
+
left: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
borderBottomLeftRadius: theme.border.radius[largeAndUp ? '2xl' : 'lg'],
|
|
14
|
+
borderBottomRightRadius: theme.border.radius[largeAndUp ? '2xl' : 'lg'],
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
}));
|
|
17
|
+
export const OverlayContentContainer = styled(View)(({ theme }) => ({
|
|
18
|
+
paddingHorizontal: theme.space[400],
|
|
19
|
+
paddingBottom: theme.space[400],
|
|
20
|
+
marginTop: theme.space[1100],
|
|
21
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HeroImageCard';
|
|
@@ -1,23 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
2
|
-
import { useTheme } from '../../../styled.native';
|
|
3
|
-
import { Heading2, Heading4 } from '../../Heading';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
2
|
import { Icon } from '../../Icon';
|
|
5
3
|
import { P } from '../../P';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const HeadingComponent = checkIsSmall(size) ? Heading4 : Heading2;
|
|
11
|
-
const lineHeight = theme.font.lineHeight[checkIsSmall(size) ? 'lg' : '3xl'].mediaQuery.sm;
|
|
12
|
-
if (typeof heading === 'string') {
|
|
13
|
-
return (_jsx(HeadingComponent, { style: { lineHeight }, children: heading }));
|
|
14
|
-
}
|
|
15
|
-
return (_jsx(_Fragment, { children: heading.map(segment => (_jsx(HeadingComponent, { style: {
|
|
16
|
-
color: resolveColor(segment.color),
|
|
17
|
-
lineHeight,
|
|
18
|
-
marginRight: theme.space[100],
|
|
19
|
-
}, children: segment.text }, segment.text))) }));
|
|
20
|
-
};
|
|
4
|
+
import { ResponsiveHeading } from '../components';
|
|
5
|
+
import { TitleContainer } from '../shared.styles';
|
|
6
|
+
import { checkIsSmall } from '../utils';
|
|
7
|
+
import { CardWithIconText, SubHeading, TextContainer, } from './IconTextCard.styles';
|
|
21
8
|
export const IconTextCard = ({ icon, heading, subHeading, size = 'default', }) => {
|
|
22
9
|
return (_jsxs(CardWithIconText, { isSmall: checkIsSmall(size), children: [_jsx(Icon, { name: icon, size: 24 }), _jsxs(TextContainer, { isSmall: checkIsSmall(size), children: [_jsx(TitleContainer, { children: _jsx(ResponsiveHeading, { heading: heading, size: size }) }), !checkIsSmall(size) && subHeading && (_jsx(SubHeading, { children: _jsx(P, { children: subHeading }) }))] })] }));
|
|
23
10
|
};
|
|
@@ -8,11 +8,6 @@ export const TextContainer = styled(View)(({ isSmall }) => ({
|
|
|
8
8
|
flex: isSmall ? 1 : undefined,
|
|
9
9
|
justifyContent: 'flex-end',
|
|
10
10
|
}));
|
|
11
|
-
export const TitleContainer = styled(View)(({ theme }) => ({
|
|
12
|
-
marginRight: theme.space[50],
|
|
13
|
-
flexDirection: 'row',
|
|
14
|
-
flexWrap: 'wrap',
|
|
15
|
-
}));
|
|
16
11
|
export const SubHeading = styled(View)(({ theme }) => ({
|
|
17
12
|
marginTop: theme.space[200],
|
|
18
13
|
}));
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useTheme } from '../../../styled.native';
|
|
4
|
+
import { P } from '../../P';
|
|
5
|
+
import { ContainerWithCardBadge, ResponsiveHeading } from '../components';
|
|
6
|
+
import { checkIsSmall } from '../utils';
|
|
7
|
+
import { CardImage, CardWithIllustrationText, HeadingContainer, ImageContent, TextContent, } from './IllustrationTextCard.styles';
|
|
8
|
+
export const IllustrationTextCard = ({ badgeText, illustration, heading, subHeading, size = 'default', backgroundColor, onPress, }) => {
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const hasBadge = !!badgeText;
|
|
11
|
+
const CardContent = (_jsxs(CardWithIllustrationText, { isSmall: checkIsSmall(size), hasBadge: hasBadge, onPress: onPress, background: backgroundColor
|
|
12
|
+
? backgroundColor === 'brand'
|
|
13
|
+
? theme.color.brand.accessible
|
|
14
|
+
: undefined
|
|
15
|
+
: undefined, children: [_jsxs(TextContent, { isSmall: checkIsSmall(size), children: [_jsx(HeadingContainer, { isSmall: checkIsSmall(size), children: _jsx(ResponsiveHeading, { heading: heading, size: size }) }), !checkIsSmall(size) && subHeading && (_jsx(View, { children: _jsx(P, { inverted: backgroundColor === 'brand', children: subHeading }) }))] }), _jsx(ImageContent, { hasBadge: hasBadge, isSmall: checkIsSmall(size), children: _jsx(CardImage, { source: typeof illustration === 'string'
|
|
16
|
+
? { uri: illustration }
|
|
17
|
+
: illustration, resizeMode: "contain" }) })] }));
|
|
18
|
+
if (!hasBadge) {
|
|
19
|
+
return CardContent;
|
|
20
|
+
}
|
|
21
|
+
return (_jsx(ContainerWithCardBadge, { badgeText: badgeText, children: CardContent }));
|
|
22
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Image, View } from 'react-native';
|
|
2
|
+
import styled from '../../../styled.native';
|
|
3
|
+
import { CardWithMinHeight } from '../shared.styles';
|
|
4
|
+
export const CardWithIllustrationText = styled(CardWithMinHeight)(({ theme, isSmall, hasBadge }) => ({
|
|
5
|
+
paddingTop: hasBadge ? theme.space[800] : theme.space[400],
|
|
6
|
+
display: 'flex',
|
|
7
|
+
flexDirection: isSmall ? 'column-reverse' : 'row',
|
|
8
|
+
}));
|
|
9
|
+
export const TextContent = styled(View)(({ isSmall, theme }) => ({
|
|
10
|
+
flex: isSmall ? undefined : 1,
|
|
11
|
+
paddingRight: isSmall ? 0 : theme.space[100],
|
|
12
|
+
alignSelf: isSmall ? undefined : 'flex-end',
|
|
13
|
+
}));
|
|
14
|
+
export const HeadingContainer = styled(View)(({ theme, isSmall }) => ({
|
|
15
|
+
marginBottom: isSmall ? 0 : theme.space[200],
|
|
16
|
+
}));
|
|
17
|
+
export const ImageContent = styled(View)(({ theme, isSmall, hasBadge }) => ({
|
|
18
|
+
width: isSmall ? theme.space[1600] : theme.space[3000],
|
|
19
|
+
height: isSmall ? theme.space[1600] : theme.space[3000],
|
|
20
|
+
justifyContent: 'center',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
alignSelf: isSmall ? undefined : 'center',
|
|
23
|
+
marginTop: hasBadge && !isSmall ? -theme.space[400] : 0,
|
|
24
|
+
}));
|
|
25
|
+
export const CardImage = styled(Image)({
|
|
26
|
+
width: '100%',
|
|
27
|
+
height: '100%',
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './IllustrationTextCard';
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import { P
|
|
4
|
-
import {
|
|
3
|
+
import { P } from '../../P';
|
|
4
|
+
import { Strong } from '../../Strong';
|
|
5
|
+
import { ContainerWithCardBadge } from '../components';
|
|
5
6
|
import { checkIsSmall } from '../utils';
|
|
6
7
|
import { CardImage, CardWithLinkText, Heading, ImageContent, TextContent, } from './LinkTextCard.styles';
|
|
7
|
-
export const LinkTextCard = ({ image,
|
|
8
|
-
const hasBadge = !!
|
|
9
|
-
const CardContent = (_jsxs(CardWithLinkText, { isSmall: checkIsSmall(size), hasBadge: hasBadge, onPress: onPress, children: [_jsxs(TextContent, { isSmall: checkIsSmall(size), children: [_jsx(View, { children: _jsx(Heading, { isSmall: checkIsSmall(size), children: _jsx(Strong, { children: heading }) }) }), !checkIsSmall(size) && (_jsx(View, { children: _jsx(P, { children: subHeading }) }))] }), _jsx(ImageContent, { children: _jsx(CardImage, { source: image
|
|
8
|
+
export const LinkTextCard = ({ image, badgeText, heading, subHeading, size, onPress, }) => {
|
|
9
|
+
const hasBadge = !!badgeText;
|
|
10
|
+
const CardContent = (_jsxs(CardWithLinkText, { isSmall: checkIsSmall(size), hasBadge: hasBadge, onPress: onPress, children: [_jsxs(TextContent, { isSmall: checkIsSmall(size), children: [_jsx(View, { children: _jsx(Heading, { isSmall: checkIsSmall(size), children: _jsx(Strong, { children: heading }) }) }), !checkIsSmall(size) && !!subHeading && (_jsx(View, { children: _jsx(P, { children: subHeading }) }))] }), _jsx(ImageContent, { isSmall: checkIsSmall(size), hasBadge: hasBadge, children: _jsx(CardImage, { source: image
|
|
10
11
|
? image
|
|
11
12
|
: {
|
|
12
13
|
uri: 'https://www.ovobyus.com/transform/eed55bf8-f059-4acb-a043-2d0a6d12537f/homepage-supporting-house-image',
|
|
@@ -14,5 +15,5 @@ export const LinkTextCard = ({ image, badge, heading, subHeading, size, onPress,
|
|
|
14
15
|
if (!hasBadge) {
|
|
15
16
|
return CardContent;
|
|
16
17
|
}
|
|
17
|
-
return (
|
|
18
|
+
return (_jsx(ContainerWithCardBadge, { badgeText: badgeText, children: CardContent }));
|
|
18
19
|
};
|
|
@@ -7,16 +7,19 @@ export const CardWithLinkText = styled(Card)(({ theme, isSmall, hasBadge }) => (
|
|
|
7
7
|
display: 'flex',
|
|
8
8
|
flexDirection: isSmall ? 'column-reverse' : 'row',
|
|
9
9
|
}));
|
|
10
|
-
export const TextContent = styled(View)(({ isSmall }) => ({
|
|
10
|
+
export const TextContent = styled(View)(({ isSmall, theme }) => ({
|
|
11
11
|
flex: isSmall ? undefined : 1,
|
|
12
|
-
paddingRight: isSmall ? 0 :
|
|
12
|
+
paddingRight: isSmall ? 0 : theme.space[100],
|
|
13
|
+
alignSelf: isSmall ? undefined : 'flex-end',
|
|
13
14
|
}));
|
|
14
|
-
export const ImageContent = styled(View)({
|
|
15
|
-
width:
|
|
16
|
-
height:
|
|
15
|
+
export const ImageContent = styled(View)(({ theme, isSmall, hasBadge }) => ({
|
|
16
|
+
width: isSmall ? theme.space[1600] : theme.space[2000],
|
|
17
|
+
height: isSmall ? theme.space[1600] : theme.space[2000],
|
|
17
18
|
justifyContent: 'center',
|
|
18
19
|
alignItems: 'center',
|
|
19
|
-
|
|
20
|
+
alignSelf: isSmall ? undefined : 'center',
|
|
21
|
+
marginTop: hasBadge && !isSmall ? -theme.space[400] : 0,
|
|
22
|
+
}));
|
|
20
23
|
export const CardImage = styled(Image)({
|
|
21
24
|
width: '100%',
|
|
22
25
|
height: '100%',
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { View } from 'react-native';
|
|
14
|
+
import { SkeletonCircle, SkeletonText, Strong } from '../..';
|
|
15
|
+
import { checkIsSmall } from '../utils';
|
|
16
|
+
import { CardWithQuickLink, HeadingText, Illustration, ImageContent, ImageSkeletonContainer, } from './QuickLinkCard.styles';
|
|
17
|
+
export const QuickLinkCard = (_a) => {
|
|
18
|
+
var { heading, illustration, onPress, size = 'default', loading = false } = _a, rest = __rest(_a, ["heading", "illustration", "onPress", "size", "loading"]);
|
|
19
|
+
const showContent = !loading;
|
|
20
|
+
return (_jsxs(CardWithQuickLink, Object.assign({ onPress: onPress }, rest, { children: [_jsxs(View, { children: [loading && _jsx(SkeletonText, { lines: 2 }), showContent && (_jsx(HeadingText, { children: _jsx(Strong, { children: heading }) }))] }), loading && (_jsx(ImageSkeletonContainer, { children: _jsx(SkeletonCircle, {}) })), showContent && illustration && (_jsx(ImageContent, { children: _jsx(Illustration, { isSmall: checkIsSmall(size), source: typeof illustration === 'string'
|
|
21
|
+
? { uri: illustration }
|
|
22
|
+
: illustration, resizeMode: "contain" }) }))] })));
|
|
23
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Image, View } from 'react-native';
|
|
2
|
+
import { Card } from '../..';
|
|
3
|
+
import styled from '../../../styled.native';
|
|
4
|
+
import { P } from '../../P';
|
|
5
|
+
export const CardWithQuickLink = styled(Card)(({ theme }) => ({
|
|
6
|
+
padding: theme.space[300],
|
|
7
|
+
minHeight: theme.space[2400],
|
|
8
|
+
minWidth: theme.space[3500],
|
|
9
|
+
}));
|
|
10
|
+
export const HeadingText = styled(P)(({ theme }) => ({
|
|
11
|
+
marginBottom: theme.space[900],
|
|
12
|
+
}));
|
|
13
|
+
export const ImageContent = styled(View)(({ theme }) => ({
|
|
14
|
+
position: 'absolute',
|
|
15
|
+
bottom: theme.space[300],
|
|
16
|
+
right: theme.space[300],
|
|
17
|
+
}));
|
|
18
|
+
export const Illustration = styled(Image)(({ isSmall, theme }) => ({
|
|
19
|
+
width: isSmall ? theme.space[1000] : theme.space[1600],
|
|
20
|
+
height: isSmall ? theme.space[1000] : theme.space[1600],
|
|
21
|
+
}));
|
|
22
|
+
export const ImageSkeletonContainer = styled(View)(({ theme }) => ({
|
|
23
|
+
alignSelf: 'flex-end',
|
|
24
|
+
width: theme.space[1000],
|
|
25
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './QuickLinkCard';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { P } from '../../P';
|
|
5
|
+
import { ContainerWithCardBadge, ResponsiveHeading } from '../components';
|
|
6
|
+
import { SMALL_CARD_HEIGHT } from '../shared.styles';
|
|
7
|
+
import { CardImage, CardWithServicesImage, HeadingContainer, ImageContent, TextContent, } from './ServicesImageCard.styles';
|
|
8
|
+
export const ServicesImageCard = ({ badgeText, image, heading, subHeading, onPress, }) => {
|
|
9
|
+
const hasBadge = !!badgeText;
|
|
10
|
+
const [cardHeight, setCardHeight] = useState(0);
|
|
11
|
+
const onLayout = useCallback((e) => {
|
|
12
|
+
const { height: layoutHeight } = e.nativeEvent.layout;
|
|
13
|
+
setCardHeight(layoutHeight);
|
|
14
|
+
}, []);
|
|
15
|
+
const pushImage = useMemo(() => cardHeight > SMALL_CARD_HEIGHT, [cardHeight]);
|
|
16
|
+
const content = (_jsxs(CardWithServicesImage, { isSmall: true, onPress: onPress, onLayout: onLayout, children: [_jsxs(TextContent, { hasBadge: hasBadge, pushImage: pushImage, children: [_jsx(HeadingContainer, { subHeading: !!subHeading, children: _jsx(ResponsiveHeading, { heading: heading }) }), !!subHeading && (_jsx(View, { children: _jsx(P, { children: subHeading }) }))] }), _jsx(ImageContent, { pushImage: pushImage, children: _jsx(CardImage, { pushImage: pushImage, source: typeof image === 'string' ? { uri: image } : image, resizeMode: "cover" }) })] }));
|
|
17
|
+
if (!hasBadge)
|
|
18
|
+
return content;
|
|
19
|
+
return (_jsx(ContainerWithCardBadge, { badgeText: badgeText, children: content }));
|
|
20
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Image, View } from 'react-native';
|
|
2
|
+
import styled from '../../../styled.native';
|
|
3
|
+
import { CardWithMinHeight, SMALL_CARD_HEIGHT } from '../shared.styles';
|
|
4
|
+
const IMAGE_OUTSIDE = SMALL_CARD_HEIGHT * 0.45;
|
|
5
|
+
export const CardWithServicesImage = styled(CardWithMinHeight)({
|
|
6
|
+
paddingTop: 0,
|
|
7
|
+
flexDirection: 'row',
|
|
8
|
+
borderColor: 'transparent',
|
|
9
|
+
});
|
|
10
|
+
export const TextContent = styled(View)(({ hasBadge, theme, pushImage }) => ({
|
|
11
|
+
paddingTop: hasBadge ? theme.space[800] : theme.space[400],
|
|
12
|
+
paddingRight: pushImage ? IMAGE_OUTSIDE : SMALL_CARD_HEIGHT - IMAGE_OUTSIDE,
|
|
13
|
+
flex: 1,
|
|
14
|
+
alignSelf: 'flex-end',
|
|
15
|
+
}));
|
|
16
|
+
export const HeadingContainer = styled(View)(({ theme, subHeading }) => ({
|
|
17
|
+
marginBottom: subHeading ? theme.space[200] : 0,
|
|
18
|
+
}));
|
|
19
|
+
export const ImageContent = styled(View)(({ theme, pushImage }) => ({
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: pushImage ? theme.space[50] : theme.space[250],
|
|
22
|
+
bottom: 0,
|
|
23
|
+
width: SMALL_CARD_HEIGHT,
|
|
24
|
+
right: -(pushImage ? IMAGE_OUTSIDE * 1.45 : IMAGE_OUTSIDE),
|
|
25
|
+
transform: 'rotate(-15deg)',
|
|
26
|
+
overflow: 'hidden',
|
|
27
|
+
}));
|
|
28
|
+
export const CardImage = styled(Image)(({ pushImage }) => ({
|
|
29
|
+
width: '100%',
|
|
30
|
+
height: '100%',
|
|
31
|
+
transform: `rotate(15deg) scale(${pushImage ? 1.35 : 1.2})`,
|
|
32
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ServicesImageCard';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from '../../styled.native';
|
|
3
|
+
import { Heading2, Heading4 } from '../Heading';
|
|
4
|
+
import { BadgeContainer, StyledBadge } from './shared.styles';
|
|
5
|
+
import { checkIsSmall, resolveColor } from './utils';
|
|
6
|
+
export const ResponsiveHeading = ({ heading, size = 'default', }) => {
|
|
7
|
+
const theme = useTheme();
|
|
8
|
+
const HeadingComponent = checkIsSmall(size) ? Heading4 : Heading2;
|
|
9
|
+
if (typeof heading === 'string') {
|
|
10
|
+
return _jsx(HeadingComponent, { children: heading });
|
|
11
|
+
}
|
|
12
|
+
return (_jsx(_Fragment, { children: heading.map((segment, index) => (_jsx(HeadingComponent, { style: {
|
|
13
|
+
color: resolveColor(segment.color),
|
|
14
|
+
marginRight: theme.space[150],
|
|
15
|
+
}, children: segment.text }, `${segment.text}-${index}`))) }));
|
|
16
|
+
};
|
|
17
|
+
export const ContainerWithCardBadge = ({ badgeText, variant = 'success', children }) => {
|
|
18
|
+
return (_jsxs(BadgeContainer, { children: [_jsx(StyledBadge, { variant: variant, children: badgeText }), children] }));
|
|
19
|
+
};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export { AccountCard } from './AccountCard';
|
|
2
2
|
export { BalanceCard, BalanceCardErrorFallback } from './BalanceCard';
|
|
3
|
+
export { DisruptiveCard } from './DisruptiveCard';
|
|
4
|
+
export { HeroImageCard } from './HeroImageCard';
|
|
3
5
|
export { IconDataCard } from './IconDataCard';
|
|
4
6
|
export { IconTextCard } from './IconTextCard';
|
|
7
|
+
export { IllustrationTextCard } from './IllustrationTextCard';
|
|
5
8
|
export { LinkTextCard } from './LinkTextCard';
|
|
6
9
|
export { ProgressBarCard } from './ProgressBarCard';
|
|
10
|
+
export { QuickLinkCard } from './QuickLinkCard';
|
|
11
|
+
export { ServicesImageCard } from './ServicesImageCard';
|
|
@@ -3,7 +3,10 @@ import styled from '../../styled.native';
|
|
|
3
3
|
import { Badge } from '../Badge';
|
|
4
4
|
import { Card } from '../Card';
|
|
5
5
|
export const SMALL_CARD_HEIGHT = 172;
|
|
6
|
-
export const
|
|
6
|
+
export const BadgeContainer = styled(View)({
|
|
7
|
+
position: 'relative',
|
|
8
|
+
});
|
|
9
|
+
export const StyledBadge = styled(Badge)(({ theme }) => ({
|
|
7
10
|
position: 'absolute',
|
|
8
11
|
top: theme.space[100],
|
|
9
12
|
left: theme.space[500],
|
|
@@ -16,6 +19,11 @@ export const CardBadge = styled(Badge)(({ theme }) => ({
|
|
|
16
19
|
paddingTop: 0,
|
|
17
20
|
zIndex: 1,
|
|
18
21
|
}));
|
|
22
|
+
export const TitleContainer = styled(View)(({ theme }) => ({
|
|
23
|
+
marginRight: theme.space[50],
|
|
24
|
+
flexDirection: 'row',
|
|
25
|
+
flexWrap: 'wrap',
|
|
26
|
+
}));
|
|
19
27
|
export const CardWithMinHeight = styled(Card)(({ isSmall }) => ({
|
|
20
28
|
minHeight: isSmall ? SMALL_CARD_HEIGHT : undefined,
|
|
21
29
|
}));
|
|
@@ -31,3 +39,11 @@ export const WrappedContainer = styled(View)(({ theme }) => ({
|
|
|
31
39
|
flexWrap: 'wrap',
|
|
32
40
|
gap: theme.space[100],
|
|
33
41
|
}));
|
|
42
|
+
// Styles for stories
|
|
43
|
+
export const StyleWrapper = styled.View({
|
|
44
|
+
padding: 10,
|
|
45
|
+
gap: 15,
|
|
46
|
+
});
|
|
47
|
+
export const SmallCardContainer = styled.View({
|
|
48
|
+
maxWidth: 180,
|
|
49
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Alert } from 'react-native';
|
|
1
2
|
import { useTheme } from '../../styled.native';
|
|
2
3
|
export const checkIsSmall = (size) => size === 'small';
|
|
3
4
|
export const resolveColor = (colorKey = 'default') => {
|
|
@@ -8,5 +9,15 @@ export const resolveColor = (colorKey = 'default') => {
|
|
|
8
9
|
if (colorKey === 'onSurface') {
|
|
9
10
|
return theme.color.surface.onSurface;
|
|
10
11
|
}
|
|
12
|
+
if (colorKey === 'brandBold') {
|
|
13
|
+
return theme.color.brand.bold;
|
|
14
|
+
}
|
|
15
|
+
if (colorKey === 'onBrand') {
|
|
16
|
+
return theme.color.brand.onBrand;
|
|
17
|
+
}
|
|
11
18
|
return colorKey;
|
|
12
19
|
};
|
|
20
|
+
// Used for stories
|
|
21
|
+
export const handlePress = () => {
|
|
22
|
+
Alert.alert('Card pressed');
|
|
23
|
+
};
|
|
@@ -10,59 +10,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import {
|
|
14
|
-
import { TouchableOpacity, View, } from 'react-native';
|
|
15
|
-
import styled from '../../styled.native';
|
|
13
|
+
import { TouchableOpacity, View } from 'react-native';
|
|
16
14
|
import { ErrorText } from '../ErrorText';
|
|
17
15
|
import { FormGroup } from '../FormGroup';
|
|
18
16
|
import { HintText } from '../HintText';
|
|
19
|
-
import { Icon } from '../Icon/Icon';
|
|
20
|
-
import { LabelText } from '../LabelText';
|
|
21
17
|
import { Stack } from '../Stack';
|
|
22
|
-
|
|
23
|
-
const checkboxSize = theme.space[600];
|
|
24
|
-
const gap = theme.space[200];
|
|
25
|
-
return `
|
|
26
|
-
width: ${numToPx(checkboxSize + gap)};
|
|
27
|
-
height: ${numToPx(theme.space[1100])};
|
|
28
|
-
`;
|
|
29
|
-
});
|
|
30
|
-
const StyledCheckboxInput = styled.View(({ theme, invalid, checked }) => {
|
|
31
|
-
return `
|
|
32
|
-
width: ${numToPx(theme.space[600])};
|
|
33
|
-
height: ${numToPx(theme.space[600])};
|
|
34
|
-
border: ${numToPx(theme.border.width.md)} solid;
|
|
35
|
-
margin-top: 10px;
|
|
36
|
-
border-radius: ${numToPx(theme.border.radius.xs)};
|
|
37
|
-
border-color: ${invalid
|
|
38
|
-
? theme.input.color.borderError
|
|
39
|
-
: checked
|
|
40
|
-
? theme.input.color.selected
|
|
41
|
-
: theme.input.color.border};
|
|
42
|
-
background: ${checked ? theme.input.color.selectedTint : 'transparent'};
|
|
43
|
-
`;
|
|
44
|
-
});
|
|
45
|
-
const CheckboxCheck = (props) => {
|
|
46
|
-
return _jsx(Icon, Object.assign({ name: "check", size: 16 }, props));
|
|
47
|
-
};
|
|
48
|
-
const StyledCheckboxInputCheck = styled(CheckboxCheck)(({ theme, checked, }) => {
|
|
49
|
-
return `
|
|
50
|
-
margin-top: ${numToPx(theme.space[50])};
|
|
51
|
-
margin-left: ${numToPx(theme.space[50])};
|
|
52
|
-
color: ${theme.color.alert.info};
|
|
53
|
-
opacity: ${checked ? 1 : 0};
|
|
54
|
-
`;
|
|
55
|
-
});
|
|
18
|
+
import { CheckLabelText, StyledCheckboxInput, StyledCheckboxInputCheck, StyledCheckboxInputWrapper, StyledWrapper, } from './styled';
|
|
56
19
|
const Input = (_a) => {
|
|
57
20
|
var { checked, invalid, testID } = _a, rest = __rest(_a, ["checked", "invalid", "testID"]);
|
|
58
21
|
return (_jsx(StyledCheckboxInputWrapper, Object.assign({}, rest, { children: _jsx(StyledCheckboxInput, { invalid: invalid, checked: checked, testID: testID, children: _jsx(StyledCheckboxInputCheck, { checked: checked }) }) })));
|
|
59
22
|
};
|
|
60
|
-
const CheckLabelText = styled(LabelText)(({ theme }) => `
|
|
61
|
-
padding-top: ${numToPx(theme.space[300])};
|
|
62
|
-
`);
|
|
63
|
-
const StyledWrapper = styled.View `
|
|
64
|
-
flex-direction: row;
|
|
65
|
-
`;
|
|
66
23
|
const Checkbox = (_a) => {
|
|
67
24
|
var { label, hint, error, checked, optional, invalid, activeOpacity = 0.8, testID, ref } = _a, rest = __rest(_a, ["label", "hint", "error", "checked", "optional", "invalid", "activeOpacity", "testID", "ref"]);
|
|
68
25
|
const hasError = !!error;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { numToPx } from '@ovotech/element-core';
|
|
3
|
+
import styled from '../../styled.native';
|
|
4
|
+
import { Icon } from '../Icon';
|
|
5
|
+
import { LabelText } from '../LabelText';
|
|
6
|
+
const CheckboxCheck = (props) => {
|
|
7
|
+
return _jsx(Icon, Object.assign({ name: "check", size: 16 }, props));
|
|
8
|
+
};
|
|
9
|
+
export const StyledCheckboxInputWrapper = styled.View(({ theme }) => {
|
|
10
|
+
const checkboxSize = theme.space[600];
|
|
11
|
+
const gap = theme.space[200];
|
|
12
|
+
return `
|
|
13
|
+
width: ${numToPx(checkboxSize + gap)};
|
|
14
|
+
height: ${numToPx(theme.space[1100])};
|
|
15
|
+
`;
|
|
16
|
+
});
|
|
17
|
+
export const StyledCheckboxInput = styled.View(({ theme, invalid, checked }) => {
|
|
18
|
+
return `
|
|
19
|
+
width: ${numToPx(theme.space[600])};
|
|
20
|
+
height: ${numToPx(theme.space[600])};
|
|
21
|
+
border: ${numToPx(theme.border.width.md)} solid;
|
|
22
|
+
margin-top: 10px;
|
|
23
|
+
border-radius: ${numToPx(theme.border.radius.xs)};
|
|
24
|
+
border-color: ${invalid
|
|
25
|
+
? theme.input.color.borderError
|
|
26
|
+
: checked
|
|
27
|
+
? theme.input.color.selected
|
|
28
|
+
: theme.input.color.border};
|
|
29
|
+
background: ${checked ? theme.input.color.selectedTint : 'transparent'};
|
|
30
|
+
`;
|
|
31
|
+
});
|
|
32
|
+
export const StyledCheckboxInputCheck = styled(CheckboxCheck)(({ theme, checked }) => {
|
|
33
|
+
return `
|
|
34
|
+
margin-top: ${numToPx(theme.space[50])};
|
|
35
|
+
margin-left: ${numToPx(theme.space[50])};
|
|
36
|
+
color: ${theme.color.alert.info};
|
|
37
|
+
opacity: ${checked ? 1 : 0};
|
|
38
|
+
`;
|
|
39
|
+
});
|
|
40
|
+
export const CheckLabelText = styled(LabelText)(({ theme }) => `
|
|
41
|
+
padding-top: ${numToPx(theme.space[300])};
|
|
42
|
+
font-family: ${theme.native.font.family.book};
|
|
43
|
+
`);
|
|
44
|
+
export const StyledWrapper = styled.View `
|
|
45
|
+
flex-direction: row;
|
|
46
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,15 +9,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { createRef } from 'react';
|
|
14
|
+
import { useBreakpoint } from '../../hooks';
|
|
14
15
|
import { mergeRefs } from '../../utils';
|
|
15
|
-
import {
|
|
16
|
+
import { CurrencyInputWrapper, StyledCurrencyInput, StyledCurrencySymbol, StyledCurrencySymbolWrapper, } from './styled';
|
|
17
|
+
const currecySymbolMap = {
|
|
18
|
+
GBP: '£',
|
|
19
|
+
EUR: '€',
|
|
20
|
+
AUD: '$',
|
|
21
|
+
USD: '$',
|
|
22
|
+
};
|
|
16
23
|
const CurrencyInput = (_a) => {
|
|
17
24
|
var { currency = 'GBP', invalid, accessibilityLabel = '', ref } = _a, rest = __rest(_a, ["currency", "invalid", "accessibilityLabel", "ref"]);
|
|
18
25
|
const inputRef = createRef();
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
return (_jsx(
|
|
26
|
+
const breakpoints = useBreakpoint();
|
|
27
|
+
const updatedAccessibilityLabel = `${accessibilityLabel} ${currency === 'GBP' ? 'pounds' : currency === 'EUR' ? 'euros' : 'dollars'}`.trim();
|
|
28
|
+
return (_jsxs(CurrencyInputWrapper, { children: [_jsx(StyledCurrencyInput, Object.assign({ accessibilityLabel: updatedAccessibilityLabel, invalid: invalid, ref: mergeRefs(ref, inputRef) }, breakpoints, rest)), _jsx(StyledCurrencySymbolWrapper, { testID: `element-currency-input-${currency}`, accessible: false, children: _jsx(StyledCurrencySymbol, Object.assign({}, breakpoints, { children: currecySymbolMap[currency] })) })] }));
|
|
22
29
|
};
|
|
23
30
|
export { CurrencyInput };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import styled from '../../styled.native';
|
|
3
|
+
import { numToPx } from '../../theme';
|
|
4
|
+
import { NumberInput } from '../NumberInput';
|
|
5
|
+
import { P } from '../P';
|
|
6
|
+
export const CurrencyInputWrapper = styled(View) `
|
|
7
|
+
position: relative;
|
|
8
|
+
`;
|
|
9
|
+
export const StyledCurrencyInput = styled(NumberInput)(({ theme, smallAndUp }) => `
|
|
10
|
+
padding-left: ${numToPx(theme.space[800])};
|
|
11
|
+
padding-bottom: ${numToPx(theme.space[100])};
|
|
12
|
+
font-family: ${theme.native.font.family.black};
|
|
13
|
+
font-size: ${numToPx(theme.font.size['4xl'].mediaQuery[smallAndUp ? 'lg' : 'sm'])};
|
|
14
|
+
line-height: ${numToPx(theme.font.size['4xl'].mediaQuery[smallAndUp ? 'lg' : 'sm'])};
|
|
15
|
+
letter-spacing: ${numToPx(theme.font.letterSpacing['4xl'].mediaQuery[smallAndUp ? 'lg' : 'sm'])};
|
|
16
|
+
`);
|
|
17
|
+
export const StyledCurrencySymbolWrapper = styled(View)(({ theme }) => {
|
|
18
|
+
return `
|
|
19
|
+
position: absolute;
|
|
20
|
+
width: ${numToPx(theme.space[700])};
|
|
21
|
+
height: ${numToPx(theme.space[700])};
|
|
22
|
+
top: 50%;
|
|
23
|
+
margin-top: -${numToPx(theme.space[350])};
|
|
24
|
+
left: ${numToPx(theme.space[400])};
|
|
25
|
+
`;
|
|
26
|
+
});
|
|
27
|
+
export const StyledCurrencySymbol = styled(P)(({ theme, smallAndUp, }) => {
|
|
28
|
+
return `
|
|
29
|
+
font-family: ${theme.native.font.family.bold};
|
|
30
|
+
font-size: ${numToPx(theme.font.size.xl.mediaQuery[smallAndUp ? 'lg' : 'sm'])};
|
|
31
|
+
line-height: ${numToPx(theme.font.lineHeight.xl.mediaQuery[smallAndUp ? 'lg' : 'sm'])};
|
|
32
|
+
`;
|
|
33
|
+
});
|
|
@@ -5,7 +5,9 @@ const StyledDivider = styled.View(({ theme, type = 'default', width = '100%' })
|
|
|
5
5
|
height: 1px;
|
|
6
6
|
background: ${type === 'default'
|
|
7
7
|
? theme.color.surface.border
|
|
8
|
-
:
|
|
8
|
+
: type === 'brand'
|
|
9
|
+
? theme.color.green[70]
|
|
10
|
+
: theme.color.surface.borderDim};
|
|
9
11
|
width: ${width};
|
|
10
12
|
`;
|
|
11
13
|
});
|
|
@@ -10,9 +10,25 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
13
14
|
import { Input } from '../Input/Input';
|
|
15
|
+
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
14
16
|
const EmailInput = (_a) => {
|
|
15
|
-
var {
|
|
16
|
-
|
|
17
|
+
var { onChangeText, onSubmitEditing, value, invalid, onValidityChange } = _a, rest = __rest(_a, ["onChangeText", "onSubmitEditing", "value", "invalid", "onValidityChange"]);
|
|
18
|
+
const textValue = typeof value === 'string' ? value : '';
|
|
19
|
+
const isValid = useMemo(() => textValue.length > 0 && EMAIL_REGEX.test(textValue), [textValue]);
|
|
20
|
+
const [hasUserInput, setHasUserInput] = useState(false);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
onValidityChange === null || onValidityChange === void 0 ? void 0 : onValidityChange(isValid);
|
|
23
|
+
}, [isValid, onValidityChange]);
|
|
24
|
+
return (_jsx(Input, Object.assign({ keyboardType: "email-address", autoCapitalize: "none", autoCorrect: false, value: value, invalid: invalid !== null && invalid !== void 0 ? invalid : (hasUserInput && !isValid), onChangeText: text => {
|
|
25
|
+
if (!hasUserInput)
|
|
26
|
+
setHasUserInput(true);
|
|
27
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
|
|
28
|
+
}, onSubmitEditing: e => {
|
|
29
|
+
if (!isValid)
|
|
30
|
+
return;
|
|
31
|
+
onSubmitEditing === null || onSubmitEditing === void 0 ? void 0 : onSubmitEditing(e);
|
|
32
|
+
} }, rest)));
|
|
17
33
|
};
|
|
18
34
|
export { EmailInput };
|