@ovotech/element-native 2.1.0 → 2.2.0-canary-ea79e4d-74

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 (147) hide show
  1. package/dist/components/Accordion/Accordion.js +20 -19
  2. package/dist/components/Accordion/Icon.js +7 -10
  3. package/dist/components/Accordion/styles.d.ts +688 -46
  4. package/dist/components/Accordion/styles.js +56 -49
  5. package/dist/components/Badge/Badge.d.ts +237 -8
  6. package/dist/components/Badge/Badge.js +35 -16
  7. package/dist/components/CTAButton/CTAButton.d.ts +7 -12
  8. package/dist/components/CTAButton/CTAButton.js +18 -19
  9. package/dist/components/CTALink/CTALink.d.ts +3 -3
  10. package/dist/components/Card/Card.d.ts +228 -5
  11. package/dist/components/Card/Card.js +5 -25
  12. package/dist/components/Checkbox/Checkbox.js +14 -19
  13. package/dist/components/DataTable/DataTable.d.ts +3 -12
  14. package/dist/components/DataTable/DataTable.js +8 -71
  15. package/dist/components/DataTable/TableRow.d.ts +2 -0
  16. package/dist/components/DataTable/TableRow.js +33 -0
  17. package/dist/components/DataTable/index.d.ts +2 -0
  18. package/dist/components/DataTable/index.js +16 -0
  19. package/dist/components/DataTable/styles.d.ts +2517 -0
  20. package/dist/components/DataTable/styles.js +77 -0
  21. package/dist/components/DataTable/types.d.ts +15 -0
  22. package/dist/components/DataTable/types.js +2 -0
  23. package/dist/components/DateField/DateField.js +9 -9
  24. package/dist/components/DescriptionList/DescriptionList.d.ts +10 -0
  25. package/dist/components/DescriptionList/DescriptionList.js +66 -0
  26. package/dist/components/DescriptionList/index.d.ts +1 -0
  27. package/dist/components/DescriptionList/index.js +6 -0
  28. package/dist/components/DescriptionList/styled.d.ts +241 -0
  29. package/dist/components/DescriptionList/styled.js +88 -0
  30. package/dist/components/Disclosure/Disclosure.js +7 -10
  31. package/dist/components/ErrorSummaryNotification/ErrorSummaryNotification.d.ts +1 -1
  32. package/dist/components/ErrorText/ErrorText.d.ts +228 -1
  33. package/dist/components/ErrorText/ErrorText.js +1 -1
  34. package/dist/components/Field/Field.js +3 -3
  35. package/dist/components/Grid/Col.d.ts +228 -1
  36. package/dist/components/Grid/Row.d.ts +228 -1
  37. package/dist/components/Heading/Heading.js +8 -24
  38. package/dist/components/HintText/HintText.d.ts +228 -1
  39. package/dist/components/HintText/HintText.js +1 -1
  40. package/dist/components/Icon/Icon.d.ts +2 -3
  41. package/dist/components/Icon/Icon.js +2 -2
  42. package/dist/components/Input/Input.d.ts +1 -1
  43. package/dist/components/Input/Input.js +13 -16
  44. package/dist/components/Input/PasswordInput.styled.d.ts +228 -1
  45. package/dist/components/Input/PasswordInput.styled.js +2 -5
  46. package/dist/components/Input/PasswordVisibilityToggle.js +2 -5
  47. package/dist/components/Input/{TelInput.d.ts → PhoneInput.d.ts} +2 -2
  48. package/dist/components/Input/{TelInput.js → PhoneInput.js} +3 -3
  49. package/dist/components/Input/TextareaInput.js +11 -9
  50. package/dist/components/Input/index.d.ts +1 -1
  51. package/dist/components/Input/index.js +3 -3
  52. package/dist/components/LabelText/LabelText.d.ts +228 -1
  53. package/dist/components/LabelText/LabelText.js +1 -1
  54. package/dist/components/List/List.d.ts +706 -3
  55. package/dist/components/List/List.js +18 -5
  56. package/dist/components/Margin/Margin.d.ts +228 -1
  57. package/dist/components/NavHeader/NavHeader.js +4 -4
  58. package/dist/components/Notification/Notification.d.ts +466 -20
  59. package/dist/components/Notification/Notification.js +32 -44
  60. package/dist/components/Radio/Radio.js +13 -29
  61. package/dist/components/SelectField/Select.d.ts +244 -0
  62. package/dist/components/SelectField/Select.js +101 -0
  63. package/dist/components/SelectField/SelectField.d.ts +7 -0
  64. package/dist/components/SelectField/SelectField.js +38 -0
  65. package/dist/components/SelectField/index.d.ts +1 -0
  66. package/dist/components/SelectField/index.js +5 -0
  67. package/dist/components/SkeletonLoading/Skeleton.d.ts +228 -1
  68. package/dist/components/SubLabelText/SubLabelText.d.ts +228 -1
  69. package/dist/components/SubLabelText/SubLabelText.js +1 -1
  70. package/dist/components/SummaryList/SummaryList.d.ts +4 -0
  71. package/dist/components/SummaryList/SummaryList.js +5 -0
  72. package/dist/components/Tabs/Tab.js +22 -19
  73. package/dist/components/Tabs/TabList.d.ts +11 -1
  74. package/dist/components/Tabs/TabList.js +19 -16
  75. package/dist/components/Tabs/TabPanel.js +32 -6
  76. package/dist/components/Tabs/Tabs.d.ts +8 -6
  77. package/dist/components/Tabs/Tabs.js +10 -6
  78. package/dist/components/Text/Text.d.ts +1140 -5
  79. package/dist/components/Text/Text.js +6 -10
  80. package/dist/components/TextField/PhoneField.d.ts +10 -0
  81. package/dist/components/TextField/PhoneField.js +56 -0
  82. package/dist/components/TextField/TelField.d.ts +4 -0
  83. package/dist/components/TextField/TelField.js +7 -2
  84. package/dist/components/TextField/index.d.ts +1 -0
  85. package/dist/components/TextField/index.js +3 -1
  86. package/dist/components/TextLink/TextLink.js +2 -2
  87. package/dist/components/index.d.ts +2 -0
  88. package/dist/components/index.js +2 -0
  89. package/dist/esm/components/Accordion/Accordion.js +23 -22
  90. package/dist/esm/components/Accordion/Icon.js +8 -8
  91. package/dist/esm/components/Accordion/styles.js +29 -48
  92. package/dist/esm/components/Badge/Badge.js +35 -16
  93. package/dist/esm/components/CTAButton/CTAButton.js +20 -21
  94. package/dist/esm/components/Card/Card.js +5 -25
  95. package/dist/esm/components/Checkbox/Checkbox.js +12 -20
  96. package/dist/esm/components/DataTable/DataTable.js +3 -66
  97. package/dist/esm/components/DataTable/TableRow.js +26 -0
  98. package/dist/esm/components/DataTable/index.js +2 -0
  99. package/dist/esm/components/DataTable/styles.js +51 -0
  100. package/dist/esm/components/DataTable/types.js +1 -0
  101. package/dist/esm/components/DateField/DateField.js +9 -9
  102. package/dist/esm/components/DescriptionList/DescriptionList.js +39 -0
  103. package/dist/esm/components/DescriptionList/index.js +1 -0
  104. package/dist/esm/components/DescriptionList/styled.js +57 -0
  105. package/dist/esm/components/Disclosure/Disclosure.js +9 -12
  106. package/dist/esm/components/ErrorText/ErrorText.js +1 -1
  107. package/dist/esm/components/Field/Field.js +3 -3
  108. package/dist/esm/components/Heading/Heading.js +8 -24
  109. package/dist/esm/components/HintText/HintText.js +1 -1
  110. package/dist/esm/components/Icon/Icon.js +2 -2
  111. package/dist/esm/components/Input/Input.js +15 -18
  112. package/dist/esm/components/Input/PasswordInput.styled.js +2 -5
  113. package/dist/esm/components/Input/PasswordVisibilityToggle.js +3 -6
  114. package/dist/esm/components/Input/{TelInput.js → PhoneInput.js} +2 -2
  115. package/dist/esm/components/Input/TextareaInput.js +11 -9
  116. package/dist/esm/components/Input/index.js +1 -1
  117. package/dist/esm/components/LabelText/LabelText.js +1 -1
  118. package/dist/esm/components/List/List.js +17 -5
  119. package/dist/esm/components/NavHeader/NavHeader.js +4 -4
  120. package/dist/esm/components/Notification/Notification.js +34 -46
  121. package/dist/esm/components/Radio/Radio.js +13 -29
  122. package/dist/esm/components/SelectField/Select.js +74 -0
  123. package/dist/esm/components/SelectField/SelectField.js +31 -0
  124. package/dist/esm/components/SelectField/index.js +1 -0
  125. package/dist/esm/components/SubLabelText/SubLabelText.js +1 -1
  126. package/dist/esm/components/SummaryList/SummaryList.js +5 -0
  127. package/dist/esm/components/Tabs/Tab.js +22 -16
  128. package/dist/esm/components/Tabs/TabList.js +18 -16
  129. package/dist/esm/components/Tabs/TabPanel.js +9 -6
  130. package/dist/esm/components/Tabs/Tabs.js +9 -6
  131. package/dist/esm/components/Text/Text.js +6 -10
  132. package/dist/esm/components/TextField/PhoneField.js +30 -0
  133. package/dist/esm/components/TextField/TelField.js +7 -2
  134. package/dist/esm/components/TextField/index.js +1 -0
  135. package/dist/esm/components/TextLink/TextLink.js +2 -2
  136. package/dist/esm/components/index.js +2 -0
  137. package/dist/esm/providers/icons/Logo.js +6 -3
  138. package/dist/esm/theme/create-theme.js +2 -176
  139. package/dist/esm/theme/index.js +13 -2
  140. package/dist/providers/icons/Logo.js +5 -2
  141. package/dist/styled.native.d.ts +1363 -1
  142. package/dist/theme/create-theme.d.ts +1 -1
  143. package/dist/theme/create-theme.js +2 -176
  144. package/dist/theme/index.d.ts +228 -2
  145. package/dist/theme/index.js +13 -2
  146. package/dist/theme/theme.d.ts +1 -110
  147. package/package.json +9 -6
@@ -24,24 +24,20 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  }
25
25
  return t;
26
26
  };
27
- import React, { useState, forwardRef, useContext } from 'react';
27
+ import React, { forwardRef, useState } from 'react';
28
28
  import { useBreakpoint } from '../../hooks';
29
- import styled, { css, ThemeContext } from '../../styled.native';
30
- import { pxToNumber } from '../../utils';
29
+ import styled, { css } from '../../styled.native';
31
30
  import { Icon } from '../Icon/Icon';
32
31
  var StyledIcon = styled(Icon)(function (_a) {
33
- var _b = _a.theme, input = _b.input, focusRing = _b.focusRing, side = _a.side, focused = _a.focused;
34
- var distance = (pxToNumber(input.height) - pxToNumber(input.icon.size)) / 2 +
35
- (focused ? pxToNumber(focusRing.distance) : 0);
36
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", "px;\n ", ";\n ", ";\n "], ["\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", "px;\n ", ";\n ", ";\n "])), input.icon.size, distance, side === 'left' ? "left: ".concat(distance, "px") : '', side === 'right' ? "right: ".concat(distance, "px") : '');
32
+ var core = _a.theme.core, side = _a.side, focused = _a.focused;
33
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n z-index: 1;\n top: ", ";\n ", ";\n ", ";\n "], ["\n position: absolute;\n z-index: 1;\n top: ", ";\n ", ";\n ", ";\n "])), focused ? '16px' : '14px', side === 'left' ? "left: ".concat(core.space[2]) : '', side === 'right' ? "right: ".concat(core.space[2]) : '');
37
34
  });
38
35
  var Input = forwardRef(function (_a, ref) {
39
36
  var onFocus = _a.onFocus, onBlur = _a.onBlur, style = _a.style, iconLeft = _a.iconLeft, iconRight = _a.iconRight, rightSlot = _a.rightSlot, rest = __rest(_a, ["onFocus", "onBlur", "style", "iconLeft", "iconRight", "rightSlot"]);
40
37
  var _b = useState(false), focused = _b[0], setFocused = _b[1];
41
38
  var breakpoints = useBreakpoint();
42
- var input = useContext(ThemeContext).input;
43
39
  return (React.createElement(InputWrapper, { focused: focused },
44
- iconLeft ? (React.createElement(StyledIcon, { name: iconLeft, size: pxToNumber(input.icon.size), focused: focused, pointerEvents: "none", side: "left" })) : null,
40
+ iconLeft ? (React.createElement(StyledIcon, { name: iconLeft, size: 16, focused: focused, pointerEvents: "none", side: "left" })) : null,
45
41
  React.createElement(StyledInput, __assign({}, rest, breakpoints, { iconLeft: !!iconLeft, iconRight: !!iconRight, hasRightSlot: !!rightSlot, style: style,
46
42
  // @ts-ignore
47
43
  ref: ref, onFocus: function (event) {
@@ -55,23 +51,24 @@ var Input = forwardRef(function (_a, ref) {
55
51
  onBlur(event);
56
52
  }
57
53
  } })),
58
- iconRight && !rightSlot ? (React.createElement(StyledIcon, { name: iconRight, size: pxToNumber(input.icon.size), focused: focused, pointerEvents: "none", side: "right" })) : null,
54
+ iconRight && !rightSlot ? (React.createElement(StyledIcon, { name: iconRight, size: 16, focused: focused, pointerEvents: "none", side: "right" })) : null,
59
55
  rightSlot));
60
56
  });
61
57
  var InputWrapper = styled.View(function (_a) {
62
- var _b = _a.theme, input = _b.input, focusRing = _b.focusRing, focused = _a.focused;
63
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: stretch;\n background-color: ", ";\n border-radius: ", ";\n border-width: 0px;\n border-style: solid;\n border-color: ", ";\n flex-direction: row;\n\n ", "\n "], ["\n align-self: stretch;\n background-color: ", ";\n border-radius: ", ";\n border-width: 0px;\n border-style: solid;\n border-color: ", ";\n flex-direction: row;\n\n ", "\n "])), input.background, input.borderRadius, focusRing.color, focused
64
- ? "\n border-width: ".concat(focusRing.width, ";\n padding: ").concat(focusRing.distance, ";\n margin: -").concat(pxToNumber(focusRing.width) +
65
- pxToNumber(focusRing.distance), "px;")
58
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, focused = _a.focused;
59
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n align-self: stretch;\n border-radius: ", ";\n border-width: 0;\n border-style: solid;\n border-color: ", ";\n flex-direction: row;\n\n ", "\n "], ["\n align-self: stretch;\n border-radius: ", ";\n border-width: 0;\n border-style: solid;\n border-color: ", ";\n flex-direction: row;\n\n ", "\n "])), core.radius.small, semantic.border.functional, focused
60
+ ? "\n border-width: ".concat(core.borderWidth.small, ";\n border-color: ").concat(semantic.focus.outline, ";\n padding: 2px;\n margin: -4px;")
66
61
  : null);
67
62
  });
68
63
  var StyledInput = styled.TextInput(function (_a) {
69
- var input = _a.theme.input, invalid = _a.invalid, smallAndUp = _a.smallAndUp, iconLeft = _a.iconLeft, iconRight = _a.iconRight, hasRightSlot = _a.hasRightSlot;
70
- var fontSize = smallAndUp ? input.fontSize[1] : input.fontSize[0];
64
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, invalid = _a.invalid, smallAndUp = _a.smallAndUp, iconLeft = _a.iconLeft, iconRight = _a.iconRight, hasRightSlot = _a.hasRightSlot;
65
+ var fontSize = smallAndUp
66
+ ? core.fontSize.body.large
67
+ : core.fontSize.body.small;
71
68
  var errorStyles = invalid
72
- ? "\n border-width: ".concat(input.error.borderWidth, ";\n border-color: ").concat(input.error.color, ";\n ")
69
+ ? "\n border-color: ".concat(semantic.message.error, ";\n ")
73
70
  : '';
74
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid ", ";\n background: ", ";\n border-radius: ", ";\n padding: ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "], ["\n font-family: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid ", ";\n background: ", ";\n border-radius: ", ";\n padding: ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "])), input.fontFamily, input.fontWeight, input.color, fontSize, input.height, input.borderWidth, input.borderColor, input.background, input.borderRadius, input.padding, iconLeft ? "padding-left: ".concat(input.height, ";") : '', iconRight || hasRightSlot ? "padding-right: ".concat(input.height, ";") : '', errorStyles);
71
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n font-family: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid ", ";\n border-radius: ", ";\n padding: 0 ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "], ["\n font-family: ", ";\n color: ", ";\n font-size: ", ";\n height: ", ";\n line-height: 18px; /* Corrects for responsive line height in fixed height input */\n border: ", " solid ", ";\n border-radius: ", ";\n padding: 0 ", ";\n flex: 1;\n\n ", "\n ", "\n\n ", "\n "])), core.fontFamily.body.native, semantic.message.base, fontSize, core.space[11], core.borderWidth.small, semantic.border.functional, core.radius.small, core.space[2], iconLeft ? "padding-left: ".concat(core.space[8], ";") : '', iconRight || hasRightSlot ? "padding-right: ".concat(core.space[8], ";") : '', errorStyles);
75
72
  });
76
73
  export { Input };
77
74
  var templateObject_1, templateObject_2, templateObject_3;
@@ -4,11 +4,8 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
4
4
  };
5
5
  import { Pressable } from 'react-native';
6
6
  import styled, { css } from '../../styled.native';
7
- import { pxToNumber } from '../../utils';
8
7
  export var StyledPressable = styled(Pressable)(function (_a) {
9
- var _b = _a.theme, input = _b.input, focusRing = _b.focusRing, focused = _a.focused;
10
- var distance = (pxToNumber(input.height) - pxToNumber(input.icon.size)) / 2 +
11
- (focused ? pxToNumber(focusRing.distance) : 0);
12
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", "px;\n right: ", "px;\n "], ["\n display: flex;\n align-items: center;\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", "px;\n right: ", "px;\n "])), input.icon.size, distance, distance);
8
+ var core = _a.theme.core, focused = _a.focused;
9
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", ";\n right: ", ";\n "], ["\n display: flex;\n align-items: center;\n position: absolute;\n width: ", ";\n z-index: 1;\n top: ", ";\n right: ", ";\n "])), core.space[4], focused ? '16px' : '14px', core.space[3]);
13
10
  });
14
11
  var templateObject_1;
@@ -1,6 +1,4 @@
1
- import React, { useContext, useState } from 'react';
2
- import { ThemeContext } from '../../styled.native';
3
- import { pxToNumber } from '../../utils';
1
+ import React, { useState } from 'react';
4
2
  import { Icon } from '../Icon';
5
3
  import { StyledPressable } from './PasswordInput.styled';
6
4
  export var useTogglePasswordVisibility = function () {
@@ -15,12 +13,11 @@ export var useTogglePasswordVisibility = function () {
15
13
  };
16
14
  export var PasswordVisibilityToggle = function (_a) {
17
15
  var iconName = _a.iconName, visibilityToggleLabel = _a.visibilityToggleLabel, handlePasswordVisibility = _a.handlePasswordVisibility;
18
- var input = useContext(ThemeContext).input;
19
16
  var _b = useState(false), focused = _b[0], setFocused = _b[1];
20
- return (React.createElement(StyledPressable, { testID: "password-input-visibility-toggle", focused: focused, accessibilityRole: "button", accessibilityLabel: visibilityToggleLabel, onPress: handlePasswordVisibility, hitSlop: pxToNumber(input.icon.size), onFocus: function () {
17
+ return (React.createElement(StyledPressable, { testID: "password-input-visibility-toggle", focused: focused, accessibilityRole: "button", accessibilityLabel: visibilityToggleLabel, onPress: handlePasswordVisibility, hitSlop: 16, onFocus: function () {
21
18
  setFocused(true);
22
19
  }, onBlur: function () {
23
20
  setFocused(false);
24
21
  } },
25
- React.createElement(Icon, { name: iconName, size: pxToNumber(input.icon.size), pointerEvents: "none" })));
22
+ React.createElement(Icon, { name: iconName, size: 16, pointerEvents: "none" })));
26
23
  };
@@ -11,5 +11,5 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import React, { forwardRef } from 'react';
13
13
  import { Input } from './Input';
14
- var TelInput = forwardRef(function (props, ref) { return (React.createElement(Input, __assign({}, props, { keyboardType: "phone-pad", autoCapitalize: "none", autoCorrect: false, ref: ref }))); });
15
- export { TelInput };
14
+ var PhoneInput = forwardRef(function (props, ref) { return (React.createElement(Input, __assign({}, props, { keyboardType: "phone-pad", autoCapitalize: "none", autoCorrect: false, ref: ref }))); });
15
+ export { PhoneInput };
@@ -1,3 +1,7 @@
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
+ };
1
5
  var __assign = (this && this.__assign) || function () {
2
6
  __assign = Object.assign || function(t) {
3
7
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -21,18 +25,16 @@ var __rest = (this && this.__rest) || function (s, e) {
21
25
  return t;
22
26
  };
23
27
  import React, { forwardRef } from 'react';
24
- import { useBreakpoint } from '../../hooks';
25
- import { useTheme } from '../../styled.native';
26
- import { calculateLineHeight } from '../../theme';
28
+ import styled, { css } from '../../styled.native';
27
29
  import { pxToNumber } from '../../utils';
28
30
  import { Input } from './Input';
31
+ var StyledInput = styled(Input)(function (_a) {
32
+ var core = _a.theme.core, rows = _a.rows;
33
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: ", " ", " ", " ", ";\n height: ", "px;\n "], ["\n padding: ", " ", " ", " ", ";\n height: ", "px;\n "])), core.space[3], core.space[2], core.space[2], core.space[2], pxToNumber(core.space[8]) * rows);
34
+ });
29
35
  var TextareaInput = forwardRef(function (_a, ref) {
30
36
  var _b = _a.rows, rows = _b === void 0 ? 3 : _b, rest = __rest(_a, ["rows"]);
31
- var input = useTheme().input;
32
- var smallAndUp = useBreakpoint().smallAndUp;
33
- var height = pxToNumber(input.padding) * 2 +
34
- pxToNumber(calculateLineHeight(smallAndUp ? input.fontSize[1] : input.fontSize[0], input.lineHeight)) *
35
- rows;
36
- return (React.createElement(Input, __assign({}, rest, { keyboardType: "default", multiline: true, textAlignVertical: "top", style: { height: height }, ref: ref })));
37
+ return (React.createElement(StyledInput, __assign({}, rest, { keyboardType: "default", multiline: true, textAlignVertical: "top", rows: rows, ref: ref })));
37
38
  });
38
39
  export { TextareaInput };
40
+ var templateObject_1;
@@ -1,7 +1,7 @@
1
1
  export { CurrencyInput } from './CurrencyInput';
2
2
  export { EmailInput } from './EmailInput';
3
3
  export { NumberInput } from './NumberInput';
4
- export { TelInput } from './TelInput';
4
+ export { PhoneInput } from './PhoneInput';
5
5
  export { TextInput } from './TextInput';
6
6
  export { PasswordInput } from './PasswordInput';
7
7
  export { TextareaInput } from './TextareaInput';
@@ -8,7 +8,7 @@ import { styledComponentWithBreakpoints } from '../../utils';
8
8
  var StyledLabelText = styled.Text(function (_a) {
9
9
  var field = _a.theme.field, smallAndUp = _a.smallAndUp;
10
10
  var fontSize = smallAndUp ? field.fontSize[1] : field.fontSize[0];
11
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n "])), field.label.fontFamily, calculateLineHeight(fontSize, field.lineHeight), field.label.fontWeight, field.label.color, fontSize);
11
+ return css(templateObject_1 || (templateObject_1 = __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 "])), field.label.fontFamily, calculateLineHeight(fontSize, field.lineHeight), field.label.color, fontSize);
12
12
  });
13
13
  var LabelText = styledComponentWithBreakpoints(StyledLabelText);
14
14
  export { LabelText };
@@ -46,7 +46,7 @@ var StyledBullet = styled.Text(function (_a) {
46
46
  var lineHeight = smallAndUp
47
47
  ? list.listItem.lineHeight[1]
48
48
  : list.listItem.lineHeight[0];
49
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize, list.listItem.bulletGap, space[4]);
49
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n margin-right: ", ";\n width: ", ";\n text-align: right;\n "])), text.fontFamily, lineHeight, text.color, fontSize, list.listItem.bulletGap, space[4]);
50
50
  });
51
51
  var StyledUlItem = styled.View(function () { return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: flex-start;\n justify-content: center;\n "], ["\n flex-direction: row;\n align-items: flex-start;\n justify-content: center;\n "]))); });
52
52
  var Bullet = styledComponentWithBreakpoints(StyledBullet);
@@ -87,9 +87,13 @@ var StyledLi = styled.Text(function (_a) {
87
87
  var lineHeight = smallAndUp
88
88
  ? list.listItem.lineHeight[1]
89
89
  : list.listItem.lineHeight[0];
90
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize);
90
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, lineHeight, text.color, fontSize);
91
91
  });
92
92
  var Li = styledComponentWithBreakpoints(StyledLi);
93
+ /**
94
+ * @deprecated This component has been deprecated and will be removed in a future release.
95
+ * Please use the DescriptionList component instead.
96
+ * */
93
97
  var Dl = ListWrapper;
94
98
  var StyledDtText = styled.Text(function (_a) {
95
99
  var list = _a.theme.list, smallAndUp = _a.smallAndUp;
@@ -99,7 +103,7 @@ var StyledDtText = styled.Text(function (_a) {
99
103
  var lineHeight = smallAndUp
100
104
  ? list.listItem.lineHeight[1]
101
105
  : list.listItem.lineHeight[0];
102
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n font-weight: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), list.descriptionTerm.fontFamily, list.descriptionTerm.fontWeight, lineHeight, list.descriptionTerm.color, fontSize);
106
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), list.descriptionTerm.fontFamily, lineHeight, list.descriptionTerm.color, fontSize);
103
107
  });
104
108
  var DtText = styledComponentWithBreakpoints(StyledDtText);
105
109
  var StyledDtItem = styled.View(function (_a) {
@@ -113,6 +117,10 @@ var StyledDtItem = styled.View(function (_a) {
113
117
  return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: ", ";\n margin-bottom: ", ";\n flex-direction: row;\n "], ["\n margin-top: ", ";\n margin-bottom: ", ";\n flex-direction: row;\n "])), marginTop, marginBottom);
114
118
  });
115
119
  var DtItem = styledComponentWithBreakpoints(StyledDtItem);
120
+ /**
121
+ * @deprecated This component has been deprecated and will be removed in a future release.
122
+ * Please use the DescriptionList component instead.
123
+ * */
116
124
  var Dt = function (_a) {
117
125
  var children = _a.children, rest = __rest(_a, ["children"]);
118
126
  return (React.createElement(DtItem, __assign({}, rest),
@@ -126,13 +134,17 @@ var StyledDdText = styled.Text(function (_a) {
126
134
  var lineHeight = smallAndUp
127
135
  ? list.listItem.lineHeight[1]
128
136
  : list.listItem.lineHeight[0];
129
- return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, lineHeight, text.fontWeight, text.color, fontSize);
137
+ return css(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "], ["\n font-family: ", ";\n line-height: ", ";\n color: ", ";\n font-size: ", ";\n flex: 1;\n "])), text.fontFamily, lineHeight, text.color, fontSize);
130
138
  });
139
+ /**
140
+ * @deprecated This component has been deprecated and will be removed in a future release.
141
+ * Please use the DescriptionList component instead.
142
+ * */
131
143
  var Dd = function (_a) {
132
144
  var children = _a.children, rest = __rest(_a, ["children"]);
133
145
  var breakpoints = useBreakpoint();
134
146
  return (React.createElement(View, __assign({ style: { flexDirection: 'row' } }, rest),
135
147
  React.createElement(StyledDdText, __assign({}, breakpoints), children)));
136
148
  };
137
- export { Ul, Ol, Li, Dl, Dt, Dd };
149
+ export { Ul, Ol, Li, Dl, Dt, Dd, ListWrapper };
138
150
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
@@ -13,8 +13,8 @@ var BackIcon = function () {
13
13
  React.createElement(Path, { d: "M0.579956 8L8.57996 16L9.99996 14.58L3.41996 8L9.99996 1.42L8.57996 0L0.579956 8Z", fill: "white" })));
14
14
  };
15
15
  var StyledText = styled.Text(function (_a) {
16
- var _b = _a.theme, colors = _b.colors, fonts = _b.fonts, fontWeights = _b.fontWeights, fontSizes = _b.fontSizes;
17
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-family: ", ";\n "], ["\n color: ", ";\n font-size: ", ";\n font-weight: ", ";\n font-family: ", ";\n "])), colors.primaryContrast, fontSizes[1], fontWeights.normal, fonts.body);
16
+ var _b = _a.theme, colors = _b.colors, fonts = _b.fonts, fontSizes = _b.fontSizes;
17
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: ", ";\n font-size: ", ";\n font-family: ", ";\n "], ["\n color: ", ";\n font-size: ", ";\n font-family: ", ";\n "])), colors.primaryContrast, fontSizes[1], fonts.body);
18
18
  });
19
19
  var LeftHeaderText = styled(StyledText)(function (_a) {
20
20
  var space = _a.theme.space;
@@ -33,8 +33,8 @@ var StyledView = styled(Animated.View)(function (_a) {
33
33
  return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n padding: ", ";\n padding-bottom: ", ";\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n margin-top: ", ";\n "], ["\n padding: ", ";\n padding-bottom: ", ";\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n margin-top: ", ";\n "])), space[3], space[2], marginTop !== null && marginTop !== void 0 ? marginTop : 0);
34
34
  });
35
35
  var StyledHeading4 = styled(Heading4)(function (_a) {
36
- var _b = _a.theme, fonts = _b.fonts, fontWeights = _b.fontWeights, colors = _b.colors, textAlign = _a.textAlign;
37
- return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n font-weight: ", ";\n margin-top: 0;\n margin-bottom: 0;\n color: ", ";\n text-align: ", ";\n "], ["\n font-family: ", ";\n font-weight: ", ";\n margin-top: 0;\n margin-bottom: 0;\n color: ", ";\n text-align: ", ";\n "])), fonts.bold, fontWeights.bold, colors.primaryContrast, textAlign);
36
+ var _b = _a.theme, fonts = _b.fonts, colors = _b.colors, textAlign = _a.textAlign;
37
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n font-family: ", ";\n margin-top: 0;\n margin-bottom: 0;\n color: ", ";\n text-align: ", ";\n "], ["\n font-family: ", ";\n margin-top: 0;\n margin-bottom: 0;\n color: ", ";\n text-align: ", ";\n "])), fonts.bold, colors.primaryContrast, textAlign);
38
38
  });
39
39
  var StyledHeading3 = styled(Heading3)(function (_a) {
40
40
  var colors = _a.theme.colors;
@@ -24,69 +24,57 @@ var __rest = (this && this.__rest) || function (s, e) {
24
24
  }
25
25
  return t;
26
26
  };
27
- import React, { forwardRef, useContext, useState, } from 'react';
27
+ import React, { forwardRef, useState } from 'react';
28
28
  import { View } from 'react-native';
29
- import { useBreakpoint } from '../../hooks';
30
- import styled, { css, ThemeContext } from '../../styled.native';
29
+ import styled, { css } from '../../styled.native';
31
30
  import { Icon } from '../Icon';
32
- var pxToNumber = function (value) { return parseInt(value.replace('px', '')); };
33
- var numberToPx = function (value) { return "".concat(value, "px"); };
34
31
  var NotificationBox = styled.View(function (_a) {
35
- var _b = _a.theme, colors = _b.colors, notification = _b.notification, space = _b.space, variant = _a.variant, noMargin = _a.noMargin;
36
- // @ts-ignore
37
- var currentVariant = notification.variants[variant];
38
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n border: ", " solid ", ";\n border-radius: ", ";\n margin-bottom: ", ";\n background-color: ", ";\n "], ["\n position: relative;\n border: ", " solid ", ";\n border-radius: ", ";\n margin-bottom: ", ";\n background-color: ", ";\n "])), notification.borderWidth, currentVariant.borderColor, notification.borderRadius, noMargin ? 0 : space[4], colors.canvas);
32
+ var core = _a.theme.core, noMargin = _a.noMargin;
33
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n border: ", " solid ", ";\n border-radius: ", ";\n margin-bottom: ", ";\n overflow: hidden;\n "], ["\n position: relative;\n border: ", " solid ", ";\n border-radius: ", ";\n margin-bottom: ", ";\n overflow: hidden;\n "])), core.borderWidth.medium, core.color.brand.white, core.radius.small, noMargin ? 0 : core.space[4]);
39
34
  });
40
35
  export var NotificationContentBox = styled.View(function (_a) {
41
- var _b = _a.theme, colors = _b.colors, _c = _b.notification, paddingX = _c.paddingX, paddingY = _c.paddingY, variants = _c.variants, smallAndUp = _a.smallAndUp, variant = _a.variant;
42
- // @ts-ignore
43
- var currentVariant = variants[variant];
44
- return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n padding: ", " ", ";\n\n a {\n color: ", ";\n :hover {\n color: ", ";\n }\n }\n ul {\n list-style-type: square;\n }\n li {\n color: ", ";\n }\n "], ["\n padding: ", " ", ";\n\n a {\n color: ", ";\n :hover {\n color: ", ";\n }\n }\n ul {\n list-style-type: square;\n }\n li {\n color: ", ";\n }\n "])), paddingX[smallAndUp ? 1 : 0], paddingY[smallAndUp ? 1 : 0], currentVariant.textColor, colors.body, currentVariant.textColor);
36
+ var core = _a.theme.core;
37
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "])), core.color.brand.white, core.space[2], core.space[3], core.space[4], core.space[4]);
45
38
  });
46
39
  export var NotificationTitleBox = styled.View(function (_a) {
47
- var notification = _a.theme.notification, variant = _a.variant, dismissable = _a.dismissable, smallAndUp = _a.smallAndUp;
48
- // @ts-ignore to support additional palettes.
49
- var currentVariant = notification.variants[variant];
50
- return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "])), currentVariant.background, notification.paddingX[smallAndUp ? 1 : 0], notification.paddingX[smallAndUp ? 1 : 0], notification.paddingY[smallAndUp ? 1 : 0], dismissable
51
- ? numberToPx(pxToNumber(notification.dismiss.touchSize) -
52
- pxToNumber(notification.dismiss.size))
53
- : notification.paddingY[smallAndUp ? 1 : 0]);
40
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, variant = _a.variant, dismissible = _a.dismissible;
41
+ var currentVariant = semantic[variant];
42
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "], ["\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n "])), currentVariant.surface, core.space[2], core.space[2], core.space[4], dismissible ? core.space[3] : core.space[4]);
54
43
  });
55
44
  var NotificationTitleText = styled.Text(function (_a) {
56
- var _b = _a.theme, fonts = _b.fonts, fontWeights = _b.fontWeights, responsiveFontSizes = _b.responsiveFontSizes, notification = _b.notification, variant = _a.variant;
57
- // @ts-ignore
58
- var currentVariant = notification.variants[variant];
59
- return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n "], ["\n color: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n "])), currentVariant.textColor, fonts.bold, fontWeights.bold, responsiveFontSizes.body[0]);
45
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, variant = _a.variant;
46
+ var currentVariant = semantic[variant];
47
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-size: ", ";\n font-family: ", ";\n color: ", ";\n "], ["\n font-size: ", ";\n font-family: ", ";\n color: ", ";\n "])), core.fontSize.body.small, core.fontFamily.bodyBold.native, currentVariant.message);
60
48
  });
61
- var DismissButton = styled.TouchableOpacity(function (_a) {
62
- var notification = _a.theme.notification;
63
- return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n right: 0;\n width: ", ";\n height: ", ";\n align-items: center;\n justify-content: center;\n "], ["\n position: absolute;\n top: 0;\n right: 0;\n width: ", ";\n height: ", ";\n align-items: center;\n justify-content: center;\n "])), notification.dismiss.touchSize, notification.dismiss.touchSize);
49
+ var DismissButton = styled.TouchableOpacity(function () {
50
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 16px;\n height: 16px;\n margin-left: auto;\n "], ["\n width: 16px;\n height: 16px;\n margin-left: auto;\n "])));
51
+ });
52
+ var StyledIcon = styled(Icon)(function (_a) {
53
+ var semantic = _a.theme.semantic, variant = _a.variant;
54
+ var currentVariant = semantic[variant];
55
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n color: ", ";\n "], ["\n color: ", ";\n "])), currentVariant.message);
64
56
  });
65
57
  export var Notification = forwardRef(function (_a, ref) {
66
- var _b = _a.variant, variant = _b === void 0 ? 'info' : _b, children = _a.children, title = _a.title, noMargin = _a.noMargin, dismissable = _a.dismissable, onDismiss = _a.onDismiss, rest = __rest(_a, ["variant", "children", "title", "noMargin", "dismissable", "onDismiss"]);
67
- var breakpoints = useBreakpoint();
68
- var theme = useContext(ThemeContext);
58
+ var _b = _a.variant, variant = _b === void 0 ? 'info' : _b, children = _a.children, title = _a.title, noMargin = _a.noMargin, dismissible = _a.dismissible, onDismiss = _a.onDismiss, rest = __rest(_a, ["variant", "children", "title", "noMargin", "dismissible", "onDismiss"]);
69
59
  var _c = useState(false), dismissed = _c[0], setDismissed = _c[1];
70
- if (dismissed || (!title && !children)) {
60
+ if (dismissed || !children) {
71
61
  return null;
72
62
  }
73
63
  return (React.createElement(View, __assign({ ref: ref }, rest),
74
- React.createElement(NotificationBox, __assign({ variant: variant, noMargin: noMargin, testID: "nb-notification" }, breakpoints),
75
- !!title ? (React.createElement(NotificationTitleBox, __assign({ variant: variant, dismissable: dismissable }, breakpoints),
76
- React.createElement(View, null, typeof title === 'string' ? (React.createElement(NotificationTitleText, { variant: variant }, title)) : (title)))) : null,
77
- dismissable ? (React.createElement(DismissButton, { accessibilityLabel: "Dismiss", testID: "nb-notification-dismiss", onPress: function () {
78
- setDismissed(true);
79
- if (onDismiss) {
80
- onDismiss();
81
- }
82
- } },
83
- React.createElement(Icon, { name: theme.notification.dismiss.icon, size: theme.notification.dismiss.size,
84
- // @ts-ignore
85
- color: theme.notification.variants[variant].textColor }))) : null,
86
- children ? (React.createElement(NotificationContentBox, __assign({ "data-testid": "el-notification-box", variant: variant }, breakpoints), children)) : null)));
64
+ React.createElement(NotificationBox, { noMargin: noMargin, testID: "nb-notification" },
65
+ React.createElement(NotificationTitleBox, { variant: variant, dismissible: dismissible },
66
+ React.createElement(NotificationTitleText, { variant: variant }, title),
67
+ dismissible ? (React.createElement(DismissButton, { accessibilityLabel: "Dismiss", testID: "nb-notification-dismiss", onPress: function () {
68
+ setDismissed(true);
69
+ if (onDismiss) {
70
+ onDismiss();
71
+ }
72
+ } },
73
+ React.createElement(StyledIcon, { variant: variant, name: "cross", size: "16" }))) : null),
74
+ children ? (React.createElement(NotificationContentBox, { "data-testid": "el-notification-box" }, children)) : null)));
87
75
  });
88
- export var ErrorNotification = forwardRef(function (props, ref) { return (React.createElement(Notification, __assign({ ref: ref, variant: "error", title: "Oops, there\u2019s a problem\u2026" }, props))); });
76
+ export var ErrorNotification = forwardRef(function (props, ref) { return React.createElement(Notification, __assign({ ref: ref, variant: "error" }, props)); });
89
77
  export var SuccessNotification = forwardRef(function (props, ref) { return (React.createElement(Notification, __assign({ ref: ref, variant: "success" }, props))); });
90
78
  export var InfoNotification = forwardRef(function (props, ref) { return React.createElement(Notification, __assign({ ref: ref, variant: "info" }, props)); });
91
79
  export var WarningNotification = forwardRef(function (props, ref) { return React.createElement(Notification, __assign({ ref: ref, variant: "warning" }, props)); });
92
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
80
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
@@ -1,7 +1,3 @@
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
1
  var __assign = (this && this.__assign) || function () {
6
2
  __assign = Object.assign || function(t) {
7
3
  for (var s, i = 1, n = arguments.length; i < n; i++) {
@@ -27,33 +23,23 @@ var __rest = (this && this.__rest) || function (s, e) {
27
23
  import React, { forwardRef } from 'react';
28
24
  import { TouchableOpacity, View, } from 'react-native';
29
25
  import styled from '../../styled.native';
30
- import { pxToNumber } from '../../utils';
31
26
  import { HintText } from '../HintText';
32
27
  import { LabelText } from '../LabelText';
33
28
  var StyledRadioInputWrapper = styled.View(function (_a) {
34
- var radio = _a.theme.radio;
35
- var radioSize = pxToNumber(radio.size);
36
- var gap = pxToNumber(radio.gap);
37
- return "\n width: ".concat(radioSize + gap, "px;\n height: ").concat(radio.touchSize, ";\n ");
29
+ var core = _a.theme.core;
30
+ return "\n width: ".concat(core.space[6], ";\n height: ").concat(core.space[6], ";\n margin-right: 10px;\n ");
38
31
  });
39
32
  var StyledRadioInput = styled.View(function (_a) {
40
- var radio = _a.theme.radio, invalid = _a.invalid, checked = _a.checked;
41
- var touchSize = pxToNumber(radio.touchSize);
42
- var radioSize = pxToNumber(radio.size);
43
- var radioDistance = (touchSize - radioSize) / 2;
44
- return "\n width: ".concat(radio.size, ";\n height: ").concat(radio.size, ";\n border: ").concat(radio.borderWidth, " solid;\n margin-top: ").concat(radioDistance, "px;\n border-radius: ").concat(radioSize / 2, "px;\n border-color: ").concat(invalid
45
- ? radio.errorColor
33
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, invalid = _a.invalid, checked = _a.checked;
34
+ return "\n width: ".concat(core.space[6], ";\n height: ").concat(core.space[6], ";\n border: ").concat(core.borderWidth.small, " solid;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n border-color: ").concat(invalid
35
+ ? semantic.error.border
46
36
  : checked
47
- ? radio.dotColor
48
- : radio.borderColor, ";\n background: ").concat(radio.background, ";\n background: ").concat(checked ? radio.checkedBackground : radio.background, ";\n ");
37
+ ? core.color.blue.dark
38
+ : semantic.border.functional, ";\n background: ").concat(checked ? core.color.blue.lightest : 'transparent', ";\n ");
49
39
  });
50
40
  var StyledRadioInputDot = styled.View(function (_a) {
51
- var radio = _a.theme.radio, checked = _a.checked;
52
- var radioSize = pxToNumber(radio.size);
53
- var dotSize = pxToNumber(radio.dotSize);
54
- var borderWidth = pxToNumber(radio.borderWidth);
55
- var dotDistance = (radioSize - dotSize) / 2 - borderWidth;
56
- return "\n width: ".concat(radio.dotSize, ";\n height: ").concat(radio.dotSize, ";\n margin: ").concat(dotDistance, "px;\n border-radius: ").concat(radioSize / 2, "px;\n background: ").concat(radio.dotColor, ";\n opacity: ").concat(checked ? 1 : 0, ";\n ");
41
+ var core = _a.theme.core, checked = _a.checked;
42
+ return "\n width: ".concat(core.space[3], ";\n height: ").concat(core.space[3], ";\n border-radius: 50%;\n background: ").concat(core.color.blue.dark, ";\n opacity: ").concat(checked ? 1 : 0, ";\n ");
57
43
  });
58
44
  var Input = function (_a) {
59
45
  var checked = _a.checked, invalid = _a.invalid, testID = _a.testID, rest = __rest(_a, ["checked", "invalid", "testID"]);
@@ -61,11 +47,10 @@ var Input = function (_a) {
61
47
  React.createElement(StyledRadioInput, { invalid: invalid, checked: checked, testID: testID },
62
48
  React.createElement(StyledRadioInputDot, { checked: checked }))));
63
49
  };
64
- var RadioLabelText = styled(LabelText)(function (_a) {
65
- var space = _a.theme.space;
66
- return "\n padding-top: ".concat(space[3], ";\n ");
50
+ var StyledWrapper = styled.View(function (_a) {
51
+ var core = _a.theme.core;
52
+ return "\n padding-top: ".concat(core.space[3], ";\n flex-direction: row;\n ");
67
53
  });
68
- var StyledWrapper = styled.View(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: row;\n"], ["\n flex-direction: row;\n"])));
69
54
  var Radio = forwardRef(function (_a, ref) {
70
55
  var label = _a.label, hint = _a.hint, checked = _a.checked, invalid = _a.invalid,
71
56
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -76,8 +61,7 @@ var Radio = forwardRef(function (_a, ref) {
76
61
  React.createElement(StyledWrapper, null,
77
62
  React.createElement(Input, { checked: checked, invalid: invalid, testID: testID }),
78
63
  React.createElement(View, { style: { flexShrink: 1 } },
79
- React.createElement(RadioLabelText, null, label),
64
+ React.createElement(LabelText, null, label),
80
65
  hint ? React.createElement(HintText, null, hint) : null))));
81
66
  });
82
67
  export { Radio };
83
- var templateObject_1;
@@ -0,0 +1,74 @@
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
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
6
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
7
+ if (ar || !(i in from)) {
8
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
9
+ ar[i] = from[i];
10
+ }
11
+ }
12
+ return to.concat(ar || Array.prototype.slice.call(from));
13
+ };
14
+ import React, { useState } from 'react';
15
+ import { Modal, ScrollView, View } from 'react-native';
16
+ import styled, { css } from '../../styled.native';
17
+ import { Icon } from '../Icon';
18
+ import { P, Strong } from '../Text';
19
+ var SelectInput = styled.TouchableOpacity(function (_a) {
20
+ var _b = _a.theme, semantic = _b.semantic, core = _b.core, hasError = _a.hasError;
21
+ return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n border-color: ", ";\n border-width: ", "\n border-radius: ", ";\n padding-vertical: ", "\n padding-left: ", "\n padding-right: 14px;\n height: 44px;\n "], ["\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n border-color: ", ";\n border-width: ", "\n border-radius: ", ";\n padding-vertical: ", "\n padding-left: ", "\n padding-right: 14px;\n height: 44px;\n "])), core.color.brand.white, hasError ? semantic.error.border : semantic.border.functional, core.borderWidth.small, core.radius.small, core.space[2], core.space[2]);
22
+ });
23
+ var DropdownWrapper = styled.View(function (_a) {
24
+ var core = _a.theme.core;
25
+ return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n flex: 1;\n justify-content: center;\n align-items: center;\n // 40 is an opacity for hex https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4\n background-color: ", "40;\n "], ["\n flex: 1;\n justify-content: center;\n align-items: center;\n // 40 is an opacity for hex https://gist.github.com/lopspower/03fb1cc0ac9f32ef38f4\n background-color: ", "40;\n "])), core.color.neutral.darkest);
26
+ });
27
+ var DropdownContainer = styled.SafeAreaView(function (_a) {
28
+ var core = _a.theme.core;
29
+ return css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 95%;\n max-height: 70%;\n border-radius: ", ";\n background-color: ", ";\n "], ["\n width: 95%;\n max-height: 70%;\n border-radius: ", ";\n background-color: ", ";\n "])), core.radius.small, core.color.brand.white);
30
+ });
31
+ var SelectOption = styled.TouchableOpacity(function (_a) {
32
+ var _b = _a.theme, semantic = _b.semantic, core = _b.core, isLastOption = _a.isLastOption;
33
+ return css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n flex-direction: row;\n align-items: center;\n border-bottom-color: ", ";\n border-bottom-width: ", "px;\n padding-horizontal: ", ";\n "], ["\n flex-direction: row;\n align-items: center;\n border-bottom-color: ", ";\n border-bottom-width: ", "px;\n padding-horizontal: ", ";\n "])), semantic.border.differentiated, isLastOption ? 0 : 1, core.space[4]);
34
+ });
35
+ var Radio = styled.View(function (_a) {
36
+ var _b = _a.theme, core = _b.core, semantic = _b.semantic, isChecked = _a.isChecked;
37
+ return css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 24px;\n height: 24px;\n margin-left: auto;\n border-radius: 24px;\n border-width: ", ";\n border-color: ", ";\n "], ["\n width: 24px;\n height: 24px;\n margin-left: auto;\n border-radius: 24px;\n border-width: ", ";\n border-color: ", ";\n "])), core.borderWidth.small, isChecked
38
+ ? semantic.focus.outline
39
+ : semantic.border.functional);
40
+ });
41
+ var RadioDot = styled.View(function (_a) {
42
+ var semantic = _a.theme.semantic, isChecked = _a.isChecked;
43
+ return css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n position: absolute;\n top: 5px;\n width: 12px;\n height: 12px;\n border-radius: 12px;\n align-self: center;\n opacity: ", ";\n "], ["\n background-color: ", ";\n position: absolute;\n top: 5px;\n width: 12px;\n height: 12px;\n border-radius: 12px;\n align-self: center;\n opacity: ", ";\n "])), semantic.focus.outline, isChecked ? 1 : 0);
44
+ });
45
+ var StyledP = styled(P)(function (_a) {
46
+ var core = _a.theme.core;
47
+ return css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: ", ";\n "], ["\n margin-top: ", ";\n "])), core.space[3]);
48
+ });
49
+ export var Select = function (_a) {
50
+ var _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.defaultSelected, defaultSelected = _c === void 0 ? { label: '', value: 'default' } : _c, _d = _a.noOptionMessage, noOptionMessage = _d === void 0 ? 'No option selected' : _d, _e = _a.onSelected, onSelected = _e === void 0 ? function () { return null; } : _e, _f = _a.hasError, hasError = _f === void 0 ? false : _f, _g = _a.testID, testID = _g === void 0 ? 'select' : _g;
51
+ var _h = useState(false), isOpen = _h[0], setOpen = _h[1];
52
+ var _j = useState(defaultSelected), selected = _j[0], setSelected = _j[1];
53
+ var handleOptionPress = function (val) {
54
+ onSelected(val);
55
+ setOpen(false);
56
+ setSelected(val);
57
+ };
58
+ var extendedOptions = __spreadArray([
59
+ { label: "-- ".concat(noOptionMessage, " --"), value: 'default' }
60
+ ], options, true);
61
+ return (React.createElement(View, null,
62
+ React.createElement(SelectInput, { testID: testID, hasError: hasError, onPress: function () { return setOpen(!isOpen); } },
63
+ React.createElement(P, { style: { marginTop: 0, marginBottom: 0 } }, selected.value === 'default' ? '' : selected.label),
64
+ React.createElement(Icon, { name: "chevron-down", size: 16, style: { marginLeft: 'auto' } })),
65
+ React.createElement(Modal, { transparent: true, visible: isOpen, animationType: "fade", onRequestClose: function () { return setOpen(false); } },
66
+ React.createElement(DropdownWrapper, null,
67
+ React.createElement(DropdownContainer, null,
68
+ React.createElement(ScrollView, { nestedScrollEnabled: true }, extendedOptions.map(function (option, i) { return (React.createElement(SelectOption, { key: option.label, accessibilityRole: "radio", isLastOption: i === extendedOptions.length - 1, onPress: function () { return handleOptionPress(option); } },
69
+ React.createElement(StyledP, null,
70
+ React.createElement(Strong, null, option.label)),
71
+ React.createElement(Radio, { isChecked: selected.value === option.value },
72
+ React.createElement(RadioDot, { isChecked: selected.value === option.value })))); })))))));
73
+ };
74
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
@@ -0,0 +1,31 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import React from 'react';
24
+ import { Field } from '../Field';
25
+ import { Select } from './Select';
26
+ export var SelectField = function (_a) {
27
+ var error = _a.error, options = _a.options, onSelected = _a.onSelected, noOptionMessage = _a.noOptionMessage, defaultSelected = _a.defaultSelected, testID = _a.testID, rest = __rest(_a, ["error", "options", "onSelected", "noOptionMessage", "defaultSelected", "testID"]);
28
+ return (React.createElement(Field, __assign({ affixWidth: 20, error: error }, rest),
29
+ React.createElement(React.Fragment, null,
30
+ React.createElement(Select, { onSelected: onSelected, options: options, noOptionMessage: noOptionMessage, defaultSelected: defaultSelected, hasError: Boolean(error), testID: testID }))));
31
+ };
@@ -0,0 +1 @@
1
+ export { SelectField } from './SelectField';
@@ -8,7 +8,7 @@ import { styledComponentWithBreakpoints } from '../../utils';
8
8
  var StyledSubLabelText = styled.Text(function (_a) {
9
9
  var field = _a.theme.field, smallAndUp = _a.smallAndUp;
10
10
  var fontSize = smallAndUp ? field.fontSize[1] : field.fontSize[0];
11
- return css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n "], ["\n font-family: ", ";\n line-height: ", ";\n font-weight: ", ";\n color: ", ";\n font-size: ", ";\n "])), field.fontFamily, calculateLineHeight(fontSize, field.lineHeight), field.subLabel.fontWeight, field.subLabel.color, fontSize);
11
+ return css(templateObject_1 || (templateObject_1 = __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 "])), field.fontFamily, calculateLineHeight(fontSize, field.lineHeight), field.subLabel.color, fontSize);
12
12
  });
13
13
  var SubLabelText = styledComponentWithBreakpoints(StyledSubLabelText);
14
14
  export { SubLabelText };