@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.
Files changed (284) hide show
  1. package/dist/components/Accordion/styles.d.ts +3 -1725
  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 +23 -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 +12 -0
  16. package/dist/components/ActionList/ActionListItems/styles.d.ts +51 -0
  17. package/dist/components/ActionList/ActionListItems/styles.js +173 -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 +12 -5756
  23. package/dist/components/ActionList/styled.js +24 -9
  24. package/dist/components/Badge/Badge.d.ts +1 -575
  25. package/dist/components/BottomActionBar/BottomActionBar.d.ts +12 -0
  26. package/dist/components/BottomActionBar/BottomActionBar.js +80 -0
  27. package/dist/components/BottomActionBar/OverlayProvider.d.ts +8 -0
  28. package/dist/components/BottomActionBar/OverlayProvider.js +38 -0
  29. package/dist/components/BottomActionBar/index.d.ts +2 -0
  30. package/dist/components/BottomActionBar/index.js +7 -0
  31. package/dist/components/Button/Button.js +1 -1
  32. package/dist/components/Button/Button.styles.d.ts +5 -2300
  33. package/dist/components/Card/Card.d.ts +7 -4
  34. package/dist/components/Card/Card.js +44 -22
  35. package/dist/components/Card/Card.styles.d.ts +4 -1725
  36. package/dist/components/Card/Card.styles.js +7 -11
  37. package/dist/components/Cards/AccountCard/AccountCard.styles.d.ts +8 -4600
  38. package/dist/components/Cards/BalanceCard/BalanceCard.styles.d.ts +15 -8625
  39. package/dist/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
  40. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.d.ts +13 -0
  41. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.js +45 -0
  42. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.d.ts +3 -0
  43. package/dist/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +11 -0
  44. package/dist/components/Cards/DisruptiveCard/index.d.ts +1 -0
  45. package/dist/components/Cards/DisruptiveCard/index.js +17 -0
  46. package/dist/components/Cards/HeroImageCard/HeroImageCard.d.ts +12 -0
  47. package/dist/components/Cards/HeroImageCard/HeroImageCard.js +65 -0
  48. package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.d.ts +10 -0
  49. package/dist/components/Cards/HeroImageCard/HeroImageCard.styles.js +27 -0
  50. package/dist/components/Cards/HeroImageCard/index.d.ts +1 -0
  51. package/dist/components/Cards/HeroImageCard/index.js +17 -0
  52. package/dist/components/Cards/IconDataCard/IconDataCard.styles.d.ts +4 -2300
  53. package/dist/components/Cards/IconTextCard/IconTextCard.js +3 -16
  54. package/dist/components/Cards/IconTextCard/IconTextCard.styles.d.ts +3 -2300
  55. package/dist/components/Cards/IconTextCard/IconTextCard.styles.js +1 -6
  56. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.d.ts +14 -0
  57. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.js +26 -0
  58. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.d.ts +18 -0
  59. package/dist/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +33 -0
  60. package/dist/components/Cards/IllustrationTextCard/index.d.ts +1 -0
  61. package/dist/components/Cards/IllustrationTextCard/index.js +17 -0
  62. package/dist/components/Cards/LinkTextCard/LinkTextCard.d.ts +2 -2
  63. package/dist/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
  64. package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.d.ts +8 -2875
  65. package/dist/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
  66. package/dist/components/Cards/OfferCard/OfferCard.d.ts +22 -0
  67. package/dist/components/Cards/OfferCard/OfferCard.js +36 -0
  68. package/dist/components/Cards/OfferCard/OfferCard.styles.d.ts +34 -0
  69. package/dist/components/Cards/OfferCard/OfferCard.styles.js +61 -0
  70. package/dist/components/Cards/OfferCard/index.d.ts +1 -0
  71. package/dist/components/Cards/OfferCard/index.js +17 -0
  72. package/dist/components/Cards/ProgressBarCard/ProgressBarCard.styles.d.ts +9 -5175
  73. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.d.ts +12 -0
  74. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.js +27 -0
  75. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.d.ts +12 -0
  76. package/dist/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +31 -0
  77. package/dist/components/Cards/QuickLinkCard/index.d.ts +1 -0
  78. package/dist/components/Cards/QuickLinkCard/index.js +17 -0
  79. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.d.ts +12 -0
  80. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.js +24 -0
  81. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.d.ts +17 -0
  82. package/dist/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +38 -0
  83. package/dist/components/Cards/ServicesImageCard/index.d.ts +1 -0
  84. package/dist/components/Cards/ServicesImageCard/index.js +17 -0
  85. package/dist/components/Cards/components.d.ts +15 -0
  86. package/dist/components/Cards/components.js +24 -0
  87. package/dist/components/Cards/index.d.ts +5 -0
  88. package/dist/components/Cards/index.js +11 -1
  89. package/dist/components/Cards/shared.styles.d.ts +11 -3451
  90. package/dist/components/Cards/shared.styles.js +18 -2
  91. package/dist/components/Cards/utils.d.ts +1 -0
  92. package/dist/components/Cards/utils.js +13 -1
  93. package/dist/components/Checkbox/Checkbox.d.ts +2 -13
  94. package/dist/components/Checkbox/Checkbox.js +3 -49
  95. package/dist/components/Checkbox/styled.d.ts +21 -0
  96. package/dist/components/Checkbox/styled.js +52 -0
  97. package/dist/components/Checkbox/types.d.ts +16 -0
  98. package/dist/components/Checkbox/types.js +2 -0
  99. package/dist/components/CurrencyInput/CurrencyInput.d.ts +2 -1
  100. package/dist/components/CurrencyInput/CurrencyInput.js +11 -4
  101. package/dist/components/CurrencyInput/styled.d.ts +10 -0
  102. package/dist/components/CurrencyInput/styled.js +39 -0
  103. package/dist/components/DataTable/styles.d.ts +13 -7475
  104. package/dist/components/Disclosure/Disclosure.d.ts +1 -575
  105. package/dist/components/Divider/Divider.d.ts +1 -1
  106. package/dist/components/Divider/Divider.js +3 -1
  107. package/dist/components/Em/Em.d.ts +1 -575
  108. package/dist/components/EmailInput/EmailInput.d.ts +4 -1
  109. package/dist/components/EmailInput/EmailInput.js +18 -2
  110. package/dist/components/EmptyState/EmptyState.d.ts +2 -0
  111. package/dist/components/EmptyState/EmptyState.js +17 -0
  112. package/dist/components/EmptyState/EmptyState.test.d.ts +1 -0
  113. package/dist/components/EmptyState/EmptyState.test.js +92 -0
  114. package/dist/components/EmptyState/index.d.ts +1 -0
  115. package/dist/components/EmptyState/index.js +17 -0
  116. package/dist/components/EmptyState/styles.d.ts +2 -0
  117. package/dist/components/EmptyState/styles.js +23 -0
  118. package/dist/components/EmptyState/types.d.ts +18 -0
  119. package/dist/components/EmptyState/types.js +2 -0
  120. package/dist/components/ErrorText/ErrorText.d.ts +1 -575
  121. package/dist/components/Field/Field.d.ts +3 -2
  122. package/dist/components/Field/Field.js +3 -2
  123. package/dist/components/Grid/Col.d.ts +1 -575
  124. package/dist/components/HintText/HintText.d.ts +1 -575
  125. package/dist/components/Input/Input.d.ts +2 -1
  126. package/dist/components/Input/Input.js +6 -97
  127. package/dist/components/Input/styled.d.ts +16 -0
  128. package/dist/components/Input/styled.js +96 -0
  129. package/dist/components/LabelText/LabelText.d.ts +1 -575
  130. package/dist/components/LargeValueReference/LargeValueReference.d.ts +11 -0
  131. package/dist/components/LargeValueReference/LargeValueReference.js +49 -0
  132. package/dist/components/LargeValueReference/index.d.ts +1 -0
  133. package/dist/components/LargeValueReference/index.js +17 -0
  134. package/dist/components/LargeValueReference/styles.d.ts +10 -0
  135. package/dist/components/LargeValueReference/styles.js +29 -0
  136. package/dist/components/LineThrough/LineThrough.d.ts +1 -575
  137. package/dist/components/List/styled.d.ts +4 -2300
  138. package/dist/components/Margin/Margin.d.ts +1 -575
  139. package/dist/components/NavHeader/NavHeader.styles.d.ts +11 -6325
  140. package/dist/components/Notification/Notification.d.ts +2 -2
  141. package/dist/components/Notification/Notification.js +20 -12
  142. package/dist/components/Notification/Notification.styles.d.ts +13 -5175
  143. package/dist/components/Notification/Notification.styles.js +21 -2
  144. package/dist/components/PasswordInput/PasswordInput.styled.d.ts +1 -577
  145. package/dist/components/PasswordInput/PasswordInput.styled.js +5 -3
  146. package/dist/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
  147. package/dist/components/Radio/Radio.d.ts +2 -2
  148. package/dist/components/Radio/Radio.js +5 -43
  149. package/dist/components/Radio/Radio.styles.d.ts +9 -0
  150. package/dist/components/Radio/Radio.styles.js +74 -0
  151. package/dist/components/RadioCard/RadioCard.d.ts +2 -1
  152. package/dist/components/RadioCard/RadioCard.js +7 -57
  153. package/dist/components/RadioCard/RadioCard.styles.d.ts +16 -0
  154. package/dist/components/RadioCard/RadioCard.styles.js +97 -0
  155. package/dist/components/Rail/Rail.d.ts +12 -0
  156. package/dist/components/Rail/Rail.js +58 -0
  157. package/dist/components/Rail/RailIndicator.d.ts +7 -0
  158. package/dist/components/Rail/RailIndicator.js +81 -0
  159. package/dist/components/Rail/index.d.ts +1 -0
  160. package/dist/components/Rail/index.js +5 -0
  161. package/dist/components/Rail/styles.d.ts +13 -0
  162. package/dist/components/Rail/styles.js +55 -0
  163. package/dist/components/Rail/useRailPaging.d.ts +13 -0
  164. package/dist/components/Rail/useRailPaging.js +95 -0
  165. package/dist/components/SelectField/Select.d.ts +5 -579
  166. package/dist/components/SelectField/Select.js +7 -107
  167. package/dist/components/SelectField/SelectField.d.ts +2 -2
  168. package/dist/components/SelectField/SelectField.js +2 -2
  169. package/dist/components/SelectField/styled.d.ts +26 -0
  170. package/dist/components/SelectField/styled.js +118 -0
  171. package/dist/components/SkeletonText/SkeletonText.js +4 -4
  172. package/dist/components/Strong/Strong.d.ts +1 -575
  173. package/dist/components/SubLabelText/SubLabelText.d.ts +1 -575
  174. package/dist/components/Tabs/Tab.d.ts +1 -575
  175. package/dist/components/TextareaInput/TextareaInput.js +12 -6
  176. package/dist/components/Toast/Toast.d.ts +10 -4
  177. package/dist/components/Toast/Toast.js +40 -27
  178. package/dist/components/Toggle/Toggle.d.ts +3 -1
  179. package/dist/components/Toggle/Toggle.js +4 -6
  180. package/dist/components/Toggle/styles.d.ts +5 -2300
  181. package/dist/components/Toggle/styles.js +3 -3
  182. package/dist/components/index.d.ts +5 -0
  183. package/dist/components/index.js +5 -0
  184. package/dist/esm/components/ActionList/Action.js +26 -0
  185. package/dist/esm/components/ActionList/ActionList.js +12 -28
  186. package/dist/esm/components/ActionList/ActionListItems/DataListItem.js +19 -0
  187. package/dist/esm/components/ActionList/ActionListItems/EditableListItem.js +131 -0
  188. package/dist/esm/components/ActionList/ActionListItems/NavigationListItem.js +26 -0
  189. package/dist/esm/components/ActionList/ActionListItems/ProgressRing.js +29 -0
  190. package/dist/esm/components/ActionList/ActionListItems/ToggleListItem.js +8 -0
  191. package/dist/esm/components/ActionList/ActionListItems/styles.js +137 -0
  192. package/dist/esm/components/ActionList/components/ActionListHeading.js +7 -0
  193. package/dist/esm/components/ActionList/index.js +6 -1
  194. package/dist/esm/components/ActionList/styled.js +23 -8
  195. package/dist/esm/components/BottomActionBar/BottomActionBar.js +40 -0
  196. package/dist/esm/components/BottomActionBar/OverlayProvider.js +30 -0
  197. package/dist/esm/components/BottomActionBar/index.js +2 -0
  198. package/dist/esm/components/Button/Button.js +1 -1
  199. package/dist/esm/components/Card/Card.js +45 -23
  200. package/dist/esm/components/Card/Card.styles.js +8 -12
  201. package/dist/esm/components/Cards/BalanceCard/BalanceCard.styles.js +2 -2
  202. package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.js +41 -0
  203. package/dist/esm/components/Cards/DisruptiveCard/DisruptiveCard.styles.js +5 -0
  204. package/dist/esm/components/Cards/DisruptiveCard/index.js +1 -0
  205. package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.js +28 -0
  206. package/dist/esm/components/Cards/HeroImageCard/HeroImageCard.styles.js +21 -0
  207. package/dist/esm/components/Cards/HeroImageCard/index.js +1 -0
  208. package/dist/esm/components/Cards/IconTextCard/IconTextCard.js +5 -18
  209. package/dist/esm/components/Cards/IconTextCard/IconTextCard.styles.js +0 -5
  210. package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.js +22 -0
  211. package/dist/esm/components/Cards/IllustrationTextCard/IllustrationTextCard.styles.js +27 -0
  212. package/dist/esm/components/Cards/IllustrationTextCard/index.js +1 -0
  213. package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.js +7 -6
  214. package/dist/esm/components/Cards/LinkTextCard/LinkTextCard.styles.js +9 -6
  215. package/dist/esm/components/Cards/OfferCard/OfferCard.js +32 -0
  216. package/dist/esm/components/Cards/OfferCard/OfferCard.styles.js +55 -0
  217. package/dist/esm/components/Cards/OfferCard/index.js +1 -0
  218. package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.js +23 -0
  219. package/dist/esm/components/Cards/QuickLinkCard/QuickLinkCard.styles.js +25 -0
  220. package/dist/esm/components/Cards/QuickLinkCard/index.js +1 -0
  221. package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.js +20 -0
  222. package/dist/esm/components/Cards/ServicesImageCard/ServicesImageCard.styles.js +32 -0
  223. package/dist/esm/components/Cards/ServicesImageCard/index.js +1 -0
  224. package/dist/esm/components/Cards/components.js +19 -0
  225. package/dist/esm/components/Cards/index.js +5 -0
  226. package/dist/esm/components/Cards/shared.styles.js +17 -1
  227. package/dist/esm/components/Cards/utils.js +11 -0
  228. package/dist/esm/components/Checkbox/Checkbox.js +2 -45
  229. package/dist/esm/components/Checkbox/styled.js +46 -0
  230. package/dist/esm/components/Checkbox/types.js +1 -0
  231. package/dist/esm/components/CurrencyInput/CurrencyInput.js +12 -5
  232. package/dist/esm/components/CurrencyInput/styled.js +33 -0
  233. package/dist/esm/components/Divider/Divider.js +3 -1
  234. package/dist/esm/components/EmailInput/EmailInput.js +18 -2
  235. package/dist/esm/components/EmptyState/EmptyState.js +13 -0
  236. package/dist/esm/components/EmptyState/EmptyState.test.js +90 -0
  237. package/dist/esm/components/EmptyState/index.js +1 -0
  238. package/dist/esm/components/EmptyState/styles.js +17 -0
  239. package/dist/esm/components/EmptyState/types.js +1 -0
  240. package/dist/esm/components/Field/Field.js +3 -2
  241. package/dist/esm/components/Input/Input.js +6 -64
  242. package/dist/esm/components/Input/styled.js +60 -0
  243. package/dist/esm/components/LargeValueReference/LargeValueReference.js +45 -0
  244. package/dist/esm/components/LargeValueReference/index.js +1 -0
  245. package/dist/esm/components/LargeValueReference/styles.js +23 -0
  246. package/dist/esm/components/Notification/Notification.js +21 -13
  247. package/dist/esm/components/Notification/Notification.styles.js +20 -1
  248. package/dist/esm/components/PasswordInput/PasswordInput.styled.js +5 -3
  249. package/dist/esm/components/PasswordInput/PasswordVisibilityToggle.js +2 -8
  250. package/dist/esm/components/Radio/Radio.js +4 -39
  251. package/dist/esm/components/Radio/Radio.styles.js +38 -0
  252. package/dist/esm/components/RadioCard/RadioCard.js +5 -52
  253. package/dist/esm/components/RadioCard/RadioCard.styles.js +61 -0
  254. package/dist/esm/components/Rail/Rail.js +21 -0
  255. package/dist/esm/components/Rail/RailIndicator.js +44 -0
  256. package/dist/esm/components/Rail/index.js +1 -0
  257. package/dist/esm/components/Rail/styles.js +49 -0
  258. package/dist/esm/components/Rail/useRailPaging.js +92 -0
  259. package/dist/esm/components/SelectField/Select.js +7 -74
  260. package/dist/esm/components/SelectField/SelectField.js +3 -3
  261. package/dist/esm/components/SelectField/styled.js +82 -0
  262. package/dist/esm/components/SkeletonText/SkeletonText.js +4 -4
  263. package/dist/esm/components/TextareaInput/TextareaInput.js +12 -6
  264. package/dist/esm/components/Toast/Toast.js +40 -27
  265. package/dist/esm/components/Toggle/Toggle.js +4 -6
  266. package/dist/esm/components/Toggle/styles.js +3 -3
  267. package/dist/esm/components/index.js +5 -0
  268. package/dist/esm/hooks/use-font-scaling.js +32 -0
  269. package/dist/esm/index.js +1 -0
  270. package/dist/esm/test/utils.js +12 -0
  271. package/dist/esm/utils/utils.js +12 -1
  272. package/dist/hooks/use-font-scaling.d.ts +26 -0
  273. package/dist/hooks/use-font-scaling.js +35 -0
  274. package/dist/index.d.ts +1 -0
  275. package/dist/index.js +1 -0
  276. package/dist/styled.native.d.ts +1 -3445
  277. package/dist/test/utils.d.ts +4 -0
  278. package/dist/test/utils.js +28 -0
  279. package/dist/utils/utils.d.ts +11 -1
  280. package/dist/utils/utils.js +12 -0
  281. package/package.json +5 -5
  282. package/dist/components/ErrorWrapper/styles.d.ts +0 -0
  283. package/dist/components/ErrorWrapper/styles.js +0 -1
  284. package/dist/esm/components/ErrorWrapper/styles.js +0 -1
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useMemo, useState } from 'react';
3
+ import { View } from 'react-native';
4
+ import { P } from '../../P';
5
+ import { ContainerWithCardBadge, ResponsiveHeading } from '../components';
6
+ import { SMALL_CARD_HEIGHT } from '../shared.styles';
7
+ import { CardImage, CardWithServicesImage, HeadingContainer, ImageContent, TextContent, } from './ServicesImageCard.styles';
8
+ export const ServicesImageCard = ({ badgeText, image, heading, subHeading, onPress, }) => {
9
+ const hasBadge = !!badgeText;
10
+ const [cardHeight, setCardHeight] = useState(0);
11
+ const onLayout = useCallback((e) => {
12
+ const { height: layoutHeight } = e.nativeEvent.layout;
13
+ setCardHeight(layoutHeight);
14
+ }, []);
15
+ const pushImage = useMemo(() => cardHeight > SMALL_CARD_HEIGHT, [cardHeight]);
16
+ const content = (_jsxs(CardWithServicesImage, { isSmall: true, onPress: onPress, onLayout: onLayout, children: [_jsxs(TextContent, { hasBadge: hasBadge, pushImage: pushImage, children: [_jsx(HeadingContainer, { subHeading: !!subHeading, children: _jsx(ResponsiveHeading, { heading: heading }) }), !!subHeading && (_jsx(View, { children: _jsx(P, { children: subHeading }) }))] }), _jsx(ImageContent, { pushImage: pushImage, children: _jsx(CardImage, { pushImage: pushImage, source: typeof image === 'string' ? { uri: image } : image, resizeMode: "cover" }) })] }));
17
+ if (!hasBadge)
18
+ return content;
19
+ return (_jsx(ContainerWithCardBadge, { badgeText: badgeText, children: content }));
20
+ };
@@ -0,0 +1,32 @@
1
+ import { Image, View } from 'react-native';
2
+ import styled from '../../../styled.native';
3
+ import { CardWithMinHeight, SMALL_CARD_HEIGHT } from '../shared.styles';
4
+ const IMAGE_OUTSIDE = SMALL_CARD_HEIGHT * 0.45;
5
+ export const CardWithServicesImage = styled(CardWithMinHeight)({
6
+ paddingTop: 0,
7
+ flexDirection: 'row',
8
+ borderColor: 'transparent',
9
+ });
10
+ export const TextContent = styled(View)(({ hasBadge, theme, pushImage }) => ({
11
+ paddingTop: hasBadge ? theme.space[800] : theme.space[400],
12
+ paddingRight: pushImage ? IMAGE_OUTSIDE : SMALL_CARD_HEIGHT - IMAGE_OUTSIDE,
13
+ flex: 1,
14
+ alignSelf: 'flex-end',
15
+ }));
16
+ export const HeadingContainer = styled(View)(({ theme, subHeading }) => ({
17
+ marginBottom: subHeading ? theme.space[200] : 0,
18
+ }));
19
+ export const ImageContent = styled(View)(({ theme, pushImage }) => ({
20
+ position: 'absolute',
21
+ top: pushImage ? theme.space[50] : theme.space[250],
22
+ bottom: 0,
23
+ width: SMALL_CARD_HEIGHT,
24
+ right: -(pushImage ? IMAGE_OUTSIDE * 1.45 : IMAGE_OUTSIDE),
25
+ transform: 'rotate(-15deg)',
26
+ overflow: 'hidden',
27
+ }));
28
+ export const CardImage = styled(Image)(({ pushImage }) => ({
29
+ width: '100%',
30
+ height: '100%',
31
+ transform: `rotate(15deg) scale(${pushImage ? 1.35 : 1.2})`,
32
+ }));
@@ -0,0 +1 @@
1
+ export * from './ServicesImageCard';
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useTheme } from '../../styled.native';
3
+ import { Heading2, Heading4 } from '../Heading';
4
+ import { BadgeContainer, StyledBadge } from './shared.styles';
5
+ import { checkIsSmall, resolveColor } from './utils';
6
+ export const ResponsiveHeading = ({ heading, size = 'default', }) => {
7
+ const theme = useTheme();
8
+ const HeadingComponent = checkIsSmall(size) ? Heading4 : Heading2;
9
+ if (typeof heading === 'string') {
10
+ return _jsx(HeadingComponent, { children: heading });
11
+ }
12
+ return (_jsx(_Fragment, { children: heading.map((segment, index) => (_jsx(HeadingComponent, { style: {
13
+ color: resolveColor(segment.color),
14
+ marginRight: theme.space[150],
15
+ }, children: segment.text }, `${segment.text}-${index}`))) }));
16
+ };
17
+ export const ContainerWithCardBadge = ({ badgeText, variant = 'success', children }) => {
18
+ return (_jsxs(BadgeContainer, { children: [_jsx(StyledBadge, { variant: variant, children: badgeText }), children] }));
19
+ };
@@ -1,6 +1,11 @@
1
1
  export { AccountCard } from './AccountCard';
2
2
  export { BalanceCard, BalanceCardErrorFallback } from './BalanceCard';
3
+ export { DisruptiveCard } from './DisruptiveCard';
4
+ export { HeroImageCard } from './HeroImageCard';
3
5
  export { IconDataCard } from './IconDataCard';
4
6
  export { IconTextCard } from './IconTextCard';
7
+ export { IllustrationTextCard } from './IllustrationTextCard';
5
8
  export { LinkTextCard } from './LinkTextCard';
6
9
  export { ProgressBarCard } from './ProgressBarCard';
10
+ export { QuickLinkCard } from './QuickLinkCard';
11
+ export { ServicesImageCard } from './ServicesImageCard';
@@ -3,7 +3,10 @@ import styled from '../../styled.native';
3
3
  import { Badge } from '../Badge';
4
4
  import { Card } from '../Card';
5
5
  export const SMALL_CARD_HEIGHT = 172;
6
- export const CardBadge = styled(Badge)(({ theme }) => ({
6
+ export const BadgeContainer = styled(View)({
7
+ position: 'relative',
8
+ });
9
+ export const StyledBadge = styled(Badge)(({ theme }) => ({
7
10
  position: 'absolute',
8
11
  top: theme.space[100],
9
12
  left: theme.space[500],
@@ -16,6 +19,11 @@ export const CardBadge = styled(Badge)(({ theme }) => ({
16
19
  paddingTop: 0,
17
20
  zIndex: 1,
18
21
  }));
22
+ export const TitleContainer = styled(View)(({ theme }) => ({
23
+ marginRight: theme.space[50],
24
+ flexDirection: 'row',
25
+ flexWrap: 'wrap',
26
+ }));
19
27
  export const CardWithMinHeight = styled(Card)(({ isSmall }) => ({
20
28
  minHeight: isSmall ? SMALL_CARD_HEIGHT : undefined,
21
29
  }));
@@ -31,3 +39,11 @@ export const WrappedContainer = styled(View)(({ theme }) => ({
31
39
  flexWrap: 'wrap',
32
40
  gap: theme.space[100],
33
41
  }));
42
+ // Styles for stories
43
+ export const StyleWrapper = styled.View({
44
+ padding: 10,
45
+ gap: 15,
46
+ });
47
+ export const SmallCardContainer = styled.View({
48
+ maxWidth: 180,
49
+ });
@@ -1,3 +1,4 @@
1
+ import { Alert } from 'react-native';
1
2
  import { useTheme } from '../../styled.native';
2
3
  export const checkIsSmall = (size) => size === 'small';
3
4
  export const resolveColor = (colorKey = 'default') => {
@@ -8,5 +9,15 @@ export const resolveColor = (colorKey = 'default') => {
8
9
  if (colorKey === 'onSurface') {
9
10
  return theme.color.surface.onSurface;
10
11
  }
12
+ if (colorKey === 'brandBold') {
13
+ return theme.color.brand.bold;
14
+ }
15
+ if (colorKey === 'onBrand') {
16
+ return theme.color.brand.onBrand;
17
+ }
11
18
  return colorKey;
12
19
  };
20
+ // Used for stories
21
+ export const handlePress = () => {
22
+ Alert.alert('Card pressed');
23
+ };
@@ -10,59 +10,16 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { numToPx } from '@ovotech/element-core';
14
- import { TouchableOpacity, View, } from 'react-native';
15
- import styled from '../../styled.native';
13
+ import { TouchableOpacity, View } from 'react-native';
16
14
  import { ErrorText } from '../ErrorText';
17
15
  import { FormGroup } from '../FormGroup';
18
16
  import { HintText } from '../HintText';
19
- import { Icon } from '../Icon/Icon';
20
- import { LabelText } from '../LabelText';
21
17
  import { Stack } from '../Stack';
22
- const StyledCheckboxInputWrapper = styled.View(({ theme }) => {
23
- const checkboxSize = theme.space[600];
24
- const gap = theme.space[200];
25
- return `
26
- width: ${numToPx(checkboxSize + gap)};
27
- height: ${numToPx(theme.space[1100])};
28
- `;
29
- });
30
- const StyledCheckboxInput = styled.View(({ theme, invalid, checked }) => {
31
- return `
32
- width: ${numToPx(theme.space[600])};
33
- height: ${numToPx(theme.space[600])};
34
- border: ${numToPx(theme.border.width.md)} solid;
35
- margin-top: 10px;
36
- border-radius: ${numToPx(theme.border.radius.xs)};
37
- border-color: ${invalid
38
- ? theme.input.color.borderError
39
- : checked
40
- ? theme.input.color.selected
41
- : theme.input.color.border};
42
- background: ${checked ? theme.input.color.selectedTint : 'transparent'};
43
- `;
44
- });
45
- const CheckboxCheck = (props) => {
46
- return _jsx(Icon, Object.assign({ name: "check", size: 16 }, props));
47
- };
48
- const StyledCheckboxInputCheck = styled(CheckboxCheck)(({ theme, checked, }) => {
49
- return `
50
- margin-top: ${numToPx(theme.space[50])};
51
- margin-left: ${numToPx(theme.space[50])};
52
- color: ${theme.color.alert.info};
53
- opacity: ${checked ? 1 : 0};
54
- `;
55
- });
18
+ import { CheckLabelText, StyledCheckboxInput, StyledCheckboxInputCheck, StyledCheckboxInputWrapper, StyledWrapper, } from './styled';
56
19
  const Input = (_a) => {
57
20
  var { checked, invalid, testID } = _a, rest = __rest(_a, ["checked", "invalid", "testID"]);
58
21
  return (_jsx(StyledCheckboxInputWrapper, Object.assign({}, rest, { children: _jsx(StyledCheckboxInput, { invalid: invalid, checked: checked, testID: testID, children: _jsx(StyledCheckboxInputCheck, { checked: checked }) }) })));
59
22
  };
60
- const CheckLabelText = styled(LabelText)(({ theme }) => `
61
- padding-top: ${numToPx(theme.space[300])};
62
- `);
63
- const StyledWrapper = styled.View `
64
- flex-direction: row;
65
- `;
66
23
  const Checkbox = (_a) => {
67
24
  var { label, hint, error, checked, optional, invalid, activeOpacity = 0.8, testID, ref } = _a, rest = __rest(_a, ["label", "hint", "error", "checked", "optional", "invalid", "activeOpacity", "testID", "ref"]);
68
25
  const hasError = !!error;
@@ -0,0 +1,46 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { numToPx } from '@ovotech/element-core';
3
+ import styled from '../../styled.native';
4
+ import { Icon } from '../Icon';
5
+ import { LabelText } from '../LabelText';
6
+ const CheckboxCheck = (props) => {
7
+ return _jsx(Icon, Object.assign({ name: "check", size: 16 }, props));
8
+ };
9
+ export const StyledCheckboxInputWrapper = styled.View(({ theme }) => {
10
+ const checkboxSize = theme.space[600];
11
+ const gap = theme.space[200];
12
+ return `
13
+ width: ${numToPx(checkboxSize + gap)};
14
+ height: ${numToPx(theme.space[1100])};
15
+ `;
16
+ });
17
+ export const StyledCheckboxInput = styled.View(({ theme, invalid, checked }) => {
18
+ return `
19
+ width: ${numToPx(theme.space[600])};
20
+ height: ${numToPx(theme.space[600])};
21
+ border: ${numToPx(theme.border.width.md)} solid;
22
+ margin-top: 10px;
23
+ border-radius: ${numToPx(theme.border.radius.xs)};
24
+ border-color: ${invalid
25
+ ? theme.input.color.borderError
26
+ : checked
27
+ ? theme.input.color.selected
28
+ : theme.input.color.border};
29
+ background: ${checked ? theme.input.color.selectedTint : 'transparent'};
30
+ `;
31
+ });
32
+ export const StyledCheckboxInputCheck = styled(CheckboxCheck)(({ theme, checked }) => {
33
+ return `
34
+ margin-top: ${numToPx(theme.space[50])};
35
+ margin-left: ${numToPx(theme.space[50])};
36
+ color: ${theme.color.alert.info};
37
+ opacity: ${checked ? 1 : 0};
38
+ `;
39
+ });
40
+ export const CheckLabelText = styled(LabelText)(({ theme }) => `
41
+ padding-top: ${numToPx(theme.space[300])};
42
+ font-family: ${theme.native.font.family.book};
43
+ `);
44
+ export const StyledWrapper = styled.View `
45
+ flex-direction: row;
46
+ `;
@@ -0,0 +1 @@
1
+ export {};
@@ -9,15 +9,22 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { createRef } from 'react';
14
+ import { useBreakpoint } from '../../hooks';
14
15
  import { mergeRefs } from '../../utils';
15
- import { NumberInput } from '../NumberInput';
16
+ import { CurrencyInputWrapper, StyledCurrencyInput, StyledCurrencySymbol, StyledCurrencySymbolWrapper, } from './styled';
17
+ const currecySymbolMap = {
18
+ GBP: '£',
19
+ EUR: '€',
20
+ AUD: '$',
21
+ USD: '$',
22
+ };
16
23
  const CurrencyInput = (_a) => {
17
24
  var { currency = 'GBP', invalid, accessibilityLabel = '', ref } = _a, rest = __rest(_a, ["currency", "invalid", "accessibilityLabel", "ref"]);
18
25
  const inputRef = createRef();
19
- const updatedAccessibilityLabel = `${accessibilityLabel} ${currency === 'GBP' ? 'pounds' : currency === 'EUR' ? 'euro' : 'dollar'}`.trim();
20
- const iconName = currency === 'GBP' ? 'pound' : currency === 'EUR' ? 'euro' : 'dollar';
21
- return (_jsx(NumberInput, Object.assign({ accessibilityLabel: updatedAccessibilityLabel, invalid: invalid, iconLeft: iconName, ref: mergeRefs(ref, inputRef) }, rest)));
26
+ const breakpoints = useBreakpoint();
27
+ const updatedAccessibilityLabel = `${accessibilityLabel} ${currency === 'GBP' ? 'pounds' : currency === 'EUR' ? 'euros' : 'dollars'}`.trim();
28
+ return (_jsxs(CurrencyInputWrapper, { children: [_jsx(StyledCurrencyInput, Object.assign({ accessibilityLabel: updatedAccessibilityLabel, invalid: invalid, ref: mergeRefs(ref, inputRef) }, breakpoints, rest)), _jsx(StyledCurrencySymbolWrapper, { testID: `element-currency-input-${currency}`, accessible: false, children: _jsx(StyledCurrencySymbol, Object.assign({}, breakpoints, { children: currecySymbolMap[currency] })) })] }));
22
29
  };
23
30
  export { CurrencyInput };
@@ -0,0 +1,33 @@
1
+ import { View } from 'react-native';
2
+ import styled from '../../styled.native';
3
+ import { numToPx } from '../../theme';
4
+ import { NumberInput } from '../NumberInput';
5
+ import { P } from '../P';
6
+ export const CurrencyInputWrapper = styled(View) `
7
+ position: relative;
8
+ `;
9
+ export const StyledCurrencyInput = styled(NumberInput)(({ theme, smallAndUp }) => `
10
+ padding-left: ${numToPx(theme.space[800])};
11
+ padding-bottom: ${numToPx(theme.space[100])};
12
+ font-family: ${theme.native.font.family.black};
13
+ font-size: ${numToPx(theme.font.size['4xl'].mediaQuery[smallAndUp ? 'lg' : 'sm'])};
14
+ line-height: ${numToPx(theme.font.size['4xl'].mediaQuery[smallAndUp ? 'lg' : 'sm'])};
15
+ letter-spacing: ${numToPx(theme.font.letterSpacing['4xl'].mediaQuery[smallAndUp ? 'lg' : 'sm'])};
16
+ `);
17
+ export const StyledCurrencySymbolWrapper = styled(View)(({ theme }) => {
18
+ return `
19
+ position: absolute;
20
+ width: ${numToPx(theme.space[700])};
21
+ height: ${numToPx(theme.space[700])};
22
+ top: 50%;
23
+ margin-top: -${numToPx(theme.space[350])};
24
+ left: ${numToPx(theme.space[400])};
25
+ `;
26
+ });
27
+ export const StyledCurrencySymbol = styled(P)(({ theme, smallAndUp, }) => {
28
+ return `
29
+ font-family: ${theme.native.font.family.bold};
30
+ font-size: ${numToPx(theme.font.size.xl.mediaQuery[smallAndUp ? 'lg' : 'sm'])};
31
+ line-height: ${numToPx(theme.font.lineHeight.xl.mediaQuery[smallAndUp ? 'lg' : 'sm'])};
32
+ `;
33
+ });
@@ -5,7 +5,9 @@ const StyledDivider = styled.View(({ theme, type = 'default', width = '100%' })
5
5
  height: 1px;
6
6
  background: ${type === 'default'
7
7
  ? theme.color.surface.border
8
- : theme.color.surface.borderDim};
8
+ : type === 'brand'
9
+ ? theme.color.green[70]
10
+ : theme.color.surface.borderDim};
9
11
  width: ${width};
10
12
  `;
11
13
  });
@@ -10,9 +10,25 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useEffect, useMemo, useState } from 'react';
13
14
  import { Input } from '../Input/Input';
15
+ const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
14
16
  const EmailInput = (_a) => {
15
- var { ref } = _a, rest = __rest(_a, ["ref"]);
16
- return (_jsx(Input, Object.assign({ keyboardType: "email-address", autoCapitalize: "none", autoCorrect: false, ref: ref }, rest)));
17
+ var { onChangeText, onSubmitEditing, value, invalid, onValidityChange } = _a, rest = __rest(_a, ["onChangeText", "onSubmitEditing", "value", "invalid", "onValidityChange"]);
18
+ const textValue = typeof value === 'string' ? value : '';
19
+ const isValid = useMemo(() => textValue.length > 0 && EMAIL_REGEX.test(textValue), [textValue]);
20
+ const [hasUserInput, setHasUserInput] = useState(false);
21
+ useEffect(() => {
22
+ onValidityChange === null || onValidityChange === void 0 ? void 0 : onValidityChange(isValid);
23
+ }, [isValid, onValidityChange]);
24
+ return (_jsx(Input, Object.assign({ keyboardType: "email-address", autoCapitalize: "none", autoCorrect: false, value: value, invalid: invalid !== null && invalid !== void 0 ? invalid : (hasUserInput && !isValid), onChangeText: text => {
25
+ if (!hasUserInput)
26
+ setHasUserInput(true);
27
+ onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
28
+ }, onSubmitEditing: e => {
29
+ if (!isValid)
30
+ return;
31
+ onSubmitEditing === null || onSubmitEditing === void 0 ? void 0 : onSubmitEditing(e);
32
+ } }, rest)));
17
33
  };
18
34
  export { EmailInput };
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { usePictograms } from '../../providers';
3
+ import { useTheme } from '../../styled.native';
4
+ import { Heading4 } from '../Heading';
5
+ import { Pictogram } from '../Pictogram';
6
+ import { RemoteImage } from '../RemoteImage';
7
+ import { StyledCard, TextContainer } from './styles';
8
+ export const EmptyState = ({ backgroundStyle = 'filled', children, illustration, heading, pictogramName, }) => {
9
+ const pictograms = usePictograms();
10
+ const theme = useTheme();
11
+ const isFilledBackground = backgroundStyle === 'filled';
12
+ return (_jsxs(StyledCard, { testID: "empty-state-card", background: isFilledBackground ? theme.color.surface.bright : 'transparent', children: [(illustration === null || illustration === void 0 ? void 0 : illustration.uri) ? (_jsx(RemoteImage, Object.assign({ testID: "empty-state-illustration", resizeMode: "contain" }, illustration))) : null, pictogramName && pictograms[pictogramName] ? (_jsx(Pictogram, { testID: "empty-state-pictogram", size: 64, name: pictogramName })) : null, _jsxs(TextContainer, { children: [_jsx(Heading4, { style: { color: theme.color.surface.onSurface }, children: heading }), children] })] }));
13
+ };
@@ -0,0 +1,90 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Text } from 'react-native';
3
+ import { render } from '../../test/utils';
4
+ import { EmptyState } from './EmptyState';
5
+ jest.mock('../../providers', () => (Object.assign(Object.assign({}, jest.requireActual('../../providers')), { usePictograms: () => ({
6
+ 'test-pictogram': 'test-pictogram-data',
7
+ }) })));
8
+ const mockIllustration = {
9
+ uri: 'https://example.com/image.png',
10
+ width: 100,
11
+ height: 100,
12
+ };
13
+ const setup = (props) => {
14
+ return render(_jsx(EmptyState, Object.assign({}, props)));
15
+ };
16
+ describe('EmptyState', () => {
17
+ it('should render the heading and children', () => {
18
+ const { getByText } = setup({
19
+ heading: 'Default Heading',
20
+ children: _jsx(Text, { children: "Default Children" }),
21
+ pictogramName: 'test-pictogram',
22
+ });
23
+ expect(getByText('Default Heading')).toBeDefined();
24
+ expect(getByText('Default Children')).toBeDefined();
25
+ });
26
+ it('should have a filled background by default', () => {
27
+ const { getByTestId } = setup({
28
+ heading: 'Default Heading',
29
+ pictogramName: 'test-pictogram',
30
+ });
31
+ const card = getByTestId('empty-state-card');
32
+ expect(card.props.style.backgroundColor).not.toBe('transparent');
33
+ });
34
+ it("should have a transparent background when backgroundStyle is 'transparent'", () => {
35
+ const { getByTestId } = setup({
36
+ backgroundStyle: 'transparent',
37
+ heading: 'Default Heading',
38
+ pictogramName: 'test-pictogram',
39
+ });
40
+ const card = getByTestId('empty-state-card');
41
+ expect(card.props.style.backgroundColor).toBe('transparent');
42
+ });
43
+ it('should render an illustration if provided', () => {
44
+ const { getByTestId } = setup({
45
+ heading: 'Default Heading',
46
+ illustration: mockIllustration,
47
+ });
48
+ const image = getByTestId('empty-state-illustration');
49
+ expect(image).toBeDefined();
50
+ expect(image.props.source.uri).toBe(mockIllustration.uri);
51
+ });
52
+ it('should not render an illustration if uri is not provided', () => {
53
+ const { queryByTestId } = setup({
54
+ heading: 'Default Heading',
55
+ // @ts-expect-error - we are intentionally providing an illustration without a valid uri to test rendering logic
56
+ illustration: { height: 100, width: 100 },
57
+ });
58
+ expect(queryByTestId('empty-state-illustration')).toBeNull();
59
+ });
60
+ it('should render a pictogram if a valid pictogramName is provided', () => {
61
+ const { getByTestId } = setup({
62
+ heading: 'Default Heading',
63
+ pictogramName: 'test-pictogram',
64
+ });
65
+ expect(getByTestId('empty-state-pictogram')).toBeDefined();
66
+ });
67
+ it('should not render a pictogram if pictogramName is invalid', () => {
68
+ const { queryByTestId } = setup({
69
+ heading: 'Default Heading',
70
+ pictogramName: 'invalid-pictogram',
71
+ });
72
+ expect(queryByTestId('empty-state-pictogram')).toBeNull();
73
+ });
74
+ it('should render custom children', () => {
75
+ const { getByText } = render(_jsx(EmptyState, { heading: "Custom Heading", pictogramName: "test-pictogram", children: _jsx(Text, { children: "My Custom Child" }) }));
76
+ expect(getByText('My Custom Child')).toBeDefined();
77
+ });
78
+ it('should only render illustration when both illustration and pictogramName are provided', () => {
79
+ // According to the EmptyStateProps, only one of them should be present.
80
+ // However, if a user passes both, the component's internal logic will prioritize illustration.
81
+ // @ts-expect-error - we are intentionally passing both props to test runtime behavior
82
+ const { getByTestId, queryByTestId } = setup({
83
+ heading: 'Default Heading',
84
+ illustration: mockIllustration,
85
+ pictogramName: 'test-pictogram',
86
+ });
87
+ expect(getByTestId('empty-state-illustration')).toBeDefined();
88
+ expect(queryByTestId('empty-state-pictogram')).toBeNull();
89
+ });
90
+ });
@@ -0,0 +1 @@
1
+ export * from './EmptyState';
@@ -0,0 +1,17 @@
1
+ import styled from '../../styled.native';
2
+ import { Card } from '../Card';
3
+ export const StyledCard = styled(Card)(({ theme }) => ({
4
+ display: 'flex',
5
+ alignItems: 'center',
6
+ justifyContent: 'center',
7
+ gap: theme.space[100],
8
+ }));
9
+ export const TextContainer = styled.View(({ theme }) => ({
10
+ display: 'flex',
11
+ flexDirection: 'column',
12
+ width: '100%',
13
+ gap: theme.space[50],
14
+ paddingLeft: theme.space[400],
15
+ paddingRight: theme.space[400],
16
+ alignItems: 'center',
17
+ }));
@@ -0,0 +1 @@
1
+ export {};
@@ -20,7 +20,7 @@ import { LabelText } from '../LabelText';
20
20
  import { Stack } from '../Stack';
21
21
  import { Stretch } from '../Stretch';
22
22
  export const Field = (_a) => {
23
- var { children, label, optional = false, hint, error, fullWidth, characters = 25, affixWidth = 0, ref } = _a, rest = __rest(_a, ["children", "label", "optional", "hint", "error", "fullWidth", "characters", "affixWidth", "ref"]);
23
+ var { children, label, optional = false, hint, error, fullWidth, characters = 25, affixWidth = 0, ref, selected } = _a, rest = __rest(_a, ["children", "label", "optional", "hint", "error", "fullWidth", "characters", "affixWidth", "ref", "selected"]);
24
24
  const hasError = !!error;
25
25
  const inputRef = createRef();
26
26
  const labelText = optional ? `${label} (optional)` : label;
@@ -39,6 +39,7 @@ export const Field = (_a) => {
39
39
  }
40
40
  }
41
41
  }, children: _jsxs(View, { children: [_jsxs(LabelText, { children: [label, optional ? ' (optional)' : null] }), hint ? _jsx(HintText, { children: hint }) : null, error ? _jsx(ErrorText, { children: error }) : null] }) }), _jsx(Stretch, { defaultWidth: `${Math.ceil(characters * 0.8 * 16) + affixWidth}px`, fullWidth: fullWidth, children: Children.map(children, child => isValidElement(child)
42
- ? cloneElement(child, Object.assign({ invalid: hasError || undefined, ref: mergeRefs(inputRef, ref), accessibilityLabel }, rest))
42
+ ? cloneElement(child, Object.assign({ invalid: hasError || undefined, ref: mergeRefs(inputRef, ref), accessibilityLabel,
43
+ selected }, rest))
43
44
  : child) })] }) }));
44
45
  };
@@ -10,30 +10,16 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { numToPx } from '@ovotech/element-core';
14
13
  import { useState } from 'react';
15
14
  import { useBreakpoint } from '../../hooks';
16
- import styled, { css } from '../../styled.native';
17
- import { Icon } from '../Icon/Icon';
18
- const StyledIcon = styled(Icon)(({ theme, side, focused }) => {
19
- const focusCompensation = focused ? theme.space[50] : 0;
20
- return css `
21
- position: absolute;
22
- z-index: 1;
23
- top: ${numToPx(theme.space[350] + focusCompensation)};
24
- ${side === 'left'
25
- ? `left: ${numToPx(theme.space[200] + focusCompensation)}`
26
- : ''};
27
- ${side === 'right'
28
- ? `right: ${numToPx(theme.space[200] + focusCompensation)}`
29
- : ''};
30
- `;
31
- });
15
+ import { useTheme } from '../../styled.native';
16
+ import { ICON_SIZE, StyledIcon, StyledInput, StyledInputWrapper, } from './styled';
32
17
  const Input = (_a) => {
33
- var { onFocus, onBlur, style, iconLeft, iconRight, rightSlot, ref } = _a, rest = __rest(_a, ["onFocus", "onBlur", "style", "iconLeft", "iconRight", "rightSlot", "ref"]);
18
+ var { onFocus, onBlur, style, iconLeft, iconRight, invalid, rightSlot, ref, selected } = _a, rest = __rest(_a, ["onFocus", "onBlur", "style", "iconLeft", "iconRight", "invalid", "rightSlot", "ref", "selected"]);
34
19
  const [focused, setFocused] = useState(false);
35
20
  const breakpoints = useBreakpoint();
36
- return (_jsxs(InputWrapper, { focused: focused, children: [iconLeft ? (_jsx(StyledIcon, { name: iconLeft, size: 16, focused: focused, pointerEvents: "none", side: "left" })) : null, _jsx(StyledInput, Object.assign({}, rest, breakpoints, { iconLeft: !!iconLeft, iconRight: !!iconRight, hasRightSlot: !!rightSlot, style: style, ref: ref, onFocus: (event) => {
21
+ const theme = useTheme();
22
+ return (_jsxs(StyledInputWrapper, { focused: focused, hasError: invalid, isSelected: selected, children: [iconLeft ? (_jsx(StyledIcon, { name: iconLeft, size: ICON_SIZE, pointerEvents: "none", side: "left" })) : null, _jsx(StyledInput, Object.assign({}, rest, breakpoints, { hasRightSlot: !!rightSlot, iconLeft: !!iconLeft, iconRight: !!iconRight, invalid: invalid, placeholderTextColor: theme.color.surface.onSurfaceVariant, ref: ref, style: style, onFocus: (event) => {
37
23
  setFocused(true);
38
24
  if (onFocus) {
39
25
  onFocus(event);
@@ -43,50 +29,6 @@ const Input = (_a) => {
43
29
  if (onBlur) {
44
30
  onBlur(event);
45
31
  }
46
- } })), iconRight && !rightSlot ? (_jsx(StyledIcon, { name: iconRight, size: 16, focused: focused, pointerEvents: "none", side: "right" })) : null, rightSlot] }));
32
+ } })), iconRight && !rightSlot ? (_jsx(StyledIcon, { name: iconRight, size: ICON_SIZE, pointerEvents: "none", side: "right" })) : null, rightSlot] }));
47
33
  };
48
- const InputWrapper = styled.View(({ theme, focused }) => css `
49
- align-self: stretch;
50
- border-radius: ${numToPx(theme.border.radius.md)};
51
- border-width: 0;
52
- border-style: solid;
53
- border-color: ${theme.input.color.border};
54
- flex-direction: row;
55
-
56
- ${focused
57
- ? `
58
- border-width: ${numToPx(theme.border.width.md)};
59
- border-color: ${theme.color.outline.outer};
60
- padding: 2px;
61
- margin: -4px;`
62
- : null}
63
- `);
64
- const StyledInput = styled.TextInput(({ theme, invalid, smallAndUp, iconLeft, iconRight, hasRightSlot }) => {
65
- const fontSize = smallAndUp
66
- ? theme.font.size.md.mediaQuery.lg
67
- : theme.font.size.md.mediaQuery.sm;
68
- const errorStyles = invalid
69
- ? `
70
- border-color: ${theme.color.alert.error};
71
- `
72
- : '';
73
- return css `
74
- font-family: ${theme.native.font.family.book};
75
- color: ${theme.color.surface.onSurface};
76
- font-size: ${numToPx(fontSize)};
77
- height: ${numToPx(theme.space[1100])};
78
- line-height: 18px; /* Corrects for responsive line height in fixed height input */
79
- border: ${numToPx(theme.border.width.md)} solid ${theme.input.color.border};
80
- border-radius: ${numToPx(theme.border.radius.sm)};
81
- padding: ${numToPx(theme.space[200])};
82
- flex: 1;
83
-
84
- ${iconLeft ? `padding-left: ${numToPx(theme.space[800])};` : ''}
85
- ${iconRight || hasRightSlot
86
- ? `padding-right: ${numToPx(theme.space[800])};`
87
- : ''}
88
-
89
- ${errorStyles}
90
- `;
91
- });
92
34
  export { Input };