@zendeskgarden/react-tags 9.0.0-next.2 → 9.0.0-next.20
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/esm/elements/Avatar.js +16 -0
- package/dist/esm/elements/Close.js +27 -0
- package/dist/esm/elements/Tag.js +43 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js +26 -0
- package/dist/esm/styled/StyledAvatar.js +22 -0
- package/dist/esm/styled/StyledClose.js +22 -0
- package/dist/esm/styled/StyledTag.js +198 -0
- package/dist/esm/types/index.js +9 -0
- package/dist/index.cjs.js +129 -50
- package/dist/typings/styled/StyledAvatar.d.ts +2 -2
- package/dist/typings/types/index.d.ts +2 -1
- package/package.json +8 -8
- package/dist/index.esm.js +0 -207
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import '../styled/StyledTag.js';
|
|
9
|
+
import { StyledAvatar } from '../styled/StyledAvatar.js';
|
|
10
|
+
import '../styled/StyledClose.js';
|
|
11
|
+
|
|
12
|
+
const AvatarComponent = props => React__default.createElement(StyledAvatar, props);
|
|
13
|
+
AvatarComponent.displayName = 'Tag.Avatar';
|
|
14
|
+
const Avatar = AvatarComponent;
|
|
15
|
+
|
|
16
|
+
export { Avatar };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import '../styled/StyledTag.js';
|
|
9
|
+
import '../styled/StyledAvatar.js';
|
|
10
|
+
import { StyledClose } from '../styled/StyledClose.js';
|
|
11
|
+
import SvgXStroke from '../node_modules/@zendeskgarden/svg-icons/src/12/x-stroke.svg.js';
|
|
12
|
+
import { useText } from '@zendeskgarden/react-theming';
|
|
13
|
+
|
|
14
|
+
const CloseComponent = forwardRef((props, ref) => {
|
|
15
|
+
const ariaLabel = useText(CloseComponent, props, 'aria-label', 'Remove');
|
|
16
|
+
return React__default.createElement(StyledClose, Object.assign({
|
|
17
|
+
ref: ref,
|
|
18
|
+
"aria-label": ariaLabel
|
|
19
|
+
}, props, {
|
|
20
|
+
type: "button",
|
|
21
|
+
tabIndex: -1
|
|
22
|
+
}), React__default.createElement(SvgXStroke, null));
|
|
23
|
+
});
|
|
24
|
+
CloseComponent.displayName = 'Tag.Close';
|
|
25
|
+
const Close = CloseComponent;
|
|
26
|
+
|
|
27
|
+
export { Close };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import React__default, { forwardRef } from 'react';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { SIZE } from '../types/index.js';
|
|
10
|
+
import { StyledTag } from '../styled/StyledTag.js';
|
|
11
|
+
import '../styled/StyledAvatar.js';
|
|
12
|
+
import '../styled/StyledClose.js';
|
|
13
|
+
import { Close } from './Close.js';
|
|
14
|
+
import { Avatar } from './Avatar.js';
|
|
15
|
+
|
|
16
|
+
const TagComponent = forwardRef((_ref, ref) => {
|
|
17
|
+
let {
|
|
18
|
+
size,
|
|
19
|
+
hue,
|
|
20
|
+
...otherProps
|
|
21
|
+
} = _ref;
|
|
22
|
+
return React__default.createElement(StyledTag, Object.assign({
|
|
23
|
+
ref: ref,
|
|
24
|
+
size: size,
|
|
25
|
+
hue: hue
|
|
26
|
+
}, otherProps));
|
|
27
|
+
});
|
|
28
|
+
TagComponent.displayName = 'Tag';
|
|
29
|
+
TagComponent.propTypes = {
|
|
30
|
+
size: PropTypes.oneOf(SIZE),
|
|
31
|
+
hue: PropTypes.string,
|
|
32
|
+
isPill: PropTypes.bool,
|
|
33
|
+
isRound: PropTypes.bool,
|
|
34
|
+
isRegular: PropTypes.bool
|
|
35
|
+
};
|
|
36
|
+
TagComponent.defaultProps = {
|
|
37
|
+
size: 'medium'
|
|
38
|
+
};
|
|
39
|
+
const Tag = TagComponent;
|
|
40
|
+
Tag.Avatar = Avatar;
|
|
41
|
+
Tag.Close = Close;
|
|
42
|
+
|
|
43
|
+
export { Tag };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
|
|
9
|
+
var _path;
|
|
10
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
11
|
+
var SvgXStroke = function SvgXStroke(props) {
|
|
12
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
width: 12,
|
|
15
|
+
height: 12,
|
|
16
|
+
focusable: "false",
|
|
17
|
+
viewBox: "0 0 12 12",
|
|
18
|
+
"aria-hidden": "true"
|
|
19
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
20
|
+
stroke: "currentColor",
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
d: "M3 9l6-6m0 6L3 3"
|
|
23
|
+
})));
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { SvgXStroke as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { StyledBaseIcon, retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'tags.avatar';
|
|
11
|
+
const StyledAvatar = styled(StyledBaseIcon).attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.20'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledAvatar",
|
|
16
|
+
componentId: "sc-3kdmgt-0"
|
|
17
|
+
})(["flex-shrink:0;font-size:0;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledAvatar.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledAvatar };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
|
|
9
|
+
|
|
10
|
+
const COMPONENT_ID = 'tags.close';
|
|
11
|
+
const StyledClose = styled.button.attrs({
|
|
12
|
+
'data-garden-id': COMPONENT_ID,
|
|
13
|
+
'data-garden-version': '9.0.0-next.20'
|
|
14
|
+
}).withConfig({
|
|
15
|
+
displayName: "StyledClose",
|
|
16
|
+
componentId: "sc-d6lrpn-0"
|
|
17
|
+
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:", ";border:0;background:transparent;cursor:pointer;padding:0;color:inherit;font-size:0;appearance:none;&:hover{opacity:", ";}&:focus{outline:none;}&:active{opacity:", ";}", ";"], props => props.theme.opacity[1000], props => props.theme.opacity[1100], props => props.theme.opacity[1200], props => retrieveComponentStyles(COMPONENT_ID, props));
|
|
18
|
+
StyledClose.defaultProps = {
|
|
19
|
+
theme: DEFAULT_THEME
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { StyledClose };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled, { css } from 'styled-components';
|
|
8
|
+
import { readableColor, math } from 'polished';
|
|
9
|
+
import { SELECTOR_FOCUS_VISIBLE, retrieveComponentStyles, DEFAULT_THEME, getColor, focusStyles, getLineHeight } from '@zendeskgarden/react-theming';
|
|
10
|
+
import { StyledAvatar } from './StyledAvatar.js';
|
|
11
|
+
import { StyledClose } from './StyledClose.js';
|
|
12
|
+
|
|
13
|
+
const COMPONENT_ID = 'tags.tag_view';
|
|
14
|
+
const colorStyles = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
theme,
|
|
17
|
+
hue
|
|
18
|
+
} = _ref;
|
|
19
|
+
let backgroundColor;
|
|
20
|
+
let foregroundColor;
|
|
21
|
+
if (hue) {
|
|
22
|
+
foregroundColor = getColor({
|
|
23
|
+
theme,
|
|
24
|
+
variable: 'foreground.onEmphasis'
|
|
25
|
+
});
|
|
26
|
+
switch (hue) {
|
|
27
|
+
case 'grey':
|
|
28
|
+
case 'neutralHue':
|
|
29
|
+
backgroundColor = getColor({
|
|
30
|
+
theme,
|
|
31
|
+
variable: 'background.emphasis',
|
|
32
|
+
dark: {
|
|
33
|
+
offset: -300
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
case 'blue':
|
|
38
|
+
case 'primaryHue':
|
|
39
|
+
backgroundColor = getColor({
|
|
40
|
+
theme,
|
|
41
|
+
variable: 'background.primaryEmphasis'
|
|
42
|
+
});
|
|
43
|
+
break;
|
|
44
|
+
case 'red':
|
|
45
|
+
case 'dangerHue':
|
|
46
|
+
backgroundColor = getColor({
|
|
47
|
+
theme,
|
|
48
|
+
variable: 'background.dangerEmphasis'
|
|
49
|
+
});
|
|
50
|
+
break;
|
|
51
|
+
case 'green':
|
|
52
|
+
case 'successHue':
|
|
53
|
+
backgroundColor = getColor({
|
|
54
|
+
theme,
|
|
55
|
+
variable: 'background.successEmphasis'
|
|
56
|
+
});
|
|
57
|
+
break;
|
|
58
|
+
case 'yellow':
|
|
59
|
+
case 'warningHue':
|
|
60
|
+
backgroundColor = getColor({
|
|
61
|
+
theme,
|
|
62
|
+
hue: 'warningHue',
|
|
63
|
+
shade: 400
|
|
64
|
+
});
|
|
65
|
+
if (theme.colors.base === 'light') {
|
|
66
|
+
foregroundColor = getColor({
|
|
67
|
+
theme,
|
|
68
|
+
variable: 'foreground.warningEmphasis'
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
case 'kale':
|
|
73
|
+
case 'chromeHue':
|
|
74
|
+
backgroundColor = getColor({
|
|
75
|
+
theme,
|
|
76
|
+
hue: 'chromeHue',
|
|
77
|
+
dark: {
|
|
78
|
+
shade: 500
|
|
79
|
+
},
|
|
80
|
+
light: {
|
|
81
|
+
shade: 800
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
{
|
|
87
|
+
const lightTheme = {
|
|
88
|
+
...theme,
|
|
89
|
+
colors: {
|
|
90
|
+
...theme.colors,
|
|
91
|
+
base: 'light'
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const darkTheme = {
|
|
95
|
+
...theme,
|
|
96
|
+
colors: {
|
|
97
|
+
...theme.colors,
|
|
98
|
+
base: 'dark'
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const variable = 'foreground.onEmphasis';
|
|
102
|
+
backgroundColor = getColor({
|
|
103
|
+
theme,
|
|
104
|
+
hue
|
|
105
|
+
});
|
|
106
|
+
foregroundColor = readableColor(backgroundColor, getColor({
|
|
107
|
+
theme: darkTheme,
|
|
108
|
+
variable
|
|
109
|
+
}), getColor({
|
|
110
|
+
theme: lightTheme,
|
|
111
|
+
variable
|
|
112
|
+
}), false );
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
backgroundColor = getColor({
|
|
118
|
+
theme,
|
|
119
|
+
hue: 'neutralHue',
|
|
120
|
+
dark: {
|
|
121
|
+
shade: 800
|
|
122
|
+
},
|
|
123
|
+
light: {
|
|
124
|
+
shade: 200
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
foregroundColor = getColor({
|
|
128
|
+
theme,
|
|
129
|
+
variable: 'foreground.default'
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return css(["background-color:", ";color:", ";&:hover{color:", ";}", ""], backgroundColor, foregroundColor, foregroundColor, focusStyles({
|
|
133
|
+
theme,
|
|
134
|
+
shadowWidth: 'sm',
|
|
135
|
+
selector: '&:focus'
|
|
136
|
+
}));
|
|
137
|
+
};
|
|
138
|
+
const sizeStyles = props => {
|
|
139
|
+
let borderRadius;
|
|
140
|
+
let padding;
|
|
141
|
+
let height;
|
|
142
|
+
let fontSize;
|
|
143
|
+
let minWidth;
|
|
144
|
+
let avatarSize;
|
|
145
|
+
if (props.size === 'small') {
|
|
146
|
+
borderRadius = props.theme.borderRadii.sm;
|
|
147
|
+
padding = props.theme.space.base;
|
|
148
|
+
height = props.theme.space.base * 4;
|
|
149
|
+
fontSize = props.theme.fontSizes.xs;
|
|
150
|
+
avatarSize = 0;
|
|
151
|
+
} else if (props.size === 'large') {
|
|
152
|
+
borderRadius = props.theme.borderRadii.md;
|
|
153
|
+
padding = props.theme.space.base * 3;
|
|
154
|
+
height = props.theme.space.base * 8;
|
|
155
|
+
fontSize = props.theme.fontSizes.sm;
|
|
156
|
+
avatarSize = props.theme.space.base * 6;
|
|
157
|
+
} else {
|
|
158
|
+
borderRadius = props.theme.borderRadii.sm;
|
|
159
|
+
padding = props.theme.space.base * 2;
|
|
160
|
+
height = props.theme.space.base * 5;
|
|
161
|
+
fontSize = props.theme.fontSizes.sm;
|
|
162
|
+
avatarSize = props.theme.space.base * 4;
|
|
163
|
+
}
|
|
164
|
+
let avatarBorderRadius = props.size === 'large' ? math(`${borderRadius} - 1`) : borderRadius;
|
|
165
|
+
const avatarMargin = (height - avatarSize) / 2;
|
|
166
|
+
const avatarTextMargin = props.isRound ? avatarMargin : avatarMargin * 2;
|
|
167
|
+
if (props.isRound) {
|
|
168
|
+
borderRadius = '50%';
|
|
169
|
+
padding = 0;
|
|
170
|
+
minWidth = height;
|
|
171
|
+
avatarBorderRadius = '50%';
|
|
172
|
+
} else if (props.isPill) {
|
|
173
|
+
borderRadius = '100px';
|
|
174
|
+
avatarBorderRadius = '50%';
|
|
175
|
+
if (props.size === 'small') {
|
|
176
|
+
padding = props.theme.space.base * 1.5;
|
|
177
|
+
minWidth = props.theme.space.base * 6;
|
|
178
|
+
} else if (props.size === 'large') {
|
|
179
|
+
minWidth = props.theme.space.base * 12;
|
|
180
|
+
} else {
|
|
181
|
+
minWidth = props.theme.space.base * 7.5;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
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);
|
|
185
|
+
};
|
|
186
|
+
const StyledTag = styled.div.attrs({
|
|
187
|
+
'data-garden-id': COMPONENT_ID,
|
|
188
|
+
'data-garden-version': '9.0.0-next.20'
|
|
189
|
+
}).withConfig({
|
|
190
|
+
displayName: "StyledTag",
|
|
191
|
+
componentId: "sc-1jvbe03-0"
|
|
192
|
+
})(["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;}&:link:hover,&:visited:hover{cursor:pointer;}&:any-link:hover{cursor:pointer;}", "{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), SELECTOR_FOCUS_VISIBLE, 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));
|
|
193
|
+
StyledTag.defaultProps = {
|
|
194
|
+
size: 'medium',
|
|
195
|
+
theme: DEFAULT_THEME
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export { StyledTag };
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
8
7
|
'use strict';
|
|
9
8
|
|
|
10
9
|
var React = require('react');
|
|
@@ -37,33 +36,12 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
37
36
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
38
37
|
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
39
38
|
|
|
40
|
-
function _extends$1() {
|
|
41
|
-
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
42
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
43
|
-
var source = arguments[i];
|
|
44
|
-
for (var key in source) {
|
|
45
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
46
|
-
target[key] = source[key];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return target;
|
|
51
|
-
};
|
|
52
|
-
return _extends$1.apply(this, arguments);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
39
|
const SIZE = ['small', 'medium', 'large'];
|
|
56
40
|
|
|
57
41
|
const COMPONENT_ID$2 = 'tags.avatar';
|
|
58
|
-
const StyledAvatar = styled__default.default(
|
|
59
|
-
let {
|
|
60
|
-
children,
|
|
61
|
-
...props
|
|
62
|
-
} = _ref;
|
|
63
|
-
return React__namespace.default.cloneElement(React.Children.only(children), props);
|
|
64
|
-
}).attrs({
|
|
42
|
+
const StyledAvatar = styled__default.default(reactTheming.StyledBaseIcon).attrs({
|
|
65
43
|
'data-garden-id': COMPONENT_ID$2,
|
|
66
|
-
'data-garden-version': '9.0.0-next.
|
|
44
|
+
'data-garden-version': '9.0.0-next.20'
|
|
67
45
|
}).withConfig({
|
|
68
46
|
displayName: "StyledAvatar",
|
|
69
47
|
componentId: "sc-3kdmgt-0"
|
|
@@ -75,38 +53,139 @@ StyledAvatar.defaultProps = {
|
|
|
75
53
|
const COMPONENT_ID$1 = 'tags.close';
|
|
76
54
|
const StyledClose = styled__default.default.button.attrs({
|
|
77
55
|
'data-garden-id': COMPONENT_ID$1,
|
|
78
|
-
'data-garden-version': '9.0.0-next.
|
|
56
|
+
'data-garden-version': '9.0.0-next.20'
|
|
79
57
|
}).withConfig({
|
|
80
58
|
displayName: "StyledClose",
|
|
81
59
|
componentId: "sc-d6lrpn-0"
|
|
82
|
-
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:
|
|
60
|
+
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:", ";border:0;background:transparent;cursor:pointer;padding:0;color:inherit;font-size:0;appearance:none;&:hover{opacity:", ";}&:focus{outline:none;}&:active{opacity:", ";}", ";"], props => props.theme.opacity[1000], props => props.theme.opacity[1100], props => props.theme.opacity[1200], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
83
61
|
StyledClose.defaultProps = {
|
|
84
62
|
theme: reactTheming.DEFAULT_THEME
|
|
85
63
|
};
|
|
86
64
|
|
|
87
65
|
const COMPONENT_ID = 'tags.tag_view';
|
|
88
|
-
const colorStyles =
|
|
66
|
+
const colorStyles = _ref => {
|
|
67
|
+
let {
|
|
68
|
+
theme,
|
|
69
|
+
hue
|
|
70
|
+
} = _ref;
|
|
89
71
|
let backgroundColor;
|
|
90
72
|
let foregroundColor;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
73
|
+
if (hue) {
|
|
74
|
+
foregroundColor = reactTheming.getColor({
|
|
75
|
+
theme,
|
|
76
|
+
variable: 'foreground.onEmphasis'
|
|
77
|
+
});
|
|
78
|
+
switch (hue) {
|
|
79
|
+
case 'grey':
|
|
80
|
+
case 'neutralHue':
|
|
81
|
+
backgroundColor = reactTheming.getColor({
|
|
82
|
+
theme,
|
|
83
|
+
variable: 'background.emphasis',
|
|
84
|
+
dark: {
|
|
85
|
+
offset: -300
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
break;
|
|
89
|
+
case 'blue':
|
|
90
|
+
case 'primaryHue':
|
|
91
|
+
backgroundColor = reactTheming.getColor({
|
|
92
|
+
theme,
|
|
93
|
+
variable: 'background.primaryEmphasis'
|
|
94
|
+
});
|
|
95
|
+
break;
|
|
96
|
+
case 'red':
|
|
97
|
+
case 'dangerHue':
|
|
98
|
+
backgroundColor = reactTheming.getColor({
|
|
99
|
+
theme,
|
|
100
|
+
variable: 'background.dangerEmphasis'
|
|
101
|
+
});
|
|
102
|
+
break;
|
|
103
|
+
case 'green':
|
|
104
|
+
case 'successHue':
|
|
105
|
+
backgroundColor = reactTheming.getColor({
|
|
106
|
+
theme,
|
|
107
|
+
variable: 'background.successEmphasis'
|
|
108
|
+
});
|
|
109
|
+
break;
|
|
110
|
+
case 'yellow':
|
|
111
|
+
case 'warningHue':
|
|
112
|
+
backgroundColor = reactTheming.getColor({
|
|
113
|
+
theme,
|
|
114
|
+
hue: 'warningHue',
|
|
115
|
+
shade: 400
|
|
116
|
+
});
|
|
117
|
+
if (theme.colors.base === 'light') {
|
|
118
|
+
foregroundColor = reactTheming.getColor({
|
|
119
|
+
theme,
|
|
120
|
+
variable: 'foreground.warningEmphasis'
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
case 'kale':
|
|
125
|
+
case 'chromeHue':
|
|
126
|
+
backgroundColor = reactTheming.getColor({
|
|
127
|
+
theme,
|
|
128
|
+
hue: 'chromeHue',
|
|
129
|
+
dark: {
|
|
130
|
+
shade: 500
|
|
131
|
+
},
|
|
132
|
+
light: {
|
|
133
|
+
shade: 800
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
break;
|
|
137
|
+
default:
|
|
138
|
+
{
|
|
139
|
+
const lightTheme = {
|
|
140
|
+
...theme,
|
|
141
|
+
colors: {
|
|
142
|
+
...theme.colors,
|
|
143
|
+
base: 'light'
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const darkTheme = {
|
|
147
|
+
...theme,
|
|
148
|
+
colors: {
|
|
149
|
+
...theme.colors,
|
|
150
|
+
base: 'dark'
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const variable = 'foreground.onEmphasis';
|
|
154
|
+
backgroundColor = reactTheming.getColor({
|
|
155
|
+
theme,
|
|
156
|
+
hue
|
|
157
|
+
});
|
|
158
|
+
foregroundColor = polished.readableColor(backgroundColor, reactTheming.getColor({
|
|
159
|
+
theme: darkTheme,
|
|
160
|
+
variable
|
|
161
|
+
}), reactTheming.getColor({
|
|
162
|
+
theme: lightTheme,
|
|
163
|
+
variable
|
|
164
|
+
}), false );
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
99
167
|
}
|
|
100
168
|
} else {
|
|
101
|
-
backgroundColor = reactTheming.getColor(
|
|
102
|
-
|
|
103
|
-
|
|
169
|
+
backgroundColor = reactTheming.getColor({
|
|
170
|
+
theme,
|
|
171
|
+
hue: 'neutralHue',
|
|
172
|
+
dark: {
|
|
173
|
+
shade: 800
|
|
174
|
+
},
|
|
175
|
+
light: {
|
|
176
|
+
shade: 200
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
foregroundColor = reactTheming.getColor({
|
|
180
|
+
theme,
|
|
181
|
+
variable: 'foreground.default'
|
|
182
|
+
});
|
|
104
183
|
}
|
|
105
|
-
return styled.css(["background-color:", ";color:", ";&:hover{color:", ";}", "
|
|
106
|
-
theme
|
|
184
|
+
return styled.css(["background-color:", ";color:", ";&:hover{color:", ";}", ""], backgroundColor, foregroundColor, foregroundColor, reactTheming.focusStyles({
|
|
185
|
+
theme,
|
|
107
186
|
shadowWidth: 'sm',
|
|
108
187
|
selector: '&:focus'
|
|
109
|
-
})
|
|
188
|
+
}));
|
|
110
189
|
};
|
|
111
190
|
const sizeStyles = props => {
|
|
112
191
|
let borderRadius;
|
|
@@ -158,7 +237,7 @@ const sizeStyles = props => {
|
|
|
158
237
|
};
|
|
159
238
|
const StyledTag = styled__default.default.div.attrs({
|
|
160
239
|
'data-garden-id': COMPONENT_ID,
|
|
161
|
-
'data-garden-version': '9.0.0-next.
|
|
240
|
+
'data-garden-version': '9.0.0-next.20'
|
|
162
241
|
}).withConfig({
|
|
163
242
|
displayName: "StyledTag",
|
|
164
243
|
componentId: "sc-1jvbe03-0"
|
|
@@ -169,7 +248,7 @@ StyledTag.defaultProps = {
|
|
|
169
248
|
};
|
|
170
249
|
|
|
171
250
|
var _path;
|
|
172
|
-
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (
|
|
251
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
173
252
|
var SvgXStroke = function SvgXStroke(props) {
|
|
174
253
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
175
254
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -187,7 +266,7 @@ var SvgXStroke = function SvgXStroke(props) {
|
|
|
187
266
|
|
|
188
267
|
const CloseComponent = React.forwardRef((props, ref) => {
|
|
189
268
|
const ariaLabel = reactTheming.useText(CloseComponent, props, 'aria-label', 'Remove');
|
|
190
|
-
return React__namespace.default.createElement(StyledClose,
|
|
269
|
+
return React__namespace.default.createElement(StyledClose, Object.assign({
|
|
191
270
|
ref: ref,
|
|
192
271
|
"aria-label": ariaLabel
|
|
193
272
|
}, props, {
|
|
@@ -208,7 +287,7 @@ const TagComponent = React.forwardRef((_ref, ref) => {
|
|
|
208
287
|
hue,
|
|
209
288
|
...otherProps
|
|
210
289
|
} = _ref;
|
|
211
|
-
return React__namespace.default.createElement(StyledTag,
|
|
290
|
+
return React__namespace.default.createElement(StyledTag, Object.assign({
|
|
212
291
|
ref: ref,
|
|
213
292
|
size: size,
|
|
214
293
|
hue: hue
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
5
|
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
export declare const StyledAvatar: import("styled-components").StyledComponent<({ children, ...props }: any) =>
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
export declare const StyledAvatar: import("styled-components").StyledComponent<({ children, theme, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>, import("styled-components").DefaultTheme, {
|
|
9
9
|
'data-garden-id': string;
|
|
10
10
|
'data-garden-version': string;
|
|
11
11
|
}, "data-garden-id" | "data-garden-version">;
|
|
@@ -11,7 +11,8 @@ export interface ITagProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
size?: (typeof SIZE)[number];
|
|
12
12
|
/**
|
|
13
13
|
* Sets the color of the tag. Refer to
|
|
14
|
-
* [
|
|
14
|
+
* theming [colors](components/theme-object#colors)
|
|
15
|
+
* or [PALETTE](/components/palette#palette)
|
|
15
16
|
* for available colors. Accepts any hex value.
|
|
16
17
|
*/
|
|
17
18
|
hue?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-tags",
|
|
3
|
-
"version": "9.0.0-next.
|
|
3
|
+
"version": "9.0.0-next.20",
|
|
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>",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/zendeskgarden/react-components/issues"
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/index.cjs.js",
|
|
13
|
-
"module": "dist/index.
|
|
13
|
+
"module": "dist/esm/index.js",
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"types": "dist/typings/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@zendeskgarden/container-utilities": "^2.0.0",
|
|
25
|
-
"polished": "^4.
|
|
25
|
+
"polished": "^4.3.1",
|
|
26
26
|
"prop-types": "^15.5.7"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@zendeskgarden/react-theming": "
|
|
29
|
+
"@zendeskgarden/react-theming": ">=9.0.0-next",
|
|
30
30
|
"react": ">=16.8.0",
|
|
31
31
|
"react-dom": ">=16.8.0",
|
|
32
|
-
"styled-components": "^5.1
|
|
32
|
+
"styled-components": "^5.3.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@zendeskgarden/react-theming": "^9.0.0-next.
|
|
36
|
-
"@zendeskgarden/svg-icons": "7.
|
|
35
|
+
"@zendeskgarden/react-theming": "^9.0.0-next.20",
|
|
36
|
+
"@zendeskgarden/svg-icons": "7.1.1"
|
|
37
37
|
},
|
|
38
38
|
"keywords": [
|
|
39
39
|
"components",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"zendeskgarden:src": "src/index.ts",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "eab087ac0d6e74b3a4489d37d067baf7a225e7a8"
|
|
49
49
|
}
|
package/dist/index.esm.js
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright Zendesk, Inc.
|
|
3
|
-
*
|
|
4
|
-
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
-
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as React from 'react';
|
|
9
|
-
import React__default, { Children, forwardRef } from 'react';
|
|
10
|
-
import PropTypes from 'prop-types';
|
|
11
|
-
import styled, { css } from 'styled-components';
|
|
12
|
-
import { readableColor, math } from 'polished';
|
|
13
|
-
import { retrieveComponentStyles, DEFAULT_THEME, SELECTOR_FOCUS_VISIBLE, getColor, focusStyles, getLineHeight, useText } from '@zendeskgarden/react-theming';
|
|
14
|
-
|
|
15
|
-
function _extends$1() {
|
|
16
|
-
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
17
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
18
|
-
var source = arguments[i];
|
|
19
|
-
for (var key in source) {
|
|
20
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
21
|
-
target[key] = source[key];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return target;
|
|
26
|
-
};
|
|
27
|
-
return _extends$1.apply(this, arguments);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const SIZE = ['small', 'medium', 'large'];
|
|
31
|
-
|
|
32
|
-
const COMPONENT_ID$2 = 'tags.avatar';
|
|
33
|
-
const StyledAvatar = styled(_ref => {
|
|
34
|
-
let {
|
|
35
|
-
children,
|
|
36
|
-
...props
|
|
37
|
-
} = _ref;
|
|
38
|
-
return React__default.cloneElement(Children.only(children), props);
|
|
39
|
-
}).attrs({
|
|
40
|
-
'data-garden-id': COMPONENT_ID$2,
|
|
41
|
-
'data-garden-version': '9.0.0-next.2'
|
|
42
|
-
}).withConfig({
|
|
43
|
-
displayName: "StyledAvatar",
|
|
44
|
-
componentId: "sc-3kdmgt-0"
|
|
45
|
-
})(["flex-shrink:0;font-size:0;", ";"], props => retrieveComponentStyles(COMPONENT_ID$2, props));
|
|
46
|
-
StyledAvatar.defaultProps = {
|
|
47
|
-
theme: DEFAULT_THEME
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const COMPONENT_ID$1 = 'tags.close';
|
|
51
|
-
const StyledClose = styled.button.attrs({
|
|
52
|
-
'data-garden-id': COMPONENT_ID$1,
|
|
53
|
-
'data-garden-version': '9.0.0-next.2'
|
|
54
|
-
}).withConfig({
|
|
55
|
-
displayName: "StyledClose",
|
|
56
|
-
componentId: "sc-d6lrpn-0"
|
|
57
|
-
})(["display:flex;flex-shrink:0;align-items:center;justify-content:center;transition:opacity 0.25s ease-in-out;opacity:0.8;border:0;background:transparent;cursor:pointer;padding:0;color:inherit;font-size:0;appearance:none;&:hover{opacity:0.9;}&:focus{outline:none;}", ";"], props => retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
58
|
-
StyledClose.defaultProps = {
|
|
59
|
-
theme: DEFAULT_THEME
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const COMPONENT_ID = 'tags.tag_view';
|
|
63
|
-
const colorStyles = props => {
|
|
64
|
-
let backgroundColor;
|
|
65
|
-
let foregroundColor;
|
|
66
|
-
let closeColor;
|
|
67
|
-
if (props.hue) {
|
|
68
|
-
const shade = props.hue === 'yellow' ? 400 : 600;
|
|
69
|
-
backgroundColor = getColor(props.hue, shade, props.theme);
|
|
70
|
-
if (props.hue === 'yellow' || props.hue === 'lemon') {
|
|
71
|
-
foregroundColor = getColor('yellow', 800, props.theme);
|
|
72
|
-
} else {
|
|
73
|
-
foregroundColor = readableColor(backgroundColor, props.theme.palette.grey[800], props.theme.palette.white);
|
|
74
|
-
}
|
|
75
|
-
} else {
|
|
76
|
-
backgroundColor = getColor('neutralHue', 200, props.theme);
|
|
77
|
-
foregroundColor = getColor('neutralHue', 700, props.theme);
|
|
78
|
-
closeColor = getColor('neutralHue', 600, props.theme);
|
|
79
|
-
}
|
|
80
|
-
return css(["background-color:", ";color:", ";&:hover{color:", ";}", " & ", "{color:", ";}"], backgroundColor, foregroundColor, foregroundColor, focusStyles({
|
|
81
|
-
theme: props.theme,
|
|
82
|
-
shadowWidth: 'sm',
|
|
83
|
-
selector: '&:focus'
|
|
84
|
-
}), StyledClose, closeColor);
|
|
85
|
-
};
|
|
86
|
-
const sizeStyles = props => {
|
|
87
|
-
let borderRadius;
|
|
88
|
-
let padding;
|
|
89
|
-
let height;
|
|
90
|
-
let fontSize;
|
|
91
|
-
let minWidth;
|
|
92
|
-
let avatarSize;
|
|
93
|
-
if (props.size === 'small') {
|
|
94
|
-
borderRadius = props.theme.borderRadii.sm;
|
|
95
|
-
padding = props.theme.space.base;
|
|
96
|
-
height = props.theme.space.base * 4;
|
|
97
|
-
fontSize = props.theme.fontSizes.xs;
|
|
98
|
-
avatarSize = 0;
|
|
99
|
-
} else if (props.size === 'large') {
|
|
100
|
-
borderRadius = props.theme.borderRadii.md;
|
|
101
|
-
padding = props.theme.space.base * 3;
|
|
102
|
-
height = props.theme.space.base * 8;
|
|
103
|
-
fontSize = props.theme.fontSizes.sm;
|
|
104
|
-
avatarSize = props.theme.space.base * 6;
|
|
105
|
-
} else {
|
|
106
|
-
borderRadius = props.theme.borderRadii.sm;
|
|
107
|
-
padding = props.theme.space.base * 2;
|
|
108
|
-
height = props.theme.space.base * 5;
|
|
109
|
-
fontSize = props.theme.fontSizes.sm;
|
|
110
|
-
avatarSize = props.theme.space.base * 4;
|
|
111
|
-
}
|
|
112
|
-
let avatarBorderRadius = props.size === 'large' ? math(`${borderRadius} - 1`) : borderRadius;
|
|
113
|
-
const avatarMargin = (height - avatarSize) / 2;
|
|
114
|
-
const avatarTextMargin = props.isRound ? avatarMargin : avatarMargin * 2;
|
|
115
|
-
if (props.isRound) {
|
|
116
|
-
borderRadius = '50%';
|
|
117
|
-
padding = 0;
|
|
118
|
-
minWidth = height;
|
|
119
|
-
avatarBorderRadius = '50%';
|
|
120
|
-
} else if (props.isPill) {
|
|
121
|
-
borderRadius = '100px';
|
|
122
|
-
avatarBorderRadius = '50%';
|
|
123
|
-
if (props.size === 'small') {
|
|
124
|
-
padding = props.theme.space.base * 1.5;
|
|
125
|
-
minWidth = props.theme.space.base * 6;
|
|
126
|
-
} else if (props.size === 'large') {
|
|
127
|
-
minWidth = props.theme.space.base * 12;
|
|
128
|
-
} else {
|
|
129
|
-
minWidth = props.theme.space.base * 7.5;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
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);
|
|
133
|
-
};
|
|
134
|
-
const StyledTag = styled.div.attrs({
|
|
135
|
-
'data-garden-id': COMPONENT_ID,
|
|
136
|
-
'data-garden-version': '9.0.0-next.2'
|
|
137
|
-
}).withConfig({
|
|
138
|
-
displayName: "StyledTag",
|
|
139
|
-
componentId: "sc-1jvbe03-0"
|
|
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;}&:link:hover,&:visited:hover{cursor:pointer;}&:any-link:hover{cursor:pointer;}", "{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), SELECTOR_FOCUS_VISIBLE, 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));
|
|
141
|
-
StyledTag.defaultProps = {
|
|
142
|
-
size: 'medium',
|
|
143
|
-
theme: DEFAULT_THEME
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
var _path;
|
|
147
|
-
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); }
|
|
148
|
-
var SvgXStroke = function SvgXStroke(props) {
|
|
149
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
150
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
151
|
-
width: 12,
|
|
152
|
-
height: 12,
|
|
153
|
-
focusable: "false",
|
|
154
|
-
viewBox: "0 0 12 12",
|
|
155
|
-
"aria-hidden": "true"
|
|
156
|
-
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
157
|
-
stroke: "currentColor",
|
|
158
|
-
strokeLinecap: "round",
|
|
159
|
-
d: "M3 9l6-6m0 6L3 3"
|
|
160
|
-
})));
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
const CloseComponent = forwardRef((props, ref) => {
|
|
164
|
-
const ariaLabel = useText(CloseComponent, props, 'aria-label', 'Remove');
|
|
165
|
-
return React__default.createElement(StyledClose, _extends$1({
|
|
166
|
-
ref: ref,
|
|
167
|
-
"aria-label": ariaLabel
|
|
168
|
-
}, props, {
|
|
169
|
-
type: "button",
|
|
170
|
-
tabIndex: -1
|
|
171
|
-
}), React__default.createElement(SvgXStroke, null));
|
|
172
|
-
});
|
|
173
|
-
CloseComponent.displayName = 'Tag.Close';
|
|
174
|
-
const Close = CloseComponent;
|
|
175
|
-
|
|
176
|
-
const AvatarComponent = props => React__default.createElement(StyledAvatar, props);
|
|
177
|
-
AvatarComponent.displayName = 'Tag.Avatar';
|
|
178
|
-
const Avatar = AvatarComponent;
|
|
179
|
-
|
|
180
|
-
const TagComponent = forwardRef((_ref, ref) => {
|
|
181
|
-
let {
|
|
182
|
-
size,
|
|
183
|
-
hue,
|
|
184
|
-
...otherProps
|
|
185
|
-
} = _ref;
|
|
186
|
-
return React__default.createElement(StyledTag, _extends$1({
|
|
187
|
-
ref: ref,
|
|
188
|
-
size: size,
|
|
189
|
-
hue: hue
|
|
190
|
-
}, otherProps));
|
|
191
|
-
});
|
|
192
|
-
TagComponent.displayName = 'Tag';
|
|
193
|
-
TagComponent.propTypes = {
|
|
194
|
-
size: PropTypes.oneOf(SIZE),
|
|
195
|
-
hue: PropTypes.string,
|
|
196
|
-
isPill: PropTypes.bool,
|
|
197
|
-
isRound: PropTypes.bool,
|
|
198
|
-
isRegular: PropTypes.bool
|
|
199
|
-
};
|
|
200
|
-
TagComponent.defaultProps = {
|
|
201
|
-
size: 'medium'
|
|
202
|
-
};
|
|
203
|
-
const Tag = TagComponent;
|
|
204
|
-
Tag.Avatar = Avatar;
|
|
205
|
-
Tag.Close = Close;
|
|
206
|
-
|
|
207
|
-
export { Tag };
|