@gympass/yoga 7.36.0 → 7.37.2
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.
- package/cjs/AutoComplete/web/AutoComplete.js +5 -3
- package/cjs/AutoComplete/web/AutoComplete.test.js +152 -0
- package/cjs/Avatar/native/Avatar.test.js +1 -0
- package/cjs/Avatar/web/Avatar.test.js +72 -0
- package/cjs/Banner/native/Banner.js +1 -1
- package/cjs/Banner/native/Banner.test.js +1 -0
- package/cjs/Banner/web/Banner.js +4 -3
- package/cjs/Banner/web/Banner.test.js +121 -0
- package/cjs/BottomSheet/web/BottomSheet.test.js +46 -0
- package/cjs/Box/native/Box.test.js +1 -0
- package/cjs/Box/web/Box.test.js +23 -0
- package/cjs/Button/native/Button.test.js +1 -0
- package/cjs/Button/web/Button.test.js +778 -0
- package/cjs/Card/native/Card/Card.js +1 -1
- package/cjs/Card/native/Card/Card.test.js +1 -0
- package/cjs/Card/native/EventCard/EventCard.test.js +1 -0
- package/cjs/Card/native/GymCard/CheckIn/CheckIn.test.js +1 -0
- package/cjs/Card/native/PlanCard/PlanCard.test.js +1 -0
- package/cjs/Card/web/Card/Card.js +7 -3
- package/cjs/Card/web/Card/Card.test.js +22 -0
- package/cjs/Card/web/EventCard/EventCard.test.js +35 -0
- package/cjs/Card/web/PlanCard/PlanCard.test.js +95 -0
- package/cjs/Checkbox/native/Checkbox.test.js +1 -0
- package/cjs/Checkbox/native/Switch.test.js +1 -0
- package/cjs/Checkbox/web/Checkbox.test.js +161 -0
- package/cjs/Checkbox/web/Switch.test.js +65 -0
- package/cjs/Chips/native/Chips.js +1 -1
- package/cjs/Chips/native/Chips.test.js +1 -0
- package/cjs/Chips/web/Chips.js +4 -3
- package/cjs/Chips/web/Chips.test.js +138 -0
- package/cjs/Dialog/web/Dialog.test.js +70 -0
- package/cjs/Divider/native/Divider.js +1 -1
- package/cjs/Divider/native/Divider.test.js +1 -0
- package/cjs/Divider/web/Divider.js +5 -4
- package/cjs/Divider/web/Divider.test.js +36 -0
- package/cjs/Dropdown/native/Backdrop.test.js +1 -0
- package/cjs/Dropdown/native/Dropdown.js +1 -1
- package/cjs/Dropdown/native/Dropdown.test.js +1 -0
- package/cjs/Dropdown/web/Dropdown.js +6 -3
- package/cjs/Dropdown/web/Dropdown.test.js +102 -0
- package/cjs/Feedback/web/Feedback.test.js +89 -0
- package/cjs/Grid/web/Col.test.js +56 -0
- package/cjs/Grid/web/Container.test.js +22 -0
- package/cjs/Grid/web/Hide.test.js +39 -0
- package/cjs/Grid/web/Row.test.js +22 -0
- package/cjs/Header/web/Header.test.js +44 -0
- package/cjs/Heading/web/Heading.test.js +55 -0
- package/cjs/Icon/native/Icon.test.js +1 -0
- package/cjs/Icon/web/Icon.test.js +53 -0
- package/cjs/Input/native/Email.js +1 -1
- package/cjs/Input/native/Email.test.js +1 -0
- package/cjs/Input/native/Helper.js +1 -1
- package/cjs/Input/native/Input.js +1 -1
- package/cjs/Input/native/Input.test.js +1 -0
- package/cjs/Input/native/Number.js +1 -1
- package/cjs/Input/native/Number.test.js +1 -0
- package/cjs/Input/native/Password.js +1 -1
- package/cjs/Input/native/Password.test.js +1 -0
- package/cjs/Input/native/Tel.js +1 -1
- package/cjs/Input/native/Tel.test.js +1 -0
- package/cjs/Input/web/Email.js +5 -3
- package/cjs/Input/web/Email.test.js +20 -0
- package/cjs/Input/web/Field.js +1 -1
- package/cjs/Input/web/Input.test.js +161 -0
- package/cjs/Input/web/Legend.js +7 -3
- package/cjs/Input/web/Number.js +6 -4
- package/cjs/Input/web/Number.test.js +20 -0
- package/cjs/Input/web/Password.test.js +103 -0
- package/cjs/Input/web/Tel.js +5 -3
- package/cjs/Input/web/Tel.test.js +20 -0
- package/cjs/List/native/List.js +1 -1
- package/cjs/List/native/List.test.js +1 -0
- package/cjs/List/web/List.js +4 -3
- package/cjs/List/web/List.test.js +69 -0
- package/cjs/Progress/native/Progress.js +1 -1
- package/cjs/Progress/native/Progress.test.js +1 -0
- package/cjs/Progress/web/Progress.js +4 -3
- package/cjs/Progress/web/Progress.test.js +229 -0
- package/cjs/RadioGroup/native/Button/RadioButton.js +1 -1
- package/cjs/RadioGroup/native/Button/RadioButton.test.js +1 -0
- package/cjs/RadioGroup/native/Radio/Radio.js +1 -1
- package/cjs/RadioGroup/native/Radio/Radio.test.js +1 -0
- package/cjs/RadioGroup/native/RadioGroup.test.js +1 -0
- package/cjs/RadioGroup/web/Button/RadioButton.js +4 -3
- package/cjs/RadioGroup/web/Button/RadioButton.test.js +132 -0
- package/cjs/RadioGroup/web/Radio/Radio.js +4 -3
- package/cjs/RadioGroup/web/Radio/Radio.test.js +119 -0
- package/cjs/RadioGroup/web/RadioGroup.test.js +93 -0
- package/cjs/Rating/native/Rating.test.js +1 -0
- package/cjs/Rating/web/Rating.test.js +201 -0
- package/cjs/Result/native/Result.test.js +1 -0
- package/cjs/Slider/native/Slider.test.js +1 -0
- package/cjs/Slider/web/Slider.test.js +95 -0
- package/cjs/Snackbar/native/Snackbar.test.js +1 -0
- package/cjs/Snackbar/web/Snackbar.js +5 -11
- package/cjs/Snackbar/web/Snackbar.test.js +135 -0
- package/cjs/Stepper/native/Stepper.test.js +1 -0
- package/cjs/Stepper/web/Stepper.test.js +75 -0
- package/cjs/Tag/native/Tag.test.js +1 -0
- package/cjs/Tag/web/Tag.test.js +87 -0
- package/cjs/Text/native/Text.test.js +1 -0
- package/cjs/Text/sharedTextStyle.js +1 -1
- package/cjs/Text/textStyle.android.js +1 -1
- package/cjs/Text/textStyle.ios.js +1 -1
- package/cjs/Text/textStyle.web.js +1 -1
- package/cjs/Text/web/Text.test.js +157 -0
- package/cjs/TextArea/native/TextArea.test.js +1 -0
- package/cjs/TextArea/web/TextArea.test.js +18 -0
- package/cjs/Theme/Provider/web/FontLoader.test.js +19 -0
- package/cjs/Theme/Provider/web/GlobalStyle.test.js +27 -0
- package/cjs/Theme/helpers/themeReader/native/native.test.js +1 -0
- package/cjs/Theme/helpers/themeReader/web/web.test.js +54 -0
- package/esm/AutoComplete/web/AutoComplete.js +5 -4
- package/esm/AutoComplete/web/AutoComplete.test.js +135 -0
- package/esm/Avatar/index.native.js +4 -0
- package/esm/Avatar/native/Avatar.js +96 -0
- package/esm/Avatar/native/Avatar.test.js +46 -0
- package/esm/Avatar/native/AvatarCircle.js +24 -0
- package/esm/Avatar/web/Avatar.test.js +63 -0
- package/esm/Banner/index.native.js +2 -0
- package/esm/Banner/native/Banner.js +128 -0
- package/esm/Banner/native/Banner.test.js +103 -0
- package/esm/Banner/native/index.js +2 -0
- package/esm/Banner/web/Banner.js +4 -5
- package/esm/Banner/web/Banner.test.js +109 -0
- package/esm/BottomSheet/web/BottomSheet.test.js +33 -0
- package/esm/Box/index.native.js +2 -0
- package/esm/Box/native/Box.js +4 -0
- package/esm/Box/native/Box.test.js +16 -0
- package/esm/Box/native/index.js +2 -0
- package/esm/Box/web/Box.test.js +16 -0
- package/esm/Button/index.native.js +8 -0
- package/esm/Button/native/Button.js +110 -0
- package/esm/Button/native/Button.test.js +475 -0
- package/esm/Button/native/Icon.js +82 -0
- package/esm/Button/native/Link.js +35 -0
- package/esm/Button/native/Text.js +74 -0
- package/esm/Button/native/withTouchable.js +63 -0
- package/esm/Button/web/Button.test.js +764 -0
- package/esm/Card/index.native.js +2 -0
- package/esm/Card/native/Card/Actions.js +12 -0
- package/esm/Card/native/Card/Card.js +92 -0
- package/esm/Card/native/Card/Card.test.js +15 -0
- package/esm/Card/native/Card/Content.js +8 -0
- package/esm/Card/native/Card/Header.js +8 -0
- package/esm/Card/native/Card/index.js +8 -0
- package/esm/Card/native/EventCard/EventCard.js +169 -0
- package/esm/Card/native/EventCard/EventCard.test.js +65 -0
- package/esm/Card/native/EventCard/index.js +2 -0
- package/esm/Card/native/GymCard/CheckIn/Avatar.js +17 -0
- package/esm/Card/native/GymCard/CheckIn/CheckIn.js +66 -0
- package/esm/Card/native/GymCard/CheckIn/CheckIn.test.js +39 -0
- package/esm/Card/native/GymCard/CheckIn/Content.js +11 -0
- package/esm/Card/native/GymCard/CheckIn/Header.js +11 -0
- package/esm/Card/native/GymCard/CheckIn/index.js +2 -0
- package/esm/Card/native/GymCard/index.js +5 -0
- package/esm/Card/native/PlanCard/Actions.js +24 -0
- package/esm/Card/native/PlanCard/Content.js +82 -0
- package/esm/Card/native/PlanCard/List.js +73 -0
- package/esm/Card/native/PlanCard/PlanCard.js +54 -0
- package/esm/Card/native/PlanCard/PlanCard.test.js +84 -0
- package/esm/Card/native/PlanCard/Subtitle.js +15 -0
- package/esm/Card/native/PlanCard/Tag.js +33 -0
- package/esm/Card/native/PlanCard/index.js +15 -0
- package/esm/Card/native/index.js +5 -0
- package/esm/Card/web/Card/Card.js +7 -5
- package/esm/Card/web/Card/Card.test.js +14 -0
- package/esm/Card/web/EventCard/EventCard.test.js +27 -0
- package/esm/Card/web/PlanCard/PlanCard.test.js +85 -0
- package/esm/Checkbox/index.native.js +3 -0
- package/esm/Checkbox/native/Checkbox.js +179 -0
- package/esm/Checkbox/native/Checkbox.test.js +115 -0
- package/esm/Checkbox/native/Switch.js +115 -0
- package/esm/Checkbox/native/Switch.test.js +54 -0
- package/esm/Checkbox/native/index.js +3 -0
- package/esm/Checkbox/web/Checkbox.test.js +153 -0
- package/esm/Checkbox/web/Switch.test.js +56 -0
- package/esm/Chips/index.native.js +2 -0
- package/esm/Chips/native/Chips.js +104 -0
- package/esm/Chips/native/Chips.test.js +134 -0
- package/esm/Chips/native/Counter.js +20 -0
- package/esm/Chips/native/index.js +2 -0
- package/esm/Chips/web/Chips.js +4 -5
- package/esm/Chips/web/Chips.test.js +128 -0
- package/esm/Dialog/web/Dialog.test.js +54 -0
- package/esm/Divider/index.native.js +2 -0
- package/esm/Divider/native/Divider.js +29 -0
- package/esm/Divider/native/Divider.test.js +29 -0
- package/esm/Divider/native/index.js +2 -0
- package/esm/Divider/web/Divider.js +5 -6
- package/esm/Divider/web/Divider.test.js +29 -0
- package/esm/Dropdown/index.native.js +2 -0
- package/esm/Dropdown/native/Backdrop.js +93 -0
- package/esm/Dropdown/native/Backdrop.test.js +26 -0
- package/esm/Dropdown/native/Dropdown.js +142 -0
- package/esm/Dropdown/native/Dropdown.test.js +78 -0
- package/esm/Dropdown/native/Options.android.js +66 -0
- package/esm/Dropdown/native/Options.ios.js +71 -0
- package/esm/Dropdown/native/index.js +2 -0
- package/esm/Dropdown/web/Dropdown.js +5 -4
- package/esm/Dropdown/web/Dropdown.test.js +93 -0
- package/esm/Feedback/web/Feedback.test.js +83 -0
- package/esm/Grid/web/Col.test.js +48 -0
- package/esm/Grid/web/Container.test.js +14 -0
- package/esm/Grid/web/Hide.test.js +31 -0
- package/esm/Grid/web/Row.test.js +14 -0
- package/esm/Header/web/Header.test.js +34 -0
- package/esm/Heading/web/Heading.test.js +45 -0
- package/esm/Icon/index.native.js +2 -0
- package/esm/Icon/native/Icon.test.js +47 -0
- package/esm/Icon/native/index.js +2 -0
- package/esm/Icon/web/Icon.test.js +47 -0
- package/esm/Input/index.native.js +6 -0
- package/esm/Input/native/Email.js +15 -0
- package/esm/Input/native/Email.test.js +13 -0
- package/esm/Input/native/Helper.js +62 -0
- package/esm/Input/native/Input.js +234 -0
- package/esm/Input/native/Input.test.js +181 -0
- package/esm/Input/native/Number.js +12 -0
- package/esm/Input/native/Number.test.js +13 -0
- package/esm/Input/native/Password.js +112 -0
- package/esm/Input/native/Password.test.js +125 -0
- package/esm/Input/native/Tel.js +14 -0
- package/esm/Input/native/Tel.test.js +13 -0
- package/esm/Input/native/index.js +6 -0
- package/esm/Input/web/Email.js +5 -5
- package/esm/Input/web/Email.test.js +13 -0
- package/esm/Input/web/Field.js +1 -1
- package/esm/Input/web/Input.test.js +145 -0
- package/esm/Input/web/Legend.js +7 -5
- package/esm/Input/web/Number.js +6 -6
- package/esm/Input/web/Number.test.js +13 -0
- package/esm/Input/web/Password.test.js +90 -0
- package/esm/Input/web/Tel.js +5 -5
- package/esm/Input/web/Tel.test.js +13 -0
- package/esm/List/index.native.js +3 -0
- package/esm/List/native/List.js +22 -0
- package/esm/List/native/List.test.js +106 -0
- package/esm/List/native/ListItem.js +51 -0
- package/esm/List/native/index.js +3 -0
- package/esm/List/web/List.js +4 -4
- package/esm/List/web/List.test.js +62 -0
- package/esm/Progress/index.native.js +2 -0
- package/esm/Progress/native/Progress.js +103 -0
- package/esm/Progress/native/Progress.test.js +222 -0
- package/esm/Progress/native/index.js +2 -0
- package/esm/Progress/web/Progress.js +4 -4
- package/esm/Progress/web/Progress.test.js +222 -0
- package/esm/RadioGroup/index.native.js +4 -0
- package/esm/RadioGroup/native/Button/RadioButton.js +64 -0
- package/esm/RadioGroup/native/Button/RadioButton.test.js +94 -0
- package/esm/RadioGroup/native/Radio/Radio.js +88 -0
- package/esm/RadioGroup/native/Radio/Radio.test.js +102 -0
- package/esm/RadioGroup/native/RadioGroup.js +66 -0
- package/esm/RadioGroup/native/RadioGroup.test.js +48 -0
- package/esm/RadioGroup/native/index.js +4 -0
- package/esm/RadioGroup/web/Button/RadioButton.js +4 -4
- package/esm/RadioGroup/web/Button/RadioButton.test.js +121 -0
- package/esm/RadioGroup/web/Radio/Radio.js +4 -4
- package/esm/RadioGroup/web/Radio/Radio.test.js +108 -0
- package/esm/RadioGroup/web/RadioGroup.test.js +83 -0
- package/esm/Rating/index.native.js +2 -0
- package/esm/Rating/native/Rating.js +186 -0
- package/esm/Rating/native/Rating.test.js +121 -0
- package/esm/Rating/native/index.js +2 -0
- package/esm/Rating/web/Rating.test.js +184 -0
- package/esm/Result/index.native.js +8 -0
- package/esm/Result/native/Attendances.js +55 -0
- package/esm/Result/native/Details.js +97 -0
- package/esm/Result/native/Rate.js +35 -0
- package/esm/Result/native/Result.js +86 -0
- package/esm/Result/native/Result.test.js +107 -0
- package/esm/Result/native/ResultButton.js +13 -0
- package/esm/Result/native/Tags.js +41 -0
- package/esm/Result/native/TinyTextIcon.js +18 -0
- package/esm/Result/native/index.js +2 -0
- package/esm/Slider/index.native.js +2 -0
- package/esm/Slider/native/Label.js +19 -0
- package/esm/Slider/native/Marker.js +68 -0
- package/esm/Slider/native/Slider.js +156 -0
- package/esm/Slider/native/Slider.test.js +115 -0
- package/esm/Slider/native/Step.js +14 -0
- package/esm/Slider/native/Tooltip.js +90 -0
- package/esm/Slider/web/Slider.test.js +86 -0
- package/esm/Snackbar/index.native.js +2 -0
- package/esm/Snackbar/native/Snackbar.js +199 -0
- package/esm/Snackbar/native/Snackbar.test.js +98 -0
- package/esm/Snackbar/native/SnackbarAnimationWrapper.js +124 -0
- package/esm/Snackbar/native/index.js +2 -0
- package/esm/Snackbar/web/Snackbar.js +4 -12
- package/esm/Snackbar/web/Snackbar.test.js +116 -0
- package/esm/Stepper/index.native.js +3 -0
- package/esm/Stepper/native/Dots.js +45 -0
- package/esm/Stepper/native/Line.js +35 -0
- package/esm/Stepper/native/Step.js +19 -0
- package/esm/Stepper/native/Stepper.js +52 -0
- package/esm/Stepper/native/Stepper.test.js +68 -0
- package/esm/Stepper/native/index.js +3 -0
- package/esm/Stepper/web/Stepper.test.js +67 -0
- package/esm/Tag/index.native.js +4 -0
- package/esm/Tag/native/Informative.js +71 -0
- package/esm/Tag/native/Tag.js +75 -0
- package/esm/Tag/native/Tag.test.js +92 -0
- package/esm/Tag/native/index.js +2 -0
- package/esm/Tag/web/Tag.test.js +79 -0
- package/esm/Text/index.native.js +16 -0
- package/esm/Text/native/Text.js +69 -0
- package/esm/Text/native/Text.test.js +149 -0
- package/esm/Text/native/index.js +2 -0
- package/esm/Text/sharedTextStyle.js +1 -1
- package/esm/Text/textStyle.android.js +1 -1
- package/esm/Text/textStyle.ios.js +1 -1
- package/esm/Text/textStyle.web.js +1 -1
- package/esm/Text/web/Text.test.js +149 -0
- package/esm/TextArea/index.native.js +2 -0
- package/esm/TextArea/native/TextArea.js +59 -0
- package/esm/TextArea/native/TextArea.test.js +11 -0
- package/esm/TextArea/native/index.js +2 -0
- package/esm/TextArea/web/TextArea.test.js +11 -0
- package/esm/Theme/Provider/index.native.js +2 -0
- package/esm/Theme/Provider/native/index.js +2 -0
- package/esm/Theme/Provider/web/FontLoader.test.js +11 -0
- package/esm/Theme/Provider/web/GlobalStyle.test.js +17 -0
- package/esm/Theme/helpers/themeReader/native/native.test.js +53 -0
- package/esm/Theme/helpers/themeReader/web/web.test.js +41 -0
- package/esm/Theme/index.native.js +5 -0
- package/esm/index.native.js +24 -0
- package/esm/shared/index.native.js +2 -0
- package/package.json +6 -6
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, fireEvent, toJSON } from '@testing-library/react-native';
|
|
3
|
+
import { Booking } from '@gympass/yoga-icons';
|
|
4
|
+
import ThemeProvider from '../../Theme';
|
|
5
|
+
import Button from '..';
|
|
6
|
+
describe('<Button />', function () {
|
|
7
|
+
describe('Snapshots', function () {
|
|
8
|
+
describe('primary buttons', function () {
|
|
9
|
+
describe('Without props', function () {
|
|
10
|
+
it('should match snapshot with default Button', function () {
|
|
11
|
+
var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, null))),
|
|
12
|
+
container = _render.container;
|
|
13
|
+
|
|
14
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
it('should match snapshot with text Button', function () {
|
|
17
|
+
var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, null))),
|
|
18
|
+
container = _render2.container;
|
|
19
|
+
|
|
20
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
it('should match snapshot with link Button', function () {
|
|
23
|
+
var _render3 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Link, null))),
|
|
24
|
+
container = _render3.container;
|
|
25
|
+
|
|
26
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
29
|
+
var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
30
|
+
icon: Booking
|
|
31
|
+
}))),
|
|
32
|
+
container = _render4.container;
|
|
33
|
+
|
|
34
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
37
|
+
var _render5 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
38
|
+
icon: Booking
|
|
39
|
+
}))),
|
|
40
|
+
container = _render5.container;
|
|
41
|
+
|
|
42
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
describe('With inverted prop', function () {
|
|
46
|
+
it('should match snapshot with default Button', function () {
|
|
47
|
+
var _render6 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
48
|
+
inverted: true
|
|
49
|
+
}))),
|
|
50
|
+
container = _render6.container;
|
|
51
|
+
|
|
52
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
53
|
+
});
|
|
54
|
+
it('should match snapshot with text Button', function () {
|
|
55
|
+
var _render7 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
56
|
+
inverted: true
|
|
57
|
+
}))),
|
|
58
|
+
container = _render7.container;
|
|
59
|
+
|
|
60
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
63
|
+
var _render8 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
64
|
+
inverted: true,
|
|
65
|
+
icon: Booking
|
|
66
|
+
}))),
|
|
67
|
+
container = _render8.container;
|
|
68
|
+
|
|
69
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
70
|
+
});
|
|
71
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
72
|
+
var _render9 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
73
|
+
inverted: true,
|
|
74
|
+
icon: Booking
|
|
75
|
+
}))),
|
|
76
|
+
container = _render9.container;
|
|
77
|
+
|
|
78
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
79
|
+
});
|
|
80
|
+
it('should match snapshot with icon Button', function () {
|
|
81
|
+
var _render10 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Icon, {
|
|
82
|
+
icon: Booking,
|
|
83
|
+
inverted: true
|
|
84
|
+
}))),
|
|
85
|
+
container = _render10.container;
|
|
86
|
+
|
|
87
|
+
expect(container).toMatchSnapshot();
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
describe('With small prop', function () {
|
|
91
|
+
it('should match snapshot with default Button', function () {
|
|
92
|
+
var _render11 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
93
|
+
small: true
|
|
94
|
+
}))),
|
|
95
|
+
container = _render11.container;
|
|
96
|
+
|
|
97
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
98
|
+
});
|
|
99
|
+
it('should match snapshot with text Button', function () {
|
|
100
|
+
var _render12 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
101
|
+
small: true
|
|
102
|
+
}))),
|
|
103
|
+
container = _render12.container;
|
|
104
|
+
|
|
105
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
106
|
+
});
|
|
107
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
108
|
+
var _render13 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
109
|
+
small: true,
|
|
110
|
+
icon: Booking
|
|
111
|
+
}))),
|
|
112
|
+
container = _render13.container;
|
|
113
|
+
|
|
114
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
115
|
+
});
|
|
116
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
117
|
+
var _render14 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
118
|
+
small: true,
|
|
119
|
+
icon: Booking
|
|
120
|
+
}))),
|
|
121
|
+
container = _render14.container;
|
|
122
|
+
|
|
123
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe('With full prop', function () {
|
|
127
|
+
it('should match snapshot with default Button', function () {
|
|
128
|
+
var _render15 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
129
|
+
full: true
|
|
130
|
+
}))),
|
|
131
|
+
container = _render15.container;
|
|
132
|
+
|
|
133
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
134
|
+
});
|
|
135
|
+
it('should match snapshot with text Button', function () {
|
|
136
|
+
var _render16 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
137
|
+
full: true
|
|
138
|
+
}))),
|
|
139
|
+
container = _render16.container;
|
|
140
|
+
|
|
141
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
142
|
+
});
|
|
143
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
144
|
+
var _render17 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
145
|
+
full: true,
|
|
146
|
+
icon: Booking
|
|
147
|
+
}))),
|
|
148
|
+
container = _render17.container;
|
|
149
|
+
|
|
150
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
151
|
+
});
|
|
152
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
153
|
+
var _render18 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
154
|
+
full: true,
|
|
155
|
+
icon: Booking
|
|
156
|
+
}))),
|
|
157
|
+
container = _render18.container;
|
|
158
|
+
|
|
159
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
describe('With large prop', function () {
|
|
163
|
+
it('should match snapshot icon Button with large prop', function () {
|
|
164
|
+
var _render19 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Icon, {
|
|
165
|
+
icon: Booking,
|
|
166
|
+
large: true
|
|
167
|
+
}))),
|
|
168
|
+
container = _render19.container;
|
|
169
|
+
|
|
170
|
+
expect(container).toMatchSnapshot();
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
describe('secondary buttons', function () {
|
|
175
|
+
describe('Without props', function () {
|
|
176
|
+
it('should match snapshot with default Button', function () {
|
|
177
|
+
var _render20 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
178
|
+
secondary: true
|
|
179
|
+
}))),
|
|
180
|
+
container = _render20.container;
|
|
181
|
+
|
|
182
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
183
|
+
});
|
|
184
|
+
it('should match snapshot with text Button', function () {
|
|
185
|
+
var _render21 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
186
|
+
secondary: true
|
|
187
|
+
}))),
|
|
188
|
+
container = _render21.container;
|
|
189
|
+
|
|
190
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
191
|
+
});
|
|
192
|
+
it('should match snapshot with link Button', function () {
|
|
193
|
+
var _render22 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Link, {
|
|
194
|
+
secondary: true
|
|
195
|
+
}))),
|
|
196
|
+
container = _render22.container;
|
|
197
|
+
|
|
198
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
199
|
+
});
|
|
200
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
201
|
+
var _render23 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
202
|
+
icon: Booking,
|
|
203
|
+
secondary: true
|
|
204
|
+
}))),
|
|
205
|
+
container = _render23.container;
|
|
206
|
+
|
|
207
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
208
|
+
});
|
|
209
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
210
|
+
var _render24 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
211
|
+
icon: Booking,
|
|
212
|
+
secondary: true
|
|
213
|
+
}))),
|
|
214
|
+
container = _render24.container;
|
|
215
|
+
|
|
216
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
217
|
+
});
|
|
218
|
+
it('should match snapshot with icon Button with Icon', function () {
|
|
219
|
+
var _render25 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Icon, {
|
|
220
|
+
icon: Booking,
|
|
221
|
+
secondary: true
|
|
222
|
+
}))),
|
|
223
|
+
container = _render25.container;
|
|
224
|
+
|
|
225
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
describe('With inverted prop', function () {
|
|
229
|
+
it('should match snapshot with default Button', function () {
|
|
230
|
+
var _render26 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
231
|
+
inverted: true,
|
|
232
|
+
secondary: true
|
|
233
|
+
}))),
|
|
234
|
+
container = _render26.container;
|
|
235
|
+
|
|
236
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
237
|
+
});
|
|
238
|
+
it('should match snapshot with text Button', function () {
|
|
239
|
+
var _render27 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
240
|
+
inverted: true,
|
|
241
|
+
secondary: true
|
|
242
|
+
}))),
|
|
243
|
+
container = _render27.container;
|
|
244
|
+
|
|
245
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
246
|
+
});
|
|
247
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
248
|
+
var _render28 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
249
|
+
inverted: true,
|
|
250
|
+
icon: Booking,
|
|
251
|
+
secondary: true
|
|
252
|
+
}))),
|
|
253
|
+
container = _render28.container;
|
|
254
|
+
|
|
255
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
256
|
+
});
|
|
257
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
258
|
+
var _render29 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
259
|
+
inverted: true,
|
|
260
|
+
icon: Booking,
|
|
261
|
+
secondary: true
|
|
262
|
+
}))),
|
|
263
|
+
container = _render29.container;
|
|
264
|
+
|
|
265
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
266
|
+
});
|
|
267
|
+
it('should match snapshot with icon Button with Icon', function () {
|
|
268
|
+
var _render30 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Icon, {
|
|
269
|
+
inverted: true,
|
|
270
|
+
icon: Booking,
|
|
271
|
+
secondary: true
|
|
272
|
+
}))),
|
|
273
|
+
container = _render30.container;
|
|
274
|
+
|
|
275
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
describe('With small prop', function () {
|
|
279
|
+
it('should match snapshot with default Button', function () {
|
|
280
|
+
var _render31 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
281
|
+
small: true,
|
|
282
|
+
secondary: true
|
|
283
|
+
}))),
|
|
284
|
+
container = _render31.container;
|
|
285
|
+
|
|
286
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
287
|
+
});
|
|
288
|
+
it('should match snapshot with text Button', function () {
|
|
289
|
+
var _render32 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
290
|
+
small: true,
|
|
291
|
+
secondary: true
|
|
292
|
+
}))),
|
|
293
|
+
container = _render32.container;
|
|
294
|
+
|
|
295
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
296
|
+
});
|
|
297
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
298
|
+
var _render33 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
299
|
+
small: true,
|
|
300
|
+
icon: Booking,
|
|
301
|
+
secondary: true
|
|
302
|
+
}))),
|
|
303
|
+
container = _render33.container;
|
|
304
|
+
|
|
305
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
306
|
+
});
|
|
307
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
308
|
+
var _render34 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
309
|
+
small: true,
|
|
310
|
+
icon: Booking,
|
|
311
|
+
secondary: true
|
|
312
|
+
}))),
|
|
313
|
+
container = _render34.container;
|
|
314
|
+
|
|
315
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
describe('With full prop', function () {
|
|
319
|
+
it('should match snapshot with default Button', function () {
|
|
320
|
+
var _render35 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
321
|
+
full: true,
|
|
322
|
+
secondary: true
|
|
323
|
+
}))),
|
|
324
|
+
container = _render35.container;
|
|
325
|
+
|
|
326
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
327
|
+
});
|
|
328
|
+
it('should match snapshot with text Button', function () {
|
|
329
|
+
var _render36 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
330
|
+
full: true,
|
|
331
|
+
secondary: true
|
|
332
|
+
}))),
|
|
333
|
+
container = _render36.container;
|
|
334
|
+
|
|
335
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
336
|
+
});
|
|
337
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
338
|
+
var _render37 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
339
|
+
full: true,
|
|
340
|
+
icon: Booking,
|
|
341
|
+
secondary: true
|
|
342
|
+
}))),
|
|
343
|
+
container = _render37.container;
|
|
344
|
+
|
|
345
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
346
|
+
});
|
|
347
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
348
|
+
var _render38 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
349
|
+
full: true,
|
|
350
|
+
icon: Booking,
|
|
351
|
+
secondary: true
|
|
352
|
+
}))),
|
|
353
|
+
container = _render38.container;
|
|
354
|
+
|
|
355
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
describe('With large prop', function () {
|
|
359
|
+
it('should match snapshot icon Button with large prop', function () {
|
|
360
|
+
var _render39 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Icon, {
|
|
361
|
+
large: true,
|
|
362
|
+
icon: Booking,
|
|
363
|
+
secondary: true
|
|
364
|
+
}))),
|
|
365
|
+
container = _render39.container;
|
|
366
|
+
|
|
367
|
+
expect(container).toMatchSnapshot();
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
describe('disabled buttons', function () {
|
|
372
|
+
describe('With disabled prop', function () {
|
|
373
|
+
it('should match snapshot with default Button', function () {
|
|
374
|
+
var _render40 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
375
|
+
disabled: true
|
|
376
|
+
}))),
|
|
377
|
+
container = _render40.container;
|
|
378
|
+
|
|
379
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
380
|
+
});
|
|
381
|
+
it('should match snapshot with text Button', function () {
|
|
382
|
+
var _render41 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
383
|
+
disabled: true
|
|
384
|
+
}))),
|
|
385
|
+
container = _render41.container;
|
|
386
|
+
|
|
387
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
388
|
+
});
|
|
389
|
+
it('should match snapshot with link Button', function () {
|
|
390
|
+
var _render42 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Link, {
|
|
391
|
+
disabled: true
|
|
392
|
+
}))),
|
|
393
|
+
container = _render42.container;
|
|
394
|
+
|
|
395
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
396
|
+
});
|
|
397
|
+
it('should match snapshot with default Button with Icon', function () {
|
|
398
|
+
var _render43 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
399
|
+
disabled: true,
|
|
400
|
+
icon: Booking
|
|
401
|
+
}))),
|
|
402
|
+
container = _render43.container;
|
|
403
|
+
|
|
404
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
405
|
+
});
|
|
406
|
+
it('should match snapshot with text Button with Icon', function () {
|
|
407
|
+
var _render44 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
408
|
+
disabled: true,
|
|
409
|
+
icon: Booking
|
|
410
|
+
}))),
|
|
411
|
+
container = _render44.container;
|
|
412
|
+
|
|
413
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
414
|
+
});
|
|
415
|
+
it('should match snapshot with icon Button with Icon', function () {
|
|
416
|
+
var _render45 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Icon, {
|
|
417
|
+
disabled: true,
|
|
418
|
+
icon: Booking
|
|
419
|
+
}))),
|
|
420
|
+
container = _render45.container;
|
|
421
|
+
|
|
422
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
});
|
|
427
|
+
describe('onPress prop', function () {
|
|
428
|
+
it('should call onPress function when click on Button', function () {
|
|
429
|
+
var onPressMock = jest.fn();
|
|
430
|
+
|
|
431
|
+
var _render46 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
432
|
+
onPress: onPressMock
|
|
433
|
+
}, "Button"))),
|
|
434
|
+
getByText = _render46.getByText;
|
|
435
|
+
|
|
436
|
+
fireEvent.press(getByText('Button'));
|
|
437
|
+
expect(onPressMock).toHaveBeenCalled();
|
|
438
|
+
});
|
|
439
|
+
it('should call onPress function when press on Button.Text', function () {
|
|
440
|
+
var onPressMock = jest.fn();
|
|
441
|
+
|
|
442
|
+
var _render47 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Text, {
|
|
443
|
+
onPress: onPressMock
|
|
444
|
+
}, "Button.Text"))),
|
|
445
|
+
getByText = _render47.getByText;
|
|
446
|
+
|
|
447
|
+
fireEvent.press(getByText('Button.Text'));
|
|
448
|
+
expect(onPressMock).toHaveBeenCalled();
|
|
449
|
+
});
|
|
450
|
+
it('should call onPress function when press on Button.Icon', function () {
|
|
451
|
+
var onPressMock = jest.fn();
|
|
452
|
+
|
|
453
|
+
var _render48 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button.Icon, {
|
|
454
|
+
onPress: onPressMock,
|
|
455
|
+
icon: Booking
|
|
456
|
+
}))),
|
|
457
|
+
getByRole = _render48.getByRole;
|
|
458
|
+
|
|
459
|
+
fireEvent.press(getByRole('button'));
|
|
460
|
+
expect(onPressMock).toHaveBeenCalled();
|
|
461
|
+
});
|
|
462
|
+
it('should not call onPress function when press on Button disabled', function () {
|
|
463
|
+
var onPressMock = jest.fn();
|
|
464
|
+
|
|
465
|
+
var _render49 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Button, {
|
|
466
|
+
disabled: true,
|
|
467
|
+
onPress: onPressMock
|
|
468
|
+
}, "Button"))),
|
|
469
|
+
getByText = _render49.getByText;
|
|
470
|
+
|
|
471
|
+
fireEvent.press(getByText('Button'));
|
|
472
|
+
expect(onPressMock).not.toHaveBeenCalled();
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
var _excluded = ["icon", "theme", "small", "pressed", "disabled", "inverted", "secondary"];
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
10
|
+
|
|
11
|
+
import React, { forwardRef } from 'react';
|
|
12
|
+
import styled, { withTheme } from 'styled-components';
|
|
13
|
+
import { node, oneOfType, func, bool } from 'prop-types';
|
|
14
|
+
import Icon from '../../Icon';
|
|
15
|
+
import withTouchable from './withTouchable';
|
|
16
|
+
var ButtonContainer = styled.View(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n\n ", "\n"])), function (_ref) {
|
|
17
|
+
var small = _ref.small,
|
|
18
|
+
secondary = _ref.secondary,
|
|
19
|
+
button = _ref.theme.yoga.components.button,
|
|
20
|
+
disabled = _ref.disabled,
|
|
21
|
+
inverted = _ref.inverted,
|
|
22
|
+
pressed = _ref.pressed;
|
|
23
|
+
var state = secondary ? 'secondary' : 'primary';
|
|
24
|
+
return "\n border-radius: " + button.border.radius + "px;\n\n background-color: " + button.types.contained.backgroundColor[state]["default"] + ";\n\n width: " + (small ? button.height.small : button.height["default"]) + "px;\n height: " + (small ? button.height.small : button.height["default"]) + "px;\n\n " + (!disabled && pressed ? "\n background-color: " + button.types.contained.backgroundColor[state].pressed + ";\n " : '') + "\n\n " + (disabled ? "\n background-color: " + button.types.contained.backgroundColor.disabled + ";\n " : '') + "\n\n " + (inverted && !disabled ? "\n background-color: " + button.types.contained.font["default"].color + ";\n " : '') + "\n ";
|
|
25
|
+
});
|
|
26
|
+
var ButtonIcon = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
27
|
+
var icon = _ref2.icon,
|
|
28
|
+
button = _ref2.theme.yoga.components.button,
|
|
29
|
+
small = _ref2.small,
|
|
30
|
+
pressed = _ref2.pressed,
|
|
31
|
+
disabled = _ref2.disabled,
|
|
32
|
+
inverted = _ref2.inverted,
|
|
33
|
+
secondary = _ref2.secondary,
|
|
34
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
35
|
+
|
|
36
|
+
var state = secondary ? 'secondary' : 'primary';
|
|
37
|
+
var textColor = button.types.contained.font["default"].color;
|
|
38
|
+
|
|
39
|
+
if (disabled) {
|
|
40
|
+
textColor = button.types.contained.font.disabled.color;
|
|
41
|
+
} else if (inverted) {
|
|
42
|
+
textColor = button.types.contained.backgroundColor[state]["default"];
|
|
43
|
+
|
|
44
|
+
if (pressed) {
|
|
45
|
+
textColor = button.types.contained.backgroundColor[state].pressed;
|
|
46
|
+
}
|
|
47
|
+
} else if (pressed) {
|
|
48
|
+
textColor = button.types.contained.font.pressed.color;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return /*#__PURE__*/React.createElement(ButtonContainer, _extends({}, props, {
|
|
52
|
+
ref: ref,
|
|
53
|
+
small: small,
|
|
54
|
+
pressed: pressed,
|
|
55
|
+
disabled: disabled,
|
|
56
|
+
inverted: inverted,
|
|
57
|
+
secondary: secondary,
|
|
58
|
+
accessibilityRole: "button"
|
|
59
|
+
}), /*#__PURE__*/React.createElement(Icon, {
|
|
60
|
+
as: icon,
|
|
61
|
+
fill: textColor,
|
|
62
|
+
size: small ? button.icon.size.small : button.icon.size["default"]
|
|
63
|
+
}));
|
|
64
|
+
});
|
|
65
|
+
ButtonIcon.propTypes = {
|
|
66
|
+
small: bool,
|
|
67
|
+
disabled: bool,
|
|
68
|
+
pressed: bool,
|
|
69
|
+
inverted: bool,
|
|
70
|
+
secondary: bool,
|
|
71
|
+
icon: oneOfType([node, func])
|
|
72
|
+
};
|
|
73
|
+
ButtonIcon.defaultProps = {
|
|
74
|
+
small: false,
|
|
75
|
+
disabled: false,
|
|
76
|
+
pressed: false,
|
|
77
|
+
inverted: false,
|
|
78
|
+
secondary: false,
|
|
79
|
+
icon: undefined
|
|
80
|
+
};
|
|
81
|
+
ButtonIcon.displayName = 'Button.Icon';
|
|
82
|
+
export default withTouchable(withTheme(ButtonIcon));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
|
|
3
|
+
function _extends() { _extends = Object.assign || 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 _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
6
|
+
|
|
7
|
+
import React, { forwardRef } from 'react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { bool } from 'prop-types';
|
|
10
|
+
import { hexToRgb } from '@gympass/yoga-common';
|
|
11
|
+
import withTouchable from './withTouchable';
|
|
12
|
+
import { Label } from './Button';
|
|
13
|
+
var Link = styled(Label)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
14
|
+
var disabled = _ref.disabled,
|
|
15
|
+
pressed = _ref.pressed,
|
|
16
|
+
secondary = _ref.secondary,
|
|
17
|
+
link = _ref.theme.yoga.components.button.types.link;
|
|
18
|
+
var state = secondary ? 'secondary' : 'primary';
|
|
19
|
+
return "\n color: " + link.font[state].color + ";\n\n " + (disabled ? "color: " + link.font.disabled.color + ";" : '') + "\n " + (!disabled && pressed ? "color: " + hexToRgb(link.font[state].color, 0.75) + ";" : '') + "\n ";
|
|
20
|
+
});
|
|
21
|
+
var ButtonLink = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
22
|
+
return /*#__PURE__*/React.createElement(Link, _extends({}, props, {
|
|
23
|
+
ref: ref
|
|
24
|
+
}));
|
|
25
|
+
});
|
|
26
|
+
ButtonLink.propTypes = {
|
|
27
|
+
disabled: bool,
|
|
28
|
+
secondary: bool
|
|
29
|
+
};
|
|
30
|
+
ButtonLink.defaultProps = {
|
|
31
|
+
disabled: false,
|
|
32
|
+
secondary: false
|
|
33
|
+
};
|
|
34
|
+
ButtonLink.displayName = 'Button.Link';
|
|
35
|
+
export default withTouchable(ButtonLink);
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var _excluded = ["children", "disabled", "pressed", "small", "secondary", "inverted", "icon", "theme"];
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2;
|
|
4
|
+
|
|
5
|
+
function _extends() { _extends = Object.assign || 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); }
|
|
6
|
+
|
|
7
|
+
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; }
|
|
8
|
+
|
|
9
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
10
|
+
|
|
11
|
+
import React, { forwardRef } from 'react';
|
|
12
|
+
import styled, { withTheme } from 'styled-components';
|
|
13
|
+
import { hexToRgb } from '@gympass/yoga-common';
|
|
14
|
+
import withTouchable from './withTouchable';
|
|
15
|
+
import { Label, ButtonContainer } from './Button';
|
|
16
|
+
var LabelText = styled(Label)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
17
|
+
var color = _ref.color;
|
|
18
|
+
return "color: " + color + ";";
|
|
19
|
+
});
|
|
20
|
+
var ButtonContainerText = styled(ButtonContainer)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref2) {
|
|
21
|
+
var button = _ref2.theme.yoga.components.button;
|
|
22
|
+
return "\n background-color: " + button.types.text.backgroundColor + ";\n ";
|
|
23
|
+
});
|
|
24
|
+
var ButtonText = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
25
|
+
var children = _ref3.children,
|
|
26
|
+
disabled = _ref3.disabled,
|
|
27
|
+
pressed = _ref3.pressed,
|
|
28
|
+
small = _ref3.small,
|
|
29
|
+
secondary = _ref3.secondary,
|
|
30
|
+
inverted = _ref3.inverted,
|
|
31
|
+
Icon = _ref3.icon,
|
|
32
|
+
_ref3$theme$yoga = _ref3.theme.yoga,
|
|
33
|
+
colors = _ref3$theme$yoga.colors,
|
|
34
|
+
button = _ref3$theme$yoga.components.button,
|
|
35
|
+
rest = _objectWithoutPropertiesLoose(_ref3, _excluded);
|
|
36
|
+
|
|
37
|
+
var state = secondary ? 'secondary' : 'primary';
|
|
38
|
+
var textColor = colors[state];
|
|
39
|
+
|
|
40
|
+
if (disabled) {
|
|
41
|
+
textColor = colors.text.disabled;
|
|
42
|
+
} else if (inverted) {
|
|
43
|
+
textColor = colors.white;
|
|
44
|
+
|
|
45
|
+
if (pressed) {
|
|
46
|
+
textColor = hexToRgb(colors.white, 0.75);
|
|
47
|
+
}
|
|
48
|
+
} else if (pressed) {
|
|
49
|
+
textColor = hexToRgb(colors[state], 0.75);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return /*#__PURE__*/React.createElement(ButtonContainerText, _extends({}, rest, {
|
|
53
|
+
disabled: disabled,
|
|
54
|
+
pressed: pressed,
|
|
55
|
+
small: small,
|
|
56
|
+
ref: ref
|
|
57
|
+
}), Icon && /*#__PURE__*/React.createElement(Icon, {
|
|
58
|
+
width: small ? button.icon.size.small : button.icon.size["default"],
|
|
59
|
+
height: small ? button.icon.size.small : button.icon.size["default"],
|
|
60
|
+
fill: textColor,
|
|
61
|
+
style: {
|
|
62
|
+
marginRight: button.icon.margin.right
|
|
63
|
+
}
|
|
64
|
+
}), /*#__PURE__*/React.createElement(LabelText, {
|
|
65
|
+
disabled: disabled,
|
|
66
|
+
pressed: pressed,
|
|
67
|
+
small: small,
|
|
68
|
+
secondary: secondary,
|
|
69
|
+
color: textColor
|
|
70
|
+
}, children));
|
|
71
|
+
});
|
|
72
|
+
ButtonText.propTypes = ButtonContainer.propTypes;
|
|
73
|
+
ButtonText.defaultProps = ButtonContainer.defaultProps;
|
|
74
|
+
export default withTouchable(withTheme(ButtonText));
|