@ovotech/element-native 5.5.0 → 5.7.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 +3 -1725
- 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 +23 -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 +12 -0
- package/dist/components/ActionList/ActionListItems/styles.d.ts +51 -0
- package/dist/components/ActionList/ActionListItems/styles.js +173 -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 +12 -5756
- package/dist/components/ActionList/styled.js +24 -9
- package/dist/components/Badge/Badge.d.ts +1 -575
- package/dist/components/BottomActionBar/BottomActionBar.d.ts +12 -0
- package/dist/components/BottomActionBar/BottomActionBar.js +80 -0
- package/dist/components/BottomActionBar/OverlayProvider.d.ts +8 -0
- package/dist/components/BottomActionBar/OverlayProvider.js +38 -0
- package/dist/components/BottomActionBar/index.d.ts +2 -0
- package/dist/components/BottomActionBar/index.js +7 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.styles.d.ts +5 -2300
- 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 +4 -1725
- package/dist/components/Card/Card.styles.js +7 -11
- package/dist/components/Cards/AccountCard/AccountCard.styles.d.ts +8 -4600
- package/dist/components/Cards/BalanceCard/BalanceCard.styles.d.ts +15 -8625
- 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 +3 -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 +10 -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 +4 -2300
- package/dist/components/Cards/IconTextCard/IconTextCard.js +3 -16
- package/dist/components/Cards/IconTextCard/IconTextCard.styles.d.ts +3 -2300
- 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 +18 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +33 -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 +8 -2875
- package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
- package/dist/components/Cards/OfferCard/OfferCard.d.ts +22 -0
- package/dist/components/Cards/OfferCard/OfferCard.js +36 -0
- package/dist/components/Cards/OfferCard/OfferCard.styles.d.ts +34 -0
- package/dist/components/Cards/OfferCard/OfferCard.styles.js +61 -0
- package/dist/components/Cards/OfferCard/index.d.ts +1 -0
- package/dist/components/Cards/OfferCard/index.js +17 -0
- package/dist/components/Cards/ProgressBarCard/ProgressBarCard.styles.d.ts +9 -5175
- 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 +12 -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 +17 -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 +11 -3451
- 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 +21 -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 +10 -0
- package/dist/components/CurrencyInput/styled.js +39 -0
- package/dist/components/DataTable/styles.d.ts +13 -7475
- package/dist/components/Disclosure/Disclosure.d.ts +1 -575
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Divider/Divider.js +3 -1
- package/dist/components/Em/Em.d.ts +1 -575
- 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 +2 -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 +1 -575
- package/dist/components/Field/Field.d.ts +3 -2
- package/dist/components/Field/Field.js +3 -2
- package/dist/components/Grid/Col.d.ts +1 -575
- package/dist/components/HintText/HintText.d.ts +1 -575
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Input/Input.js +6 -97
- package/dist/components/Input/styled.d.ts +16 -0
- package/dist/components/Input/styled.js +96 -0
- package/dist/components/LabelText/LabelText.d.ts +1 -575
- 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 +10 -0
- package/dist/components/LargeValueReference/styles.js +29 -0
- package/dist/components/LineThrough/LineThrough.d.ts +1 -575
- package/dist/components/List/styled.d.ts +4 -2300
- package/dist/components/Margin/Margin.d.ts +1 -575
- package/dist/components/NavHeader/NavHeader.styles.d.ts +11 -6325
- package/dist/components/Notification/Notification.d.ts +2 -2
- package/dist/components/Notification/Notification.js +20 -12
- package/dist/components/Notification/Notification.styles.d.ts +13 -5175
- package/dist/components/Notification/Notification.styles.js +21 -2
- package/dist/components/PasswordInput/PasswordInput.styled.d.ts +1 -577
- package/dist/components/PasswordInput/PasswordInput.styled.js +5 -3
- package/dist/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
- package/dist/components/Radio/Radio.d.ts +2 -2
- package/dist/components/Radio/Radio.js +5 -43
- package/dist/components/Radio/Radio.styles.d.ts +9 -0
- package/dist/components/Radio/Radio.styles.js +74 -0
- 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 +16 -0
- package/dist/components/RadioCard/RadioCard.styles.js +97 -0
- package/dist/components/Rail/Rail.d.ts +12 -0
- package/dist/components/Rail/Rail.js +58 -0
- package/dist/components/Rail/RailIndicator.d.ts +7 -0
- package/dist/components/Rail/RailIndicator.js +81 -0
- package/dist/components/Rail/index.d.ts +1 -0
- package/dist/components/Rail/index.js +5 -0
- package/dist/components/Rail/styles.d.ts +13 -0
- package/dist/components/Rail/styles.js +55 -0
- package/dist/components/Rail/useRailPaging.d.ts +13 -0
- package/dist/components/Rail/useRailPaging.js +95 -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 +26 -0
- package/dist/components/SelectField/styled.js +118 -0
- package/dist/components/SkeletonText/SkeletonText.js +4 -4
- package/dist/components/Strong/Strong.d.ts +1 -575
- package/dist/components/SubLabelText/SubLabelText.d.ts +1 -575
- package/dist/components/Tabs/Tab.d.ts +1 -575
- package/dist/components/TextareaInput/TextareaInput.js +12 -6
- package/dist/components/Toast/Toast.d.ts +10 -4
- package/dist/components/Toast/Toast.js +40 -27
- package/dist/components/Toggle/Toggle.d.ts +3 -1
- package/dist/components/Toggle/Toggle.js +4 -6
- package/dist/components/Toggle/styles.d.ts +5 -2300
- package/dist/components/Toggle/styles.js +3 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +5 -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 +19 -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 +8 -0
- package/dist/esm/components/ActionList/ActionListItems/styles.js +137 -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/BottomActionBar/BottomActionBar.js +40 -0
- package/dist/esm/components/BottomActionBar/OverlayProvider.js +30 -0
- package/dist/esm/components/BottomActionBar/index.js +2 -0
- 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 +27 -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/OfferCard/OfferCard.js +32 -0
- package/dist/esm/components/Cards/OfferCard/OfferCard.styles.js +55 -0
- package/dist/esm/components/Cards/OfferCard/index.js +1 -0
- 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/Notification/Notification.js +21 -13
- package/dist/esm/components/Notification/Notification.styles.js +20 -1
- package/dist/esm/components/PasswordInput/PasswordInput.styled.js +5 -3
- package/dist/esm/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
- package/dist/esm/components/Radio/Radio.js +4 -39
- package/dist/esm/components/Radio/Radio.styles.js +38 -0
- package/dist/esm/components/RadioCard/RadioCard.js +5 -52
- package/dist/esm/components/RadioCard/RadioCard.styles.js +61 -0
- package/dist/esm/components/Rail/Rail.js +21 -0
- package/dist/esm/components/Rail/RailIndicator.js +44 -0
- package/dist/esm/components/Rail/index.js +1 -0
- package/dist/esm/components/Rail/styles.js +49 -0
- package/dist/esm/components/Rail/useRailPaging.js +92 -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/Toast/Toast.js +40 -27
- package/dist/esm/components/Toggle/Toggle.js +4 -6
- package/dist/esm/components/Toggle/styles.js +3 -3
- package/dist/esm/components/index.js +5 -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 +1 -3445
- 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 +5 -5
- 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,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
import styled from '../../styled.native';
|
|
5
|
+
const OverlayContext = React.createContext(null);
|
|
6
|
+
const StyledView = styled.View({
|
|
7
|
+
flex: 1,
|
|
8
|
+
});
|
|
9
|
+
export const BottomActionBarOverlayProvider = ({ children }) => {
|
|
10
|
+
const [entries, setEntries] = React.useState([]);
|
|
11
|
+
const api = React.useMemo(() => ({
|
|
12
|
+
mount: (key, node) => {
|
|
13
|
+
setEntries(prev => {
|
|
14
|
+
const next = prev.filter(e => e.key !== key);
|
|
15
|
+
next.push({ key, node });
|
|
16
|
+
return next;
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
unmount: key => {
|
|
20
|
+
setEntries(prev => prev.filter(e => e.key !== key));
|
|
21
|
+
},
|
|
22
|
+
}), []);
|
|
23
|
+
return (_jsx(OverlayContext.Provider, { value: api, children: _jsxs(StyledView, { children: [children, _jsx(View, { style: StyleSheet.absoluteFill, pointerEvents: "box-none", children: entries.map(e => (_jsx(React.Fragment, { children: e.node }, e.key))) })] }) }));
|
|
24
|
+
};
|
|
25
|
+
export const useOverlayContext = () => {
|
|
26
|
+
const ctx = React.useContext(OverlayContext);
|
|
27
|
+
if (!ctx)
|
|
28
|
+
throw new Error('BottomActionOverlayProvider is missing above in the tree');
|
|
29
|
+
return ctx;
|
|
30
|
+
};
|
|
@@ -11,17 +11,26 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useEffect, useRef, useState } from 'react';
|
|
14
|
-
import { Animated } from 'react-native';
|
|
14
|
+
import { Animated, Pressable, View, } from 'react-native';
|
|
15
15
|
import { useBreakpoint } from '../../hooks';
|
|
16
16
|
import { useTheme } from '../../styled.native';
|
|
17
17
|
import { AnimatedStyledCard, BackgroundImage, TappableWrapper, } from './Card.styles';
|
|
18
18
|
export const getCardFlags = (props) => {
|
|
19
|
-
const { background, onPress, displayStyle } = props;
|
|
20
|
-
const
|
|
21
|
-
const
|
|
19
|
+
const { background, onPress, onSelect, displayStyle } = props;
|
|
20
|
+
const hasBackground = !!background;
|
|
21
|
+
const hasBgImage = hasBackground && typeof background !== 'string';
|
|
22
|
+
const selectable = Boolean(onSelect) && !onPress;
|
|
23
|
+
const pressable = Boolean(onPress) && !onSelect;
|
|
22
24
|
const isDefault = displayStyle === 'default';
|
|
23
25
|
const isOutline = displayStyle === 'outline';
|
|
24
|
-
return {
|
|
26
|
+
return {
|
|
27
|
+
hasBackground,
|
|
28
|
+
hasBgImage,
|
|
29
|
+
pressable,
|
|
30
|
+
selectable,
|
|
31
|
+
isDefault,
|
|
32
|
+
isOutline,
|
|
33
|
+
};
|
|
25
34
|
};
|
|
26
35
|
function useAnimatedBorder(baseColor, selectedColor, isSelected, duration) {
|
|
27
36
|
const borderAnim = useRef(new Animated.Value(0)).current;
|
|
@@ -31,45 +40,58 @@ function useAnimatedBorder(baseColor, selectedColor, isSelected, duration) {
|
|
|
31
40
|
duration,
|
|
32
41
|
useNativeDriver: false,
|
|
33
42
|
}).start();
|
|
34
|
-
}, [isSelected, duration]);
|
|
43
|
+
}, [isSelected, duration, borderAnim]);
|
|
35
44
|
return borderAnim.interpolate({
|
|
36
45
|
inputRange: [0, 1],
|
|
37
46
|
outputRange: [baseColor, selectedColor],
|
|
38
47
|
});
|
|
39
48
|
}
|
|
40
49
|
export const Card = (_a) => {
|
|
41
|
-
var { children, displayStyle = 'default', background, onPress } = _a, rest = __rest(_a, ["children", "displayStyle", "background", "onPress"]);
|
|
50
|
+
var { children, displayStyle = 'default', background, onPress, onSelect } = _a, rest = __rest(_a, ["children", "displayStyle", "background", "onPress", "onSelect"]);
|
|
42
51
|
const theme = useTheme();
|
|
43
52
|
const [isFocused, setFocused] = useState(false);
|
|
44
53
|
const [isSelected, setSelected] = useState(false);
|
|
45
54
|
const { largeAndUp } = useBreakpoint();
|
|
46
|
-
const { hasBgImage,
|
|
55
|
+
const { hasBackground, hasBgImage, pressable, selectable, isDefault, isOutline, } = getCardFlags({
|
|
47
56
|
background,
|
|
48
57
|
onPress,
|
|
49
58
|
displayStyle,
|
|
59
|
+
onSelect,
|
|
50
60
|
});
|
|
51
61
|
let baseBorderColor = theme.color.surface.bright;
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
else if (isDefault) {
|
|
56
|
-
if (hasBgImage)
|
|
62
|
+
if (isDefault) {
|
|
63
|
+
if (hasBgImage) {
|
|
57
64
|
baseBorderColor = 'transparent';
|
|
58
|
-
|
|
65
|
+
}
|
|
66
|
+
else if (typeof background === 'string') {
|
|
59
67
|
baseBorderColor = background;
|
|
60
|
-
|
|
61
|
-
baseBorderColor = theme.color.surface.bright;
|
|
68
|
+
}
|
|
62
69
|
}
|
|
63
70
|
const selectedBorderColor = theme.color.surface.onSurface;
|
|
64
|
-
const
|
|
71
|
+
const shouldHideBorder = hasBackground && !isOutline && !pressable && !selectable;
|
|
72
|
+
const animatedBorderColor = useAnimatedBorder(baseBorderColor, selectedBorderColor, selectable && isSelected, theme.transition.duration.fast);
|
|
65
73
|
const handlePress = () => {
|
|
66
|
-
setSelected(prev => !prev);
|
|
67
74
|
onPress === null || onPress === void 0 ? void 0 : onPress();
|
|
68
75
|
};
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
const handleSelect = () => {
|
|
77
|
+
setSelected(prev => !prev);
|
|
78
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect();
|
|
79
|
+
};
|
|
80
|
+
const CardContent = (_jsxs(AnimatedStyledCard, Object.assign({ displayStyle: displayStyle, background: background, largeAndUp: largeAndUp, onPress: onPress, onSelect: onSelect }, rest, { style: [
|
|
81
|
+
{
|
|
82
|
+
borderWidth: shouldHideBorder ? 0 : theme.border.width.md,
|
|
83
|
+
borderColor: animatedBorderColor,
|
|
84
|
+
},
|
|
85
|
+
rest === null || rest === void 0 ? void 0 : rest.style,
|
|
86
|
+
], children: [hasBgImage && (_jsx(BackgroundImage, { source: background, resizeMode: "cover", largeAndUp: largeAndUp })), children] })));
|
|
87
|
+
const isInteractive = pressable || selectable;
|
|
88
|
+
return (_jsx(TappableWrapper, Object.assign({ as: isInteractive ? Pressable : View, largeAndUp: largeAndUp, tappable: isInteractive, focused: isInteractive ? isFocused : false }, (isInteractive && {
|
|
89
|
+
onPress: pressable ? handlePress : handleSelect,
|
|
90
|
+
onFocus: () => setFocused(true),
|
|
91
|
+
onBlur: () => setFocused(false),
|
|
92
|
+
accessibilityRole: 'button',
|
|
93
|
+
style: ({ pressed }) => ({
|
|
73
94
|
opacity: pressed ? 0.9 : 1,
|
|
74
|
-
}),
|
|
95
|
+
}),
|
|
96
|
+
}), { children: CardContent })));
|
|
75
97
|
};
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { Animated, ImageBackground,
|
|
1
|
+
import { Animated, ImageBackground, View } from 'react-native';
|
|
2
2
|
import styled from '../../styled.native';
|
|
3
3
|
import { styledComponentWithBreakpoints } from '../../utils';
|
|
4
4
|
import { getCardFlags } from './Card';
|
|
5
|
-
const StyledCardBase = styled(View)(({ theme, displayStyle, background, onPress, largeAndUp, size, }) => {
|
|
6
|
-
const { hasBgImage,
|
|
5
|
+
const StyledCardBase = styled(View)(({ theme, displayStyle, background, onPress, onSelect, largeAndUp, size, }) => {
|
|
6
|
+
const { hasBgImage, pressable, selectable, isDefault } = getCardFlags({
|
|
7
7
|
background,
|
|
8
8
|
onPress,
|
|
9
|
+
onSelect,
|
|
9
10
|
displayStyle,
|
|
10
11
|
});
|
|
11
12
|
const backgroundColor = hasBgImage
|
|
12
13
|
? 'transparent'
|
|
13
14
|
: typeof background === 'string'
|
|
14
15
|
? background
|
|
15
|
-
: isDefault ||
|
|
16
|
+
: isDefault || pressable || selectable
|
|
16
17
|
? theme.color.surface.bright
|
|
17
18
|
: 'transparent';
|
|
18
|
-
return Object.assign(Object.assign({}, (size || {})), { padding: theme.space[400], position: 'relative',
|
|
19
|
+
return Object.assign(Object.assign({}, (size || {})), { padding: theme.space[400], position: 'relative', borderStyle: 'solid', borderRadius: theme.border.radius[largeAndUp ? '2xl' : 'lg'], overflow: 'hidden', backgroundColor });
|
|
19
20
|
});
|
|
20
21
|
const CardBase = styledComponentWithBreakpoints(StyledCardBase);
|
|
21
22
|
export const AnimatedStyledCard = Animated.createAnimatedComponent(CardBase);
|
|
@@ -28,15 +29,10 @@ export const BackgroundImage = styled(ImageBackground)(({ theme, largeAndUp }) =
|
|
|
28
29
|
borderRadius: theme.border.radius[largeAndUp ? '2xl' : 'lg'],
|
|
29
30
|
overflow: 'hidden',
|
|
30
31
|
}));
|
|
31
|
-
export const TappableWrapper = styled(
|
|
32
|
-
backgroundColor: 'transparent',
|
|
33
|
-
borderColor: focused ? theme.color.outline.outer : 'transparent',
|
|
34
|
-
borderWidth: theme.border.width.md,
|
|
35
|
-
borderRadius: largeAndUp ? 26 : theme.border.radius.xl,
|
|
36
|
-
padding: theme.space[50],
|
|
32
|
+
export const TappableWrapper = styled(View)(({ theme, focused, tappable, largeAndUp }) => (Object.assign(Object.assign({}, (tappable && {
|
|
37
33
|
shadowColor: '#000',
|
|
38
34
|
shadowOffset: { width: 0, height: theme.space[100] },
|
|
39
35
|
shadowOpacity: 0.1,
|
|
40
36
|
shadowRadius: theme.space[250],
|
|
41
37
|
elevation: theme.space[150],
|
|
42
|
-
}));
|
|
38
|
+
})), { backgroundColor: 'transparent', borderColor: focused ? theme.color.outline.outer : 'transparent', borderWidth: theme.border.width.md, borderRadius: largeAndUp ? 26 : theme.border.radius.xl, padding: theme.space[50] })));
|
|
@@ -70,10 +70,10 @@ export const CreditContainer = styled(View)(({ theme }) => ({
|
|
|
70
70
|
paddingBottom: theme.space[200],
|
|
71
71
|
}));
|
|
72
72
|
export const StyledDisplay4 = styled(Display4)(({ theme }) => ({
|
|
73
|
-
lineHeight: theme.font.lineHeight.d3.mediaQuery.sm
|
|
73
|
+
lineHeight: `${theme.font.lineHeight.d3.mediaQuery.sm}px`,
|
|
74
74
|
}));
|
|
75
75
|
export const StyledHeading1 = styled(Heading1)(({ theme }) => ({
|
|
76
|
-
lineHeight: theme.font.lineHeight.d4.mediaQuery.sm
|
|
76
|
+
lineHeight: `${theme.font.lineHeight.d4.mediaQuery.sm}px`,
|
|
77
77
|
}));
|
|
78
78
|
export const ErrorContainer = styled(View)(({ theme }) => ({
|
|
79
79
|
flexDirection: 'column',
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { Heading2, Heading3, Icon, P, Stack } from '../..';
|
|
4
|
+
import { useTheme } from '../../../styled.native';
|
|
5
|
+
import { checkIsSmall } from '../utils';
|
|
6
|
+
import { CardDisruptive } from './DisruptiveCard.styles';
|
|
7
|
+
const CARD_ICONS = {
|
|
8
|
+
success: 'check-circle',
|
|
9
|
+
info: 'info',
|
|
10
|
+
warning: 'info',
|
|
11
|
+
};
|
|
12
|
+
const getVariantStyles = (variant, theme) => {
|
|
13
|
+
switch (variant) {
|
|
14
|
+
case 'success':
|
|
15
|
+
return {
|
|
16
|
+
iconTextColor: theme.color.alert.success,
|
|
17
|
+
background: theme.color.brand.bright,
|
|
18
|
+
};
|
|
19
|
+
case 'info':
|
|
20
|
+
return {
|
|
21
|
+
iconTextColor: theme.color.alert.info,
|
|
22
|
+
background: theme.color.alert.infoTint,
|
|
23
|
+
};
|
|
24
|
+
case 'warning':
|
|
25
|
+
default:
|
|
26
|
+
return {
|
|
27
|
+
iconTextColor: theme.color.alert.warning,
|
|
28
|
+
background: theme.color.alert.warningTint,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
const DisruptiveHeading = ({ heading, size = 'default', color, }) => {
|
|
33
|
+
const HeadingComponent = checkIsSmall(size) ? Heading3 : Heading2;
|
|
34
|
+
const headingStyle = useMemo(() => ({ color }), [color]);
|
|
35
|
+
return _jsx(HeadingComponent, { style: headingStyle, children: heading });
|
|
36
|
+
};
|
|
37
|
+
export const DisruptiveCard = ({ variant = 'success', icon, heading, subHeading, size = 'default', }) => {
|
|
38
|
+
const theme = useTheme();
|
|
39
|
+
const { iconTextColor, background } = getVariantStyles(variant, theme);
|
|
40
|
+
return (_jsx(CardDisruptive, { background: background, isSmall: true, children: _jsxs(Stack, { spaceBetween: 1, children: [_jsx(Icon, { name: icon !== null && icon !== void 0 ? icon : CARD_ICONS[variant], size: 32, color: iconTextColor }), _jsx(DisruptiveHeading, { color: iconTextColor, heading: heading, size: size }), subHeading && !checkIsSmall(size) && (_jsx(P, { style: { color: iconTextColor }, children: subHeading }))] }) }));
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DisruptiveCard';
|
|
@@ -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,27 @@
|
|
|
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
|
+
justifyContent: 'space-between',
|
|
9
|
+
}));
|
|
10
|
+
export const TextContent = styled(View)(({ isSmall, theme }) => ({
|
|
11
|
+
flex: isSmall ? undefined : 1,
|
|
12
|
+
paddingRight: isSmall ? 0 : theme.space[100],
|
|
13
|
+
alignSelf: isSmall ? undefined : 'flex-end',
|
|
14
|
+
}));
|
|
15
|
+
export const HeadingContainer = styled(View)(({ theme, isSmall }) => ({
|
|
16
|
+
marginBottom: isSmall ? 0 : theme.space[200],
|
|
17
|
+
}));
|
|
18
|
+
export const ImageContent = styled(View)(({ theme, isSmall, hasBadge }) => ({
|
|
19
|
+
width: isSmall ? theme.space[1600] : theme.space[3000],
|
|
20
|
+
height: isSmall ? theme.space[1600] : theme.space[3000],
|
|
21
|
+
alignSelf: isSmall ? undefined : 'center',
|
|
22
|
+
marginTop: hasBadge && !isSmall ? -theme.space[400] : 0,
|
|
23
|
+
}));
|
|
24
|
+
export const CardImage = styled(Image)({
|
|
25
|
+
width: '100%',
|
|
26
|
+
height: '100%',
|
|
27
|
+
});
|
|
@@ -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,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from 'react';
|
|
3
|
+
import { useTheme } from '../../../styled.native';
|
|
4
|
+
import { Icon } from '../../Icon';
|
|
5
|
+
import { P } from '../../P';
|
|
6
|
+
import { ContainerWithCardBadge } from '../components';
|
|
7
|
+
import { checkIsSmall } from '../utils';
|
|
8
|
+
import { CardImage, CardWithOffer, EyebrowContainer, EyebrowText, HeadingText, IllustrationContainer, ImageContainer, SubHeadingContainer, TextContent, } from './OfferCard.styles';
|
|
9
|
+
const GraphicContent = ({ graphic }) => {
|
|
10
|
+
if (!graphic) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const resizeMode = graphic.type === 'image' ? 'cover' : 'contain';
|
|
14
|
+
return (_jsx(CardImage, { source: typeof graphic.source === 'string'
|
|
15
|
+
? { uri: graphic.source }
|
|
16
|
+
: graphic.source, resizeMode: resizeMode }));
|
|
17
|
+
};
|
|
18
|
+
export const OfferCard = ({ badgeText, graphic, eyebrowText, eyebrowIcon, heading, subHeading, size = 'default', onPress, }) => {
|
|
19
|
+
const theme = useTheme();
|
|
20
|
+
const hasBadge = !!badgeText;
|
|
21
|
+
const isSmall = checkIsSmall(size);
|
|
22
|
+
const [cardHeight, setCardHeight] = useState(0);
|
|
23
|
+
const onLayout = useCallback((e) => {
|
|
24
|
+
const { height: layoutHeight } = e.nativeEvent.layout;
|
|
25
|
+
setCardHeight(layoutHeight);
|
|
26
|
+
}, []);
|
|
27
|
+
const CardContent = (_jsxs(CardWithOffer, { isSmall: isSmall, onPress: onPress, onLayout: onLayout, children: [_jsxs(TextContent, { isSmall: isSmall, hasBadge: hasBadge, children: [(eyebrowIcon || eyebrowText) && (_jsxs(EyebrowContainer, { children: [eyebrowIcon && (_jsx(Icon, { name: eyebrowIcon, color: theme.color.brand.dim })), eyebrowText && _jsx(EyebrowText, { size: "sm", children: eyebrowText })] })), _jsx(HeadingText, { isSmall: isSmall, children: heading }), subHeading && (_jsx(SubHeadingContainer, { children: _jsx(P, { size: "sm", children: subHeading }) }))] }), (graphic === null || graphic === void 0 ? void 0 : graphic.type) === 'illustration' && (_jsx(IllustrationContainer, { hasBadge: hasBadge, isSmall: isSmall, children: _jsx(GraphicContent, { graphic: graphic }) })), (graphic === null || graphic === void 0 ? void 0 : graphic.type) === 'image' && (_jsx(ImageContainer, { isSmall: isSmall, cardHeight: cardHeight, children: _jsx(GraphicContent, { graphic: graphic }) }))] }));
|
|
28
|
+
if (!hasBadge) {
|
|
29
|
+
return CardContent;
|
|
30
|
+
}
|
|
31
|
+
return (_jsx(ContainerWithCardBadge, { badgeText: badgeText, children: CardContent }));
|
|
32
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Image, View } from 'react-native';
|
|
2
|
+
import { Heading4, P } from '../..';
|
|
3
|
+
import styled from '../../../styled.native';
|
|
4
|
+
import { CardWithMinHeight, SMALL_CARD_HEIGHT } from '../shared.styles';
|
|
5
|
+
export const CardWithOffer = styled(CardWithMinHeight)(({ isSmall }) => ({
|
|
6
|
+
padding: 0,
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: isSmall ? 'column-reverse' : 'row',
|
|
9
|
+
borderWidth: 0,
|
|
10
|
+
justifyContent: 'space-between',
|
|
11
|
+
}));
|
|
12
|
+
export const TextContent = styled(View)(({ isSmall, hasBadge, theme }) => ({
|
|
13
|
+
flex: isSmall ? undefined : 1,
|
|
14
|
+
paddingHorizontal: theme.space[400],
|
|
15
|
+
paddingTop: !isSmall && hasBadge ? theme.space[800] : theme.space[400],
|
|
16
|
+
paddingBottom: theme.space[400],
|
|
17
|
+
alignSelf: isSmall ? undefined : 'flex-end',
|
|
18
|
+
}));
|
|
19
|
+
export const EyebrowContainer = styled(View)(({ theme }) => ({
|
|
20
|
+
flexDirection: 'row',
|
|
21
|
+
gap: theme.space[50],
|
|
22
|
+
marginBottom: theme.space[100],
|
|
23
|
+
}));
|
|
24
|
+
export const EyebrowText = styled(P)(({ theme }) => ({
|
|
25
|
+
color: theme.color.brand.dim,
|
|
26
|
+
}));
|
|
27
|
+
export const HeadingText = styled(Heading4)(({ isSmall, theme }) => ({
|
|
28
|
+
color: theme.color.surface.onSurface,
|
|
29
|
+
fontSize: isSmall ? theme.font.size.md.mediaQuery.sm : undefined,
|
|
30
|
+
lineHeight: isSmall ? theme.font.lineHeight.md.mediaQuery.sm : undefined,
|
|
31
|
+
}));
|
|
32
|
+
export const SubHeadingContainer = styled(View)(({ theme }) => ({
|
|
33
|
+
marginTop: theme.space[100],
|
|
34
|
+
}));
|
|
35
|
+
export const IllustrationContainer = styled(View)(({ theme, isSmall, hasBadge }) => ({
|
|
36
|
+
width: isSmall ? theme.space[1600] : theme.space[3000],
|
|
37
|
+
height: isSmall ? theme.space[1600] : theme.space[3000],
|
|
38
|
+
alignSelf: isSmall ? undefined : 'center',
|
|
39
|
+
marginBottom: isSmall ? 0 : theme.space[400],
|
|
40
|
+
marginTop: hasBadge ? theme.space[800] : theme.space[400],
|
|
41
|
+
marginLeft: isSmall ? theme.space[400] : 0,
|
|
42
|
+
}));
|
|
43
|
+
export const ImageContainer = styled(View)(({ theme, isSmall, cardHeight = 0 }) => ({
|
|
44
|
+
height: isSmall
|
|
45
|
+
? theme.space[2400]
|
|
46
|
+
: cardHeight > 0
|
|
47
|
+
? cardHeight
|
|
48
|
+
: SMALL_CARD_HEIGHT,
|
|
49
|
+
width: !isSmall ? theme.space[3500] : undefined,
|
|
50
|
+
flexShrink: 0,
|
|
51
|
+
}));
|
|
52
|
+
export const CardImage = styled(Image)({
|
|
53
|
+
width: '100%',
|
|
54
|
+
height: '100%',
|
|
55
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './OfferCard';
|
|
@@ -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';
|