@gympass/yoga 7.66.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 (218) hide show
  1. package/cjs/Dialog/web/Dialog.js +12 -7
  2. package/cjs/Drawer/web/Drawer.js +5 -1
  3. package/esm/Accordion/web/Accordion.test.js +19 -0
  4. package/esm/ActionRequirement/index.native.js +2 -0
  5. package/esm/ActionRequirement/native/ActionRequirement.js +48 -0
  6. package/esm/ActionRequirement/native/ActionRequirement.test.js +45 -0
  7. package/esm/ActionRequirement/native/ActionRequirementStyles.js +25 -0
  8. package/esm/ActionRequirement/native/index.js +6 -0
  9. package/esm/ActionRequirement/web/ActionRequirement.test.js +36 -0
  10. package/esm/AutoComplete/web/AutoComplete.test.js +139 -0
  11. package/esm/Avatar/index.native.js +4 -0
  12. package/esm/Avatar/native/Avatar.js +96 -0
  13. package/esm/Avatar/native/Avatar.test.js +46 -0
  14. package/esm/Avatar/native/AvatarCircle.js +24 -0
  15. package/esm/Avatar/web/Avatar.test.js +63 -0
  16. package/esm/Banner/index.native.js +2 -0
  17. package/esm/Banner/native/Banner.js +128 -0
  18. package/esm/Banner/native/Banner.test.js +103 -0
  19. package/esm/Banner/native/index.js +2 -0
  20. package/esm/Banner/web/Banner.test.js +109 -0
  21. package/esm/BottomSheet/web/BottomSheet.test.js +48 -0
  22. package/esm/Box/index.native.js +2 -0
  23. package/esm/Box/native/Box.js +4 -0
  24. package/esm/Box/native/Box.test.js +16 -0
  25. package/esm/Box/native/index.js +2 -0
  26. package/esm/Box/web/Box.test.js +16 -0
  27. package/esm/Button/index.native.js +8 -0
  28. package/esm/Button/native/Button.js +110 -0
  29. package/esm/Button/native/Button.test.js +475 -0
  30. package/esm/Button/native/Icon.js +82 -0
  31. package/esm/Button/native/Link.js +35 -0
  32. package/esm/Button/native/Text.js +74 -0
  33. package/esm/Button/native/withTouchable.js +63 -0
  34. package/esm/Button/web/Button.test.js +772 -0
  35. package/esm/Card/index.native.js +2 -0
  36. package/esm/Card/native/Card/Actions.js +12 -0
  37. package/esm/Card/native/Card/Card.js +92 -0
  38. package/esm/Card/native/Card/Card.test.js +15 -0
  39. package/esm/Card/native/Card/Content.js +8 -0
  40. package/esm/Card/native/Card/Header.js +8 -0
  41. package/esm/Card/native/Card/index.js +8 -0
  42. package/esm/Card/native/EventCard/EventCard.js +169 -0
  43. package/esm/Card/native/EventCard/EventCard.test.js +65 -0
  44. package/esm/Card/native/EventCard/index.js +2 -0
  45. package/esm/Card/native/GymCard/CheckIn/Avatar.js +17 -0
  46. package/esm/Card/native/GymCard/CheckIn/CheckIn.js +66 -0
  47. package/esm/Card/native/GymCard/CheckIn/CheckIn.test.js +39 -0
  48. package/esm/Card/native/GymCard/CheckIn/Content.js +11 -0
  49. package/esm/Card/native/GymCard/CheckIn/Header.js +11 -0
  50. package/esm/Card/native/GymCard/CheckIn/index.js +2 -0
  51. package/esm/Card/native/GymCard/index.js +5 -0
  52. package/esm/Card/native/PlanCard/Actions.js +22 -0
  53. package/esm/Card/native/PlanCard/Content.js +75 -0
  54. package/esm/Card/native/PlanCard/List.js +73 -0
  55. package/esm/Card/native/PlanCard/PlanCard.js +51 -0
  56. package/esm/Card/native/PlanCard/PlanCard.test.js +84 -0
  57. package/esm/Card/native/PlanCard/Subtitle.js +15 -0
  58. package/esm/Card/native/PlanCard/Tag.js +34 -0
  59. package/esm/Card/native/PlanCard/index.js +15 -0
  60. package/esm/Card/native/index.js +5 -0
  61. package/esm/Card/web/Card/Card.test.js +14 -0
  62. package/esm/Card/web/EventCard/EventCard.test.js +27 -0
  63. package/esm/Card/web/PlanCard/PlanCard.test.js +94 -0
  64. package/esm/Checkbox/index.native.js +3 -0
  65. package/esm/Checkbox/native/Checkbox.js +179 -0
  66. package/esm/Checkbox/native/Checkbox.test.js +115 -0
  67. package/esm/Checkbox/native/Switch.js +115 -0
  68. package/esm/Checkbox/native/Switch.test.js +54 -0
  69. package/esm/Checkbox/native/index.js +3 -0
  70. package/esm/Checkbox/web/Checkbox.test.js +153 -0
  71. package/esm/Checkbox/web/Switch.test.js +56 -0
  72. package/esm/Chips/index.native.js +2 -0
  73. package/esm/Chips/native/Chips.js +104 -0
  74. package/esm/Chips/native/Chips.test.js +143 -0
  75. package/esm/Chips/native/Counter.js +20 -0
  76. package/esm/Chips/native/index.js +2 -0
  77. package/esm/Chips/web/Chips.test.js +128 -0
  78. package/esm/Datepicker/web/Datepicker.test.js +247 -0
  79. package/esm/Dialog/web/Dialog.js +13 -8
  80. package/esm/Dialog/web/Dialog.test.js +62 -0
  81. package/esm/Divider/index.native.js +2 -0
  82. package/esm/Divider/native/Divider.js +29 -0
  83. package/esm/Divider/native/Divider.test.js +29 -0
  84. package/esm/Divider/native/index.js +2 -0
  85. package/esm/Divider/web/Divider.test.js +29 -0
  86. package/esm/Drawer/web/Drawer.js +6 -2
  87. package/esm/Drawer/web/Drawer.test.js +33 -0
  88. package/esm/Dropdown/index.native.js +2 -0
  89. package/esm/Dropdown/native/Backdrop.js +93 -0
  90. package/esm/Dropdown/native/Backdrop.test.js +26 -0
  91. package/esm/Dropdown/native/Dropdown.js +142 -0
  92. package/esm/Dropdown/native/Dropdown.test.js +78 -0
  93. package/esm/Dropdown/native/Options.android.js +66 -0
  94. package/esm/Dropdown/native/Options.ios.js +71 -0
  95. package/esm/Dropdown/native/index.js +2 -0
  96. package/esm/Dropdown/web/Dropdown.test.js +93 -0
  97. package/esm/Feedback/web/Feedback.test.js +83 -0
  98. package/esm/Grid/web/Col.test.js +48 -0
  99. package/esm/Grid/web/Container.test.js +14 -0
  100. package/esm/Grid/web/Hide.test.js +31 -0
  101. package/esm/Grid/web/Row.test.js +14 -0
  102. package/esm/Header/web/Header.test.js +38 -0
  103. package/esm/Heading/web/Heading.test.js +58 -0
  104. package/esm/Icon/index.native.js +2 -0
  105. package/esm/Icon/native/Icon.test.js +47 -0
  106. package/esm/Icon/native/index.js +2 -0
  107. package/esm/Icon/web/Icon.test.js +47 -0
  108. package/esm/Input/index.native.js +6 -0
  109. package/esm/Input/native/Email.js +15 -0
  110. package/esm/Input/native/Email.test.js +13 -0
  111. package/esm/Input/native/Helper.js +62 -0
  112. package/esm/Input/native/Input.js +234 -0
  113. package/esm/Input/native/Input.test.js +181 -0
  114. package/esm/Input/native/Number.js +12 -0
  115. package/esm/Input/native/Number.test.js +13 -0
  116. package/esm/Input/native/Password.js +112 -0
  117. package/esm/Input/native/Password.test.js +125 -0
  118. package/esm/Input/native/Tel.js +14 -0
  119. package/esm/Input/native/Tel.test.js +13 -0
  120. package/esm/Input/native/index.js +6 -0
  121. package/esm/Input/web/Email.test.js +13 -0
  122. package/esm/Input/web/Input.test.js +145 -0
  123. package/esm/Input/web/Number.test.js +13 -0
  124. package/esm/Input/web/Password.test.js +90 -0
  125. package/esm/Input/web/Phone.test.js +95 -0
  126. package/esm/Input/web/Tel.test.js +13 -0
  127. package/esm/List/index.native.js +3 -0
  128. package/esm/List/native/List.js +22 -0
  129. package/esm/List/native/List.test.js +106 -0
  130. package/esm/List/native/ListItem.js +51 -0
  131. package/esm/List/native/index.js +3 -0
  132. package/esm/List/web/List.test.js +62 -0
  133. package/esm/Menu/web/Menu.test.js +115 -0
  134. package/esm/Popover/web/Popover.test.js +19 -0
  135. package/esm/Progress/index.native.js +2 -0
  136. package/esm/Progress/native/Progress.js +103 -0
  137. package/esm/Progress/native/Progress.test.js +222 -0
  138. package/esm/Progress/native/index.js +2 -0
  139. package/esm/Progress/web/Progress.test.js +222 -0
  140. package/esm/RadioGroup/index.native.js +4 -0
  141. package/esm/RadioGroup/native/Button/RadioButton.js +64 -0
  142. package/esm/RadioGroup/native/Button/RadioButton.test.js +96 -0
  143. package/esm/RadioGroup/native/Radio/Radio.js +88 -0
  144. package/esm/RadioGroup/native/Radio/Radio.test.js +112 -0
  145. package/esm/RadioGroup/native/RadioGroup.js +66 -0
  146. package/esm/RadioGroup/native/RadioGroup.test.js +50 -0
  147. package/esm/RadioGroup/native/index.js +4 -0
  148. package/esm/RadioGroup/web/Button/RadioButton.test.js +121 -0
  149. package/esm/RadioGroup/web/Radio/Radio.test.js +108 -0
  150. package/esm/RadioGroup/web/RadioGroup.test.js +83 -0
  151. package/esm/Rating/index.native.js +2 -0
  152. package/esm/Rating/native/Rating.js +186 -0
  153. package/esm/Rating/native/Rating.test.js +121 -0
  154. package/esm/Rating/native/index.js +2 -0
  155. package/esm/Rating/web/Rating.test.js +184 -0
  156. package/esm/Result/index.native.js +8 -0
  157. package/esm/Result/native/Attendances.js +55 -0
  158. package/esm/Result/native/Details.js +97 -0
  159. package/esm/Result/native/Rate.js +35 -0
  160. package/esm/Result/native/Result.js +86 -0
  161. package/esm/Result/native/Result.test.js +107 -0
  162. package/esm/Result/native/ResultButton.js +13 -0
  163. package/esm/Result/native/Tags.js +41 -0
  164. package/esm/Result/native/TinyTextIcon.js +18 -0
  165. package/esm/Result/native/index.js +2 -0
  166. package/esm/Skeleton/index.native.js +2 -0
  167. package/esm/Skeleton/native/Skeleton.js +94 -0
  168. package/esm/Skeleton/native/Skeleton.test.js +78 -0
  169. package/esm/Skeleton/native/index.js +2 -0
  170. package/esm/Skeleton/web/Skeleton.test.js +77 -0
  171. package/esm/Slider/index.native.js +2 -0
  172. package/esm/Slider/native/Label.js +19 -0
  173. package/esm/Slider/native/Marker.js +68 -0
  174. package/esm/Slider/native/Slider.js +156 -0
  175. package/esm/Slider/native/Slider.test.js +122 -0
  176. package/esm/Slider/native/Step.js +14 -0
  177. package/esm/Slider/native/Tooltip.js +90 -0
  178. package/esm/Slider/web/Slider.test.js +86 -0
  179. package/esm/Snackbar/index.native.js +2 -0
  180. package/esm/Snackbar/native/Snackbar.js +199 -0
  181. package/esm/Snackbar/native/Snackbar.test.js +100 -0
  182. package/esm/Snackbar/native/SnackbarAnimationWrapper.js +124 -0
  183. package/esm/Snackbar/native/index.js +2 -0
  184. package/esm/Snackbar/web/Snackbar.test.js +118 -0
  185. package/esm/Stepper/index.native.js +3 -0
  186. package/esm/Stepper/native/Dots.js +45 -0
  187. package/esm/Stepper/native/Line.js +35 -0
  188. package/esm/Stepper/native/Step.js +19 -0
  189. package/esm/Stepper/native/Stepper.js +52 -0
  190. package/esm/Stepper/native/Stepper.test.js +70 -0
  191. package/esm/Stepper/native/index.js +3 -0
  192. package/esm/Stepper/web/Stepper.test.js +67 -0
  193. package/esm/Tag/index.native.js +4 -0
  194. package/esm/Tag/native/Informative.js +72 -0
  195. package/esm/Tag/native/Tag.js +75 -0
  196. package/esm/Tag/native/Tag.test.js +94 -0
  197. package/esm/Tag/native/index.js +2 -0
  198. package/esm/Tag/web/Tag.test.js +79 -0
  199. package/esm/Text/index.native.js +16 -0
  200. package/esm/Text/native/Text.js +69 -0
  201. package/esm/Text/native/Text.test.js +149 -0
  202. package/esm/Text/native/index.js +2 -0
  203. package/esm/Text/web/Text.test.js +149 -0
  204. package/esm/TextArea/index.native.js +2 -0
  205. package/esm/TextArea/native/TextArea.js +59 -0
  206. package/esm/TextArea/native/TextArea.test.js +11 -0
  207. package/esm/TextArea/native/index.js +2 -0
  208. package/esm/TextArea/web/TextArea.test.js +11 -0
  209. package/esm/Theme/Provider/index.native.js +2 -0
  210. package/esm/Theme/Provider/native/index.js +2 -0
  211. package/esm/Theme/Provider/web/FontLoader.test.js +11 -0
  212. package/esm/Theme/Provider/web/GlobalStyle.test.js +17 -0
  213. package/esm/Theme/helpers/themeReader/native/native.test.js +53 -0
  214. package/esm/Theme/helpers/themeReader/web/web.test.js +41 -0
  215. package/esm/Theme/index.native.js +5 -0
  216. package/esm/index.native.js +26 -0
  217. package/esm/shared/index.native.js +2 -0
  218. package/package.json +2 -2
@@ -0,0 +1,100 @@
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, { useRef } from 'react';
4
+ import { render, fireEvent } from '@testing-library/react-native';
5
+ import * as RN from 'react-native';
6
+ import { CheckedFull } from '@gympass/yoga-icons';
7
+ import { ThemeProvider, Snackbar } from '../..';
8
+ import Button from '../../Button';
9
+ RN.Animated.spring = jest.fn().mockReturnValue({
10
+ start: jest.fn()
11
+ });
12
+
13
+ var Component = function Component(overrideProps) {
14
+ var snackbarRef = useRef();
15
+ return /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
16
+ full: true,
17
+ small: true,
18
+ onPress: function onPress() {
19
+ snackbarRef.current.open();
20
+ }
21
+ }, "Tap to open snackbar"), /*#__PURE__*/React.createElement(Snackbar, _extends({
22
+ ref: snackbarRef,
23
+ message: "Feedback Message"
24
+ }, overrideProps)));
25
+ };
26
+
27
+ describe('<Snackbar />', function () {
28
+ it('should match snapshot when snackbar is default', function () {
29
+ var _render = render( /*#__PURE__*/React.createElement(Component, null)),
30
+ toJSON = _render.toJSON;
31
+
32
+ expect(toJSON()).toMatchSnapshot();
33
+ });
34
+ it('should match snapshot when have an icon and action', function () {
35
+ var overrideProps = {
36
+ icon: CheckedFull,
37
+ actionLabel: 'Action',
38
+ onAction: function onAction() {}
39
+ };
40
+
41
+ var _render2 = render( /*#__PURE__*/React.createElement(Component, overrideProps)),
42
+ toJSON = _render2.toJSON;
43
+
44
+ expect(toJSON()).toMatchSnapshot();
45
+ });
46
+ it('should match snapshot when have a long text', function () {
47
+ var overrideProps = {
48
+ message: 'Lorem Ipsum is simply dummy text of the printing and types.',
49
+ icon: CheckedFull,
50
+ actionLabel: 'Action',
51
+ onAction: function onAction() {}
52
+ };
53
+
54
+ var _render3 = render( /*#__PURE__*/React.createElement(Component, overrideProps)),
55
+ toJSON = _render3.toJSON;
56
+
57
+ expect(toJSON()).toMatchSnapshot();
58
+ });
59
+ it('should match snapshot when have a variant informative or attention prop', function () {
60
+ var overrideProps = {
61
+ variant: 'informative'
62
+ };
63
+
64
+ var _render4 = render( /*#__PURE__*/React.createElement(Component, overrideProps)),
65
+ toJSON = _render4.toJSON;
66
+
67
+ expect(toJSON()).toMatchSnapshot();
68
+ });
69
+ it('should show and hide snackbar when the open and close Animation function is called', function () {
70
+ var overrideProps = {
71
+ onSnackbarClose: jest.fn(),
72
+ actionLabel: 'Action',
73
+ onAction: jest.fn()
74
+ };
75
+
76
+ var _render5 = render( /*#__PURE__*/React.createElement(Component, overrideProps)),
77
+ getByText = _render5.getByText,
78
+ getByTestId = _render5.getByTestId;
79
+
80
+ fireEvent(getByTestId('wrapper'), 'layout', {
81
+ nativeEvent: {
82
+ layout: {
83
+ height: 200
84
+ }
85
+ }
86
+ });
87
+ fireEvent.press(getByText('Tap to open snackbar'));
88
+ expect(RN.Animated.spring.mock.calls[0][1]).toEqual({
89
+ toValue: 0,
90
+ bounciness: 0,
91
+ useNativeDriver: true
92
+ });
93
+ fireEvent.press(getByText('Action'));
94
+ expect(RN.Animated.spring.mock.calls[1][1]).toEqual({
95
+ toValue: 200,
96
+ bounciness: 0,
97
+ useNativeDriver: true
98
+ });
99
+ });
100
+ });
@@ -0,0 +1,124 @@
1
+ import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
2
+ import { Animated, useWindowDimensions, View } from 'react-native';
3
+ import { func, node, oneOf } from 'prop-types';
4
+ import styled from 'styled-components';
5
+ var durationDictionary = {
6
+ fast: 4000,
7
+ "default": 8000,
8
+ slow: 10000,
9
+ indefinite: -1
10
+ };
11
+ var Wrapper = styled(Animated.View)(function () {
12
+ return "\n position: absolute;\n width: 100%;\n bottom: 0px;\n ";
13
+ });
14
+ var SnackbarAnimationWrapper = /*#__PURE__*/forwardRef(function (_ref, ref) {
15
+ var onSnackbarClose = _ref.onSnackbarClose,
16
+ children = _ref.children,
17
+ duration = _ref.duration;
18
+
19
+ var _useWindowDimensions = useWindowDimensions(),
20
+ windowHeight = _useWindowDimensions.height;
21
+
22
+ var _useState = useState(),
23
+ childrenHeight = _useState[0],
24
+ setChildrenHeight = _useState[1];
25
+
26
+ var _translateY = useRef(new Animated.Value(windowHeight)).current;
27
+ var timeoutRef = useRef();
28
+ var childrenRef = useRef();
29
+
30
+ var openAnimation = function openAnimation() {
31
+ Animated.spring(_translateY, {
32
+ toValue: 0,
33
+ bounciness: 0,
34
+ useNativeDriver: true
35
+ }).start();
36
+ };
37
+
38
+ var closeAnimation = function closeAnimation(callback) {
39
+ if (childrenHeight) {
40
+ Animated.spring(_translateY, {
41
+ toValue: childrenHeight,
42
+ bounciness: 0,
43
+ useNativeDriver: true
44
+ }).start(function (_ref2) {
45
+ var finished = _ref2.finished;
46
+
47
+ if (finished && callback) {
48
+ callback();
49
+ }
50
+ });
51
+
52
+ if (onSnackbarClose) {
53
+ onSnackbarClose();
54
+ }
55
+ }
56
+ };
57
+
58
+ var setupSnackbarTimeout = function setupSnackbarTimeout() {
59
+ var timeoutDuration = durationDictionary[duration];
60
+ var shouldCloseOnTimer = childrenHeight && timeoutDuration > 0;
61
+
62
+ if (shouldCloseOnTimer) {
63
+ timeoutRef.current = setTimeout(function () {
64
+ clearTimeout(timeoutRef.current);
65
+ closeAnimation();
66
+ }, timeoutDuration);
67
+ }
68
+ };
69
+
70
+ var openSnackbar = function openSnackbar() {
71
+ openAnimation();
72
+ setupSnackbarTimeout();
73
+ };
74
+
75
+ var closeSnackbar = function closeSnackbar(callback) {
76
+ clearTimeout(timeoutRef.current);
77
+ closeAnimation(callback);
78
+ };
79
+
80
+ useImperativeHandle(ref, function () {
81
+ return {
82
+ open: function open() {
83
+ openSnackbar();
84
+ },
85
+ close: function close(callback) {
86
+ closeSnackbar(callback);
87
+ },
88
+ translateY: function translateY(dy) {
89
+ _translateY.setValue(dy);
90
+ }
91
+ };
92
+ });
93
+ useEffect(function () {
94
+ return function () {
95
+ return clearTimeout(timeoutRef.current);
96
+ };
97
+ }, []);
98
+ return /*#__PURE__*/React.createElement(Wrapper, {
99
+ style: {
100
+ zIndex: 10,
101
+ transform: [{
102
+ translateY: _translateY
103
+ }]
104
+ }
105
+ }, /*#__PURE__*/React.createElement(View, {
106
+ testID: "wrapper",
107
+ ref: childrenRef,
108
+ onLayout: function onLayout(_ref3) {
109
+ var height = _ref3.nativeEvent.layout.height;
110
+ setChildrenHeight(height);
111
+
112
+ _translateY.setValue(height);
113
+ }
114
+ }, children));
115
+ });
116
+ SnackbarAnimationWrapper.propTypes = {
117
+ onSnackbarClose: func,
118
+ children: node.isRequired,
119
+ duration: oneOf(['fast', 'default', 'slow', 'indefinite']).isRequired
120
+ };
121
+ SnackbarAnimationWrapper.defaultProps = {
122
+ onSnackbarClose: undefined
123
+ };
124
+ export default SnackbarAnimationWrapper;
@@ -0,0 +1,2 @@
1
+ import Snackbar from './Snackbar';
2
+ export default Snackbar;
@@ -0,0 +1,118 @@
1
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
2
+
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+
5
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
6
+
7
+ import React from 'react';
8
+ import { fireEvent, render, screen } from '@testing-library/react';
9
+ import { ThemeProvider, Snackbar } from '../..';
10
+ describe('<Snackbar />', function () {
11
+ jest.useRealTimers();
12
+ it('should match snapshot', function () {
13
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Snackbar, {
14
+ open: true,
15
+ message: "Make wellbeing universal",
16
+ onClose: jest.fn()
17
+ }))),
18
+ container = _render.container;
19
+
20
+ expect(container).toMatchSnapshot();
21
+ });
22
+ it('should render a minimal snackbar', function () {
23
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Snackbar, {
24
+ open: true,
25
+ message: "Make wellbeing universal",
26
+ onClose: jest.fn()
27
+ })));
28
+ screen.getByRole('alert');
29
+ screen.getByRole('img');
30
+ screen.getByLabelText('success');
31
+ screen.getByText('Make wellbeing universal');
32
+ });
33
+ it('should not render an icon', function () {
34
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Snackbar, {
35
+ open: true,
36
+ message: "Make wellbeing universal",
37
+ onClose: jest.fn(),
38
+ hideIcon: true
39
+ })));
40
+ expect(screen.queryByRole('img')).toBeNull();
41
+ });
42
+ it('should render a custom action button', function () {
43
+ var onActionMock = jest.fn();
44
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Snackbar, {
45
+ open: true,
46
+ message: "Make wellbeing universal",
47
+ onAction: onActionMock,
48
+ onClose: jest.fn(),
49
+ actionLabel: "Let's go"
50
+ })));
51
+ var button = screen.getByRole('button', {
52
+ name: /let's go/i
53
+ });
54
+ fireEvent.click(button);
55
+ expect(onActionMock).toHaveBeenCalledTimes(1);
56
+ });
57
+ it('should render a close button', function () {
58
+ var onCloseMock = jest.fn();
59
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Snackbar, {
60
+ open: true,
61
+ message: "Make wellbeing universal",
62
+ onClose: onCloseMock
63
+ })));
64
+ var button = screen.getByRole('button');
65
+ fireEvent.click(button);
66
+ expect(onCloseMock).toHaveBeenCalledTimes(1);
67
+ });
68
+ it('should close after timeout', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
69
+ var onCloseMock;
70
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
71
+ while (1) {
72
+ switch (_context.prev = _context.next) {
73
+ case 0:
74
+ jest.useFakeTimers();
75
+ onCloseMock = jest.fn();
76
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Snackbar, {
77
+ open: true,
78
+ duration: 1000,
79
+ message: "Make wellbeing universal",
80
+ onClose: onCloseMock,
81
+ hideCloseButton: true
82
+ })));
83
+ expect(screen.queryByRole('button')).toBeNull();
84
+ jest.runAllTimers();
85
+ expect(onCloseMock).toHaveBeenCalledTimes(1);
86
+
87
+ case 6:
88
+ case "end":
89
+ return _context.stop();
90
+ }
91
+ }
92
+ }, _callee);
93
+ })));
94
+ it('should close with timeout set up', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
95
+ var onCloseMock, button;
96
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
97
+ while (1) {
98
+ switch (_context2.prev = _context2.next) {
99
+ case 0:
100
+ onCloseMock = jest.fn();
101
+ render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Snackbar, {
102
+ open: true,
103
+ duration: 1000,
104
+ message: "Make wellbeing universal",
105
+ onClose: onCloseMock
106
+ })));
107
+ button = screen.getByRole('button');
108
+ fireEvent.click(button);
109
+ expect(onCloseMock).toHaveBeenCalledTimes(1);
110
+
111
+ case 5:
112
+ case "end":
113
+ return _context2.stop();
114
+ }
115
+ }
116
+ }, _callee2);
117
+ })));
118
+ });
@@ -0,0 +1,3 @@
1
+ import { Stepper, Step } from './native';
2
+ Stepper.Step = Step;
3
+ export default Stepper;
@@ -0,0 +1,45 @@
1
+ var _templateObject, _templateObject2;
2
+
3
+ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
4
+
5
+ import React from 'react';
6
+ import { number, arrayOf, string } from 'prop-types';
7
+ import styled from 'styled-components';
8
+ import activeDot from '../activeDot';
9
+ import Text from '../../Text';
10
+ var Wrapper = styled.View(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n flex-direction: row;\n justify-content: space-between;\n"])));
11
+ var DotWrapper = styled.View(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n width: 15px;\n"])));
12
+ var Dot = styled.View(function (_ref) {
13
+ var active = _ref.active,
14
+ stepper = _ref.theme.yoga.components.stepper;
15
+ return "\n width: 15px;\n height: 15px;\n\n margin-top: -6px;\n\n border-radius: " + stepper.dot.radius + "px;\n background-color: " + (active ? stepper.dot.backgroundColor.active : stepper.dot.backgroundColor.inactive) + ";\n ";
16
+ });
17
+ var Label = styled(Text.Bold)(function (_ref2) {
18
+ var active = _ref2.active,
19
+ stepper = _ref2.theme.yoga.components.stepper;
20
+ return "\n width: 95px;\n margin-top: 10px;\n margin-left: -40px;\n\n color: " + (active ? stepper.label.color.active : stepper.label.color.inactive) + ";\n\n font-size: " + stepper.label.font.size + "px;\n text-align: center;\n ";
21
+ });
22
+
23
+ var Dots = function Dots(_ref3) {
24
+ var activeStep = _ref3.activeStep,
25
+ labels = _ref3.labels;
26
+ return /*#__PURE__*/React.createElement(Wrapper, null, labels.map(function (label, index) {
27
+ return /*#__PURE__*/React.createElement(DotWrapper, {
28
+ key: label
29
+ }, /*#__PURE__*/React.createElement(Dot, {
30
+ active: activeDot(index, activeStep)
31
+ }), /*#__PURE__*/React.createElement(Label, {
32
+ active: activeDot(index, activeStep)
33
+ }, label));
34
+ }));
35
+ };
36
+
37
+ Dots.propTypes = {
38
+ activeStep: number,
39
+ labels: arrayOf(string)
40
+ };
41
+ Dots.defaultProps = {
42
+ activeStep: 0,
43
+ labels: []
44
+ };
45
+ export default Dots;
@@ -0,0 +1,35 @@
1
+ var _templateObject;
2
+
3
+ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
4
+
5
+ import React from 'react';
6
+ import { number } from 'prop-types';
7
+ import styled from 'styled-components';
8
+ var Wrapper = styled.View(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n position: relative;\n"])));
9
+ var InactiveLine = styled.View(function (_ref) {
10
+ var stepper = _ref.theme.yoga.components.stepper;
11
+ return "\n width: 100%;\n height: 4px;\n\n position: absolute;\n top: 0;\n\n background-color: " + stepper.line.backgroundColor.inactive + ";\n";
12
+ });
13
+ var ActiveLine = styled.View(function (_ref2) {
14
+ var width = _ref2.width,
15
+ stepper = _ref2.theme.yoga.components.stepper;
16
+ return "\n position: absolute;\n top: 0;\n\n background-color: " + stepper.line.backgroundColor.active + ";\n width: " + width + "%;\n height: 4px;\n";
17
+ });
18
+
19
+ var Line = function Line(_ref3) {
20
+ var activeStep = _ref3.activeStep,
21
+ totalSteps = _ref3.totalSteps;
22
+ return /*#__PURE__*/React.createElement(Wrapper, null, /*#__PURE__*/React.createElement(InactiveLine, null), /*#__PURE__*/React.createElement(ActiveLine, {
23
+ width: activeStep <= 0 ? 0 : activeStep / totalSteps * 100
24
+ }));
25
+ };
26
+
27
+ Line.propTypes = {
28
+ activeStep: number,
29
+ totalSteps: number
30
+ };
31
+ Line.defaultProps = {
32
+ activeStep: 0,
33
+ totalSteps: 0
34
+ };
35
+ export default Line;
@@ -0,0 +1,19 @@
1
+ var _templateObject;
2
+
3
+ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
4
+
5
+ import React from 'react';
6
+ import { string } from 'prop-types';
7
+ import styled from 'styled-components';
8
+ var Wrapper = styled.View(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n width: 100%;\n"])));
9
+
10
+ var Step = function Step(props) {
11
+ return /*#__PURE__*/React.createElement(Wrapper, props);
12
+ };
13
+
14
+ Step.displayName = 'Stepper.Step';
15
+ Step.propTypes = {
16
+ /** Label to be displayed below the stepper dot. */
17
+ label: string.isRequired
18
+ };
19
+ export default Step;
@@ -0,0 +1,52 @@
1
+ var _excluded = ["children", "activeStep"];
2
+
3
+ var _templateObject;
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
+ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
8
+
9
+ import React from 'react';
10
+ import styled from 'styled-components';
11
+ import { limitChildren, typeOf } from '../../shared';
12
+ import Line from './Line';
13
+ import Dots from './Dots';
14
+ import Step from './Step';
15
+ var Wrapper = styled.View(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n width: 100%;\n"])));
16
+ var LineWrapper = styled.View(function (_ref) {
17
+ var stepper = _ref.theme.yoga.components.stepper;
18
+ return "\n width: 100%;\n padding: 0 " + stepper.padding.right + "px 0 " + stepper.padding.left + "px;\n";
19
+ });
20
+ /** Stepper is responsible for the logic that drives a stepped workflow, it
21
+ provides a wizard-like workflow by dividing content into logical steps. */
22
+
23
+ var Stepper = function Stepper(_ref2) {
24
+ var children = _ref2.children,
25
+ activeStep = _ref2.activeStep,
26
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded);
27
+
28
+ return /*#__PURE__*/React.createElement(Wrapper, rest, /*#__PURE__*/React.createElement(LineWrapper, null, /*#__PURE__*/React.createElement(Line, {
29
+ activeStep: activeStep,
30
+ totalSteps: React.Children.count(children) - 1
31
+ }), /*#__PURE__*/React.createElement(Dots, {
32
+ activeStep: activeStep,
33
+ labels: React.Children.map(children, function (child) {
34
+ return child.props.label;
35
+ })
36
+ })), React.Children.toArray(children)[activeStep]);
37
+ };
38
+
39
+ Stepper.displayName = 'Stepper';
40
+ Stepper.propTypes = {
41
+ /** Must be a Stepper.Step component. */
42
+ children: typeOf(Step),
43
+
44
+ /** Controls the active step, it receive the index value for showing some
45
+ * step. Starting from 0. */
46
+ activeStep: limitChildren
47
+ };
48
+ Stepper.defaultProps = {
49
+ children: undefined,
50
+ activeStep: 0
51
+ };
52
+ export default Stepper;
@@ -0,0 +1,70 @@
1
+ import React from 'react';
2
+ import { Text } from 'react-native';
3
+ import { render } from '@testing-library/react-native';
4
+ import ThemeProvider from '../../Theme';
5
+ import Stepper from '..';
6
+ describe('<Stepper />', function () {
7
+ describe('Snapshots', function () {
8
+ it('should match snapshot with first step active', function () {
9
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Stepper, {
10
+ activeStep: 0
11
+ }, /*#__PURE__*/React.createElement(Stepper.Step, {
12
+ label: "step one"
13
+ }, /*#__PURE__*/React.createElement(Text, null, "step one content")), /*#__PURE__*/React.createElement(Stepper.Step, {
14
+ label: "step two"
15
+ }, /*#__PURE__*/React.createElement(Text, null, "step two content")), /*#__PURE__*/React.createElement(Stepper.Step, {
16
+ label: "step three"
17
+ }, /*#__PURE__*/React.createElement(Text, null, "step three content"))))),
18
+ container = _render.container,
19
+ toJSON = _render.toJSON;
20
+
21
+ expect(toJSON(container)).toMatchSnapshot();
22
+ });
23
+ it('should match snapshot with second step active', function () {
24
+ var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Stepper, {
25
+ activeStep: 1
26
+ }, /*#__PURE__*/React.createElement(Stepper.Step, {
27
+ label: "step one"
28
+ }, /*#__PURE__*/React.createElement(Text, null, "step one content")), /*#__PURE__*/React.createElement(Stepper.Step, {
29
+ label: "step two"
30
+ }, /*#__PURE__*/React.createElement(Text, null, "step two content")), /*#__PURE__*/React.createElement(Stepper.Step, {
31
+ label: "step three"
32
+ }, /*#__PURE__*/React.createElement(Text, null, "step three content"))))),
33
+ container = _render2.container,
34
+ toJSON = _render2.toJSON;
35
+
36
+ expect(toJSON(container)).toMatchSnapshot();
37
+ });
38
+ });
39
+ describe('Steps', function () {
40
+ it('should change the active step', function () {
41
+ var _render3 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Stepper, {
42
+ activeStep: 0
43
+ }, /*#__PURE__*/React.createElement(Stepper.Step, {
44
+ label: "step one"
45
+ }, /*#__PURE__*/React.createElement(Text, null, "step one content")), /*#__PURE__*/React.createElement(Stepper.Step, {
46
+ label: "step two"
47
+ }, /*#__PURE__*/React.createElement(Text, null, "step two content")), /*#__PURE__*/React.createElement(Stepper.Step, {
48
+ label: "step three"
49
+ }, /*#__PURE__*/React.createElement(Text, null, "step three content"))))),
50
+ queryByText = _render3.queryByText,
51
+ rerender = _render3.rerender;
52
+
53
+ expect(queryByText('step one content')).toBeTruthy();
54
+ expect(queryByText('step two content')).toBeFalsy();
55
+ expect(queryByText('step three content')).toBeFalsy();
56
+ rerender( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Stepper, {
57
+ activeStep: 1
58
+ }, /*#__PURE__*/React.createElement(Stepper.Step, {
59
+ label: "step one"
60
+ }, /*#__PURE__*/React.createElement(Text, null, "step one content")), /*#__PURE__*/React.createElement(Stepper.Step, {
61
+ label: "step two"
62
+ }, /*#__PURE__*/React.createElement(Text, null, "step two content")), /*#__PURE__*/React.createElement(Stepper.Step, {
63
+ label: "step three"
64
+ }, /*#__PURE__*/React.createElement(Text, null, "step three content")))));
65
+ expect(queryByText('step one content')).toBeFalsy();
66
+ expect(queryByText('step two content')).toBeTruthy();
67
+ expect(queryByText('step three content')).toBeFalsy();
68
+ });
69
+ });
70
+ });
@@ -0,0 +1,3 @@
1
+ import Stepper from './Stepper';
2
+ import Step from './Step';
3
+ export { Stepper, Step };