@gympass/yoga 7.69.2 → 7.70.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,9 +5,12 @@ exports["default"] = void 0;
5
5
 
6
6
  var Accordion = function Accordion(_ref) {
7
7
  var spacing = _ref.spacing,
8
- fontWeights = _ref.fontWeights;
8
+ fontWeights = _ref.fontWeights,
9
+ fontSizes = _ref.fontSizes;
9
10
  return {
10
11
  padding: {
12
+ zero: spacing.zero,
13
+ small: spacing.small,
11
14
  standard: spacing.medium,
12
15
  large: spacing.large
13
16
  },
@@ -18,7 +21,12 @@ var Accordion = function Accordion(_ref) {
18
21
  header: spacing.xxxsmall
19
22
  },
20
23
  fontWeight: {
21
- title: fontWeights.medium
24
+ medium: fontWeights.medium,
25
+ regular: fontWeights.regular
26
+ },
27
+ fontSize: {
28
+ medium: fontSizes.medium,
29
+ small: fontSizes.small
22
30
  }
23
31
  };
24
32
  };
@@ -13,9 +13,13 @@ var _yogaIcons = require("@gympass/yoga-icons");
13
13
 
14
14
  var _yoga = require("@gympass/yoga");
15
15
 
16
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
16
+ var _Content = _interopRequireDefault(require("./Content"));
17
17
 
18
- var _excluded = ["title", "subtitle", "children", "disabled", "expanded"];
18
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
19
+
20
+ var _excluded = ["title", "subtitle", "children", "disabled", "expanded", "small", "hasHorizontalPadding"];
21
+
22
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
23
 
20
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
25
 
@@ -31,12 +35,24 @@ var Accordion = function Accordion(_ref) {
31
35
  children = _ref.children,
32
36
  disabled = _ref.disabled,
33
37
  expanded = _ref.expanded,
38
+ small = _ref.small,
39
+ hasHorizontalPadding = _ref.hasHorizontalPadding,
34
40
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
35
41
 
36
42
  var _useState = (0, _react.useState)(expanded),
37
43
  open = _useState[0],
38
44
  setOpen = _useState[1];
39
45
 
46
+ var getVerticalPadding = function getVerticalPadding(accordion) {
47
+ if (small) return accordion.padding.small;
48
+ return accordion.padding.large;
49
+ };
50
+
51
+ var getHorizontalPadding = function getHorizontalPadding(accordion) {
52
+ if (hasHorizontalPadding) return accordion.padding.standard;
53
+ return accordion.padding.zero;
54
+ };
55
+
40
56
  var AccordionWrapper = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n border: none;\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n z-index: 1;\n\n ", "\n\n hr {\n bottom: 0;\n left: 0;\n margin: 0;\n position: absolute;\n z-index: -1;\n }\n "])), function (_ref2) {
41
57
  var _ref2$theme$yoga$colo = _ref2.theme.yoga.colors,
42
58
  white = _ref2$theme$yoga$colo.white,
@@ -46,7 +62,7 @@ var Accordion = function Accordion(_ref) {
46
62
 
47
63
  var Header = _styledComponents["default"].button(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n align-items: center;\n background-color: transparent;\n border: none;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n width: 100%;\n\n ", "\n\n &:focus-visible {\n ", "\n }\n\n ", "\n "])), function (_ref3) {
48
64
  var accordion = _ref3.theme.yoga.components.accordion;
49
- return "\n padding: " + (subtitle ? accordion.padding.standard + "px" : accordion.padding.large + "px " + accordion.padding.standard + "px") + ";\n ";
65
+ return "\n padding:" + getVerticalPadding(accordion) + "px " + getHorizontalPadding(accordion) + "px;\n ";
50
66
  }, function (_ref4) {
51
67
  var elements = _ref4.theme.yoga.colors.elements;
52
68
  return "\n background: " + elements.backgroundAndDisabled + ";\n\n ";
@@ -54,27 +70,30 @@ var Accordion = function Accordion(_ref) {
54
70
 
55
71
  var Title = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n text-align: start;\n\n ", "\n\n ", "\n "])), function (_ref5) {
56
72
  var accordion = _ref5.theme.yoga.components.accordion;
57
- return "\n gap: " + (subtitle ? accordion.gap.header : 0) + "px;\n margin: " + (subtitle ? 0 : accordion.paddingArrow.total + "px 0") + ";\n\n p {\n font-weight: " + accordion.fontWeight.title + ";\n }\n ";
73
+ return "\n gap: " + (subtitle ? accordion.gap.header : 0) + "px;\n margin: " + (subtitle ? 0 : accordion.paddingArrow.total + "px 0") + ";\n ";
58
74
  }, disabled && (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n ", "\n "])), function (_ref6) {
59
75
  var text = _ref6.theme.yoga.colors.text;
60
76
  return "\n color: " + text.secundary + ";\n ";
61
77
  }));
62
78
 
63
- var AccordionContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n height: auto;\n max-height: ", ";\n overflow: hidden;\n transition: max-height 200ms ease-in-out;\n "])), function (_ref7) {
79
+ var AccordionContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n height: auto;\n max-height: ", ";\n overflow: hidden;\n transition: max-height 200ms ease-in-out;\n\n ", "\n\n ", "\n "])), function (_ref7) {
64
80
  var isOpen = _ref7.isOpen;
65
81
  return isOpen ? '9999px' : '0';
66
- });
82
+ }, function (_ref8) {
83
+ var accordion = _ref8.theme.yoga.components.accordion;
84
+ return small && (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-bottom: ", "px;\n }\n "])), _Content["default"], accordion.padding.small);
85
+ }, !hasHorizontalPadding && (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-left: 0;\n padding-right: 0;\n }\n "])), _Content["default"]));
67
86
 
68
- var ArrowWrapper = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n align-items: center;\n display: flex;\n justify-content: center;\n\n svg {\n transform: ", ";\n transition: all 200ms ease-out 0s;\n\n ", "\n }\n\n ", "\n "])), function (_ref8) {
69
- var isOpen = _ref8.isOpen;
87
+ var ArrowWrapper = _styledComponents["default"].div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n align-items: center;\n display: flex;\n justify-content: center;\n\n svg {\n transform: ", ";\n transition: all 200ms ease-out 0s;\n\n ", "\n }\n\n ", "\n "])), function (_ref9) {
88
+ var isOpen = _ref9.isOpen;
70
89
  return isOpen ? 'rotate(180deg)' : 'rotate(0deg)';
71
- }, function (_ref9) {
72
- var _ref9$theme$yoga$colo = _ref9.theme.yoga.colors,
73
- primary = _ref9$theme$yoga$colo.primary,
74
- text = _ref9$theme$yoga$colo.text;
75
- return "\n fill: " + (disabled ? text.secondary : primary) + ";\n ";
76
90
  }, function (_ref10) {
77
- var accordion = _ref10.theme.yoga.components.accordion;
91
+ var _ref10$theme$yoga$col = _ref10.theme.yoga.colors,
92
+ primary = _ref10$theme$yoga$col.primary,
93
+ text = _ref10$theme$yoga$col.text;
94
+ return "\n fill: " + (disabled ? text.secondary : primary) + ";\n ";
95
+ }, function (_ref11) {
96
+ var accordion = _ref11.theme.yoga.components.accordion;
78
97
  return "\n padding: " + accordion.paddingArrow.total + "px;\n ";
79
98
  });
80
99
 
@@ -83,8 +102,11 @@ var Accordion = function Accordion(_ref) {
83
102
  onClick: function onClick() {
84
103
  setOpen(!open);
85
104
  }
86
- }, /*#__PURE__*/_react["default"].createElement(Title, null, /*#__PURE__*/_react["default"].createElement(_yoga.Text, {
105
+ }, /*#__PURE__*/_react["default"].createElement(Title, null, small ? /*#__PURE__*/_react["default"].createElement(_yoga.Text.Small, {
87
106
  color: disabled ? 'deep' : undefined
107
+ }, title) : /*#__PURE__*/_react["default"].createElement(_yoga.Text.Medium, {
108
+ color: disabled ? 'deep' : undefined,
109
+ lineHeight: "medium"
88
110
  }, title), /*#__PURE__*/_react["default"].createElement(_yoga.Text.Small, {
89
111
  color: "deep"
90
112
  }, subtitle)), /*#__PURE__*/_react["default"].createElement(ArrowWrapper, {
@@ -102,12 +124,16 @@ Accordion.propTypes = {
102
124
  subtitle: _propTypes.string,
103
125
  children: _propTypes.node.isRequired,
104
126
  disabled: _propTypes.bool,
105
- expanded: _propTypes.bool
127
+ expanded: _propTypes.bool,
128
+ small: _propTypes.bool,
129
+ hasHorizontalPadding: _propTypes.bool
106
130
  };
107
131
  Accordion.defaultProps = {
108
132
  subtitle: undefined,
109
133
  disabled: false,
110
- expanded: false
134
+ expanded: false,
135
+ small: false,
136
+ hasHorizontalPadding: true
111
137
  };
112
138
  var _default = Accordion;
113
139
  exports["default"] = _default;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports["default"] = void 0;
5
+
6
+ var _react = _interopRequireDefault(require("react"));
7
+
8
+ var _Accordion = _interopRequireDefault(require("./Accordion"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
+
12
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
13
+
14
+ function AccordionSmall(props) {
15
+ return /*#__PURE__*/_react["default"].createElement(_Accordion["default"], _extends({}, props, {
16
+ small: true
17
+ }));
18
+ }
19
+
20
+ AccordionSmall.propTypes = _Accordion["default"].propTypes;
21
+ AccordionSmall.defaultProps = _Accordion["default"].defaultProps;
22
+ var _default = AccordionSmall;
23
+ exports["default"] = _default;
@@ -7,8 +7,11 @@ var _Accordion = _interopRequireDefault(require("./Accordion"));
7
7
 
8
8
  var _Content = _interopRequireDefault(require("./Content"));
9
9
 
10
+ var _Small = _interopRequireDefault(require("./Small"));
11
+
10
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
11
13
 
12
14
  _Accordion["default"].Content = _Content["default"];
15
+ _Accordion["default"].Small = _Small["default"];
13
16
  var _default = _Accordion["default"];
14
17
  exports["default"] = _default;
@@ -1,8 +1,11 @@
1
1
  var Accordion = function Accordion(_ref) {
2
2
  var spacing = _ref.spacing,
3
- fontWeights = _ref.fontWeights;
3
+ fontWeights = _ref.fontWeights,
4
+ fontSizes = _ref.fontSizes;
4
5
  return {
5
6
  padding: {
7
+ zero: spacing.zero,
8
+ small: spacing.small,
6
9
  standard: spacing.medium,
7
10
  large: spacing.large
8
11
  },
@@ -13,7 +16,12 @@ var Accordion = function Accordion(_ref) {
13
16
  header: spacing.xxxsmall
14
17
  },
15
18
  fontWeight: {
16
- title: fontWeights.medium
19
+ medium: fontWeights.medium,
20
+ regular: fontWeights.regular
21
+ },
22
+ fontSize: {
23
+ medium: fontSizes.medium,
24
+ small: fontSizes.small
17
25
  }
18
26
  };
19
27
  };
@@ -1,6 +1,6 @@
1
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
1
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
2
2
 
3
- var _excluded = ["title", "subtitle", "children", "disabled", "expanded"];
3
+ var _excluded = ["title", "subtitle", "children", "disabled", "expanded", "small", "hasHorizontalPadding"];
4
4
 
5
5
  function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
6
6
 
@@ -11,6 +11,7 @@ import styled, { css } from 'styled-components';
11
11
  import { string, node, bool } from 'prop-types';
12
12
  import { ChevronDown } from '@gympass/yoga-icons';
13
13
  import { Text, Divider } from '@gympass/yoga';
14
+ import Content from './Content';
14
15
 
15
16
  var Accordion = function Accordion(_ref) {
16
17
  var title = _ref.title,
@@ -18,12 +19,24 @@ var Accordion = function Accordion(_ref) {
18
19
  children = _ref.children,
19
20
  disabled = _ref.disabled,
20
21
  expanded = _ref.expanded,
22
+ small = _ref.small,
23
+ hasHorizontalPadding = _ref.hasHorizontalPadding,
21
24
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
22
25
 
23
26
  var _useState = useState(expanded),
24
27
  open = _useState[0],
25
28
  setOpen = _useState[1];
26
29
 
30
+ var getVerticalPadding = function getVerticalPadding(accordion) {
31
+ if (small) return accordion.padding.small;
32
+ return accordion.padding.large;
33
+ };
34
+
35
+ var getHorizontalPadding = function getHorizontalPadding(accordion) {
36
+ if (hasHorizontalPadding) return accordion.padding.standard;
37
+ return accordion.padding.zero;
38
+ };
39
+
27
40
  var AccordionWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n border: none;\n display: flex;\n flex-direction: column;\n position: relative;\n width: 100%;\n z-index: 1;\n\n ", "\n\n hr {\n bottom: 0;\n left: 0;\n margin: 0;\n position: absolute;\n z-index: -1;\n }\n "])), function (_ref2) {
28
41
  var _ref2$theme$yoga$colo = _ref2.theme.yoga.colors,
29
42
  white = _ref2$theme$yoga$colo.white,
@@ -32,32 +45,35 @@ var Accordion = function Accordion(_ref) {
32
45
  });
33
46
  var Header = styled.button(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n align-items: center;\n background-color: transparent;\n border: none;\n cursor: pointer;\n display: flex;\n justify-content: space-between;\n width: 100%;\n\n ", "\n\n &:focus-visible {\n ", "\n }\n\n ", "\n "])), function (_ref3) {
34
47
  var accordion = _ref3.theme.yoga.components.accordion;
35
- return "\n padding: " + (subtitle ? accordion.padding.standard + "px" : accordion.padding.large + "px " + accordion.padding.standard + "px") + ";\n ";
48
+ return "\n padding:" + getVerticalPadding(accordion) + "px " + getHorizontalPadding(accordion) + "px;\n ";
36
49
  }, function (_ref4) {
37
50
  var elements = _ref4.theme.yoga.colors.elements;
38
51
  return "\n background: " + elements.backgroundAndDisabled + ";\n\n ";
39
52
  }, disabled && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n cursor: not-allowed;\n "]))));
40
53
  var Title = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n align-items: flex-start;\n display: flex;\n flex-direction: column;\n text-align: start;\n\n ", "\n\n ", "\n "])), function (_ref5) {
41
54
  var accordion = _ref5.theme.yoga.components.accordion;
42
- return "\n gap: " + (subtitle ? accordion.gap.header : 0) + "px;\n margin: " + (subtitle ? 0 : accordion.paddingArrow.total + "px 0") + ";\n\n p {\n font-weight: " + accordion.fontWeight.title + ";\n }\n ";
55
+ return "\n gap: " + (subtitle ? accordion.gap.header : 0) + "px;\n margin: " + (subtitle ? 0 : accordion.paddingArrow.total + "px 0") + ";\n ";
43
56
  }, disabled && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n ", "\n "])), function (_ref6) {
44
57
  var text = _ref6.theme.yoga.colors.text;
45
58
  return "\n color: " + text.secundary + ";\n ";
46
59
  }));
47
- var AccordionContent = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n height: auto;\n max-height: ", ";\n overflow: hidden;\n transition: max-height 200ms ease-in-out;\n "])), function (_ref7) {
60
+ var AccordionContent = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n height: auto;\n max-height: ", ";\n overflow: hidden;\n transition: max-height 200ms ease-in-out;\n\n ", "\n\n ", "\n "])), function (_ref7) {
48
61
  var isOpen = _ref7.isOpen;
49
62
  return isOpen ? '9999px' : '0';
50
- });
51
- var ArrowWrapper = styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n align-items: center;\n display: flex;\n justify-content: center;\n\n svg {\n transform: ", ";\n transition: all 200ms ease-out 0s;\n\n ", "\n }\n\n ", "\n "])), function (_ref8) {
52
- var isOpen = _ref8.isOpen;
63
+ }, function (_ref8) {
64
+ var accordion = _ref8.theme.yoga.components.accordion;
65
+ return small && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-bottom: ", "px;\n }\n "])), Content, accordion.padding.small);
66
+ }, !hasHorizontalPadding && css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-left: 0;\n padding-right: 0;\n }\n "])), Content));
67
+ var ArrowWrapper = styled.div(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n align-items: center;\n display: flex;\n justify-content: center;\n\n svg {\n transform: ", ";\n transition: all 200ms ease-out 0s;\n\n ", "\n }\n\n ", "\n "])), function (_ref9) {
68
+ var isOpen = _ref9.isOpen;
53
69
  return isOpen ? 'rotate(180deg)' : 'rotate(0deg)';
54
- }, function (_ref9) {
55
- var _ref9$theme$yoga$colo = _ref9.theme.yoga.colors,
56
- primary = _ref9$theme$yoga$colo.primary,
57
- text = _ref9$theme$yoga$colo.text;
58
- return "\n fill: " + (disabled ? text.secondary : primary) + ";\n ";
59
70
  }, function (_ref10) {
60
- var accordion = _ref10.theme.yoga.components.accordion;
71
+ var _ref10$theme$yoga$col = _ref10.theme.yoga.colors,
72
+ primary = _ref10$theme$yoga$col.primary,
73
+ text = _ref10$theme$yoga$col.text;
74
+ return "\n fill: " + (disabled ? text.secondary : primary) + ";\n ";
75
+ }, function (_ref11) {
76
+ var accordion = _ref11.theme.yoga.components.accordion;
61
77
  return "\n padding: " + accordion.paddingArrow.total + "px;\n ";
62
78
  });
63
79
  return /*#__PURE__*/React.createElement(AccordionWrapper, props, /*#__PURE__*/React.createElement(Header, {
@@ -65,8 +81,11 @@ var Accordion = function Accordion(_ref) {
65
81
  onClick: function onClick() {
66
82
  setOpen(!open);
67
83
  }
68
- }, /*#__PURE__*/React.createElement(Title, null, /*#__PURE__*/React.createElement(Text, {
84
+ }, /*#__PURE__*/React.createElement(Title, null, small ? /*#__PURE__*/React.createElement(Text.Small, {
69
85
  color: disabled ? 'deep' : undefined
86
+ }, title) : /*#__PURE__*/React.createElement(Text.Medium, {
87
+ color: disabled ? 'deep' : undefined,
88
+ lineHeight: "medium"
70
89
  }, title), /*#__PURE__*/React.createElement(Text.Small, {
71
90
  color: "deep"
72
91
  }, subtitle)), /*#__PURE__*/React.createElement(ArrowWrapper, {
@@ -84,11 +103,15 @@ Accordion.propTypes = {
84
103
  subtitle: string,
85
104
  children: node.isRequired,
86
105
  disabled: bool,
87
- expanded: bool
106
+ expanded: bool,
107
+ small: bool,
108
+ hasHorizontalPadding: bool
88
109
  };
89
110
  Accordion.defaultProps = {
90
111
  subtitle: undefined,
91
112
  disabled: false,
92
- expanded: false
113
+ expanded: false,
114
+ small: false,
115
+ hasHorizontalPadding: true
93
116
  };
94
117
  export default Accordion;
@@ -1,20 +1,106 @@
1
1
  import React from 'react';
2
2
  import { render, cleanup, screen } from '@testing-library/react';
3
+ import { fontSizes, fontWeights, spacing } from '@gympass/yoga-tokens/src/global';
3
4
  import { Text, Button } from '@gympass/yoga';
4
5
  import { ThemeProvider } from '../..';
5
6
  import Accordion from '.';
6
7
  describe('<Accordion />', function () {
7
8
  afterEach(cleanup);
8
- it('should match snapshot', function () {
9
- var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Accordion, {
10
- title: "Title"
11
- }, /*#__PURE__*/React.createElement(Accordion.Content, null, /*#__PURE__*/React.createElement(Text, null, "Content"), /*#__PURE__*/React.createElement(Button, {
12
- small: true,
13
- inverted: true
14
- }, "Small button"))))),
15
- baseElement = _render.baseElement;
9
+ describe('should correctly render', function () {
10
+ it('the default version', function () {
11
+ var _render = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Accordion, {
12
+ title: "Default",
13
+ expanded: true
14
+ }, /*#__PURE__*/React.createElement(Accordion.Content, null, /*#__PURE__*/React.createElement(Text, null, "Content"))))),
15
+ container = _render.container;
16
+
17
+ expect(screen.getByText('Default')).toBeInTheDocument();
18
+ expect(screen.getByText('Default')).toHaveStyle({
19
+ fontSize: fontSizes.medium + "px",
20
+ fontWeight: fontWeights.medium
21
+ });
22
+ expect(screen.getByRole('button')).toHaveStyle({
23
+ padding: spacing.large + "px " + spacing.medium + "px"
24
+ });
25
+ expect(container.firstChild).toMatchSnapshot();
26
+ });
27
+ it('the small version', function () {
28
+ var _render2 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Accordion.Small, {
29
+ title: "Small"
30
+ }, /*#__PURE__*/React.createElement(Accordion.Content, null, /*#__PURE__*/React.createElement(Text, null, "Content"))))),
31
+ container = _render2.container;
32
+
33
+ expect(screen.getByText('Small')).toBeInTheDocument();
34
+ expect(screen.getByText('Small')).toHaveStyle({
35
+ fontSize: fontSizes.small + "px",
36
+ fontWeight: fontWeights.regular
37
+ });
38
+ expect(screen.getByRole('button')).toHaveStyle({
39
+ padding: spacing.small + "px " + spacing.medium + "px"
40
+ });
41
+ expect(container.firstChild).toMatchSnapshot();
42
+ });
43
+ it('the default version with subtitle', function () {
44
+ var _render3 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Accordion, {
45
+ title: "Default",
46
+ subtitle: "default with subtitle"
47
+ }, /*#__PURE__*/React.createElement(Accordion.Content, null, /*#__PURE__*/React.createElement(Text, null, "Content"))))),
48
+ container = _render3.container;
49
+
50
+ expect(screen.getByText('Default')).toBeInTheDocument();
51
+ expect(screen.getByText('default with subtitle')).toBeInTheDocument();
52
+ expect(screen.getByText('Default')).toHaveStyle({
53
+ fontSize: fontSizes.medium + "px",
54
+ fontWeight: fontWeights.medium
55
+ });
56
+ expect(screen.getByRole('button')).toHaveStyle({
57
+ padding: spacing.large + "px " + spacing.medium + "px"
58
+ });
59
+ expect(container.firstChild).toMatchSnapshot();
60
+ });
61
+ it('the small version with subtitle', function () {
62
+ var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Accordion.Small, {
63
+ title: "Small",
64
+ subtitle: "small with subtitle"
65
+ }, /*#__PURE__*/React.createElement(Accordion.Content, null, /*#__PURE__*/React.createElement(Text, null, "Content"))))),
66
+ container = _render4.container;
67
+
68
+ expect(screen.getByText('Small')).toBeInTheDocument();
69
+ expect(screen.getByText('small with subtitle')).toBeInTheDocument();
70
+ expect(screen.getByText('Small')).toHaveStyle({
71
+ fontSize: fontSizes.small + "px",
72
+ fontWeight: fontWeights.regular
73
+ });
74
+ expect(screen.getByRole('button')).toHaveStyle({
75
+ padding: spacing.small + "px " + spacing.medium + "px"
76
+ });
77
+ expect(container.firstChild).toMatchSnapshot();
78
+ });
79
+ it('the default version without side padding', function () {
80
+ var _render5 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Accordion, {
81
+ title: "Default",
82
+ expanded: true,
83
+ hasHorizontalPadding: false
84
+ }, /*#__PURE__*/React.createElement(Accordion.Content, null, /*#__PURE__*/React.createElement(Text, null, "Content"))))),
85
+ container = _render5.container;
86
+
87
+ expect(screen.getByRole('button')).toHaveStyle({
88
+ padding: spacing.large + "px " + spacing.zero + "px"
89
+ });
90
+ expect(container.firstChild).toMatchSnapshot();
91
+ });
92
+ it('the small version without side padding', function () {
93
+ var _render6 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Accordion.Small, {
94
+ title: "Small",
95
+ hasHorizontalPadding: false
96
+ }, /*#__PURE__*/React.createElement(Accordion.Content, null, /*#__PURE__*/React.createElement(Text, null, "Content"))))),
97
+ container = _render6.container;
16
98
 
17
- expect(baseElement).toMatchSnapshot();
99
+ expect(screen.getByRole('button')).toHaveStyle({
100
+ padding: spacing.small + "px " + spacing.zero + "px"
101
+ });
102
+ expect(container.firstChild).toMatchSnapshot();
103
+ });
18
104
  });
19
105
  it('should have className when passed as props', function () {
20
106
  render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Accordion, {
@@ -0,0 +1,14 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import React from 'react';
4
+ import Accordion from './Accordion';
5
+
6
+ function AccordionSmall(props) {
7
+ return /*#__PURE__*/React.createElement(Accordion, _extends({}, props, {
8
+ small: true
9
+ }));
10
+ }
11
+
12
+ AccordionSmall.propTypes = Accordion.propTypes;
13
+ AccordionSmall.defaultProps = Accordion.defaultProps;
14
+ export default AccordionSmall;
@@ -1,4 +1,6 @@
1
1
  import Accordion from './Accordion';
2
2
  import Content from './Content';
3
+ import AccordionSmall from './Small';
3
4
  Accordion.Content = Content;
5
+ Accordion.Small = AccordionSmall;
4
6
  export default Accordion;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gympass/yoga",
3
- "version": "7.69.2",
3
+ "version": "7.70.1",
4
4
  "description": "Gympass component library",
5
5
  "main": "./cjs",
6
6
  "sideEffects": false,
@@ -29,7 +29,7 @@
29
29
  "@gympass/yoga-helpers": "^1.0.3",
30
30
  "@gympass/yoga-icons": "^1.9.1",
31
31
  "@gympass/yoga-illustrations": "^0.5.1",
32
- "@gympass/yoga-system": "^0.10.3",
32
+ "@gympass/yoga-system": "^0.11.0",
33
33
  "@gympass/yoga-tokens": "^3.1.5",
34
34
  "@ptomasroos/react-native-multi-slider": "^1.0.0",
35
35
  "@radix-ui/react-dropdown-menu": "^2.0.1",
@@ -53,7 +53,7 @@
53
53
  "react": ">=16",
54
54
  "styled-components": "^4.4.0"
55
55
  },
56
- "gitHead": "ef314aea8ebfe8e77cf8f2b46acaa4a3001924f5",
56
+ "gitHead": "29cc52332ff1c6d5a8c39828ddcb0bc5ee611373",
57
57
  "module": "./esm",
58
58
  "private": false,
59
59
  "react-native": "./cjs/index.native.js"