@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.
Files changed (102) hide show
  1. package/dist/components/Accordion/styles.d.ts +3 -1734
  2. package/dist/components/ActionList/ActionListItems/DataListItem.js +3 -1
  3. package/dist/components/ActionList/ActionListItems/ToggleListItem.js +3 -4
  4. package/dist/components/ActionList/ActionListItems/styles.d.ts +22 -10404
  5. package/dist/components/ActionList/ActionListItems/styles.js +18 -16
  6. package/dist/components/ActionList/styled.d.ts +12 -6936
  7. package/dist/components/Badge/Badge.d.ts +1 -578
  8. package/dist/components/BottomActionBar/BottomActionBar.d.ts +12 -0
  9. package/dist/components/BottomActionBar/BottomActionBar.js +80 -0
  10. package/dist/components/BottomActionBar/OverlayProvider.d.ts +8 -0
  11. package/dist/components/BottomActionBar/OverlayProvider.js +38 -0
  12. package/dist/components/BottomActionBar/index.d.ts +2 -0
  13. package/dist/components/BottomActionBar/index.js +7 -0
  14. package/dist/components/Button/Button.styles.d.ts +5 -2312
  15. package/dist/components/Card/Card.styles.d.ts +3 -1734
  16. package/dist/components/Cards/AccountCard/AccountCard.styles.d.ts +8 -4624
  17. package/dist/components/Cards/BalanceCard/BalanceCard.styles.d.ts +15 -8670
  18. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.d.ts +1 -578
  19. package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.d.ts +3 -1734
  20. package/dist/components/Cards/IconDataCard/IconDataCard.styles.d.ts +4 -2312
  21. package/dist/components/Cards/IconTextCard/IconTextCard.styles.d.ts +3 -1734
  22. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.d.ts +5 -2890
  23. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +1 -2
  24. package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.d.ts +5 -2890
  25. package/dist/components/Cards/OfferCard/OfferCard.d.ts +22 -0
  26. package/dist/components/Cards/OfferCard/OfferCard.js +36 -0
  27. package/dist/components/Cards/OfferCard/OfferCard.styles.d.ts +34 -0
  28. package/dist/components/Cards/OfferCard/OfferCard.styles.js +61 -0
  29. package/dist/components/Cards/OfferCard/index.d.ts +1 -0
  30. package/dist/components/Cards/OfferCard/index.js +17 -0
  31. package/dist/components/Cards/ProgressBarCard/ProgressBarCard.styles.d.ts +9 -5202
  32. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.d.ts +5 -2890
  33. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.d.ts +5 -2890
  34. package/dist/components/Cards/shared.styles.d.ts +10 -5780
  35. package/dist/components/Checkbox/styled.d.ts +6 -3468
  36. package/dist/components/CurrencyInput/styled.d.ts +4 -2312
  37. package/dist/components/DataTable/styles.d.ts +13 -7514
  38. package/dist/components/Disclosure/Disclosure.d.ts +1 -578
  39. package/dist/components/Em/Em.d.ts +1 -578
  40. package/dist/components/EmptyState/styles.d.ts +2 -1156
  41. package/dist/components/ErrorText/ErrorText.d.ts +1 -578
  42. package/dist/components/Grid/Col.d.ts +1 -578
  43. package/dist/components/HintText/HintText.d.ts +1 -578
  44. package/dist/components/Input/styled.d.ts +3 -1734
  45. package/dist/components/LabelText/LabelText.d.ts +1 -578
  46. package/dist/components/LargeValueReference/styles.d.ts +3 -1734
  47. package/dist/components/LineThrough/LineThrough.d.ts +1 -578
  48. package/dist/components/List/styled.d.ts +4 -2312
  49. package/dist/components/Margin/Margin.d.ts +1 -578
  50. package/dist/components/NavHeader/NavHeader.styles.d.ts +11 -6358
  51. package/dist/components/Notification/Notification.d.ts +2 -2
  52. package/dist/components/Notification/Notification.js +20 -12
  53. package/dist/components/Notification/Notification.styles.d.ts +13 -5202
  54. package/dist/components/Notification/Notification.styles.js +21 -2
  55. package/dist/components/PasswordInput/PasswordInput.styled.d.ts +1 -578
  56. package/dist/components/Radio/Radio.d.ts +2 -2
  57. package/dist/components/Radio/Radio.js +5 -43
  58. package/dist/components/Radio/Radio.styles.d.ts +9 -0
  59. package/dist/components/Radio/Radio.styles.js +74 -0
  60. package/dist/components/RadioCard/RadioCard.styles.d.ts +5 -2890
  61. package/dist/components/Rail/Rail.d.ts +12 -0
  62. package/dist/components/Rail/Rail.js +58 -0
  63. package/dist/components/Rail/RailIndicator.d.ts +7 -0
  64. package/dist/components/Rail/RailIndicator.js +81 -0
  65. package/dist/components/Rail/index.d.ts +1 -0
  66. package/dist/components/Rail/index.js +5 -0
  67. package/dist/components/Rail/styles.d.ts +13 -0
  68. package/dist/components/Rail/styles.js +55 -0
  69. package/dist/components/Rail/useRailPaging.d.ts +13 -0
  70. package/dist/components/Rail/useRailPaging.js +95 -0
  71. package/dist/components/SelectField/styled.d.ts +8 -4624
  72. package/dist/components/Strong/Strong.d.ts +1 -578
  73. package/dist/components/SubLabelText/SubLabelText.d.ts +1 -578
  74. package/dist/components/Tabs/Tab.d.ts +1 -578
  75. package/dist/components/Toast/Toast.d.ts +10 -4
  76. package/dist/components/Toast/Toast.js +40 -27
  77. package/dist/components/Toggle/styles.d.ts +4 -2312
  78. package/dist/components/index.d.ts +2 -0
  79. package/dist/components/index.js +2 -0
  80. package/dist/esm/components/ActionList/ActionListItems/DataListItem.js +3 -1
  81. package/dist/esm/components/ActionList/ActionListItems/ToggleListItem.js +5 -6
  82. package/dist/esm/components/ActionList/ActionListItems/styles.js +17 -15
  83. package/dist/esm/components/BottomActionBar/BottomActionBar.js +40 -0
  84. package/dist/esm/components/BottomActionBar/OverlayProvider.js +30 -0
  85. package/dist/esm/components/BottomActionBar/index.js +2 -0
  86. package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +1 -2
  87. package/dist/esm/components/Cards/OfferCard/OfferCard.js +32 -0
  88. package/dist/esm/components/Cards/OfferCard/OfferCard.styles.js +55 -0
  89. package/dist/esm/components/Cards/OfferCard/index.js +1 -0
  90. package/dist/esm/components/Notification/Notification.js +21 -13
  91. package/dist/esm/components/Notification/Notification.styles.js +20 -1
  92. package/dist/esm/components/Radio/Radio.js +4 -39
  93. package/dist/esm/components/Radio/Radio.styles.js +38 -0
  94. package/dist/esm/components/Rail/Rail.js +21 -0
  95. package/dist/esm/components/Rail/RailIndicator.js +44 -0
  96. package/dist/esm/components/Rail/index.js +1 -0
  97. package/dist/esm/components/Rail/styles.js +49 -0
  98. package/dist/esm/components/Rail/useRailPaging.js +92 -0
  99. package/dist/esm/components/Toast/Toast.js +40 -27
  100. package/dist/esm/components/index.js +2 -0
  101. package/dist/styled.native.d.ts +1 -3463
  102. 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 ToastsContainer = ({ top = -80 }) => ((0, jsx_runtime_1.jsx)(react_native_toast_1.Toasts, { extraInsets: { top } }));
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
- return action || dismissible
81
- ? react_native_toast_1.toast.loading(message, {
82
- id: 'clipboard',
83
- position: react_native_toast_1.ToastPosition.BOTTOM,
84
- disableShadow: true,
85
- customToast: t => ((0, jsx_runtime_1.jsx)(CustomToast, Object.assign({}, t, { dismissible: dismissible, action: action, actionTitle: actionTitle, variant: variant }), message)),
86
- })
87
- : (0, react_native_toast_1.toast)(message, {
88
- id: 'clipboard',
89
- position: react_native_toast_1.ToastPosition.BOTTOM,
90
- duration,
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 screenPadding = 32;
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 + toastPadding,
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 + toastPadding,
142
- alignItems: action ? 'flex-start' : 'center',
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 }), action && actionTitle ? ((0, jsx_runtime_1.jsx)(ActionList_1.Action, { ref: actionRef, style: { width: 'auto' }, inverted: true, standalone: true, iconRight: "chevron-right-small", onPress: handleAction, onLayout: () => {
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);