@ovotech/element-native 5.5.0 → 5.6.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 (237) hide show
  1. package/dist/components/Accordion/styles.d.ts +9 -0
  2. package/dist/components/ActionList/Action.d.ts +23 -0
  3. package/dist/components/ActionList/Action.js +29 -0
  4. package/dist/components/ActionList/ActionList.d.ts +11 -27
  5. package/dist/components/ActionList/ActionList.js +9 -25
  6. package/dist/components/ActionList/ActionListItems/DataListItem.d.ts +23 -0
  7. package/dist/components/ActionList/ActionListItems/DataListItem.js +21 -0
  8. package/dist/components/ActionList/ActionListItems/EditableListItem.d.ts +43 -0
  9. package/dist/components/ActionList/ActionListItems/EditableListItem.js +134 -0
  10. package/dist/components/ActionList/ActionListItems/NavigationListItem.d.ts +16 -0
  11. package/dist/components/ActionList/ActionListItems/NavigationListItem.js +30 -0
  12. package/dist/components/ActionList/ActionListItems/ProgressRing.d.ts +7 -0
  13. package/dist/components/ActionList/ActionListItems/ProgressRing.js +66 -0
  14. package/dist/components/ActionList/ActionListItems/ToggleListItem.d.ts +9 -0
  15. package/dist/components/ActionList/ActionListItems/ToggleListItem.js +13 -0
  16. package/dist/components/ActionList/ActionListItems/styles.d.ts +10433 -0
  17. package/dist/components/ActionList/ActionListItems/styles.js +171 -0
  18. package/dist/components/ActionList/components/ActionListHeading.d.ts +9 -0
  19. package/dist/components/ActionList/components/ActionListHeading.js +11 -0
  20. package/dist/components/ActionList/index.d.ts +6 -1
  21. package/dist/components/ActionList/index.js +11 -2
  22. package/dist/components/ActionList/styled.d.ts +1187 -7
  23. package/dist/components/ActionList/styled.js +24 -9
  24. package/dist/components/Badge/Badge.d.ts +3 -0
  25. package/dist/components/Button/Button.js +1 -1
  26. package/dist/components/Button/Button.styles.d.ts +12 -0
  27. package/dist/components/Card/Card.d.ts +7 -4
  28. package/dist/components/Card/Card.js +44 -22
  29. package/dist/components/Card/Card.styles.d.ts +11 -1
  30. package/dist/components/Card/Card.styles.js +7 -11
  31. package/dist/components/Cards/AccountCard/AccountCard.styles.d.ts +24 -0
  32. package/dist/components/Cards/BalanceCard/BalanceCard.styles.d.ts +46 -1
  33. package/dist/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
  34. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.d.ts +13 -0
  35. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.js +45 -0
  36. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.d.ts +580 -0
  37. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +11 -0
  38. package/dist/components/Cards/DisruptiveCard/index.d.ts +1 -0
  39. package/dist/components/Cards/DisruptiveCard/index.js +17 -0
  40. package/dist/components/Cards/HeroImageCard/HeroImageCard.d.ts +12 -0
  41. package/dist/components/Cards/HeroImageCard/HeroImageCard.js +65 -0
  42. package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.d.ts +1741 -0
  43. package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.js +27 -0
  44. package/dist/components/Cards/HeroImageCard/index.d.ts +1 -0
  45. package/dist/components/Cards/HeroImageCard/index.js +17 -0
  46. package/dist/components/Cards/IconDataCard/IconDataCard.styles.d.ts +12 -0
  47. package/dist/components/Cards/IconTextCard/IconTextCard.js +3 -16
  48. package/dist/components/Cards/IconTextCard/IconTextCard.styles.d.ts +10 -576
  49. package/dist/components/Cards/IconTextCard/IconTextCard.styles.js +1 -6
  50. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.d.ts +14 -0
  51. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.js +26 -0
  52. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.d.ts +2903 -0
  53. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +34 -0
  54. package/dist/components/Cards/IllustrationTextCard/index.d.ts +1 -0
  55. package/dist/components/Cards/IllustrationTextCard/index.js +17 -0
  56. package/dist/components/Cards/LinkTextCard/LinkTextCard.d.ts +2 -2
  57. package/dist/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
  58. package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.d.ts +20 -2
  59. package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
  60. package/dist/components/Cards/ProgressBarCard/ProgressBarCard.styles.d.ts +28 -1
  61. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.d.ts +12 -0
  62. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.js +27 -0
  63. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.d.ts +2897 -0
  64. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +31 -0
  65. package/dist/components/Cards/QuickLinkCard/index.d.ts +1 -0
  66. package/dist/components/Cards/QuickLinkCard/index.js +17 -0
  67. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.d.ts +12 -0
  68. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.js +24 -0
  69. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.d.ts +2902 -0
  70. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +38 -0
  71. package/dist/components/Cards/ServicesImageCard/index.d.ts +1 -0
  72. package/dist/components/Cards/ServicesImageCard/index.js +17 -0
  73. package/dist/components/Cards/components.d.ts +15 -0
  74. package/dist/components/Cards/components.js +24 -0
  75. package/dist/components/Cards/index.d.ts +5 -0
  76. package/dist/components/Cards/index.js +11 -1
  77. package/dist/components/Cards/shared.styles.d.ts +2835 -505
  78. package/dist/components/Cards/shared.styles.js +18 -2
  79. package/dist/components/Cards/utils.d.ts +1 -0
  80. package/dist/components/Cards/utils.js +13 -1
  81. package/dist/components/Checkbox/Checkbox.d.ts +2 -13
  82. package/dist/components/Checkbox/Checkbox.js +3 -49
  83. package/dist/components/Checkbox/styled.d.ts +3483 -0
  84. package/dist/components/Checkbox/styled.js +52 -0
  85. package/dist/components/Checkbox/types.d.ts +16 -0
  86. package/dist/components/Checkbox/types.js +2 -0
  87. package/dist/components/CurrencyInput/CurrencyInput.d.ts +2 -1
  88. package/dist/components/CurrencyInput/CurrencyInput.js +11 -4
  89. package/dist/components/CurrencyInput/styled.d.ts +2318 -0
  90. package/dist/components/CurrencyInput/styled.js +39 -0
  91. package/dist/components/DataTable/styles.d.ts +39 -0
  92. package/dist/components/Disclosure/Disclosure.d.ts +3 -0
  93. package/dist/components/Divider/Divider.d.ts +1 -1
  94. package/dist/components/Divider/Divider.js +3 -1
  95. package/dist/components/Em/Em.d.ts +3 -0
  96. package/dist/components/EmailInput/EmailInput.d.ts +4 -1
  97. package/dist/components/EmailInput/EmailInput.js +18 -2
  98. package/dist/components/EmptyState/EmptyState.d.ts +2 -0
  99. package/dist/components/EmptyState/EmptyState.js +17 -0
  100. package/dist/components/EmptyState/EmptyState.test.d.ts +1 -0
  101. package/dist/components/EmptyState/EmptyState.test.js +92 -0
  102. package/dist/components/EmptyState/index.d.ts +1 -0
  103. package/dist/components/EmptyState/index.js +17 -0
  104. package/dist/components/EmptyState/styles.d.ts +1156 -0
  105. package/dist/components/EmptyState/styles.js +23 -0
  106. package/dist/components/EmptyState/types.d.ts +18 -0
  107. package/dist/components/EmptyState/types.js +2 -0
  108. package/dist/components/ErrorText/ErrorText.d.ts +3 -0
  109. package/dist/components/Field/Field.d.ts +3 -2
  110. package/dist/components/Field/Field.js +3 -2
  111. package/dist/components/Grid/Col.d.ts +3 -0
  112. package/dist/components/HintText/HintText.d.ts +3 -0
  113. package/dist/components/Input/Input.d.ts +2 -1
  114. package/dist/components/Input/Input.js +6 -97
  115. package/dist/components/Input/styled.d.ts +1747 -0
  116. package/dist/components/Input/styled.js +96 -0
  117. package/dist/components/LabelText/LabelText.d.ts +3 -0
  118. package/dist/components/LargeValueReference/LargeValueReference.d.ts +11 -0
  119. package/dist/components/LargeValueReference/LargeValueReference.js +49 -0
  120. package/dist/components/LargeValueReference/index.d.ts +1 -0
  121. package/dist/components/LargeValueReference/index.js +17 -0
  122. package/dist/components/LargeValueReference/styles.d.ts +1741 -0
  123. package/dist/components/LargeValueReference/styles.js +29 -0
  124. package/dist/components/LineThrough/LineThrough.d.ts +3 -0
  125. package/dist/components/List/styled.d.ts +12 -0
  126. package/dist/components/Margin/Margin.d.ts +3 -0
  127. package/dist/components/NavHeader/NavHeader.styles.d.ts +33 -0
  128. package/dist/components/Notification/Notification.styles.d.ts +27 -0
  129. package/dist/components/PasswordInput/PasswordInput.styled.d.ts +4 -3
  130. package/dist/components/PasswordInput/PasswordInput.styled.js +5 -3
  131. package/dist/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
  132. package/dist/components/RadioCard/RadioCard.d.ts +2 -1
  133. package/dist/components/RadioCard/RadioCard.js +7 -57
  134. package/dist/components/RadioCard/RadioCard.styles.d.ts +2901 -0
  135. package/dist/components/RadioCard/RadioCard.styles.js +97 -0
  136. package/dist/components/SelectField/Select.d.ts +5 -579
  137. package/dist/components/SelectField/Select.js +7 -107
  138. package/dist/components/SelectField/SelectField.d.ts +2 -2
  139. package/dist/components/SelectField/SelectField.js +2 -2
  140. package/dist/components/SelectField/styled.d.ts +4642 -0
  141. package/dist/components/SelectField/styled.js +118 -0
  142. package/dist/components/SkeletonText/SkeletonText.js +4 -4
  143. package/dist/components/Strong/Strong.d.ts +3 -0
  144. package/dist/components/SubLabelText/SubLabelText.d.ts +3 -0
  145. package/dist/components/Tabs/Tab.d.ts +3 -0
  146. package/dist/components/TextareaInput/TextareaInput.js +12 -6
  147. package/dist/components/Toggle/Toggle.d.ts +3 -1
  148. package/dist/components/Toggle/Toggle.js +4 -6
  149. package/dist/components/Toggle/styles.d.ts +13 -0
  150. package/dist/components/Toggle/styles.js +3 -3
  151. package/dist/components/index.d.ts +3 -0
  152. package/dist/components/index.js +3 -0
  153. package/dist/esm/components/ActionList/Action.js +26 -0
  154. package/dist/esm/components/ActionList/ActionList.js +12 -28
  155. package/dist/esm/components/ActionList/ActionListItems/DataListItem.js +17 -0
  156. package/dist/esm/components/ActionList/ActionListItems/EditableListItem.js +131 -0
  157. package/dist/esm/components/ActionList/ActionListItems/NavigationListItem.js +26 -0
  158. package/dist/esm/components/ActionList/ActionListItems/ProgressRing.js +29 -0
  159. package/dist/esm/components/ActionList/ActionListItems/ToggleListItem.js +9 -0
  160. package/dist/esm/components/ActionList/ActionListItems/styles.js +135 -0
  161. package/dist/esm/components/ActionList/components/ActionListHeading.js +7 -0
  162. package/dist/esm/components/ActionList/index.js +6 -1
  163. package/dist/esm/components/ActionList/styled.js +23 -8
  164. package/dist/esm/components/Button/Button.js +1 -1
  165. package/dist/esm/components/Card/Card.js +45 -23
  166. package/dist/esm/components/Card/Card.styles.js +8 -12
  167. package/dist/esm/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
  168. package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.js +41 -0
  169. package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +5 -0
  170. package/dist/esm/components/Cards/DisruptiveCard/index.js +1 -0
  171. package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.js +28 -0
  172. package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.styles.js +21 -0
  173. package/dist/esm/components/Cards/HeroImageCard/index.js +1 -0
  174. package/dist/esm/components/Cards/IconTextCard/IconTextCard.js +5 -18
  175. package/dist/esm/components/Cards/IconTextCard/IconTextCard.styles.js +0 -5
  176. package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.js +22 -0
  177. package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +28 -0
  178. package/dist/esm/components/Cards/IllustrationTextCard/index.js +1 -0
  179. package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
  180. package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
  181. package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.js +23 -0
  182. package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +25 -0
  183. package/dist/esm/components/Cards/QuickLinkCard/index.js +1 -0
  184. package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.js +20 -0
  185. package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +32 -0
  186. package/dist/esm/components/Cards/ServicesImageCard/index.js +1 -0
  187. package/dist/esm/components/Cards/components.js +19 -0
  188. package/dist/esm/components/Cards/index.js +5 -0
  189. package/dist/esm/components/Cards/shared.styles.js +17 -1
  190. package/dist/esm/components/Cards/utils.js +11 -0
  191. package/dist/esm/components/Checkbox/Checkbox.js +2 -45
  192. package/dist/esm/components/Checkbox/styled.js +46 -0
  193. package/dist/esm/components/Checkbox/types.js +1 -0
  194. package/dist/esm/components/CurrencyInput/CurrencyInput.js +12 -5
  195. package/dist/esm/components/CurrencyInput/styled.js +33 -0
  196. package/dist/esm/components/Divider/Divider.js +3 -1
  197. package/dist/esm/components/EmailInput/EmailInput.js +18 -2
  198. package/dist/esm/components/EmptyState/EmptyState.js +13 -0
  199. package/dist/esm/components/EmptyState/EmptyState.test.js +90 -0
  200. package/dist/esm/components/EmptyState/index.js +1 -0
  201. package/dist/esm/components/EmptyState/styles.js +17 -0
  202. package/dist/esm/components/EmptyState/types.js +1 -0
  203. package/dist/esm/components/Field/Field.js +3 -2
  204. package/dist/esm/components/Input/Input.js +6 -64
  205. package/dist/esm/components/Input/styled.js +60 -0
  206. package/dist/esm/components/LargeValueReference/LargeValueReference.js +45 -0
  207. package/dist/esm/components/LargeValueReference/index.js +1 -0
  208. package/dist/esm/components/LargeValueReference/styles.js +23 -0
  209. package/dist/esm/components/PasswordInput/PasswordInput.styled.js +5 -3
  210. package/dist/esm/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
  211. package/dist/esm/components/RadioCard/RadioCard.js +5 -52
  212. package/dist/esm/components/RadioCard/RadioCard.styles.js +61 -0
  213. package/dist/esm/components/SelectField/Select.js +7 -74
  214. package/dist/esm/components/SelectField/SelectField.js +3 -3
  215. package/dist/esm/components/SelectField/styled.js +82 -0
  216. package/dist/esm/components/SkeletonText/SkeletonText.js +4 -4
  217. package/dist/esm/components/TextareaInput/TextareaInput.js +12 -6
  218. package/dist/esm/components/Toggle/Toggle.js +4 -6
  219. package/dist/esm/components/Toggle/styles.js +3 -3
  220. package/dist/esm/components/index.js +3 -0
  221. package/dist/esm/hooks/use-font-scaling.js +32 -0
  222. package/dist/esm/index.js +1 -0
  223. package/dist/esm/test/utils.js +12 -0
  224. package/dist/esm/utils/utils.js +12 -1
  225. package/dist/hooks/use-font-scaling.d.ts +26 -0
  226. package/dist/hooks/use-font-scaling.js +35 -0
  227. package/dist/index.d.ts +1 -0
  228. package/dist/index.js +1 -0
  229. package/dist/styled.native.d.ts +18 -0
  230. package/dist/test/utils.d.ts +4 -0
  231. package/dist/test/utils.js +28 -0
  232. package/dist/utils/utils.d.ts +11 -1
  233. package/dist/utils/utils.js +12 -0
  234. package/package.json +4 -4
  235. package/dist/components/ErrorWrapper/styles.d.ts +0 -0
  236. package/dist/components/ErrorWrapper/styles.js +0 -1
  237. package/dist/esm/components/ErrorWrapper/styles.js +0 -1
@@ -0,0 +1,131 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, useImperativeHandle, useMemo, useRef, useState, } from 'react';
3
+ import { CurrencyInput } from '../../CurrencyInput';
4
+ import { EmailInput } from '../../EmailInput';
5
+ import { Input } from '../../Input/Input';
6
+ import { TextLink } from '../../Link';
7
+ import { Margin } from '../../Margin';
8
+ import { NumberInput } from '../../NumberInput';
9
+ import { P } from '../../P';
10
+ import { SelectField } from '../../SelectField';
11
+ import { Strong } from '../../Strong';
12
+ import { TextareaInput } from '../../TextareaInput';
13
+ import { ActionListItemWrapper, EditableListContainer, EditButtonsContainer, InitialStateContainer, ValueText, } from './styles';
14
+ const getInitialValue = (input) => {
15
+ var _a, _b, _c;
16
+ switch (input.type) {
17
+ case 'number':
18
+ case 'currency':
19
+ return (_a = input.defaultValue) !== null && _a !== void 0 ? _a : null;
20
+ case 'select':
21
+ return (_b = input.defaultValue) !== null && _b !== void 0 ? _b : null;
22
+ case 'text':
23
+ case 'location':
24
+ case 'email':
25
+ case 'textarea':
26
+ return (_c = input.defaultValue) !== null && _c !== void 0 ? _c : '';
27
+ }
28
+ };
29
+ function acceptNumericInput(nextText, prevText) {
30
+ var _a;
31
+ if (nextText === '')
32
+ return '';
33
+ if (!/^[0-9.]*$/.test(nextText))
34
+ return prevText;
35
+ if (((_a = nextText.match(/\./g)) !== null && _a !== void 0 ? _a : []).length > 1)
36
+ return prevText;
37
+ return nextText;
38
+ }
39
+ function parseDraftNumericText(text) {
40
+ if (text === '' || text === '.' || text.endsWith('.'))
41
+ return null;
42
+ const n = Number(text);
43
+ return Number.isFinite(n) ? n : null;
44
+ }
45
+ export const EditableListItem = forwardRef(({ heading, input, onSave }, ref) => {
46
+ const inputRef = useRef(null);
47
+ const initialValue = useMemo(() => getInitialValue(input), [input]);
48
+ const [editState, setEditState] = useState('initial');
49
+ const [value, setValue] = useState(initialValue);
50
+ const [draft, setDraft] = useState(initialValue);
51
+ const [numericInputText, setNumericInputText] = useState('');
52
+ useImperativeHandle(ref, () => ({
53
+ getValue: () => value,
54
+ }));
55
+ const handleNumericChange = (nextText) => {
56
+ const accepted = acceptNumericInput(nextText, numericInputText);
57
+ if (accepted === numericInputText)
58
+ return;
59
+ setNumericInputText(accepted);
60
+ };
61
+ const startEditing = () => {
62
+ setDraft(value);
63
+ setEditState('editing');
64
+ if (input.type === 'number' || input.type === 'currency') {
65
+ const n = value;
66
+ setNumericInputText(n === null ? '' : String(n));
67
+ }
68
+ requestAnimationFrame(() => {
69
+ var _a, _b;
70
+ (_b = (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus) === null || _b === void 0 ? void 0 : _b.call(_a);
71
+ });
72
+ };
73
+ const saveEditing = () => {
74
+ const nextValue = input.type === 'number' || input.type === 'currency'
75
+ ? parseDraftNumericText(numericInputText)
76
+ : draft;
77
+ setValue(nextValue);
78
+ setEditState('initial');
79
+ onSave === null || onSave === void 0 ? void 0 : onSave(nextValue);
80
+ };
81
+ const cancelEditing = () => {
82
+ setDraft(value);
83
+ if (input.type === 'number' || input.type === 'currency') {
84
+ const n = value;
85
+ setNumericInputText(n === null ? '' : String(n));
86
+ }
87
+ setEditState('initial');
88
+ };
89
+ const displayValue = useMemo(() => {
90
+ var _a, _b;
91
+ switch (input.type) {
92
+ case 'select':
93
+ return (_a = value === null || value === void 0 ? void 0 : value.label) !== null && _a !== void 0 ? _a : '-';
94
+ case 'number':
95
+ case 'currency':
96
+ return (_b = value === null || value === void 0 ? void 0 : value.toString()) !== null && _b !== void 0 ? _b : '-';
97
+ default: {
98
+ const v = value;
99
+ return v === '' ? '-' : v;
100
+ }
101
+ }
102
+ }, [input.type, value]);
103
+ const renderEditingInput = () => {
104
+ var _a;
105
+ if (editState !== 'editing')
106
+ return null;
107
+ switch (input.type) {
108
+ case 'text':
109
+ return (_jsx(Input, { ref: inputRef, value: draft, onChangeText: v => setDraft(v) }));
110
+ case 'location':
111
+ return (_jsx(Input, { ref: inputRef, value: draft, onChangeText: v => setDraft(v), iconLeft: "address" }));
112
+ case 'email':
113
+ return (_jsx(EmailInput, { ref: inputRef, value: draft, onChangeText: v => setDraft(v) }));
114
+ case 'textarea':
115
+ return (_jsx(TextareaInput, { ref: inputRef, value: draft, onChangeText: v => setDraft(v) }));
116
+ case 'number':
117
+ return (_jsx(NumberInput, { ref: inputRef, value: numericInputText, onChangeText: handleNumericChange }));
118
+ case 'currency':
119
+ return (_jsx(CurrencyInput, { ref: inputRef, value: numericInputText, onChangeText: handleNumericChange }));
120
+ case 'select': {
121
+ const selected = (_a = draft) !== null && _a !== void 0 ? _a : {
122
+ label: 'None',
123
+ value: 'default',
124
+ };
125
+ return (_jsx(SelectField, { ref: inputRef, label: "", options: input.options, onSelected: opt => setDraft(opt.value === 'default' ? null : opt), defaultSelected: selected }));
126
+ }
127
+ }
128
+ };
129
+ return (_jsx(ActionListItemWrapper, { children: _jsxs(EditableListContainer, { children: [heading && (_jsx(P, { children: _jsx(Strong, { children: heading }) })), editState === 'initial' ? (_jsxs(InitialStateContainer, { children: [_jsx(ValueText, { children: displayValue }), _jsx(TextLink, { onPress: startEditing, children: _jsx(P, { size: "md", children: displayValue === '-' ? 'Add' : 'Change' }) })] })) : (_jsxs(_Fragment, { children: [renderEditingInput(), _jsx(Margin, { top: 2 }), _jsxs(EditButtonsContainer, { children: [_jsx(TextLink, { onPress: saveEditing, children: _jsx(P, { children: "Save" }) }), _jsx(TextLink, { onPress: cancelEditing, children: _jsx(P, { children: "Cancel" }) })] })] }))] }) }));
130
+ });
131
+ EditableListItem.displayName = 'EditableListItem';
@@ -0,0 +1,26 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { TouchableOpacity, View, } from 'react-native';
14
+ import { useTheme } from '../../../styled.native';
15
+ import { Icon } from '../../Icon';
16
+ import { P } from '../../P';
17
+ import { ActionListItemWrapper, SubHeading, TextContainer } from './styles';
18
+ export const NavigationListItem = (_a) => {
19
+ 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"]);
20
+ const theme = useTheme();
21
+ const isPressable = !!onPress && !disabled;
22
+ const Wrapper = isPressable ? TouchableOpacity : View;
23
+ return (_jsx(Wrapper, Object.assign({ testID: testID }, (isPressable && Object.assign({ activeOpacity,
24
+ onPress,
25
+ disabled, accessible: true, accessibilityRole: accessibilityRole !== null && accessibilityRole !== void 0 ? accessibilityRole : 'button', accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : heading, accessibilityHint }, touchableProps)), { children: _jsxs(ActionListItemWrapper, { children: [iconLeft && (_jsx(Icon, { name: iconLeft, size: 24, color: theme.color.brand.brand })), (heading || subHeading) && (_jsxs(TextContainer, { children: [heading && _jsx(P, { children: heading }), subHeading && _jsx(SubHeading, { size: "sm", children: subHeading })] })), iconRight && _jsx(Icon, { name: iconRight, size: 20 })] }) })));
26
+ };
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import Svg, { Circle } from 'react-native-svg';
4
+ import styled, { css, useTheme } from '../../../styled.native';
5
+ import { PROGESS_RING_INNER } from './styles';
6
+ const clamp = (n, min, max) => Math.min(max, Math.max(min, n));
7
+ const Outer = styled(View)(({ outerSize }) => css `
8
+ width: ${outerSize}px;
9
+ height: ${outerSize}px;
10
+ position: relative;
11
+ justify-content: center;
12
+ align-items: center;
13
+ `);
14
+ const RingSvg = styled(Svg) `
15
+ position: absolute;
16
+ top: 0;
17
+ left: 0;
18
+ `;
19
+ export const ProgressRing = ({ percentage, children, }) => {
20
+ const theme = useTheme();
21
+ const innerSize = PROGESS_RING_INNER;
22
+ const strokeWidth = 2;
23
+ const outerSize = innerSize + 2 * strokeWidth;
24
+ const pct = clamp(percentage, 0, 100);
25
+ const radius = (outerSize - strokeWidth) / 2;
26
+ const circumference = 2 * Math.PI * radius;
27
+ const dashOffset = circumference * (1 - pct / 100);
28
+ return (_jsxs(Outer, { outerSize: outerSize, children: [_jsxs(RingSvg, { width: outerSize, height: outerSize, viewBox: `0 0 ${outerSize} ${outerSize}`, children: [_jsx(Circle, { cx: outerSize / 2, cy: outerSize / 2, r: radius, stroke: theme.color.surface.border, strokeWidth: strokeWidth, fill: "none" }), _jsx(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] }));
29
+ };
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useTheme } from '../../../styled.native';
3
+ import { P } from '../../P';
4
+ import { Toggle } from '../../Toggle';
5
+ import { ActionListItemWrapper } from './styles';
6
+ export const ToggleListItem = ({ testID, heading, hintText, checked, onToggle, }) => {
7
+ const theme = useTheme();
8
+ return (_jsx(ActionListItemWrapper, { testID: testID ? `${testID}-toggle` : undefined, children: _jsx(Toggle, { checked: checked, onPress: onToggle, accessibilityLabel: typeof heading === 'string' ? heading : undefined, label: _jsx(P, { children: heading }), hint: hintText, toggleBackgroundColor: theme.color.brand.brand }) }));
9
+ };
@@ -0,0 +1,135 @@
1
+ import { numToPx } from '@ovotech/element-core';
2
+ import { Image, ImageBackground, View } from 'react-native';
3
+ import styled, { css } from '../../../styled.native';
4
+ import { P } from '../../P';
5
+ export const ActionListItemWrapper = styled(View)(({ theme }) => {
6
+ return css `
7
+ flex-direction: row;
8
+ align-items: center;
9
+ justify-content: space-between;
10
+ gap: ${numToPx(theme.space[300])};
11
+ padding: ${numToPx(theme.space[400])} 0;
12
+ `;
13
+ });
14
+ // Editable List Item
15
+ export const EditableListContainer = styled(View)(({ theme }) => {
16
+ return css `
17
+ flex: 1;
18
+ gap: ${numToPx(theme.space[100])};
19
+ `;
20
+ });
21
+ export const InitialStateContainer = styled(View)(() => {
22
+ return css `
23
+ flex-direction: row;
24
+ justify-content: space-between;
25
+ align-items: center;
26
+ `;
27
+ });
28
+ export const ValueText = styled(P)(({ theme }) => {
29
+ return css `
30
+ color: ${theme.color.surface.onSurfaceVariant};
31
+ `;
32
+ });
33
+ export const EditButtonsContainer = styled(View)(({ theme }) => {
34
+ return css `
35
+ gap: ${numToPx(theme.space[300])};
36
+ flex-direction: row;
37
+ justify-content: flex-end;
38
+ `;
39
+ });
40
+ // Navigation List Item
41
+ export const NavigationListContainer = styled(View)(({ theme }) => {
42
+ return css `
43
+ flex-direction: row;
44
+ align-items: center;
45
+ justify-content: space-between;
46
+ gap: ${numToPx(theme.space[100])};
47
+ `;
48
+ });
49
+ export const TextContainer = styled(View)(() => {
50
+ return css `
51
+ flex: 1;
52
+ `;
53
+ });
54
+ export const SubHeading = styled(P)(({ theme }) => {
55
+ return css `
56
+ color: ${theme.color.alert.info};
57
+ `;
58
+ });
59
+ // Data List Item
60
+ export const LeftTextContainer = styled(View)(({ theme }) => {
61
+ return css `
62
+ flex: 1;
63
+ gap: ${numToPx(theme.space[100])};
64
+ `;
65
+ });
66
+ export const RightTextContainer = styled(View)(({ theme }) => {
67
+ return css `
68
+ flex: 1;
69
+ gap: ${numToPx(theme.space[100])};
70
+ align-items: flex-end;
71
+ `;
72
+ });
73
+ export const StyledImage = styled(Image)(() => {
74
+ return css `
75
+ width: 100%;
76
+ height: 100%;
77
+ `;
78
+ });
79
+ export const StatusText = styled(P)(({ theme, isError, }) => {
80
+ return css `
81
+ color: ${isError ? theme.color.alert.error : theme.color.alert.info};
82
+ `;
83
+ });
84
+ export const ValueTextContainer = styled(View)(({ theme }) => {
85
+ return css `
86
+ min-width: ${numToPx(theme.space[2400])};
87
+ align-items: flex-end;
88
+ `;
89
+ });
90
+ export const DataValueText = styled(P)(({ theme, isError, }) => {
91
+ return css `
92
+ color: ${isError ? theme.color.alert.error : theme.color.surface.onSurface};
93
+ `;
94
+ });
95
+ export const DirectionLabelContainer = styled(View)(({ theme }) => {
96
+ return css `
97
+ min-width: ${numToPx(theme.space[600])};
98
+ align-items: flex-end;
99
+ `;
100
+ });
101
+ export const OnSurfaceP = styled(P)(({ theme }) => {
102
+ return css `
103
+ color: ${theme.color.surface.onSurfaceVariant};
104
+ `;
105
+ });
106
+ export const DirectionAndValueTextContainer = styled(View)(({ theme }) => {
107
+ return css `
108
+ align-items: flex-end;
109
+ justify-content: space-between;
110
+ width: 100%;
111
+ flex-direction: row;
112
+ margin-left: ${numToPx(theme.space[300])};
113
+ `;
114
+ });
115
+ export const PROGESS_RING_INNER = 42;
116
+ export const GraphicContainer = styled(ImageBackground)(({ theme, isIcon, hasProgress }) => {
117
+ return css `
118
+ border-radius: ${numToPx(theme.border.radius['2xl'])};
119
+ background-color: ${hasProgress
120
+ ? theme.color.surface.bright
121
+ : theme.color.surface.surface};
122
+ border-width: 0;
123
+ padding: ${isIcon ? numToPx(theme.space[200]) : 0};
124
+ width: ${hasProgress
125
+ ? `${PROGESS_RING_INNER}px`
126
+ : numToPx(theme.space[1100])};
127
+ height: ${hasProgress
128
+ ? `${PROGESS_RING_INNER}px`
129
+ : numToPx(theme.space[1100])};
130
+ flex-shrink: 0;
131
+ overflow: hidden;
132
+ align-items: center;
133
+ justify-content: center;
134
+ `;
135
+ });
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { Icon } from '../../Icon';
4
+ import { P } from '../../P';
5
+ import { Strong } from '../../Strong';
6
+ import { GraphicContainer, InfoRowWrapper } from '../styled';
7
+ export const ActionListHeading = ({ iconName, iconColor = 'surface.surface', heading, subheading, }) => (_jsxs(InfoRowWrapper, { children: [iconName && (_jsx(GraphicContainer, { children: _jsx(Icon, { name: iconName, size: 24, color: iconColor }) })), _jsxs(View, { children: [heading && (_jsx(P, { size: "xl", children: _jsx(Strong, { children: heading }) })), subheading && _jsx(P, { children: subheading })] })] }));
@@ -1 +1,6 @@
1
- export { Action, ActionList } from './ActionList';
1
+ export { Action } from './Action';
2
+ export { ActionList } from './ActionList';
3
+ export { DataListItem } from './ActionListItems/DataListItem';
4
+ export { EditableListItem } from './ActionListItems/EditableListItem';
5
+ export { NavigationListItem } from './ActionListItems/NavigationListItem';
6
+ export { ToggleListItem } from './ActionListItems/ToggleListItem';
@@ -1,23 +1,22 @@
1
1
  import { numToPx } from '@ovotech/element-core';
2
2
  import styled, { css } from '../../styled.native';
3
3
  import { styledComponentWithBreakpoints } from '../../utils';
4
+ import { Card } from '../Card';
4
5
  import { HintText } from '../HintText';
5
6
  import { Icon } from '../Icon';
6
- const StyledList = styled.View(({ theme, smallAndUp }) => css `
7
+ const StyledList = styled(Card)(({ theme, smallAndUp, inverted }) => css `
7
8
  flex-direction: column;
9
+ padding-top: ${numToPx(theme.space[0])};
10
+ padding-bottom: ${numToPx(theme.space[0])};
8
11
  margin-top: ${numToPx(smallAndUp ? theme.space[300] : theme.space[200])};
9
12
  margin-bottom: ${numToPx(smallAndUp ? theme.space[300] : theme.space[200])};
13
+ background-color: ${inverted && theme.color.neutral.black};
10
14
  `);
11
15
  export const StyledActionList = styledComponentWithBreakpoints(StyledList);
12
- export const StyledActionWrapper = styled.View(({ theme, hasBorder, inverted, inList, hint, badgeText }) => css `
16
+ export const StyledActionWrapper = styled.View(({ theme }) => css `
13
17
  width: 100%;
14
18
  align-self: flex-start;
15
- border-bottom-width: ${hasBorder ? numToPx(theme.border.width.sm) : 0};
16
- border-bottom-style: solid;
17
- border-bottom-color: ${inverted
18
- ? theme.color.surface.dim
19
- : theme.color.brand.fixed.onBrand};
20
- padding: ${inList && (hint || badgeText) ? numToPx(theme.space[200]) : 0} 0;
19
+ padding: ${numToPx(theme.space[400])} 0 ${numToPx(theme.space[400])} 0;
21
20
  `);
22
21
  export const StyledActionInner = styled.View(({ fullWidth, standalone }) => css `
23
22
  flex-direction: row;
@@ -72,3 +71,19 @@ export const StyledHintText = styled(HintText)(({ theme, inverted = false }) =>
72
71
  : theme.color.surface.onSurfaceVariant};
73
72
  `;
74
73
  });
74
+ // Action List Heading
75
+ export const GraphicContainer = styled.View(({ theme }) => css `
76
+ width: ${numToPx(theme.unit[1100])};
77
+ height: ${numToPx(theme.unit[1100])};
78
+ background-color: ${theme.color.surface.bright};
79
+ display: flex;
80
+ justify-content: center;
81
+ align-items: center;
82
+ border-radius: ${numToPx(theme.border.radius['2xl'])};
83
+ padding: ${numToPx(theme.space[200])};
84
+ `);
85
+ export const InfoRowWrapper = styled.View(({ theme }) => css `
86
+ flex-direction: row;
87
+ align-items: center;
88
+ gap: ${numToPx(theme.space[300])};
89
+ `);
@@ -18,7 +18,7 @@ const Button = (_a) => {
18
18
  const { smallAndUp } = useBreakpoint();
19
19
  const isIconOnly = !children;
20
20
  const iconSizes = {
21
- small: 14,
21
+ small: 16,
22
22
  default: 16,
23
23
  large: 20,
24
24
  };
@@ -11,17 +11,26 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { useEffect, useRef, useState } from 'react';
14
- import { Animated } from 'react-native';
14
+ import { Animated, Pressable, View, } from 'react-native';
15
15
  import { useBreakpoint } from '../../hooks';
16
16
  import { useTheme } from '../../styled.native';
17
17
  import { AnimatedStyledCard, BackgroundImage, TappableWrapper, } from './Card.styles';
18
18
  export const getCardFlags = (props) => {
19
- const { background, onPress, displayStyle } = props;
20
- const hasBgImage = !!background && typeof background !== 'string';
21
- const tappable = Boolean(onPress);
19
+ const { background, onPress, onSelect, displayStyle } = props;
20
+ const hasBackground = !!background;
21
+ const hasBgImage = hasBackground && typeof background !== 'string';
22
+ const selectable = Boolean(onSelect) && !onPress;
23
+ const pressable = Boolean(onPress) && !onSelect;
22
24
  const isDefault = displayStyle === 'default';
23
25
  const isOutline = displayStyle === 'outline';
24
- return { hasBgImage, tappable, isDefault, isOutline };
26
+ return {
27
+ hasBackground,
28
+ hasBgImage,
29
+ pressable,
30
+ selectable,
31
+ isDefault,
32
+ isOutline,
33
+ };
25
34
  };
26
35
  function useAnimatedBorder(baseColor, selectedColor, isSelected, duration) {
27
36
  const borderAnim = useRef(new Animated.Value(0)).current;
@@ -31,45 +40,58 @@ function useAnimatedBorder(baseColor, selectedColor, isSelected, duration) {
31
40
  duration,
32
41
  useNativeDriver: false,
33
42
  }).start();
34
- }, [isSelected, duration]);
43
+ }, [isSelected, duration, borderAnim]);
35
44
  return borderAnim.interpolate({
36
45
  inputRange: [0, 1],
37
46
  outputRange: [baseColor, selectedColor],
38
47
  });
39
48
  }
40
49
  export const Card = (_a) => {
41
- var { children, displayStyle = 'default', background, onPress } = _a, rest = __rest(_a, ["children", "displayStyle", "background", "onPress"]);
50
+ var { children, displayStyle = 'default', background, onPress, onSelect } = _a, rest = __rest(_a, ["children", "displayStyle", "background", "onPress", "onSelect"]);
42
51
  const theme = useTheme();
43
52
  const [isFocused, setFocused] = useState(false);
44
53
  const [isSelected, setSelected] = useState(false);
45
54
  const { largeAndUp } = useBreakpoint();
46
- const { hasBgImage, tappable, isDefault, isOutline } = getCardFlags({
55
+ const { hasBackground, hasBgImage, pressable, selectable, isDefault, isOutline, } = getCardFlags({
47
56
  background,
48
57
  onPress,
49
58
  displayStyle,
59
+ onSelect,
50
60
  });
51
61
  let baseBorderColor = theme.color.surface.bright;
52
- if (isOutline) {
53
- baseBorderColor = theme.color.surface.bright;
54
- }
55
- else if (isDefault) {
56
- if (hasBgImage)
62
+ if (isDefault) {
63
+ if (hasBgImage) {
57
64
  baseBorderColor = 'transparent';
58
- else if (typeof background === 'string')
65
+ }
66
+ else if (typeof background === 'string') {
59
67
  baseBorderColor = background;
60
- else
61
- baseBorderColor = theme.color.surface.bright;
68
+ }
62
69
  }
63
70
  const selectedBorderColor = theme.color.surface.onSurface;
64
- const animatedBorderColor = useAnimatedBorder(baseBorderColor, selectedBorderColor, isSelected, theme.transition.duration.fast);
71
+ const shouldHideBorder = hasBackground && !isOutline && !pressable && !selectable;
72
+ const animatedBorderColor = useAnimatedBorder(baseBorderColor, selectedBorderColor, selectable && isSelected, theme.transition.duration.fast);
65
73
  const handlePress = () => {
66
- setSelected(prev => !prev);
67
74
  onPress === null || onPress === void 0 ? void 0 : onPress();
68
75
  };
69
- const CardContent = (_jsxs(AnimatedStyledCard, Object.assign({ displayStyle: displayStyle, background: background, largeAndUp: largeAndUp }, rest, { style: [rest === null || rest === void 0 ? void 0 : rest.style, { borderColor: animatedBorderColor }], children: [hasBgImage && (_jsx(BackgroundImage, { source: background, resizeMode: "cover", largeAndUp: largeAndUp })), children] })));
70
- if (!tappable)
71
- return CardContent;
72
- return (_jsx(TappableWrapper, { onPress: handlePress, onFocus: () => setFocused(true), onBlur: () => setFocused(false), accessibilityRole: "button", focused: isFocused, largeAndUp: largeAndUp, style: ({ pressed }) => ({
76
+ const handleSelect = () => {
77
+ setSelected(prev => !prev);
78
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect();
79
+ };
80
+ const CardContent = (_jsxs(AnimatedStyledCard, Object.assign({ displayStyle: displayStyle, background: background, largeAndUp: largeAndUp, onPress: onPress, onSelect: onSelect }, rest, { style: [
81
+ {
82
+ borderWidth: shouldHideBorder ? 0 : theme.border.width.md,
83
+ borderColor: animatedBorderColor,
84
+ },
85
+ rest === null || rest === void 0 ? void 0 : rest.style,
86
+ ], children: [hasBgImage && (_jsx(BackgroundImage, { source: background, resizeMode: "cover", largeAndUp: largeAndUp })), children] })));
87
+ const isInteractive = pressable || selectable;
88
+ return (_jsx(TappableWrapper, Object.assign({ as: isInteractive ? Pressable : View, largeAndUp: largeAndUp, tappable: isInteractive, focused: isInteractive ? isFocused : false }, (isInteractive && {
89
+ onPress: pressable ? handlePress : handleSelect,
90
+ onFocus: () => setFocused(true),
91
+ onBlur: () => setFocused(false),
92
+ accessibilityRole: 'button',
93
+ style: ({ pressed }) => ({
73
94
  opacity: pressed ? 0.9 : 1,
74
- }), children: CardContent }));
95
+ }),
96
+ }), { children: CardContent })));
75
97
  };
@@ -1,21 +1,22 @@
1
- import { Animated, ImageBackground, Pressable, View } from 'react-native';
1
+ import { Animated, ImageBackground, View } from 'react-native';
2
2
  import styled from '../../styled.native';
3
3
  import { styledComponentWithBreakpoints } from '../../utils';
4
4
  import { getCardFlags } from './Card';
5
- const StyledCardBase = styled(View)(({ theme, displayStyle, background, onPress, largeAndUp, size, }) => {
6
- const { hasBgImage, tappable, isDefault } = getCardFlags({
5
+ const StyledCardBase = styled(View)(({ theme, displayStyle, background, onPress, onSelect, largeAndUp, size, }) => {
6
+ const { hasBgImage, pressable, selectable, isDefault } = getCardFlags({
7
7
  background,
8
8
  onPress,
9
+ onSelect,
9
10
  displayStyle,
10
11
  });
11
12
  const backgroundColor = hasBgImage
12
13
  ? 'transparent'
13
14
  : typeof background === 'string'
14
15
  ? background
15
- : isDefault || tappable
16
+ : isDefault || pressable || selectable
16
17
  ? theme.color.surface.bright
17
18
  : 'transparent';
18
- return Object.assign(Object.assign({}, (size || {})), { padding: theme.space[400], position: 'relative', borderWidth: theme.border.width.md, borderStyle: 'solid', borderRadius: theme.border.radius[largeAndUp ? '2xl' : 'lg'], overflow: 'hidden', backgroundColor });
19
+ return Object.assign(Object.assign({}, (size || {})), { padding: theme.space[400], position: 'relative', borderStyle: 'solid', borderRadius: theme.border.radius[largeAndUp ? '2xl' : 'lg'], overflow: 'hidden', backgroundColor });
19
20
  });
20
21
  const CardBase = styledComponentWithBreakpoints(StyledCardBase);
21
22
  export const AnimatedStyledCard = Animated.createAnimatedComponent(CardBase);
@@ -28,15 +29,10 @@ export const BackgroundImage = styled(ImageBackground)(({ theme, largeAndUp }) =
28
29
  borderRadius: theme.border.radius[largeAndUp ? '2xl' : 'lg'],
29
30
  overflow: 'hidden',
30
31
  }));
31
- export const TappableWrapper = styled(Pressable)(({ theme, focused, largeAndUp }) => ({
32
- backgroundColor: 'transparent',
33
- borderColor: focused ? theme.color.outline.outer : 'transparent',
34
- borderWidth: theme.border.width.md,
35
- borderRadius: largeAndUp ? 26 : theme.border.radius.xl,
36
- padding: theme.space[50],
32
+ export const TappableWrapper = styled(View)(({ theme, focused, tappable, largeAndUp }) => (Object.assign(Object.assign({}, (tappable && {
37
33
  shadowColor: '#000',
38
34
  shadowOffset: { width: 0, height: theme.space[100] },
39
35
  shadowOpacity: 0.1,
40
36
  shadowRadius: theme.space[250],
41
37
  elevation: theme.space[150],
42
- }));
38
+ })), { backgroundColor: 'transparent', borderColor: focused ? theme.color.outline.outer : 'transparent', borderWidth: theme.border.width.md, borderRadius: largeAndUp ? 26 : theme.border.radius.xl, padding: theme.space[50] })));
@@ -70,10 +70,10 @@ export const CreditContainer = styled(View)(({ theme }) => ({
70
70
  paddingBottom: theme.space[200],
71
71
  }));
72
72
  export const StyledDisplay4 = styled(Display4)(({ theme }) => ({
73
- lineHeight: theme.font.lineHeight.d3.mediaQuery.sm,
73
+ lineHeight: `${theme.font.lineHeight.d3.mediaQuery.sm}px`,
74
74
  }));
75
75
  export const StyledHeading1 = styled(Heading1)(({ theme }) => ({
76
- lineHeight: theme.font.lineHeight.d4.mediaQuery.sm,
76
+ lineHeight: `${theme.font.lineHeight.d4.mediaQuery.sm}px`,
77
77
  }));
78
78
  export const ErrorContainer = styled(View)(({ theme }) => ({
79
79
  flexDirection: 'column',
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { Heading2, Heading3, Icon, P, Stack } from '../..';
4
+ import { useTheme } from '../../../styled.native';
5
+ import { checkIsSmall } from '../utils';
6
+ import { CardDisruptive } from './DisruptiveCard.styles';
7
+ const CARD_ICONS = {
8
+ success: 'check-circle',
9
+ info: 'info',
10
+ warning: 'info',
11
+ };
12
+ const getVariantStyles = (variant, theme) => {
13
+ switch (variant) {
14
+ case 'success':
15
+ return {
16
+ iconTextColor: theme.color.alert.success,
17
+ background: theme.color.brand.bright,
18
+ };
19
+ case 'info':
20
+ return {
21
+ iconTextColor: theme.color.alert.info,
22
+ background: theme.color.alert.infoTint,
23
+ };
24
+ case 'warning':
25
+ default:
26
+ return {
27
+ iconTextColor: theme.color.alert.warning,
28
+ background: theme.color.alert.warningTint,
29
+ };
30
+ }
31
+ };
32
+ const DisruptiveHeading = ({ heading, size = 'default', color, }) => {
33
+ const HeadingComponent = checkIsSmall(size) ? Heading3 : Heading2;
34
+ const headingStyle = useMemo(() => ({ color }), [color]);
35
+ return _jsx(HeadingComponent, { style: headingStyle, children: heading });
36
+ };
37
+ export const DisruptiveCard = ({ variant = 'success', icon, heading, subHeading, size = 'default', }) => {
38
+ const theme = useTheme();
39
+ const { iconTextColor, background } = getVariantStyles(variant, theme);
40
+ return (_jsx(CardDisruptive, { background: background, isSmall: true, children: _jsxs(Stack, { spaceBetween: 1, children: [_jsx(Icon, { name: icon !== null && icon !== void 0 ? icon : CARD_ICONS[variant], size: 32, color: iconTextColor }), _jsx(DisruptiveHeading, { color: iconTextColor, heading: heading, size: size }), subHeading && !checkIsSmall(size) && (_jsx(P, { style: { color: iconTextColor }, children: subHeading }))] }) }));
41
+ };
@@ -0,0 +1,5 @@
1
+ import styled from '../../../styled.native';
2
+ import { CardWithMinHeight } from '../shared.styles';
3
+ export const CardDisruptive = styled(CardWithMinHeight)({
4
+ justifyContent: 'flex-end',
5
+ });
@@ -0,0 +1 @@
1
+ export * from './DisruptiveCard';