@gympass/yoga 7.65.0 → 7.66.1

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 (234) hide show
  1. package/cjs/Dialog/web/Dialog.js +12 -7
  2. package/cjs/Drawer/web/Drawer.js +5 -1
  3. package/cjs/Input/index.js +1 -0
  4. package/cjs/Input/web/Input.js +8 -3
  5. package/cjs/Input/web/Phone.js +144 -0
  6. package/cjs/Input/web/Phone.style.js +41 -0
  7. package/cjs/Input/web/data-images.js +10 -0
  8. package/cjs/Input/web/index.js +4 -0
  9. package/cjs/hooks/index.js +8 -0
  10. package/cjs/hooks/useCombinedRefs.js +32 -0
  11. package/esm/Accordion/web/Accordion.test.js +19 -0
  12. package/esm/ActionRequirement/index.native.js +2 -0
  13. package/esm/ActionRequirement/native/ActionRequirement.js +48 -0
  14. package/esm/ActionRequirement/native/ActionRequirement.test.js +45 -0
  15. package/esm/ActionRequirement/native/ActionRequirementStyles.js +25 -0
  16. package/esm/ActionRequirement/native/index.js +6 -0
  17. package/esm/ActionRequirement/web/ActionRequirement.test.js +36 -0
  18. package/esm/AutoComplete/web/AutoComplete.test.js +139 -0
  19. package/esm/Avatar/index.native.js +4 -0
  20. package/esm/Avatar/native/Avatar.js +96 -0
  21. package/esm/Avatar/native/Avatar.test.js +46 -0
  22. package/esm/Avatar/native/AvatarCircle.js +24 -0
  23. package/esm/Avatar/web/Avatar.test.js +63 -0
  24. package/esm/Banner/index.native.js +2 -0
  25. package/esm/Banner/native/Banner.js +128 -0
  26. package/esm/Banner/native/Banner.test.js +103 -0
  27. package/esm/Banner/native/index.js +2 -0
  28. package/esm/Banner/web/Banner.test.js +109 -0
  29. package/esm/BottomSheet/web/BottomSheet.test.js +48 -0
  30. package/esm/Box/index.native.js +2 -0
  31. package/esm/Box/native/Box.js +4 -0
  32. package/esm/Box/native/Box.test.js +16 -0
  33. package/esm/Box/native/index.js +2 -0
  34. package/esm/Box/web/Box.test.js +16 -0
  35. package/esm/Button/index.native.js +8 -0
  36. package/esm/Button/native/Button.js +110 -0
  37. package/esm/Button/native/Button.test.js +475 -0
  38. package/esm/Button/native/Icon.js +82 -0
  39. package/esm/Button/native/Link.js +35 -0
  40. package/esm/Button/native/Text.js +74 -0
  41. package/esm/Button/native/withTouchable.js +63 -0
  42. package/esm/Button/web/Button.test.js +772 -0
  43. package/esm/Card/index.native.js +2 -0
  44. package/esm/Card/native/Card/Actions.js +12 -0
  45. package/esm/Card/native/Card/Card.js +92 -0
  46. package/esm/Card/native/Card/Card.test.js +15 -0
  47. package/esm/Card/native/Card/Content.js +8 -0
  48. package/esm/Card/native/Card/Header.js +8 -0
  49. package/esm/Card/native/Card/index.js +8 -0
  50. package/esm/Card/native/EventCard/EventCard.js +169 -0
  51. package/esm/Card/native/EventCard/EventCard.test.js +65 -0
  52. package/esm/Card/native/EventCard/index.js +2 -0
  53. package/esm/Card/native/GymCard/CheckIn/Avatar.js +17 -0
  54. package/esm/Card/native/GymCard/CheckIn/CheckIn.js +66 -0
  55. package/esm/Card/native/GymCard/CheckIn/CheckIn.test.js +39 -0
  56. package/esm/Card/native/GymCard/CheckIn/Content.js +11 -0
  57. package/esm/Card/native/GymCard/CheckIn/Header.js +11 -0
  58. package/esm/Card/native/GymCard/CheckIn/index.js +2 -0
  59. package/esm/Card/native/GymCard/index.js +5 -0
  60. package/esm/Card/native/PlanCard/Actions.js +22 -0
  61. package/esm/Card/native/PlanCard/Content.js +75 -0
  62. package/esm/Card/native/PlanCard/List.js +73 -0
  63. package/esm/Card/native/PlanCard/PlanCard.js +51 -0
  64. package/esm/Card/native/PlanCard/PlanCard.test.js +84 -0
  65. package/esm/Card/native/PlanCard/Subtitle.js +15 -0
  66. package/esm/Card/native/PlanCard/Tag.js +34 -0
  67. package/esm/Card/native/PlanCard/index.js +15 -0
  68. package/esm/Card/native/index.js +5 -0
  69. package/esm/Card/web/Card/Card.test.js +14 -0
  70. package/esm/Card/web/EventCard/EventCard.test.js +27 -0
  71. package/esm/Card/web/PlanCard/PlanCard.test.js +94 -0
  72. package/esm/Checkbox/index.native.js +3 -0
  73. package/esm/Checkbox/native/Checkbox.js +179 -0
  74. package/esm/Checkbox/native/Checkbox.test.js +115 -0
  75. package/esm/Checkbox/native/Switch.js +115 -0
  76. package/esm/Checkbox/native/Switch.test.js +54 -0
  77. package/esm/Checkbox/native/index.js +3 -0
  78. package/esm/Checkbox/web/Checkbox.test.js +153 -0
  79. package/esm/Checkbox/web/Switch.test.js +56 -0
  80. package/esm/Chips/index.native.js +2 -0
  81. package/esm/Chips/native/Chips.js +104 -0
  82. package/esm/Chips/native/Chips.test.js +143 -0
  83. package/esm/Chips/native/Counter.js +20 -0
  84. package/esm/Chips/native/index.js +2 -0
  85. package/esm/Chips/web/Chips.test.js +128 -0
  86. package/esm/Datepicker/web/Datepicker.test.js +247 -0
  87. package/esm/Dialog/web/Dialog.js +13 -8
  88. package/esm/Dialog/web/Dialog.test.js +62 -0
  89. package/esm/Divider/index.native.js +2 -0
  90. package/esm/Divider/native/Divider.js +29 -0
  91. package/esm/Divider/native/Divider.test.js +29 -0
  92. package/esm/Divider/native/index.js +2 -0
  93. package/esm/Divider/web/Divider.test.js +29 -0
  94. package/esm/Drawer/web/Drawer.js +6 -2
  95. package/esm/Drawer/web/Drawer.test.js +33 -0
  96. package/esm/Dropdown/index.native.js +2 -0
  97. package/esm/Dropdown/native/Backdrop.js +93 -0
  98. package/esm/Dropdown/native/Backdrop.test.js +26 -0
  99. package/esm/Dropdown/native/Dropdown.js +142 -0
  100. package/esm/Dropdown/native/Dropdown.test.js +78 -0
  101. package/esm/Dropdown/native/Options.android.js +66 -0
  102. package/esm/Dropdown/native/Options.ios.js +71 -0
  103. package/esm/Dropdown/native/index.js +2 -0
  104. package/esm/Dropdown/web/Dropdown.test.js +93 -0
  105. package/esm/Feedback/web/Feedback.test.js +83 -0
  106. package/esm/Grid/web/Col.test.js +48 -0
  107. package/esm/Grid/web/Container.test.js +14 -0
  108. package/esm/Grid/web/Hide.test.js +31 -0
  109. package/esm/Grid/web/Row.test.js +14 -0
  110. package/esm/Header/web/Header.test.js +38 -0
  111. package/esm/Heading/web/Heading.test.js +58 -0
  112. package/esm/Icon/index.native.js +2 -0
  113. package/esm/Icon/native/Icon.test.js +47 -0
  114. package/esm/Icon/native/index.js +2 -0
  115. package/esm/Icon/web/Icon.test.js +47 -0
  116. package/esm/Input/index.js +2 -1
  117. package/esm/Input/index.native.js +6 -0
  118. package/esm/Input/native/Email.js +15 -0
  119. package/esm/Input/native/Email.test.js +13 -0
  120. package/esm/Input/native/Helper.js +62 -0
  121. package/esm/Input/native/Input.js +234 -0
  122. package/esm/Input/native/Input.test.js +181 -0
  123. package/esm/Input/native/Number.js +12 -0
  124. package/esm/Input/native/Number.test.js +13 -0
  125. package/esm/Input/native/Password.js +112 -0
  126. package/esm/Input/native/Password.test.js +125 -0
  127. package/esm/Input/native/Tel.js +14 -0
  128. package/esm/Input/native/Tel.test.js +13 -0
  129. package/esm/Input/native/index.js +6 -0
  130. package/esm/Input/web/Email.test.js +13 -0
  131. package/esm/Input/web/Input.js +9 -4
  132. package/esm/Input/web/Input.test.js +145 -0
  133. package/esm/Input/web/Number.test.js +13 -0
  134. package/esm/Input/web/Password.test.js +90 -0
  135. package/esm/Input/web/Phone.js +124 -0
  136. package/esm/Input/web/Phone.style.js +27 -0
  137. package/esm/Input/web/Phone.test.js +95 -0
  138. package/esm/Input/web/Tel.test.js +13 -0
  139. package/esm/Input/web/data-images.js +3 -0
  140. package/esm/Input/web/index.js +2 -1
  141. package/esm/List/index.native.js +3 -0
  142. package/esm/List/native/List.js +22 -0
  143. package/esm/List/native/List.test.js +106 -0
  144. package/esm/List/native/ListItem.js +51 -0
  145. package/esm/List/native/index.js +3 -0
  146. package/esm/List/web/List.test.js +62 -0
  147. package/esm/Menu/web/Menu.test.js +115 -0
  148. package/esm/Popover/web/Popover.test.js +19 -0
  149. package/esm/Progress/index.native.js +2 -0
  150. package/esm/Progress/native/Progress.js +103 -0
  151. package/esm/Progress/native/Progress.test.js +222 -0
  152. package/esm/Progress/native/index.js +2 -0
  153. package/esm/Progress/web/Progress.test.js +222 -0
  154. package/esm/RadioGroup/index.native.js +4 -0
  155. package/esm/RadioGroup/native/Button/RadioButton.js +64 -0
  156. package/esm/RadioGroup/native/Button/RadioButton.test.js +96 -0
  157. package/esm/RadioGroup/native/Radio/Radio.js +88 -0
  158. package/esm/RadioGroup/native/Radio/Radio.test.js +112 -0
  159. package/esm/RadioGroup/native/RadioGroup.js +66 -0
  160. package/esm/RadioGroup/native/RadioGroup.test.js +50 -0
  161. package/esm/RadioGroup/native/index.js +4 -0
  162. package/esm/RadioGroup/web/Button/RadioButton.test.js +121 -0
  163. package/esm/RadioGroup/web/Radio/Radio.test.js +108 -0
  164. package/esm/RadioGroup/web/RadioGroup.test.js +83 -0
  165. package/esm/Rating/index.native.js +2 -0
  166. package/esm/Rating/native/Rating.js +186 -0
  167. package/esm/Rating/native/Rating.test.js +121 -0
  168. package/esm/Rating/native/index.js +2 -0
  169. package/esm/Rating/web/Rating.test.js +184 -0
  170. package/esm/Result/index.native.js +8 -0
  171. package/esm/Result/native/Attendances.js +55 -0
  172. package/esm/Result/native/Details.js +97 -0
  173. package/esm/Result/native/Rate.js +35 -0
  174. package/esm/Result/native/Result.js +86 -0
  175. package/esm/Result/native/Result.test.js +107 -0
  176. package/esm/Result/native/ResultButton.js +13 -0
  177. package/esm/Result/native/Tags.js +41 -0
  178. package/esm/Result/native/TinyTextIcon.js +18 -0
  179. package/esm/Result/native/index.js +2 -0
  180. package/esm/Skeleton/index.native.js +2 -0
  181. package/esm/Skeleton/native/Skeleton.js +94 -0
  182. package/esm/Skeleton/native/Skeleton.test.js +78 -0
  183. package/esm/Skeleton/native/index.js +2 -0
  184. package/esm/Skeleton/web/Skeleton.test.js +77 -0
  185. package/esm/Slider/index.native.js +2 -0
  186. package/esm/Slider/native/Label.js +19 -0
  187. package/esm/Slider/native/Marker.js +68 -0
  188. package/esm/Slider/native/Slider.js +156 -0
  189. package/esm/Slider/native/Slider.test.js +122 -0
  190. package/esm/Slider/native/Step.js +14 -0
  191. package/esm/Slider/native/Tooltip.js +90 -0
  192. package/esm/Slider/web/Slider.test.js +86 -0
  193. package/esm/Snackbar/index.native.js +2 -0
  194. package/esm/Snackbar/native/Snackbar.js +199 -0
  195. package/esm/Snackbar/native/Snackbar.test.js +100 -0
  196. package/esm/Snackbar/native/SnackbarAnimationWrapper.js +124 -0
  197. package/esm/Snackbar/native/index.js +2 -0
  198. package/esm/Snackbar/web/Snackbar.test.js +118 -0
  199. package/esm/Stepper/index.native.js +3 -0
  200. package/esm/Stepper/native/Dots.js +45 -0
  201. package/esm/Stepper/native/Line.js +35 -0
  202. package/esm/Stepper/native/Step.js +19 -0
  203. package/esm/Stepper/native/Stepper.js +52 -0
  204. package/esm/Stepper/native/Stepper.test.js +70 -0
  205. package/esm/Stepper/native/index.js +3 -0
  206. package/esm/Stepper/web/Stepper.test.js +67 -0
  207. package/esm/Tag/index.native.js +4 -0
  208. package/esm/Tag/native/Informative.js +72 -0
  209. package/esm/Tag/native/Tag.js +75 -0
  210. package/esm/Tag/native/Tag.test.js +94 -0
  211. package/esm/Tag/native/index.js +2 -0
  212. package/esm/Tag/web/Tag.test.js +79 -0
  213. package/esm/Text/index.native.js +16 -0
  214. package/esm/Text/native/Text.js +69 -0
  215. package/esm/Text/native/Text.test.js +149 -0
  216. package/esm/Text/native/index.js +2 -0
  217. package/esm/Text/web/Text.test.js +149 -0
  218. package/esm/TextArea/index.native.js +2 -0
  219. package/esm/TextArea/native/TextArea.js +59 -0
  220. package/esm/TextArea/native/TextArea.test.js +11 -0
  221. package/esm/TextArea/native/index.js +2 -0
  222. package/esm/TextArea/web/TextArea.test.js +11 -0
  223. package/esm/Theme/Provider/index.native.js +2 -0
  224. package/esm/Theme/Provider/native/index.js +2 -0
  225. package/esm/Theme/Provider/web/FontLoader.test.js +11 -0
  226. package/esm/Theme/Provider/web/GlobalStyle.test.js +17 -0
  227. package/esm/Theme/helpers/themeReader/native/native.test.js +53 -0
  228. package/esm/Theme/helpers/themeReader/web/web.test.js +41 -0
  229. package/esm/Theme/index.native.js +5 -0
  230. package/esm/hooks/index.js +2 -1
  231. package/esm/hooks/useCombinedRefs.js +25 -0
  232. package/esm/index.native.js +26 -0
  233. package/esm/shared/index.native.js +2 -0
  234. package/package.json +4 -3
@@ -0,0 +1,125 @@
1
+ import React from 'react';
2
+ import { render, fireEvent } from '@testing-library/react-native';
3
+ import { ThemeProvider, Input } from '../..';
4
+ describe('<Input.Password />', function () {
5
+ describe('Snapshots', function () {
6
+ it('should match with default input', function () {
7
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, null))),
8
+ toJSON = _render.toJSON;
9
+
10
+ expect(toJSON()).toMatchSnapshot();
11
+ });
12
+ it('should match when input is focused', function () {
13
+ var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
14
+ label: "Input",
15
+ testID: "input"
16
+ }))),
17
+ toJSON = _render2.toJSON,
18
+ getByTestId = _render2.getByTestId;
19
+
20
+ fireEvent(getByTestId('input'), 'focus');
21
+ expect(toJSON()).toMatchSnapshot();
22
+ });
23
+ it('should match with disabled input', function () {
24
+ var _render3 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
25
+ disabled: true
26
+ }))),
27
+ toJSON = _render3.toJSON;
28
+
29
+ expect(toJSON()).toMatchSnapshot();
30
+ });
31
+ it('should match with full width', function () {
32
+ var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
33
+ label: "Label",
34
+ full: true
35
+ }))),
36
+ toJSON = _render4.toJSON;
37
+
38
+ expect(toJSON()).toMatchSnapshot();
39
+ });
40
+ });
41
+ describe('Events', function () {
42
+ it('should call onChangeText', function () {
43
+ var onChangeTextMock = jest.fn();
44
+
45
+ var _render5 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
46
+ label: "Input",
47
+ testID: "input",
48
+ onChangeText: onChangeTextMock
49
+ }))),
50
+ getByTestId = _render5.getByTestId;
51
+
52
+ fireEvent.changeText(getByTestId('input'), 'foo');
53
+ expect(onChangeTextMock).toHaveBeenCalled();
54
+ });
55
+ it('should not call onChangeText when input is readOnly', function () {
56
+ var onChangeTextMock = jest.fn();
57
+
58
+ var _render6 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
59
+ label: "Input",
60
+ testID: "input",
61
+ onChangeText: onChangeTextMock,
62
+ readOnly: true
63
+ }))),
64
+ getByTestId = _render6.getByTestId;
65
+
66
+ fireEvent(getByTestId('input'), 'focus');
67
+ expect(onChangeTextMock).not.toHaveBeenCalled();
68
+ });
69
+ it('should not call onChangeText when input is disabled', function () {
70
+ var onChangeTextMock = jest.fn();
71
+
72
+ var _render7 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
73
+ label: "Input",
74
+ testID: "input",
75
+ onChangeText: onChangeTextMock,
76
+ disabled: true
77
+ }))),
78
+ getByTestId = _render7.getByTestId;
79
+
80
+ fireEvent(getByTestId('input'), 'focus');
81
+ expect(onChangeTextMock).not.toHaveBeenCalled();
82
+ });
83
+ it('should call onFocus', function () {
84
+ var onFocusMock = jest.fn();
85
+
86
+ var _render8 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
87
+ label: "Input",
88
+ testID: "input",
89
+ onFocus: onFocusMock
90
+ }))),
91
+ getByTestId = _render8.getByTestId;
92
+
93
+ fireEvent(getByTestId('input'), 'focus');
94
+ expect(onFocusMock).toHaveBeenCalled();
95
+ });
96
+ it('should call onBlur', function () {
97
+ var onBlurMock = jest.fn();
98
+
99
+ var _render9 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
100
+ label: "Input",
101
+ testID: "input",
102
+ onBlur: onBlurMock
103
+ }))),
104
+ getByTestId = _render9.getByTestId;
105
+
106
+ fireEvent(getByTestId('input'), 'focus');
107
+ fireEvent(getByTestId('input'), 'blur');
108
+ expect(onBlurMock).toHaveBeenCalled();
109
+ });
110
+ });
111
+ describe('visibility button', function () {
112
+ it('should toggle password visibility when press visibility button', function () {
113
+ var _render10 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
114
+ label: "Input",
115
+ testID: "input"
116
+ }))),
117
+ getByRole = _render10.getByRole,
118
+ getByTestId = _render10.getByTestId;
119
+
120
+ expect(getByTestId('input').props.secureTextEntry).toBe(true);
121
+ fireEvent.press(getByRole('button'));
122
+ expect(getByTestId('input').props.secureTextEntry).toBe(false);
123
+ });
124
+ });
125
+ });
@@ -0,0 +1,14 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React from 'react';
4
+ import Input from './Input';
5
+ var Tel = /*#__PURE__*/React.forwardRef(function (props, ref) {
6
+ return /*#__PURE__*/React.createElement(Input, _extends({
7
+ ref: ref
8
+ }, props, {
9
+ keyboardType: "phone-pad",
10
+ autoCompleteType: "tel",
11
+ textContentType: "telephoneNumber"
12
+ }));
13
+ });
14
+ export default Tel;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react-native';
3
+ import { ThemeProvider, Input } from '../..';
4
+ describe('<Input.Tel />', function () {
5
+ describe('Snapshots', function () {
6
+ it('should match with default input', function () {
7
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Tel, null))),
8
+ toJSON = _render.toJSON;
9
+
10
+ expect(toJSON()).toMatchSnapshot();
11
+ });
12
+ });
13
+ });
@@ -0,0 +1,6 @@
1
+ import Input from './Input';
2
+ import Password from './Password';
3
+ import InputNumber from './Number';
4
+ import Tel from './Tel';
5
+ import Email from './Email';
6
+ export { Input, Password, InputNumber, Tel, Email };
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import { ThemeProvider, Input } from '../..';
4
+ describe('<Input.Email />', function () {
5
+ describe('Snapshots', function () {
6
+ it('should match with default input', function () {
7
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Email, null))),
8
+ container = _render.container;
9
+
10
+ expect(container).toMatchSnapshot();
11
+ });
12
+ });
13
+ });
@@ -1,4 +1,4 @@
1
- var _excluded = ["cleanable", "disabled", "error", "full", "helper", "label", "maxLength", "readOnly", "style", "value", "onChange", "onClean", "hideMaxLength", "rightIcon"];
1
+ var _excluded = ["cleanable", "children", "disabled", "error", "full", "helper", "label", "maxLength", "readOnly", "style", "value", "onChange", "onClean", "hideMaxLength", "rightIcon"];
2
2
 
3
3
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
4
4
 
@@ -10,7 +10,7 @@ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.s
10
10
 
11
11
  import React, { useRef } from 'react';
12
12
  import styled, { css } from 'styled-components';
13
- import { func, string, bool, number, shape, oneOfType, node } from 'prop-types';
13
+ import { arrayOf, func, string, bool, number, shape, oneOfType, node } from 'prop-types';
14
14
  import { Close } from '@gympass/yoga-icons';
15
15
  import { theme } from '../../Theme';
16
16
  import Field from './Field';
@@ -34,6 +34,7 @@ var IconWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemp
34
34
  });
35
35
  var Input = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
36
36
  var cleanable = _ref3.cleanable,
37
+ children = _ref3.children,
37
38
  disabled = _ref3.disabled,
38
39
  error = _ref3.error,
39
40
  full = _ref3.full,
@@ -68,7 +69,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
68
69
  label: label,
69
70
  style: style,
70
71
  value: value
71
- }, /*#__PURE__*/React.createElement(Field, _extends({}, props, {
72
+ }, !children ? /*#__PURE__*/React.createElement(Field, _extends({}, props, {
72
73
  label: label,
73
74
  cleanable: cleanable,
74
75
  disabled: disabled,
@@ -79,7 +80,7 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
79
80
  ref: inputRef,
80
81
  value: value,
81
82
  onChange: onChange
82
- })), /*#__PURE__*/React.createElement(Label, {
83
+ })) : children, /*#__PURE__*/React.createElement(Label, {
83
84
  error: error,
84
85
  disabled: disabled
85
86
  }, label), label && /*#__PURE__*/React.createElement(Legend, null, label), cleanable && !readOnly && value && /*#__PURE__*/React.createElement(IconWrapper, {
@@ -111,6 +112,9 @@ var Input = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
111
112
  Input.propTypes = {
112
113
  className: string,
113
114
 
115
+ /** a children node to override default input component */
116
+ children: oneOfType([arrayOf(node), node]),
117
+
114
118
  /** display a close icon to clean the field */
115
119
  cleanable: bool,
116
120
  disabled: bool,
@@ -138,6 +142,7 @@ Input.propTypes = {
138
142
  };
139
143
  Input.defaultProps = {
140
144
  className: undefined,
145
+ children: undefined,
141
146
  cleanable: true,
142
147
  disabled: false,
143
148
  error: undefined,
@@ -0,0 +1,145 @@
1
+ import React from 'react';
2
+ import { render, fireEvent, screen } from '@testing-library/react';
3
+ import { ThemeProvider, Input } from '../..';
4
+ describe('<Input />', function () {
5
+ describe('Snapshots', function () {
6
+ it('should match with default input', function () {
7
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, null))),
8
+ container = _render.container;
9
+
10
+ expect(container).toMatchSnapshot();
11
+ });
12
+ it('should match with label', function () {
13
+ var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
14
+ label: "Input"
15
+ }))),
16
+ container = _render2.container;
17
+
18
+ expect(container).toMatchSnapshot();
19
+ });
20
+ it('should match with disabled input', function () {
21
+ var _render3 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
22
+ disabled: true
23
+ }))),
24
+ container = _render3.container;
25
+
26
+ expect(container).toMatchSnapshot();
27
+ });
28
+ it('should match with error', function () {
29
+ var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
30
+ error: "Error message"
31
+ }))),
32
+ container = _render4.container;
33
+
34
+ expect(container).toMatchSnapshot();
35
+ });
36
+ it('should match with helper text and max length', function () {
37
+ var _render5 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
38
+ helper: "Helper text",
39
+ maxLength: 20
40
+ }))),
41
+ container = _render5.container;
42
+
43
+ expect(container).toMatchSnapshot();
44
+ });
45
+ it('should match with helper text, max length and hideMaxLength', function () {
46
+ var _render6 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
47
+ helper: "Helper text",
48
+ maxLength: 20,
49
+ hideMaxLength: true
50
+ }))),
51
+ container = _render6.container;
52
+
53
+ expect(container).toMatchSnapshot();
54
+ });
55
+ it('should match with full width', function () {
56
+ var _render7 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
57
+ label: "Label",
58
+ full: true
59
+ }))),
60
+ container = _render7.container;
61
+
62
+ expect(container).toMatchSnapshot();
63
+ });
64
+ });
65
+ describe('Events', function () {
66
+ it('should call onChange', function () {
67
+ var onChangeMock = jest.fn();
68
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
69
+ label: "Input",
70
+ onChange: onChangeMock,
71
+ "data-testid": "input"
72
+ })));
73
+ fireEvent.change(screen.getByTestId('input'), {
74
+ target: {
75
+ value: 'foo'
76
+ }
77
+ });
78
+ expect(onChangeMock).toHaveBeenCalled();
79
+ });
80
+ it('should call onFocus', function () {
81
+ var onFocusMock = jest.fn();
82
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
83
+ label: "Input",
84
+ "data-testid": "input",
85
+ onFocus: onFocusMock
86
+ })));
87
+ fireEvent.focus(screen.getByTestId('input'));
88
+ expect(onFocusMock).toHaveBeenCalled();
89
+ });
90
+ it('should call onBlur', function () {
91
+ var onBlurMock = jest.fn();
92
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
93
+ label: "Input",
94
+ "data-testid": "input",
95
+ onBlur: onBlurMock
96
+ })));
97
+ fireEvent.focus(screen.getByTestId('input'));
98
+ fireEvent.blur(screen.getByTestId('input'));
99
+ expect(onBlurMock).toHaveBeenCalled();
100
+ });
101
+ });
102
+ describe('maxLength', function () {
103
+ it('should update maxLength counter when add character', function () {
104
+ var _render8 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
105
+ label: "Input",
106
+ maxLength: 10
107
+ }))),
108
+ rerender = _render8.rerender;
109
+
110
+ expect(screen.getByText('0/10').textContent).toBe('0/10');
111
+ rerender( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
112
+ label: "Input",
113
+ value: "foo",
114
+ maxLength: 10
115
+ })));
116
+ expect(screen.getByText('3/10').textContent).toBe('3/10');
117
+ });
118
+ });
119
+ describe('clean button', function () {
120
+ it('should call onClean when press clean button', function () {
121
+ var onClean = jest.fn();
122
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
123
+ label: "Input",
124
+ value: "foo",
125
+ onClean: onClean
126
+ })));
127
+ fireEvent.click(screen.queryByRole('button'));
128
+ expect(onClean).toHaveBeenCalled();
129
+ });
130
+ it('should test if clean button is present', function () {
131
+ var _render9 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
132
+ label: "Input"
133
+ }))),
134
+ rerender = _render9.rerender; // closeButton
135
+
136
+
137
+ expect(screen.queryByRole('button')).toBeNull();
138
+ rerender( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input, {
139
+ label: "Input",
140
+ value: "foo"
141
+ })));
142
+ expect(screen.queryByRole('button')).not.toBeNull();
143
+ });
144
+ });
145
+ });
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import { ThemeProvider, Input } from '../..';
4
+ describe('<Input.Number />', function () {
5
+ describe('Snapshots', function () {
6
+ it('should match with default input', function () {
7
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Number, null))),
8
+ container = _render.container;
9
+
10
+ expect(container).toMatchSnapshot();
11
+ });
12
+ });
13
+ });
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import { render, fireEvent } from '@testing-library/react';
3
+ import { ThemeProvider, Input } from '../..';
4
+ describe('<Input.Password />', function () {
5
+ describe('Snapshots', function () {
6
+ it('should match with default input', function () {
7
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, null))),
8
+ container = _render.container;
9
+
10
+ expect(container).toMatchSnapshot();
11
+ });
12
+ it('should match with disabled input', function () {
13
+ var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
14
+ disabled: true
15
+ }))),
16
+ container = _render2.container;
17
+
18
+ expect(container).toMatchSnapshot();
19
+ });
20
+ it('should match with full width', function () {
21
+ var _render3 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
22
+ label: "Label",
23
+ full: true
24
+ }))),
25
+ container = _render3.container;
26
+
27
+ expect(container).toMatchSnapshot();
28
+ });
29
+ });
30
+ describe('Events', function () {
31
+ it('should call onChange', function () {
32
+ var onChangeMock = jest.fn();
33
+
34
+ var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
35
+ label: "Input",
36
+ "data-testid": "input",
37
+ onChange: onChangeMock
38
+ }))),
39
+ getByTestId = _render4.getByTestId;
40
+
41
+ fireEvent.change(getByTestId('input'), {
42
+ target: {
43
+ value: 'foo'
44
+ }
45
+ });
46
+ expect(onChangeMock).toHaveBeenCalled();
47
+ });
48
+ it('should call onFocus', function () {
49
+ var onFocusMock = jest.fn();
50
+
51
+ var _render5 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
52
+ label: "Input",
53
+ "data-testid": "input",
54
+ onFocus: onFocusMock
55
+ }))),
56
+ getByTestId = _render5.getByTestId;
57
+
58
+ fireEvent.focus(getByTestId('input'));
59
+ expect(onFocusMock).toHaveBeenCalled();
60
+ });
61
+ it('should call onBlur', function () {
62
+ var onBlurMock = jest.fn();
63
+
64
+ var _render6 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
65
+ label: "Input",
66
+ "data-testid": "input",
67
+ onBlur: onBlurMock
68
+ }))),
69
+ getByTestId = _render6.getByTestId;
70
+
71
+ fireEvent.focus(getByTestId('input'));
72
+ fireEvent.blur(getByTestId('input'));
73
+ expect(onBlurMock).toHaveBeenCalled();
74
+ });
75
+ });
76
+ describe('visibility button', function () {
77
+ it('should toggle password visibility when click visibility button', function () {
78
+ var _render7 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Input.Password, {
79
+ label: "Input",
80
+ "data-testid": "input"
81
+ }))),
82
+ getByRole = _render7.getByRole,
83
+ getByTestId = _render7.getByTestId;
84
+
85
+ expect(getByTestId('input').type).toBe('password');
86
+ fireEvent.click(getByRole('button'));
87
+ expect(getByTestId('input').type).toBe('text');
88
+ });
89
+ });
90
+ });
@@ -0,0 +1,124 @@
1
+ var _excluded = ["defaultCountry", "disabled", "readOnly", "error", "full", "helper", "label", "placeholder", "value", "onChange"];
2
+
3
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+
7
+ import React, { useRef, useCallback } from 'react';
8
+ import BasePhoneInput from 'react-phone-input-2';
9
+ import PropTypes, { func, string, bool } from 'prop-types';
10
+ import * as S from './Phone.style';
11
+ import Input from './Input';
12
+ import { useCombinedRefs } from '../../hooks';
13
+ var phoneBaseSettings = {
14
+ onlyCountries: ['ar', 'br', 'cl', 'de', 'es', 'gb', 'ie', 'it', 'mx', 'pt', 'us']
15
+ };
16
+ var Phone = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
17
+ var defaultCountry = _ref.defaultCountry,
18
+ disabled = _ref.disabled,
19
+ readOnly = _ref.readOnly,
20
+ error = _ref.error,
21
+ full = _ref.full,
22
+ helper = _ref.helper,
23
+ label = _ref.label,
24
+ placeholder = _ref.placeholder,
25
+ value = _ref.value,
26
+ _onChange = _ref.onChange,
27
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
28
+
29
+ var inputRef = useCombinedRefs(forwardedRef);
30
+ var currentCountry = useRef(defaultCountry);
31
+ var onChangeCountry = useCallback(function (countryCode) {
32
+ if (currentCountry.current !== countryCode) {
33
+ inputRef.current.focus();
34
+ currentCountry.current = countryCode;
35
+ }
36
+ }, []);
37
+ return /*#__PURE__*/React.createElement(Input, _extends({}, _extends({
38
+ disabled: disabled,
39
+ readOnly: readOnly,
40
+ error: error,
41
+ full: full,
42
+ helper: helper,
43
+ value: value
44
+ }, rest), {
45
+ ref: inputRef,
46
+ label: "",
47
+ onClean: function onClean(phoneNumber) {
48
+ return _onChange(phoneNumber);
49
+ }
50
+ }), /*#__PURE__*/React.createElement(S.Container, {
51
+ error: error,
52
+ disabled: disabled,
53
+ full: full
54
+ }, /*#__PURE__*/React.createElement(BasePhoneInput, _extends({}, phoneBaseSettings, {
55
+ ref: function ref(phoneRef) {
56
+ inputRef.current = phoneRef == null ? void 0 : phoneRef.numberInputRef;
57
+ },
58
+ inputProps: {
59
+ readOnly: readOnly
60
+ },
61
+ disabled: disabled,
62
+ disableDropdown: readOnly,
63
+ country: defaultCountry,
64
+ specialLabel: label,
65
+ placeholder: placeholder,
66
+ onChange: function onChange(phoneNumber, options) {
67
+ _onChange(phoneNumber, options);
68
+
69
+ onChangeCountry(options.countryCode);
70
+ },
71
+ value: value
72
+ }))));
73
+ });
74
+ Phone.propTypes = {
75
+ className: string,
76
+
77
+ /** display a close icon to clean the field */
78
+ cleanable: bool,
79
+
80
+ /** default country to be selected on the dropdown */
81
+ defaultCountry: PropTypes.string,
82
+
83
+ /** disable the whole input */
84
+ disabled: bool,
85
+
86
+ /** display a error message and error style */
87
+ error: string,
88
+
89
+ /** should occupy the whole container width */
90
+ full: bool,
91
+
92
+ /** a helper text to be displayed below field */
93
+ helper: string,
94
+
95
+ /** label for the input */
96
+ label: string,
97
+
98
+ /** make the input read only */
99
+ readOnly: bool,
100
+
101
+ /** value of the input */
102
+ value: string,
103
+
104
+ /** callback invoked when value changes, either by typing of selecting a country */
105
+ onChange: func,
106
+
107
+ /** placeholder to show when the input is cleared */
108
+ placeholder: string
109
+ };
110
+ Phone.defaultProps = {
111
+ className: undefined,
112
+ cleanable: true,
113
+ defaultCountry: 'br',
114
+ disabled: false,
115
+ error: undefined,
116
+ full: false,
117
+ helper: undefined,
118
+ label: '',
119
+ readOnly: false,
120
+ value: '',
121
+ onChange: function onChange() {},
122
+ placeholder: '+55 (11) 999999999'
123
+ };
124
+ export default Phone;
@@ -0,0 +1,27 @@
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
2
+
3
+ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
4
+
5
+ import 'react-phone-input-2/lib/material.css';
6
+ import styled, { css } from 'styled-components';
7
+ import { flagsSprite, chevronSvg, checkSvg } from './data-images';
8
+ var flagsPositioning = css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n .ar {\n background-position: 0px 0px;\n }\n\n .br {\n background-position: -20px 0px;\n }\n\n .cl {\n background-position: 0px -20px;\n }\n\n .de {\n background-position: -20px -20px;\n }\n\n .es {\n background-position: -20px -40px;\n }\n\n .gb {\n background-position: -60px 0px;\n }\n\n .ie {\n background-position: -40px 0px;\n }\n\n .it {\n background-position: -40px -20px;\n }\n\n .mx {\n background-position: 0px -40px;\n }\n\n .pt {\n background-position: -40px -40px;\n }\n\n .us {\n background-position: -60px -20px;\n }\n"])));
9
+ var flagReset = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n position: relative;\n top: initial;\n left: initial;\n margin-top: 0;\n"])));
10
+ var hiddenScrollBar = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n ::-webkit-scrollbar {\n display: none;\n }\n\n -ms-overflow-style: none;\n scrollbar-width: none;\n"])));
11
+
12
+ var labelStateColors = function labelStateColors(_ref) {
13
+ var disabled = _ref.disabled,
14
+ error = _ref.error,
15
+ colors = _ref.theme.yoga.colors;
16
+ return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n ", "\n ", "\n"])), disabled ? "color: " + colors.text.disabled + ";" : '', error ? "color: " + colors.feedback.attention[1] + ";" : '');
17
+ };
18
+
19
+ export var Container = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n --fieldset-left-offset: 12px;\n --dropdown-zIndex: 1;\n\n height: inherit;\n\n ", "\n"])), function (_ref2) {
20
+ var disabled = _ref2.disabled,
21
+ _ref2$theme$yoga = _ref2.theme.yoga,
22
+ spacing = _ref2$theme$yoga.spacing,
23
+ colors = _ref2$theme$yoga.colors,
24
+ baseFont = _ref2$theme$yoga.baseFont,
25
+ input = _ref2$theme$yoga.components.input;
26
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n .react-tel-input {\n width: inherit;\n height: inherit;\n font-family: ", ", sans-serif;\n font-size: ", "px;\n font-weight: ", ";\n display: grid;\n grid-template-areas: 'dropdown input';\n grid-template-columns: min-content 1fr;\n\n .special-label {\n z-index: unset;\n left: unset;\n font-size: ", "px;\n color: ", ";\n letter-spacing: normal;\n ", ";\n }\n\n &:focus-within {\n .special-label {\n font-weight: ", ";\n color: ", ";\n ", ";\n }\n }\n\n .form-control {\n background: transparent;\n border: unset;\n padding: unset;\n box-sizing: border-box;\n width: 100%;\n grid-area: input;\n color: ", ";\n font-size: ", "px;\n padding-left: ", "px;\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &::placeholder {\n color: ", ";\n }\n\n &:hover,\n &:focus {\n box-shadow: none;\n }\n\n &.open {\n z-index: calc(var(--dropdown-zIndex) + 1);\n }\n }\n\n .flag-dropdown {\n border: none;\n width: inherit;\n position: unset;\n top: unset;\n bottom: unset;\n padding: unset;\n grid-area: dropdown;\n\n &.open {\n width: 100%;\n z-index: var(--dropdown-zIndex);\n }\n\n &.open,\n &.open .selected-flag,\n &:hover,\n &:focus {\n background: transparent;\n }\n }\n\n .selected-flag {\n border: none;\n padding: 0;\n padding-left: ", "px;\n display: flex;\n align-items: center;\n opacity: ", ";\n\n &::after {\n content: '';\n position: absolute;\n background-color: ", ";\n height: 28px;\n right: -", "px;\n width: 1px;\n top: 50%;\n transform: translate(0, -50%);\n }\n\n .flag {\n ", ";\n display: flex;\n align-items: center;\n\n .arrow {\n background-color: ", ";\n mask-image: url('data:image/svg+xml;utf8,", "');\n border: none;\n top: unset;\n margin-top: unset;\n width: 16px;\n height: 16px;\n transition: 0.6s, color 0.1s;\n\n &.up {\n border: none;\n transform: rotateX(180deg);\n }\n\n &:hover,\n &:focus {\n border: none;\n background-color: ", ";\n }\n }\n }\n }\n\n .flag {\n width: 20px;\n height: 20px;\n background-image: url('data:image/png;base64,", "');\n }\n\n ", ";\n\n .country-list {\n box-shadow: none;\n border-radius: unset;\n max-height: 18rem;\n margin: -", "px 0 0 calc(-1 * var(--fieldset-left-offset) -\n 1px);\n width: calc(100% + var(--fieldset-left-offset) + 2px);\n z-index: var(--dropdown-zIndex);\n border: 1px solid ", ";\n border-top: 0;\n border-bottom-left-radius: ", "px;\n border-bottom-right-radius: ", "px;\n\n ", ";\n\n .country {\n display: flex;\n align-items: center;\n outline: 0;\n padding: ", "px ", "px ", "px\n ", "px;\n color: ", ";\n\n .flag {\n ", ";\n margin-right: ", "px;\n }\n\n .dial-code {\n color: inherit;\n display: flex;\n flex: 1;\n\n ::before {\n content: '(';\n }\n\n ::after {\n content: ')';\n }\n }\n\n &.highlight {\n background-color: transparent;\n color: ", ";\n\n &::after {\n content: '';\n background-color: ", ";\n mask-image: url('data:image/svg+xml;utf8,", "');\n width: 16px;\n height: 16px;\n }\n }\n\n &.focus,\n &:hover {\n background-color: ", ";\n }\n }\n }\n }\n "])), baseFont.family, input.font.size, input.font.weight, input.label.font.size.typed, input.label.color["default"], labelStateColors, input.label.font.weight.typed, input.label.color.focus, labelStateColors, disabled ? colors.text.disabled : input.font.color.focus, input.font.size, spacing.xsmall, input.font.color["default"], spacing.xxxsmall, disabled ? 0.5 : 1, input.border.color["default"], spacing.xxxsmall, flagReset, input.label.color["default"], chevronSvg, input.label.color.focus, flagsSprite, flagsPositioning, spacing.xxsmall, input.border.color.typed, spacing.xxsmall, spacing.xxsmall, hiddenScrollBar, spacing.xsmall, spacing.small, spacing.xsmall, spacing.small, input.font.color.focus, flagReset, spacing.small, colors.primary, colors.primary, checkSvg, colors.clear);
27
+ });