@gympass/yoga 7.79.2 → 7.81.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/Dropdown/web/Dropdown.js +11 -6
- package/cjs/Icon/Icon.js +72 -20
- package/esm/Dropdown/web/Dropdown.js +11 -6
- package/esm/Icon/Icon.js +66 -20
- package/esm/Icon/native/Icon.test.js +13 -0
- package/esm/Icon/web/Icon.test.js +13 -0
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ var _Helper = _interopRequireDefault(require("../../Input/web/Helper"));
|
|
|
18
18
|
var _Input = _interopRequireDefault(require("../../Input/web/Input"));
|
|
19
19
|
|
|
20
20
|
var _excluded = ["isOpen", "selected"],
|
|
21
|
-
_excluded2 = ["error", "label", "disabled", "full", "options", "onChange"];
|
|
21
|
+
_excluded2 = ["error", "label", "disabled", "full", "options", "onChange", "isMaxHeight"];
|
|
22
22
|
|
|
23
23
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
24
24
|
|
|
@@ -37,7 +37,7 @@ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.s
|
|
|
37
37
|
var Wrapper = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
38
38
|
var full = _ref.full,
|
|
39
39
|
dropdown = _ref.theme.yoga.components.dropdown;
|
|
40
|
-
return "\n position: relative;\n display: inline-block;\n vertical-align: top;\n\n width: " + (full ? '100%' : dropdown.width + "px") + ";\n ";
|
|
40
|
+
return "\n position: relative;\n display: inline-block;\n vertical-align: top;\n \n width: " + (full ? '100%' : dropdown.width + "px") + ";\n ";
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
var labelTransition = (0, _styledComponents.css)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref2) {
|
|
@@ -74,8 +74,9 @@ var Button = _styledComponents["default"].button(_templateObject9 || (_templateO
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
var OptionsList = _styledComponents["default"].ul(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref6) {
|
|
77
|
-
var
|
|
78
|
-
|
|
77
|
+
var isMaxHeight = _ref6.isMaxHeight,
|
|
78
|
+
dropdown = _ref6.theme.yoga.components.dropdown;
|
|
79
|
+
return "\n position: absolute;\n top: 46px;\n z-index: 1;\n box-sizing: border-box;\n\n width: 100%;\n margin: 0;\n padding: 0;\n overflow-y: auto;\n list-style-type: none;\n\n background: " + dropdown.optionsList.backgroundColor + ";\n border-width: " + dropdown.optionsList.border.width + "px;\n border-style: solid;\n border-color: " + dropdown.optionsList.border.color + ";\n border-top: none;\n\n border-radius:\n " + dropdown.option.border.radius.topLeft + "px\n " + dropdown.option.border.radius.topRight + "px\n " + dropdown.option.border.radius.bottomRight + "px\n " + dropdown.option.border.radius.bottomLeft + "px;\n\n " + (isMaxHeight && "max-height: " + dropdown.option.height * 3.5 + "px;") + "\n ";
|
|
79
80
|
});
|
|
80
81
|
|
|
81
82
|
var Option = _styledComponents["default"].li(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref7) {
|
|
@@ -112,6 +113,7 @@ var Dropdown = /*#__PURE__*/_react["default"].forwardRef(function (_ref10, ref)
|
|
|
112
113
|
full = _ref10.full,
|
|
113
114
|
options = _ref10.options,
|
|
114
115
|
onChange = _ref10.onChange,
|
|
116
|
+
isMaxHeight = _ref10.isMaxHeight,
|
|
115
117
|
rest = _objectWithoutPropertiesLoose(_ref10, _excluded2);
|
|
116
118
|
|
|
117
119
|
var inputRef = ref || _react["default"].useRef(null);
|
|
@@ -174,6 +176,7 @@ var Dropdown = /*#__PURE__*/_react["default"].forwardRef(function (_ref10, ref)
|
|
|
174
176
|
selected: selectedItem !== null,
|
|
175
177
|
disabled: disabled
|
|
176
178
|
}))), isOpen && /*#__PURE__*/_react["default"].createElement(OptionsList, _extends({
|
|
179
|
+
isMaxHeight: isMaxHeight,
|
|
177
180
|
selected: selectedItem !== null
|
|
178
181
|
}, getMenuProps()), options.map(function (item, index) {
|
|
179
182
|
return /*#__PURE__*/_react["default"].createElement(Option, getItemProps({
|
|
@@ -200,14 +203,16 @@ Dropdown.propTypes = {
|
|
|
200
203
|
value: (0, _propTypes.oneOfType)([_propTypes.string, _propTypes.number]),
|
|
201
204
|
selected: _propTypes.bool
|
|
202
205
|
})).isRequired,
|
|
203
|
-
onChange: _propTypes.func
|
|
206
|
+
onChange: _propTypes.func,
|
|
207
|
+
isMaxHeight: _propTypes.bool
|
|
204
208
|
};
|
|
205
209
|
Dropdown.defaultProps = {
|
|
206
210
|
label: '',
|
|
207
211
|
error: undefined,
|
|
208
212
|
full: false,
|
|
209
213
|
disabled: false,
|
|
210
|
-
onChange: function onChange() {}
|
|
214
|
+
onChange: function onChange() {},
|
|
215
|
+
isMaxHeight: true
|
|
211
216
|
};
|
|
212
217
|
var _default = Dropdown;
|
|
213
218
|
exports["default"] = _default;
|
package/cjs/Icon/Icon.js
CHANGED
|
@@ -13,7 +13,7 @@ var _lodash = _interopRequireDefault(require("lodash.get"));
|
|
|
13
13
|
|
|
14
14
|
var _Box = _interopRequireDefault(require("../Box"));
|
|
15
15
|
|
|
16
|
-
var _excluded = ["as", "size", "width", "height", "fill", "stroke", "theme"];
|
|
16
|
+
var _excluded = ["as", "size", "width", "height", "fill", "stroke", "theme", "title", "description", "ariaLabel"];
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
19
|
|
|
@@ -31,17 +31,56 @@ var Icon = function Icon(_ref) {
|
|
|
31
31
|
fill = _ref.fill,
|
|
32
32
|
stroke = _ref.stroke,
|
|
33
33
|
theme = _ref.theme,
|
|
34
|
+
title = _ref.title,
|
|
35
|
+
description = _ref.description,
|
|
36
|
+
ariaLabel = _ref.ariaLabel,
|
|
34
37
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
35
38
|
|
|
39
|
+
var componentWithTitle = function componentWithTitle(propsTitle) {
|
|
40
|
+
var titleId = ariaLabel + "-titleId";
|
|
41
|
+
var ariaDescribedBy = titleId;
|
|
42
|
+
|
|
43
|
+
var titleElement = /*#__PURE__*/_react["default"].createElement("title", {
|
|
44
|
+
id: titleId,
|
|
45
|
+
key: titleId
|
|
46
|
+
}, title);
|
|
47
|
+
|
|
48
|
+
var svgChildren = [titleElement];
|
|
49
|
+
|
|
50
|
+
if (description) {
|
|
51
|
+
var descId = ariaLabel + "-descId";
|
|
52
|
+
|
|
53
|
+
var descElement = /*#__PURE__*/_react["default"].createElement("desc", {
|
|
54
|
+
id: descId,
|
|
55
|
+
key: descId
|
|
56
|
+
}, description);
|
|
57
|
+
|
|
58
|
+
ariaDescribedBy += " " + descId;
|
|
59
|
+
svgChildren = [].concat(svgChildren, [descElement]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var defaultProps = {
|
|
63
|
+
viewBox: '0 0 12 12',
|
|
64
|
+
role: 'img',
|
|
65
|
+
'aria-describedby': ariaDescribedBy
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var newSvg = /*#__PURE__*/_react["default"].createElement('svg', _extends({}, propsTitle, defaultProps), svgChildren, Component().props.children);
|
|
69
|
+
|
|
70
|
+
return newSvg;
|
|
71
|
+
};
|
|
72
|
+
|
|
36
73
|
return /*#__PURE__*/_react["default"].createElement(_Box["default"], _extends({
|
|
37
|
-
as: Component,
|
|
74
|
+
as: title && ariaLabel ? componentWithTitle : Component,
|
|
38
75
|
width: (0, _lodash["default"])(theme.yoga.spacing, width, width),
|
|
39
76
|
height: (0, _lodash["default"])(theme.yoga.spacing, height, height)
|
|
40
77
|
}, fill && {
|
|
41
78
|
fill: (0, _lodash["default"])(theme.yoga.colors, fill, fill)
|
|
42
79
|
}, stroke && {
|
|
43
80
|
stroke: (0, _lodash["default"])(theme.yoga.colors, stroke, stroke)
|
|
44
|
-
}, props
|
|
81
|
+
}, props, {
|
|
82
|
+
"aria-hidden": title ? undefined : true
|
|
83
|
+
}));
|
|
45
84
|
};
|
|
46
85
|
|
|
47
86
|
var commonSizes = ['xxxsmall', 'xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'xxxlarge', 'huge', 'xhuge'];
|
|
@@ -57,6 +96,31 @@ Icon.propTypes = {
|
|
|
57
96
|
* tokens (vibin, neutral, stamina...) */
|
|
58
97
|
stroke: _propTypes.string,
|
|
59
98
|
|
|
99
|
+
/** Text that will be displayed in the title element, used for accessibility */
|
|
100
|
+
title: _propTypes.string,
|
|
101
|
+
|
|
102
|
+
/** Text used as element description, used for accessibility.
|
|
103
|
+
* A title must be given in order to use description corretly.
|
|
104
|
+
*/
|
|
105
|
+
description: _propTypes.string,
|
|
106
|
+
|
|
107
|
+
/** Text used as identifier for aria-describedby, title and description */
|
|
108
|
+
ariaLabel: function ariaLabel(props, propName, componentName) {
|
|
109
|
+
var _checkPropTypes;
|
|
110
|
+
|
|
111
|
+
var title = props.title,
|
|
112
|
+
ariaLabel = props.ariaLabel;
|
|
113
|
+
|
|
114
|
+
if (title && !ariaLabel) {
|
|
115
|
+
return new Error("accessible elements, such as title, must receive the " + propName + " property as an identifier.");
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
(0, _propTypes.checkPropTypes)((_checkPropTypes = {}, _checkPropTypes[propName] = _propTypes.string, _checkPropTypes), {
|
|
119
|
+
ariaLabel: ariaLabel
|
|
120
|
+
}, 'prop', componentName);
|
|
121
|
+
return null;
|
|
122
|
+
},
|
|
123
|
+
|
|
60
124
|
/** Horizontal size of the SVG. Use it as one of
|
|
61
125
|
* theme.spacing tokens (xxsmall, small, medium...) */
|
|
62
126
|
width: (0, _propTypes.oneOfType)([(0, _propTypes.oneOf)(commonSizes), _propTypes.string, _propTypes.number]),
|
|
@@ -67,29 +131,17 @@ Icon.propTypes = {
|
|
|
67
131
|
|
|
68
132
|
/** Size for vertical and horizontal of the SVG.
|
|
69
133
|
* Use it as one of theme.spacing tokens (xxsmall, small, medium...) */
|
|
70
|
-
size:
|
|
71
|
-
var _checkPropTypes;
|
|
72
|
-
|
|
73
|
-
var size = props.size,
|
|
74
|
-
width = props.width,
|
|
75
|
-
height = props.height;
|
|
76
|
-
|
|
77
|
-
if (size && (width || height)) {
|
|
78
|
-
return new Error("you must use only " + propName + ", alone, or width and/or height in " + componentName);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
(0, _propTypes.checkPropTypes)((_checkPropTypes = {}, _checkPropTypes[propName] = (0, _propTypes.oneOfType)([(0, _propTypes.oneOf)(commonSizes), _propTypes.string, _propTypes.number]), _checkPropTypes), {
|
|
82
|
-
size: size
|
|
83
|
-
}, 'prop', componentName);
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
134
|
+
size: (0, _propTypes.oneOfType)([(0, _propTypes.oneOf)(commonSizes), _propTypes.string, _propTypes.number])
|
|
86
135
|
};
|
|
87
136
|
Icon.defaultProps = {
|
|
88
137
|
fill: undefined,
|
|
89
138
|
stroke: undefined,
|
|
139
|
+
title: undefined,
|
|
140
|
+
description: undefined,
|
|
141
|
+
ariaLabel: undefined,
|
|
90
142
|
width: undefined,
|
|
91
143
|
height: undefined,
|
|
92
|
-
size:
|
|
144
|
+
size: 12
|
|
93
145
|
};
|
|
94
146
|
|
|
95
147
|
var _default = (0, _styledComponents.withTheme)(Icon);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["isOpen", "selected"],
|
|
2
|
-
_excluded2 = ["error", "label", "disabled", "full", "options", "onChange"];
|
|
2
|
+
_excluded2 = ["error", "label", "disabled", "full", "options", "onChange", "isMaxHeight"];
|
|
3
3
|
|
|
4
4
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ import Input from '../../Input/web/Input';
|
|
|
19
19
|
var Wrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref) {
|
|
20
20
|
var full = _ref.full,
|
|
21
21
|
dropdown = _ref.theme.yoga.components.dropdown;
|
|
22
|
-
return "\n position: relative;\n display: inline-block;\n vertical-align: top;\n\n width: " + (full ? '100%' : dropdown.width + "px") + ";\n ";
|
|
22
|
+
return "\n position: relative;\n display: inline-block;\n vertical-align: top;\n \n width: " + (full ? '100%' : dropdown.width + "px") + ";\n ";
|
|
23
23
|
});
|
|
24
24
|
var labelTransition = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref2) {
|
|
25
25
|
var _ref2$theme$yoga = _ref2.theme.yoga,
|
|
@@ -51,8 +51,9 @@ var Button = styled.button(_templateObject9 || (_templateObject9 = _taggedTempla
|
|
|
51
51
|
return "\n display: flex;\n align-content: center;\n align-items: center;\n justify-content: flex-end;\n position: absolute;\n top: 0;\n left: 0;\n\n width: 100%;\n padding-right: " + dropdown.button.padding.right + "px;\n padding-top: " + dropdown.button.padding.top + "px;\n padding-bottom: " + dropdown.button.padding.bottom + "px;\n\n border: none;\n outline: none;\n background-color: transparent;\n cursor: " + (disabled ? 'not-allowed' : 'pointer') + ";\n ";
|
|
52
52
|
});
|
|
53
53
|
var OptionsList = styled.ul(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref6) {
|
|
54
|
-
var
|
|
55
|
-
|
|
54
|
+
var isMaxHeight = _ref6.isMaxHeight,
|
|
55
|
+
dropdown = _ref6.theme.yoga.components.dropdown;
|
|
56
|
+
return "\n position: absolute;\n top: 46px;\n z-index: 1;\n box-sizing: border-box;\n\n width: 100%;\n margin: 0;\n padding: 0;\n overflow-y: auto;\n list-style-type: none;\n\n background: " + dropdown.optionsList.backgroundColor + ";\n border-width: " + dropdown.optionsList.border.width + "px;\n border-style: solid;\n border-color: " + dropdown.optionsList.border.color + ";\n border-top: none;\n\n border-radius:\n " + dropdown.option.border.radius.topLeft + "px\n " + dropdown.option.border.radius.topRight + "px\n " + dropdown.option.border.radius.bottomRight + "px\n " + dropdown.option.border.radius.bottomLeft + "px;\n\n " + (isMaxHeight && "max-height: " + dropdown.option.height * 3.5 + "px;") + "\n ";
|
|
56
57
|
});
|
|
57
58
|
var Option = styled.li(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n ", "\n"])), function (_ref7) {
|
|
58
59
|
var isSelected = _ref7.isSelected,
|
|
@@ -87,6 +88,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref10, ref) {
|
|
|
87
88
|
full = _ref10.full,
|
|
88
89
|
options = _ref10.options,
|
|
89
90
|
onChange = _ref10.onChange,
|
|
91
|
+
isMaxHeight = _ref10.isMaxHeight,
|
|
90
92
|
rest = _objectWithoutPropertiesLoose(_ref10, _excluded2);
|
|
91
93
|
|
|
92
94
|
var inputRef = ref || React.useRef(null);
|
|
@@ -148,6 +150,7 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref10, ref) {
|
|
|
148
150
|
selected: selectedItem !== null,
|
|
149
151
|
disabled: disabled
|
|
150
152
|
}))), isOpen && /*#__PURE__*/React.createElement(OptionsList, _extends({
|
|
153
|
+
isMaxHeight: isMaxHeight,
|
|
151
154
|
selected: selectedItem !== null
|
|
152
155
|
}, getMenuProps()), options.map(function (item, index) {
|
|
153
156
|
return /*#__PURE__*/React.createElement(Option, getItemProps({
|
|
@@ -173,13 +176,15 @@ Dropdown.propTypes = {
|
|
|
173
176
|
value: oneOfType([string, number]),
|
|
174
177
|
selected: bool
|
|
175
178
|
})).isRequired,
|
|
176
|
-
onChange: func
|
|
179
|
+
onChange: func,
|
|
180
|
+
isMaxHeight: bool
|
|
177
181
|
};
|
|
178
182
|
Dropdown.defaultProps = {
|
|
179
183
|
label: '',
|
|
180
184
|
error: undefined,
|
|
181
185
|
full: false,
|
|
182
186
|
disabled: false,
|
|
183
|
-
onChange: function onChange() {}
|
|
187
|
+
onChange: function onChange() {},
|
|
188
|
+
isMaxHeight: true
|
|
184
189
|
};
|
|
185
190
|
export default Dropdown;
|
package/esm/Icon/Icon.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["as", "size", "width", "height", "fill", "stroke", "theme"];
|
|
1
|
+
var _excluded = ["as", "size", "width", "height", "fill", "stroke", "theme", "title", "description", "ariaLabel"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -20,17 +20,50 @@ var Icon = function Icon(_ref) {
|
|
|
20
20
|
fill = _ref.fill,
|
|
21
21
|
stroke = _ref.stroke,
|
|
22
22
|
theme = _ref.theme,
|
|
23
|
+
title = _ref.title,
|
|
24
|
+
description = _ref.description,
|
|
25
|
+
ariaLabel = _ref.ariaLabel,
|
|
23
26
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
24
27
|
|
|
28
|
+
var componentWithTitle = function componentWithTitle(propsTitle) {
|
|
29
|
+
var titleId = ariaLabel + "-titleId";
|
|
30
|
+
var ariaDescribedBy = titleId;
|
|
31
|
+
var titleElement = /*#__PURE__*/React.createElement("title", {
|
|
32
|
+
id: titleId,
|
|
33
|
+
key: titleId
|
|
34
|
+
}, title);
|
|
35
|
+
var svgChildren = [titleElement];
|
|
36
|
+
|
|
37
|
+
if (description) {
|
|
38
|
+
var descId = ariaLabel + "-descId";
|
|
39
|
+
var descElement = /*#__PURE__*/React.createElement("desc", {
|
|
40
|
+
id: descId,
|
|
41
|
+
key: descId
|
|
42
|
+
}, description);
|
|
43
|
+
ariaDescribedBy += " " + descId;
|
|
44
|
+
svgChildren = [].concat(svgChildren, [descElement]);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var defaultProps = {
|
|
48
|
+
viewBox: '0 0 12 12',
|
|
49
|
+
role: 'img',
|
|
50
|
+
'aria-describedby': ariaDescribedBy
|
|
51
|
+
};
|
|
52
|
+
var newSvg = /*#__PURE__*/React.createElement('svg', _extends({}, propsTitle, defaultProps), svgChildren, Component().props.children);
|
|
53
|
+
return newSvg;
|
|
54
|
+
};
|
|
55
|
+
|
|
25
56
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
26
|
-
as: Component,
|
|
57
|
+
as: title && ariaLabel ? componentWithTitle : Component,
|
|
27
58
|
width: get(theme.yoga.spacing, width, width),
|
|
28
59
|
height: get(theme.yoga.spacing, height, height)
|
|
29
60
|
}, fill && {
|
|
30
61
|
fill: get(theme.yoga.colors, fill, fill)
|
|
31
62
|
}, stroke && {
|
|
32
63
|
stroke: get(theme.yoga.colors, stroke, stroke)
|
|
33
|
-
}, props
|
|
64
|
+
}, props, {
|
|
65
|
+
"aria-hidden": title ? undefined : true
|
|
66
|
+
}));
|
|
34
67
|
};
|
|
35
68
|
|
|
36
69
|
var commonSizes = ['xxxsmall', 'xxsmall', 'xsmall', 'small', 'medium', 'large', 'xlarge', 'xxlarge', 'xxxlarge', 'huge', 'xhuge'];
|
|
@@ -46,6 +79,31 @@ Icon.propTypes = {
|
|
|
46
79
|
* tokens (vibin, neutral, stamina...) */
|
|
47
80
|
stroke: string,
|
|
48
81
|
|
|
82
|
+
/** Text that will be displayed in the title element, used for accessibility */
|
|
83
|
+
title: string,
|
|
84
|
+
|
|
85
|
+
/** Text used as element description, used for accessibility.
|
|
86
|
+
* A title must be given in order to use description corretly.
|
|
87
|
+
*/
|
|
88
|
+
description: string,
|
|
89
|
+
|
|
90
|
+
/** Text used as identifier for aria-describedby, title and description */
|
|
91
|
+
ariaLabel: function ariaLabel(props, propName, componentName) {
|
|
92
|
+
var _checkPropTypes;
|
|
93
|
+
|
|
94
|
+
var title = props.title,
|
|
95
|
+
ariaLabel = props.ariaLabel;
|
|
96
|
+
|
|
97
|
+
if (title && !ariaLabel) {
|
|
98
|
+
return new Error("accessible elements, such as title, must receive the " + propName + " property as an identifier.");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
checkPropTypes((_checkPropTypes = {}, _checkPropTypes[propName] = string, _checkPropTypes), {
|
|
102
|
+
ariaLabel: ariaLabel
|
|
103
|
+
}, 'prop', componentName);
|
|
104
|
+
return null;
|
|
105
|
+
},
|
|
106
|
+
|
|
49
107
|
/** Horizontal size of the SVG. Use it as one of
|
|
50
108
|
* theme.spacing tokens (xxsmall, small, medium...) */
|
|
51
109
|
width: oneOfType([oneOf(commonSizes), string, number]),
|
|
@@ -56,28 +114,16 @@ Icon.propTypes = {
|
|
|
56
114
|
|
|
57
115
|
/** Size for vertical and horizontal of the SVG.
|
|
58
116
|
* Use it as one of theme.spacing tokens (xxsmall, small, medium...) */
|
|
59
|
-
size:
|
|
60
|
-
var _checkPropTypes;
|
|
61
|
-
|
|
62
|
-
var size = props.size,
|
|
63
|
-
width = props.width,
|
|
64
|
-
height = props.height;
|
|
65
|
-
|
|
66
|
-
if (size && (width || height)) {
|
|
67
|
-
return new Error("you must use only " + propName + ", alone, or width and/or height in " + componentName);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
checkPropTypes((_checkPropTypes = {}, _checkPropTypes[propName] = oneOfType([oneOf(commonSizes), string, number]), _checkPropTypes), {
|
|
71
|
-
size: size
|
|
72
|
-
}, 'prop', componentName);
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
117
|
+
size: oneOfType([oneOf(commonSizes), string, number])
|
|
75
118
|
};
|
|
76
119
|
Icon.defaultProps = {
|
|
77
120
|
fill: undefined,
|
|
78
121
|
stroke: undefined,
|
|
122
|
+
title: undefined,
|
|
123
|
+
description: undefined,
|
|
124
|
+
ariaLabel: undefined,
|
|
79
125
|
width: undefined,
|
|
80
126
|
height: undefined,
|
|
81
|
-
size:
|
|
127
|
+
size: 12
|
|
82
128
|
};
|
|
83
129
|
export default withTheme(Icon);
|
|
@@ -44,4 +44,17 @@ describe('Snapshots', function () {
|
|
|
44
44
|
|
|
45
45
|
expect(toJSON()).toMatchSnapshot();
|
|
46
46
|
});
|
|
47
|
+
it('should match snapshot with accessible props', function () {
|
|
48
|
+
var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Icon, {
|
|
49
|
+
as: Circle,
|
|
50
|
+
size: "small",
|
|
51
|
+
fill: "stamina",
|
|
52
|
+
title: "Circle icon",
|
|
53
|
+
description: "This is a circular icon",
|
|
54
|
+
ariaLabel: "circleIcon"
|
|
55
|
+
}))),
|
|
56
|
+
toJSON = _render4.toJSON;
|
|
57
|
+
|
|
58
|
+
expect(toJSON()).toMatchSnapshot();
|
|
59
|
+
});
|
|
47
60
|
});
|
|
@@ -44,4 +44,17 @@ describe('Snapshots', function () {
|
|
|
44
44
|
|
|
45
45
|
expect(container).toMatchSnapshot();
|
|
46
46
|
});
|
|
47
|
+
it('should match snapshot with acessible props', function () {
|
|
48
|
+
var _render4 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Icon, {
|
|
49
|
+
as: Circle,
|
|
50
|
+
size: "small",
|
|
51
|
+
fill: "stamina",
|
|
52
|
+
title: "Circle icon",
|
|
53
|
+
description: "This is a circular icon",
|
|
54
|
+
ariaLabel: "circleIcon"
|
|
55
|
+
}))),
|
|
56
|
+
container = _render4.container;
|
|
57
|
+
|
|
58
|
+
expect(container).toMatchSnapshot();
|
|
59
|
+
});
|
|
47
60
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gympass/yoga",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.81.0",
|
|
4
4
|
"description": "Gympass component library",
|
|
5
5
|
"main": "./cjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react-native": "0.72.3",
|
|
56
56
|
"styled-components": "^4.4.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "f839d0ec99d5438e966d931c2467a9dcc7a4dd4c",
|
|
59
59
|
"module": "./esm",
|
|
60
60
|
"types": "./typings/index.d.ts",
|
|
61
61
|
"private": false,
|