@ovotech/element-native 5.6.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 -1734
- package/dist/components/ActionList/ActionListItems/DataListItem.js +3 -1
- package/dist/components/ActionList/ActionListItems/ToggleListItem.js +3 -4
- package/dist/components/ActionList/ActionListItems/styles.d.ts +22 -10404
- package/dist/components/ActionList/ActionListItems/styles.js +18 -16
- package/dist/components/ActionList/styled.d.ts +12 -6936
- package/dist/components/Badge/Badge.d.ts +1 -578
- 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.styles.d.ts +5 -2312
- package/dist/components/Card/Card.styles.d.ts +3 -1734
- package/dist/components/Cards/AccountCard/AccountCard.styles.d.ts +8 -4624
- package/dist/components/Cards/BalanceCard/BalanceCard.styles.d.ts +15 -8670
- package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.d.ts +1 -578
- package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.d.ts +3 -1734
- package/dist/components/Cards/IconDataCard/IconDataCard.styles.d.ts +4 -2312
- package/dist/components/Cards/IconTextCard/IconTextCard.styles.d.ts +3 -1734
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.d.ts +5 -2890
- package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +1 -2
- package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.d.ts +5 -2890
- 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 -5202
- package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.d.ts +5 -2890
- package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.d.ts +5 -2890
- package/dist/components/Cards/shared.styles.d.ts +10 -5780
- package/dist/components/Checkbox/styled.d.ts +6 -3468
- package/dist/components/CurrencyInput/styled.d.ts +4 -2312
- package/dist/components/DataTable/styles.d.ts +13 -7514
- package/dist/components/Disclosure/Disclosure.d.ts +1 -578
- package/dist/components/Em/Em.d.ts +1 -578
- package/dist/components/EmptyState/styles.d.ts +2 -1156
- package/dist/components/ErrorText/ErrorText.d.ts +1 -578
- package/dist/components/Grid/Col.d.ts +1 -578
- package/dist/components/HintText/HintText.d.ts +1 -578
- package/dist/components/Input/styled.d.ts +3 -1734
- package/dist/components/LabelText/LabelText.d.ts +1 -578
- package/dist/components/LargeValueReference/styles.d.ts +3 -1734
- package/dist/components/LineThrough/LineThrough.d.ts +1 -578
- package/dist/components/List/styled.d.ts +4 -2312
- package/dist/components/Margin/Margin.d.ts +1 -578
- package/dist/components/NavHeader/NavHeader.styles.d.ts +11 -6358
- 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 -5202
- package/dist/components/Notification/Notification.styles.js +21 -2
- package/dist/components/PasswordInput/PasswordInput.styled.d.ts +1 -578
- 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.styles.d.ts +5 -2890
- 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/styled.d.ts +8 -4624
- package/dist/components/Strong/Strong.d.ts +1 -578
- package/dist/components/SubLabelText/SubLabelText.d.ts +1 -578
- package/dist/components/Tabs/Tab.d.ts +1 -578
- package/dist/components/Toast/Toast.d.ts +10 -4
- package/dist/components/Toast/Toast.js +40 -27
- package/dist/components/Toggle/styles.d.ts +4 -2312
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/esm/components/ActionList/ActionListItems/DataListItem.js +3 -1
- package/dist/esm/components/ActionList/ActionListItems/ToggleListItem.js +5 -6
- package/dist/esm/components/ActionList/ActionListItems/styles.js +17 -15
- 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/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +1 -2
- 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/Notification/Notification.js +21 -13
- package/dist/esm/components/Notification/Notification.styles.js +20 -1
- package/dist/esm/components/Radio/Radio.js +4 -39
- package/dist/esm/components/Radio/Radio.styles.js +38 -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/Toast/Toast.js +40 -27
- package/dist/esm/components/index.js +2 -0
- package/dist/styled.native.d.ts +1 -3463
- package/package.json +2 -2
|
@@ -32,6 +32,17 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
35
46
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
47
|
exports.showToast = exports.ToastsContainer = void 0;
|
|
37
48
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -44,7 +55,13 @@ const styled_native_1 = __importStar(require("../../styled.native"));
|
|
|
44
55
|
const ActionList_1 = require("../ActionList");
|
|
45
56
|
const Icon_1 = require("../Icon");
|
|
46
57
|
const P_1 = require("../P");
|
|
47
|
-
const
|
|
58
|
+
const TOAST_PADDING = 20;
|
|
59
|
+
const ToastsContainer = (_a) => {
|
|
60
|
+
var { top = -80, left, inModal = false } = _a, rest = __rest(_a, ["top", "left", "inModal"]);
|
|
61
|
+
// Extra right inset if in modal, unless it's been explicitly passed
|
|
62
|
+
const leftInset = inModal ? -20 : left !== null && left !== void 0 ? left : 0;
|
|
63
|
+
return (0, jsx_runtime_1.jsx)(react_native_toast_1.Toasts, Object.assign({ extraInsets: { top, left: leftInset } }, rest));
|
|
64
|
+
};
|
|
48
65
|
exports.ToastsContainer = ToastsContainer;
|
|
49
66
|
const StyledView = styled_native_1.default.View(({ theme, variant }) => (0, styled_native_1.css) `
|
|
50
67
|
background-color: ${variant === 'default'
|
|
@@ -76,30 +93,25 @@ const StyledCloseIcon = (0, styled_native_1.default)(react_native_1.TouchableOpa
|
|
|
76
93
|
align-items: center;
|
|
77
94
|
justify-content: center;
|
|
78
95
|
`);
|
|
79
|
-
const showToast = ({ message, dismissible = false, action, actionTitle, variant = 'default', duration = 5000, }) => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
disableShadow: true,
|
|
92
|
-
customToast: t => ((0, jsx_runtime_1.jsx)(CustomToastWithTimeIndicator, Object.assign({}, t, { variant: variant }), message)),
|
|
93
|
-
});
|
|
96
|
+
const showToast = ({ message, dismissible = false, action, actionTitle, inlineContent, variant = 'default', duration = 5000, providerKey = 'DEFAULT', }) => {
|
|
97
|
+
const baseToastProps = {
|
|
98
|
+
id: 'clipboard',
|
|
99
|
+
position: react_native_toast_1.ToastPosition.BOTTOM,
|
|
100
|
+
disableShadow: true,
|
|
101
|
+
providerKey,
|
|
102
|
+
};
|
|
103
|
+
// Uses toast.loading for manual dismissal with action or dismiss
|
|
104
|
+
// Otherwise, use regular toast for auto-hiding with time indicator.
|
|
105
|
+
action || dismissible
|
|
106
|
+
? react_native_toast_1.toast.loading(message, Object.assign(Object.assign({}, baseToastProps), { duration: 0, customToast: t => ((0, jsx_runtime_1.jsx)(CustomToast, Object.assign({}, t, { dismissible: dismissible, action: action, actionTitle: actionTitle, variant: variant, inline: inlineContent }), message)) }))
|
|
107
|
+
: (0, react_native_toast_1.toast)(message, Object.assign(Object.assign({}, baseToastProps), { duration, customToast: t => ((0, jsx_runtime_1.jsx)(CustomToastWithTimeIndicator, Object.assign({}, t, { variant: variant, inline: inlineContent }), message)) }));
|
|
94
108
|
};
|
|
95
109
|
exports.showToast = showToast;
|
|
96
|
-
const CustomToastWithTimeIndicator = ({ message, duration = 5000, variant, }) => {
|
|
97
|
-
const toastPadding = 20;
|
|
110
|
+
const CustomToastWithTimeIndicator = ({ message, duration = 5000, variant, inline = false, }) => {
|
|
98
111
|
const textRef = (0, react_1.useRef)(null);
|
|
99
112
|
const [textHeight, setTextHeight] = (0, react_1.useState)(0);
|
|
100
113
|
const windowWidth = react_native_1.Dimensions.get('window').width;
|
|
101
|
-
const
|
|
102
|
-
const toastWidth = windowWidth - screenPadding;
|
|
114
|
+
const toastWidth = windowWidth - TOAST_PADDING * 2;
|
|
103
115
|
const sharedWidth = (0, react_native_reanimated_1.useSharedValue)(toastWidth);
|
|
104
116
|
const style = (0, react_native_reanimated_1.useAnimatedStyle)(() => {
|
|
105
117
|
return {
|
|
@@ -114,8 +126,9 @@ const CustomToastWithTimeIndicator = ({ message, duration = 5000, variant, }) =>
|
|
|
114
126
|
}, []);
|
|
115
127
|
return ((0, jsx_runtime_1.jsxs)(StyledView, { variant: variant, style: {
|
|
116
128
|
width: toastWidth,
|
|
117
|
-
height: textHeight +
|
|
129
|
+
height: textHeight + TOAST_PADDING,
|
|
118
130
|
flexWrap: 'wrap',
|
|
131
|
+
flexDirection: inline ? 'row' : 'column',
|
|
119
132
|
}, children: [(0, jsx_runtime_1.jsx)(StyledP, { ref: textRef, onLayout: () => {
|
|
120
133
|
var _a;
|
|
121
134
|
(_a = textRef.current) === null || _a === void 0 ? void 0 : _a.measureInWindow((_x, _y, _width, height) => {
|
|
@@ -123,13 +136,13 @@ const CustomToastWithTimeIndicator = ({ message, duration = 5000, variant, }) =>
|
|
|
123
136
|
});
|
|
124
137
|
}, children: message }), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: { position: 'absolute', bottom: 0 }, children: (0, jsx_runtime_1.jsx)(StyledBorder, { variant: variant, style: style }) })] }));
|
|
125
138
|
};
|
|
126
|
-
const CustomToast = ({ id, message, dismissible, action, actionTitle, width, variant, }) => {
|
|
127
|
-
const toastPadding = 20;
|
|
139
|
+
const CustomToast = ({ id, message, dismissible, action, actionTitle, inline = false, width, variant, }) => {
|
|
128
140
|
const textRef = (0, react_1.useRef)(null);
|
|
129
141
|
const actionRef = (0, react_1.useRef)(null);
|
|
130
142
|
const [textHeight, setTextHeight] = (0, react_1.useState)(0);
|
|
131
143
|
const [actionHeight, setActionHeight] = (0, react_1.useState)(0);
|
|
132
144
|
const toastHeight = textHeight + actionHeight;
|
|
145
|
+
const hasAction = action && actionTitle;
|
|
133
146
|
const handleAction = () => {
|
|
134
147
|
if (action && actionTitle) {
|
|
135
148
|
action();
|
|
@@ -138,10 +151,10 @@ const CustomToast = ({ id, message, dismissible, action, actionTitle, width, var
|
|
|
138
151
|
};
|
|
139
152
|
return ((0, jsx_runtime_1.jsxs)(StyledView, { variant: variant, style: {
|
|
140
153
|
width,
|
|
141
|
-
height: toastHeight +
|
|
142
|
-
alignItems:
|
|
154
|
+
height: toastHeight + TOAST_PADDING,
|
|
155
|
+
alignItems: dismissible ? 'flex-start' : 'center',
|
|
143
156
|
}, children: [(0, jsx_runtime_1.jsxs)(react_native_1.View, { style: {
|
|
144
|
-
flexDirection: 'row',
|
|
157
|
+
flexDirection: inline ? 'row' : 'column',
|
|
145
158
|
flexWrap: 'wrap',
|
|
146
159
|
justifyContent: 'space-between',
|
|
147
160
|
flex: 1,
|
|
@@ -150,7 +163,7 @@ const CustomToast = ({ id, message, dismissible, action, actionTitle, width, var
|
|
|
150
163
|
(_a = textRef.current) === null || _a === void 0 ? void 0 : _a.measureInWindow((_x, _y, _width, height) => {
|
|
151
164
|
setTextHeight(height);
|
|
152
165
|
});
|
|
153
|
-
}, children: message }),
|
|
166
|
+
}, children: message }), hasAction ? ((0, jsx_runtime_1.jsx)(ActionList_1.Action, { ref: actionRef, style: Object.assign({ width: 'auto', paddingBottom: 0 }, (inline ? { paddingTop: 0 } : {})), inverted: true, standalone: true, iconRight: "chevron-right-small", onPress: handleAction, onLayout: () => {
|
|
154
167
|
var _a;
|
|
155
168
|
(_a = actionRef.current) === null || _a === void 0 ? void 0 : _a.measureInWindow((_x, _y, _width, height) => {
|
|
156
169
|
setActionHeight(height);
|