@ovotech/element-native 2.2.0-canary-668a0ee-91 → 2.2.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/Accordion.d.ts +2 -2
- package/dist/components/Accordion/Accordion.js +24 -21
- package/dist/components/Accordion/Group.js +32 -10
- package/dist/components/Accordion/Icon.js +14 -19
- package/dist/components/Accordion/hooks.d.ts +1 -1
- package/dist/components/Accordion/hooks.js +26 -3
- package/dist/components/Accordion/styles.d.ts +46 -688
- package/dist/components/Accordion/styles.js +49 -56
- package/dist/components/Badge/Badge.d.ts +46 -54
- package/dist/components/Badge/Badge.js +20 -35
- package/dist/components/CTAButton/CTAButton.d.ts +12 -7
- package/dist/components/CTAButton/CTAButton.js +27 -23
- package/dist/components/CTALink/CTALink.d.ts +4 -4
- package/dist/components/CTALink/CTALink.js +27 -5
- package/dist/components/Card/Card.d.ts +45 -47
- package/dist/components/Card/Card.js +25 -5
- package/dist/components/Checkbox/Checkbox.d.ts +3 -3
- package/dist/components/Checkbox/Checkbox.js +57 -18
- package/dist/components/Checkbox/CheckboxField.js +37 -7
- package/dist/components/DataTable/DataTable.d.ts +12 -3
- package/dist/components/DataTable/DataTable.js +98 -11
- package/dist/components/DataTable/index.d.ts +0 -2
- package/dist/components/DataTable/index.js +0 -16
- package/dist/components/DateField/DateField.d.ts +2 -2
- package/dist/components/DateField/DateField.js +28 -9
- package/dist/components/DescriptionList/DescriptionList.js +32 -8
- package/dist/components/DescriptionList/styled.d.ts +44 -50
- package/dist/components/DescriptionList/styled.js +34 -9
- package/dist/components/Disclosure/Disclosure.d.ts +3 -3
- package/dist/components/Disclosure/Disclosure.js +18 -12
- package/dist/components/Divider/Divider.js +7 -4
- package/dist/components/ErrorSummaryNotification/ErrorSummaryNotification.d.ts +1 -1
- package/dist/components/ErrorSummaryNotification/ErrorSummaryNotification.js +28 -6
- package/dist/components/ErrorText/ErrorText.d.ts +39 -45
- package/dist/components/ErrorText/ErrorText.js +4 -7
- package/dist/components/Field/Field.d.ts +2 -2
- package/dist/components/Field/Field.js +49 -18
- package/dist/components/FormGroup/FormGroup.js +3 -2
- package/dist/components/Grid/Col.d.ts +39 -45
- package/dist/components/Grid/Col.js +3 -4
- package/dist/components/Grid/Row.d.ts +41 -47
- package/dist/components/Grid/Row.js +10 -7
- package/dist/components/Heading/Heading.js +32 -21
- package/dist/components/HintText/HintText.d.ts +39 -45
- package/dist/components/HintText/HintText.js +4 -7
- package/dist/components/Icon/Icon.d.ts +4 -3
- package/dist/components/Icon/Icon.js +27 -5
- package/dist/components/Input/CurrencyInput.d.ts +6 -6
- package/dist/components/Input/CurrencyInput.js +25 -3
- package/dist/components/Input/EmailInput.d.ts +6 -6
- package/dist/components/Input/EmailInput.js +25 -3
- package/dist/components/Input/Input.d.ts +8 -8
- package/dist/components/Input/Input.js +32 -26
- package/dist/components/Input/NumberInput.d.ts +6 -6
- package/dist/components/Input/NumberInput.js +25 -3
- package/dist/components/Input/PasswordInput.d.ts +6 -6
- package/dist/components/Input/PasswordInput.js +25 -3
- package/dist/components/Input/PasswordInput.styled.d.ts +39 -45
- package/dist/components/Input/PasswordInput.styled.js +5 -2
- package/dist/components/Input/PasswordVisibilityToggle.js +29 -14
- package/dist/components/Input/TelInput.d.ts +10 -0
- package/dist/components/Input/TelInput.js +41 -0
- package/dist/components/Input/TextInput.d.ts +6 -6
- package/dist/components/Input/TextInput.js +25 -3
- package/dist/components/Input/TextareaInput.d.ts +6 -6
- package/dist/components/Input/TextareaInput.js +10 -13
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Input/index.js +3 -3
- package/dist/components/LabelText/LabelText.d.ts +39 -45
- package/dist/components/LabelText/LabelText.js +4 -5
- package/dist/components/List/List.d.ts +131 -149
- package/dist/components/List/List.js +44 -30
- package/dist/components/Margin/Margin.d.ts +39 -45
- package/dist/components/Margin/Margin.js +3 -3
- package/dist/components/NavHeader/NavHeader.d.ts +1 -1
- package/dist/components/NavHeader/NavHeader.js +35 -34
- package/dist/components/Notification/Notification.d.ts +100 -104
- package/dist/components/Notification/Notification.js +49 -32
- package/dist/components/Radio/Radio.d.ts +3 -3
- package/dist/components/Radio/Radio.js +61 -16
- package/dist/components/Radio/RadioField.js +41 -11
- package/dist/components/SkeletonLoading/Skeleton.d.ts +39 -45
- package/dist/components/SkeletonLoading/SkeletonAnimation.js +33 -22
- package/dist/components/SkeletonLoading/SkeletonCTA.js +5 -4
- package/dist/components/SkeletonLoading/SkeletonCircle.js +6 -4
- package/dist/components/SkeletonLoading/SkeletonHeading.js +5 -4
- package/dist/components/SkeletonLoading/SkeletonText.js +5 -5
- package/dist/components/Stack/Stack.js +28 -6
- package/dist/components/Stretch/Stretch.js +2 -2
- package/dist/components/SubLabelText/SubLabelText.d.ts +39 -45
- package/dist/components/SubLabelText/SubLabelText.js +4 -5
- package/dist/components/SummaryList/SummaryList.js +32 -8
- package/dist/components/Tabs/Tab.d.ts +4 -4
- package/dist/components/Tabs/Tab.js +20 -23
- package/dist/components/Tabs/TabList.d.ts +222 -11
- package/dist/components/Tabs/TabList.js +18 -22
- package/dist/components/Tabs/TabPanel.js +10 -33
- package/dist/components/Tabs/Tabs.d.ts +227 -8
- package/dist/components/Tabs/Tabs.js +23 -26
- package/dist/components/Text/Text.d.ts +204 -234
- package/dist/components/Text/Text.js +20 -17
- package/dist/components/TextField/CurrencyField.d.ts +6 -6
- package/dist/components/TextField/CurrencyField.js +26 -3
- package/dist/components/TextField/EmailField.d.ts +6 -6
- package/dist/components/TextField/EmailField.js +26 -3
- package/dist/components/TextField/NumberField.d.ts +6 -6
- package/dist/components/TextField/NumberField.js +26 -3
- package/dist/components/TextField/PasswordField.d.ts +6 -6
- package/dist/components/TextField/PasswordField.js +26 -3
- package/dist/components/TextField/TelField.d.ts +6 -10
- package/dist/components/TextField/TelField.js +27 -9
- package/dist/components/TextField/TextField.d.ts +6 -6
- package/dist/components/TextField/TextField.js +26 -3
- package/dist/components/TextField/TextareaField.d.ts +6 -6
- package/dist/components/TextField/TextareaField.js +26 -3
- package/dist/components/TextField/index.d.ts +0 -1
- package/dist/components/TextField/index.js +1 -3
- package/dist/components/TextLink/TextLink.d.ts +4 -4
- package/dist/components/TextLink/TextLink.js +8 -5
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.js +0 -1
- package/dist/esm/components/Accordion/Accordion.js +26 -23
- package/dist/esm/components/Accordion/Group.js +9 -10
- package/dist/esm/components/Accordion/Icon.js +12 -20
- package/dist/esm/components/Accordion/hooks.js +3 -3
- package/dist/esm/components/Accordion/styles.js +48 -29
- package/dist/esm/components/Badge/Badge.js +17 -35
- package/dist/esm/components/CTAButton/CTAButton.js +28 -24
- package/dist/esm/components/CTALink/CTALink.js +4 -5
- package/dist/esm/components/Card/Card.js +25 -5
- package/dist/esm/components/Checkbox/Checkbox.js +34 -15
- package/dist/esm/components/Checkbox/CheckboxField.js +14 -7
- package/dist/esm/components/DataTable/DataTable.js +74 -10
- package/dist/esm/components/DataTable/index.js +0 -2
- package/dist/esm/components/DateField/DateField.js +28 -9
- package/dist/esm/components/DescriptionList/DescriptionList.js +9 -8
- package/dist/esm/components/DescriptionList/styled.js +31 -9
- package/dist/esm/components/Disclosure/Disclosure.js +19 -13
- package/dist/esm/components/Divider/Divider.js +4 -4
- package/dist/esm/components/ErrorSummaryNotification/ErrorSummaryNotification.js +5 -6
- package/dist/esm/components/ErrorText/ErrorText.js +4 -7
- package/dist/esm/components/Field/Field.js +26 -18
- package/dist/esm/components/FormGroup/FormGroup.js +3 -2
- package/dist/esm/components/Grid/Col.js +3 -4
- package/dist/esm/components/Grid/Row.js +7 -7
- package/dist/esm/components/Heading/Heading.js +29 -21
- package/dist/esm/components/HintText/HintText.js +4 -7
- package/dist/esm/components/Icon/Icon.js +4 -5
- package/dist/esm/components/Input/CurrencyInput.js +2 -3
- package/dist/esm/components/Input/EmailInput.js +2 -3
- package/dist/esm/components/Input/Input.js +33 -27
- package/dist/esm/components/Input/NumberInput.js +2 -3
- package/dist/esm/components/Input/PasswordInput.js +2 -3
- package/dist/esm/components/Input/PasswordInput.styled.js +5 -2
- package/dist/esm/components/Input/PasswordVisibilityToggle.js +7 -15
- package/dist/esm/components/Input/{PhoneInput.js → TelInput.js} +3 -4
- package/dist/esm/components/Input/TextInput.js +2 -3
- package/dist/esm/components/Input/TextareaInput.js +10 -13
- package/dist/esm/components/Input/index.js +1 -1
- package/dist/esm/components/LabelText/LabelText.js +4 -5
- package/dist/esm/components/List/List.js +45 -31
- package/dist/esm/components/Margin/Margin.js +3 -3
- package/dist/esm/components/NavHeader/NavHeader.js +32 -34
- package/dist/esm/components/Notification/Notification.js +50 -33
- package/dist/esm/components/Radio/Radio.js +38 -16
- package/dist/esm/components/Radio/RadioField.js +18 -11
- package/dist/esm/components/SkeletonLoading/SkeletonAnimation.js +11 -23
- package/dist/esm/components/SkeletonLoading/SkeletonCTA.js +5 -4
- package/dist/esm/components/SkeletonLoading/SkeletonCircle.js +6 -4
- package/dist/esm/components/SkeletonLoading/SkeletonHeading.js +5 -4
- package/dist/esm/components/SkeletonLoading/SkeletonText.js +5 -5
- package/dist/esm/components/Stack/Stack.js +5 -6
- package/dist/esm/components/Stretch/Stretch.js +2 -2
- package/dist/esm/components/SubLabelText/SubLabelText.js +4 -5
- package/dist/esm/components/SummaryList/SummaryList.js +9 -8
- package/dist/esm/components/Tabs/Tab.js +17 -23
- package/dist/esm/components/Tabs/TabList.js +18 -21
- package/dist/esm/components/Tabs/TabPanel.js +7 -10
- package/dist/esm/components/Tabs/Tabs.js +23 -25
- package/dist/esm/components/Text/Text.js +20 -17
- package/dist/esm/components/TextField/CurrencyField.js +3 -3
- package/dist/esm/components/TextField/EmailField.js +3 -3
- package/dist/esm/components/TextField/NumberField.js +3 -3
- package/dist/esm/components/TextField/PasswordField.js +3 -3
- package/dist/esm/components/TextField/TelField.js +4 -9
- package/dist/esm/components/TextField/TextField.js +3 -3
- package/dist/esm/components/TextField/TextareaField.js +3 -3
- package/dist/esm/components/TextField/index.js +0 -1
- package/dist/esm/components/TextLink/TextLink.js +8 -5
- package/dist/esm/components/index.js +0 -1
- package/dist/esm/hooks/use-breakpoint.js +4 -4
- package/dist/esm/providers/IconsProvider.js +2 -3
- package/dist/esm/providers/icons/ArrowDown.js +3 -2
- package/dist/esm/providers/icons/ArrowLeft.js +3 -2
- package/dist/esm/providers/icons/ArrowRight.js +3 -2
- package/dist/esm/providers/icons/ArrowUp.js +3 -2
- package/dist/esm/providers/icons/CaretDown.js +3 -2
- package/dist/esm/providers/icons/CaretLeft.js +3 -2
- package/dist/esm/providers/icons/CaretRight.js +3 -2
- package/dist/esm/providers/icons/CaretUp.js +3 -2
- package/dist/esm/providers/icons/Chart.js +3 -2
- package/dist/esm/providers/icons/Check.js +3 -2
- package/dist/esm/providers/icons/ChevronDown.js +3 -2
- package/dist/esm/providers/icons/ChevronLeft.js +3 -2
- package/dist/esm/providers/icons/ChevronLeftSmall.js +3 -2
- package/dist/esm/providers/icons/ChevronLeftSmallFirst.js +3 -2
- package/dist/esm/providers/icons/ChevronRight.js +3 -2
- package/dist/esm/providers/icons/ChevronRightSmall.js +3 -2
- package/dist/esm/providers/icons/ChevronRightSmallLast.js +3 -2
- package/dist/esm/providers/icons/ChevronUp.js +3 -2
- package/dist/esm/providers/icons/Cross.js +3 -2
- package/dist/esm/providers/icons/Dollar.js +3 -2
- package/dist/esm/providers/icons/Download.js +3 -2
- package/dist/esm/providers/icons/Electricity.js +3 -2
- package/dist/esm/providers/icons/Euro.js +3 -2
- package/dist/esm/providers/icons/Gas.js +4 -2
- package/dist/esm/providers/icons/Help.js +3 -2
- package/dist/esm/providers/icons/Hide.js +3 -2
- package/dist/esm/providers/icons/Home.js +3 -2
- package/dist/esm/providers/icons/Info.js +3 -2
- package/dist/esm/providers/icons/Link.js +4 -2
- package/dist/esm/providers/icons/Logo.js +4 -3
- package/dist/esm/providers/icons/Minus.js +3 -2
- package/dist/esm/providers/icons/NewWindow.js +3 -2
- package/dist/esm/providers/icons/PaymentCard.js +3 -2
- package/dist/esm/providers/icons/Plus.js +3 -2
- package/dist/esm/providers/icons/Pound.js +3 -2
- package/dist/esm/providers/icons/Search.js +3 -2
- package/dist/esm/providers/icons/Show.js +3 -2
- package/dist/esm/providers/icons/User.js +3 -2
- package/dist/esm/theme/create-theme.js +153 -0
- package/dist/esm/utils/utils.js +3 -7
- package/dist/hooks/use-breakpoint.js +4 -4
- package/dist/providers/IconsProvider.js +25 -3
- package/dist/providers/icons/ArrowDown.js +6 -2
- package/dist/providers/icons/ArrowLeft.js +6 -2
- package/dist/providers/icons/ArrowRight.js +6 -2
- package/dist/providers/icons/ArrowUp.js +6 -2
- package/dist/providers/icons/CaretDown.js +6 -2
- package/dist/providers/icons/CaretLeft.js +6 -2
- package/dist/providers/icons/CaretRight.js +6 -2
- package/dist/providers/icons/CaretUp.js +6 -2
- package/dist/providers/icons/Chart.js +6 -2
- package/dist/providers/icons/Check.js +6 -2
- package/dist/providers/icons/ChevronDown.js +6 -2
- package/dist/providers/icons/ChevronLeft.js +6 -2
- package/dist/providers/icons/ChevronLeftSmall.js +6 -2
- package/dist/providers/icons/ChevronLeftSmallFirst.js +6 -2
- package/dist/providers/icons/ChevronRight.js +6 -2
- package/dist/providers/icons/ChevronRightSmall.js +6 -2
- package/dist/providers/icons/ChevronRightSmallLast.js +6 -2
- package/dist/providers/icons/ChevronUp.js +6 -2
- package/dist/providers/icons/Cross.js +6 -2
- package/dist/providers/icons/Dollar.js +6 -2
- package/dist/providers/icons/Download.js +6 -2
- package/dist/providers/icons/Electricity.js +6 -2
- package/dist/providers/icons/Euro.js +6 -2
- package/dist/providers/icons/Gas.js +7 -2
- package/dist/providers/icons/Help.js +6 -2
- package/dist/providers/icons/Hide.js +6 -2
- package/dist/providers/icons/Home.js +6 -2
- package/dist/providers/icons/Info.js +6 -2
- package/dist/providers/icons/Link.js +7 -2
- package/dist/providers/icons/Logo.js +6 -2
- package/dist/providers/icons/Minus.js +6 -2
- package/dist/providers/icons/NewWindow.js +6 -2
- package/dist/providers/icons/PaymentCard.js +6 -2
- package/dist/providers/icons/Plus.js +6 -2
- package/dist/providers/icons/Pound.js +6 -2
- package/dist/providers/icons/Search.js +6 -2
- package/dist/providers/icons/Show.js +6 -2
- package/dist/providers/icons/User.js +6 -2
- package/dist/styled.native.d.ts +234 -270
- package/dist/theme/create-theme.js +153 -0
- package/dist/theme/index.d.ts +39 -45
- package/dist/theme/theme.d.ts +90 -0
- package/dist/utils/utils.d.ts +4 -5
- package/dist/utils/utils.js +26 -8
- package/package.json +5 -6
- package/dist/components/DataTable/TableRow.d.ts +0 -2
- package/dist/components/DataTable/TableRow.js +0 -31
- package/dist/components/DataTable/styles.d.ts +0 -2517
- package/dist/components/DataTable/styles.js +0 -77
- package/dist/components/DataTable/types.d.ts +0 -15
- package/dist/components/DataTable/types.js +0 -2
- package/dist/components/Input/PhoneInput.d.ts +0 -10
- package/dist/components/Input/PhoneInput.js +0 -19
- package/dist/components/SelectField/Select.d.ts +0 -244
- package/dist/components/SelectField/Select.js +0 -102
- package/dist/components/SelectField/SelectField.d.ts +0 -7
- package/dist/components/SelectField/SelectField.js +0 -33
- package/dist/components/SelectField/index.d.ts +0 -1
- package/dist/components/SelectField/index.js +0 -5
- package/dist/components/TextField/PhoneField.d.ts +0 -10
- package/dist/components/TextField/PhoneField.js +0 -33
- package/dist/esm/components/DataTable/TableRow.js +0 -27
- package/dist/esm/components/DataTable/styles.js +0 -51
- package/dist/esm/components/DataTable/types.js +0 -1
- package/dist/esm/components/SelectField/Select.js +0 -75
- package/dist/esm/components/SelectField/SelectField.js +0 -29
- package/dist/esm/components/SelectField/index.js +0 -1
- package/dist/esm/components/TextField/PhoneField.js +0 -30
|
@@ -24,15 +24,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
24
|
};
|
|
25
25
|
return __assign.apply(this, arguments);
|
|
26
26
|
};
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import Animated, {
|
|
30
|
-
import {
|
|
31
|
-
import { pxToNumber } from '../../utils';
|
|
27
|
+
import React, { useCallback, useMemo, useEffect, useState, } from 'react';
|
|
28
|
+
import { View, TouchableOpacity } from 'react-native';
|
|
29
|
+
import Animated, { useSharedValue, useAnimatedStyle, useDerivedValue, withTiming, runOnUI, interpolateColor, } from 'react-native-reanimated';
|
|
30
|
+
import { theme } from '../../theme';
|
|
32
31
|
import { Heading3 } from '../Heading';
|
|
33
32
|
import { AccordionIcon } from './Icon';
|
|
34
33
|
import { useLayout } from './hooks';
|
|
35
|
-
import {
|
|
34
|
+
import { styles } from './styles';
|
|
35
|
+
var _a = theme.colors, canvas = _a.canvas, canvasMuted = _a.canvasMuted, primary = _a.primary, greyDarker = _a.brand.grey.darker;
|
|
36
36
|
export function withAnimated(WrappedComponent) {
|
|
37
37
|
var displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
38
38
|
// eslint-disable-next-line react/prefer-stateless-function
|
|
@@ -42,21 +42,20 @@ export function withAnimated(WrappedComponent) {
|
|
|
42
42
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
43
43
|
}
|
|
44
44
|
WithAnimated.prototype.render = function () {
|
|
45
|
-
return
|
|
45
|
+
return React.createElement(WrappedComponent, __assign({}, this.props));
|
|
46
46
|
};
|
|
47
47
|
WithAnimated.displayName = "WithAnimated(".concat(displayName, ")");
|
|
48
48
|
return WithAnimated;
|
|
49
|
-
}(Component));
|
|
49
|
+
}(React.Component));
|
|
50
50
|
return Animated.createAnimatedComponent(WithAnimated);
|
|
51
51
|
}
|
|
52
52
|
export var Accordion = function (_a) {
|
|
53
53
|
var _b = _a.expanded, expanded = _b === void 0 ? false : _b, first = _a.first, _c = _a.headingComponent, headingComponent = _c === void 0 ? Heading3 : _c, last = _a.last, title = _a.title, children = _a.children, onToggle = _a.onToggle;
|
|
54
|
-
var _d = useContext(ThemeContext), core = _d.core, semantic = _d.semantic;
|
|
55
54
|
var AnimatedHeading = useMemo(function () { return withAnimated(headingComponent); }, [
|
|
56
55
|
headingComponent,
|
|
57
56
|
]);
|
|
58
|
-
var
|
|
59
|
-
var
|
|
57
|
+
var _d = useLayout(0), layout = _d[0], onLayout = _d[1];
|
|
58
|
+
var _e = useState(expanded), open = _e[0], setOpen = _e[1];
|
|
60
59
|
var handleHeightContent = useMemo(function () { return layout.height || 100; }, [
|
|
61
60
|
layout.height,
|
|
62
61
|
]);
|
|
@@ -91,18 +90,22 @@ export var Accordion = function (_a) {
|
|
|
91
90
|
}
|
|
92
91
|
setOpen(function (o) { return !o; });
|
|
93
92
|
}, [handleHeightContent, open, size]);
|
|
94
|
-
var containerAnimatedStyle = useMemo(function () { return [
|
|
93
|
+
var containerAnimatedStyle = useMemo(function () { return [styles.content, style]; }, [style]);
|
|
95
94
|
var headerStyle = useAnimatedStyle(function () { return ({
|
|
96
|
-
color: interpolateColor(progress.value, [0, 1], [
|
|
95
|
+
color: interpolateColor(progress.value, [0, 1], [greyDarker, primary]),
|
|
97
96
|
}); });
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
var backgroundStyle = useAnimatedStyle(function () { return ({
|
|
98
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], [canvas, canvasMuted]),
|
|
99
|
+
}); });
|
|
100
|
+
return (React.createElement(Animated.View, { style: [
|
|
101
|
+
backgroundStyle,
|
|
102
|
+
styles.accordion,
|
|
103
|
+
first ? styles.topItem : null,
|
|
104
|
+
last ? styles.bottomItem : null,
|
|
105
|
+
] },
|
|
106
|
+
React.createElement(TouchableOpacity, { accessibilityState: { expanded: open }, onPress: toggleOpen, style: styles.accordionHeader, testID: "accordionTitle" },
|
|
107
|
+
React.createElement(AnimatedHeading, { style: [headerStyle, styles.accordionHeaderText] }, title),
|
|
108
|
+
React.createElement(AccordionIcon, { animationTiming: progress })),
|
|
109
|
+
React.createElement(Animated.View, { style: containerAnimatedStyle },
|
|
110
|
+
React.createElement(View, { onLayout: onLayout, style: styles.container }, children))));
|
|
108
111
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Children, cloneElement, isValidElement, } from 'react';
|
|
1
|
+
import React, { Children, cloneElement, isValidElement, } from 'react';
|
|
3
2
|
import { View } from 'react-native';
|
|
4
3
|
export var AccordionGroup = function (_a) {
|
|
5
4
|
var children = _a.children;
|
|
6
5
|
var childCount = Children.count(children);
|
|
7
|
-
return (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
return (React.createElement(View, null, Children.map(children, function (child, i) {
|
|
7
|
+
return isValidElement(child)
|
|
8
|
+
? cloneElement(child, {
|
|
9
|
+
first: i === 0,
|
|
10
|
+
last: i === childCount - 1,
|
|
11
|
+
})
|
|
12
|
+
: child;
|
|
13
|
+
})));
|
|
15
14
|
};
|
|
@@ -1,26 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useContext } from 'react';
|
|
14
|
-
import Animated, { interpolateColor, useAnimatedProps, useAnimatedStyle, } from 'react-native-reanimated';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Animated, { useAnimatedStyle, interpolateColor, useAnimatedProps, } from 'react-native-reanimated';
|
|
15
3
|
import { Path, Svg } from 'react-native-svg';
|
|
16
|
-
import {
|
|
4
|
+
import { theme } from '../../theme';
|
|
5
|
+
var _a = theme.colors, canvas = _a.canvas, primary = _a.primary, primaryMuted = _a.primaryMuted;
|
|
17
6
|
var OVO_LOGO_ANGLE = 105;
|
|
18
7
|
var AnimatedPath = Animated.createAnimatedComponent(Path);
|
|
19
8
|
export function AccordionIcon(_a) {
|
|
20
9
|
var animationTiming = _a.animationTiming;
|
|
21
|
-
var _b = useContext(ThemeContext), core = _b.core, semantic = _b.semantic;
|
|
22
10
|
var outerAnimatedStyles = useAnimatedStyle(function () { return ({
|
|
23
|
-
backgroundColor: interpolateColor(animationTiming.value, [0, 1], [
|
|
11
|
+
backgroundColor: interpolateColor(animationTiming.value, [0, 1], [primaryMuted, primary]),
|
|
24
12
|
height: 36 - animationTiming.value * 4,
|
|
25
13
|
margin: 2 * animationTiming.value,
|
|
26
14
|
transform: [{ rotateZ: animationTiming.value * -OVO_LOGO_ANGLE + 'deg' }],
|
|
@@ -34,13 +22,17 @@ export function AccordionIcon(_a) {
|
|
|
34
22
|
var minusAnimatedProps = useAnimatedProps(function () { return ({
|
|
35
23
|
opacity: animationTiming.value,
|
|
36
24
|
}); });
|
|
37
|
-
return (
|
|
25
|
+
return (React.createElement(Animated.View, { style: [
|
|
38
26
|
{
|
|
39
|
-
backgroundColor:
|
|
27
|
+
backgroundColor: primaryMuted,
|
|
40
28
|
aspectRatio: 1,
|
|
41
29
|
alignItems: 'center',
|
|
42
30
|
justifyContent: 'center',
|
|
43
31
|
},
|
|
44
32
|
outerAnimatedStyles,
|
|
45
|
-
] },
|
|
33
|
+
] },
|
|
34
|
+
React.createElement(Animated.View, { style: innerAnimatedStyles },
|
|
35
|
+
React.createElement(Svg, { width: "16", height: "16", viewBox: "0 0 16 16" },
|
|
36
|
+
React.createElement(AnimatedPath, { animatedProps: plusAnimatedProps, d: "M9 9H16V6.99H9V0H6.99V7H0V9.01H7V16.01H9.01V9.01L9 9Z", fill: primary }),
|
|
37
|
+
React.createElement(AnimatedPath, { animatedProps: minusAnimatedProps, d: "M16.3826 9.66663V7.66663H0.462646V9.66663H16.3826Z", fill: canvas })))));
|
|
46
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
export var useLayout = function (defaultHeight) {
|
|
3
3
|
var _a = useState({ height: defaultHeight || 0, width: 0, measured: false }), layout = _a[0], setLayout = _a[1];
|
|
4
|
-
var onLayout = useCallback(function (e) {
|
|
4
|
+
var onLayout = React.useCallback(function (e) {
|
|
5
5
|
var _a = e.nativeEvent.layout, height = _a.height, width = _a.width;
|
|
6
6
|
if (height === layout.height && width === layout.width) {
|
|
7
7
|
return;
|
|
@@ -9,7 +9,7 @@ export var useLayout = function (defaultHeight) {
|
|
|
9
9
|
setLayout({
|
|
10
10
|
height: height,
|
|
11
11
|
width: width,
|
|
12
|
-
measured: true
|
|
12
|
+
measured: true
|
|
13
13
|
});
|
|
14
14
|
}, [layout.height, layout.width]);
|
|
15
15
|
return [layout, onLayout];
|
|
@@ -1,30 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { theme } from '../../theme';
|
|
3
|
+
var greyBase = theme.colors.brand.grey.base;
|
|
4
|
+
var styles = StyleSheet.create({
|
|
5
|
+
accordion: {
|
|
6
|
+
width: '100%',
|
|
7
|
+
borderWidth: parseInt(theme.borderWidths.standard),
|
|
8
|
+
borderBottomWidth: 0,
|
|
9
|
+
borderColor: greyBase,
|
|
10
|
+
},
|
|
11
|
+
topItem: {
|
|
12
|
+
borderTopLeftRadius: parseInt(theme.radii.small),
|
|
13
|
+
borderTopRightRadius: parseInt(theme.radii.small),
|
|
14
|
+
},
|
|
15
|
+
bottomItem: {
|
|
16
|
+
borderBottomLeftRadius: parseInt(theme.radii.small),
|
|
17
|
+
borderBottomRightRadius: parseInt(theme.radii.small),
|
|
18
|
+
borderBottomWidth: parseInt(theme.borderWidths.standard),
|
|
19
|
+
},
|
|
20
|
+
accordionHeader: {
|
|
21
|
+
paddingTop: parseInt(theme.space[5]),
|
|
22
|
+
paddingRight: 18,
|
|
23
|
+
paddingBottom: 18,
|
|
24
|
+
paddingLeft: parseInt(theme.space[3]),
|
|
25
|
+
flexDirection: 'row',
|
|
26
|
+
alignItems: 'flex-start',
|
|
27
|
+
justifyContent: 'space-between',
|
|
28
|
+
},
|
|
29
|
+
accordionHeaderText: {
|
|
30
|
+
paddingRight: parseInt(theme.space[3]),
|
|
31
|
+
marginTop: 0,
|
|
32
|
+
marginBottom: 0,
|
|
33
|
+
flexShrink: 1,
|
|
34
|
+
},
|
|
35
|
+
content: {
|
|
36
|
+
overflow: 'hidden',
|
|
37
|
+
},
|
|
38
|
+
container: {
|
|
39
|
+
position: 'absolute',
|
|
40
|
+
top: 0,
|
|
41
|
+
left: 0,
|
|
42
|
+
right: 0,
|
|
43
|
+
paddingTop: 0,
|
|
44
|
+
paddingRight: parseInt(theme.space[12]),
|
|
45
|
+
paddingBottom: parseInt(theme.space[6]),
|
|
46
|
+
paddingLeft: parseInt(theme.space[3]),
|
|
47
|
+
},
|
|
21
48
|
});
|
|
22
|
-
export
|
|
23
|
-
var core = _a.theme.core;
|
|
24
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-top: ", "\n padding-left: ", "\n padding-right: 18px;\n padding-bottom: 18px;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n "], ["\n padding-top: ", "\n padding-left: ", "\n padding-right: 18px;\n padding-bottom: 18px;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n "])), core.space[5], core.space[3]);
|
|
25
|
-
});
|
|
26
|
-
export var StyledContainer = styled.View(function (_a) {
|
|
27
|
-
var core = _a.theme.core;
|
|
28
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n padding-top: 0;\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n "], ["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n padding-top: 0;\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n "])), core.space[12], core.space[6], core.space[3]);
|
|
29
|
-
});
|
|
30
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
49
|
+
export { styles };
|
|
@@ -24,46 +24,28 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
}
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
|
-
import
|
|
27
|
+
import React from 'react';
|
|
28
|
+
import { useBreakpoint } from '../../hooks';
|
|
28
29
|
import styled, { css } from '../../styled.native';
|
|
30
|
+
import { calculateLineHeight } from '../../theme';
|
|
29
31
|
var StyledBadge = styled.View(function (_a) {
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
surface = component.badge.variants[variant].background;
|
|
39
|
-
message = component.badge.variants[variant].foreground;
|
|
40
|
-
}
|
|
41
|
-
if ((customVariant === null || customVariant === void 0 ? void 0 : customVariant.foregroundColor) && (customVariant === null || customVariant === void 0 ? void 0 : customVariant.backgroundColor)) {
|
|
42
|
-
surface = customVariant.backgroundColor;
|
|
43
|
-
message = customVariant.foregroundColor;
|
|
44
|
-
}
|
|
45
|
-
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 ", ";\n border-radius: 16px;\n border: ", " solid ", ";\n background-color: ", ";\n align-self: flex-start;\n "], ["\n padding: 0 ", ";\n border-radius: 16px;\n border: ", " solid ", ";\n background-color: ", ";\n align-self: flex-start;\n "])), core.space[2], core.borderWidth.medium, core.color.brand.white, inverted ? message : surface);
|
|
32
|
+
var badge = _a.theme.badge, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.inverted, inverted = _c === void 0 ? false : _c;
|
|
33
|
+
// @ts-ignore to support additional palettes.
|
|
34
|
+
var currentVariant = badge.variants[variant];
|
|
35
|
+
return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 ", ";\n border-radius: ", ";\n background-color: ", ";\n align-self: flex-start;\n "], ["\n padding: 0 ", ";\n border-radius: ", ";\n background-color: ", ";\n align-self: flex-start;\n "])), badge.paddingHorizontal, badge.borderRadius, inverted
|
|
36
|
+
? currentVariant.foreground
|
|
37
|
+
: currentVariant.background);
|
|
46
38
|
});
|
|
47
39
|
var StyledBadgeText = styled.Text(function (_a) {
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
surface = semantic[variant].surface;
|
|
53
|
-
message = semantic[variant].message;
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
surface = component.badge.variants[variant].background;
|
|
57
|
-
message = component.badge.variants[variant].foreground;
|
|
58
|
-
}
|
|
59
|
-
if ((customVariant === null || customVariant === void 0 ? void 0 : customVariant.foregroundColor) && (customVariant === null || customVariant === void 0 ? void 0 : customVariant.backgroundColor)) {
|
|
60
|
-
surface = customVariant.backgroundColor;
|
|
61
|
-
message = customVariant.foregroundColor;
|
|
62
|
-
}
|
|
63
|
-
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "])), core.fontFamily.bodyBold.native, core.lineHeight.body.small, inverted ? surface : message, core.fontSize.body.small);
|
|
40
|
+
var badge = _a.theme.badge, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.inverted, inverted = _c === void 0 ? false : _c;
|
|
41
|
+
// @ts-ignore to support additional palettes.
|
|
42
|
+
var currentVariant = badge.variants[variant];
|
|
43
|
+
return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "])), badge.fontFamily, calculateLineHeight(badge.fontSize[1], badge.lineHeight), inverted ? currentVariant.background : currentVariant.foreground, badge.fontSize[1]);
|
|
64
44
|
});
|
|
65
45
|
export var Badge = function (_a) {
|
|
66
|
-
var children = _a.children, variant = _a.variant,
|
|
67
|
-
|
|
46
|
+
var children = _a.children, variant = _a.variant, rest = __rest(_a, ["children", "variant"]);
|
|
47
|
+
var smallAndUp = useBreakpoint().smallAndUp;
|
|
48
|
+
return (React.createElement(StyledBadge, __assign({}, rest, { variant: variant }),
|
|
49
|
+
React.createElement(StyledBadgeText, { variant: variant, smallAndUp: smallAndUp }, children)));
|
|
68
50
|
};
|
|
69
51
|
var templateObject_1, templateObject_2;
|
|
@@ -24,51 +24,55 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
}
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
|
-
import {
|
|
28
|
-
import { forwardRef } from 'react';
|
|
27
|
+
import React, { useContext, forwardRef, } from 'react';
|
|
29
28
|
import { useBreakpoint } from '../../hooks';
|
|
30
|
-
import styled, { css } from '../../styled.native';
|
|
29
|
+
import styled, { css, ThemeContext } from '../../styled.native';
|
|
30
|
+
import { calculateLineHeight } from '../../theme';
|
|
31
31
|
import { Icon } from '../Icon/Icon';
|
|
32
32
|
var StyledCTAWrapper = styled.TouchableOpacity(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-self: flex-start;\n flex-direction: row;\n align-items: flex-start;\n"], ["\n align-self: flex-start;\n flex-direction: row;\n align-items: flex-start;\n"])));
|
|
33
33
|
var CTAButtonWrapper = function (_a) {
|
|
34
34
|
var children = _a.children, _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'button' : _b, _c = _a.activeOpacity, activeOpacity = _c === void 0 ? 0.8 : _c, rest = __rest(_a, ["children", "accessibilityRole", "activeOpacity"]);
|
|
35
|
-
return (
|
|
35
|
+
return (React.createElement(StyledCTAWrapper, __assign({ accessibilityRole: accessibilityRole, activeOpacity: activeOpacity }, rest), children));
|
|
36
36
|
};
|
|
37
37
|
var StyledInner = styled.View(function (_a) {
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
var
|
|
41
|
-
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", " ", ";\n background-color: ", ";\n border-radius: ", ";\n min-height: ", ";\n border:
|
|
38
|
+
var cta = _a.theme.cta, fullWidth = _a.fullWidth, variant = _a.variant;
|
|
39
|
+
// @ts-ignore to support additional palettes.
|
|
40
|
+
var currentVariant = cta.variants[variant];
|
|
41
|
+
return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", " ", ";\n border-color: ", ";\n background-color: ", ";\n border-width: ", ";\n border-radius: ", ";\n min-height: ", ";\n border-style: solid;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n flex-grow: 1;\n\n ", ";\n "], ["\n padding: ", " ", ";\n border-color: ", ";\n background-color: ", ";\n border-width: ", ";\n border-radius: ", ";\n min-height: ", ";\n border-style: solid;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n flex-grow: 1;\n\n ", ";\n "])), cta.paddingVertical, cta.paddingHorizontal, currentVariant.border, currentVariant.background, cta.borderWidth, cta.borderRadius, cta.minHeight, fullWidth === 'never'
|
|
42
42
|
? css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n flex-grow: 0;\n "], ["\n flex-grow: 0;\n "]))) : '');
|
|
43
43
|
});
|
|
44
44
|
var StyledRightIcon = styled(Icon)(function (_a) {
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-left: ", ";\n color: ", ";\n "], ["\n margin-left: ", ";\n color: ", ";\n "])), core.space[1], currentVariant.message);
|
|
45
|
+
var cta = _a.theme.cta;
|
|
46
|
+
return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), cta.iconGap);
|
|
48
47
|
});
|
|
49
48
|
var StyledLeftIcon = styled(Icon)(function (_a) {
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-right: ", ";\n color: ", ";\n "], ["\n margin-right: ", ";\n color: ", ";\n "])), core.space[1], currentVariant.message);
|
|
49
|
+
var cta = _a.theme.cta;
|
|
50
|
+
return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-right: ", ";\n "], ["\n margin-right: ", ";\n "])), cta.iconGap);
|
|
53
51
|
});
|
|
54
52
|
var StyledCTAButtonText = styled.Text(function (_a) {
|
|
55
|
-
var
|
|
56
|
-
var fontSize = smallAndUp
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: center;\n flex-shrink: 2;\n "], ["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: center;\n flex-shrink: 2;\n "])), currentVariant.message, core.fontFamily.bodyBold.native, fontSize, core.lineHeight.body.small);
|
|
53
|
+
var cta = _a.theme.cta, smallAndUp = _a.smallAndUp, variant = _a.variant;
|
|
54
|
+
var fontSize = smallAndUp ? cta.fontSize[1] : cta.fontSize[0];
|
|
55
|
+
// @ts-ignore to support additional palettes.
|
|
56
|
+
var currentVariant = cta.variants[variant];
|
|
57
|
+
return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: left;\n flex-shrink: 2;\n "], ["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: left;\n flex-shrink: 2;\n "])), currentVariant.foreground, cta.fontFamily, fontSize, calculateLineHeight(fontSize, cta.lineHeight));
|
|
61
58
|
});
|
|
62
59
|
var CTAButton = function (_a) {
|
|
63
60
|
var _b = _a.iconLeft, iconLeft = _b === void 0 ? 'off' : _b, _c = _a.iconRight, iconRight = _c === void 0 ? 'off' : _c, children = _a.children, _d = _a.fullWidth, fullWidth = _d === void 0 ? 'small' : _d, _e = _a.variant, variant = _e === void 0 ? 'primary' : _e, rest = __rest(_a, ["iconLeft", "iconRight", "children", "fullWidth", "variant"]);
|
|
61
|
+
var cta = useContext(ThemeContext).cta;
|
|
64
62
|
var smallAndUp = useBreakpoint().smallAndUp;
|
|
63
|
+
// @ts-ignore to support additional palettes.
|
|
64
|
+
var currentVariant = cta.variants[variant];
|
|
65
65
|
if (fullWidth === 'small') {
|
|
66
66
|
fullWidth = smallAndUp ? 'never' : 'always';
|
|
67
67
|
}
|
|
68
|
-
return (
|
|
68
|
+
return (React.createElement(CTAButtonWrapper, __assign({}, rest),
|
|
69
|
+
React.createElement(StyledInner, { fullWidth: fullWidth, variant: variant },
|
|
70
|
+
iconLeft !== 'off' ? (React.createElement(StyledLeftIcon, { name: iconLeft, size: 16, color: currentVariant.foreground })) : null,
|
|
71
|
+
React.createElement(StyledCTAButtonText, { smallAndUp: smallAndUp, variant: variant }, children),
|
|
72
|
+
iconRight !== 'off' ? (React.createElement(StyledRightIcon, { name: iconRight, size: 16, color: currentVariant.foreground })) : null)));
|
|
69
73
|
};
|
|
70
|
-
var PrimaryCTAButton = forwardRef(function (props, ref) { return (
|
|
71
|
-
var SecondaryCTAButton = forwardRef(function (props, ref) { return (
|
|
72
|
-
var DestructiveCTAButton = forwardRef(function (props, ref) { return (
|
|
74
|
+
var PrimaryCTAButton = forwardRef(function (props, ref) { return (React.createElement(CTAButton, __assign({ variant: "primary" }, props, { ref: ref }))); });
|
|
75
|
+
var SecondaryCTAButton = forwardRef(function (props, ref) { return (React.createElement(CTAButton, __assign({ variant: "secondary" }, props, { ref: ref }))); });
|
|
76
|
+
var DestructiveCTAButton = forwardRef(function (props, ref) { return (React.createElement(CTAButton, __assign({ variant: "destructive" }, props, { ref: ref }))); });
|
|
73
77
|
export { CTAButton, PrimaryCTAButton, SecondaryCTAButton, DestructiveCTAButton, };
|
|
74
78
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -9,10 +9,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
import { forwardRef } from 'react';
|
|
12
|
+
import React, { forwardRef } from 'react';
|
|
14
13
|
import { CTAButton } from '../CTAButton';
|
|
15
|
-
var CTALink = forwardRef(function (props, ref) { return
|
|
16
|
-
var PrimaryCTALink = forwardRef(function (props, ref) { return
|
|
17
|
-
var SecondaryCTALink = forwardRef(function (props, ref) { return (
|
|
14
|
+
var CTALink = forwardRef(function (props, ref) { return React.createElement(CTAButton, __assign({}, props, { ref: ref })); });
|
|
15
|
+
var PrimaryCTALink = forwardRef(function (props, ref) { return React.createElement(CTALink, __assign({ variant: "primary", ref: ref }, props)); });
|
|
16
|
+
var SecondaryCTALink = forwardRef(function (props, ref) { return (React.createElement(CTALink, __assign({ variant: "secondary", ref: ref }, props))); });
|
|
18
17
|
export { CTALink, PrimaryCTALink, SecondaryCTALink };
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { useBreakpoint } from '../../hooks';
|
|
1
14
|
import styled from '../../styled.native';
|
|
2
|
-
|
|
3
|
-
var _b = _a.theme,
|
|
4
|
-
|
|
5
|
-
? "".concat(
|
|
6
|
-
:
|
|
15
|
+
var StyledCard = styled.View(function (_a) {
|
|
16
|
+
var _b = _a.theme, card = _b.card, radii = _b.radii, smallAndUp = _a.smallAndUp, _c = _a.inline, inline = _c === void 0 ? false : _c;
|
|
17
|
+
var padding = smallAndUp
|
|
18
|
+
? "".concat(card.padding[2], " ").concat(card.padding[1])
|
|
19
|
+
: "".concat(card.padding[1], " ").concat(card.padding[0]);
|
|
20
|
+
var borderRadius = smallAndUp ? radii.medium : radii.small;
|
|
21
|
+
return "\n background: ".concat(card.background, ";\n border: ").concat(inline ? "".concat(card.borderWidth, " solid ").concat(card.borderColor) : 'none', ";\n padding: ").concat(padding, ";\n border-radius: ").concat(borderRadius, ";\n ");
|
|
7
22
|
});
|
|
23
|
+
var Card = function (props) {
|
|
24
|
+
var breakpoints = useBreakpoint();
|
|
25
|
+
return React.createElement(StyledCard, __assign({}, breakpoints, props));
|
|
26
|
+
};
|
|
27
|
+
export { Card };
|
|
@@ -24,10 +24,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
24
24
|
}
|
|
25
25
|
return t;
|
|
26
26
|
};
|
|
27
|
-
import {
|
|
28
|
-
import { forwardRef } from 'react';
|
|
27
|
+
import React, { forwardRef, useContext, } from 'react';
|
|
29
28
|
import { TouchableOpacity, View, } from 'react-native';
|
|
30
|
-
import styled from '../../styled.native';
|
|
29
|
+
import styled, { ThemeContext } from '../../styled.native';
|
|
31
30
|
import { pxToNumber } from '../../utils';
|
|
32
31
|
import { ErrorText } from '../ErrorText';
|
|
33
32
|
import { FormGroup } from '../FormGroup';
|
|
@@ -42,33 +41,53 @@ var StyledCheckboxInputWrapper = styled.View(function (_a) {
|
|
|
42
41
|
return "\n width: ".concat(checkboxSize + gap, "px;\n height: ").concat(checkbox.touchSize, ";\n ");
|
|
43
42
|
});
|
|
44
43
|
var StyledCheckboxInput = styled.View(function (_a) {
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
var checkbox = _a.theme.checkbox, invalid = _a.invalid, checked = _a.checked;
|
|
45
|
+
var touchSize = pxToNumber(checkbox.touchSize);
|
|
46
|
+
var checkboxSize = pxToNumber(checkbox.size);
|
|
47
|
+
var checkboxDistance = (touchSize - checkboxSize) / 2;
|
|
48
|
+
return "\n width: ".concat(checkbox.size, ";\n height: ").concat(checkbox.size, ";\n border: ").concat(checkbox.borderWidth, " solid;\n margin-top: ").concat(checkboxDistance, "px;\n border-radius: ").concat(checkbox.borderRadius, ";\n border-color: ").concat(invalid
|
|
49
|
+
? checkbox.errorColor
|
|
48
50
|
: checked
|
|
49
|
-
?
|
|
50
|
-
:
|
|
51
|
+
? checkbox.checkColor
|
|
52
|
+
: checkbox.borderColor, ";\n background: ").concat(checked ? checkbox.checkedBackground : checkbox.background, ";\n ");
|
|
51
53
|
});
|
|
52
54
|
var CheckboxCheck = function (props) {
|
|
53
|
-
|
|
55
|
+
var checkbox = useContext(ThemeContext).checkbox;
|
|
56
|
+
return (React.createElement(Icon, __assign({ name: "check", size: pxToNumber(checkbox.checkSize), color: checkbox.checkColor }, props)));
|
|
54
57
|
};
|
|
55
58
|
var StyledCheckboxInputCheck = styled(CheckboxCheck)(function (_a) {
|
|
56
|
-
var
|
|
57
|
-
|
|
59
|
+
var checkbox = _a.theme.checkbox, checked = _a.checked;
|
|
60
|
+
var checkboxSize = pxToNumber(checkbox.size);
|
|
61
|
+
var checkSize = pxToNumber(checkbox.checkSize);
|
|
62
|
+
var borderWidth = pxToNumber(checkbox.borderWidth);
|
|
63
|
+
var checkDistance = (checkboxSize - checkSize) / 2 - borderWidth;
|
|
64
|
+
return "\n margin-top: ".concat(checkDistance, "px;\n margin-left: ").concat(checkDistance, "px;\n opacity: ").concat(checked ? 1 : 0, ";\n ");
|
|
58
65
|
});
|
|
59
66
|
var Input = function (_a) {
|
|
60
67
|
var checked = _a.checked, invalid = _a.invalid, testID = _a.testID, rest = __rest(_a, ["checked", "invalid", "testID"]);
|
|
61
|
-
return (
|
|
68
|
+
return (React.createElement(StyledCheckboxInputWrapper, __assign({}, rest),
|
|
69
|
+
React.createElement(StyledCheckboxInput, { invalid: invalid, checked: checked, testID: testID },
|
|
70
|
+
React.createElement(StyledCheckboxInputCheck, { checked: checked }))));
|
|
62
71
|
};
|
|
63
72
|
var CheckLabelText = styled(LabelText)(function (_a) {
|
|
64
|
-
var
|
|
65
|
-
return "\n padding-top: ".concat(
|
|
73
|
+
var checkbox = _a.theme.checkbox;
|
|
74
|
+
return "\n padding-top: ".concat(checkbox.paddingTop, ";\n ");
|
|
66
75
|
});
|
|
67
76
|
var StyledWrapper = styled.View(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: row;\n"], ["\n flex-direction: row;\n"])));
|
|
68
77
|
var Checkbox = forwardRef(function (_a, ref) {
|
|
69
78
|
var label = _a.label, hint = _a.hint, error = _a.error, checked = _a.checked, optional = _a.optional, invalid = _a.invalid, _b = _a.activeOpacity, activeOpacity = _b === void 0 ? 0.8 : _b, testID = _a.testID, rest = __rest(_a, ["label", "hint", "error", "checked", "optional", "invalid", "activeOpacity", "testID"]);
|
|
70
79
|
var hasError = !!error;
|
|
71
|
-
return (
|
|
80
|
+
return (React.createElement(FormGroup, { error: hasError },
|
|
81
|
+
React.createElement(Stack, { spaceBetween: 1 },
|
|
82
|
+
error ? React.createElement(ErrorText, null, error) : null,
|
|
83
|
+
React.createElement(TouchableOpacity, __assign({ ref: ref, accessibilityRole: "checkbox", activeOpacity: activeOpacity, accessibilityState: { checked: checked } }, rest),
|
|
84
|
+
React.createElement(StyledWrapper, null,
|
|
85
|
+
React.createElement(Input, { checked: checked, invalid: hasError || invalid, testID: testID }),
|
|
86
|
+
React.createElement(View, { style: { flexShrink: 1 } },
|
|
87
|
+
React.createElement(CheckLabelText, null,
|
|
88
|
+
label,
|
|
89
|
+
optional ? ' (optional)' : null),
|
|
90
|
+
hint ? React.createElement(HintText, null, hint) : null))))));
|
|
72
91
|
});
|
|
73
92
|
export { Checkbox };
|
|
74
93
|
var templateObject_1;
|
|
@@ -20,8 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import {
|
|
24
|
-
import { Children, cloneElement } from 'react';
|
|
23
|
+
import React, { Children, cloneElement, } from 'react';
|
|
25
24
|
import { View } from 'react-native';
|
|
26
25
|
import { ErrorText } from '../ErrorText';
|
|
27
26
|
import { FormGroup } from '../FormGroup';
|
|
@@ -31,10 +30,18 @@ import { Stack } from '../Stack';
|
|
|
31
30
|
var CheckboxField = function (_a) {
|
|
32
31
|
var label = _a.label, hint = _a.hint, error = _a.error, children = _a.children, _b = _a.optional, optional = _b === void 0 ? false : _b, rest = __rest(_a, ["label", "hint", "error", "children", "optional"]);
|
|
33
32
|
var hasError = !!error;
|
|
34
|
-
return (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
return (React.createElement(FormGroup, __assign({}, rest, { error: hasError }),
|
|
34
|
+
React.createElement(Stack, { spaceBetween: 1 },
|
|
35
|
+
React.createElement(View, null,
|
|
36
|
+
React.createElement(LabelText, null,
|
|
37
|
+
label,
|
|
38
|
+
optional ? ' (optional)' : null),
|
|
39
|
+
hint ? React.createElement(HintText, null, hint) : null,
|
|
40
|
+
error ? React.createElement(ErrorText, null, error) : null),
|
|
41
|
+
React.createElement(View, null, Children.map(children, function (child) {
|
|
42
|
+
return cloneElement(child, {
|
|
43
|
+
invalid: hasError ? true : child.props.invalid,
|
|
44
|
+
});
|
|
45
|
+
})))));
|
|
39
46
|
};
|
|
40
47
|
export { CheckboxField };
|