@ovotech/element-native 5.5.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/styles.d.ts +3 -1725
- package/dist/components/ActionList/Action.d.ts +23 -0
- package/dist/components/ActionList/Action.js +29 -0
- package/dist/components/ActionList/ActionList.d.ts +11 -27
- package/dist/components/ActionList/ActionList.js +9 -25
- package/dist/components/ActionList/ActionListItems/DataListItem.d.ts +23 -0
- package/dist/components/ActionList/ActionListItems/DataListItem.js +23 -0
- package/dist/components/ActionList/ActionListItems/EditableListItem.d.ts +43 -0
- package/dist/components/ActionList/ActionListItems/EditableListItem.js +134 -0
- package/dist/components/ActionList/ActionListItems/NavigationListItem.d.ts +16 -0
- package/dist/components/ActionList/ActionListItems/NavigationListItem.js +30 -0
- package/dist/components/ActionList/ActionListItems/ProgressRing.d.ts +7 -0
- package/dist/components/ActionList/ActionListItems/ProgressRing.js +66 -0
- package/dist/components/ActionList/ActionListItems/ToggleListItem.d.ts +9 -0
- package/dist/components/ActionList/ActionListItems/ToggleListItem.js +12 -0
- package/dist/components/ActionList/ActionListItems/styles.d.ts +51 -0
- package/dist/components/ActionList/ActionListItems/styles.js +173 -0
- package/dist/components/ActionList/components/ActionListHeading.d.ts +9 -0
- package/dist/components/ActionList/components/ActionListHeading.js +11 -0
- package/dist/components/ActionList/index.d.ts +6 -1
- package/dist/components/ActionList/index.js +11 -2
- package/dist/components/ActionList/styled.d.ts +12 -5756
- package/dist/components/ActionList/styled.js +24 -9
- package/dist/components/Badge/Badge.d.ts +1 -575
- package/dist/components/BottomActionBar/BottomActionBar.d.ts +12 -0
- package/dist/components/BottomActionBar/BottomActionBar.js +80 -0
- package/dist/components/BottomActionBar/OverlayProvider.d.ts +8 -0
- package/dist/components/BottomActionBar/OverlayProvider.js +38 -0
- package/dist/components/BottomActionBar/index.d.ts +2 -0
- package/dist/components/BottomActionBar/index.js +7 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.styles.d.ts +5 -2300
- package/dist/components/Card/Card.d.ts +7 -4
- package/dist/components/Card/Card.js +44 -22
- package/dist/components/Card/Card.styles.d.ts +4 -1725
- package/dist/components/Card/Card.styles.js +7 -11
- package/dist/components/Cards/AccountCard/AccountCard.styles.d.ts +8 -4600
- package/dist/components/Cards/BalanceCard/BalanceCard.styles.d.ts +15 -8625
- package/dist/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.d.ts +13 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.js +45 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.d.ts +3 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +11 -0
- package/dist/components/Cards/DisruptiveCard/index.d.ts +1 -0
- package/dist/components/Cards/DisruptiveCard/index.js +17 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.d.ts +12 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.js +65 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.d.ts +10 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.js +27 -0
- package/dist/components/Cards/HeroImageCard/index.d.ts +1 -0
- package/dist/components/Cards/HeroImageCard/index.js +17 -0
- package/dist/components/Cards/IconDataCard/IconDataCard.styles.d.ts +4 -2300
- package/dist/components/Cards/IconTextCard/IconTextCard.js +3 -16
- package/dist/components/Cards/IconTextCard/IconTextCard.styles.d.ts +3 -2300
- package/dist/components/Cards/IconTextCard/IconTextCard.styles.js +1 -6
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.d.ts +14 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.js +26 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.d.ts +18 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +33 -0
- package/dist/components/Cards/IllustrationTextCard/index.d.ts +1 -0
- package/dist/components/Cards/IllustrationTextCard/index.js +17 -0
- package/dist/components/Cards/LinkTextCard/LinkTextCard.d.ts +2 -2
- package/dist/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
- package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.d.ts +8 -2875
- package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
- package/dist/components/Cards/OfferCard/OfferCard.d.ts +22 -0
- package/dist/components/Cards/OfferCard/OfferCard.js +36 -0
- package/dist/components/Cards/OfferCard/OfferCard.styles.d.ts +34 -0
- package/dist/components/Cards/OfferCard/OfferCard.styles.js +61 -0
- package/dist/components/Cards/OfferCard/index.d.ts +1 -0
- package/dist/components/Cards/OfferCard/index.js +17 -0
- package/dist/components/Cards/ProgressBarCard/ProgressBarCard.styles.d.ts +9 -5175
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.d.ts +12 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.js +27 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.d.ts +12 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +31 -0
- package/dist/components/Cards/QuickLinkCard/index.d.ts +1 -0
- package/dist/components/Cards/QuickLinkCard/index.js +17 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.d.ts +12 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.js +24 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.d.ts +17 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +38 -0
- package/dist/components/Cards/ServicesImageCard/index.d.ts +1 -0
- package/dist/components/Cards/ServicesImageCard/index.js +17 -0
- package/dist/components/Cards/components.d.ts +15 -0
- package/dist/components/Cards/components.js +24 -0
- package/dist/components/Cards/index.d.ts +5 -0
- package/dist/components/Cards/index.js +11 -1
- package/dist/components/Cards/shared.styles.d.ts +11 -3451
- package/dist/components/Cards/shared.styles.js +18 -2
- package/dist/components/Cards/utils.d.ts +1 -0
- package/dist/components/Cards/utils.js +13 -1
- package/dist/components/Checkbox/Checkbox.d.ts +2 -13
- package/dist/components/Checkbox/Checkbox.js +3 -49
- package/dist/components/Checkbox/styled.d.ts +21 -0
- package/dist/components/Checkbox/styled.js +52 -0
- package/dist/components/Checkbox/types.d.ts +16 -0
- package/dist/components/Checkbox/types.js +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +2 -1
- package/dist/components/CurrencyInput/CurrencyInput.js +11 -4
- package/dist/components/CurrencyInput/styled.d.ts +10 -0
- package/dist/components/CurrencyInput/styled.js +39 -0
- package/dist/components/DataTable/styles.d.ts +13 -7475
- package/dist/components/Disclosure/Disclosure.d.ts +1 -575
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Divider/Divider.js +3 -1
- package/dist/components/Em/Em.d.ts +1 -575
- package/dist/components/EmailInput/EmailInput.d.ts +4 -1
- package/dist/components/EmailInput/EmailInput.js +18 -2
- package/dist/components/EmptyState/EmptyState.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.js +17 -0
- package/dist/components/EmptyState/EmptyState.test.d.ts +1 -0
- package/dist/components/EmptyState/EmptyState.test.js +92 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EmptyState/index.js +17 -0
- package/dist/components/EmptyState/styles.d.ts +2 -0
- package/dist/components/EmptyState/styles.js +23 -0
- package/dist/components/EmptyState/types.d.ts +18 -0
- package/dist/components/EmptyState/types.js +2 -0
- package/dist/components/ErrorText/ErrorText.d.ts +1 -575
- package/dist/components/Field/Field.d.ts +3 -2
- package/dist/components/Field/Field.js +3 -2
- package/dist/components/Grid/Col.d.ts +1 -575
- package/dist/components/HintText/HintText.d.ts +1 -575
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Input/Input.js +6 -97
- package/dist/components/Input/styled.d.ts +16 -0
- package/dist/components/Input/styled.js +96 -0
- package/dist/components/LabelText/LabelText.d.ts +1 -575
- package/dist/components/LargeValueReference/LargeValueReference.d.ts +11 -0
- package/dist/components/LargeValueReference/LargeValueReference.js +49 -0
- package/dist/components/LargeValueReference/index.d.ts +1 -0
- package/dist/components/LargeValueReference/index.js +17 -0
- package/dist/components/LargeValueReference/styles.d.ts +10 -0
- package/dist/components/LargeValueReference/styles.js +29 -0
- package/dist/components/LineThrough/LineThrough.d.ts +1 -575
- package/dist/components/List/styled.d.ts +4 -2300
- package/dist/components/Margin/Margin.d.ts +1 -575
- package/dist/components/NavHeader/NavHeader.styles.d.ts +11 -6325
- package/dist/components/Notification/Notification.d.ts +2 -2
- package/dist/components/Notification/Notification.js +20 -12
- package/dist/components/Notification/Notification.styles.d.ts +13 -5175
- package/dist/components/Notification/Notification.styles.js +21 -2
- package/dist/components/PasswordInput/PasswordInput.styled.d.ts +1 -577
- package/dist/components/PasswordInput/PasswordInput.styled.js +5 -3
- package/dist/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
- package/dist/components/Radio/Radio.d.ts +2 -2
- package/dist/components/Radio/Radio.js +5 -43
- package/dist/components/Radio/Radio.styles.d.ts +9 -0
- package/dist/components/Radio/Radio.styles.js +74 -0
- package/dist/components/RadioCard/RadioCard.d.ts +2 -1
- package/dist/components/RadioCard/RadioCard.js +7 -57
- package/dist/components/RadioCard/RadioCard.styles.d.ts +16 -0
- package/dist/components/RadioCard/RadioCard.styles.js +97 -0
- package/dist/components/Rail/Rail.d.ts +12 -0
- package/dist/components/Rail/Rail.js +58 -0
- package/dist/components/Rail/RailIndicator.d.ts +7 -0
- package/dist/components/Rail/RailIndicator.js +81 -0
- package/dist/components/Rail/index.d.ts +1 -0
- package/dist/components/Rail/index.js +5 -0
- package/dist/components/Rail/styles.d.ts +13 -0
- package/dist/components/Rail/styles.js +55 -0
- package/dist/components/Rail/useRailPaging.d.ts +13 -0
- package/dist/components/Rail/useRailPaging.js +95 -0
- package/dist/components/SelectField/Select.d.ts +5 -579
- package/dist/components/SelectField/Select.js +7 -107
- package/dist/components/SelectField/SelectField.d.ts +2 -2
- package/dist/components/SelectField/SelectField.js +2 -2
- package/dist/components/SelectField/styled.d.ts +26 -0
- package/dist/components/SelectField/styled.js +118 -0
- package/dist/components/SkeletonText/SkeletonText.js +4 -4
- package/dist/components/Strong/Strong.d.ts +1 -575
- package/dist/components/SubLabelText/SubLabelText.d.ts +1 -575
- package/dist/components/Tabs/Tab.d.ts +1 -575
- package/dist/components/TextareaInput/TextareaInput.js +12 -6
- package/dist/components/Toast/Toast.d.ts +10 -4
- package/dist/components/Toast/Toast.js +40 -27
- package/dist/components/Toggle/Toggle.d.ts +3 -1
- package/dist/components/Toggle/Toggle.js +4 -6
- package/dist/components/Toggle/styles.d.ts +5 -2300
- package/dist/components/Toggle/styles.js +3 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +5 -0
- package/dist/esm/components/ActionList/Action.js +26 -0
- package/dist/esm/components/ActionList/ActionList.js +12 -28
- package/dist/esm/components/ActionList/ActionListItems/DataListItem.js +19 -0
- package/dist/esm/components/ActionList/ActionListItems/EditableListItem.js +131 -0
- package/dist/esm/components/ActionList/ActionListItems/NavigationListItem.js +26 -0
- package/dist/esm/components/ActionList/ActionListItems/ProgressRing.js +29 -0
- package/dist/esm/components/ActionList/ActionListItems/ToggleListItem.js +8 -0
- package/dist/esm/components/ActionList/ActionListItems/styles.js +137 -0
- package/dist/esm/components/ActionList/components/ActionListHeading.js +7 -0
- package/dist/esm/components/ActionList/index.js +6 -1
- package/dist/esm/components/ActionList/styled.js +23 -8
- package/dist/esm/components/BottomActionBar/BottomActionBar.js +40 -0
- package/dist/esm/components/BottomActionBar/OverlayProvider.js +30 -0
- package/dist/esm/components/BottomActionBar/index.js +2 -0
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Card/Card.js +45 -23
- package/dist/esm/components/Card/Card.styles.js +8 -12
- package/dist/esm/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
- package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.js +41 -0
- package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +5 -0
- package/dist/esm/components/Cards/DisruptiveCard/index.js +1 -0
- package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.js +28 -0
- package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.styles.js +21 -0
- package/dist/esm/components/Cards/HeroImageCard/index.js +1 -0
- package/dist/esm/components/Cards/IconTextCard/IconTextCard.js +5 -18
- package/dist/esm/components/Cards/IconTextCard/IconTextCard.styles.js +0 -5
- package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.js +22 -0
- package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +27 -0
- package/dist/esm/components/Cards/IllustrationTextCard/index.js +1 -0
- package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
- package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
- package/dist/esm/components/Cards/OfferCard/OfferCard.js +32 -0
- package/dist/esm/components/Cards/OfferCard/OfferCard.styles.js +55 -0
- package/dist/esm/components/Cards/OfferCard/index.js +1 -0
- package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.js +23 -0
- package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +25 -0
- package/dist/esm/components/Cards/QuickLinkCard/index.js +1 -0
- package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.js +20 -0
- package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +32 -0
- package/dist/esm/components/Cards/ServicesImageCard/index.js +1 -0
- package/dist/esm/components/Cards/components.js +19 -0
- package/dist/esm/components/Cards/index.js +5 -0
- package/dist/esm/components/Cards/shared.styles.js +17 -1
- package/dist/esm/components/Cards/utils.js +11 -0
- package/dist/esm/components/Checkbox/Checkbox.js +2 -45
- package/dist/esm/components/Checkbox/styled.js +46 -0
- package/dist/esm/components/Checkbox/types.js +1 -0
- package/dist/esm/components/CurrencyInput/CurrencyInput.js +12 -5
- package/dist/esm/components/CurrencyInput/styled.js +33 -0
- package/dist/esm/components/Divider/Divider.js +3 -1
- package/dist/esm/components/EmailInput/EmailInput.js +18 -2
- package/dist/esm/components/EmptyState/EmptyState.js +13 -0
- package/dist/esm/components/EmptyState/EmptyState.test.js +90 -0
- package/dist/esm/components/EmptyState/index.js +1 -0
- package/dist/esm/components/EmptyState/styles.js +17 -0
- package/dist/esm/components/EmptyState/types.js +1 -0
- package/dist/esm/components/Field/Field.js +3 -2
- package/dist/esm/components/Input/Input.js +6 -64
- package/dist/esm/components/Input/styled.js +60 -0
- package/dist/esm/components/LargeValueReference/LargeValueReference.js +45 -0
- package/dist/esm/components/LargeValueReference/index.js +1 -0
- package/dist/esm/components/LargeValueReference/styles.js +23 -0
- package/dist/esm/components/Notification/Notification.js +21 -13
- package/dist/esm/components/Notification/Notification.styles.js +20 -1
- package/dist/esm/components/PasswordInput/PasswordInput.styled.js +5 -3
- package/dist/esm/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
- package/dist/esm/components/Radio/Radio.js +4 -39
- package/dist/esm/components/Radio/Radio.styles.js +38 -0
- package/dist/esm/components/RadioCard/RadioCard.js +5 -52
- package/dist/esm/components/RadioCard/RadioCard.styles.js +61 -0
- package/dist/esm/components/Rail/Rail.js +21 -0
- package/dist/esm/components/Rail/RailIndicator.js +44 -0
- package/dist/esm/components/Rail/index.js +1 -0
- package/dist/esm/components/Rail/styles.js +49 -0
- package/dist/esm/components/Rail/useRailPaging.js +92 -0
- package/dist/esm/components/SelectField/Select.js +7 -74
- package/dist/esm/components/SelectField/SelectField.js +3 -3
- package/dist/esm/components/SelectField/styled.js +82 -0
- package/dist/esm/components/SkeletonText/SkeletonText.js +4 -4
- package/dist/esm/components/TextareaInput/TextareaInput.js +12 -6
- package/dist/esm/components/Toast/Toast.js +40 -27
- package/dist/esm/components/Toggle/Toggle.js +4 -6
- package/dist/esm/components/Toggle/styles.js +3 -3
- package/dist/esm/components/index.js +5 -0
- package/dist/esm/hooks/use-font-scaling.js +32 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/test/utils.js +12 -0
- package/dist/esm/utils/utils.js +12 -1
- package/dist/hooks/use-font-scaling.d.ts +26 -0
- package/dist/hooks/use-font-scaling.js +35 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/styled.native.d.ts +1 -3445
- package/dist/test/utils.d.ts +4 -0
- package/dist/test/utils.js +28 -0
- package/dist/utils/utils.d.ts +11 -1
- package/dist/utils/utils.js +12 -0
- package/package.json +5 -5
- package/dist/components/ErrorWrapper/styles.d.ts +0 -0
- package/dist/components/ErrorWrapper/styles.js +0 -1
- package/dist/esm/components/ErrorWrapper/styles.js +0 -1
|
@@ -10,62 +10,24 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
14
|
exports.Radio = void 0;
|
|
18
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const element_core_1 = require("@ovotech/element-core");
|
|
20
16
|
const react_native_1 = require("react-native");
|
|
21
|
-
const styled_native_1 =
|
|
17
|
+
const styled_native_1 = require("../../styled.native");
|
|
22
18
|
const HintText_1 = require("../HintText");
|
|
23
19
|
const LabelText_1 = require("../LabelText");
|
|
24
|
-
const
|
|
25
|
-
return `
|
|
26
|
-
width: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
27
|
-
height: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
28
|
-
margin-right: 10px;
|
|
29
|
-
`;
|
|
30
|
-
});
|
|
31
|
-
const StyledRadioInput = styled_native_1.default.View(({ theme, invalid, checked }) => {
|
|
32
|
-
return `
|
|
33
|
-
width: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
34
|
-
height: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
35
|
-
border: ${(0, element_core_1.numToPx)(theme.border.width.md)} solid;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
border-radius: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
39
|
-
border-color: ${invalid
|
|
40
|
-
? theme.input.color.borderError
|
|
41
|
-
: checked
|
|
42
|
-
? theme.input.color.selected
|
|
43
|
-
: theme.input.color.border};
|
|
44
|
-
background: ${checked ? theme.input.color.selectedTint : 'transparent'};
|
|
45
|
-
`;
|
|
46
|
-
});
|
|
47
|
-
const StyledRadioInputDot = styled_native_1.default.View(({ theme, checked }) => {
|
|
48
|
-
return `
|
|
49
|
-
width: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
50
|
-
height: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
51
|
-
border-radius: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
52
|
-
background: ${theme.input.color.selected};
|
|
53
|
-
opacity: ${checked ? 1 : 0};
|
|
54
|
-
`;
|
|
55
|
-
});
|
|
20
|
+
const Radio_styles_1 = require("./Radio.styles");
|
|
56
21
|
const Input = (_a) => {
|
|
57
22
|
var { checked, invalid, testID } = _a, rest = __rest(_a, ["checked", "invalid", "testID"]);
|
|
58
|
-
return ((0, jsx_runtime_1.jsx)(StyledRadioInputWrapper, Object.assign({}, rest, { children: (0, jsx_runtime_1.jsx)(StyledRadioInput, { invalid: invalid, checked: checked, testID: testID, children: (0, jsx_runtime_1.jsx)(StyledRadioInputDot, { checked: checked }) }) })));
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(Radio_styles_1.StyledRadioInputWrapper, Object.assign({}, rest, { children: (0, jsx_runtime_1.jsx)(Radio_styles_1.StyledRadioInput, { invalid: invalid, checked: checked, testID: testID, children: (0, jsx_runtime_1.jsx)(Radio_styles_1.StyledRadioInputDot, { checked: checked }) }) })));
|
|
59
24
|
};
|
|
60
|
-
const StyledWrapper = styled_native_1.default.View(({ theme }) => `
|
|
61
|
-
padding-top: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
62
|
-
flex-direction: row;
|
|
63
|
-
`);
|
|
64
25
|
const Radio = (_a) => {
|
|
65
26
|
var { label, hint, checked, invalid,
|
|
66
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
67
28
|
value, // "value" is needed for RadioGroup, but isn't actually used in the radio anywhere
|
|
68
29
|
activeOpacity = 0.8, testID, ref } = _a, rest = __rest(_a, ["label", "hint", "checked", "invalid", "value", "activeOpacity", "testID", "ref"]);
|
|
69
|
-
|
|
30
|
+
const theme = (0, styled_native_1.useTheme)();
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, Object.assign({ ref: ref, accessible: true, accessibilityRole: "radio", activeOpacity: activeOpacity, accessibilityState: { checked } }, rest, { children: (0, jsx_runtime_1.jsxs)(Radio_styles_1.StyledWrapper, { children: [(0, jsx_runtime_1.jsx)(Input, { checked: checked, invalid: invalid, testID: testID }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: { flexShrink: 1 }, children: [(0, jsx_runtime_1.jsx)(LabelText_1.LabelText, { style: { fontFamily: theme.native.font.family.book }, children: label }), hint ? (0, jsx_runtime_1.jsx)(HintText_1.HintText, { children: hint }) : null] })] }) })));
|
|
70
32
|
};
|
|
71
33
|
exports.Radio = Radio;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const StyledWrapper: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
2
|
+
export declare const StyledRadioInputDot: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
}, never>;
|
|
5
|
+
export declare const StyledRadioInput: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {
|
|
6
|
+
invalid?: boolean;
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const StyledRadioInputWrapper: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.StyledRadioInputWrapper = exports.StyledRadioInput = exports.StyledRadioInputDot = exports.StyledWrapper = void 0;
|
|
37
|
+
const element_core_1 = require("@ovotech/element-core");
|
|
38
|
+
const styled_native_1 = __importStar(require("../../styled.native"));
|
|
39
|
+
exports.StyledWrapper = styled_native_1.default.View(({ theme }) => (0, styled_native_1.css) `
|
|
40
|
+
padding-top: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
`);
|
|
43
|
+
exports.StyledRadioInputDot = styled_native_1.default.View(({ theme, checked }) => {
|
|
44
|
+
return (0, styled_native_1.css) `
|
|
45
|
+
width: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
46
|
+
height: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
47
|
+
border-radius: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
48
|
+
background: ${theme.input.color.selected};
|
|
49
|
+
opacity: ${checked ? 1 : 0};
|
|
50
|
+
`;
|
|
51
|
+
});
|
|
52
|
+
exports.StyledRadioInput = styled_native_1.default.View(({ theme, invalid, checked }) => {
|
|
53
|
+
return (0, styled_native_1.css) `
|
|
54
|
+
width: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
55
|
+
height: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
56
|
+
border: ${(0, element_core_1.numToPx)(theme.border.width.md)} solid;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
border-radius: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
60
|
+
border-color: ${invalid
|
|
61
|
+
? theme.input.color.borderError
|
|
62
|
+
: checked
|
|
63
|
+
? theme.input.color.selected
|
|
64
|
+
: theme.input.color.border};
|
|
65
|
+
background: ${checked ? theme.input.color.selectedTint : 'transparent'};
|
|
66
|
+
`;
|
|
67
|
+
});
|
|
68
|
+
exports.StyledRadioInputWrapper = styled_native_1.default.View(({ theme }) => {
|
|
69
|
+
return (0, styled_native_1.css) `
|
|
70
|
+
width: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
71
|
+
height: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
72
|
+
margin-right: 10px;
|
|
73
|
+
`;
|
|
74
|
+
});
|
|
@@ -6,6 +6,7 @@ type Props = Omit<TouchableOpacityProps, 'children'> & {
|
|
|
6
6
|
invalid?: boolean;
|
|
7
7
|
activeOpacity?: number;
|
|
8
8
|
ref?: React.Ref<View>;
|
|
9
|
+
alignment?: 'center' | 'left' | 'right';
|
|
9
10
|
};
|
|
10
|
-
export declare const RadioCard: ({ label, checked, invalid, activeOpacity, testID, ref, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const RadioCard: ({ label, checked, invalid, activeOpacity, testID, alignment, ref, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -10,68 +10,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
14
|
exports.RadioCard = void 0;
|
|
18
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
-
const element_core_1 = require("@ovotech/element-core");
|
|
20
16
|
const react_native_1 = require("react-native");
|
|
21
|
-
const styled_components_1 = require("styled-components");
|
|
22
|
-
const styled_native_1 = __importDefault(require("../../styled.native"));
|
|
23
17
|
const LabelText_1 = require("../LabelText");
|
|
24
|
-
const
|
|
25
|
-
return `
|
|
26
|
-
width: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
27
|
-
height: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
28
|
-
margin-top: ${(0, element_core_1.numToPx)(theme.space[200])};
|
|
29
|
-
`;
|
|
30
|
-
});
|
|
31
|
-
const StyledRadioInput = styled_native_1.default.View(({ theme, invalid, checked }) => {
|
|
32
|
-
return `
|
|
33
|
-
width: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
34
|
-
height: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
35
|
-
border: ${(0, element_core_1.numToPx)(theme.border.width.md)} solid;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
border-radius: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
39
|
-
border-color: ${invalid
|
|
40
|
-
? theme.input.color.borderError
|
|
41
|
-
: checked
|
|
42
|
-
? theme.input.color.selected
|
|
43
|
-
: theme.input.color.border};
|
|
44
|
-
background: ${checked ? theme.input.color.selectedTint : 'transparent'};
|
|
45
|
-
`;
|
|
46
|
-
});
|
|
47
|
-
const StyledRadioInputDot = styled_native_1.default.View(({ theme, checked }) => {
|
|
48
|
-
return `
|
|
49
|
-
width: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
50
|
-
height: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
51
|
-
border-radius: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
52
|
-
background: ${theme.input.color.selected};
|
|
53
|
-
opacity: ${checked ? 1 : 0};
|
|
54
|
-
`;
|
|
55
|
-
});
|
|
56
|
-
const Input = (_a) => {
|
|
57
|
-
var { checked, invalid, testID } = _a, rest = __rest(_a, ["checked", "invalid", "testID"]);
|
|
58
|
-
return ((0, jsx_runtime_1.jsx)(StyledRadioInputWrapper, Object.assign({}, rest, { children: (0, jsx_runtime_1.jsx)(StyledRadioInput, { invalid: invalid, checked: checked, testID: testID, children: (0, jsx_runtime_1.jsx)(StyledRadioInputDot, { checked: checked }) }) })));
|
|
59
|
-
};
|
|
60
|
-
const StyledWrapper = styled_native_1.default.View(({ theme, checked, invalid }) => (0, styled_components_1.css) `
|
|
61
|
-
align-items: center;
|
|
62
|
-
background: ${theme.color.surface.bright};
|
|
63
|
-
padding: ${(0, element_core_1.numToPx)(theme.space[200])};
|
|
64
|
-
min-width: 82px;
|
|
65
|
-
border-radius: ${(0, element_core_1.numToPx)(theme.border.radius.lg)};
|
|
66
|
-
border: ${(0, element_core_1.numToPx)(theme.border.width.md)} solid;
|
|
67
|
-
border-color: ${invalid
|
|
68
|
-
? theme.input.color.borderError
|
|
69
|
-
: checked
|
|
70
|
-
? theme.input.color.selected
|
|
71
|
-
: 'transparent'};
|
|
72
|
-
`);
|
|
18
|
+
const RadioCard_styles_1 = require("./RadioCard.styles");
|
|
73
19
|
const RadioCard = (_a) => {
|
|
74
|
-
var { label, checked, invalid, activeOpacity = 0.8, testID, ref } = _a, rest = __rest(_a, ["label", "checked", "invalid", "activeOpacity", "testID", "ref"]);
|
|
75
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, Object.assign({ ref: ref, accessible: true, accessibilityRole: "radio", activeOpacity: activeOpacity, accessibilityState: { checked } }, rest, { children: (0, jsx_runtime_1.jsxs)(StyledWrapper, { checked: checked, invalid: invalid, children: [typeof label === 'string' ? (0, jsx_runtime_1.jsx)(LabelText_1.LabelText, { children: label }) : label, (0, jsx_runtime_1.jsx)(Input, { checked: checked, invalid: invalid, testID: testID })] }) })));
|
|
20
|
+
var { label, checked, invalid, activeOpacity = 0.8, testID, alignment = 'center', ref } = _a, rest = __rest(_a, ["label", "checked", "invalid", "activeOpacity", "testID", "alignment", "ref"]);
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, Object.assign({ ref: ref, accessible: true, accessibilityRole: "radio", activeOpacity: activeOpacity, accessibilityState: { checked } }, rest, { children: (0, jsx_runtime_1.jsxs)(RadioCard_styles_1.StyledWrapper, { checked: checked, invalid: invalid, alignment: alignment, children: [(0, jsx_runtime_1.jsx)(RadioCard_styles_1.TextContainer, { children: typeof label === 'string' ? (0, jsx_runtime_1.jsx)(LabelText_1.LabelText, { children: label }) : label }), (0, jsx_runtime_1.jsx)(Input, { checked: checked, invalid: invalid, testID: testID })] }) })));
|
|
76
22
|
};
|
|
77
23
|
exports.RadioCard = RadioCard;
|
|
24
|
+
const Input = (_a) => {
|
|
25
|
+
var { checked, invalid, testID } = _a, rest = __rest(_a, ["checked", "invalid", "testID"]);
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(RadioCard_styles_1.StyledRadioInputWrapper, Object.assign({}, rest, { children: (0, jsx_runtime_1.jsx)(RadioCard_styles_1.StyledRadioInput, { invalid: invalid, checked: checked, testID: testID, children: (0, jsx_runtime_1.jsx)(RadioCard_styles_1.StyledRadioInputDot, { checked: checked }) }) })));
|
|
27
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const StyledRadioInputWrapper: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
2
|
+
export declare const StyledRadioInput: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {
|
|
3
|
+
invalid?: boolean;
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const StyledRadioInputDot: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
}, never>;
|
|
9
|
+
export declare const StyledWrapper: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {
|
|
10
|
+
checked: boolean;
|
|
11
|
+
invalid: boolean;
|
|
12
|
+
alignment: "center" | "left" | "right";
|
|
13
|
+
}, never>;
|
|
14
|
+
export declare const TextContainer: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core").ThemeNative, {
|
|
15
|
+
alignment: "center" | "left" | "right";
|
|
16
|
+
}, never>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TextContainer = exports.StyledWrapper = exports.StyledRadioInputDot = exports.StyledRadioInput = exports.StyledRadioInputWrapper = void 0;
|
|
37
|
+
const element_core_1 = require("@ovotech/element-core");
|
|
38
|
+
const styled_native_1 = __importStar(require("../../styled.native"));
|
|
39
|
+
exports.StyledRadioInputWrapper = styled_native_1.default.View(({ theme }) => {
|
|
40
|
+
return `
|
|
41
|
+
width: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
42
|
+
height: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
43
|
+
margin-top: ${(0, element_core_1.numToPx)(theme.space[200])};
|
|
44
|
+
`;
|
|
45
|
+
});
|
|
46
|
+
exports.StyledRadioInput = styled_native_1.default.View(({ theme, invalid, checked }) => {
|
|
47
|
+
return `
|
|
48
|
+
width: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
49
|
+
height: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
50
|
+
border: ${(0, element_core_1.numToPx)(theme.border.width.md)} solid;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
border-radius: ${(0, element_core_1.numToPx)(theme.space[600])};
|
|
54
|
+
border-color: ${invalid
|
|
55
|
+
? theme.input.color.borderError
|
|
56
|
+
: checked
|
|
57
|
+
? theme.input.color.selected
|
|
58
|
+
: theme.input.color.border};
|
|
59
|
+
background: ${checked ? theme.input.color.selectedTint : 'transparent'};
|
|
60
|
+
`;
|
|
61
|
+
});
|
|
62
|
+
exports.StyledRadioInputDot = styled_native_1.default.View(({ theme, checked }) => {
|
|
63
|
+
return `
|
|
64
|
+
width: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
65
|
+
height: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
66
|
+
border-radius: ${(0, element_core_1.numToPx)(theme.space[300])};
|
|
67
|
+
background: ${theme.input.color.selected};
|
|
68
|
+
opacity: ${checked ? 1 : 0};
|
|
69
|
+
`;
|
|
70
|
+
});
|
|
71
|
+
exports.StyledWrapper = styled_native_1.default.View(({ theme, checked, invalid, alignment }) => (0, styled_native_1.css) `
|
|
72
|
+
align-items: center;
|
|
73
|
+
text-align: center;
|
|
74
|
+
justify-content: ${alignment === 'center' ? 'center' : 'flex-end'};
|
|
75
|
+
flex-direction: ${alignment === 'left'
|
|
76
|
+
? 'row-reverse'
|
|
77
|
+
: alignment === 'right'
|
|
78
|
+
? 'row'
|
|
79
|
+
: 'column'};
|
|
80
|
+
background: ${theme.color.surface.bright};
|
|
81
|
+
padding: ${alignment === 'center'
|
|
82
|
+
? (0, element_core_1.numToPx)(theme.space[200])
|
|
83
|
+
: (0, element_core_1.numToPx)(theme.space[400])};
|
|
84
|
+
border-radius: ${(0, element_core_1.numToPx)(theme.border.radius.lg)};
|
|
85
|
+
border: ${(0, element_core_1.numToPx)(theme.border.width.md)} solid;
|
|
86
|
+
border-color: ${invalid
|
|
87
|
+
? theme.input.color.borderError
|
|
88
|
+
: checked
|
|
89
|
+
? theme.input.color.selected
|
|
90
|
+
: 'transparent'};
|
|
91
|
+
gap: ${alignment === 'center' ? 0 : (0, element_core_1.numToPx)(theme.space[400])};
|
|
92
|
+
`);
|
|
93
|
+
exports.TextContainer = styled_native_1.default.View(({ alignment }) => (0, styled_native_1.css) `
|
|
94
|
+
flex-direction: column;
|
|
95
|
+
flex-grow: 1;
|
|
96
|
+
text-align: ${alignment === 'center' ? 'center' : 'left'};
|
|
97
|
+
`);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconNameExtended } from '../../providers';
|
|
3
|
+
type Props = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
indicator?: boolean;
|
|
6
|
+
heading?: string;
|
|
7
|
+
subHeading?: string;
|
|
8
|
+
icon?: IconNameExtended;
|
|
9
|
+
maxChildren?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const Rail: ({ children, indicator, icon, heading, subHeading, maxChildren, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Rail = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = __importStar(require("react"));
|
|
39
|
+
const react_native_1 = require("react-native");
|
|
40
|
+
const Icon_1 = require("../Icon");
|
|
41
|
+
const P_1 = require("../P");
|
|
42
|
+
const Strong_1 = require("../Strong");
|
|
43
|
+
const RailIndicator_1 = require("./RailIndicator");
|
|
44
|
+
const styles_1 = require("./styles");
|
|
45
|
+
const useRailPaging_1 = require("./useRailPaging");
|
|
46
|
+
const DEFAULT_MAX_CHILDREN = 6;
|
|
47
|
+
const Rail = ({ children, indicator = true, icon, heading, subHeading, maxChildren = DEFAULT_MAX_CHILDREN, }) => {
|
|
48
|
+
const allItems = (0, react_1.useMemo)(() => react_1.default.Children.toArray(children), [children]);
|
|
49
|
+
const items = (0, react_1.useMemo)(() => allItems.slice(0, Math.max(0, maxChildren)), [allItems, maxChildren]);
|
|
50
|
+
const paging = (0, useRailPaging_1.useRailPaging)({ itemCount: items.length });
|
|
51
|
+
const hasIndicator = indicator && paging.isScrollable;
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsxs)(styles_1.Header, { children: [icon && ((0, jsx_runtime_1.jsx)(styles_1.IconContainer, { children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: icon, size: 24 }) })), (heading || subHeading) && ((0, jsx_runtime_1.jsxs)(styles_1.HeadingText, { children: [heading && ((0, jsx_runtime_1.jsx)(P_1.P, { size: "lg", children: (0, jsx_runtime_1.jsx)(Strong_1.Strong, { children: heading }) })), subHeading && (0, jsx_runtime_1.jsx)(P_1.P, { size: "sm", children: subHeading })] }))] }), (0, jsx_runtime_1.jsxs)(react_native_1.View, { onLayout: e => paging.onContainerLayout(e.nativeEvent.layout.width), children: [(0, jsx_runtime_1.jsx)(styles_1.StyledRail, { horizontal: true, hasIndicator: hasIndicator, showsHorizontalScrollIndicator: false, contentContainerStyle: { flexDirection: 'row' }, decelerationRate: "fast", snapToOffsets: paging.snapOffsets, snapToAlignment: "start", disableIntervalMomentum: true, scrollEventThrottle: 16, onMomentumScrollEnd: (e) => paging.onMomentumEnd(e.nativeEvent.contentOffset.x), onContentSizeChange: w => paging.onContentSizeChange(w), children: items.map((child, index) => ((0, jsx_runtime_1.jsx)(styles_1.RailItemWrapper, { onLayout: (e) => {
|
|
53
|
+
if (index !== 0)
|
|
54
|
+
return;
|
|
55
|
+
paging.onItemLayout(e.nativeEvent.layout.width);
|
|
56
|
+
}, children: child }, `Rail-item-${index}`))) }), hasIndicator && ((0, jsx_runtime_1.jsx)(RailIndicator_1.RailIndicator, { dotCount: items.length, activeStartIndex: paging.activeStartIndex, visibleCount: paging.visibleCount }))] })] }));
|
|
57
|
+
};
|
|
58
|
+
exports.Rail = Rail;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.RailIndicator = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_1 = require("react");
|
|
39
|
+
const react_native_reanimated_1 = __importStar(require("react-native-reanimated"));
|
|
40
|
+
const styled_native_1 = require("../../styled.native");
|
|
41
|
+
const styles_1 = require("./styles");
|
|
42
|
+
const RailIndicator = ({ dotCount, activeStartIndex, visibleCount, }) => {
|
|
43
|
+
const theme = (0, styled_native_1.useTheme)();
|
|
44
|
+
const DOT = theme.space[200];
|
|
45
|
+
const GAP = theme.space[200];
|
|
46
|
+
const PADDING = theme.space[350];
|
|
47
|
+
const [containerWidth, setContainerWidth] = (0, react_1.useState)(0);
|
|
48
|
+
const onContainerLayout = (0, react_1.useCallback)((e) => {
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
const w = (_c = (_b = (_a = e === null || e === void 0 ? void 0 : e.nativeEvent) === null || _a === void 0 ? void 0 : _a.layout) === null || _b === void 0 ? void 0 : _b.width) !== null && _c !== void 0 ? _c : 0;
|
|
51
|
+
if (w > 0)
|
|
52
|
+
setContainerWidth(w);
|
|
53
|
+
}, []);
|
|
54
|
+
if (dotCount <= 0)
|
|
55
|
+
return null;
|
|
56
|
+
const start = Math.min(Math.max(0, activeStartIndex), dotCount - 1);
|
|
57
|
+
const visible = Math.max(1, Math.min(visibleCount, dotCount - start));
|
|
58
|
+
const rowWidth = (0, react_1.useMemo)(() => {
|
|
59
|
+
return dotCount * DOT + (dotCount - 1) * GAP;
|
|
60
|
+
}, [dotCount, DOT, GAP]);
|
|
61
|
+
const step = DOT + GAP;
|
|
62
|
+
const animatedLeft = (0, react_native_reanimated_1.useDerivedValue)(() => {
|
|
63
|
+
if (containerWidth <= 0)
|
|
64
|
+
return 0;
|
|
65
|
+
const innerWidth = Math.max(0, containerWidth - 2 * PADDING);
|
|
66
|
+
const rowLeft = PADDING + Math.max(0, (innerWidth - rowWidth) / 2);
|
|
67
|
+
return (0, react_native_reanimated_1.withTiming)(rowLeft + start * step, { duration: 150 });
|
|
68
|
+
}, [containerWidth, PADDING, rowWidth, start, step]);
|
|
69
|
+
const animatedWidth = (0, react_native_reanimated_1.useDerivedValue)(() => {
|
|
70
|
+
const w = visible * DOT + Math.max(0, visible - 1) * GAP;
|
|
71
|
+
return (0, react_native_reanimated_1.withTiming)(w, { duration: 150 });
|
|
72
|
+
}, [visible, DOT, GAP]);
|
|
73
|
+
const pillStyle = (0, react_native_reanimated_1.useAnimatedStyle)(() => ({
|
|
74
|
+
position: 'absolute',
|
|
75
|
+
left: animatedLeft.value,
|
|
76
|
+
width: animatedWidth.value,
|
|
77
|
+
opacity: containerWidth > 0 ? 1 : 0,
|
|
78
|
+
}));
|
|
79
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.RailIndicatorContainer, { onLayout: onContainerLayout, children: [Array.from({ length: dotCount }).map((_, index) => ((0, jsx_runtime_1.jsx)(styles_1.DotContainer, { isActive: false }, `dot-${index}`))), (0, jsx_runtime_1.jsx)(react_native_reanimated_1.default.View, { pointerEvents: "none", style: pillStyle, children: (0, jsx_runtime_1.jsx)(styles_1.DotContainer, { isActive: true, style: { width: '100%' } }) })] }));
|
|
80
|
+
};
|
|
81
|
+
exports.RailIndicator = RailIndicator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Rail } from './Rail';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import Animated from 'react-native-reanimated';
|
|
3
|
+
export declare const StyledRail: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("react-native-reanimated").AnimatedScrollViewProps & import("react").RefAttributes<Animated.ScrollView>>, import("@ovotech/element-core/dist/tokens-build/theme-native.types").ThemeNative, {
|
|
4
|
+
hasIndicator: boolean;
|
|
5
|
+
}, never>;
|
|
6
|
+
export declare const RailItemWrapper: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core/dist/tokens-build/theme-native.types").ThemeNative, {}, never>;
|
|
7
|
+
export declare const RailIndicatorContainer: import("styled-components").StyledComponent<typeof import("react-native").View, import("@ovotech/element-core/dist/tokens-build/theme-native.types").ThemeNative, {}, never>;
|
|
8
|
+
export declare const DotContainer: import("styled-components").StyledComponent<import("react").ComponentClass<import("react-native-reanimated").AnimateProps<import("react-native").ViewProps>, any>, import("@ovotech/element-core/dist/tokens-build/theme-native.types").ThemeNative, {
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
}, never>;
|
|
11
|
+
export declare const Header: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core/dist/tokens-build/theme-native.types").ThemeNative, {}, never>;
|
|
12
|
+
export declare const HeadingText: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core/dist/tokens-build/theme-native.types").ThemeNative, {}, never>;
|
|
13
|
+
export declare const IconContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core/dist/tokens-build/theme-native.types").ThemeNative, {}, never>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.IconContainer = exports.HeadingText = exports.Header = exports.DotContainer = exports.RailIndicatorContainer = exports.RailItemWrapper = exports.StyledRail = void 0;
|
|
7
|
+
const react_native_1 = require("react-native");
|
|
8
|
+
const react_native_reanimated_1 = __importDefault(require("react-native-reanimated"));
|
|
9
|
+
const styled_native_1 = __importDefault(require("../../styled.native"));
|
|
10
|
+
exports.StyledRail = (0, styled_native_1.default)(react_native_reanimated_1.default.ScrollView)(({ theme, hasIndicator }) => ({
|
|
11
|
+
paddingVertical: theme.space[350],
|
|
12
|
+
paddingHorizontal: theme.space[50],
|
|
13
|
+
marginBottom: hasIndicator ? 0 : theme.space[900],
|
|
14
|
+
}));
|
|
15
|
+
exports.RailItemWrapper = styled_native_1.default.View(({ theme }) => ({
|
|
16
|
+
paddingHorizontal: theme.space[100],
|
|
17
|
+
}));
|
|
18
|
+
exports.RailIndicatorContainer = styled_native_1.default.View(({ theme }) => ({
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
alignItems: 'center',
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignSelf: 'center',
|
|
23
|
+
backgroundColor: theme.color.surface.dim,
|
|
24
|
+
borderRadius: theme.border.radius['2xl'],
|
|
25
|
+
padding: theme.space[350],
|
|
26
|
+
gap: theme.space[200],
|
|
27
|
+
}));
|
|
28
|
+
exports.DotContainer = (0, styled_native_1.default)(react_native_reanimated_1.default.View)(({ theme, isActive }) => ({
|
|
29
|
+
height: theme.space[200],
|
|
30
|
+
width: theme.space[200],
|
|
31
|
+
borderRadius: 9999,
|
|
32
|
+
backgroundColor: isActive
|
|
33
|
+
? theme.color.surface.onSurface
|
|
34
|
+
: theme.color.surface.onSurfaceVariant,
|
|
35
|
+
}));
|
|
36
|
+
exports.Header = (0, styled_native_1.default)(react_native_1.View)(({ theme }) => ({
|
|
37
|
+
flexDirection: 'row',
|
|
38
|
+
gap: theme.space[300],
|
|
39
|
+
marginBottom: -theme.space[100],
|
|
40
|
+
marginLeft: theme.space[100],
|
|
41
|
+
}));
|
|
42
|
+
exports.HeadingText = (0, styled_native_1.default)(react_native_1.View)({
|
|
43
|
+
flex: 1,
|
|
44
|
+
flexShrink: 1,
|
|
45
|
+
});
|
|
46
|
+
exports.IconContainer = (0, styled_native_1.default)(react_native_1.View)(({ theme }) => ({
|
|
47
|
+
borderRadius: theme.border.radius['2xl'],
|
|
48
|
+
backgroundColor: theme.color.surface.bright,
|
|
49
|
+
borderWidth: 0,
|
|
50
|
+
padding: theme.space[200],
|
|
51
|
+
width: theme.space[1100],
|
|
52
|
+
height: theme.space[1100],
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'center',
|
|
55
|
+
}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type UseRailPagingArgs = {
|
|
2
|
+
itemCount: number;
|
|
3
|
+
};
|
|
4
|
+
export declare function useRailPaging({ itemCount }: UseRailPagingArgs): {
|
|
5
|
+
snapOffsets: number[];
|
|
6
|
+
isScrollable: boolean;
|
|
7
|
+
activeStartIndex: number;
|
|
8
|
+
visibleCount: number;
|
|
9
|
+
onContainerLayout: (width: number) => void;
|
|
10
|
+
onContentSizeChange: (width: number) => void;
|
|
11
|
+
onItemLayout: (width: number) => void;
|
|
12
|
+
onMomentumEnd: (offsetX: number) => void;
|
|
13
|
+
};
|