@zendeskgarden/react-tags 8.57.1 → 8.59.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/dist/index.cjs.js +50 -111
- package/dist/index.esm.js +50 -111
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -44,99 +44,58 @@ function _extends$1() {
|
|
|
44
44
|
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
45
45
|
for (var i = 1; i < arguments.length; i++) {
|
|
46
46
|
var source = arguments[i];
|
|
47
|
-
|
|
48
47
|
for (var key in source) {
|
|
49
48
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
50
49
|
target[key] = source[key];
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
|
|
55
53
|
return target;
|
|
56
54
|
};
|
|
57
55
|
return _extends$1.apply(this, arguments);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
|
|
61
|
-
if (source == null) return {};
|
|
62
|
-
var target = {};
|
|
63
|
-
var sourceKeys = Object.keys(source);
|
|
64
|
-
var key, i;
|
|
65
|
-
|
|
66
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
67
|
-
key = sourceKeys[i];
|
|
68
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
69
|
-
target[key] = source[key];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return target;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function _objectWithoutProperties(source, excluded) {
|
|
76
|
-
if (source == null) return {};
|
|
77
|
-
|
|
78
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
79
|
-
|
|
80
|
-
var key, i;
|
|
81
|
-
|
|
82
|
-
if (Object.getOwnPropertySymbols) {
|
|
83
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
84
|
-
|
|
85
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
86
|
-
key = sourceSymbolKeys[i];
|
|
87
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
88
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
89
|
-
target[key] = source[key];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return target;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
var SIZE = ['small', 'medium', 'large'];
|
|
58
|
+
const SIZE = ['small', 'medium', 'large'];
|
|
97
59
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
60
|
+
const COMPONENT_ID$2 = 'tags.avatar';
|
|
61
|
+
const StyledAvatar = styled__default["default"](_ref => {
|
|
62
|
+
let {
|
|
63
|
+
children,
|
|
64
|
+
...props
|
|
65
|
+
} = _ref;
|
|
103
66
|
return React__default["default"].cloneElement(React.Children.only(children), props);
|
|
104
67
|
}).attrs({
|
|
105
68
|
'data-garden-id': COMPONENT_ID$2,
|
|
106
|
-
'data-garden-version': '8.
|
|
69
|
+
'data-garden-version': '8.59.0'
|
|
107
70
|
}).withConfig({
|
|
108
71
|
displayName: "StyledAvatar",
|
|
109
72
|
componentId: "sc-3kdmgt-0"
|
|
110
|
-
})(["flex-shrink:0;font-size:0;", ";"],
|
|
111
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props);
|
|
112
|
-
});
|
|
73
|
+
})(["flex-shrink:0;font-size:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
113
74
|
StyledAvatar.defaultProps = {
|
|
114
75
|
theme: reactTheming.DEFAULT_THEME
|
|
115
76
|
};
|
|
116
77
|
|
|
117
|
-
|
|
118
|
-
|
|
78
|
+
const COMPONENT_ID$1 = 'tags.close';
|
|
79
|
+
const StyledClose = styled__default["default"].div.attrs({
|
|
119
80
|
'data-garden-id': COMPONENT_ID$1,
|
|
120
|
-
'data-garden-version': '8.
|
|
81
|
+
'data-garden-version': '8.59.0',
|
|
121
82
|
'aria-label': 'Press delete to remove'
|
|
122
83
|
}).withConfig({
|
|
123
84
|
displayName: "StyledClose",
|
|
124
85
|
componentId: "sc-d6lrpn-0"
|
|
125
|
-
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;cursor:pointer;padding:0;font-size:0;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"],
|
|
126
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
127
|
-
});
|
|
86
|
+
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;cursor:pointer;padding:0;font-size:0;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
128
87
|
StyledClose.defaultProps = {
|
|
129
88
|
theme: reactTheming.DEFAULT_THEME
|
|
130
89
|
};
|
|
131
90
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
91
|
+
const COMPONENT_ID = 'tags.tag_view';
|
|
92
|
+
const colorStyles = props => {
|
|
93
|
+
let backgroundColor;
|
|
94
|
+
let boxShadowColor;
|
|
95
|
+
let foregroundColor;
|
|
96
|
+
let closeColor;
|
|
138
97
|
if (props.hue) {
|
|
139
|
-
|
|
98
|
+
const shade = props.hue === 'yellow' ? 400 : 600;
|
|
140
99
|
backgroundColor = reactTheming.getColor(props.hue, shade, props.theme);
|
|
141
100
|
boxShadowColor = reactTheming.getColor(props.hue, shade, props.theme, 0.35);
|
|
142
101
|
if (props.hue === 'yellow' || props.hue === 'lemon') {
|
|
@@ -152,13 +111,13 @@ var colorStyles = function colorStyles(props) {
|
|
|
152
111
|
}
|
|
153
112
|
return styled.css(["background-color:", ";color:", ";&:hover{color:", ";}&:focus{box-shadow:", ";}& ", "{color:", ";}"], backgroundColor, foregroundColor, foregroundColor, props.theme.shadows.sm(boxShadowColor), StyledClose, closeColor);
|
|
154
113
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
114
|
+
const sizeStyles = props => {
|
|
115
|
+
let borderRadius;
|
|
116
|
+
let padding;
|
|
117
|
+
let height;
|
|
118
|
+
let fontSize;
|
|
119
|
+
let minWidth;
|
|
120
|
+
let avatarSize;
|
|
162
121
|
if (props.size === 'small') {
|
|
163
122
|
borderRadius = props.theme.borderRadii.sm;
|
|
164
123
|
padding = props.theme.space.base;
|
|
@@ -178,9 +137,9 @@ var sizeStyles = function sizeStyles(props) {
|
|
|
178
137
|
fontSize = props.theme.fontSizes.sm;
|
|
179
138
|
avatarSize = props.theme.space.base * 4;
|
|
180
139
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
140
|
+
let avatarBorderRadius = props.size === 'large' ? polished.math(`${borderRadius} - 1`) : borderRadius;
|
|
141
|
+
const avatarMargin = (height - avatarSize) / 2;
|
|
142
|
+
const avatarTextMargin = props.isRound ? avatarMargin : avatarMargin * 2;
|
|
184
143
|
if (props.isRound) {
|
|
185
144
|
borderRadius = '50%';
|
|
186
145
|
padding = 0;
|
|
@@ -198,33 +157,15 @@ var sizeStyles = function sizeStyles(props) {
|
|
|
198
157
|
minWidth = props.theme.space.base * 7.5;
|
|
199
158
|
}
|
|
200
159
|
}
|
|
201
|
-
return styled.css(["border-radius:", ";padding:0 ", "px;min-width:", ";height:", "px;line-height:", ";font-size:", ";& > *{width:100%;min-width:", ";}& ", "{margin-", ":-", "px;margin-", ":", "px;border-radius:", ";width:", "px;min-width:", "px;height:", "px;}& ", "{margin-", ":-", "px;border-radius:", ";width:", "px;height:", "px;}"], borderRadius, padding, minWidth ?
|
|
160
|
+
return styled.css(["border-radius:", ";padding:0 ", "px;min-width:", ";height:", "px;line-height:", ";font-size:", ";& > *{width:100%;min-width:", ";}& ", "{margin-", ":-", "px;margin-", ":", "px;border-radius:", ";width:", "px;min-width:", "px;height:", "px;}& ", "{margin-", ":-", "px;border-radius:", ";width:", "px;height:", "px;}"], borderRadius, padding, minWidth ? `${minWidth}px` : `calc(${padding * 2}px + 1ch)`, height, reactTheming.getLineHeight(height, fontSize), fontSize, minWidth ? `${minWidth - padding * 2}px` : '1ch', StyledAvatar, props.theme.rtl ? 'right' : 'left', padding - avatarMargin, props.theme.rtl ? 'left' : 'right', avatarTextMargin, avatarBorderRadius, avatarSize, avatarSize, avatarSize, StyledClose, props.theme.rtl ? 'left' : 'right', padding, borderRadius, height, height);
|
|
202
161
|
};
|
|
203
|
-
|
|
162
|
+
const StyledTag = styled__default["default"].div.attrs({
|
|
204
163
|
'data-garden-id': COMPONENT_ID,
|
|
205
|
-
'data-garden-version': '8.
|
|
164
|
+
'data-garden-version': '8.59.0'
|
|
206
165
|
}).withConfig({
|
|
207
166
|
displayName: "StyledTag",
|
|
208
167
|
componentId: "sc-1jvbe03-0"
|
|
209
|
-
})(["display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:", ";transition:box-shadow 0.1s ease-in-out;box-sizing:border-box;border:0;max-width:100%;overflow:hidden;vertical-align:middle;text-decoration:none;white-space:nowrap;font-weight:", ";direction:", ";", ";&:hover{cursor:default;text-decoration:none;}&:focus{outline:none;}&:link:hover,&:visited:hover{cursor:pointer;}&:any-link:hover{cursor:pointer;}&[data-garden-focus-visible]{text-decoration:none;}", ";& > *{overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;}& b{font-weight:", ";}& ", "{display:", ";}& ", "{display:", ";}", ";"],
|
|
210
|
-
return props.isRound && 'center';
|
|
211
|
-
}, function (props) {
|
|
212
|
-
return !props.isRegular && props.theme.fontWeights.semibold;
|
|
213
|
-
}, function (props) {
|
|
214
|
-
return props.theme.rtl ? 'rtl' : 'ltr';
|
|
215
|
-
}, function (props) {
|
|
216
|
-
return sizeStyles(props);
|
|
217
|
-
}, function (props) {
|
|
218
|
-
return colorStyles(props);
|
|
219
|
-
}, function (props) {
|
|
220
|
-
return props.theme.fontWeights.semibold;
|
|
221
|
-
}, StyledAvatar, function (props) {
|
|
222
|
-
return (props.isRound || props.size === 'small') && 'none';
|
|
223
|
-
}, StyledClose, function (props) {
|
|
224
|
-
return props.isRound && 'none';
|
|
225
|
-
}, function (props) {
|
|
226
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
|
|
227
|
-
});
|
|
168
|
+
})(["display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:", ";transition:box-shadow 0.1s ease-in-out;box-sizing:border-box;border:0;max-width:100%;overflow:hidden;vertical-align:middle;text-decoration:none;white-space:nowrap;font-weight:", ";direction:", ";", ";&:hover{cursor:default;text-decoration:none;}&:focus{outline:none;}&:link:hover,&:visited:hover{cursor:pointer;}&:any-link:hover{cursor:pointer;}&[data-garden-focus-visible]{text-decoration:none;}", ";& > *{overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;}& b{font-weight:", ";}& ", "{display:", ";}& ", "{display:", ";}", ";"], props => props.isRound && 'center', props => !props.isRegular && props.theme.fontWeights.semibold, props => props.theme.rtl ? 'rtl' : 'ltr', props => sizeStyles(props), props => colorStyles(props), props => props.theme.fontWeights.semibold, StyledAvatar, props => (props.isRound || props.size === 'small') && 'none', StyledClose, props => props.isRound && 'none', props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
228
169
|
StyledTag.defaultProps = {
|
|
229
170
|
size: 'medium',
|
|
230
171
|
theme: reactTheming.DEFAULT_THEME
|
|
@@ -241,7 +182,8 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
241
182
|
height: 12,
|
|
242
183
|
focusable: "false",
|
|
243
184
|
viewBox: "0 0 12 12",
|
|
244
|
-
"aria-hidden": "true"
|
|
185
|
+
"aria-hidden": "true",
|
|
186
|
+
role: "img"
|
|
245
187
|
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
246
188
|
stroke: "currentColor",
|
|
247
189
|
strokeLinecap: "round",
|
|
@@ -249,25 +191,22 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
249
191
|
})));
|
|
250
192
|
};
|
|
251
193
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
}, props), React__default["default"].createElement(SvgXStroke, null));
|
|
256
|
-
});
|
|
194
|
+
const CloseComponent = React.forwardRef((props, ref) => React__default["default"].createElement(StyledClose, _extends$1({
|
|
195
|
+
ref: ref
|
|
196
|
+
}, props), React__default["default"].createElement(SvgXStroke, null)));
|
|
257
197
|
CloseComponent.displayName = 'Tag.Close';
|
|
258
|
-
|
|
198
|
+
const Close = CloseComponent;
|
|
259
199
|
|
|
260
|
-
|
|
261
|
-
return React__default["default"].createElement(StyledAvatar, props);
|
|
262
|
-
};
|
|
200
|
+
const AvatarComponent = props => React__default["default"].createElement(StyledAvatar, props);
|
|
263
201
|
AvatarComponent.displayName = 'Tag.Avatar';
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
202
|
+
const Avatar = AvatarComponent;
|
|
203
|
+
|
|
204
|
+
const TagComponent = React.forwardRef((_ref, ref) => {
|
|
205
|
+
let {
|
|
206
|
+
size,
|
|
207
|
+
hue,
|
|
208
|
+
...otherProps
|
|
209
|
+
} = _ref;
|
|
271
210
|
return React__default["default"].createElement(StyledTag, _extends$1({
|
|
272
211
|
ref: ref,
|
|
273
212
|
size: size,
|
|
@@ -285,7 +224,7 @@ TagComponent.propTypes = {
|
|
|
285
224
|
TagComponent.defaultProps = {
|
|
286
225
|
size: 'medium'
|
|
287
226
|
};
|
|
288
|
-
|
|
227
|
+
const Tag = TagComponent;
|
|
289
228
|
Tag.Avatar = Avatar;
|
|
290
229
|
Tag.Close = Close;
|
|
291
230
|
|
package/dist/index.esm.js
CHANGED
|
@@ -16,99 +16,58 @@ function _extends$1() {
|
|
|
16
16
|
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
17
17
|
for (var i = 1; i < arguments.length; i++) {
|
|
18
18
|
var source = arguments[i];
|
|
19
|
-
|
|
20
19
|
for (var key in source) {
|
|
21
20
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
22
21
|
target[key] = source[key];
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
return target;
|
|
28
26
|
};
|
|
29
27
|
return _extends$1.apply(this, arguments);
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
if (source == null) return {};
|
|
34
|
-
var target = {};
|
|
35
|
-
var sourceKeys = Object.keys(source);
|
|
36
|
-
var key, i;
|
|
37
|
-
|
|
38
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
39
|
-
key = sourceKeys[i];
|
|
40
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
41
|
-
target[key] = source[key];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return target;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function _objectWithoutProperties(source, excluded) {
|
|
48
|
-
if (source == null) return {};
|
|
49
|
-
|
|
50
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
51
|
-
|
|
52
|
-
var key, i;
|
|
53
|
-
|
|
54
|
-
if (Object.getOwnPropertySymbols) {
|
|
55
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
56
|
-
|
|
57
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
58
|
-
key = sourceSymbolKeys[i];
|
|
59
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
60
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
61
|
-
target[key] = source[key];
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return target;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
var SIZE = ['small', 'medium', 'large'];
|
|
30
|
+
const SIZE = ['small', 'medium', 'large'];
|
|
69
31
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
32
|
+
const COMPONENT_ID$2 = 'tags.avatar';
|
|
33
|
+
const StyledAvatar = styled(_ref => {
|
|
34
|
+
let {
|
|
35
|
+
children,
|
|
36
|
+
...props
|
|
37
|
+
} = _ref;
|
|
75
38
|
return React__default.cloneElement(Children.only(children), props);
|
|
76
39
|
}).attrs({
|
|
77
40
|
'data-garden-id': COMPONENT_ID$2,
|
|
78
|
-
'data-garden-version': '8.
|
|
41
|
+
'data-garden-version': '8.59.0'
|
|
79
42
|
}).withConfig({
|
|
80
43
|
displayName: "StyledAvatar",
|
|
81
44
|
componentId: "sc-3kdmgt-0"
|
|
82
|
-
})(["flex-shrink:0;font-size:0;", ";"],
|
|
83
|
-
return retrieveComponentStyles(COMPONENT_ID$2, props);
|
|
84
|
-
});
|
|
45
|
+
})(["flex-shrink:0;font-size:0;", ";"], props => retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
85
46
|
StyledAvatar.defaultProps = {
|
|
86
47
|
theme: DEFAULT_THEME
|
|
87
48
|
};
|
|
88
49
|
|
|
89
|
-
|
|
90
|
-
|
|
50
|
+
const COMPONENT_ID$1 = 'tags.close';
|
|
51
|
+
const StyledClose = styled.div.attrs({
|
|
91
52
|
'data-garden-id': COMPONENT_ID$1,
|
|
92
|
-
'data-garden-version': '8.
|
|
53
|
+
'data-garden-version': '8.59.0',
|
|
93
54
|
'aria-label': 'Press delete to remove'
|
|
94
55
|
}).withConfig({
|
|
95
56
|
displayName: "StyledClose",
|
|
96
57
|
componentId: "sc-d6lrpn-0"
|
|
97
|
-
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;cursor:pointer;padding:0;font-size:0;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"],
|
|
98
|
-
return retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
99
|
-
});
|
|
58
|
+
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;cursor:pointer;padding:0;font-size:0;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
100
59
|
StyledClose.defaultProps = {
|
|
101
60
|
theme: DEFAULT_THEME
|
|
102
61
|
};
|
|
103
62
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
63
|
+
const COMPONENT_ID = 'tags.tag_view';
|
|
64
|
+
const colorStyles = props => {
|
|
65
|
+
let backgroundColor;
|
|
66
|
+
let boxShadowColor;
|
|
67
|
+
let foregroundColor;
|
|
68
|
+
let closeColor;
|
|
110
69
|
if (props.hue) {
|
|
111
|
-
|
|
70
|
+
const shade = props.hue === 'yellow' ? 400 : 600;
|
|
112
71
|
backgroundColor = getColor(props.hue, shade, props.theme);
|
|
113
72
|
boxShadowColor = getColor(props.hue, shade, props.theme, 0.35);
|
|
114
73
|
if (props.hue === 'yellow' || props.hue === 'lemon') {
|
|
@@ -124,13 +83,13 @@ var colorStyles = function colorStyles(props) {
|
|
|
124
83
|
}
|
|
125
84
|
return css(["background-color:", ";color:", ";&:hover{color:", ";}&:focus{box-shadow:", ";}& ", "{color:", ";}"], backgroundColor, foregroundColor, foregroundColor, props.theme.shadows.sm(boxShadowColor), StyledClose, closeColor);
|
|
126
85
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
86
|
+
const sizeStyles = props => {
|
|
87
|
+
let borderRadius;
|
|
88
|
+
let padding;
|
|
89
|
+
let height;
|
|
90
|
+
let fontSize;
|
|
91
|
+
let minWidth;
|
|
92
|
+
let avatarSize;
|
|
134
93
|
if (props.size === 'small') {
|
|
135
94
|
borderRadius = props.theme.borderRadii.sm;
|
|
136
95
|
padding = props.theme.space.base;
|
|
@@ -150,9 +109,9 @@ var sizeStyles = function sizeStyles(props) {
|
|
|
150
109
|
fontSize = props.theme.fontSizes.sm;
|
|
151
110
|
avatarSize = props.theme.space.base * 4;
|
|
152
111
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
112
|
+
let avatarBorderRadius = props.size === 'large' ? math(`${borderRadius} - 1`) : borderRadius;
|
|
113
|
+
const avatarMargin = (height - avatarSize) / 2;
|
|
114
|
+
const avatarTextMargin = props.isRound ? avatarMargin : avatarMargin * 2;
|
|
156
115
|
if (props.isRound) {
|
|
157
116
|
borderRadius = '50%';
|
|
158
117
|
padding = 0;
|
|
@@ -170,33 +129,15 @@ var sizeStyles = function sizeStyles(props) {
|
|
|
170
129
|
minWidth = props.theme.space.base * 7.5;
|
|
171
130
|
}
|
|
172
131
|
}
|
|
173
|
-
return css(["border-radius:", ";padding:0 ", "px;min-width:", ";height:", "px;line-height:", ";font-size:", ";& > *{width:100%;min-width:", ";}& ", "{margin-", ":-", "px;margin-", ":", "px;border-radius:", ";width:", "px;min-width:", "px;height:", "px;}& ", "{margin-", ":-", "px;border-radius:", ";width:", "px;height:", "px;}"], borderRadius, padding, minWidth ?
|
|
132
|
+
return css(["border-radius:", ";padding:0 ", "px;min-width:", ";height:", "px;line-height:", ";font-size:", ";& > *{width:100%;min-width:", ";}& ", "{margin-", ":-", "px;margin-", ":", "px;border-radius:", ";width:", "px;min-width:", "px;height:", "px;}& ", "{margin-", ":-", "px;border-radius:", ";width:", "px;height:", "px;}"], borderRadius, padding, minWidth ? `${minWidth}px` : `calc(${padding * 2}px + 1ch)`, height, getLineHeight(height, fontSize), fontSize, minWidth ? `${minWidth - padding * 2}px` : '1ch', StyledAvatar, props.theme.rtl ? 'right' : 'left', padding - avatarMargin, props.theme.rtl ? 'left' : 'right', avatarTextMargin, avatarBorderRadius, avatarSize, avatarSize, avatarSize, StyledClose, props.theme.rtl ? 'left' : 'right', padding, borderRadius, height, height);
|
|
174
133
|
};
|
|
175
|
-
|
|
134
|
+
const StyledTag = styled.div.attrs({
|
|
176
135
|
'data-garden-id': COMPONENT_ID,
|
|
177
|
-
'data-garden-version': '8.
|
|
136
|
+
'data-garden-version': '8.59.0'
|
|
178
137
|
}).withConfig({
|
|
179
138
|
displayName: "StyledTag",
|
|
180
139
|
componentId: "sc-1jvbe03-0"
|
|
181
|
-
})(["display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:", ";transition:box-shadow 0.1s ease-in-out;box-sizing:border-box;border:0;max-width:100%;overflow:hidden;vertical-align:middle;text-decoration:none;white-space:nowrap;font-weight:", ";direction:", ";", ";&:hover{cursor:default;text-decoration:none;}&:focus{outline:none;}&:link:hover,&:visited:hover{cursor:pointer;}&:any-link:hover{cursor:pointer;}&[data-garden-focus-visible]{text-decoration:none;}", ";& > *{overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;}& b{font-weight:", ";}& ", "{display:", ";}& ", "{display:", ";}", ";"],
|
|
182
|
-
return props.isRound && 'center';
|
|
183
|
-
}, function (props) {
|
|
184
|
-
return !props.isRegular && props.theme.fontWeights.semibold;
|
|
185
|
-
}, function (props) {
|
|
186
|
-
return props.theme.rtl ? 'rtl' : 'ltr';
|
|
187
|
-
}, function (props) {
|
|
188
|
-
return sizeStyles(props);
|
|
189
|
-
}, function (props) {
|
|
190
|
-
return colorStyles(props);
|
|
191
|
-
}, function (props) {
|
|
192
|
-
return props.theme.fontWeights.semibold;
|
|
193
|
-
}, StyledAvatar, function (props) {
|
|
194
|
-
return (props.isRound || props.size === 'small') && 'none';
|
|
195
|
-
}, StyledClose, function (props) {
|
|
196
|
-
return props.isRound && 'none';
|
|
197
|
-
}, function (props) {
|
|
198
|
-
return retrieveComponentStyles(COMPONENT_ID, props);
|
|
199
|
-
});
|
|
140
|
+
})(["display:inline-flex;flex-wrap:nowrap;align-items:center;justify-content:", ";transition:box-shadow 0.1s ease-in-out;box-sizing:border-box;border:0;max-width:100%;overflow:hidden;vertical-align:middle;text-decoration:none;white-space:nowrap;font-weight:", ";direction:", ";", ";&:hover{cursor:default;text-decoration:none;}&:focus{outline:none;}&:link:hover,&:visited:hover{cursor:pointer;}&:any-link:hover{cursor:pointer;}&[data-garden-focus-visible]{text-decoration:none;}", ";& > *{overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;}& b{font-weight:", ";}& ", "{display:", ";}& ", "{display:", ";}", ";"], props => props.isRound && 'center', props => !props.isRegular && props.theme.fontWeights.semibold, props => props.theme.rtl ? 'rtl' : 'ltr', props => sizeStyles(props), props => colorStyles(props), props => props.theme.fontWeights.semibold, StyledAvatar, props => (props.isRound || props.size === 'small') && 'none', StyledClose, props => props.isRound && 'none', props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
200
141
|
StyledTag.defaultProps = {
|
|
201
142
|
size: 'medium',
|
|
202
143
|
theme: DEFAULT_THEME
|
|
@@ -213,7 +154,8 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
213
154
|
height: 12,
|
|
214
155
|
focusable: "false",
|
|
215
156
|
viewBox: "0 0 12 12",
|
|
216
|
-
"aria-hidden": "true"
|
|
157
|
+
"aria-hidden": "true",
|
|
158
|
+
role: "img"
|
|
217
159
|
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
218
160
|
stroke: "currentColor",
|
|
219
161
|
strokeLinecap: "round",
|
|
@@ -221,25 +163,22 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
221
163
|
})));
|
|
222
164
|
};
|
|
223
165
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}, props), React__default.createElement(SvgXStroke, null));
|
|
228
|
-
});
|
|
166
|
+
const CloseComponent = forwardRef((props, ref) => React__default.createElement(StyledClose, _extends$1({
|
|
167
|
+
ref: ref
|
|
168
|
+
}, props), React__default.createElement(SvgXStroke, null)));
|
|
229
169
|
CloseComponent.displayName = 'Tag.Close';
|
|
230
|
-
|
|
170
|
+
const Close = CloseComponent;
|
|
231
171
|
|
|
232
|
-
|
|
233
|
-
return React__default.createElement(StyledAvatar, props);
|
|
234
|
-
};
|
|
172
|
+
const AvatarComponent = props => React__default.createElement(StyledAvatar, props);
|
|
235
173
|
AvatarComponent.displayName = 'Tag.Avatar';
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
174
|
+
const Avatar = AvatarComponent;
|
|
175
|
+
|
|
176
|
+
const TagComponent = forwardRef((_ref, ref) => {
|
|
177
|
+
let {
|
|
178
|
+
size,
|
|
179
|
+
hue,
|
|
180
|
+
...otherProps
|
|
181
|
+
} = _ref;
|
|
243
182
|
return React__default.createElement(StyledTag, _extends$1({
|
|
244
183
|
ref: ref,
|
|
245
184
|
size: size,
|
|
@@ -257,7 +196,7 @@ TagComponent.propTypes = {
|
|
|
257
196
|
TagComponent.defaultProps = {
|
|
258
197
|
size: 'medium'
|
|
259
198
|
};
|
|
260
|
-
|
|
199
|
+
const Tag = TagComponent;
|
|
261
200
|
Tag.Avatar = Avatar;
|
|
262
201
|
Tag.Close = Close;
|
|
263
202
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-tags",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.59.0",
|
|
4
4
|
"description": "Components relating to tags in the Garden Design System",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Zendesk Garden <garden@zendesk.com>",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@zendeskgarden/react-theming": "^8.
|
|
35
|
+
"@zendeskgarden/react-theming": "^8.59.0",
|
|
36
36
|
"@zendeskgarden/svg-icons": "6.33.0"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"zendeskgarden:src": "src/index.ts",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "14c3ad1b3abb0f76ffc8512c89d167ecb6f024fa"
|
|
49
49
|
}
|