@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
|
@@ -9,10 +9,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
9
9
|
}
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { Field } from '../Field';
|
|
14
14
|
import { Select } from './Select';
|
|
15
15
|
export const SelectField = (_a) => {
|
|
16
|
-
var { error, options, onSelected, noOptionMessage, defaultSelected, testID, ref } = _a, rest = __rest(_a, ["error", "options", "onSelected", "noOptionMessage", "defaultSelected", "testID", "ref"]);
|
|
17
|
-
return (_jsx(Field, Object.assign({ affixWidth: 20, error: error }, rest, { children: _jsx(
|
|
16
|
+
var { error, options, onSelected, noOptionMessage, defaultSelected, size = 'medium', testID, ref } = _a, rest = __rest(_a, ["error", "options", "onSelected", "noOptionMessage", "defaultSelected", "size", "testID", "ref"]);
|
|
17
|
+
return (_jsx(Field, Object.assign({ affixWidth: 20, error: error }, rest, { children: _jsx(Select, { onSelected: onSelected, options: options, noOptionMessage: noOptionMessage, defaultSelected: defaultSelected, hasError: Boolean(error), size: size, testID: testID, ref: ref }) })));
|
|
18
18
|
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
2
|
+
import styled, { css } from '../../styled.native';
|
|
3
|
+
import { numToPx } from '../../theme';
|
|
4
|
+
import { getShadowCSS } from '../../utils';
|
|
5
|
+
import { P } from '../P';
|
|
6
|
+
export const SelectInput = styled.TouchableOpacity(({ theme, hasError, isSelected, size }) => {
|
|
7
|
+
const isSmall = size === 'small';
|
|
8
|
+
let borderColor = 'transparent';
|
|
9
|
+
/* prioritise error and selected states for border, even when focused */
|
|
10
|
+
if (hasError) {
|
|
11
|
+
borderColor = theme.color.alert.error;
|
|
12
|
+
}
|
|
13
|
+
else if (isSelected) {
|
|
14
|
+
borderColor = theme.color.surface.onSurface;
|
|
15
|
+
}
|
|
16
|
+
return css `
|
|
17
|
+
flex-direction: row;
|
|
18
|
+
align-items: center;
|
|
19
|
+
background-color: ${theme.color.surface.bright};
|
|
20
|
+
border-color: ${borderColor};
|
|
21
|
+
border-width: ${numToPx(theme.border.width.md)};
|
|
22
|
+
border-radius: ${numToPx(theme.border.radius.md)};
|
|
23
|
+
padding-top: ${numToPx(theme.space[isSmall ? 200 : 400])};
|
|
24
|
+
padding-bottom: ${numToPx(theme.space[isSmall ? 200 : 400])};
|
|
25
|
+
padding-left: ${numToPx(theme.space[400])};
|
|
26
|
+
padding-right: ${numToPx(theme.space[400])};
|
|
27
|
+
min-height: ${numToPx(theme.space[isSmall ? 1100 : 1600])};
|
|
28
|
+
${getShadowCSS({ theme })}
|
|
29
|
+
`;
|
|
30
|
+
});
|
|
31
|
+
export const DropdownWrapper = styled.TouchableOpacity(({ theme }) => css `
|
|
32
|
+
flex: 1;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
align-items: center;
|
|
35
|
+
|
|
36
|
+
/* 80 is an opacity for hex https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4 */
|
|
37
|
+
background-color: ${theme.color.brand.dark}80;
|
|
38
|
+
`);
|
|
39
|
+
export const DropdownContainer = styled(SafeAreaView)(({ theme }) => css `
|
|
40
|
+
width: 95%;
|
|
41
|
+
max-height: 70%;
|
|
42
|
+
border-radius: ${numToPx(theme.border.radius.md)};
|
|
43
|
+
background-color: ${theme.color.surface.bright};
|
|
44
|
+
`);
|
|
45
|
+
export const SelectOption = styled.TouchableOpacity(({ theme, isLastOption }) => css `
|
|
46
|
+
flex-direction: row;
|
|
47
|
+
align-items: center;
|
|
48
|
+
border-bottom-color: ${theme.color.input.borderDim};
|
|
49
|
+
border-bottom-width: ${isLastOption ? 0 : 1}px;
|
|
50
|
+
padding: 0 ${numToPx(theme.space[400])};
|
|
51
|
+
`);
|
|
52
|
+
export const Radio = styled.View(({ theme, isChecked }) => css `
|
|
53
|
+
background-color: ${isChecked
|
|
54
|
+
? theme.input.color.selectedTint
|
|
55
|
+
: 'transparent'};
|
|
56
|
+
width: ${numToPx(theme.space[600])};
|
|
57
|
+
height: ${numToPx(theme.space[600])};
|
|
58
|
+
margin-left: auto;
|
|
59
|
+
border-radius: ${numToPx(theme.space[600])};
|
|
60
|
+
border-width: ${numToPx(theme.border.width.md)};
|
|
61
|
+
border-color: ${theme.input.color[isChecked ? 'selected' : 'border']};
|
|
62
|
+
`);
|
|
63
|
+
export const RadioDot = styled.View(({ theme, isChecked }) => css `
|
|
64
|
+
background-color: ${theme.input.color.selected};
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: ${numToPx(theme.space[100])};
|
|
67
|
+
width: ${numToPx(theme.space[300])};
|
|
68
|
+
height: ${numToPx(theme.space[300])};
|
|
69
|
+
border-radius: ${numToPx(theme.space[300])};
|
|
70
|
+
align-self: center;
|
|
71
|
+
opacity: ${isChecked ? 1 : 0};
|
|
72
|
+
`);
|
|
73
|
+
export const StyledP = styled(P)(({ theme }) => css `
|
|
74
|
+
margin-top: ${numToPx(theme.space[300])};
|
|
75
|
+
margin-bottom: ${numToPx(theme.space[300])};
|
|
76
|
+
`);
|
|
77
|
+
export const StyledCategory = styled(P)(({ theme }) => css `
|
|
78
|
+
font-size: ${numToPx(theme.font.size.xs.mediaQuery.lg)};
|
|
79
|
+
color: ${theme.color.surface.onSurface};
|
|
80
|
+
background-color: ${theme.color.surface.surface};
|
|
81
|
+
padding: ${numToPx(theme.space[100])} ${numToPx(theme.space[400])};
|
|
82
|
+
`);
|
|
@@ -15,10 +15,10 @@ import { useBreakpoint } from '../../hooks';
|
|
|
15
15
|
import styled from '../../styled.native';
|
|
16
16
|
import { P } from '../P';
|
|
17
17
|
import { SkeletonAnimation } from '../SkeletonAnimation';
|
|
18
|
-
const StyledSkeletonText = styled.View(({ theme, aboveSmallBreakpoint, short, size,
|
|
18
|
+
const StyledSkeletonText = styled.View(({ theme, aboveSmallBreakpoint, short, size, isLast }) => {
|
|
19
19
|
return `
|
|
20
20
|
background-color: ${theme.color.surface.dim};
|
|
21
|
-
margin-bottom: ${
|
|
21
|
+
margin-bottom: ${isLast ? 0 : numToPx(theme.space[200])};
|
|
22
22
|
border-radius: ${numToPx(theme.border.radius.sm)};
|
|
23
23
|
height: ${aboveSmallBreakpoint
|
|
24
24
|
? numToPx(theme.font.size.md.mediaQuery.lg)
|
|
@@ -31,9 +31,9 @@ export const SkeletonText = (_a) => {
|
|
|
31
31
|
var { lines = 1, size } = _a, rest = __rest(_a, ["lines", "size"]);
|
|
32
32
|
const generatedLines = [];
|
|
33
33
|
const { smallAndUp } = useBreakpoint();
|
|
34
|
-
const hasMultipleLines = lines > 1;
|
|
35
34
|
for (let i = 1; i <= lines; i++) {
|
|
36
|
-
|
|
35
|
+
const isLast = i === lines;
|
|
36
|
+
generatedLines.push(_jsx(StyledSkeletonText, { short: lines > 1 && isLast, aboveSmallBreakpoint: smallAndUp, size: size, isLast: isLast }, `line-${i}`));
|
|
37
37
|
}
|
|
38
38
|
return (
|
|
39
39
|
// @ts-ignore styled components stuff
|
|
@@ -11,15 +11,21 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { numToPx } from '@ovotech/element-core';
|
|
14
|
+
import { useBreakpoint } from '../../hooks';
|
|
14
15
|
import styled, { css } from '../../styled.native';
|
|
15
16
|
import { Input } from '../Input/Input';
|
|
16
|
-
const StyledInput = styled(Input)(({ theme, rows }) =>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
const StyledInput = styled(Input)(({ theme, rows, smallAndUp, }) => {
|
|
18
|
+
const lineHeight = smallAndUp
|
|
19
|
+
? theme.font.lineHeight.md.mediaQuery.lg
|
|
20
|
+
: theme.font.lineHeight.md.mediaQuery.sm;
|
|
21
|
+
return css `
|
|
22
|
+
min-height: ${theme.space[800] * rows}px;
|
|
23
|
+
line-height: ${rows > 1 ? numToPx(lineHeight) : 'normal'};
|
|
24
|
+
`;
|
|
25
|
+
});
|
|
21
26
|
const TextareaInput = (_a) => {
|
|
22
27
|
var { rows = 3, ref } = _a, rest = __rest(_a, ["rows", "ref"]);
|
|
23
|
-
|
|
28
|
+
const breakpoints = useBreakpoint();
|
|
29
|
+
return (_jsx(StyledInput, Object.assign({}, rest, breakpoints, { keyboardType: "default", multiline: true, textAlignVertical: "top", rows: rows, ref: ref })));
|
|
24
30
|
};
|
|
25
31
|
export { TextareaInput };
|
|
@@ -17,7 +17,7 @@ import { HintText } from '../HintText/HintText';
|
|
|
17
17
|
import { LabelText } from '../LabelText';
|
|
18
18
|
import { StyledToggleDot, StyledToggleInput, StyledToggleInputWrapper, StyledWrapper, } from './styles';
|
|
19
19
|
const Input = (_a) => {
|
|
20
|
-
var { checked, labelPosition, testID } = _a, rest = __rest(_a, ["checked", "labelPosition", "testID"]);
|
|
20
|
+
var { checked, labelPosition, testID, toggleBackgroundColor } = _a, rest = __rest(_a, ["checked", "labelPosition", "testID", "toggleBackgroundColor"]);
|
|
21
21
|
const theme = useTheme();
|
|
22
22
|
const leftVal = useRef(new Animated.Value(checked ? theme.space[600] : theme.space[100])).current;
|
|
23
23
|
useEffect(() => {
|
|
@@ -27,12 +27,10 @@ const Input = (_a) => {
|
|
|
27
27
|
useNativeDriver: true,
|
|
28
28
|
}).start();
|
|
29
29
|
}, [checked]);
|
|
30
|
-
return (_jsx(StyledToggleInputWrapper, Object.assign({ labelPosition: labelPosition }, rest, { children: _jsx(StyledToggleInput, { checked: checked, testID: testID, children: _jsx(StyledToggleDot, { style: {
|
|
31
|
-
transform: [{ translateX: leftVal }],
|
|
32
|
-
}, checked: checked }) }) })));
|
|
30
|
+
return (_jsx(StyledToggleInputWrapper, Object.assign({ labelPosition: labelPosition }, rest, { children: _jsx(StyledToggleInput, { checked: checked, testID: testID, toggleBackgroundColor: toggleBackgroundColor, children: _jsx(StyledToggleDot, { style: { transform: [{ translateX: leftVal }] }, checked: checked }) }) })));
|
|
33
31
|
};
|
|
34
32
|
export const Toggle = (_a) => {
|
|
35
|
-
var { activeOpacity = 0.8, checked = false, label, hint, inline, labelPosition = 'left', testID, ref } = _a, rest = __rest(_a, ["activeOpacity", "checked", "label", "hint", "inline", "labelPosition", "testID", "ref"]);
|
|
33
|
+
var { activeOpacity = 0.8, checked = false, label, hint, inline, labelPosition = 'left', testID, ref, toggleBackgroundColor } = _a, rest = __rest(_a, ["activeOpacity", "checked", "label", "hint", "inline", "labelPosition", "testID", "ref", "toggleBackgroundColor"]);
|
|
36
34
|
const hasLabel = label !== undefined;
|
|
37
|
-
return (_jsxs(StyledWrapper, Object.assign({ ref: ref, accessible: true, accessibilityRole: "checkbox", activeOpacity: activeOpacity, accessibilityState: { checked }, hitSlop: 10, hasLabel: hasLabel, labelPosition: labelPosition, inline: inline }, rest, { children: [hasLabel ? (_jsxs(View, { style: { flexShrink: 1 }, children: [_jsx(LabelText, { children: label }), hint ? _jsx(HintText, { children: hint }) : null] })) : null, _jsx(Input, { checked: checked, testID: testID, labelPosition: hasLabel ? labelPosition : undefined })] })));
|
|
35
|
+
return (_jsxs(StyledWrapper, Object.assign({ ref: ref, accessible: true, accessibilityRole: "checkbox", activeOpacity: activeOpacity, accessibilityState: { checked }, hitSlop: 10, hasLabel: hasLabel, labelPosition: labelPosition, inline: inline }, rest, { children: [hasLabel ? (_jsxs(View, { style: { flexShrink: 1 }, children: [_jsx(LabelText, { children: label }), hint ? _jsx(HintText, { children: hint }) : null] })) : null, _jsx(Input, { checked: checked, testID: testID, labelPosition: hasLabel ? labelPosition : undefined, toggleBackgroundColor: toggleBackgroundColor })] })));
|
|
38
36
|
};
|
|
@@ -19,14 +19,14 @@ export const StyledToggleInputWrapper = styled.View(({ theme, labelPosition }) =
|
|
|
19
19
|
: ''}
|
|
20
20
|
`;
|
|
21
21
|
});
|
|
22
|
-
export const StyledToggleInput = styled.View(({ theme, checked }) => {
|
|
22
|
+
export const StyledToggleInput = styled.View(({ theme, checked, toggleBackgroundColor }) => {
|
|
23
23
|
return `
|
|
24
24
|
width: ${numToPx(theme.space[1100])};
|
|
25
25
|
height: ${numToPx(theme.space[600])};
|
|
26
26
|
justify-content: center;
|
|
27
27
|
border-radius: ${numToPx(theme.border.radius.lg)};
|
|
28
|
-
background: ${checked
|
|
29
|
-
? theme.color.outline.outer
|
|
28
|
+
background-color: ${checked
|
|
29
|
+
? toggleBackgroundColor || theme.color.outline.outer
|
|
30
30
|
: theme.color.surface.onSurfaceVariant};
|
|
31
31
|
`;
|
|
32
32
|
});
|
|
@@ -16,10 +16,13 @@ export * from './Divider';
|
|
|
16
16
|
export * from './Em';
|
|
17
17
|
export * from './EmailField';
|
|
18
18
|
export * from './EmailInput';
|
|
19
|
+
export * from './EmptyState';
|
|
20
|
+
export * from './ErrorWrapper';
|
|
19
21
|
export * from './Field';
|
|
20
22
|
export * from './Grid';
|
|
21
23
|
export * from './Heading';
|
|
22
24
|
export * from './Icon';
|
|
25
|
+
export * from './LargeValueReference';
|
|
23
26
|
export * from './LineThrough';
|
|
24
27
|
export * from './Link';
|
|
25
28
|
export * from './List';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useWindowDimensions } from 'react-native';
|
|
2
|
+
import { useBreakpoint } from './use-breakpoint.native';
|
|
3
|
+
/**
|
|
4
|
+
* A hook to get information about the current font scaling.
|
|
5
|
+
* It uses `useWindowDimensions` to get the `fontScale` and will update when it changes.
|
|
6
|
+
* It also uses `useBreakpoint` to only figure out scaling information below the small breakpoint, and otherwise returns defaults
|
|
7
|
+
*
|
|
8
|
+
* @returns An object with font scaling information.
|
|
9
|
+
*/
|
|
10
|
+
export function useFontScaling() {
|
|
11
|
+
const { smallAndUp } = useBreakpoint();
|
|
12
|
+
const { fontScale } = useWindowDimensions();
|
|
13
|
+
// For larger than "small" screens, we're not as concerned about font-scaling
|
|
14
|
+
// so we maintain defaults
|
|
15
|
+
if (smallAndUp) {
|
|
16
|
+
return {
|
|
17
|
+
fontScale: 1,
|
|
18
|
+
isFontScalingSmall: false,
|
|
19
|
+
isFontScalingLarge: false,
|
|
20
|
+
isFontScalingDefault: true,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const isFontScalingSmall = fontScale < 1;
|
|
24
|
+
const isFontScalingLarge = fontScale > 1;
|
|
25
|
+
const isFontScalingDefault = fontScale === 1;
|
|
26
|
+
return {
|
|
27
|
+
fontScale,
|
|
28
|
+
isFontScalingSmall,
|
|
29
|
+
isFontScalingLarge,
|
|
30
|
+
isFontScalingDefault,
|
|
31
|
+
};
|
|
32
|
+
}
|
package/dist/esm/index.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { themeNative } from '@ovotech/element-core';
|
|
3
|
+
import { render } from '@testing-library/react-native';
|
|
4
|
+
import { ThemeProvider } from '../styled.native';
|
|
5
|
+
function Wrapper({ children }) {
|
|
6
|
+
return _jsx(ThemeProvider, { theme: themeNative, children: children });
|
|
7
|
+
}
|
|
8
|
+
const customRender = (ui, options) => render(ui, Object.assign({ wrapper: Wrapper }, options));
|
|
9
|
+
// re-export everything
|
|
10
|
+
export * from '@testing-library/react-native';
|
|
11
|
+
// override render method
|
|
12
|
+
export { customRender as render };
|
package/dist/esm/utils/utils.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Children, } from 'react';
|
|
3
3
|
import { useBreakpoint } from '../hooks';
|
|
4
|
+
import { css } from '../styled.native';
|
|
5
|
+
import { numToPx } from '../theme';
|
|
4
6
|
function mergeRefs(...refs) {
|
|
5
7
|
return value => {
|
|
6
8
|
refs.forEach(ref => {
|
|
@@ -66,4 +68,13 @@ function filterChildrenByType(children, type) {
|
|
|
66
68
|
function getValidChildren(children) {
|
|
67
69
|
return Children.toArray(children).filter(Boolean);
|
|
68
70
|
}
|
|
69
|
-
|
|
71
|
+
function getShadowCSS({ theme, shadowColor, shadowOffsetX, shadowOffsetY, shadowOpacity = 0.1, shadowRadius, elevation = 5, }) {
|
|
72
|
+
return css `
|
|
73
|
+
shadow-color: ${shadowColor || theme.color.neutral.black};
|
|
74
|
+
shadow-offset: ${`${shadowOffsetX > 0 ? numToPx(shadowOffsetX) : 0} ${numToPx(shadowOffsetY || theme.space[100])}`};
|
|
75
|
+
shadow-opacity: ${shadowOpacity || '0.1'};
|
|
76
|
+
shadow-radius: ${numToPx(shadowRadius || theme.space[200])};
|
|
77
|
+
elevation: ${elevation || 5};
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
export { callAll, filterChildrenByType, getErrorMessage, getShadowCSS, getText, getValidChildren, mergeRefs, responsiveStyle, styledComponentWithBreakpoints, };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface FontScalingInfo {
|
|
2
|
+
/**
|
|
3
|
+
* The raw font scale factor.
|
|
4
|
+
*/
|
|
5
|
+
fontScale: number;
|
|
6
|
+
/**
|
|
7
|
+
* Indicates if the font scale is smaller than the default.
|
|
8
|
+
*/
|
|
9
|
+
isFontScalingSmall: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Indicates if the font scale is larger than the default.
|
|
12
|
+
*/
|
|
13
|
+
isFontScalingLarge: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Indicates if the font scale is at the default value (1).
|
|
16
|
+
*/
|
|
17
|
+
isFontScalingDefault: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A hook to get information about the current font scaling.
|
|
21
|
+
* It uses `useWindowDimensions` to get the `fontScale` and will update when it changes.
|
|
22
|
+
* It also uses `useBreakpoint` to only figure out scaling information below the small breakpoint, and otherwise returns defaults
|
|
23
|
+
*
|
|
24
|
+
* @returns An object with font scaling information.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useFontScaling(): FontScalingInfo;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useFontScaling = useFontScaling;
|
|
4
|
+
const react_native_1 = require("react-native");
|
|
5
|
+
const use_breakpoint_native_1 = require("./use-breakpoint.native");
|
|
6
|
+
/**
|
|
7
|
+
* A hook to get information about the current font scaling.
|
|
8
|
+
* It uses `useWindowDimensions` to get the `fontScale` and will update when it changes.
|
|
9
|
+
* It also uses `useBreakpoint` to only figure out scaling information below the small breakpoint, and otherwise returns defaults
|
|
10
|
+
*
|
|
11
|
+
* @returns An object with font scaling information.
|
|
12
|
+
*/
|
|
13
|
+
function useFontScaling() {
|
|
14
|
+
const { smallAndUp } = (0, use_breakpoint_native_1.useBreakpoint)();
|
|
15
|
+
const { fontScale } = (0, react_native_1.useWindowDimensions)();
|
|
16
|
+
// For larger than "small" screens, we're not as concerned about font-scaling
|
|
17
|
+
// so we maintain defaults
|
|
18
|
+
if (smallAndUp) {
|
|
19
|
+
return {
|
|
20
|
+
fontScale: 1,
|
|
21
|
+
isFontScalingSmall: false,
|
|
22
|
+
isFontScalingLarge: false,
|
|
23
|
+
isFontScalingDefault: true,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const isFontScalingSmall = fontScale < 1;
|
|
27
|
+
const isFontScalingLarge = fontScale > 1;
|
|
28
|
+
const isFontScalingDefault = fontScale === 1;
|
|
29
|
+
return {
|
|
30
|
+
fontScale,
|
|
31
|
+
isFontScalingSmall,
|
|
32
|
+
isFontScalingLarge,
|
|
33
|
+
isFontScalingDefault,
|
|
34
|
+
};
|
|
35
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./components"), exports);
|
|
18
|
+
__exportStar(require("./hooks"), exports);
|
|
18
19
|
__exportStar(require("./theme"), exports);
|
|
19
20
|
__exportStar(require("./utils"), exports);
|
package/dist/styled.native.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
39
39
|
"30": string;
|
|
40
40
|
"40": string;
|
|
41
41
|
"50": string;
|
|
42
|
+
"55": string;
|
|
42
43
|
"56": string;
|
|
43
44
|
"60": string;
|
|
44
45
|
"70": string;
|
|
@@ -81,6 +82,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
81
82
|
onBrandVariant: string;
|
|
82
83
|
aiGradientFrom: string;
|
|
83
84
|
aiGradientTo: string;
|
|
85
|
+
accessible: string;
|
|
84
86
|
fixed: {
|
|
85
87
|
brand: string;
|
|
86
88
|
dark: string;
|
|
@@ -89,6 +91,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
89
91
|
bright: string;
|
|
90
92
|
onBrand: string;
|
|
91
93
|
onBrandVariant: string;
|
|
94
|
+
accessible: string;
|
|
92
95
|
};
|
|
93
96
|
};
|
|
94
97
|
outline: {
|
|
@@ -613,6 +616,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
613
616
|
"30": string;
|
|
614
617
|
"40": string;
|
|
615
618
|
"50": string;
|
|
619
|
+
"55": string;
|
|
616
620
|
"56": string;
|
|
617
621
|
"60": string;
|
|
618
622
|
"70": string;
|
|
@@ -655,6 +659,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
655
659
|
onBrandVariant: string;
|
|
656
660
|
aiGradientFrom: string;
|
|
657
661
|
aiGradientTo: string;
|
|
662
|
+
accessible: string;
|
|
658
663
|
fixed: {
|
|
659
664
|
brand: string;
|
|
660
665
|
dark: string;
|
|
@@ -663,6 +668,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
663
668
|
bright: string;
|
|
664
669
|
onBrand: string;
|
|
665
670
|
onBrandVariant: string;
|
|
671
|
+
accessible: string;
|
|
666
672
|
};
|
|
667
673
|
};
|
|
668
674
|
outline: {
|
|
@@ -1187,6 +1193,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
1187
1193
|
"30": string;
|
|
1188
1194
|
"40": string;
|
|
1189
1195
|
"50": string;
|
|
1196
|
+
"55": string;
|
|
1190
1197
|
"56": string;
|
|
1191
1198
|
"60": string;
|
|
1192
1199
|
"70": string;
|
|
@@ -1229,6 +1236,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
1229
1236
|
onBrandVariant: string;
|
|
1230
1237
|
aiGradientFrom: string;
|
|
1231
1238
|
aiGradientTo: string;
|
|
1239
|
+
accessible: string;
|
|
1232
1240
|
fixed: {
|
|
1233
1241
|
brand: string;
|
|
1234
1242
|
dark: string;
|
|
@@ -1237,6 +1245,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
1237
1245
|
bright: string;
|
|
1238
1246
|
onBrand: string;
|
|
1239
1247
|
onBrandVariant: string;
|
|
1248
|
+
accessible: string;
|
|
1240
1249
|
};
|
|
1241
1250
|
};
|
|
1242
1251
|
outline: {
|
|
@@ -1761,6 +1770,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
1761
1770
|
"30": string;
|
|
1762
1771
|
"40": string;
|
|
1763
1772
|
"50": string;
|
|
1773
|
+
"55": string;
|
|
1764
1774
|
"56": string;
|
|
1765
1775
|
"60": string;
|
|
1766
1776
|
"70": string;
|
|
@@ -1803,6 +1813,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
1803
1813
|
onBrandVariant: string;
|
|
1804
1814
|
aiGradientFrom: string;
|
|
1805
1815
|
aiGradientTo: string;
|
|
1816
|
+
accessible: string;
|
|
1806
1817
|
fixed: {
|
|
1807
1818
|
brand: string;
|
|
1808
1819
|
dark: string;
|
|
@@ -1811,6 +1822,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
1811
1822
|
bright: string;
|
|
1812
1823
|
onBrand: string;
|
|
1813
1824
|
onBrandVariant: string;
|
|
1825
|
+
accessible: string;
|
|
1814
1826
|
};
|
|
1815
1827
|
};
|
|
1816
1828
|
outline: {
|
|
@@ -2335,6 +2347,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
2335
2347
|
"30": string;
|
|
2336
2348
|
"40": string;
|
|
2337
2349
|
"50": string;
|
|
2350
|
+
"55": string;
|
|
2338
2351
|
"56": string;
|
|
2339
2352
|
"60": string;
|
|
2340
2353
|
"70": string;
|
|
@@ -2377,6 +2390,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
2377
2390
|
onBrandVariant: string;
|
|
2378
2391
|
aiGradientFrom: string;
|
|
2379
2392
|
aiGradientTo: string;
|
|
2393
|
+
accessible: string;
|
|
2380
2394
|
fixed: {
|
|
2381
2395
|
brand: string;
|
|
2382
2396
|
dark: string;
|
|
@@ -2385,6 +2399,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
2385
2399
|
bright: string;
|
|
2386
2400
|
onBrand: string;
|
|
2387
2401
|
onBrandVariant: string;
|
|
2402
|
+
accessible: string;
|
|
2388
2403
|
};
|
|
2389
2404
|
};
|
|
2390
2405
|
outline: {
|
|
@@ -2909,6 +2924,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
2909
2924
|
"30": string;
|
|
2910
2925
|
"40": string;
|
|
2911
2926
|
"50": string;
|
|
2927
|
+
"55": string;
|
|
2912
2928
|
"56": string;
|
|
2913
2929
|
"60": string;
|
|
2914
2930
|
"70": string;
|
|
@@ -2951,6 +2967,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
2951
2967
|
onBrandVariant: string;
|
|
2952
2968
|
aiGradientFrom: string;
|
|
2953
2969
|
aiGradientTo: string;
|
|
2970
|
+
accessible: string;
|
|
2954
2971
|
fixed: {
|
|
2955
2972
|
brand: string;
|
|
2956
2973
|
dark: string;
|
|
@@ -2959,6 +2976,7 @@ declare const styled: styledComponents.ReactNativeStyledInterface<{
|
|
|
2959
2976
|
bright: string;
|
|
2960
2977
|
onBrand: string;
|
|
2961
2978
|
onBrandVariant: string;
|
|
2979
|
+
accessible: string;
|
|
2962
2980
|
};
|
|
2963
2981
|
};
|
|
2964
2982
|
outline: {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.render = void 0;
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const element_core_1 = require("@ovotech/element-core");
|
|
20
|
+
const react_native_1 = require("@testing-library/react-native");
|
|
21
|
+
const styled_native_1 = require("../styled.native");
|
|
22
|
+
function Wrapper({ children }) {
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(styled_native_1.ThemeProvider, { theme: element_core_1.themeNative, children: children });
|
|
24
|
+
}
|
|
25
|
+
const customRender = (ui, options) => (0, react_native_1.render)(ui, Object.assign({ wrapper: Wrapper }, options));
|
|
26
|
+
exports.render = customRender;
|
|
27
|
+
// re-export everything
|
|
28
|
+
__exportStar(require("@testing-library/react-native"), exports);
|
package/dist/utils/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentType, ReactElement, ReactNode, Ref, RefCallback, RefObject } from 'react';
|
|
2
2
|
import { View, ViewProps } from 'react-native';
|
|
3
3
|
import { BreakpointNames, Breakpoints } from '../hooks';
|
|
4
|
+
import { ThemeNative } from '../styled.native';
|
|
4
5
|
declare function mergeRefs<T>(...refs: Array<RefObject<T> | Ref<T> | undefined>): RefCallback<T>;
|
|
5
6
|
declare function getText(children: ReactNode): string;
|
|
6
7
|
declare function styledComponentWithBreakpoints<T = ViewProps, C = View>(Component: ComponentType<T>): (props: Omit<T, BreakpointNames> & (C extends ComponentType<any> ? import("react").ComponentProps<C> : object)) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,4 +13,13 @@ declare function getErrorMessage(id: string, errors: Array<{
|
|
|
12
13
|
declare function callAll(...fns: Array<Function | undefined>): (...args: any[]) => void;
|
|
13
14
|
declare function filterChildrenByType(children: ReactNode, type: ComponentType): ReactElement<any, string | import("react").JSXElementConstructor<any>>[];
|
|
14
15
|
declare function getValidChildren(children: ReactNode): ReactNode;
|
|
15
|
-
|
|
16
|
+
declare function getShadowCSS({ theme, shadowColor, shadowOffsetX, shadowOffsetY, shadowOpacity, shadowRadius, elevation, }: {
|
|
17
|
+
theme: ThemeNative;
|
|
18
|
+
shadowColor?: string;
|
|
19
|
+
shadowOffsetX?: number;
|
|
20
|
+
shadowOffsetY?: number;
|
|
21
|
+
shadowOpacity?: number;
|
|
22
|
+
shadowRadius?: number;
|
|
23
|
+
elevation?: number;
|
|
24
|
+
}): import("styled-components").FlattenSimpleInterpolation;
|
|
25
|
+
export { callAll, filterChildrenByType, getErrorMessage, getShadowCSS, getText, getValidChildren, mergeRefs, responsiveStyle, styledComponentWithBreakpoints, };
|
package/dist/utils/utils.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.callAll = callAll;
|
|
4
4
|
exports.filterChildrenByType = filterChildrenByType;
|
|
5
5
|
exports.getErrorMessage = getErrorMessage;
|
|
6
|
+
exports.getShadowCSS = getShadowCSS;
|
|
6
7
|
exports.getText = getText;
|
|
7
8
|
exports.getValidChildren = getValidChildren;
|
|
8
9
|
exports.mergeRefs = mergeRefs;
|
|
@@ -11,6 +12,8 @@ exports.styledComponentWithBreakpoints = styledComponentWithBreakpoints;
|
|
|
11
12
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
12
13
|
const react_1 = require("react");
|
|
13
14
|
const hooks_1 = require("../hooks");
|
|
15
|
+
const styled_native_1 = require("../styled.native");
|
|
16
|
+
const theme_1 = require("../theme");
|
|
14
17
|
function mergeRefs(...refs) {
|
|
15
18
|
return value => {
|
|
16
19
|
refs.forEach(ref => {
|
|
@@ -76,3 +79,12 @@ function filterChildrenByType(children, type) {
|
|
|
76
79
|
function getValidChildren(children) {
|
|
77
80
|
return react_1.Children.toArray(children).filter(Boolean);
|
|
78
81
|
}
|
|
82
|
+
function getShadowCSS({ theme, shadowColor, shadowOffsetX, shadowOffsetY, shadowOpacity = 0.1, shadowRadius, elevation = 5, }) {
|
|
83
|
+
return (0, styled_native_1.css) `
|
|
84
|
+
shadow-color: ${shadowColor || theme.color.neutral.black};
|
|
85
|
+
shadow-offset: ${`${shadowOffsetX > 0 ? (0, theme_1.numToPx)(shadowOffsetX) : 0} ${(0, theme_1.numToPx)(shadowOffsetY || theme.space[100])}`};
|
|
86
|
+
shadow-opacity: ${shadowOpacity || '0.1'};
|
|
87
|
+
shadow-radius: ${(0, theme_1.numToPx)(shadowRadius || theme.space[200])};
|
|
88
|
+
elevation: ${elevation || 5};
|
|
89
|
+
`;
|
|
90
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ovotech/element-native",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
],
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "
|
|
13
|
+
"url": "https://github.com/ovotech/element-design-system.git",
|
|
14
|
+
"directory": "packages/native"
|
|
14
15
|
},
|
|
15
16
|
"dependencies": {
|
|
16
17
|
"@backpackapp-io/react-native-toast": "^0.14.0",
|
|
@@ -28,7 +29,6 @@
|
|
|
28
29
|
"@testing-library/jest-dom": "^6.6.4",
|
|
29
30
|
"@testing-library/react": "^16.1.0",
|
|
30
31
|
"@testing-library/react-native": "^13.3.3",
|
|
31
|
-
"@testing-library/user-event": "^14.6.1",
|
|
32
32
|
"@types/jest": "^29.5.4",
|
|
33
33
|
"@types/lodash.groupby": "^4.6.9",
|
|
34
34
|
"@types/react": "^19.1.0",
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
"typescript": "^5.8.3"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"react-native-error-boundary": "^3.0.0",
|
|
64
63
|
"@react-native-masked-view/masked-view": "^0.3.2",
|
|
65
64
|
"react": "^19.1.0",
|
|
66
65
|
"react-native": "^0.74.2 | ^0.81.0",
|
|
66
|
+
"react-native-error-boundary": "^3.0.0",
|
|
67
67
|
"react-native-gesture-handler": "^2.28.0",
|
|
68
68
|
"react-native-reanimated": "^3.19.1",
|
|
69
69
|
"react-native-safe-area-context": "^5.6.1",
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|