@gympass/yoga 7.37.0 → 7.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.test.js +1 -0
- 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/Card.native.theme.js +9 -7
- package/cjs/Card/Card.theme.js +1 -1
- package/cjs/Card/Card.web.theme.js +8 -6
- 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/Actions.js +1 -1
- package/cjs/Card/native/PlanCard/Content.js +1 -1
- package/cjs/Card/native/PlanCard/PlanCard.test.js +1 -0
- 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/Actions.js +1 -1
- package/cjs/Card/web/PlanCard/Content.js +28 -32
- 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.test.js +1 -0
- package/cjs/Chips/web/Chips.test.js +138 -0
- package/cjs/Dialog/web/Dialog.test.js +70 -0
- package/cjs/Divider/native/Divider.test.js +1 -0
- package/cjs/Divider/web/Divider.test.js +36 -0
- package/cjs/Dropdown/native/Backdrop.test.js +1 -0
- package/cjs/Dropdown/native/Dropdown.test.js +1 -0
- 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/Heading/web/RightButton.js +1 -1
- package/cjs/Icon/native/Icon.test.js +1 -0
- package/cjs/Icon/web/Icon.test.js +53 -0
- package/cjs/Input/native/Email.test.js +1 -0
- package/cjs/Input/native/Input.test.js +1 -0
- package/cjs/Input/native/Number.test.js +1 -0
- package/cjs/Input/native/Password.test.js +1 -0
- package/cjs/Input/native/Tel.test.js +1 -0
- 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/Number.test.js +20 -0
- package/cjs/Input/web/Password.test.js +103 -0
- package/cjs/Input/web/Tel.test.js +20 -0
- package/cjs/List/native/List.test.js +1 -0
- package/cjs/List/web/List.test.js +69 -0
- package/cjs/Progress/native/Progress.test.js +1 -0
- package/cjs/Progress/web/Progress.test.js +229 -0
- package/cjs/RadioGroup/native/Button/RadioButton.test.js +1 -0
- 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.test.js +132 -0
- 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.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.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.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/Card.native.theme.js +9 -7
- package/esm/Card/Card.theme.js +1 -1
- package/esm/Card/Card.web.theme.js +8 -6
- 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 +75 -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.test.js +14 -0
- package/esm/Card/web/EventCard/EventCard.test.js +27 -0
- package/esm/Card/web/PlanCard/Actions.js +1 -1
- package/esm/Card/web/PlanCard/Content.js +25 -30
- 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.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.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.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/Heading/web/RightButton.js +1 -1
- 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.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/Number.test.js +13 -0
- package/esm/Input/web/Password.test.js +90 -0
- 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.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.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.test.js +121 -0
- 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 +100 -0
- package/esm/Snackbar/native/SnackbarAnimationWrapper.js +124 -0
- package/esm/Snackbar/native/index.js +2 -0
- 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,104 @@
|
|
|
1
|
+
var _excluded = ["children", "selected", "counter", "icons", "disabled", "onToggle", "onPress", "theme"];
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
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 from 'react';
|
|
12
|
+
import { number, arrayOf, bool, func, node } from 'prop-types';
|
|
13
|
+
import styled, { css, withTheme } from 'styled-components';
|
|
14
|
+
import { TouchableWithoutFeedback } from 'react-native';
|
|
15
|
+
import Counter from './Counter';
|
|
16
|
+
import { theme } from '../../Theme';
|
|
17
|
+
import Text from '../../Text';
|
|
18
|
+
import Icon from '../../Icon';
|
|
19
|
+
var Wrapper = styled.View(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n height: 32px;\n max-width: 216px;\n\n flex-direction: row;\n align-items: center;\n justify-content: flex-start;\n\n margin-right: ", "px;\n padding: ", "px;\n\n border-style: solid;\n border-color: ", ";\n border-radius: ", "px;\n border-width: ", "px;\n\n background-color: ", ";\n\n overflow: hidden;\n\n ", "\n\n ", "\n"])), theme.spacing.xxsmall, theme.spacing.xxsmall, theme.colors.elements.lineAndBorders, theme.radii.small, theme.borders.small, theme.colors.white, function (_ref) {
|
|
20
|
+
var disabled = _ref.disabled;
|
|
21
|
+
return disabled ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n color: ", ";\n\n border-color: ", ";\n "])), theme.colors.elements.backgroundAndDisabled, theme.colors.elements.selectionAndIcons, theme.colors.elements.lineAndBorders) : '';
|
|
22
|
+
}, function (_ref2) {
|
|
23
|
+
var selected = _ref2.selected;
|
|
24
|
+
return selected ? css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n background-color: ", ";\n border-color: transparent;\n "])), theme.colors.yoga) : '';
|
|
25
|
+
});
|
|
26
|
+
var StyledChips = styled(Text)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n font-size: ", "px;\n line-height: ", "px;\n\n flex-shrink: 1;\n\n ", "\n"])), theme.fontSizes.xsmall, theme.lineHeights.xsmall, function (_ref3) {
|
|
27
|
+
var selected = _ref3.selected;
|
|
28
|
+
return selected ? css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n color: ", ";\n "])), theme.colors.primary) : '';
|
|
29
|
+
});
|
|
30
|
+
var Chips = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
31
|
+
var children = _ref4.children,
|
|
32
|
+
selected = _ref4.selected,
|
|
33
|
+
counter = _ref4.counter,
|
|
34
|
+
icons = _ref4.icons,
|
|
35
|
+
disabled = _ref4.disabled,
|
|
36
|
+
onToggle = _ref4.onToggle,
|
|
37
|
+
_ref4$onPress = _ref4.onPress,
|
|
38
|
+
onPress = _ref4$onPress === void 0 ? onToggle : _ref4$onPress,
|
|
39
|
+
spacing = _ref4.theme.yoga.spacing,
|
|
40
|
+
props = _objectWithoutPropertiesLoose(_ref4, _excluded);
|
|
41
|
+
|
|
42
|
+
var FirstIcon = icons[0],
|
|
43
|
+
SecondIcon = icons[1];
|
|
44
|
+
return /*#__PURE__*/React.createElement(TouchableWithoutFeedback, _extends({
|
|
45
|
+
onPress: onPress,
|
|
46
|
+
ref: ref
|
|
47
|
+
}, props), /*#__PURE__*/React.createElement(Wrapper, {
|
|
48
|
+
disabled: disabled,
|
|
49
|
+
selected: selected
|
|
50
|
+
}, SecondIcon && /*#__PURE__*/React.createElement(Icon, {
|
|
51
|
+
as: SecondIcon,
|
|
52
|
+
fill: selected ? 'primary' : 'secondary',
|
|
53
|
+
width: "small",
|
|
54
|
+
height: "small",
|
|
55
|
+
style: {
|
|
56
|
+
marginRight: children ? spacing.xxxsmall : undefined
|
|
57
|
+
}
|
|
58
|
+
}), /*#__PURE__*/React.createElement(StyledChips, {
|
|
59
|
+
as: selected ? Text.Medium : Text,
|
|
60
|
+
selected: selected,
|
|
61
|
+
numberOfLines: 1
|
|
62
|
+
}, children), selected && counter && !disabled && /*#__PURE__*/React.createElement(Counter, {
|
|
63
|
+
value: counter
|
|
64
|
+
}), FirstIcon && /*#__PURE__*/React.createElement(Icon, {
|
|
65
|
+
as: FirstIcon,
|
|
66
|
+
fill: selected ? 'primary' : 'secondary',
|
|
67
|
+
width: "small",
|
|
68
|
+
height: "small",
|
|
69
|
+
style: {
|
|
70
|
+
marginLeft: children ? spacing.xxxsmall : undefined
|
|
71
|
+
}
|
|
72
|
+
})));
|
|
73
|
+
});
|
|
74
|
+
Chips.propTypes = {
|
|
75
|
+
/** text to be displayed */
|
|
76
|
+
children: node,
|
|
77
|
+
|
|
78
|
+
/** if the chip is selected */
|
|
79
|
+
selected: bool,
|
|
80
|
+
|
|
81
|
+
/** will display a three digit number, if the value is greater than 999 a plus
|
|
82
|
+
* sign will be displayed instead. ex: "+999" */
|
|
83
|
+
counter: number,
|
|
84
|
+
|
|
85
|
+
/** disable chip */
|
|
86
|
+
disabled: bool,
|
|
87
|
+
|
|
88
|
+
/** a list of max two icons from @gympass/yoga-icons package */
|
|
89
|
+
icons: arrayOf(func),
|
|
90
|
+
|
|
91
|
+
/** onPress event */
|
|
92
|
+
onToggle: func,
|
|
93
|
+
onPress: func
|
|
94
|
+
};
|
|
95
|
+
Chips.defaultProps = {
|
|
96
|
+
children: undefined,
|
|
97
|
+
selected: false,
|
|
98
|
+
disabled: false,
|
|
99
|
+
counter: undefined,
|
|
100
|
+
icons: [],
|
|
101
|
+
onToggle: undefined,
|
|
102
|
+
onPress: undefined
|
|
103
|
+
};
|
|
104
|
+
export default withTheme(Chips);
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, toJSON, fireEvent } from '@testing-library/react-native';
|
|
3
|
+
import { MapPin, ChevronDown } from '@gympass/yoga-icons';
|
|
4
|
+
import { ThemeProvider, Chips } from '../..';
|
|
5
|
+
describe('<Chips />', function () {
|
|
6
|
+
describe('Snapshots', function () {
|
|
7
|
+
it('should match snapshot', function () {
|
|
8
|
+
var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, null, "Classes"))),
|
|
9
|
+
container = _render.container;
|
|
10
|
+
|
|
11
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
it('should match snapshot with disabled prop', function () {
|
|
14
|
+
var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
15
|
+
disabled: true
|
|
16
|
+
}, "Classes"))),
|
|
17
|
+
container = _render2.container;
|
|
18
|
+
|
|
19
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
it('should match snapshot with more than one Chip', function () {
|
|
22
|
+
var _render3 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, null, "Classes"), /*#__PURE__*/React.createElement(Chips, null, "Gyms and studios"), /*#__PURE__*/React.createElement(Chips, null, "Personal trainers"))),
|
|
23
|
+
container = _render3.container;
|
|
24
|
+
|
|
25
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
it('should match snapshot with a long text', function () {
|
|
28
|
+
var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, null, "Classes with a very long text"))),
|
|
29
|
+
container = _render4.container;
|
|
30
|
+
|
|
31
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
32
|
+
});
|
|
33
|
+
describe('selected', function () {
|
|
34
|
+
it('should match snapshot', function () {
|
|
35
|
+
var _render5 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
36
|
+
selected: true
|
|
37
|
+
}, "Classes"))),
|
|
38
|
+
container = _render5.container;
|
|
39
|
+
|
|
40
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
41
|
+
});
|
|
42
|
+
it('should match snapshot with more than one Chip', function () {
|
|
43
|
+
var _render6 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, null, "Classes"), /*#__PURE__*/React.createElement(Chips, {
|
|
44
|
+
selected: true
|
|
45
|
+
}, "Gyms and studios"), /*#__PURE__*/React.createElement(Chips, {
|
|
46
|
+
selected: true
|
|
47
|
+
}, "Personal trainers"))),
|
|
48
|
+
container = _render6.container;
|
|
49
|
+
|
|
50
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
describe('counter', function () {
|
|
54
|
+
it('should match snapshot', function () {
|
|
55
|
+
var _render7 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
56
|
+
counter: 8
|
|
57
|
+
}, "Classes"))),
|
|
58
|
+
container = _render7.container;
|
|
59
|
+
|
|
60
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
61
|
+
});
|
|
62
|
+
it('should match snapshot with more than one Chip', function () {
|
|
63
|
+
var _render8 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
64
|
+
counter: 8
|
|
65
|
+
}, "Classes"), /*#__PURE__*/React.createElement(Chips, {
|
|
66
|
+
counter: 52,
|
|
67
|
+
selected: true
|
|
68
|
+
}, "Gyms and studios"), /*#__PURE__*/React.createElement(Chips, {
|
|
69
|
+
counter: 1732,
|
|
70
|
+
selected: true
|
|
71
|
+
}, "Personal trainers"))),
|
|
72
|
+
container = _render8.container;
|
|
73
|
+
|
|
74
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
describe('icon', function () {
|
|
78
|
+
it('should match selected snapshot', function () {
|
|
79
|
+
var _render9 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
80
|
+
counter: 8,
|
|
81
|
+
icon: [MapPin]
|
|
82
|
+
}, "Location"), /*#__PURE__*/React.createElement(Chips, {
|
|
83
|
+
counter: 8,
|
|
84
|
+
icon: [MapPin, ChevronDown]
|
|
85
|
+
}, "Classes"), /*#__PURE__*/React.createElement(Chips, {
|
|
86
|
+
icon: [MapPin, ChevronDown]
|
|
87
|
+
}, "Gyms and studios"), /*#__PURE__*/React.createElement(Chips, {
|
|
88
|
+
icon: [MapPin]
|
|
89
|
+
}, "Personal trainers"), /*#__PURE__*/React.createElement(Chips, {
|
|
90
|
+
counter: 8,
|
|
91
|
+
selected: true,
|
|
92
|
+
icon: [MapPin]
|
|
93
|
+
}, "Activities"), /*#__PURE__*/React.createElement(Chips, {
|
|
94
|
+
counter: 8,
|
|
95
|
+
selected: true,
|
|
96
|
+
icon: [MapPin, ChevronDown]
|
|
97
|
+
}, "Language"), /*#__PURE__*/React.createElement(Chips, {
|
|
98
|
+
selected: true,
|
|
99
|
+
icon: [MapPin, ChevronDown]
|
|
100
|
+
}, "Categories"), /*#__PURE__*/React.createElement(Chips, {
|
|
101
|
+
selected: true,
|
|
102
|
+
icon: [MapPin]
|
|
103
|
+
}, "Availability"))),
|
|
104
|
+
container = _render9.container;
|
|
105
|
+
|
|
106
|
+
expect(toJSON(container)).toMatchSnapshot();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe('Events', function () {
|
|
111
|
+
it('should toggle using onPress', function () {
|
|
112
|
+
var toggleMock = jest.fn();
|
|
113
|
+
|
|
114
|
+
var _render10 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
115
|
+
onPress: toggleMock
|
|
116
|
+
}, "Classes"))),
|
|
117
|
+
getByText = _render10.getByText;
|
|
118
|
+
|
|
119
|
+
fireEvent.press(getByText('Classes'));
|
|
120
|
+
expect(toggleMock).toHaveBeenCalled();
|
|
121
|
+
});
|
|
122
|
+
it('should toggle using onToggle', function () {
|
|
123
|
+
var toggleMock = jest.fn();
|
|
124
|
+
|
|
125
|
+
var _render11 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
126
|
+
onToggle: toggleMock
|
|
127
|
+
}, "Classes"))),
|
|
128
|
+
getByText = _render11.getByText;
|
|
129
|
+
|
|
130
|
+
fireEvent.press(getByText('Classes'));
|
|
131
|
+
expect(toggleMock).toHaveBeenCalled();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
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 styled from 'styled-components';
|
|
7
|
+
import { number, oneOfType, string } from 'prop-types';
|
|
8
|
+
import { theme } from '../../Theme';
|
|
9
|
+
import Text from '../../Text';
|
|
10
|
+
var Wrapper = styled(Text.Medium)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n\n height: 16px;\n min-width: 16px;\n\n padding-right: 5px;\n padding-left: 5px;\n margin-left: ", "px;\n\n color: ", ";\n font-size: ", "px;\n line-height: ", "px;\n\n border-radius: ", "px;\n background-color: ", ";\n\n overflow: hidden;\n"])), theme.spacing.xxxsmall, theme.colors.white, theme.fontSizes.xsmall, theme.lineHeights.xsmall, theme.radii.small, theme.colors.primary);
|
|
11
|
+
|
|
12
|
+
var Counter = function Counter(_ref) {
|
|
13
|
+
var value = _ref.value;
|
|
14
|
+
return /*#__PURE__*/React.createElement(Wrapper, null, Number(value) > 999 ? '+999' : value);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
Counter.propTypes = {
|
|
18
|
+
value: oneOfType([number, string]).isRequired
|
|
19
|
+
};
|
|
20
|
+
export default Counter;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { fireEvent, render } from '@testing-library/react';
|
|
3
|
+
import { MapPin, ChevronDown } from '@gympass/yoga-icons';
|
|
4
|
+
import { ThemeProvider, Chips } from '../..';
|
|
5
|
+
describe('<Chips />', function () {
|
|
6
|
+
describe('Snapshots', function () {
|
|
7
|
+
it('should match snapshot', function () {
|
|
8
|
+
var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, null, "Classes"))),
|
|
9
|
+
container = _render.container;
|
|
10
|
+
|
|
11
|
+
expect(container).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
it('should match snapshot with disabled prop', function () {
|
|
14
|
+
var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
15
|
+
disabled: true
|
|
16
|
+
}, "Classes"))),
|
|
17
|
+
container = _render2.container;
|
|
18
|
+
|
|
19
|
+
expect(container).toMatchSnapshot();
|
|
20
|
+
});
|
|
21
|
+
it('should match snapshot with more than one Chip', function () {
|
|
22
|
+
var _render3 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, null, "Classes"), /*#__PURE__*/React.createElement(Chips, null, "Gyms and studios"), /*#__PURE__*/React.createElement(Chips, null, "Personal trainers"))),
|
|
23
|
+
container = _render3.container;
|
|
24
|
+
|
|
25
|
+
expect(container).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
describe('selected', function () {
|
|
28
|
+
it('should match snapshot', function () {
|
|
29
|
+
var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
30
|
+
selected: true
|
|
31
|
+
}, "Classes"))),
|
|
32
|
+
container = _render4.container;
|
|
33
|
+
|
|
34
|
+
expect(container).toMatchSnapshot();
|
|
35
|
+
});
|
|
36
|
+
it('should match snapshot with more than one Chip', function () {
|
|
37
|
+
var _render5 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, null, "Classes"), /*#__PURE__*/React.createElement(Chips, {
|
|
38
|
+
selected: true
|
|
39
|
+
}, "Gyms and studios"), /*#__PURE__*/React.createElement(Chips, {
|
|
40
|
+
selected: true
|
|
41
|
+
}, "Personal trainers"))),
|
|
42
|
+
container = _render5.container;
|
|
43
|
+
|
|
44
|
+
expect(container).toMatchSnapshot();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('counter', function () {
|
|
48
|
+
it('should match snapshot', function () {
|
|
49
|
+
var _render6 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
50
|
+
counter: 8
|
|
51
|
+
}, "Classes"))),
|
|
52
|
+
container = _render6.container;
|
|
53
|
+
|
|
54
|
+
expect(container).toMatchSnapshot();
|
|
55
|
+
});
|
|
56
|
+
it('should match snapshot with more than one Chip', function () {
|
|
57
|
+
var _render7 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
58
|
+
counter: 8
|
|
59
|
+
}, "Classes"), /*#__PURE__*/React.createElement(Chips, {
|
|
60
|
+
counter: 52,
|
|
61
|
+
selected: true
|
|
62
|
+
}, "Gyms and studios"), /*#__PURE__*/React.createElement(Chips, {
|
|
63
|
+
counter: 1732,
|
|
64
|
+
selected: true
|
|
65
|
+
}, "Personal trainers"))),
|
|
66
|
+
container = _render7.container;
|
|
67
|
+
|
|
68
|
+
expect(container).toMatchSnapshot();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
describe('icon', function () {
|
|
72
|
+
it('should match selected snapshot', function () {
|
|
73
|
+
var _render8 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
74
|
+
counter: 8,
|
|
75
|
+
icon: [MapPin]
|
|
76
|
+
}, "Location"), /*#__PURE__*/React.createElement(Chips, {
|
|
77
|
+
counter: 8,
|
|
78
|
+
icon: [MapPin, ChevronDown]
|
|
79
|
+
}, "Classes"), /*#__PURE__*/React.createElement(Chips, {
|
|
80
|
+
icon: [MapPin, ChevronDown]
|
|
81
|
+
}, "Gyms and studios"), /*#__PURE__*/React.createElement(Chips, {
|
|
82
|
+
icon: [MapPin]
|
|
83
|
+
}, "Personal trainers"), /*#__PURE__*/React.createElement(Chips, {
|
|
84
|
+
counter: 8,
|
|
85
|
+
selected: true,
|
|
86
|
+
icon: [MapPin]
|
|
87
|
+
}, "Activities"), /*#__PURE__*/React.createElement(Chips, {
|
|
88
|
+
counter: 8,
|
|
89
|
+
selected: true,
|
|
90
|
+
icon: [MapPin, ChevronDown]
|
|
91
|
+
}, "Language"), /*#__PURE__*/React.createElement(Chips, {
|
|
92
|
+
selected: true,
|
|
93
|
+
icon: [MapPin, ChevronDown]
|
|
94
|
+
}, "Categories"), /*#__PURE__*/React.createElement(Chips, {
|
|
95
|
+
selected: true,
|
|
96
|
+
icon: [MapPin]
|
|
97
|
+
}, "Availability"))),
|
|
98
|
+
container = _render8.container;
|
|
99
|
+
|
|
100
|
+
expect(container).toMatchSnapshot();
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe('Events', function () {
|
|
105
|
+
it('should toggle', function () {
|
|
106
|
+
var toggleMock = jest.fn();
|
|
107
|
+
|
|
108
|
+
var _render9 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
109
|
+
onClick: toggleMock
|
|
110
|
+
}, "Classes"))),
|
|
111
|
+
getByText = _render9.getByText;
|
|
112
|
+
|
|
113
|
+
fireEvent.click(getByText('Classes'));
|
|
114
|
+
expect(toggleMock).toHaveBeenCalled();
|
|
115
|
+
});
|
|
116
|
+
it('should toggle using onToggle', function () {
|
|
117
|
+
var toggleMock = jest.fn();
|
|
118
|
+
|
|
119
|
+
var _render10 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Chips, {
|
|
120
|
+
onToggle: toggleMock
|
|
121
|
+
}, "Classes"))),
|
|
122
|
+
getByText = _render10.getByText;
|
|
123
|
+
|
|
124
|
+
fireEvent.click(getByText('Classes'));
|
|
125
|
+
expect(toggleMock).toHaveBeenCalled();
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { screen, render, fireEvent, cleanup } from '@testing-library/react';
|
|
3
|
+
import { ThemeProvider, Button } from '../..';
|
|
4
|
+
import Dialog from '.';
|
|
5
|
+
describe('<Dialog />', function () {
|
|
6
|
+
afterEach(cleanup);
|
|
7
|
+
it('should match snapshot', function () {
|
|
8
|
+
var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Dialog, {
|
|
9
|
+
isOpen: true
|
|
10
|
+
}, /*#__PURE__*/React.createElement(Dialog.Header, null, "Title"), /*#__PURE__*/React.createElement(Dialog.Content, null, "Subtitle"), /*#__PURE__*/React.createElement(Dialog.Footer, null, /*#__PURE__*/React.createElement(Button, {
|
|
11
|
+
secondary: true
|
|
12
|
+
}, "Ok, got it"))))),
|
|
13
|
+
baseElement = _render.baseElement;
|
|
14
|
+
|
|
15
|
+
expect(baseElement).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
it('should match snapshot with close button', function () {
|
|
18
|
+
var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Dialog, {
|
|
19
|
+
isOpen: true,
|
|
20
|
+
onClose: jest.fn()
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Dialog.Header, null, "Title"), /*#__PURE__*/React.createElement(Dialog.Content, null, "Subtitle"), /*#__PURE__*/React.createElement(Dialog.Footer, null, /*#__PURE__*/React.createElement(Button, {
|
|
22
|
+
secondary: true
|
|
23
|
+
}, "Ok, got it"))))),
|
|
24
|
+
baseElement = _render2.baseElement;
|
|
25
|
+
|
|
26
|
+
expect(baseElement).toMatchSnapshot();
|
|
27
|
+
});
|
|
28
|
+
it('should render a minimal dialog', function () {
|
|
29
|
+
var onActionMock = jest.fn();
|
|
30
|
+
render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Dialog, {
|
|
31
|
+
isOpen: true
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Dialog.Header, null, "Title"), /*#__PURE__*/React.createElement(Dialog.Content, null, "Subtitle"), /*#__PURE__*/React.createElement(Dialog.Footer, null, /*#__PURE__*/React.createElement(Button, {
|
|
33
|
+
onClick: onActionMock,
|
|
34
|
+
secondary: true
|
|
35
|
+
}, "Ok, got it")))));
|
|
36
|
+
screen.getByText('Title');
|
|
37
|
+
screen.getByText('Subtitle');
|
|
38
|
+
var button = screen.getByRole('button', {
|
|
39
|
+
name: /Ok, got it/i
|
|
40
|
+
});
|
|
41
|
+
fireEvent.click(button);
|
|
42
|
+
expect(onActionMock).toHaveBeenCalledTimes(1);
|
|
43
|
+
});
|
|
44
|
+
it('should render with close button', function () {
|
|
45
|
+
var onCloseMock = jest.fn();
|
|
46
|
+
render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Dialog, {
|
|
47
|
+
isOpen: true,
|
|
48
|
+
onClose: onCloseMock
|
|
49
|
+
}, /*#__PURE__*/React.createElement(Dialog.Header, null, "Title"))));
|
|
50
|
+
var button = screen.getByRole('button');
|
|
51
|
+
fireEvent.click(button);
|
|
52
|
+
expect(onCloseMock).toHaveBeenCalledTimes(1);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
|
|
3
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
4
|
+
|
|
5
|
+
import { bool } from 'prop-types';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import styled, { css, withTheme } from 'styled-components';
|
|
8
|
+
var StyledDivider = styled.View(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
9
|
+
var _ref$theme$yoga = _ref.theme.yoga,
|
|
10
|
+
borders = _ref$theme$yoga.borders,
|
|
11
|
+
colors = _ref$theme$yoga.colors,
|
|
12
|
+
vertical = _ref.vertical;
|
|
13
|
+
return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n ", ";\n ", ";\n\n border-color: ", ";\n "])), vertical ? 'height: auto' : 'width: auto', vertical ? "border-left-width: " + borders.small : "border-bottom-width: " + borders.small, colors.text.disabled);
|
|
14
|
+
});
|
|
15
|
+
var Divider = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
16
|
+
var vertical = _ref2.vertical;
|
|
17
|
+
return /*#__PURE__*/React.createElement(StyledDivider, {
|
|
18
|
+
vertical: vertical,
|
|
19
|
+
ref: ref
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
Divider.propTypes = {
|
|
23
|
+
/** If this value is defined, the divider will be in vertical when the flexDirection is row type */
|
|
24
|
+
vertical: bool
|
|
25
|
+
};
|
|
26
|
+
Divider.defaultProps = {
|
|
27
|
+
vertical: false
|
|
28
|
+
};
|
|
29
|
+
export default withTheme(Divider);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react-native';
|
|
3
|
+
import { ThemeProvider, Divider, Box, Text } from '../..';
|
|
4
|
+
describe('<Divider />', function () {
|
|
5
|
+
it('should create a divider component', function () {
|
|
6
|
+
var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Box, {
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "column",
|
|
9
|
+
minWidth: 300,
|
|
10
|
+
justifyContent: "space-between"
|
|
11
|
+
}, /*#__PURE__*/React.createElement(Text.H4, null, "First Content"), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Text.H4, null, "Second Content")))),
|
|
12
|
+
container = _render.container;
|
|
13
|
+
|
|
14
|
+
expect(container).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
it('should create vertical divider component', function () {
|
|
17
|
+
var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Box, {
|
|
18
|
+
display: "flex",
|
|
19
|
+
flexDirection: "row",
|
|
20
|
+
minWidth: 300,
|
|
21
|
+
justifyContent: "space-between"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Text.H4, null, "First Content"), /*#__PURE__*/React.createElement(Divider, {
|
|
23
|
+
vertical: true
|
|
24
|
+
}), /*#__PURE__*/React.createElement(Text.H4, null, "Second Content")))),
|
|
25
|
+
container = _render2.container;
|
|
26
|
+
|
|
27
|
+
expect(container).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { ThemeProvider, Divider, Box, Text } from '../..';
|
|
4
|
+
describe('<Divider />', function () {
|
|
5
|
+
it('should create a divider component', function () {
|
|
6
|
+
var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Box, {
|
|
7
|
+
flex: 1,
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "column",
|
|
10
|
+
minHeight: 50
|
|
11
|
+
}, /*#__PURE__*/React.createElement(Text.Regular, null, "First Content"), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Text.Regular, null, "Second Content")))),
|
|
12
|
+
container = _render.container;
|
|
13
|
+
|
|
14
|
+
expect(container).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
it('should create a vertical divider component', function () {
|
|
17
|
+
var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Box, {
|
|
18
|
+
flex: 1,
|
|
19
|
+
display: "flex",
|
|
20
|
+
flexDirection: "row",
|
|
21
|
+
minHeight: 50
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Text.Regular, null, "First Content"), /*#__PURE__*/React.createElement(Divider, {
|
|
23
|
+
vertical: true
|
|
24
|
+
}), /*#__PURE__*/React.createElement(Text.Regular, null, "Second Content")))),
|
|
25
|
+
container = _render2.container;
|
|
26
|
+
|
|
27
|
+
expect(container).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var _excluded = ["visible", "title", "children", "onClose", "theme"];
|
|
2
|
+
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
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, { useEffect, useState } from 'react';
|
|
12
|
+
import styled, { withTheme } from 'styled-components';
|
|
13
|
+
import { node, string, func, bool } from 'prop-types';
|
|
14
|
+
import { Animated, TouchableWithoutFeedback, Easing, Modal } from 'react-native';
|
|
15
|
+
import Text from '../../Text';
|
|
16
|
+
var ClosableArea = styled(Animated.View)(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
17
|
+
var colors = _ref.theme.yoga.colors;
|
|
18
|
+
return "\n position: relative;\n width: 100%;\n height: 100%;\n\n background-color: " + colors.text.primary + ";\n ";
|
|
19
|
+
});
|
|
20
|
+
var ContentWrapper = styled(Animated.View)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n position: absolute;\n justify-content: flex-end;\n\n width: 100%;\n"])));
|
|
21
|
+
var Content = styled.View(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref2) {
|
|
22
|
+
var dropdown = _ref2.theme.yoga.components.dropdown;
|
|
23
|
+
return "\n justify-content: center;\n width: 100%;\n\n background-color: " + dropdown.backdrop.content.backgroundColor + ";\n border-top-left-radius: " + dropdown.backdrop.content.border.radius.topLeft + "px;\n border-top-right-radius: " + dropdown.backdrop.content.border.radius.topRight + "px;\n ";
|
|
24
|
+
});
|
|
25
|
+
var Title = styled(Text.Bold)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref3) {
|
|
26
|
+
var dropdown = _ref3.theme.yoga.components.dropdown;
|
|
27
|
+
return "\n width: 100%;\n padding:\n " + dropdown.backdrop.content.title.padding.top + "px\n " + dropdown.backdrop.content.title.padding.right + "px\n " + dropdown.backdrop.content.title.padding.bottom + "px\n " + dropdown.backdrop.content.title.padding.left + "px;\n\n font-size: " + dropdown.backdrop.content.title.font.size + "px;\n\n text-align: center;\n ";
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
var Backdrop = function Backdrop(_ref4) {
|
|
31
|
+
var visible = _ref4.visible,
|
|
32
|
+
title = _ref4.title,
|
|
33
|
+
children = _ref4.children,
|
|
34
|
+
onClose = _ref4.onClose,
|
|
35
|
+
_ref4$theme$yoga = _ref4.theme.yoga,
|
|
36
|
+
transition = _ref4$theme$yoga.transition,
|
|
37
|
+
dropdown = _ref4$theme$yoga.components.dropdown,
|
|
38
|
+
props = _objectWithoutPropertiesLoose(_ref4, _excluded);
|
|
39
|
+
|
|
40
|
+
var _useState = useState(visible),
|
|
41
|
+
isOpen = _useState[0],
|
|
42
|
+
toggleIsOpen = _useState[1];
|
|
43
|
+
|
|
44
|
+
var _useState2 = useState(new Animated.Value(0)),
|
|
45
|
+
backgroundAnimation = _useState2[0];
|
|
46
|
+
|
|
47
|
+
var _useState3 = useState(new Animated.Value(-dropdown.backdrop.content.height)),
|
|
48
|
+
contentAnimation = _useState3[0];
|
|
49
|
+
|
|
50
|
+
var animate = function animate(animation, toValue) {
|
|
51
|
+
return Animated.timing(animation, {
|
|
52
|
+
toValue: toValue,
|
|
53
|
+
duration: transition.duration[0],
|
|
54
|
+
easing: Easing.out(Easing.ease),
|
|
55
|
+
useNativeDriver: false
|
|
56
|
+
}).start(function () {
|
|
57
|
+
return !visible && toggleIsOpen(false);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
useEffect(function () {
|
|
62
|
+
if (visible) toggleIsOpen(true);
|
|
63
|
+
animate(backgroundAnimation, visible ? 0.5 : 0);
|
|
64
|
+
animate(contentAnimation, visible ? 0 : -dropdown.backdrop.content.height);
|
|
65
|
+
}, [visible]);
|
|
66
|
+
return isOpen && /*#__PURE__*/React.createElement(Modal, _extends({}, props, {
|
|
67
|
+
transparent: true,
|
|
68
|
+
animationType: "none"
|
|
69
|
+
}), /*#__PURE__*/React.createElement(TouchableWithoutFeedback, {
|
|
70
|
+
onPress: onClose
|
|
71
|
+
}, /*#__PURE__*/React.createElement(ClosableArea, {
|
|
72
|
+
style: {
|
|
73
|
+
opacity: backgroundAnimation
|
|
74
|
+
}
|
|
75
|
+
})), /*#__PURE__*/React.createElement(ContentWrapper, {
|
|
76
|
+
style: {
|
|
77
|
+
bottom: contentAnimation
|
|
78
|
+
}
|
|
79
|
+
}, /*#__PURE__*/React.createElement(Content, null, title && /*#__PURE__*/React.createElement(Title, null, title), children)));
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
Backdrop.propTypes = {
|
|
83
|
+
visible: bool,
|
|
84
|
+
title: string,
|
|
85
|
+
children: node.isRequired,
|
|
86
|
+
onClose: func
|
|
87
|
+
};
|
|
88
|
+
Backdrop.defaultProps = {
|
|
89
|
+
visible: false,
|
|
90
|
+
title: null,
|
|
91
|
+
onClose: function onClose() {}
|
|
92
|
+
};
|
|
93
|
+
export default withTheme(Backdrop);
|