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