@ovotech/element-native 2.2.0-canary-668a0ee-91 → 2.2.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 (302) hide show
  1. package/dist/components/Accordion/Accordion.d.ts +2 -2
  2. package/dist/components/Accordion/Accordion.js +24 -21
  3. package/dist/components/Accordion/Group.js +32 -10
  4. package/dist/components/Accordion/Icon.js +14 -19
  5. package/dist/components/Accordion/hooks.d.ts +1 -1
  6. package/dist/components/Accordion/hooks.js +26 -3
  7. package/dist/components/Accordion/styles.d.ts +46 -688
  8. package/dist/components/Accordion/styles.js +49 -56
  9. package/dist/components/Badge/Badge.d.ts +46 -54
  10. package/dist/components/Badge/Badge.js +20 -35
  11. package/dist/components/CTAButton/CTAButton.d.ts +12 -7
  12. package/dist/components/CTAButton/CTAButton.js +27 -23
  13. package/dist/components/CTALink/CTALink.d.ts +4 -4
  14. package/dist/components/CTALink/CTALink.js +27 -5
  15. package/dist/components/Card/Card.d.ts +45 -47
  16. package/dist/components/Card/Card.js +25 -5
  17. package/dist/components/Checkbox/Checkbox.d.ts +3 -3
  18. package/dist/components/Checkbox/Checkbox.js +57 -18
  19. package/dist/components/Checkbox/CheckboxField.js +37 -7
  20. package/dist/components/DataTable/DataTable.d.ts +12 -3
  21. package/dist/components/DataTable/DataTable.js +98 -11
  22. package/dist/components/DataTable/index.d.ts +0 -2
  23. package/dist/components/DataTable/index.js +0 -16
  24. package/dist/components/DateField/DateField.d.ts +2 -2
  25. package/dist/components/DateField/DateField.js +28 -9
  26. package/dist/components/DescriptionList/DescriptionList.js +32 -8
  27. package/dist/components/DescriptionList/styled.d.ts +44 -50
  28. package/dist/components/DescriptionList/styled.js +34 -9
  29. package/dist/components/Disclosure/Disclosure.d.ts +3 -3
  30. package/dist/components/Disclosure/Disclosure.js +18 -12
  31. package/dist/components/Divider/Divider.js +7 -4
  32. package/dist/components/ErrorSummaryNotification/ErrorSummaryNotification.d.ts +1 -1
  33. package/dist/components/ErrorSummaryNotification/ErrorSummaryNotification.js +28 -6
  34. package/dist/components/ErrorText/ErrorText.d.ts +39 -45
  35. package/dist/components/ErrorText/ErrorText.js +4 -7
  36. package/dist/components/Field/Field.d.ts +2 -2
  37. package/dist/components/Field/Field.js +49 -18
  38. package/dist/components/FormGroup/FormGroup.js +3 -2
  39. package/dist/components/Grid/Col.d.ts +39 -45
  40. package/dist/components/Grid/Col.js +3 -4
  41. package/dist/components/Grid/Row.d.ts +41 -47
  42. package/dist/components/Grid/Row.js +10 -7
  43. package/dist/components/Heading/Heading.js +32 -21
  44. package/dist/components/HintText/HintText.d.ts +39 -45
  45. package/dist/components/HintText/HintText.js +4 -7
  46. package/dist/components/Icon/Icon.d.ts +4 -3
  47. package/dist/components/Icon/Icon.js +27 -5
  48. package/dist/components/Input/CurrencyInput.d.ts +6 -6
  49. package/dist/components/Input/CurrencyInput.js +25 -3
  50. package/dist/components/Input/EmailInput.d.ts +6 -6
  51. package/dist/components/Input/EmailInput.js +25 -3
  52. package/dist/components/Input/Input.d.ts +8 -8
  53. package/dist/components/Input/Input.js +32 -26
  54. package/dist/components/Input/NumberInput.d.ts +6 -6
  55. package/dist/components/Input/NumberInput.js +25 -3
  56. package/dist/components/Input/PasswordInput.d.ts +6 -6
  57. package/dist/components/Input/PasswordInput.js +25 -3
  58. package/dist/components/Input/PasswordInput.styled.d.ts +39 -45
  59. package/dist/components/Input/PasswordInput.styled.js +5 -2
  60. package/dist/components/Input/PasswordVisibilityToggle.js +29 -14
  61. package/dist/components/Input/TelInput.d.ts +10 -0
  62. package/dist/components/Input/TelInput.js +41 -0
  63. package/dist/components/Input/TextInput.d.ts +6 -6
  64. package/dist/components/Input/TextInput.js +25 -3
  65. package/dist/components/Input/TextareaInput.d.ts +6 -6
  66. package/dist/components/Input/TextareaInput.js +10 -13
  67. package/dist/components/Input/index.d.ts +1 -1
  68. package/dist/components/Input/index.js +3 -3
  69. package/dist/components/LabelText/LabelText.d.ts +39 -45
  70. package/dist/components/LabelText/LabelText.js +4 -5
  71. package/dist/components/List/List.d.ts +131 -149
  72. package/dist/components/List/List.js +44 -30
  73. package/dist/components/Margin/Margin.d.ts +39 -45
  74. package/dist/components/Margin/Margin.js +3 -3
  75. package/dist/components/NavHeader/NavHeader.d.ts +1 -1
  76. package/dist/components/NavHeader/NavHeader.js +35 -34
  77. package/dist/components/Notification/Notification.d.ts +100 -104
  78. package/dist/components/Notification/Notification.js +49 -32
  79. package/dist/components/Radio/Radio.d.ts +3 -3
  80. package/dist/components/Radio/Radio.js +61 -16
  81. package/dist/components/Radio/RadioField.js +41 -11
  82. package/dist/components/SkeletonLoading/Skeleton.d.ts +39 -45
  83. package/dist/components/SkeletonLoading/SkeletonAnimation.js +33 -22
  84. package/dist/components/SkeletonLoading/SkeletonCTA.js +5 -4
  85. package/dist/components/SkeletonLoading/SkeletonCircle.js +6 -4
  86. package/dist/components/SkeletonLoading/SkeletonHeading.js +5 -4
  87. package/dist/components/SkeletonLoading/SkeletonText.js +5 -5
  88. package/dist/components/Stack/Stack.js +28 -6
  89. package/dist/components/Stretch/Stretch.js +2 -2
  90. package/dist/components/SubLabelText/SubLabelText.d.ts +39 -45
  91. package/dist/components/SubLabelText/SubLabelText.js +4 -5
  92. package/dist/components/SummaryList/SummaryList.js +32 -8
  93. package/dist/components/Tabs/Tab.d.ts +4 -4
  94. package/dist/components/Tabs/Tab.js +20 -23
  95. package/dist/components/Tabs/TabList.d.ts +222 -11
  96. package/dist/components/Tabs/TabList.js +18 -22
  97. package/dist/components/Tabs/TabPanel.js +10 -33
  98. package/dist/components/Tabs/Tabs.d.ts +227 -8
  99. package/dist/components/Tabs/Tabs.js +23 -26
  100. package/dist/components/Text/Text.d.ts +204 -234
  101. package/dist/components/Text/Text.js +20 -17
  102. package/dist/components/TextField/CurrencyField.d.ts +6 -6
  103. package/dist/components/TextField/CurrencyField.js +26 -3
  104. package/dist/components/TextField/EmailField.d.ts +6 -6
  105. package/dist/components/TextField/EmailField.js +26 -3
  106. package/dist/components/TextField/NumberField.d.ts +6 -6
  107. package/dist/components/TextField/NumberField.js +26 -3
  108. package/dist/components/TextField/PasswordField.d.ts +6 -6
  109. package/dist/components/TextField/PasswordField.js +26 -3
  110. package/dist/components/TextField/TelField.d.ts +6 -10
  111. package/dist/components/TextField/TelField.js +27 -9
  112. package/dist/components/TextField/TextField.d.ts +6 -6
  113. package/dist/components/TextField/TextField.js +26 -3
  114. package/dist/components/TextField/TextareaField.d.ts +6 -6
  115. package/dist/components/TextField/TextareaField.js +26 -3
  116. package/dist/components/TextField/index.d.ts +0 -1
  117. package/dist/components/TextField/index.js +1 -3
  118. package/dist/components/TextLink/TextLink.d.ts +4 -4
  119. package/dist/components/TextLink/TextLink.js +8 -5
  120. package/dist/components/index.d.ts +0 -1
  121. package/dist/components/index.js +0 -1
  122. package/dist/esm/components/Accordion/Accordion.js +26 -23
  123. package/dist/esm/components/Accordion/Group.js +9 -10
  124. package/dist/esm/components/Accordion/Icon.js +12 -20
  125. package/dist/esm/components/Accordion/hooks.js +3 -3
  126. package/dist/esm/components/Accordion/styles.js +48 -29
  127. package/dist/esm/components/Badge/Badge.js +17 -35
  128. package/dist/esm/components/CTAButton/CTAButton.js +28 -24
  129. package/dist/esm/components/CTALink/CTALink.js +4 -5
  130. package/dist/esm/components/Card/Card.js +25 -5
  131. package/dist/esm/components/Checkbox/Checkbox.js +34 -15
  132. package/dist/esm/components/Checkbox/CheckboxField.js +14 -7
  133. package/dist/esm/components/DataTable/DataTable.js +74 -10
  134. package/dist/esm/components/DataTable/index.js +0 -2
  135. package/dist/esm/components/DateField/DateField.js +28 -9
  136. package/dist/esm/components/DescriptionList/DescriptionList.js +9 -8
  137. package/dist/esm/components/DescriptionList/styled.js +31 -9
  138. package/dist/esm/components/Disclosure/Disclosure.js +19 -13
  139. package/dist/esm/components/Divider/Divider.js +4 -4
  140. package/dist/esm/components/ErrorSummaryNotification/ErrorSummaryNotification.js +5 -6
  141. package/dist/esm/components/ErrorText/ErrorText.js +4 -7
  142. package/dist/esm/components/Field/Field.js +26 -18
  143. package/dist/esm/components/FormGroup/FormGroup.js +3 -2
  144. package/dist/esm/components/Grid/Col.js +3 -4
  145. package/dist/esm/components/Grid/Row.js +7 -7
  146. package/dist/esm/components/Heading/Heading.js +29 -21
  147. package/dist/esm/components/HintText/HintText.js +4 -7
  148. package/dist/esm/components/Icon/Icon.js +4 -5
  149. package/dist/esm/components/Input/CurrencyInput.js +2 -3
  150. package/dist/esm/components/Input/EmailInput.js +2 -3
  151. package/dist/esm/components/Input/Input.js +33 -27
  152. package/dist/esm/components/Input/NumberInput.js +2 -3
  153. package/dist/esm/components/Input/PasswordInput.js +2 -3
  154. package/dist/esm/components/Input/PasswordInput.styled.js +5 -2
  155. package/dist/esm/components/Input/PasswordVisibilityToggle.js +7 -15
  156. package/dist/esm/components/Input/{PhoneInput.js → TelInput.js} +3 -4
  157. package/dist/esm/components/Input/TextInput.js +2 -3
  158. package/dist/esm/components/Input/TextareaInput.js +10 -13
  159. package/dist/esm/components/Input/index.js +1 -1
  160. package/dist/esm/components/LabelText/LabelText.js +4 -5
  161. package/dist/esm/components/List/List.js +45 -31
  162. package/dist/esm/components/Margin/Margin.js +3 -3
  163. package/dist/esm/components/NavHeader/NavHeader.js +32 -34
  164. package/dist/esm/components/Notification/Notification.js +50 -33
  165. package/dist/esm/components/Radio/Radio.js +38 -16
  166. package/dist/esm/components/Radio/RadioField.js +18 -11
  167. package/dist/esm/components/SkeletonLoading/SkeletonAnimation.js +11 -23
  168. package/dist/esm/components/SkeletonLoading/SkeletonCTA.js +5 -4
  169. package/dist/esm/components/SkeletonLoading/SkeletonCircle.js +6 -4
  170. package/dist/esm/components/SkeletonLoading/SkeletonHeading.js +5 -4
  171. package/dist/esm/components/SkeletonLoading/SkeletonText.js +5 -5
  172. package/dist/esm/components/Stack/Stack.js +5 -6
  173. package/dist/esm/components/Stretch/Stretch.js +2 -2
  174. package/dist/esm/components/SubLabelText/SubLabelText.js +4 -5
  175. package/dist/esm/components/SummaryList/SummaryList.js +9 -8
  176. package/dist/esm/components/Tabs/Tab.js +17 -23
  177. package/dist/esm/components/Tabs/TabList.js +18 -21
  178. package/dist/esm/components/Tabs/TabPanel.js +7 -10
  179. package/dist/esm/components/Tabs/Tabs.js +23 -25
  180. package/dist/esm/components/Text/Text.js +20 -17
  181. package/dist/esm/components/TextField/CurrencyField.js +3 -3
  182. package/dist/esm/components/TextField/EmailField.js +3 -3
  183. package/dist/esm/components/TextField/NumberField.js +3 -3
  184. package/dist/esm/components/TextField/PasswordField.js +3 -3
  185. package/dist/esm/components/TextField/TelField.js +4 -9
  186. package/dist/esm/components/TextField/TextField.js +3 -3
  187. package/dist/esm/components/TextField/TextareaField.js +3 -3
  188. package/dist/esm/components/TextField/index.js +0 -1
  189. package/dist/esm/components/TextLink/TextLink.js +8 -5
  190. package/dist/esm/components/index.js +0 -1
  191. package/dist/esm/hooks/use-breakpoint.js +4 -4
  192. package/dist/esm/providers/IconsProvider.js +2 -3
  193. package/dist/esm/providers/icons/ArrowDown.js +3 -2
  194. package/dist/esm/providers/icons/ArrowLeft.js +3 -2
  195. package/dist/esm/providers/icons/ArrowRight.js +3 -2
  196. package/dist/esm/providers/icons/ArrowUp.js +3 -2
  197. package/dist/esm/providers/icons/CaretDown.js +3 -2
  198. package/dist/esm/providers/icons/CaretLeft.js +3 -2
  199. package/dist/esm/providers/icons/CaretRight.js +3 -2
  200. package/dist/esm/providers/icons/CaretUp.js +3 -2
  201. package/dist/esm/providers/icons/Chart.js +3 -2
  202. package/dist/esm/providers/icons/Check.js +3 -2
  203. package/dist/esm/providers/icons/ChevronDown.js +3 -2
  204. package/dist/esm/providers/icons/ChevronLeft.js +3 -2
  205. package/dist/esm/providers/icons/ChevronLeftSmall.js +3 -2
  206. package/dist/esm/providers/icons/ChevronLeftSmallFirst.js +3 -2
  207. package/dist/esm/providers/icons/ChevronRight.js +3 -2
  208. package/dist/esm/providers/icons/ChevronRightSmall.js +3 -2
  209. package/dist/esm/providers/icons/ChevronRightSmallLast.js +3 -2
  210. package/dist/esm/providers/icons/ChevronUp.js +3 -2
  211. package/dist/esm/providers/icons/Cross.js +3 -2
  212. package/dist/esm/providers/icons/Dollar.js +3 -2
  213. package/dist/esm/providers/icons/Download.js +3 -2
  214. package/dist/esm/providers/icons/Electricity.js +3 -2
  215. package/dist/esm/providers/icons/Euro.js +3 -2
  216. package/dist/esm/providers/icons/Gas.js +4 -2
  217. package/dist/esm/providers/icons/Help.js +3 -2
  218. package/dist/esm/providers/icons/Hide.js +3 -2
  219. package/dist/esm/providers/icons/Home.js +3 -2
  220. package/dist/esm/providers/icons/Info.js +3 -2
  221. package/dist/esm/providers/icons/Link.js +4 -2
  222. package/dist/esm/providers/icons/Logo.js +4 -3
  223. package/dist/esm/providers/icons/Minus.js +3 -2
  224. package/dist/esm/providers/icons/NewWindow.js +3 -2
  225. package/dist/esm/providers/icons/PaymentCard.js +3 -2
  226. package/dist/esm/providers/icons/Plus.js +3 -2
  227. package/dist/esm/providers/icons/Pound.js +3 -2
  228. package/dist/esm/providers/icons/Search.js +3 -2
  229. package/dist/esm/providers/icons/Show.js +3 -2
  230. package/dist/esm/providers/icons/User.js +3 -2
  231. package/dist/esm/theme/create-theme.js +153 -0
  232. package/dist/esm/utils/utils.js +3 -7
  233. package/dist/hooks/use-breakpoint.js +4 -4
  234. package/dist/providers/IconsProvider.js +25 -3
  235. package/dist/providers/icons/ArrowDown.js +6 -2
  236. package/dist/providers/icons/ArrowLeft.js +6 -2
  237. package/dist/providers/icons/ArrowRight.js +6 -2
  238. package/dist/providers/icons/ArrowUp.js +6 -2
  239. package/dist/providers/icons/CaretDown.js +6 -2
  240. package/dist/providers/icons/CaretLeft.js +6 -2
  241. package/dist/providers/icons/CaretRight.js +6 -2
  242. package/dist/providers/icons/CaretUp.js +6 -2
  243. package/dist/providers/icons/Chart.js +6 -2
  244. package/dist/providers/icons/Check.js +6 -2
  245. package/dist/providers/icons/ChevronDown.js +6 -2
  246. package/dist/providers/icons/ChevronLeft.js +6 -2
  247. package/dist/providers/icons/ChevronLeftSmall.js +6 -2
  248. package/dist/providers/icons/ChevronLeftSmallFirst.js +6 -2
  249. package/dist/providers/icons/ChevronRight.js +6 -2
  250. package/dist/providers/icons/ChevronRightSmall.js +6 -2
  251. package/dist/providers/icons/ChevronRightSmallLast.js +6 -2
  252. package/dist/providers/icons/ChevronUp.js +6 -2
  253. package/dist/providers/icons/Cross.js +6 -2
  254. package/dist/providers/icons/Dollar.js +6 -2
  255. package/dist/providers/icons/Download.js +6 -2
  256. package/dist/providers/icons/Electricity.js +6 -2
  257. package/dist/providers/icons/Euro.js +6 -2
  258. package/dist/providers/icons/Gas.js +7 -2
  259. package/dist/providers/icons/Help.js +6 -2
  260. package/dist/providers/icons/Hide.js +6 -2
  261. package/dist/providers/icons/Home.js +6 -2
  262. package/dist/providers/icons/Info.js +6 -2
  263. package/dist/providers/icons/Link.js +7 -2
  264. package/dist/providers/icons/Logo.js +6 -2
  265. package/dist/providers/icons/Minus.js +6 -2
  266. package/dist/providers/icons/NewWindow.js +6 -2
  267. package/dist/providers/icons/PaymentCard.js +6 -2
  268. package/dist/providers/icons/Plus.js +6 -2
  269. package/dist/providers/icons/Pound.js +6 -2
  270. package/dist/providers/icons/Search.js +6 -2
  271. package/dist/providers/icons/Show.js +6 -2
  272. package/dist/providers/icons/User.js +6 -2
  273. package/dist/styled.native.d.ts +234 -270
  274. package/dist/theme/create-theme.js +153 -0
  275. package/dist/theme/index.d.ts +39 -45
  276. package/dist/theme/theme.d.ts +90 -0
  277. package/dist/utils/utils.d.ts +4 -5
  278. package/dist/utils/utils.js +26 -8
  279. package/package.json +5 -6
  280. package/dist/components/DataTable/TableRow.d.ts +0 -2
  281. package/dist/components/DataTable/TableRow.js +0 -31
  282. package/dist/components/DataTable/styles.d.ts +0 -2517
  283. package/dist/components/DataTable/styles.js +0 -77
  284. package/dist/components/DataTable/types.d.ts +0 -15
  285. package/dist/components/DataTable/types.js +0 -2
  286. package/dist/components/Input/PhoneInput.d.ts +0 -10
  287. package/dist/components/Input/PhoneInput.js +0 -19
  288. package/dist/components/SelectField/Select.d.ts +0 -244
  289. package/dist/components/SelectField/Select.js +0 -102
  290. package/dist/components/SelectField/SelectField.d.ts +0 -7
  291. package/dist/components/SelectField/SelectField.js +0 -33
  292. package/dist/components/SelectField/index.d.ts +0 -1
  293. package/dist/components/SelectField/index.js +0 -5
  294. package/dist/components/TextField/PhoneField.d.ts +0 -10
  295. package/dist/components/TextField/PhoneField.js +0 -33
  296. package/dist/esm/components/DataTable/TableRow.js +0 -27
  297. package/dist/esm/components/DataTable/styles.js +0 -51
  298. package/dist/esm/components/DataTable/types.js +0 -1
  299. package/dist/esm/components/SelectField/Select.js +0 -75
  300. package/dist/esm/components/SelectField/SelectField.js +0 -29
  301. package/dist/esm/components/SelectField/index.js +0 -1
  302. package/dist/esm/components/TextField/PhoneField.js +0 -30
@@ -24,15 +24,15 @@ var __assign = (this && this.__assign) || function () {
24
24
  };
25
25
  return __assign.apply(this, arguments);
26
26
  };
27
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
- import { Component, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
29
- import Animated, { interpolateColor, runOnUI, useAnimatedStyle, useDerivedValue, useSharedValue, withTiming, } from 'react-native-reanimated';
30
- import { ThemeContext } from '../../styled.native';
31
- import { pxToNumber } from '../../utils';
27
+ import React, { useCallback, useMemo, useEffect, useState, } from 'react';
28
+ import { View, TouchableOpacity } from 'react-native';
29
+ import Animated, { useSharedValue, useAnimatedStyle, useDerivedValue, withTiming, runOnUI, interpolateColor, } from 'react-native-reanimated';
30
+ import { theme } from '../../theme';
32
31
  import { Heading3 } from '../Heading';
33
32
  import { AccordionIcon } from './Icon';
34
33
  import { useLayout } from './hooks';
35
- import { StyledAccordion, StyledAccordionHeader, StyledContainer, } from './styles';
34
+ import { styles } from './styles';
35
+ var _a = theme.colors, canvas = _a.canvas, canvasMuted = _a.canvasMuted, primary = _a.primary, greyDarker = _a.brand.grey.darker;
36
36
  export function withAnimated(WrappedComponent) {
37
37
  var displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
38
38
  // eslint-disable-next-line react/prefer-stateless-function
@@ -42,21 +42,20 @@ export function withAnimated(WrappedComponent) {
42
42
  return _super !== null && _super.apply(this, arguments) || this;
43
43
  }
44
44
  WithAnimated.prototype.render = function () {
45
- return _jsx(WrappedComponent, __assign({}, this.props));
45
+ return React.createElement(WrappedComponent, __assign({}, this.props));
46
46
  };
47
47
  WithAnimated.displayName = "WithAnimated(".concat(displayName, ")");
48
48
  return WithAnimated;
49
- }(Component));
49
+ }(React.Component));
50
50
  return Animated.createAnimatedComponent(WithAnimated);
51
51
  }
52
52
  export var Accordion = function (_a) {
53
53
  var _b = _a.expanded, expanded = _b === void 0 ? false : _b, first = _a.first, _c = _a.headingComponent, headingComponent = _c === void 0 ? Heading3 : _c, last = _a.last, title = _a.title, children = _a.children, onToggle = _a.onToggle;
54
- var _d = useContext(ThemeContext), core = _d.core, semantic = _d.semantic;
55
54
  var AnimatedHeading = useMemo(function () { return withAnimated(headingComponent); }, [
56
55
  headingComponent,
57
56
  ]);
58
- var _e = useLayout(0), layout = _e[0], onLayout = _e[1];
59
- var _f = useState(expanded), open = _f[0], setOpen = _f[1];
57
+ var _d = useLayout(0), layout = _d[0], onLayout = _d[1];
58
+ var _e = useState(expanded), open = _e[0], setOpen = _e[1];
60
59
  var handleHeightContent = useMemo(function () { return layout.height || 100; }, [
61
60
  layout.height,
62
61
  ]);
@@ -91,18 +90,22 @@ export var Accordion = function (_a) {
91
90
  }
92
91
  setOpen(function (o) { return !o; });
93
92
  }, [handleHeightContent, open, size]);
94
- var containerAnimatedStyle = useMemo(function () { return [{ overflow: 'hidden' }, style]; }, [style]);
93
+ var containerAnimatedStyle = useMemo(function () { return [styles.content, style]; }, [style]);
95
94
  var headerStyle = useAnimatedStyle(function () { return ({
96
- color: interpolateColor(progress.value, [0, 1], [semantic.message.branded, semantic.message.base]),
95
+ color: interpolateColor(progress.value, [0, 1], [greyDarker, primary]),
97
96
  }); });
98
- return (_jsxs(StyledAccordion, __assign({ first: first, last: last }, { children: [_jsxs(StyledAccordionHeader, __assign({ accessibilityState: { expanded: open }, onPress: toggleOpen, testID: "accordionTitle" }, { children: [_jsx(AnimatedHeading, __assign({ style: [
99
- headerStyle,
100
- {
101
- paddingTop: pxToNumber(core.space[1]),
102
- paddingRight: pxToNumber(core.space[3]),
103
- marginTop: 0,
104
- marginBottom: 0,
105
- flexShrink: 1,
106
- },
107
- ] }, { children: title })), _jsx(AccordionIcon, { animationTiming: progress })] })), _jsx(Animated.View, __assign({ style: containerAnimatedStyle }, { children: _jsx(StyledContainer, __assign({ onLayout: onLayout }, { children: children })) }))] })));
97
+ var backgroundStyle = useAnimatedStyle(function () { return ({
98
+ backgroundColor: interpolateColor(progress.value, [0, 1], [canvas, canvasMuted]),
99
+ }); });
100
+ return (React.createElement(Animated.View, { style: [
101
+ backgroundStyle,
102
+ styles.accordion,
103
+ first ? styles.topItem : null,
104
+ last ? styles.bottomItem : null,
105
+ ] },
106
+ React.createElement(TouchableOpacity, { accessibilityState: { expanded: open }, onPress: toggleOpen, style: styles.accordionHeader, testID: "accordionTitle" },
107
+ React.createElement(AnimatedHeading, { style: [headerStyle, styles.accordionHeaderText] }, title),
108
+ React.createElement(AccordionIcon, { animationTiming: progress })),
109
+ React.createElement(Animated.View, { style: containerAnimatedStyle },
110
+ React.createElement(View, { onLayout: onLayout, style: styles.container }, children))));
108
111
  };
@@ -1,15 +1,14 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Children, cloneElement, isValidElement, } from 'react';
1
+ import React, { Children, cloneElement, isValidElement, } from 'react';
3
2
  import { View } from 'react-native';
4
3
  export var AccordionGroup = function (_a) {
5
4
  var children = _a.children;
6
5
  var childCount = Children.count(children);
7
- return (_jsx(View, { children: Children.map(children, function (child, i) {
8
- return isValidElement(child)
9
- ? cloneElement(child, {
10
- first: i === 0,
11
- last: i === childCount - 1,
12
- })
13
- : child;
14
- }) }));
6
+ return (React.createElement(View, null, Children.map(children, function (child, i) {
7
+ return isValidElement(child)
8
+ ? cloneElement(child, {
9
+ first: i === 0,
10
+ last: i === childCount - 1,
11
+ })
12
+ : child;
13
+ })));
15
14
  };
@@ -1,26 +1,14 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useContext } from 'react';
14
- import Animated, { interpolateColor, useAnimatedProps, useAnimatedStyle, } from 'react-native-reanimated';
1
+ import React from 'react';
2
+ import Animated, { useAnimatedStyle, interpolateColor, useAnimatedProps, } from 'react-native-reanimated';
15
3
  import { Path, Svg } from 'react-native-svg';
16
- import { ThemeContext } from '../../styled.native';
4
+ import { theme } from '../../theme';
5
+ var _a = theme.colors, canvas = _a.canvas, primary = _a.primary, primaryMuted = _a.primaryMuted;
17
6
  var OVO_LOGO_ANGLE = 105;
18
7
  var AnimatedPath = Animated.createAnimatedComponent(Path);
19
8
  export function AccordionIcon(_a) {
20
9
  var animationTiming = _a.animationTiming;
21
- var _b = useContext(ThemeContext), core = _b.core, semantic = _b.semantic;
22
10
  var outerAnimatedStyles = useAnimatedStyle(function () { return ({
23
- backgroundColor: interpolateColor(animationTiming.value, [0, 1], [semantic.surface.cutout, semantic.message.branded]),
11
+ backgroundColor: interpolateColor(animationTiming.value, [0, 1], [primaryMuted, primary]),
24
12
  height: 36 - animationTiming.value * 4,
25
13
  margin: 2 * animationTiming.value,
26
14
  transform: [{ rotateZ: animationTiming.value * -OVO_LOGO_ANGLE + 'deg' }],
@@ -34,13 +22,17 @@ export function AccordionIcon(_a) {
34
22
  var minusAnimatedProps = useAnimatedProps(function () { return ({
35
23
  opacity: animationTiming.value,
36
24
  }); });
37
- return (_jsx(Animated.View, __assign({ style: [
25
+ return (React.createElement(Animated.View, { style: [
38
26
  {
39
- backgroundColor: semantic.surface.cutout,
27
+ backgroundColor: primaryMuted,
40
28
  aspectRatio: 1,
41
29
  alignItems: 'center',
42
30
  justifyContent: 'center',
43
31
  },
44
32
  outerAnimatedStyles,
45
- ] }, { children: _jsx(Animated.View, __assign({ style: innerAnimatedStyles }, { children: _jsxs(Svg, __assign({ width: "16", height: "16", viewBox: "0 0 16 16" }, { children: [_jsx(AnimatedPath, { animatedProps: plusAnimatedProps, d: "M9 9H16V6.99H9V0H6.99V7H0V9.01H7V16.01H9.01V9.01L9 9Z", fill: semantic.message.secondary }), _jsx(AnimatedPath, { animatedProps: minusAnimatedProps, d: "M16.3826 9.66663V7.66663H0.462646V9.66663H16.3826Z", fill: core.color.brand.white })] })) })) })));
33
+ ] },
34
+ React.createElement(Animated.View, { style: innerAnimatedStyles },
35
+ React.createElement(Svg, { width: "16", height: "16", viewBox: "0 0 16 16" },
36
+ React.createElement(AnimatedPath, { animatedProps: plusAnimatedProps, d: "M9 9H16V6.99H9V0H6.99V7H0V9.01H7V16.01H9.01V9.01L9 9Z", fill: primary }),
37
+ React.createElement(AnimatedPath, { animatedProps: minusAnimatedProps, d: "M16.3826 9.66663V7.66663H0.462646V9.66663H16.3826Z", fill: canvas })))));
46
38
  }
@@ -1,7 +1,7 @@
1
- import { useCallback, useState } from 'react';
1
+ import React, { useState } from 'react';
2
2
  export var useLayout = function (defaultHeight) {
3
3
  var _a = useState({ height: defaultHeight || 0, width: 0, measured: false }), layout = _a[0], setLayout = _a[1];
4
- var onLayout = useCallback(function (e) {
4
+ var onLayout = React.useCallback(function (e) {
5
5
  var _a = e.nativeEvent.layout, height = _a.height, width = _a.width;
6
6
  if (height === layout.height && width === layout.width) {
7
7
  return;
@@ -9,7 +9,7 @@ export var useLayout = function (defaultHeight) {
9
9
  setLayout({
10
10
  height: height,
11
11
  width: width,
12
- measured: true,
12
+ measured: true
13
13
  });
14
14
  }, [layout.height, layout.width]);
15
15
  return [layout, onLayout];
@@ -1,30 +1,49 @@
1
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
- return cooked;
4
- };
5
- import Animated from 'react-native-reanimated';
6
- import styled, { css } from '../../styled.native';
7
- export var StyledAccordion = styled(Animated.View)(function (_a) {
8
- var _b = _a.theme, semantic = _b.semantic, core = _b.core, first = _a.first, last = _a.last;
9
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n border-width: ", ";\n border-color: ", ";\n border-bottom-width: 0;\n\n ", "\n\n ", "\n "], ["\n width: 100%;\n border-width: ", ";\n border-color: ", ";\n border-bottom-width: 0;\n\n ", "\n\n ", "\n "])), core.borderWidth.small, semantic.border.differentiated, first
10
- ? {
11
- borderTopLeftRadius: core.radius.small,
12
- borderTopRightRadius: core.radius.small,
13
- }
14
- : null, last
15
- ? {
16
- borderBottomLeftRadius: core.radius.small,
17
- borderBottomRightRadius: core.radius.small,
18
- borderBottomWidth: core.borderWidth.small,
19
- }
20
- : null);
1
+ import { StyleSheet } from 'react-native';
2
+ import { theme } from '../../theme';
3
+ var greyBase = theme.colors.brand.grey.base;
4
+ var styles = StyleSheet.create({
5
+ accordion: {
6
+ width: '100%',
7
+ borderWidth: parseInt(theme.borderWidths.standard),
8
+ borderBottomWidth: 0,
9
+ borderColor: greyBase,
10
+ },
11
+ topItem: {
12
+ borderTopLeftRadius: parseInt(theme.radii.small),
13
+ borderTopRightRadius: parseInt(theme.radii.small),
14
+ },
15
+ bottomItem: {
16
+ borderBottomLeftRadius: parseInt(theme.radii.small),
17
+ borderBottomRightRadius: parseInt(theme.radii.small),
18
+ borderBottomWidth: parseInt(theme.borderWidths.standard),
19
+ },
20
+ accordionHeader: {
21
+ paddingTop: parseInt(theme.space[5]),
22
+ paddingRight: 18,
23
+ paddingBottom: 18,
24
+ paddingLeft: parseInt(theme.space[3]),
25
+ flexDirection: 'row',
26
+ alignItems: 'flex-start',
27
+ justifyContent: 'space-between',
28
+ },
29
+ accordionHeaderText: {
30
+ paddingRight: parseInt(theme.space[3]),
31
+ marginTop: 0,
32
+ marginBottom: 0,
33
+ flexShrink: 1,
34
+ },
35
+ content: {
36
+ overflow: 'hidden',
37
+ },
38
+ container: {
39
+ position: 'absolute',
40
+ top: 0,
41
+ left: 0,
42
+ right: 0,
43
+ paddingTop: 0,
44
+ paddingRight: parseInt(theme.space[12]),
45
+ paddingBottom: parseInt(theme.space[6]),
46
+ paddingLeft: parseInt(theme.space[3]),
47
+ },
21
48
  });
22
- export var StyledAccordionHeader = styled.TouchableOpacity(function (_a) {
23
- var core = _a.theme.core;
24
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding-top: ", "\n padding-left: ", "\n padding-right: 18px;\n padding-bottom: 18px;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n "], ["\n padding-top: ", "\n padding-left: ", "\n padding-right: 18px;\n padding-bottom: 18px;\n flex-direction: row;\n align-items: flex-start;\n justify-content: space-between;\n "])), core.space[5], core.space[3]);
25
- });
26
- export var StyledContainer = styled.View(function (_a) {
27
- var core = _a.theme.core;
28
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n padding-top: 0;\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n "], ["\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n padding-top: 0;\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n "])), core.space[12], core.space[6], core.space[3]);
29
- });
30
- var templateObject_1, templateObject_2, templateObject_3;
49
+ export { styles };
@@ -24,46 +24,28 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  }
25
25
  return t;
26
26
  };
27
- import { jsx as _jsx } from "react/jsx-runtime";
27
+ import React from 'react';
28
+ import { useBreakpoint } from '../../hooks';
28
29
  import styled, { css } from '../../styled.native';
30
+ import { calculateLineHeight } from '../../theme';
29
31
  var StyledBadge = styled.View(function (_a) {
30
- var _b = _a.theme, core = _b.core, semantic = _b.semantic, component = _b.component, _c = _a.variant, variant = _c === void 0 ? 'info' : _c, _d = _a.inverted, inverted = _d === void 0 ? false : _d, customVariant = _a.customVariant;
31
- var surface;
32
- var message;
33
- if (variant in semantic) {
34
- surface = semantic[variant].surface;
35
- message = semantic[variant].message;
36
- }
37
- else {
38
- surface = component.badge.variants[variant].background;
39
- message = component.badge.variants[variant].foreground;
40
- }
41
- if ((customVariant === null || customVariant === void 0 ? void 0 : customVariant.foregroundColor) && (customVariant === null || customVariant === void 0 ? void 0 : customVariant.backgroundColor)) {
42
- surface = customVariant.backgroundColor;
43
- message = customVariant.foregroundColor;
44
- }
45
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 ", ";\n border-radius: 16px;\n border: ", " solid ", ";\n background-color: ", ";\n align-self: flex-start;\n "], ["\n padding: 0 ", ";\n border-radius: 16px;\n border: ", " solid ", ";\n background-color: ", ";\n align-self: flex-start;\n "])), core.space[2], core.borderWidth.medium, core.color.brand.white, inverted ? message : surface);
32
+ var badge = _a.theme.badge, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.inverted, inverted = _c === void 0 ? false : _c;
33
+ // @ts-ignore to support additional palettes.
34
+ var currentVariant = badge.variants[variant];
35
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 0 ", ";\n border-radius: ", ";\n background-color: ", ";\n align-self: flex-start;\n "], ["\n padding: 0 ", ";\n border-radius: ", ";\n background-color: ", ";\n align-self: flex-start;\n "])), badge.paddingHorizontal, badge.borderRadius, inverted
36
+ ? currentVariant.foreground
37
+ : currentVariant.background);
46
38
  });
47
39
  var StyledBadgeText = styled.Text(function (_a) {
48
- var _b = _a.theme, core = _b.core, semantic = _b.semantic, component = _b.component, _c = _a.variant, variant = _c === void 0 ? 'info' : _c, _d = _a.inverted, inverted = _d === void 0 ? false : _d, customVariant = _a.customVariant;
49
- var surface;
50
- var message;
51
- if (variant in semantic) {
52
- surface = semantic[variant].surface;
53
- message = semantic[variant].message;
54
- }
55
- else {
56
- surface = component.badge.variants[variant].background;
57
- message = component.badge.variants[variant].foreground;
58
- }
59
- if ((customVariant === null || customVariant === void 0 ? void 0 : customVariant.foregroundColor) && (customVariant === null || customVariant === void 0 ? void 0 : customVariant.backgroundColor)) {
60
- surface = customVariant.backgroundColor;
61
- message = customVariant.foregroundColor;
62
- }
63
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "])), core.fontFamily.bodyBold.native, core.lineHeight.body.small, inverted ? surface : message, core.fontSize.body.small);
40
+ var badge = _a.theme.badge, _b = _a.variant, variant = _b === void 0 ? 'default' : _b, _c = _a.inverted, inverted = _c === void 0 ? false : _c;
41
+ // @ts-ignore to support additional palettes.
42
+ var currentVariant = badge.variants[variant];
43
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n "])), badge.fontFamily, calculateLineHeight(badge.fontSize[1], badge.lineHeight), inverted ? currentVariant.background : currentVariant.foreground, badge.fontSize[1]);
64
44
  });
65
45
  export var Badge = function (_a) {
66
- var children = _a.children, variant = _a.variant, inverted = _a.inverted, rest = __rest(_a, ["children", "variant", "inverted"]);
67
- return (_jsx(StyledBadge, __assign({ variant: variant, inverted: inverted }, rest, { children: _jsx(StyledBadgeText, __assign({ variant: variant, inverted: inverted }, { children: children })) })));
46
+ var children = _a.children, variant = _a.variant, rest = __rest(_a, ["children", "variant"]);
47
+ var smallAndUp = useBreakpoint().smallAndUp;
48
+ return (React.createElement(StyledBadge, __assign({}, rest, { variant: variant }),
49
+ React.createElement(StyledBadgeText, { variant: variant, smallAndUp: smallAndUp }, children)));
68
50
  };
69
51
  var templateObject_1, templateObject_2;
@@ -24,51 +24,55 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  }
25
25
  return t;
26
26
  };
27
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
- import { forwardRef } from 'react';
27
+ import React, { useContext, forwardRef, } from 'react';
29
28
  import { useBreakpoint } from '../../hooks';
30
- import styled, { css } from '../../styled.native';
29
+ import styled, { css, ThemeContext } from '../../styled.native';
30
+ import { calculateLineHeight } from '../../theme';
31
31
  import { Icon } from '../Icon/Icon';
32
32
  var StyledCTAWrapper = styled.TouchableOpacity(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n align-self: flex-start;\n flex-direction: row;\n align-items: flex-start;\n"], ["\n align-self: flex-start;\n flex-direction: row;\n align-items: flex-start;\n"])));
33
33
  var CTAButtonWrapper = function (_a) {
34
34
  var children = _a.children, _b = _a.accessibilityRole, accessibilityRole = _b === void 0 ? 'button' : _b, _c = _a.activeOpacity, activeOpacity = _c === void 0 ? 0.8 : _c, rest = __rest(_a, ["children", "accessibilityRole", "activeOpacity"]);
35
- return (_jsx(StyledCTAWrapper, __assign({ accessibilityRole: accessibilityRole, activeOpacity: activeOpacity }, rest, { children: children })));
35
+ return (React.createElement(StyledCTAWrapper, __assign({ accessibilityRole: accessibilityRole, activeOpacity: activeOpacity }, rest), children));
36
36
  };
37
37
  var StyledInner = styled.View(function (_a) {
38
- var _b = _a.theme, core = _b.core, component = _b.component, fullWidth = _a.fullWidth, variant = _a.variant;
39
- var currentVariant = component.cta[variant];
40
- var borderRadius = parseFloat(core.space[11]) / 2 + 'px';
41
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", " ", ";\n background-color: ", ";\n border-radius: ", ";\n min-height: ", ";\n border: none;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n flex-grow: 1;\n\n ", ";\n "], ["\n padding: ", " ", ";\n background-color: ", ";\n border-radius: ", ";\n min-height: ", ";\n border: none;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n flex-grow: 1;\n\n ", ";\n "])), core.space[2], core.space[4], currentVariant.surface, borderRadius, core.space[11], fullWidth === 'never'
38
+ var cta = _a.theme.cta, fullWidth = _a.fullWidth, variant = _a.variant;
39
+ // @ts-ignore to support additional palettes.
40
+ var currentVariant = cta.variants[variant];
41
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n padding: ", " ", ";\n border-color: ", ";\n background-color: ", ";\n border-width: ", ";\n border-radius: ", ";\n min-height: ", ";\n border-style: solid;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n flex-grow: 1;\n\n ", ";\n "], ["\n padding: ", " ", ";\n border-color: ", ";\n background-color: ", ";\n border-width: ", ";\n border-radius: ", ";\n min-height: ", ";\n border-style: solid;\n justify-content: center;\n align-items: center;\n flex-direction: row;\n flex-grow: 1;\n\n ", ";\n "])), cta.paddingVertical, cta.paddingHorizontal, currentVariant.border, currentVariant.background, cta.borderWidth, cta.borderRadius, cta.minHeight, fullWidth === 'never'
42
42
  ? css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n flex-grow: 0;\n "], ["\n flex-grow: 0;\n "]))) : '');
43
43
  });
44
44
  var StyledRightIcon = styled(Icon)(function (_a) {
45
- var _b = _a.theme, core = _b.core, component = _b.component, variant = _a.variant;
46
- var currentVariant = component.cta[variant];
47
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-left: ", ";\n color: ", ";\n "], ["\n margin-left: ", ";\n color: ", ";\n "])), core.space[1], currentVariant.message);
45
+ var cta = _a.theme.cta;
46
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin-left: ", ";\n "], ["\n margin-left: ", ";\n "])), cta.iconGap);
48
47
  });
49
48
  var StyledLeftIcon = styled(Icon)(function (_a) {
50
- var _b = _a.theme, core = _b.core, component = _b.component, variant = _a.variant;
51
- var currentVariant = component.cta[variant];
52
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-right: ", ";\n color: ", ";\n "], ["\n margin-right: ", ";\n color: ", ";\n "])), core.space[1], currentVariant.message);
49
+ var cta = _a.theme.cta;
50
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-right: ", ";\n "], ["\n margin-right: ", ";\n "])), cta.iconGap);
53
51
  });
54
52
  var StyledCTAButtonText = styled.Text(function (_a) {
55
- var _b = _a.theme, core = _b.core, component = _b.component, smallAndUp = _a.smallAndUp, variant = _a.variant;
56
- var fontSize = smallAndUp
57
- ? core.fontSize.body.large
58
- : core.fontSize.body.small;
59
- var currentVariant = component.cta[variant];
60
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: center;\n flex-shrink: 2;\n "], ["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: center;\n flex-shrink: 2;\n "])), currentVariant.message, core.fontFamily.bodyBold.native, fontSize, core.lineHeight.body.small);
53
+ var cta = _a.theme.cta, smallAndUp = _a.smallAndUp, variant = _a.variant;
54
+ var fontSize = smallAndUp ? cta.fontSize[1] : cta.fontSize[0];
55
+ // @ts-ignore to support additional palettes.
56
+ var currentVariant = cta.variants[variant];
57
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: left;\n flex-shrink: 2;\n "], ["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n text-align: left;\n flex-shrink: 2;\n "])), currentVariant.foreground, cta.fontFamily, fontSize, calculateLineHeight(fontSize, cta.lineHeight));
61
58
  });
62
59
  var CTAButton = function (_a) {
63
60
  var _b = _a.iconLeft, iconLeft = _b === void 0 ? 'off' : _b, _c = _a.iconRight, iconRight = _c === void 0 ? 'off' : _c, children = _a.children, _d = _a.fullWidth, fullWidth = _d === void 0 ? 'small' : _d, _e = _a.variant, variant = _e === void 0 ? 'primary' : _e, rest = __rest(_a, ["iconLeft", "iconRight", "children", "fullWidth", "variant"]);
61
+ var cta = useContext(ThemeContext).cta;
64
62
  var smallAndUp = useBreakpoint().smallAndUp;
63
+ // @ts-ignore to support additional palettes.
64
+ var currentVariant = cta.variants[variant];
65
65
  if (fullWidth === 'small') {
66
66
  fullWidth = smallAndUp ? 'never' : 'always';
67
67
  }
68
- return (_jsx(CTAButtonWrapper, __assign({}, rest, { children: _jsxs(StyledInner, __assign({ fullWidth: fullWidth, variant: variant }, { children: [iconLeft !== 'off' ? (_jsx(StyledLeftIcon, { name: iconLeft, size: 16, variant: variant })) : null, _jsx(StyledCTAButtonText, __assign({ smallAndUp: smallAndUp, variant: variant }, { children: children })), iconRight !== 'off' ? (_jsx(StyledRightIcon, { name: iconRight, size: 16, variant: variant })) : null] })) })));
68
+ return (React.createElement(CTAButtonWrapper, __assign({}, rest),
69
+ React.createElement(StyledInner, { fullWidth: fullWidth, variant: variant },
70
+ iconLeft !== 'off' ? (React.createElement(StyledLeftIcon, { name: iconLeft, size: 16, color: currentVariant.foreground })) : null,
71
+ React.createElement(StyledCTAButtonText, { smallAndUp: smallAndUp, variant: variant }, children),
72
+ iconRight !== 'off' ? (React.createElement(StyledRightIcon, { name: iconRight, size: 16, color: currentVariant.foreground })) : null)));
69
73
  };
70
- var PrimaryCTAButton = forwardRef(function (props, ref) { return (_jsx(CTAButton, __assign({ variant: "primary" }, props, { ref: ref }))); });
71
- var SecondaryCTAButton = forwardRef(function (props, ref) { return (_jsx(CTAButton, __assign({ variant: "secondary" }, props, { ref: ref }))); });
72
- var DestructiveCTAButton = forwardRef(function (props, ref) { return (_jsx(CTAButton, __assign({ variant: "destructive" }, props, { ref: ref }))); });
74
+ var PrimaryCTAButton = forwardRef(function (props, ref) { return (React.createElement(CTAButton, __assign({ variant: "primary" }, props, { ref: ref }))); });
75
+ var SecondaryCTAButton = forwardRef(function (props, ref) { return (React.createElement(CTAButton, __assign({ variant: "secondary" }, props, { ref: ref }))); });
76
+ var DestructiveCTAButton = forwardRef(function (props, ref) { return (React.createElement(CTAButton, __assign({ variant: "destructive" }, props, { ref: ref }))); });
73
77
  export { CTAButton, PrimaryCTAButton, SecondaryCTAButton, DestructiveCTAButton, };
74
78
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -9,10 +9,9 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { forwardRef } from 'react';
12
+ import React, { forwardRef } from 'react';
14
13
  import { CTAButton } from '../CTAButton';
15
- var CTALink = forwardRef(function (props, ref) { return _jsx(CTAButton, __assign({}, props, { ref: ref })); });
16
- var PrimaryCTALink = forwardRef(function (props, ref) { return _jsx(CTALink, __assign({ variant: "primary", ref: ref }, props)); });
17
- var SecondaryCTALink = forwardRef(function (props, ref) { return (_jsx(CTALink, __assign({ variant: "secondary", ref: ref }, props))); });
14
+ var CTALink = forwardRef(function (props, ref) { return React.createElement(CTAButton, __assign({}, props, { ref: ref })); });
15
+ var PrimaryCTALink = forwardRef(function (props, ref) { return React.createElement(CTALink, __assign({ variant: "primary", ref: ref }, props)); });
16
+ var SecondaryCTALink = forwardRef(function (props, ref) { return (React.createElement(CTALink, __assign({ variant: "secondary", ref: ref }, props))); });
18
17
  export { CTALink, PrimaryCTALink, SecondaryCTALink };
@@ -1,7 +1,27 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import React from 'react';
13
+ import { useBreakpoint } from '../../hooks';
1
14
  import styled from '../../styled.native';
2
- export var Card = styled.View(function (_a) {
3
- var _b = _a.theme, core = _b.core, semantic = _b.semantic, _c = _a.inline, inline = _c === void 0 ? false : _c;
4
- return "\n background: ".concat(semantic.surface.elevated, ";\n border: ").concat(inline
5
- ? "".concat(core.borderWidth.small, " solid ").concat(semantic.border.differentiated)
6
- : 'none', ";\n padding: ").concat(core.space[4], ";\n border-radius: ").concat(core.radius.small, ";\n ");
15
+ var StyledCard = styled.View(function (_a) {
16
+ var _b = _a.theme, card = _b.card, radii = _b.radii, smallAndUp = _a.smallAndUp, _c = _a.inline, inline = _c === void 0 ? false : _c;
17
+ var padding = smallAndUp
18
+ ? "".concat(card.padding[2], " ").concat(card.padding[1])
19
+ : "".concat(card.padding[1], " ").concat(card.padding[0]);
20
+ var borderRadius = smallAndUp ? radii.medium : radii.small;
21
+ return "\n background: ".concat(card.background, ";\n border: ").concat(inline ? "".concat(card.borderWidth, " solid ").concat(card.borderColor) : 'none', ";\n padding: ").concat(padding, ";\n border-radius: ").concat(borderRadius, ";\n ");
7
22
  });
23
+ var Card = function (props) {
24
+ var breakpoints = useBreakpoint();
25
+ return React.createElement(StyledCard, __assign({}, breakpoints, props));
26
+ };
27
+ export { Card };
@@ -24,10 +24,9 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  }
25
25
  return t;
26
26
  };
27
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
28
- import { forwardRef } from 'react';
27
+ import React, { forwardRef, useContext, } from 'react';
29
28
  import { TouchableOpacity, View, } from 'react-native';
30
- import styled from '../../styled.native';
29
+ import styled, { ThemeContext } from '../../styled.native';
31
30
  import { pxToNumber } from '../../utils';
32
31
  import { ErrorText } from '../ErrorText';
33
32
  import { FormGroup } from '../FormGroup';
@@ -42,33 +41,53 @@ var StyledCheckboxInputWrapper = styled.View(function (_a) {
42
41
  return "\n width: ".concat(checkboxSize + gap, "px;\n height: ").concat(checkbox.touchSize, ";\n ");
43
42
  });
44
43
  var StyledCheckboxInput = styled.View(function (_a) {
45
- var _b = _a.theme, core = _b.core, semantic = _b.semantic, invalid = _a.invalid, checked = _a.checked;
46
- return "\n width: ".concat(core.space[6], ";\n height: ").concat(core.space[6], ";\n border: ").concat(core.borderWidth.small, " solid;\n margin-top: 10px;\n border-radius: ").concat(core.radius.small, ";\n border-color: ").concat(invalid
47
- ? semantic.error.border
44
+ var checkbox = _a.theme.checkbox, invalid = _a.invalid, checked = _a.checked;
45
+ var touchSize = pxToNumber(checkbox.touchSize);
46
+ var checkboxSize = pxToNumber(checkbox.size);
47
+ var checkboxDistance = (touchSize - checkboxSize) / 2;
48
+ return "\n width: ".concat(checkbox.size, ";\n height: ").concat(checkbox.size, ";\n border: ").concat(checkbox.borderWidth, " solid;\n margin-top: ").concat(checkboxDistance, "px;\n border-radius: ").concat(checkbox.borderRadius, ";\n border-color: ").concat(invalid
49
+ ? checkbox.errorColor
48
50
  : checked
49
- ? core.color.blue.dark
50
- : semantic.border.functional, ";\n background: ").concat(checked ? core.color.blue.lightest : 'transparent', ";\n ");
51
+ ? checkbox.checkColor
52
+ : checkbox.borderColor, ";\n background: ").concat(checked ? checkbox.checkedBackground : checkbox.background, ";\n ");
51
53
  });
52
54
  var CheckboxCheck = function (props) {
53
- return _jsx(Icon, __assign({ name: "check", size: 16 }, props));
55
+ var checkbox = useContext(ThemeContext).checkbox;
56
+ return (React.createElement(Icon, __assign({ name: "check", size: pxToNumber(checkbox.checkSize), color: checkbox.checkColor }, props)));
54
57
  };
55
58
  var StyledCheckboxInputCheck = styled(CheckboxCheck)(function (_a) {
56
- var core = _a.theme.core, checked = _a.checked;
57
- return "\n margin-top: 3px;\n margin-left: 3px;\n color: ".concat(core.color.blue.dark, ";\n opacity: ").concat(checked ? 1 : 0, ";\n ");
59
+ var checkbox = _a.theme.checkbox, checked = _a.checked;
60
+ var checkboxSize = pxToNumber(checkbox.size);
61
+ var checkSize = pxToNumber(checkbox.checkSize);
62
+ var borderWidth = pxToNumber(checkbox.borderWidth);
63
+ var checkDistance = (checkboxSize - checkSize) / 2 - borderWidth;
64
+ return "\n margin-top: ".concat(checkDistance, "px;\n margin-left: ").concat(checkDistance, "px;\n opacity: ").concat(checked ? 1 : 0, ";\n ");
58
65
  });
59
66
  var Input = function (_a) {
60
67
  var checked = _a.checked, invalid = _a.invalid, testID = _a.testID, rest = __rest(_a, ["checked", "invalid", "testID"]);
61
- return (_jsx(StyledCheckboxInputWrapper, __assign({}, rest, { children: _jsx(StyledCheckboxInput, __assign({ invalid: invalid, checked: checked, testID: testID }, { children: _jsx(StyledCheckboxInputCheck, { checked: checked }) })) })));
68
+ return (React.createElement(StyledCheckboxInputWrapper, __assign({}, rest),
69
+ React.createElement(StyledCheckboxInput, { invalid: invalid, checked: checked, testID: testID },
70
+ React.createElement(StyledCheckboxInputCheck, { checked: checked }))));
62
71
  };
63
72
  var CheckLabelText = styled(LabelText)(function (_a) {
64
- var core = _a.theme.core;
65
- return "\n padding-top: ".concat(core.space[3], ";\n ");
73
+ var checkbox = _a.theme.checkbox;
74
+ return "\n padding-top: ".concat(checkbox.paddingTop, ";\n ");
66
75
  });
67
76
  var StyledWrapper = styled.View(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: row;\n"], ["\n flex-direction: row;\n"])));
68
77
  var Checkbox = forwardRef(function (_a, ref) {
69
78
  var label = _a.label, hint = _a.hint, error = _a.error, checked = _a.checked, optional = _a.optional, invalid = _a.invalid, _b = _a.activeOpacity, activeOpacity = _b === void 0 ? 0.8 : _b, testID = _a.testID, rest = __rest(_a, ["label", "hint", "error", "checked", "optional", "invalid", "activeOpacity", "testID"]);
70
79
  var hasError = !!error;
71
- return (_jsx(FormGroup, __assign({ error: hasError }, { children: _jsxs(Stack, __assign({ spaceBetween: 1 }, { children: [error ? _jsx(ErrorText, { children: error }) : null, _jsx(TouchableOpacity, __assign({ ref: ref, accessibilityRole: "checkbox", activeOpacity: activeOpacity, accessibilityState: { checked: checked } }, rest, { children: _jsxs(StyledWrapper, { children: [_jsx(Input, { checked: checked, invalid: hasError || invalid, testID: testID }), _jsxs(View, __assign({ style: { flexShrink: 1 } }, { children: [_jsxs(CheckLabelText, { children: [label, optional ? ' (optional)' : null] }), hint ? _jsx(HintText, { children: hint }) : null] }))] }) }))] })) })));
80
+ return (React.createElement(FormGroup, { error: hasError },
81
+ React.createElement(Stack, { spaceBetween: 1 },
82
+ error ? React.createElement(ErrorText, null, error) : null,
83
+ React.createElement(TouchableOpacity, __assign({ ref: ref, accessibilityRole: "checkbox", activeOpacity: activeOpacity, accessibilityState: { checked: checked } }, rest),
84
+ React.createElement(StyledWrapper, null,
85
+ React.createElement(Input, { checked: checked, invalid: hasError || invalid, testID: testID }),
86
+ React.createElement(View, { style: { flexShrink: 1 } },
87
+ React.createElement(CheckLabelText, null,
88
+ label,
89
+ optional ? ' (optional)' : null),
90
+ hint ? React.createElement(HintText, null, hint) : null))))));
72
91
  });
73
92
  export { Checkbox };
74
93
  var templateObject_1;
@@ -20,8 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
24
- import { Children, cloneElement } from 'react';
23
+ import React, { Children, cloneElement, } from 'react';
25
24
  import { View } from 'react-native';
26
25
  import { ErrorText } from '../ErrorText';
27
26
  import { FormGroup } from '../FormGroup';
@@ -31,10 +30,18 @@ import { Stack } from '../Stack';
31
30
  var CheckboxField = function (_a) {
32
31
  var label = _a.label, hint = _a.hint, error = _a.error, children = _a.children, _b = _a.optional, optional = _b === void 0 ? false : _b, rest = __rest(_a, ["label", "hint", "error", "children", "optional"]);
33
32
  var hasError = !!error;
34
- return (_jsx(FormGroup, __assign({}, rest, { error: hasError }, { children: _jsxs(Stack, __assign({ spaceBetween: 1 }, { children: [_jsxs(View, { children: [_jsxs(LabelText, { children: [label, optional ? ' (optional)' : null] }), hint ? _jsx(HintText, { children: hint }) : null, error ? _jsx(ErrorText, { children: error }) : null] }), _jsx(View, { children: Children.map(children, function (child) {
35
- return cloneElement(child, {
36
- invalid: hasError ? true : child.props.invalid,
37
- });
38
- }) })] })) })));
33
+ return (React.createElement(FormGroup, __assign({}, rest, { error: hasError }),
34
+ React.createElement(Stack, { spaceBetween: 1 },
35
+ React.createElement(View, null,
36
+ React.createElement(LabelText, null,
37
+ label,
38
+ optional ? ' (optional)' : null),
39
+ hint ? React.createElement(HintText, null, hint) : null,
40
+ error ? React.createElement(ErrorText, null, error) : null),
41
+ React.createElement(View, null, Children.map(children, function (child) {
42
+ return cloneElement(child, {
43
+ invalid: hasError ? true : child.props.invalid,
44
+ });
45
+ })))));
39
46
  };
40
47
  export { CheckboxField };