@gympass/yoga 7.72.3 → 7.73.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/Accordion/web/Accordion.js +100 -72
- package/cjs/Popover/web/Popover.js +11 -2
- package/cjs/Tag/web/Informative.js +10 -4
- package/cjs/Tag/web/Tag.js +10 -5
- package/esm/Accordion/web/Accordion.js +96 -67
- package/esm/Popover/web/Popover.js +11 -2
- package/esm/Tag/web/Informative.js +10 -4
- package/esm/Tag/web/Tag.js +11 -6
- package/esm/Tag/web/Tag.test.js +27 -0
- package/package.json +2 -2
|
@@ -15,94 +15,119 @@ var _yoga = require("@gympass/yoga");
|
|
|
15
15
|
|
|
16
16
|
var _Content = _interopRequireDefault(require("./Content"));
|
|
17
17
|
|
|
18
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
19
|
-
|
|
20
18
|
var _excluded = ["title", "subtitle", "children", "disabled", "expanded", "small", "hasHorizontalPadding"];
|
|
21
19
|
|
|
20
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
21
|
+
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
23
23
|
|
|
24
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); }
|
|
25
25
|
|
|
26
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
27
|
|
|
28
|
-
function
|
|
28
|
+
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); }
|
|
29
29
|
|
|
30
30
|
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; }
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
var title = _ref.title,
|
|
34
|
-
subtitle = _ref.subtitle,
|
|
35
|
-
children = _ref.children,
|
|
36
|
-
disabled = _ref.disabled,
|
|
37
|
-
expanded = _ref.expanded,
|
|
38
|
-
small = _ref.small,
|
|
39
|
-
hasHorizontalPadding = _ref.hasHorizontalPadding,
|
|
40
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
32
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
41
33
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
34
|
+
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 (_ref) {
|
|
35
|
+
var _ref$theme$yoga$color = _ref.theme.yoga.colors,
|
|
36
|
+
white = _ref$theme$yoga$color.white,
|
|
37
|
+
elements = _ref$theme$yoga$color.elements,
|
|
38
|
+
disabled = _ref.disabled;
|
|
39
|
+
return "\n background: " + (disabled ? elements.backgroundAndDisabled : white) + "\n";
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var getVerticalPadding = function getVerticalPadding(accordion, small) {
|
|
43
|
+
if (small) return accordion.padding.small;
|
|
44
|
+
return accordion.padding.large;
|
|
45
|
+
};
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
var getHorizontalPadding = function getHorizontalPadding(accordion) {
|
|
52
|
-
if (hasHorizontalPadding) return accordion.padding.standard;
|
|
53
|
-
return accordion.padding.zero;
|
|
54
|
-
};
|
|
55
|
-
|
|
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) {
|
|
57
|
-
var _ref2$theme$yoga$colo = _ref2.theme.yoga.colors,
|
|
58
|
-
white = _ref2$theme$yoga$colo.white,
|
|
59
|
-
elements = _ref2$theme$yoga$colo.elements;
|
|
60
|
-
return "\n background: " + (disabled ? elements.backgroundAndDisabled : white) + "\n ";
|
|
61
|
-
});
|
|
47
|
+
var getHorizontalPadding = function getHorizontalPadding(accordion, hasHorizontalPadding) {
|
|
48
|
+
if (hasHorizontalPadding) return accordion.padding.standard;
|
|
49
|
+
return accordion.padding.zero;
|
|
50
|
+
};
|
|
62
51
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
return
|
|
85
|
-
}, !hasHorizontalPadding && (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-left: 0;\n padding-right: 0;\n }\n "])), _Content["default"]));
|
|
86
|
-
|
|
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;
|
|
89
|
-
return isOpen ? 'rotate(180deg)' : 'rotate(0deg)';
|
|
90
|
-
}, function (_ref10) {
|
|
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;
|
|
97
|
-
return "\n padding: " + accordion.paddingArrow.total + "px;\n ";
|
|
52
|
+
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 (_ref2) {
|
|
53
|
+
var accordion = _ref2.theme.yoga.components.accordion,
|
|
54
|
+
small = _ref2.small,
|
|
55
|
+
hasHorizontalPadding = _ref2.hasHorizontalPadding;
|
|
56
|
+
return "\n padding:" + getVerticalPadding(accordion, small) + "px " + getHorizontalPadding(accordion, hasHorizontalPadding) + "px;\n";
|
|
57
|
+
}, function (_ref3) {
|
|
58
|
+
var elements = _ref3.theme.yoga.colors.elements;
|
|
59
|
+
return "\n background: " + elements.backgroundAndDisabled + ";\n\n ";
|
|
60
|
+
}, function (_ref4) {
|
|
61
|
+
var disabled = _ref4.disabled;
|
|
62
|
+
return disabled && (0, _styledComponents.css)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n cursor: not-allowed;\n "])));
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
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) {
|
|
66
|
+
var accordion = _ref5.theme.yoga.components.accordion,
|
|
67
|
+
subtitle = _ref5.subtitle;
|
|
68
|
+
return "\n gap: " + (subtitle ? accordion.gap.header : 0) + "px;\n margin: " + (subtitle ? 0 : accordion.paddingArrow.total + "px 0") + ";\n";
|
|
69
|
+
}, function (_ref6) {
|
|
70
|
+
var disabled = _ref6.disabled;
|
|
71
|
+
return disabled && (0, _styledComponents.css)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n ", "\n "])), function (_ref7) {
|
|
72
|
+
var text = _ref7.theme.yoga.colors.text;
|
|
73
|
+
return "\n color: " + text.secundary + ";\n ";
|
|
98
74
|
});
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
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 (_ref8) {
|
|
78
|
+
var isOpen = _ref8.isOpen;
|
|
79
|
+
return isOpen ? '9999px' : '0';
|
|
80
|
+
}, function (_ref9) {
|
|
81
|
+
var accordion = _ref9.theme.yoga.components.accordion,
|
|
82
|
+
small = _ref9.small;
|
|
83
|
+
return small && (0, _styledComponents.css)(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-bottom: ", "px;\n }\n "])), _Content["default"], accordion.padding.small);
|
|
84
|
+
}, function (_ref10) {
|
|
85
|
+
var hasHorizontalPadding = _ref10.hasHorizontalPadding;
|
|
86
|
+
return !hasHorizontalPadding && (0, _styledComponents.css)(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-left: 0;\n padding-right: 0;\n }\n "])), _Content["default"]);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
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 (_ref11) {
|
|
90
|
+
var isOpen = _ref11.isOpen;
|
|
91
|
+
return isOpen ? 'rotate(180deg)' : 'rotate(0deg)';
|
|
92
|
+
}, function (_ref12) {
|
|
93
|
+
var _ref12$theme$yoga$col = _ref12.theme.yoga.colors,
|
|
94
|
+
primary = _ref12$theme$yoga$col.primary,
|
|
95
|
+
text = _ref12$theme$yoga$col.text,
|
|
96
|
+
disabled = _ref12.disabled;
|
|
97
|
+
return "\n fill: " + (disabled ? text.secondary : primary) + ";\n ";
|
|
98
|
+
}, function (_ref13) {
|
|
99
|
+
var accordion = _ref13.theme.yoga.components.accordion;
|
|
100
|
+
return "\n padding: " + accordion.paddingArrow.total + "px;\n";
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
var Accordion = function Accordion(_ref14) {
|
|
104
|
+
var title = _ref14.title,
|
|
105
|
+
subtitle = _ref14.subtitle,
|
|
106
|
+
children = _ref14.children,
|
|
107
|
+
disabled = _ref14.disabled,
|
|
108
|
+
expanded = _ref14.expanded,
|
|
109
|
+
small = _ref14.small,
|
|
110
|
+
hasHorizontalPadding = _ref14.hasHorizontalPadding,
|
|
111
|
+
props = _objectWithoutPropertiesLoose(_ref14, _excluded);
|
|
112
|
+
|
|
113
|
+
var _useState = (0, _react.useState)(expanded),
|
|
114
|
+
open = _useState[0],
|
|
115
|
+
setOpen = _useState[1];
|
|
99
116
|
|
|
100
|
-
return /*#__PURE__*/_react["default"].createElement(AccordionWrapper,
|
|
117
|
+
return /*#__PURE__*/_react["default"].createElement(AccordionWrapper, _extends({
|
|
118
|
+
disabled: disabled
|
|
119
|
+
}, props), /*#__PURE__*/_react["default"].createElement(Header, {
|
|
101
120
|
disabled: disabled,
|
|
102
121
|
onClick: function onClick() {
|
|
103
|
-
setOpen(
|
|
104
|
-
|
|
105
|
-
|
|
122
|
+
setOpen(function (o) {
|
|
123
|
+
return !o;
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
small: small,
|
|
127
|
+
hasHorizontalPadding: hasHorizontalPadding
|
|
128
|
+
}, /*#__PURE__*/_react["default"].createElement(Title, {
|
|
129
|
+
subtitle: subtitle
|
|
130
|
+
}, small ? /*#__PURE__*/_react["default"].createElement(_yoga.Text.Small, {
|
|
106
131
|
color: disabled ? 'deep' : undefined
|
|
107
132
|
}, title) : /*#__PURE__*/_react["default"].createElement(_yoga.Text.Medium, {
|
|
108
133
|
color: disabled ? 'deep' : undefined,
|
|
@@ -110,12 +135,15 @@ var Accordion = function Accordion(_ref) {
|
|
|
110
135
|
}, title), /*#__PURE__*/_react["default"].createElement(_yoga.Text.Small, {
|
|
111
136
|
color: "deep"
|
|
112
137
|
}, subtitle)), /*#__PURE__*/_react["default"].createElement(ArrowWrapper, {
|
|
113
|
-
isOpen: open
|
|
138
|
+
isOpen: open,
|
|
139
|
+
disabled: disabled
|
|
114
140
|
}, /*#__PURE__*/_react["default"].createElement(_yogaIcons.ChevronDown, {
|
|
115
141
|
width: 24,
|
|
116
142
|
height: 24
|
|
117
143
|
}))), /*#__PURE__*/_react["default"].createElement(AccordionContent, {
|
|
118
|
-
isOpen: open
|
|
144
|
+
isOpen: open,
|
|
145
|
+
small: small,
|
|
146
|
+
hasHorizontalPadding: hasHorizontalPadding
|
|
119
147
|
}, children), /*#__PURE__*/_react["default"].createElement(_yoga.Divider, null));
|
|
120
148
|
};
|
|
121
149
|
|
|
@@ -52,9 +52,18 @@ function Popover(_ref) {
|
|
|
52
52
|
}, title), /*#__PURE__*/_react["default"].createElement(_yoga.Text.Small, {
|
|
53
53
|
m: "zero",
|
|
54
54
|
color: "white"
|
|
55
|
-
}, description)), /*#__PURE__*/_react["default"].createElement("
|
|
55
|
+
}, description)), /*#__PURE__*/_react["default"].createElement("button", {
|
|
56
|
+
type: "button",
|
|
57
|
+
style: {
|
|
58
|
+
all: 'unset'
|
|
59
|
+
},
|
|
56
60
|
onMouseEnter: handleShowPopover,
|
|
57
|
-
onMouseLeave: handleHidePopover
|
|
61
|
+
onMouseLeave: handleHidePopover,
|
|
62
|
+
onTouchStart: handleShowPopover,
|
|
63
|
+
onTouchEnd: handleHidePopover,
|
|
64
|
+
onClick: function onClick(event) {
|
|
65
|
+
return event.preventDefault();
|
|
66
|
+
}
|
|
58
67
|
}, children));
|
|
59
68
|
}
|
|
60
69
|
|
|
@@ -15,7 +15,7 @@ var _Tag = _interopRequireDefault(require("./Tag"));
|
|
|
15
15
|
|
|
16
16
|
var _Icon = _interopRequireDefault(require("../../Icon"));
|
|
17
17
|
|
|
18
|
-
var _excluded = ["children", "icon", "theme", "small"];
|
|
18
|
+
var _excluded = ["children", "icon", "theme", "small", "ellipsis"];
|
|
19
19
|
|
|
20
20
|
var _templateObject;
|
|
21
21
|
|
|
@@ -52,10 +52,12 @@ var TagInformative = function TagInformative(_ref2) {
|
|
|
52
52
|
text = _ref2$theme$yoga.colors.text,
|
|
53
53
|
tag = _ref2$theme$yoga.components.tag,
|
|
54
54
|
small = _ref2.small,
|
|
55
|
+
ellipsis = _ref2.ellipsis,
|
|
55
56
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
56
57
|
|
|
57
58
|
return /*#__PURE__*/_react["default"].createElement(Informative, _extends({
|
|
58
|
-
small: small
|
|
59
|
+
small: small,
|
|
60
|
+
ellipsis: ellipsis
|
|
59
61
|
}, props), icon && /*#__PURE__*/_react["default"].createElement(_Icon["default"], {
|
|
60
62
|
as: icon,
|
|
61
63
|
size: small ? tag.icon.size.small : tag.icon.size["default"],
|
|
@@ -75,12 +77,16 @@ TagInformative.propTypes = {
|
|
|
75
77
|
children: _propTypes.node.isRequired,
|
|
76
78
|
|
|
77
79
|
/** The tag's size */
|
|
78
|
-
small: _propTypes.bool
|
|
80
|
+
small: _propTypes.bool,
|
|
81
|
+
|
|
82
|
+
/** After set a max-width can put ellipses for large texts */
|
|
83
|
+
ellipsis: _propTypes.bool
|
|
79
84
|
};
|
|
80
85
|
TagInformative.defaultProps = {
|
|
81
86
|
icon: undefined,
|
|
82
87
|
small: false,
|
|
83
|
-
variant: 'neutral'
|
|
88
|
+
variant: 'neutral',
|
|
89
|
+
ellipsis: false
|
|
84
90
|
};
|
|
85
91
|
TagInformative.displayName = 'Tag.Informative';
|
|
86
92
|
|
package/cjs/Tag/web/Tag.js
CHANGED
|
@@ -17,9 +17,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
17
17
|
|
|
18
18
|
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
19
19
|
|
|
20
|
-
var StyledTag = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n border-style: solid;\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
20
|
+
var StyledTag = _styledComponents["default"].div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n border-style: solid;\n\n ", "\n\n ", "\n ", "\n"])), function (_ref) {
|
|
21
21
|
var variant = _ref.variant,
|
|
22
22
|
small = _ref.small,
|
|
23
|
+
ellipsis = _ref.ellipsis,
|
|
23
24
|
_ref$theme$yoga = _ref.theme.yoga,
|
|
24
25
|
_ref$theme$yoga$color = _ref$theme$yoga.colors,
|
|
25
26
|
text = _ref$theme$yoga$color.text,
|
|
@@ -34,8 +35,8 @@ var StyledTag = _styledComponents["default"].div(_templateObject || (_templateOb
|
|
|
34
35
|
dark: elements.selectionAndIcons
|
|
35
36
|
} : _ref$theme$yoga$color4,
|
|
36
37
|
tag = _ref$theme$yoga.components.tag;
|
|
37
|
-
return "\n " + (small ? "\n padding:\n " + tag.padding.small.top + "\n " + tag.padding.small.right + "px\n " + tag.padding.small.bottom + "\n " + tag.padding.small.left + "px;\n " : "\n padding:\n " + tag.padding["default"].top + "px\n " + tag.padding["default"].right + "px\n " + tag.padding["default"].bottom + "px\n " + tag.padding["default"].left + "px;\n ") + "\n
|
|
38
|
-
}, _yogaSystem.margins);
|
|
38
|
+
return "\n " + (small ? "\n padding:\n " + tag.padding.small.top + "\n " + tag.padding.small.right + "px\n " + tag.padding.small.bottom + "\n " + tag.padding.small.left + "px;\n " : "\n padding:\n " + tag.padding["default"].top + "px\n " + tag.padding["default"].right + "px\n " + tag.padding["default"].bottom + "px\n " + tag.padding["default"].left + "px;\n ") + "\n\n " + (ellipsis ? "\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n " : "") + "\n\n color: " + color.dark + ";\n border-radius: " + tag.border.radius + "px;\n border-width: " + tag.border.width + "px;\n border-color: " + borderColor.dark + ";\n\n font-size: " + tag.font.size + "px;\n line-height: " + tag.font.lineHeight + "px;\n font-weight: " + tag.font.weight + ";\n ";
|
|
39
|
+
}, _yogaSystem.margins, _yogaSystem.maxWidth);
|
|
39
40
|
/** Tags should be keywords to categorize or organize an item. */
|
|
40
41
|
|
|
41
42
|
|
|
@@ -49,11 +50,15 @@ Tag.propTypes = {
|
|
|
49
50
|
children: _propTypes.node.isRequired,
|
|
50
51
|
|
|
51
52
|
/** Can send small to use this variant */
|
|
52
|
-
small: _propTypes.bool
|
|
53
|
+
small: _propTypes.bool,
|
|
54
|
+
|
|
55
|
+
/** After set a max-width can put ellipses for large texts */
|
|
56
|
+
ellipsis: _propTypes.bool
|
|
53
57
|
};
|
|
54
58
|
Tag.defaultProps = {
|
|
55
59
|
variant: '',
|
|
56
|
-
small: false
|
|
60
|
+
small: false,
|
|
61
|
+
ellipsis: false
|
|
57
62
|
};
|
|
58
63
|
var _default = Tag;
|
|
59
64
|
exports["default"] = _default;
|
|
@@ -1,87 +1,113 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
2
|
-
|
|
3
1
|
var _excluded = ["title", "subtitle", "children", "disabled", "expanded", "small", "hasHorizontalPadding"];
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
4
|
+
|
|
5
|
+
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); }
|
|
6
6
|
|
|
7
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
8
|
|
|
9
|
+
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
10
|
+
|
|
9
11
|
import React, { useState } from 'react';
|
|
10
12
|
import styled, { css } from 'styled-components';
|
|
11
13
|
import { string, node, bool } from 'prop-types';
|
|
12
14
|
import { ChevronDown } from '@gympass/yoga-icons';
|
|
13
15
|
import { Text, Divider } from '@gympass/yoga';
|
|
14
16
|
import Content from './Content';
|
|
17
|
+
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 (_ref) {
|
|
18
|
+
var _ref$theme$yoga$color = _ref.theme.yoga.colors,
|
|
19
|
+
white = _ref$theme$yoga$color.white,
|
|
20
|
+
elements = _ref$theme$yoga$color.elements,
|
|
21
|
+
disabled = _ref.disabled;
|
|
22
|
+
return "\n background: " + (disabled ? elements.backgroundAndDisabled : white) + "\n";
|
|
23
|
+
});
|
|
15
24
|
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
var getVerticalPadding = function getVerticalPadding(accordion, small) {
|
|
26
|
+
if (small) return accordion.padding.small;
|
|
27
|
+
return accordion.padding.large;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
var getHorizontalPadding = function getHorizontalPadding(accordion, hasHorizontalPadding) {
|
|
31
|
+
if (hasHorizontalPadding) return accordion.padding.standard;
|
|
32
|
+
return accordion.padding.zero;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
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 (_ref2) {
|
|
36
|
+
var accordion = _ref2.theme.yoga.components.accordion,
|
|
37
|
+
small = _ref2.small,
|
|
38
|
+
hasHorizontalPadding = _ref2.hasHorizontalPadding;
|
|
39
|
+
return "\n padding:" + getVerticalPadding(accordion, small) + "px " + getHorizontalPadding(accordion, hasHorizontalPadding) + "px;\n";
|
|
40
|
+
}, function (_ref3) {
|
|
41
|
+
var elements = _ref3.theme.yoga.colors.elements;
|
|
42
|
+
return "\n background: " + elements.backgroundAndDisabled + ";\n\n ";
|
|
43
|
+
}, function (_ref4) {
|
|
44
|
+
var disabled = _ref4.disabled;
|
|
45
|
+
return disabled && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n cursor: not-allowed;\n "])));
|
|
46
|
+
});
|
|
47
|
+
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) {
|
|
48
|
+
var accordion = _ref5.theme.yoga.components.accordion,
|
|
49
|
+
subtitle = _ref5.subtitle;
|
|
50
|
+
return "\n gap: " + (subtitle ? accordion.gap.header : 0) + "px;\n margin: " + (subtitle ? 0 : accordion.paddingArrow.total + "px 0") + ";\n";
|
|
51
|
+
}, function (_ref6) {
|
|
52
|
+
var disabled = _ref6.disabled;
|
|
53
|
+
return disabled && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n ", "\n "])), function (_ref7) {
|
|
54
|
+
var text = _ref7.theme.yoga.colors.text;
|
|
55
|
+
return "\n color: " + text.secundary + ";\n ";
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
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 (_ref8) {
|
|
59
|
+
var isOpen = _ref8.isOpen;
|
|
60
|
+
return isOpen ? '9999px' : '0';
|
|
61
|
+
}, function (_ref9) {
|
|
62
|
+
var accordion = _ref9.theme.yoga.components.accordion,
|
|
63
|
+
small = _ref9.small;
|
|
64
|
+
return small && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-bottom: ", "px;\n }\n "])), Content, accordion.padding.small);
|
|
65
|
+
}, function (_ref10) {
|
|
66
|
+
var hasHorizontalPadding = _ref10.hasHorizontalPadding;
|
|
67
|
+
return !hasHorizontalPadding && css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n ", " {\n padding-left: 0;\n padding-right: 0;\n }\n "])), Content);
|
|
68
|
+
});
|
|
69
|
+
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 (_ref11) {
|
|
70
|
+
var isOpen = _ref11.isOpen;
|
|
71
|
+
return isOpen ? 'rotate(180deg)' : 'rotate(0deg)';
|
|
72
|
+
}, function (_ref12) {
|
|
73
|
+
var _ref12$theme$yoga$col = _ref12.theme.yoga.colors,
|
|
74
|
+
primary = _ref12$theme$yoga$col.primary,
|
|
75
|
+
text = _ref12$theme$yoga$col.text,
|
|
76
|
+
disabled = _ref12.disabled;
|
|
77
|
+
return "\n fill: " + (disabled ? text.secondary : primary) + ";\n ";
|
|
78
|
+
}, function (_ref13) {
|
|
79
|
+
var accordion = _ref13.theme.yoga.components.accordion;
|
|
80
|
+
return "\n padding: " + accordion.paddingArrow.total + "px;\n";
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
var Accordion = function Accordion(_ref14) {
|
|
84
|
+
var title = _ref14.title,
|
|
85
|
+
subtitle = _ref14.subtitle,
|
|
86
|
+
children = _ref14.children,
|
|
87
|
+
disabled = _ref14.disabled,
|
|
88
|
+
expanded = _ref14.expanded,
|
|
89
|
+
small = _ref14.small,
|
|
90
|
+
hasHorizontalPadding = _ref14.hasHorizontalPadding,
|
|
91
|
+
props = _objectWithoutPropertiesLoose(_ref14, _excluded);
|
|
25
92
|
|
|
26
93
|
var _useState = useState(expanded),
|
|
27
94
|
open = _useState[0],
|
|
28
95
|
setOpen = _useState[1];
|
|
29
96
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
var getHorizontalPadding = function getHorizontalPadding(accordion) {
|
|
36
|
-
if (hasHorizontalPadding) return accordion.padding.standard;
|
|
37
|
-
return accordion.padding.zero;
|
|
38
|
-
};
|
|
39
|
-
|
|
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) {
|
|
41
|
-
var _ref2$theme$yoga$colo = _ref2.theme.yoga.colors,
|
|
42
|
-
white = _ref2$theme$yoga$colo.white,
|
|
43
|
-
elements = _ref2$theme$yoga$colo.elements;
|
|
44
|
-
return "\n background: " + (disabled ? elements.backgroundAndDisabled : white) + "\n ";
|
|
45
|
-
});
|
|
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) {
|
|
47
|
-
var accordion = _ref3.theme.yoga.components.accordion;
|
|
48
|
-
return "\n padding:" + getVerticalPadding(accordion) + "px " + getHorizontalPadding(accordion) + "px;\n ";
|
|
49
|
-
}, function (_ref4) {
|
|
50
|
-
var elements = _ref4.theme.yoga.colors.elements;
|
|
51
|
-
return "\n background: " + elements.backgroundAndDisabled + ";\n\n ";
|
|
52
|
-
}, disabled && css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n cursor: not-allowed;\n "]))));
|
|
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) {
|
|
54
|
-
var accordion = _ref5.theme.yoga.components.accordion;
|
|
55
|
-
return "\n gap: " + (subtitle ? accordion.gap.header : 0) + "px;\n margin: " + (subtitle ? 0 : accordion.paddingArrow.total + "px 0") + ";\n ";
|
|
56
|
-
}, disabled && css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n ", "\n "])), function (_ref6) {
|
|
57
|
-
var text = _ref6.theme.yoga.colors.text;
|
|
58
|
-
return "\n color: " + text.secundary + ";\n ";
|
|
59
|
-
}));
|
|
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) {
|
|
61
|
-
var isOpen = _ref7.isOpen;
|
|
62
|
-
return isOpen ? '9999px' : '0';
|
|
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;
|
|
69
|
-
return isOpen ? 'rotate(180deg)' : 'rotate(0deg)';
|
|
70
|
-
}, function (_ref10) {
|
|
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;
|
|
77
|
-
return "\n padding: " + accordion.paddingArrow.total + "px;\n ";
|
|
78
|
-
});
|
|
79
|
-
return /*#__PURE__*/React.createElement(AccordionWrapper, props, /*#__PURE__*/React.createElement(Header, {
|
|
97
|
+
return /*#__PURE__*/React.createElement(AccordionWrapper, _extends({
|
|
98
|
+
disabled: disabled
|
|
99
|
+
}, props), /*#__PURE__*/React.createElement(Header, {
|
|
80
100
|
disabled: disabled,
|
|
81
101
|
onClick: function onClick() {
|
|
82
|
-
setOpen(
|
|
83
|
-
|
|
84
|
-
|
|
102
|
+
setOpen(function (o) {
|
|
103
|
+
return !o;
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
small: small,
|
|
107
|
+
hasHorizontalPadding: hasHorizontalPadding
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Title, {
|
|
109
|
+
subtitle: subtitle
|
|
110
|
+
}, small ? /*#__PURE__*/React.createElement(Text.Small, {
|
|
85
111
|
color: disabled ? 'deep' : undefined
|
|
86
112
|
}, title) : /*#__PURE__*/React.createElement(Text.Medium, {
|
|
87
113
|
color: disabled ? 'deep' : undefined,
|
|
@@ -89,12 +115,15 @@ var Accordion = function Accordion(_ref) {
|
|
|
89
115
|
}, title), /*#__PURE__*/React.createElement(Text.Small, {
|
|
90
116
|
color: "deep"
|
|
91
117
|
}, subtitle)), /*#__PURE__*/React.createElement(ArrowWrapper, {
|
|
92
|
-
isOpen: open
|
|
118
|
+
isOpen: open,
|
|
119
|
+
disabled: disabled
|
|
93
120
|
}, /*#__PURE__*/React.createElement(ChevronDown, {
|
|
94
121
|
width: 24,
|
|
95
122
|
height: 24
|
|
96
123
|
}))), /*#__PURE__*/React.createElement(AccordionContent, {
|
|
97
|
-
isOpen: open
|
|
124
|
+
isOpen: open,
|
|
125
|
+
small: small,
|
|
126
|
+
hasHorizontalPadding: hasHorizontalPadding
|
|
98
127
|
}, children), /*#__PURE__*/React.createElement(Divider, null));
|
|
99
128
|
};
|
|
100
129
|
|
|
@@ -40,9 +40,18 @@ function Popover(_ref) {
|
|
|
40
40
|
}, title), /*#__PURE__*/React.createElement(Text.Small, {
|
|
41
41
|
m: "zero",
|
|
42
42
|
color: "white"
|
|
43
|
-
}, description)), /*#__PURE__*/React.createElement("
|
|
43
|
+
}, description)), /*#__PURE__*/React.createElement("button", {
|
|
44
|
+
type: "button",
|
|
45
|
+
style: {
|
|
46
|
+
all: 'unset'
|
|
47
|
+
},
|
|
44
48
|
onMouseEnter: handleShowPopover,
|
|
45
|
-
onMouseLeave: handleHidePopover
|
|
49
|
+
onMouseLeave: handleHidePopover,
|
|
50
|
+
onTouchStart: handleShowPopover,
|
|
51
|
+
onTouchEnd: handleHidePopover,
|
|
52
|
+
onClick: function onClick(event) {
|
|
53
|
+
return event.preventDefault();
|
|
54
|
+
}
|
|
46
55
|
}, children));
|
|
47
56
|
}
|
|
48
57
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children", "icon", "theme", "small"];
|
|
1
|
+
var _excluded = ["children", "icon", "theme", "small", "ellipsis"];
|
|
2
2
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
|
|
@@ -35,10 +35,12 @@ var TagInformative = function TagInformative(_ref2) {
|
|
|
35
35
|
text = _ref2$theme$yoga.colors.text,
|
|
36
36
|
tag = _ref2$theme$yoga.components.tag,
|
|
37
37
|
small = _ref2.small,
|
|
38
|
+
ellipsis = _ref2.ellipsis,
|
|
38
39
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded);
|
|
39
40
|
|
|
40
41
|
return /*#__PURE__*/React.createElement(Informative, _extends({
|
|
41
|
-
small: small
|
|
42
|
+
small: small,
|
|
43
|
+
ellipsis: ellipsis
|
|
42
44
|
}, props), icon && /*#__PURE__*/React.createElement(Icon, {
|
|
43
45
|
as: icon,
|
|
44
46
|
size: small ? tag.icon.size.small : tag.icon.size["default"],
|
|
@@ -58,12 +60,16 @@ TagInformative.propTypes = {
|
|
|
58
60
|
children: node.isRequired,
|
|
59
61
|
|
|
60
62
|
/** The tag's size */
|
|
61
|
-
small: bool
|
|
63
|
+
small: bool,
|
|
64
|
+
|
|
65
|
+
/** After set a max-width can put ellipses for large texts */
|
|
66
|
+
ellipsis: bool
|
|
62
67
|
};
|
|
63
68
|
TagInformative.defaultProps = {
|
|
64
69
|
icon: undefined,
|
|
65
70
|
small: false,
|
|
66
|
-
variant: 'neutral'
|
|
71
|
+
variant: 'neutral',
|
|
72
|
+
ellipsis: false
|
|
67
73
|
};
|
|
68
74
|
TagInformative.displayName = 'Tag.Informative';
|
|
69
75
|
export default withTheme(TagInformative);
|
package/esm/Tag/web/Tag.js
CHANGED
|
@@ -5,10 +5,11 @@ function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.s
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import { oneOf, node, bool } from 'prop-types';
|
|
8
|
-
import { margins } from '@gympass/yoga-system';
|
|
9
|
-
var StyledTag = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n border-style: solid;\n\n ", "\n\n ", "\n"])), function (_ref) {
|
|
8
|
+
import { margins, maxWidth } from '@gympass/yoga-system';
|
|
9
|
+
var StyledTag = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n\n border-style: solid;\n\n ", "\n\n ", "\n ", "\n"])), function (_ref) {
|
|
10
10
|
var variant = _ref.variant,
|
|
11
11
|
small = _ref.small,
|
|
12
|
+
ellipsis = _ref.ellipsis,
|
|
12
13
|
_ref$theme$yoga = _ref.theme.yoga,
|
|
13
14
|
_ref$theme$yoga$color = _ref$theme$yoga.colors,
|
|
14
15
|
text = _ref$theme$yoga$color.text,
|
|
@@ -23,8 +24,8 @@ var StyledTag = styled.div(_templateObject || (_templateObject = _taggedTemplate
|
|
|
23
24
|
dark: elements.selectionAndIcons
|
|
24
25
|
} : _ref$theme$yoga$color4,
|
|
25
26
|
tag = _ref$theme$yoga.components.tag;
|
|
26
|
-
return "\n " + (small ? "\n padding:\n " + tag.padding.small.top + "\n " + tag.padding.small.right + "px\n " + tag.padding.small.bottom + "\n " + tag.padding.small.left + "px;\n " : "\n padding:\n " + tag.padding["default"].top + "px\n " + tag.padding["default"].right + "px\n " + tag.padding["default"].bottom + "px\n " + tag.padding["default"].left + "px;\n ") + "\n
|
|
27
|
-
}, margins);
|
|
27
|
+
return "\n " + (small ? "\n padding:\n " + tag.padding.small.top + "\n " + tag.padding.small.right + "px\n " + tag.padding.small.bottom + "\n " + tag.padding.small.left + "px;\n " : "\n padding:\n " + tag.padding["default"].top + "px\n " + tag.padding["default"].right + "px\n " + tag.padding["default"].bottom + "px\n " + tag.padding["default"].left + "px;\n ") + "\n\n " + (ellipsis ? "\n display: block;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n " : "") + "\n\n color: " + color.dark + ";\n border-radius: " + tag.border.radius + "px;\n border-width: " + tag.border.width + "px;\n border-color: " + borderColor.dark + ";\n\n font-size: " + tag.font.size + "px;\n line-height: " + tag.font.lineHeight + "px;\n font-weight: " + tag.font.weight + ";\n ";
|
|
28
|
+
}, margins, maxWidth);
|
|
28
29
|
/** Tags should be keywords to categorize or organize an item. */
|
|
29
30
|
|
|
30
31
|
var Tag = function Tag(props) {
|
|
@@ -37,10 +38,14 @@ Tag.propTypes = {
|
|
|
37
38
|
children: node.isRequired,
|
|
38
39
|
|
|
39
40
|
/** Can send small to use this variant */
|
|
40
|
-
small: bool
|
|
41
|
+
small: bool,
|
|
42
|
+
|
|
43
|
+
/** After set a max-width can put ellipses for large texts */
|
|
44
|
+
ellipsis: bool
|
|
41
45
|
};
|
|
42
46
|
Tag.defaultProps = {
|
|
43
47
|
variant: '',
|
|
44
|
-
small: false
|
|
48
|
+
small: false,
|
|
49
|
+
ellipsis: false
|
|
45
50
|
};
|
|
46
51
|
export default Tag;
|
package/esm/Tag/web/Tag.test.js
CHANGED
|
@@ -76,4 +76,31 @@ describe('<Tag />', function () {
|
|
|
76
76
|
|
|
77
77
|
expect(container).toMatchSnapshot();
|
|
78
78
|
});
|
|
79
|
+
it('should match snapshot with ellipsis prop', function () {
|
|
80
|
+
var _render8 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Tag, {
|
|
81
|
+
maxWidth: "10px",
|
|
82
|
+
ellipsis: true
|
|
83
|
+
}, "Default with ellipsis"))),
|
|
84
|
+
container = _render8.container;
|
|
85
|
+
|
|
86
|
+
expect(container).toMatchSnapshot();
|
|
87
|
+
});
|
|
88
|
+
it('should match snapshot with variant, informative type and ellipsis prop', function () {
|
|
89
|
+
var _render9 = render( /*#__PURE__*/React.createElement(ThemeProvider, null, /*#__PURE__*/React.createElement(Tag.Informative, {
|
|
90
|
+
variant: "success",
|
|
91
|
+
maxWidth: "10px",
|
|
92
|
+
ellipsis: true
|
|
93
|
+
}, "Success with ellipsis"), /*#__PURE__*/React.createElement(Tag.Informative, {
|
|
94
|
+
variant: "attention",
|
|
95
|
+
maxWidth: "10px",
|
|
96
|
+
ellipsis: true
|
|
97
|
+
}, "Attention with ellipsis"), /*#__PURE__*/React.createElement(Tag.Informative, {
|
|
98
|
+
variant: "informative",
|
|
99
|
+
maxWidth: "10px",
|
|
100
|
+
ellipsis: true
|
|
101
|
+
}, "Informative with ellipsis"))),
|
|
102
|
+
container = _render9.container;
|
|
103
|
+
|
|
104
|
+
expect(container).toMatchSnapshot();
|
|
105
|
+
});
|
|
79
106
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gympass/yoga",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.73.0",
|
|
4
4
|
"description": "Gympass component library",
|
|
5
5
|
"main": "./cjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react": ">=16",
|
|
54
54
|
"styled-components": "^4.4.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "1e683b25901f777084721ebe795c1ebd5e560ff2",
|
|
57
57
|
"module": "./esm",
|
|
58
58
|
"private": false,
|
|
59
59
|
"react-native": "./cjs/index.native.js"
|