@ovotech/element-native 5.5.0 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/styles.d.ts +3 -1725
- package/dist/components/ActionList/Action.d.ts +23 -0
- package/dist/components/ActionList/Action.js +29 -0
- package/dist/components/ActionList/ActionList.d.ts +11 -27
- package/dist/components/ActionList/ActionList.js +9 -25
- package/dist/components/ActionList/ActionListItems/DataListItem.d.ts +23 -0
- package/dist/components/ActionList/ActionListItems/DataListItem.js +23 -0
- package/dist/components/ActionList/ActionListItems/EditableListItem.d.ts +43 -0
- package/dist/components/ActionList/ActionListItems/EditableListItem.js +134 -0
- package/dist/components/ActionList/ActionListItems/NavigationListItem.d.ts +16 -0
- package/dist/components/ActionList/ActionListItems/NavigationListItem.js +30 -0
- package/dist/components/ActionList/ActionListItems/ProgressRing.d.ts +7 -0
- package/dist/components/ActionList/ActionListItems/ProgressRing.js +66 -0
- package/dist/components/ActionList/ActionListItems/ToggleListItem.d.ts +9 -0
- package/dist/components/ActionList/ActionListItems/ToggleListItem.js +12 -0
- package/dist/components/ActionList/ActionListItems/styles.d.ts +51 -0
- package/dist/components/ActionList/ActionListItems/styles.js +173 -0
- package/dist/components/ActionList/components/ActionListHeading.d.ts +9 -0
- package/dist/components/ActionList/components/ActionListHeading.js +11 -0
- package/dist/components/ActionList/index.d.ts +6 -1
- package/dist/components/ActionList/index.js +11 -2
- package/dist/components/ActionList/styled.d.ts +12 -5756
- package/dist/components/ActionList/styled.js +24 -9
- package/dist/components/Badge/Badge.d.ts +1 -575
- package/dist/components/BottomActionBar/BottomActionBar.d.ts +12 -0
- package/dist/components/BottomActionBar/BottomActionBar.js +80 -0
- package/dist/components/BottomActionBar/OverlayProvider.d.ts +8 -0
- package/dist/components/BottomActionBar/OverlayProvider.js +38 -0
- package/dist/components/BottomActionBar/index.d.ts +2 -0
- package/dist/components/BottomActionBar/index.js +7 -0
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.styles.d.ts +5 -2300
- package/dist/components/Card/Card.d.ts +7 -4
- package/dist/components/Card/Card.js +44 -22
- package/dist/components/Card/Card.styles.d.ts +4 -1725
- package/dist/components/Card/Card.styles.js +7 -11
- package/dist/components/Cards/AccountCard/AccountCard.styles.d.ts +8 -4600
- package/dist/components/Cards/BalanceCard/BalanceCard.styles.d.ts +15 -8625
- package/dist/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.d.ts +13 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.js +45 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.d.ts +3 -0
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +11 -0
- package/dist/components/Cards/DisruptiveCard/index.d.ts +1 -0
- package/dist/components/Cards/DisruptiveCard/index.js +17 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.d.ts +12 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.js +65 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.d.ts +10 -0
- package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.js +27 -0
- package/dist/components/Cards/HeroImageCard/index.d.ts +1 -0
- package/dist/components/Cards/HeroImageCard/index.js +17 -0
- package/dist/components/Cards/IconDataCard/IconDataCard.styles.d.ts +4 -2300
- package/dist/components/Cards/IconTextCard/IconTextCard.js +3 -16
- package/dist/components/Cards/IconTextCard/IconTextCard.styles.d.ts +3 -2300
- package/dist/components/Cards/IconTextCard/IconTextCard.styles.js +1 -6
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.d.ts +14 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.js +26 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.d.ts +18 -0
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +33 -0
- package/dist/components/Cards/IllustrationTextCard/index.d.ts +1 -0
- package/dist/components/Cards/IllustrationTextCard/index.js +17 -0
- package/dist/components/Cards/LinkTextCard/LinkTextCard.d.ts +2 -2
- package/dist/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
- package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.d.ts +8 -2875
- package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
- package/dist/components/Cards/OfferCard/OfferCard.d.ts +22 -0
- package/dist/components/Cards/OfferCard/OfferCard.js +36 -0
- package/dist/components/Cards/OfferCard/OfferCard.styles.d.ts +34 -0
- package/dist/components/Cards/OfferCard/OfferCard.styles.js +61 -0
- package/dist/components/Cards/OfferCard/index.d.ts +1 -0
- package/dist/components/Cards/OfferCard/index.js +17 -0
- package/dist/components/Cards/ProgressBarCard/ProgressBarCard.styles.d.ts +9 -5175
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.d.ts +12 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.js +27 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.d.ts +12 -0
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +31 -0
- package/dist/components/Cards/QuickLinkCard/index.d.ts +1 -0
- package/dist/components/Cards/QuickLinkCard/index.js +17 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.d.ts +12 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.js +24 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.d.ts +17 -0
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +38 -0
- package/dist/components/Cards/ServicesImageCard/index.d.ts +1 -0
- package/dist/components/Cards/ServicesImageCard/index.js +17 -0
- package/dist/components/Cards/components.d.ts +15 -0
- package/dist/components/Cards/components.js +24 -0
- package/dist/components/Cards/index.d.ts +5 -0
- package/dist/components/Cards/index.js +11 -1
- package/dist/components/Cards/shared.styles.d.ts +11 -3451
- package/dist/components/Cards/shared.styles.js +18 -2
- package/dist/components/Cards/utils.d.ts +1 -0
- package/dist/components/Cards/utils.js +13 -1
- package/dist/components/Checkbox/Checkbox.d.ts +2 -13
- package/dist/components/Checkbox/Checkbox.js +3 -49
- package/dist/components/Checkbox/styled.d.ts +21 -0
- package/dist/components/Checkbox/styled.js +52 -0
- package/dist/components/Checkbox/types.d.ts +16 -0
- package/dist/components/Checkbox/types.js +2 -0
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +2 -1
- package/dist/components/CurrencyInput/CurrencyInput.js +11 -4
- package/dist/components/CurrencyInput/styled.d.ts +10 -0
- package/dist/components/CurrencyInput/styled.js +39 -0
- package/dist/components/DataTable/styles.d.ts +13 -7475
- package/dist/components/Disclosure/Disclosure.d.ts +1 -575
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Divider/Divider.js +3 -1
- package/dist/components/Em/Em.d.ts +1 -575
- package/dist/components/EmailInput/EmailInput.d.ts +4 -1
- package/dist/components/EmailInput/EmailInput.js +18 -2
- package/dist/components/EmptyState/EmptyState.d.ts +2 -0
- package/dist/components/EmptyState/EmptyState.js +17 -0
- package/dist/components/EmptyState/EmptyState.test.d.ts +1 -0
- package/dist/components/EmptyState/EmptyState.test.js +92 -0
- package/dist/components/EmptyState/index.d.ts +1 -0
- package/dist/components/EmptyState/index.js +17 -0
- package/dist/components/EmptyState/styles.d.ts +2 -0
- package/dist/components/EmptyState/styles.js +23 -0
- package/dist/components/EmptyState/types.d.ts +18 -0
- package/dist/components/EmptyState/types.js +2 -0
- package/dist/components/ErrorText/ErrorText.d.ts +1 -575
- package/dist/components/Field/Field.d.ts +3 -2
- package/dist/components/Field/Field.js +3 -2
- package/dist/components/Grid/Col.d.ts +1 -575
- package/dist/components/HintText/HintText.d.ts +1 -575
- package/dist/components/Input/Input.d.ts +2 -1
- package/dist/components/Input/Input.js +6 -97
- package/dist/components/Input/styled.d.ts +16 -0
- package/dist/components/Input/styled.js +96 -0
- package/dist/components/LabelText/LabelText.d.ts +1 -575
- package/dist/components/LargeValueReference/LargeValueReference.d.ts +11 -0
- package/dist/components/LargeValueReference/LargeValueReference.js +49 -0
- package/dist/components/LargeValueReference/index.d.ts +1 -0
- package/dist/components/LargeValueReference/index.js +17 -0
- package/dist/components/LargeValueReference/styles.d.ts +10 -0
- package/dist/components/LargeValueReference/styles.js +29 -0
- package/dist/components/LineThrough/LineThrough.d.ts +1 -575
- package/dist/components/List/styled.d.ts +4 -2300
- package/dist/components/Margin/Margin.d.ts +1 -575
- package/dist/components/NavHeader/NavHeader.styles.d.ts +11 -6325
- package/dist/components/Notification/Notification.d.ts +2 -2
- package/dist/components/Notification/Notification.js +20 -12
- package/dist/components/Notification/Notification.styles.d.ts +13 -5175
- package/dist/components/Notification/Notification.styles.js +21 -2
- package/dist/components/PasswordInput/PasswordInput.styled.d.ts +1 -577
- package/dist/components/PasswordInput/PasswordInput.styled.js +5 -3
- package/dist/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
- package/dist/components/Radio/Radio.d.ts +2 -2
- package/dist/components/Radio/Radio.js +5 -43
- package/dist/components/Radio/Radio.styles.d.ts +9 -0
- package/dist/components/Radio/Radio.styles.js +74 -0
- package/dist/components/RadioCard/RadioCard.d.ts +2 -1
- package/dist/components/RadioCard/RadioCard.js +7 -57
- package/dist/components/RadioCard/RadioCard.styles.d.ts +16 -0
- package/dist/components/RadioCard/RadioCard.styles.js +97 -0
- package/dist/components/Rail/Rail.d.ts +12 -0
- package/dist/components/Rail/Rail.js +58 -0
- package/dist/components/Rail/RailIndicator.d.ts +7 -0
- package/dist/components/Rail/RailIndicator.js +81 -0
- package/dist/components/Rail/index.d.ts +1 -0
- package/dist/components/Rail/index.js +5 -0
- package/dist/components/Rail/styles.d.ts +13 -0
- package/dist/components/Rail/styles.js +55 -0
- package/dist/components/Rail/useRailPaging.d.ts +13 -0
- package/dist/components/Rail/useRailPaging.js +95 -0
- package/dist/components/SelectField/Select.d.ts +5 -579
- package/dist/components/SelectField/Select.js +7 -107
- package/dist/components/SelectField/SelectField.d.ts +2 -2
- package/dist/components/SelectField/SelectField.js +2 -2
- package/dist/components/SelectField/styled.d.ts +26 -0
- package/dist/components/SelectField/styled.js +118 -0
- package/dist/components/SkeletonText/SkeletonText.js +4 -4
- package/dist/components/Strong/Strong.d.ts +1 -575
- package/dist/components/SubLabelText/SubLabelText.d.ts +1 -575
- package/dist/components/Tabs/Tab.d.ts +1 -575
- package/dist/components/TextareaInput/TextareaInput.js +12 -6
- package/dist/components/Toast/Toast.d.ts +10 -4
- package/dist/components/Toast/Toast.js +40 -27
- package/dist/components/Toggle/Toggle.d.ts +3 -1
- package/dist/components/Toggle/Toggle.js +4 -6
- package/dist/components/Toggle/styles.d.ts +5 -2300
- package/dist/components/Toggle/styles.js +3 -3
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +5 -0
- package/dist/esm/components/ActionList/Action.js +26 -0
- package/dist/esm/components/ActionList/ActionList.js +12 -28
- package/dist/esm/components/ActionList/ActionListItems/DataListItem.js +19 -0
- package/dist/esm/components/ActionList/ActionListItems/EditableListItem.js +131 -0
- package/dist/esm/components/ActionList/ActionListItems/NavigationListItem.js +26 -0
- package/dist/esm/components/ActionList/ActionListItems/ProgressRing.js +29 -0
- package/dist/esm/components/ActionList/ActionListItems/ToggleListItem.js +8 -0
- package/dist/esm/components/ActionList/ActionListItems/styles.js +137 -0
- package/dist/esm/components/ActionList/components/ActionListHeading.js +7 -0
- package/dist/esm/components/ActionList/index.js +6 -1
- package/dist/esm/components/ActionList/styled.js +23 -8
- package/dist/esm/components/BottomActionBar/BottomActionBar.js +40 -0
- package/dist/esm/components/BottomActionBar/OverlayProvider.js +30 -0
- package/dist/esm/components/BottomActionBar/index.js +2 -0
- package/dist/esm/components/Button/Button.js +1 -1
- package/dist/esm/components/Card/Card.js +45 -23
- package/dist/esm/components/Card/Card.styles.js +8 -12
- package/dist/esm/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
- package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.js +41 -0
- package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +5 -0
- package/dist/esm/components/Cards/DisruptiveCard/index.js +1 -0
- package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.js +28 -0
- package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.styles.js +21 -0
- package/dist/esm/components/Cards/HeroImageCard/index.js +1 -0
- package/dist/esm/components/Cards/IconTextCard/IconTextCard.js +5 -18
- package/dist/esm/components/Cards/IconTextCard/IconTextCard.styles.js +0 -5
- package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.js +22 -0
- package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +27 -0
- package/dist/esm/components/Cards/IllustrationTextCard/index.js +1 -0
- package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
- package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
- package/dist/esm/components/Cards/OfferCard/OfferCard.js +32 -0
- package/dist/esm/components/Cards/OfferCard/OfferCard.styles.js +55 -0
- package/dist/esm/components/Cards/OfferCard/index.js +1 -0
- package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.js +23 -0
- package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +25 -0
- package/dist/esm/components/Cards/QuickLinkCard/index.js +1 -0
- package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.js +20 -0
- package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +32 -0
- package/dist/esm/components/Cards/ServicesImageCard/index.js +1 -0
- package/dist/esm/components/Cards/components.js +19 -0
- package/dist/esm/components/Cards/index.js +5 -0
- package/dist/esm/components/Cards/shared.styles.js +17 -1
- package/dist/esm/components/Cards/utils.js +11 -0
- package/dist/esm/components/Checkbox/Checkbox.js +2 -45
- package/dist/esm/components/Checkbox/styled.js +46 -0
- package/dist/esm/components/Checkbox/types.js +1 -0
- package/dist/esm/components/CurrencyInput/CurrencyInput.js +12 -5
- package/dist/esm/components/CurrencyInput/styled.js +33 -0
- package/dist/esm/components/Divider/Divider.js +3 -1
- package/dist/esm/components/EmailInput/EmailInput.js +18 -2
- package/dist/esm/components/EmptyState/EmptyState.js +13 -0
- package/dist/esm/components/EmptyState/EmptyState.test.js +90 -0
- package/dist/esm/components/EmptyState/index.js +1 -0
- package/dist/esm/components/EmptyState/styles.js +17 -0
- package/dist/esm/components/EmptyState/types.js +1 -0
- package/dist/esm/components/Field/Field.js +3 -2
- package/dist/esm/components/Input/Input.js +6 -64
- package/dist/esm/components/Input/styled.js +60 -0
- package/dist/esm/components/LargeValueReference/LargeValueReference.js +45 -0
- package/dist/esm/components/LargeValueReference/index.js +1 -0
- package/dist/esm/components/LargeValueReference/styles.js +23 -0
- package/dist/esm/components/Notification/Notification.js +21 -13
- package/dist/esm/components/Notification/Notification.styles.js +20 -1
- package/dist/esm/components/PasswordInput/PasswordInput.styled.js +5 -3
- package/dist/esm/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
- package/dist/esm/components/Radio/Radio.js +4 -39
- package/dist/esm/components/Radio/Radio.styles.js +38 -0
- package/dist/esm/components/RadioCard/RadioCard.js +5 -52
- package/dist/esm/components/RadioCard/RadioCard.styles.js +61 -0
- package/dist/esm/components/Rail/Rail.js +21 -0
- package/dist/esm/components/Rail/RailIndicator.js +44 -0
- package/dist/esm/components/Rail/index.js +1 -0
- package/dist/esm/components/Rail/styles.js +49 -0
- package/dist/esm/components/Rail/useRailPaging.js +92 -0
- package/dist/esm/components/SelectField/Select.js +7 -74
- package/dist/esm/components/SelectField/SelectField.js +3 -3
- package/dist/esm/components/SelectField/styled.js +82 -0
- package/dist/esm/components/SkeletonText/SkeletonText.js +4 -4
- package/dist/esm/components/TextareaInput/TextareaInput.js +12 -6
- package/dist/esm/components/Toast/Toast.js +40 -27
- package/dist/esm/components/Toggle/Toggle.js +4 -6
- package/dist/esm/components/Toggle/styles.js +3 -3
- package/dist/esm/components/index.js +5 -0
- package/dist/esm/hooks/use-font-scaling.js +32 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/test/utils.js +12 -0
- package/dist/esm/utils/utils.js +12 -1
- package/dist/hooks/use-font-scaling.d.ts +26 -0
- package/dist/hooks/use-font-scaling.js +35 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/styled.native.d.ts +1 -3445
- package/dist/test/utils.d.ts +4 -0
- package/dist/test/utils.js +28 -0
- package/dist/utils/utils.d.ts +11 -1
- package/dist/utils/utils.js +12 -0
- package/package.json +5 -5
- package/dist/components/ErrorWrapper/styles.d.ts +0 -0
- package/dist/components/ErrorWrapper/styles.js +0 -1
- package/dist/esm/components/ErrorWrapper/styles.js +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { AccessibilityRole, TouchableOpacityProps, View } from 'react-native';
|
|
3
|
+
import { IconName } from '../../providers';
|
|
4
|
+
import { SemanticVariants } from '../Badge';
|
|
5
|
+
type ActionProps = PropsWithChildren<TouchableOpacityProps & {
|
|
6
|
+
accessibilityRole?: AccessibilityRole;
|
|
7
|
+
accessibilityLabel?: string;
|
|
8
|
+
accessibilityHint?: string;
|
|
9
|
+
iconLeft?: IconName;
|
|
10
|
+
iconRight?: IconName;
|
|
11
|
+
inverted?: boolean;
|
|
12
|
+
onPress?: () => void;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
testID?: string;
|
|
15
|
+
inList?: boolean;
|
|
16
|
+
standalone?: boolean;
|
|
17
|
+
badgeText?: string;
|
|
18
|
+
badgeVariant?: SemanticVariants;
|
|
19
|
+
hint?: string;
|
|
20
|
+
ref?: React.RefObject<View | null>;
|
|
21
|
+
}>;
|
|
22
|
+
declare const Action: ({ accessibilityRole, accessibilityLabel, accessibilityHint, children, fullWidth, inverted, onPress, testID, iconLeft, iconRight, standalone, badgeVariant, badgeText, hint, ref, ...rest }: ActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export { Action };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.Action = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const react_native_1 = require("react-native");
|
|
17
|
+
const hooks_1 = require("../../hooks");
|
|
18
|
+
const Badge_1 = require("../Badge");
|
|
19
|
+
const styled_1 = require("./styled");
|
|
20
|
+
const ActionWrapper = (_a) => {
|
|
21
|
+
var { children, accessibilityRole, accessibilityLabel, accessibilityHint, activeOpacity = 0.75, fullWidth, hasBorder = false, inverted = false, inList, onPress, testID, standalone = false, ref } = _a, rest = __rest(_a, ["children", "accessibilityRole", "accessibilityLabel", "accessibilityHint", "activeOpacity", "fullWidth", "hasBorder", "inverted", "inList", "onPress", "testID", "standalone", "ref"]);
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(styled_1.StyledActionWrapper, Object.assign({ ref: ref, hasBorder: hasBorder, inverted: inverted, testID: testID, inList: inList }, rest, { children: (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { activeOpacity: activeOpacity, accessible: true, accessibilityRole: accessibilityRole, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, onPress: onPress, children: (0, jsx_runtime_1.jsx)(styled_1.StyledActionInner, { fullWidth: fullWidth, inList: inList, standalone: standalone, children: children }) }) })));
|
|
23
|
+
};
|
|
24
|
+
const Action = (_a) => {
|
|
25
|
+
var { accessibilityRole = 'link', accessibilityLabel, accessibilityHint, children, fullWidth = false, inverted = false, onPress, testID, iconLeft, iconRight, standalone = false, badgeVariant = 'info', badgeText, hint, ref } = _a, rest = __rest(_a, ["accessibilityRole", "accessibilityLabel", "accessibilityHint", "children", "fullWidth", "inverted", "onPress", "testID", "iconLeft", "iconRight", "standalone", "badgeVariant", "badgeText", "hint", "ref"]);
|
|
26
|
+
const { smallAndUp } = (0, hooks_1.useBreakpoint)();
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(ActionWrapper, Object.assign({ ref: ref, accessibilityRole: accessibilityRole, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, fullWidth: fullWidth, inverted: inverted, onPress: onPress, testID: testID, standalone: standalone, hint: hint, badgeText: badgeText }, rest, { children: [iconLeft ? ((0, jsx_runtime_1.jsx)(styled_1.StyledLeftIcon, { inverted: inverted, name: iconLeft, size: 16 })) : null, (0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [typeof children === 'string' ? ((0, jsx_runtime_1.jsxs)(styled_1.StyledTextWrapper, { children: [(0, jsx_runtime_1.jsx)(styled_1.StyledActionText, { smallAndUp: smallAndUp, inverted: inverted, children: children }), badgeText ? ((0, jsx_runtime_1.jsx)(Badge_1.Badge, { variant: badgeVariant, children: badgeText })) : null] })) : ((0, jsx_runtime_1.jsx)(styled_1.StyledActionNodeWrapper, { children: children })), hint ? ((0, jsx_runtime_1.jsx)(styled_1.StyledHintText, { inverted: inverted, children: hint })) : null] }), iconRight ? ((0, jsx_runtime_1.jsx)(styled_1.StyledRightIcon, { inverted: inverted, name: iconRight, size: 16 })) : null] })));
|
|
28
|
+
};
|
|
29
|
+
exports.Action = Action;
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type ActionListProps = ViewProps & {
|
|
6
|
-
inverted?: boolean;
|
|
7
|
-
borderBottom?: boolean;
|
|
1
|
+
import { ViewProps } from 'react-native';
|
|
2
|
+
import { IconNameExtended } from '../../providers';
|
|
3
|
+
type ActionListBaseProps = ViewProps & {
|
|
4
|
+
iconColor?: string;
|
|
8
5
|
};
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
onPress?: () => void;
|
|
17
|
-
fullWidth?: boolean;
|
|
18
|
-
testID?: string;
|
|
19
|
-
inList?: boolean;
|
|
20
|
-
standalone?: boolean;
|
|
21
|
-
badgeText?: string;
|
|
22
|
-
badgeVariant?: SemanticVariants;
|
|
23
|
-
hint?: string;
|
|
24
|
-
ref?: React.RefObject<View | null>;
|
|
25
|
-
}>;
|
|
26
|
-
declare const ActionList: ({ children, inverted, borderBottom, ...rest }: ActionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
declare const Action: ({ accessibilityRole, accessibilityLabel, accessibilityHint, children, fullWidth, inverted, onPress, testID, iconLeft, iconRight, standalone, badgeVariant, badgeText, hint, ref, ...rest }: ActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
export { Action, ActionList };
|
|
6
|
+
type ActionListProps = ActionListBaseProps & {
|
|
7
|
+
iconName?: IconNameExtended;
|
|
8
|
+
heading?: string;
|
|
9
|
+
subheading?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const ActionList: ({ children, iconName, iconColor, heading, subheading, ...rest }: ActionListProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -11,38 +11,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.ActionList =
|
|
14
|
+
exports.ActionList = void 0;
|
|
15
15
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
16
|
const react_1 = require("react");
|
|
17
17
|
const react_native_1 = require("react-native");
|
|
18
|
-
const hooks_1 = require("../../hooks");
|
|
19
18
|
const utils_1 = require("../../utils");
|
|
20
|
-
const
|
|
19
|
+
const Divider_1 = require("../Divider");
|
|
20
|
+
const ActionListHeading_1 = require("./components/ActionListHeading");
|
|
21
21
|
const styled_1 = require("./styled");
|
|
22
22
|
const ActionList = (_a) => {
|
|
23
|
-
var { children,
|
|
23
|
+
var { children, iconName, iconColor, heading, subheading } = _a, rest = __rest(_a, ["children", "iconName", "iconColor", "heading", "subheading"]);
|
|
24
24
|
const validChildren = (0, utils_1.getValidChildren)(children);
|
|
25
25
|
const childCount = react_1.Children.count(validChildren);
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(styled_1.StyledActionList, Object.assign({}, rest, { children: react_1.Children.map(validChildren, (child, index) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
hasBorder: (childCount > 1 && index !== childCount - 1) || borderBottom,
|
|
32
|
-
inverted: (_a = child.props.inverted) !== null && _a !== void 0 ? _a : inverted, // prioritise child prop
|
|
33
|
-
inList: true,
|
|
34
|
-
iconRight: (_b = child.props.iconRight) !== null && _b !== void 0 ? _b : 'chevron-right-small',
|
|
35
|
-
});
|
|
36
|
-
}) })));
|
|
26
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, jsx_runtime_1.jsx)(ActionListHeading_1.ActionListHeading, { iconName: iconName, heading: heading, subheading: subheading, iconColor: iconColor }), (0, jsx_runtime_1.jsx)(styled_1.StyledActionList, Object.assign({}, rest, { children: react_1.Children.map(validChildren, (child, index) => ((0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [(0, react_1.cloneElement)(child, {
|
|
27
|
+
fullWidth: true,
|
|
28
|
+
index,
|
|
29
|
+
inList: true,
|
|
30
|
+
}), childCount > 1 && index !== childCount - 1 && (0, jsx_runtime_1.jsx)(Divider_1.Divider, {})] }))) }))] }));
|
|
37
31
|
};
|
|
38
32
|
exports.ActionList = ActionList;
|
|
39
|
-
const ActionWrapper = (_a) => {
|
|
40
|
-
var { children, accessibilityRole, accessibilityLabel, accessibilityHint, activeOpacity = 0.75, fullWidth, hasBorder = false, inverted = false, inList, onPress, testID, standalone = false, ref } = _a, rest = __rest(_a, ["children", "accessibilityRole", "accessibilityLabel", "accessibilityHint", "activeOpacity", "fullWidth", "hasBorder", "inverted", "inList", "onPress", "testID", "standalone", "ref"]);
|
|
41
|
-
return ((0, jsx_runtime_1.jsx)(styled_1.StyledActionWrapper, Object.assign({ ref: ref, hasBorder: hasBorder, inverted: inverted, testID: testID, inList: inList }, rest, { children: (0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { activeOpacity: activeOpacity, accessible: true, accessibilityRole: accessibilityRole, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, onPress: onPress, children: (0, jsx_runtime_1.jsx)(styled_1.StyledActionInner, { fullWidth: fullWidth, inList: inList, standalone: standalone, children: children }) }) })));
|
|
42
|
-
};
|
|
43
|
-
const Action = (_a) => {
|
|
44
|
-
var { accessibilityRole = 'link', accessibilityLabel, accessibilityHint, children, fullWidth = false, inverted = false, onPress, testID, iconLeft, iconRight, standalone = false, badgeVariant = 'info', badgeText, hint, ref } = _a, rest = __rest(_a, ["accessibilityRole", "accessibilityLabel", "accessibilityHint", "children", "fullWidth", "inverted", "onPress", "testID", "iconLeft", "iconRight", "standalone", "badgeVariant", "badgeText", "hint", "ref"]);
|
|
45
|
-
const { smallAndUp } = (0, hooks_1.useBreakpoint)();
|
|
46
|
-
return ((0, jsx_runtime_1.jsxs)(ActionWrapper, Object.assign({ ref: ref, accessibilityRole: accessibilityRole, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, fullWidth: fullWidth, inverted: inverted, onPress: onPress, testID: testID, standalone: standalone, hint: hint, badgeText: badgeText }, rest, { children: [iconLeft ? ((0, jsx_runtime_1.jsx)(styled_1.StyledLeftIcon, { inverted: inverted, name: iconLeft, size: 16 })) : null, (0, jsx_runtime_1.jsxs)(react_native_1.View, { children: [typeof children === 'string' ? ((0, jsx_runtime_1.jsxs)(styled_1.StyledTextWrapper, { children: [(0, jsx_runtime_1.jsx)(styled_1.StyledActionText, { smallAndUp: smallAndUp, inverted: inverted, children: children }), badgeText ? ((0, jsx_runtime_1.jsx)(Badge_1.Badge, { variant: badgeVariant, children: badgeText })) : null] })) : ((0, jsx_runtime_1.jsx)(styled_1.StyledActionNodeWrapper, { children: children })), hint ? ((0, jsx_runtime_1.jsx)(styled_1.StyledHintText, { inverted: inverted, children: hint })) : null] }), iconRight ? ((0, jsx_runtime_1.jsx)(styled_1.StyledRightIcon, { inverted: inverted, name: iconRight, size: 16 })) : null] })));
|
|
47
|
-
};
|
|
48
|
-
exports.Action = Action;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ImageSourcePropType } from 'react-native';
|
|
2
|
+
import { IconNameExtended } from '../../../providers';
|
|
3
|
+
type Graphic = {
|
|
4
|
+
type: 'icon';
|
|
5
|
+
icon: IconNameExtended;
|
|
6
|
+
iconColor?: string;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'image';
|
|
9
|
+
image: ImageSourcePropType | string;
|
|
10
|
+
} | undefined;
|
|
11
|
+
type Props = {
|
|
12
|
+
testID?: string;
|
|
13
|
+
graphic?: Graphic;
|
|
14
|
+
progressRingPercentage?: number;
|
|
15
|
+
heading?: string;
|
|
16
|
+
subHeading?: string;
|
|
17
|
+
statusText?: 'Info' | 'Error';
|
|
18
|
+
valueText?: string;
|
|
19
|
+
valueSubText?: string;
|
|
20
|
+
directionLabel?: 'In' | 'Out';
|
|
21
|
+
};
|
|
22
|
+
export declare const DataListItem: ({ testID, graphic, progressRingPercentage, heading, subHeading, statusText, valueText, valueSubText, directionLabel, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataListItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const use_font_scaling_1 = require("../../../hooks/use-font-scaling");
|
|
6
|
+
const styled_native_1 = require("../../../styled.native");
|
|
7
|
+
const Icon_1 = require("../../Icon");
|
|
8
|
+
const LabelText_1 = require("../../LabelText");
|
|
9
|
+
const P_1 = require("../../P");
|
|
10
|
+
const ProgressRing_1 = require("./ProgressRing");
|
|
11
|
+
const styles_1 = require("./styles");
|
|
12
|
+
const DataListItem = ({ testID, graphic, progressRingPercentage, heading, subHeading, statusText, valueText, valueSubText, directionLabel, }) => {
|
|
13
|
+
const theme = (0, styled_native_1.useTheme)();
|
|
14
|
+
const isError = statusText === 'Error';
|
|
15
|
+
const hasProgressRing = progressRingPercentage !== undefined;
|
|
16
|
+
const { isFontScalingLarge } = (0, use_font_scaling_1.useFontScaling)();
|
|
17
|
+
const IconContent = (graphic === null || graphic === void 0 ? void 0 : graphic.type) === 'icon' ? ((0, jsx_runtime_1.jsx)(styles_1.GraphicContainer, { isIcon: true, hasProgress: hasProgressRing, children: (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: graphic.icon, size: 24, color: graphic.iconColor ? graphic.iconColor : theme.color.brand.brand }) })) : null;
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.ActionListItemWrapper, { testID: testID, children: [(graphic === null || graphic === void 0 ? void 0 : graphic.type) === 'icon' &&
|
|
19
|
+
(hasProgressRing ? ((0, jsx_runtime_1.jsx)(ProgressRing_1.ProgressRing, { percentage: progressRingPercentage, children: IconContent })) : (IconContent)), (graphic === null || graphic === void 0 ? void 0 : graphic.type) === 'image' && ((0, jsx_runtime_1.jsx)(styles_1.GraphicContainer, { children: (0, jsx_runtime_1.jsx)(styles_1.StyledImage, { source: typeof graphic.image === 'string'
|
|
20
|
+
? { uri: graphic.image }
|
|
21
|
+
: graphic.image, resizeMode: "cover", accessibilityLabel: 'Data List Image' }) })), (0, jsx_runtime_1.jsxs)(styles_1.LeftTextContainer, { children: [heading && (0, jsx_runtime_1.jsx)(LabelText_1.LabelText, { children: heading }), subHeading && (0, jsx_runtime_1.jsx)(P_1.P, { size: "sm", children: subHeading }), statusText && ((0, jsx_runtime_1.jsx)(styles_1.StatusText, { size: "sm", isError: isError, children: statusText }))] }), (0, jsx_runtime_1.jsxs)(styles_1.RightTextContainer, { children: [(0, jsx_runtime_1.jsxs)(styles_1.DirectionAndValueTextContainer, { children: [directionLabel && ((0, jsx_runtime_1.jsx)(styles_1.DirectionLabelContainer, { scaledUpFont: isFontScalingLarge, children: (0, jsx_runtime_1.jsx)(styles_1.OnSurfaceP, { size: "sm", children: directionLabel }) })), valueText && ((0, jsx_runtime_1.jsx)(styles_1.ValueTextContainer, { scaledUpFont: isFontScalingLarge, children: (0, jsx_runtime_1.jsx)(styles_1.DataValueText, { isError: isError, size: "lg", children: valueText }) }))] }), valueSubText && (0, jsx_runtime_1.jsx)(styles_1.OnSurfaceP, { size: "sm", children: valueSubText })] })] }));
|
|
22
|
+
};
|
|
23
|
+
exports.DataListItem = DataListItem;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type Option = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
type ValueByType = {
|
|
6
|
+
text: string;
|
|
7
|
+
location: string;
|
|
8
|
+
email: string;
|
|
9
|
+
textarea: string;
|
|
10
|
+
number: number | null;
|
|
11
|
+
currency: number | null;
|
|
12
|
+
select: Option | null;
|
|
13
|
+
};
|
|
14
|
+
type EditableInput = {
|
|
15
|
+
type: 'text';
|
|
16
|
+
defaultValue?: ValueByType['text'];
|
|
17
|
+
} | {
|
|
18
|
+
type: 'location';
|
|
19
|
+
defaultValue?: ValueByType['location'];
|
|
20
|
+
} | {
|
|
21
|
+
type: 'email';
|
|
22
|
+
defaultValue?: ValueByType['email'];
|
|
23
|
+
} | {
|
|
24
|
+
type: 'textarea';
|
|
25
|
+
defaultValue?: ValueByType['textarea'];
|
|
26
|
+
} | {
|
|
27
|
+
type: 'number';
|
|
28
|
+
defaultValue?: ValueByType['number'];
|
|
29
|
+
} | {
|
|
30
|
+
type: 'currency';
|
|
31
|
+
defaultValue?: ValueByType['currency'];
|
|
32
|
+
} | {
|
|
33
|
+
type: 'select';
|
|
34
|
+
options: Option[];
|
|
35
|
+
defaultValue?: ValueByType['select'];
|
|
36
|
+
};
|
|
37
|
+
type Props = {
|
|
38
|
+
heading?: string;
|
|
39
|
+
input: EditableInput;
|
|
40
|
+
onSave?: (value: any) => void;
|
|
41
|
+
};
|
|
42
|
+
export declare const EditableListItem: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<any>>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EditableListItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const CurrencyInput_1 = require("../../CurrencyInput");
|
|
7
|
+
const EmailInput_1 = require("../../EmailInput");
|
|
8
|
+
const Input_1 = require("../../Input/Input");
|
|
9
|
+
const Link_1 = require("../../Link");
|
|
10
|
+
const Margin_1 = require("../../Margin");
|
|
11
|
+
const NumberInput_1 = require("../../NumberInput");
|
|
12
|
+
const P_1 = require("../../P");
|
|
13
|
+
const SelectField_1 = require("../../SelectField");
|
|
14
|
+
const Strong_1 = require("../../Strong");
|
|
15
|
+
const TextareaInput_1 = require("../../TextareaInput");
|
|
16
|
+
const styles_1 = require("./styles");
|
|
17
|
+
const getInitialValue = (input) => {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
switch (input.type) {
|
|
20
|
+
case 'number':
|
|
21
|
+
case 'currency':
|
|
22
|
+
return (_a = input.defaultValue) !== null && _a !== void 0 ? _a : null;
|
|
23
|
+
case 'select':
|
|
24
|
+
return (_b = input.defaultValue) !== null && _b !== void 0 ? _b : null;
|
|
25
|
+
case 'text':
|
|
26
|
+
case 'location':
|
|
27
|
+
case 'email':
|
|
28
|
+
case 'textarea':
|
|
29
|
+
return (_c = input.defaultValue) !== null && _c !== void 0 ? _c : '';
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function acceptNumericInput(nextText, prevText) {
|
|
33
|
+
var _a;
|
|
34
|
+
if (nextText === '')
|
|
35
|
+
return '';
|
|
36
|
+
if (!/^[0-9.]*$/.test(nextText))
|
|
37
|
+
return prevText;
|
|
38
|
+
if (((_a = nextText.match(/\./g)) !== null && _a !== void 0 ? _a : []).length > 1)
|
|
39
|
+
return prevText;
|
|
40
|
+
return nextText;
|
|
41
|
+
}
|
|
42
|
+
function parseDraftNumericText(text) {
|
|
43
|
+
if (text === '' || text === '.' || text.endsWith('.'))
|
|
44
|
+
return null;
|
|
45
|
+
const n = Number(text);
|
|
46
|
+
return Number.isFinite(n) ? n : null;
|
|
47
|
+
}
|
|
48
|
+
exports.EditableListItem = (0, react_1.forwardRef)(({ heading, input, onSave }, ref) => {
|
|
49
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
50
|
+
const initialValue = (0, react_1.useMemo)(() => getInitialValue(input), [input]);
|
|
51
|
+
const [editState, setEditState] = (0, react_1.useState)('initial');
|
|
52
|
+
const [value, setValue] = (0, react_1.useState)(initialValue);
|
|
53
|
+
const [draft, setDraft] = (0, react_1.useState)(initialValue);
|
|
54
|
+
const [numericInputText, setNumericInputText] = (0, react_1.useState)('');
|
|
55
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
56
|
+
getValue: () => value,
|
|
57
|
+
}));
|
|
58
|
+
const handleNumericChange = (nextText) => {
|
|
59
|
+
const accepted = acceptNumericInput(nextText, numericInputText);
|
|
60
|
+
if (accepted === numericInputText)
|
|
61
|
+
return;
|
|
62
|
+
setNumericInputText(accepted);
|
|
63
|
+
};
|
|
64
|
+
const startEditing = () => {
|
|
65
|
+
setDraft(value);
|
|
66
|
+
setEditState('editing');
|
|
67
|
+
if (input.type === 'number' || input.type === 'currency') {
|
|
68
|
+
const n = value;
|
|
69
|
+
setNumericInputText(n === null ? '' : String(n));
|
|
70
|
+
}
|
|
71
|
+
requestAnimationFrame(() => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
(_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
const saveEditing = () => {
|
|
77
|
+
const nextValue = input.type === 'number' || input.type === 'currency'
|
|
78
|
+
? parseDraftNumericText(numericInputText)
|
|
79
|
+
: draft;
|
|
80
|
+
setValue(nextValue);
|
|
81
|
+
setEditState('initial');
|
|
82
|
+
onSave === null || onSave === void 0 ? void 0 : onSave(nextValue);
|
|
83
|
+
};
|
|
84
|
+
const cancelEditing = () => {
|
|
85
|
+
setDraft(value);
|
|
86
|
+
if (input.type === 'number' || input.type === 'currency') {
|
|
87
|
+
const n = value;
|
|
88
|
+
setNumericInputText(n === null ? '' : String(n));
|
|
89
|
+
}
|
|
90
|
+
setEditState('initial');
|
|
91
|
+
};
|
|
92
|
+
const displayValue = (0, react_1.useMemo)(() => {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
switch (input.type) {
|
|
95
|
+
case 'select':
|
|
96
|
+
return (_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : '-';
|
|
97
|
+
case 'number':
|
|
98
|
+
case 'currency':
|
|
99
|
+
return (_b = value === null || value === void 0 ? void 0 : value.toString()) !== null && _b !== void 0 ? _b : '-';
|
|
100
|
+
default: {
|
|
101
|
+
const v = value;
|
|
102
|
+
return v === '' ? '-' : v;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}, [input.type, value]);
|
|
106
|
+
const renderEditingInput = () => {
|
|
107
|
+
var _a;
|
|
108
|
+
if (editState !== 'editing')
|
|
109
|
+
return null;
|
|
110
|
+
switch (input.type) {
|
|
111
|
+
case 'text':
|
|
112
|
+
return ((0, jsx_runtime_1.jsx)(Input_1.Input, { ref: inputRef, value: draft, onChangeText: v => setDraft(v) }));
|
|
113
|
+
case 'location':
|
|
114
|
+
return ((0, jsx_runtime_1.jsx)(Input_1.Input, { ref: inputRef, value: draft, onChangeText: v => setDraft(v), iconLeft: "address" }));
|
|
115
|
+
case 'email':
|
|
116
|
+
return ((0, jsx_runtime_1.jsx)(EmailInput_1.EmailInput, { ref: inputRef, value: draft, onChangeText: v => setDraft(v) }));
|
|
117
|
+
case 'textarea':
|
|
118
|
+
return ((0, jsx_runtime_1.jsx)(TextareaInput_1.TextareaInput, { ref: inputRef, value: draft, onChangeText: v => setDraft(v) }));
|
|
119
|
+
case 'number':
|
|
120
|
+
return ((0, jsx_runtime_1.jsx)(NumberInput_1.NumberInput, { ref: inputRef, value: numericInputText, onChangeText: handleNumericChange }));
|
|
121
|
+
case 'currency':
|
|
122
|
+
return ((0, jsx_runtime_1.jsx)(CurrencyInput_1.CurrencyInput, { ref: inputRef, value: numericInputText, onChangeText: handleNumericChange }));
|
|
123
|
+
case 'select': {
|
|
124
|
+
const selected = (_a = draft) !== null && _a !== void 0 ? _a : {
|
|
125
|
+
label: 'None',
|
|
126
|
+
value: 'default',
|
|
127
|
+
};
|
|
128
|
+
return ((0, jsx_runtime_1.jsx)(SelectField_1.SelectField, { ref: inputRef, label: "", options: input.options, onSelected: opt => setDraft(opt.value === 'default' ? null : opt), defaultSelected: selected }));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
return ((0, jsx_runtime_1.jsx)(styles_1.ActionListItemWrapper, { children: (0, jsx_runtime_1.jsxs)(styles_1.EditableListContainer, { children: [heading && ((0, jsx_runtime_1.jsx)(P_1.P, { children: (0, jsx_runtime_1.jsx)(Strong_1.Strong, { children: heading }) })), editState === 'initial' ? ((0, jsx_runtime_1.jsxs)(styles_1.InitialStateContainer, { children: [(0, jsx_runtime_1.jsx)(styles_1.ValueText, { children: displayValue }), (0, jsx_runtime_1.jsx)(Link_1.TextLink, { onPress: startEditing, children: (0, jsx_runtime_1.jsx)(P_1.P, { size: "md", children: displayValue === '-' ? 'Add' : 'Change' }) })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderEditingInput(), (0, jsx_runtime_1.jsx)(Margin_1.Margin, { top: 2 }), (0, jsx_runtime_1.jsxs)(styles_1.EditButtonsContainer, { children: [(0, jsx_runtime_1.jsx)(Link_1.TextLink, { onPress: saveEditing, children: (0, jsx_runtime_1.jsx)(P_1.P, { children: "Save" }) }), (0, jsx_runtime_1.jsx)(Link_1.TextLink, { onPress: cancelEditing, children: (0, jsx_runtime_1.jsx)(P_1.P, { children: "Cancel" }) })] })] }))] }) }));
|
|
133
|
+
});
|
|
134
|
+
exports.EditableListItem.displayName = 'EditableListItem';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { AccessibilityRole, TouchableOpacityProps } from 'react-native';
|
|
3
|
+
import { IconNameExtended } from '../../../providers';
|
|
4
|
+
type NavigationListItemProps = PropsWithChildren<Omit<TouchableOpacityProps, 'onPress'>> & {
|
|
5
|
+
testID?: string;
|
|
6
|
+
iconLeft?: IconNameExtended;
|
|
7
|
+
heading?: string;
|
|
8
|
+
subHeading?: string;
|
|
9
|
+
iconRight?: IconNameExtended;
|
|
10
|
+
onPress?: () => void;
|
|
11
|
+
accessibilityRole?: AccessibilityRole;
|
|
12
|
+
accessibilityLabel?: string;
|
|
13
|
+
accessibilityHint?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare const NavigationListItem: ({ testID, iconLeft, iconRight, heading, subHeading, onPress, accessibilityRole, accessibilityLabel, accessibilityHint, activeOpacity, disabled, ...touchableProps }: NavigationListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.NavigationListItem = void 0;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const react_native_1 = require("react-native");
|
|
17
|
+
const styled_native_1 = require("../../../styled.native");
|
|
18
|
+
const Icon_1 = require("../../Icon");
|
|
19
|
+
const P_1 = require("../../P");
|
|
20
|
+
const styles_1 = require("./styles");
|
|
21
|
+
const NavigationListItem = (_a) => {
|
|
22
|
+
var { testID, iconLeft, iconRight, heading, subHeading, onPress, accessibilityRole, accessibilityLabel, accessibilityHint, activeOpacity = 0.75, disabled } = _a, touchableProps = __rest(_a, ["testID", "iconLeft", "iconRight", "heading", "subHeading", "onPress", "accessibilityRole", "accessibilityLabel", "accessibilityHint", "activeOpacity", "disabled"]);
|
|
23
|
+
const theme = (0, styled_native_1.useTheme)();
|
|
24
|
+
const isPressable = !!onPress && !disabled;
|
|
25
|
+
const Wrapper = isPressable ? react_native_1.TouchableOpacity : react_native_1.View;
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(Wrapper, Object.assign({ testID: testID }, (isPressable && Object.assign({ activeOpacity,
|
|
27
|
+
onPress,
|
|
28
|
+
disabled, accessible: true, accessibilityRole: accessibilityRole !== null && accessibilityRole !== void 0 ? accessibilityRole : 'button', accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : heading, accessibilityHint }, touchableProps)), { children: (0, jsx_runtime_1.jsxs)(styles_1.ActionListItemWrapper, { children: [iconLeft && ((0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: iconLeft, size: 24, color: theme.color.brand.brand })), (heading || subHeading) && ((0, jsx_runtime_1.jsxs)(styles_1.TextContainer, { children: [heading && (0, jsx_runtime_1.jsx)(P_1.P, { children: heading }), subHeading && (0, jsx_runtime_1.jsx)(styles_1.SubHeading, { size: "sm", children: subHeading })] })), iconRight && (0, jsx_runtime_1.jsx)(Icon_1.Icon, { name: iconRight, size: 20 })] }) })));
|
|
29
|
+
};
|
|
30
|
+
exports.NavigationListItem = NavigationListItem;
|
|
@@ -0,0 +1,66 @@
|
|
|
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.ProgressRing = void 0;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const react_native_1 = require("react-native");
|
|
39
|
+
const react_native_svg_1 = __importStar(require("react-native-svg"));
|
|
40
|
+
const styled_native_1 = __importStar(require("../../../styled.native"));
|
|
41
|
+
const styles_1 = require("./styles");
|
|
42
|
+
const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
|
|
43
|
+
const Outer = (0, styled_native_1.default)(react_native_1.View)(({ outerSize }) => (0, styled_native_1.css) `
|
|
44
|
+
width: ${outerSize}px;
|
|
45
|
+
height: ${outerSize}px;
|
|
46
|
+
position: relative;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
align-items: center;
|
|
49
|
+
`);
|
|
50
|
+
const RingSvg = (0, styled_native_1.default)(react_native_svg_1.default) `
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
`;
|
|
55
|
+
const ProgressRing = ({ percentage, children, }) => {
|
|
56
|
+
const theme = (0, styled_native_1.useTheme)();
|
|
57
|
+
const innerSize = styles_1.PROGESS_RING_INNER;
|
|
58
|
+
const strokeWidth = 2;
|
|
59
|
+
const outerSize = innerSize + 2 * strokeWidth;
|
|
60
|
+
const pct = clamp(percentage, 0, 100);
|
|
61
|
+
const radius = (outerSize - strokeWidth) / 2;
|
|
62
|
+
const circumference = 2 * Math.PI * radius;
|
|
63
|
+
const dashOffset = circumference * (1 - pct / 100);
|
|
64
|
+
return ((0, jsx_runtime_1.jsxs)(Outer, { outerSize: outerSize, children: [(0, jsx_runtime_1.jsxs)(RingSvg, { width: outerSize, height: outerSize, viewBox: `0 0 ${outerSize} ${outerSize}`, children: [(0, jsx_runtime_1.jsx)(react_native_svg_1.Circle, { cx: outerSize / 2, cy: outerSize / 2, r: radius, stroke: theme.color.surface.border, strokeWidth: strokeWidth, fill: "none" }), (0, jsx_runtime_1.jsx)(react_native_svg_1.Circle, { cx: outerSize / 2, cy: outerSize / 2, r: radius, stroke: theme.color.brand.brand, strokeWidth: strokeWidth, fill: "none", strokeDasharray: `${circumference} ${circumference}`, strokeDashoffset: dashOffset, transform: `rotate(-90 ${outerSize / 2} ${outerSize / 2})` })] }), children] }));
|
|
65
|
+
};
|
|
66
|
+
exports.ProgressRing = ProgressRing;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
testID?: string;
|
|
3
|
+
heading: string;
|
|
4
|
+
hintText?: string;
|
|
5
|
+
checked: boolean;
|
|
6
|
+
onToggle: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const ToggleListItem: ({ testID, heading, hintText, checked, onToggle, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToggleListItem = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const HintText_1 = require("../../HintText");
|
|
7
|
+
const P_1 = require("../../P");
|
|
8
|
+
const styles_1 = require("./styles");
|
|
9
|
+
const ToggleListItem = ({ testID, heading, hintText, checked, onToggle, }) => {
|
|
10
|
+
return ((0, jsx_runtime_1.jsxs)(styles_1.ActionListItemWrapper, { testID: testID ? `${testID}-toggle` : undefined, children: [(0, jsx_runtime_1.jsxs)(styles_1.TextContainer, { children: [(0, jsx_runtime_1.jsx)(P_1.P, { children: heading }), hintText && (0, jsx_runtime_1.jsx)(HintText_1.HintText, { children: hintText })] }), (0, jsx_runtime_1.jsx)(react_native_1.Switch, { value: checked, onValueChange: onToggle, accessibilityRole: "switch", accessibilityLabel: heading, accessibilityState: { checked } })] }));
|
|
11
|
+
};
|
|
12
|
+
exports.ToggleListItem = ToggleListItem;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Image, ImageBackground, View } from 'react-native';
|
|
2
|
+
export declare const ActionListItemWrapper: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
3
|
+
export declare const TextContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
4
|
+
export declare const EditableListContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
5
|
+
export declare const InitialStateContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
6
|
+
export declare const ValueText: import("styled-components").StyledComponent<(props: import("react-native").TextProps & {
|
|
7
|
+
inverted?: boolean;
|
|
8
|
+
ref?: React.Ref<import("react-native").Text>;
|
|
9
|
+
size?: "xl" | "lg" | "sm" | "md";
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
11
|
+
export declare const EditButtonsContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
12
|
+
export declare const NavigationListContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
13
|
+
export declare const SubHeading: import("styled-components").StyledComponent<(props: import("react-native").TextProps & {
|
|
14
|
+
inverted?: boolean;
|
|
15
|
+
ref?: React.Ref<import("react-native").Text>;
|
|
16
|
+
size?: "xl" | "lg" | "sm" | "md";
|
|
17
|
+
}) => import("react/jsx-runtime").JSX.Element, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
18
|
+
export declare const LeftTextContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
19
|
+
export declare const RightTextContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
20
|
+
export declare const StyledImage: import("styled-components").StyledComponent<typeof Image, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
21
|
+
export declare const StatusText: import("styled-components").StyledComponent<(props: import("react-native").TextProps & {
|
|
22
|
+
inverted?: boolean;
|
|
23
|
+
ref?: React.Ref<import("react-native").Text>;
|
|
24
|
+
size?: "xl" | "lg" | "sm" | "md";
|
|
25
|
+
}) => import("react/jsx-runtime").JSX.Element, import("@ovotech/element-core").ThemeNative, {
|
|
26
|
+
isError?: boolean;
|
|
27
|
+
}, never>;
|
|
28
|
+
export declare const ValueTextContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {
|
|
29
|
+
scaledUpFont?: boolean;
|
|
30
|
+
}, never>;
|
|
31
|
+
export declare const DataValueText: import("styled-components").StyledComponent<(props: import("react-native").TextProps & {
|
|
32
|
+
inverted?: boolean;
|
|
33
|
+
ref?: React.Ref<import("react-native").Text>;
|
|
34
|
+
size?: "xl" | "lg" | "sm" | "md";
|
|
35
|
+
}) => import("react/jsx-runtime").JSX.Element, import("@ovotech/element-core").ThemeNative, {
|
|
36
|
+
isError?: boolean;
|
|
37
|
+
}, never>;
|
|
38
|
+
export declare const DirectionLabelContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {
|
|
39
|
+
scaledUpFont?: boolean;
|
|
40
|
+
}, never>;
|
|
41
|
+
export declare const OnSurfaceP: import("styled-components").StyledComponent<(props: import("react-native").TextProps & {
|
|
42
|
+
inverted?: boolean;
|
|
43
|
+
ref?: React.Ref<import("react-native").Text>;
|
|
44
|
+
size?: "xl" | "lg" | "sm" | "md";
|
|
45
|
+
}) => import("react/jsx-runtime").JSX.Element, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
46
|
+
export declare const DirectionAndValueTextContainer: import("styled-components").StyledComponent<typeof View, import("@ovotech/element-core").ThemeNative, {}, never>;
|
|
47
|
+
export declare const PROGESS_RING_INNER = 42;
|
|
48
|
+
export declare const GraphicContainer: import("styled-components").StyledComponent<typeof ImageBackground, import("@ovotech/element-core").ThemeNative, {
|
|
49
|
+
isIcon?: boolean;
|
|
50
|
+
hasProgress?: boolean;
|
|
51
|
+
}, never>;
|