@instructure/ui-tag 11.7.4-snapshot-144 → 11.7.4
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/CHANGELOG.md +5 -1
- package/es/Tag/v2/index.js +2 -11
- package/es/Tag/v2/props.js +1 -1
- package/es/Tag/v2/styles.js +13 -64
- package/lib/Tag/v2/index.js +2 -11
- package/lib/Tag/v2/props.js +1 -1
- package/lib/Tag/v2/styles.js +13 -64
- package/package.json +12 -12
- package/src/Tag/v2/README.md +0 -23
- package/src/Tag/v2/index.tsx +2 -11
- package/src/Tag/v2/props.ts +1 -3
- package/src/Tag/v2/styles.ts +12 -65
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Tag/v2/index.d.ts +0 -2
- package/types/Tag/v2/index.d.ts.map +1 -1
- package/types/Tag/v2/props.d.ts +0 -1
- package/types/Tag/v2/props.d.ts.map +1 -1
- package/types/Tag/v2/styles.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,17 +3,21 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [11.7.4
|
|
6
|
+
## [11.7.4](https://github.com/instructure/instructure-ui/compare/v11.7.3...v11.7.4) (2026-07-24)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
### Features
|
|
10
10
|
|
|
11
11
|
* **many:** remove deprecated v2 items ([eaf8876](https://github.com/instructure/instructure-ui/commit/eaf88767c9beb95c4e09ee5705c387dfd79e4cb7))
|
|
12
12
|
* **many:** support current spacing tokens in the margin prop for v2 components ([1b47c5f](https://github.com/instructure/instructure-ui/commit/1b47c5f23eaa60b532cdfd53c39bd71f0cf51aaa))
|
|
13
|
+
* **ui-tag:** remove the inline variant from Tag v2 ([255d84f](https://github.com/instructure/instructure-ui/commit/255d84f93a1b9200ea90a31092554cbc1b386a78))
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
### BREAKING CHANGES
|
|
16
17
|
|
|
18
|
+
* **ui-tag:** the inline variant and the variant prop have been removed from Tag v2.
|
|
19
|
+
|
|
20
|
+
Refs: INSTUI-5127
|
|
17
21
|
* **many:** Removed FormFieldLabel component
|
|
18
22
|
|
|
19
23
|
Removed _content prop from DrawerLayout.Tray and DrawerLayout.Content
|
package/es/Tag/v2/index.js
CHANGED
|
@@ -45,7 +45,6 @@ let Tag = (_dec = withStyleNew(generateStyle), _dec(_class = class Tag extends C
|
|
|
45
45
|
static defaultProps = {
|
|
46
46
|
size: 'medium',
|
|
47
47
|
dismissible: false,
|
|
48
|
-
variant: 'default',
|
|
49
48
|
disabled: false,
|
|
50
49
|
readOnly: false
|
|
51
50
|
};
|
|
@@ -96,12 +95,8 @@ let Tag = (_dec = withStyleNew(generateStyle), _dec(_class = class Tag extends C
|
|
|
96
95
|
};
|
|
97
96
|
getIconSize = () => {
|
|
98
97
|
const {
|
|
99
|
-
size
|
|
100
|
-
variant
|
|
98
|
+
size
|
|
101
99
|
} = this.props;
|
|
102
|
-
if (variant === 'inline') {
|
|
103
|
-
return 'xs';
|
|
104
|
-
}
|
|
105
100
|
const sizeMap = {
|
|
106
101
|
small: 'xs',
|
|
107
102
|
medium: 'sm',
|
|
@@ -118,17 +113,13 @@ let Tag = (_dec = withStyleNew(generateStyle), _dec(_class = class Tag extends C
|
|
|
118
113
|
text,
|
|
119
114
|
onClick,
|
|
120
115
|
margin,
|
|
121
|
-
styles
|
|
122
|
-
variant
|
|
116
|
+
styles
|
|
123
117
|
} = this.props;
|
|
124
118
|
const passthroughProps = View.omitViewProps(omitProps(this.props, Tag.allowedProps), Tag);
|
|
125
119
|
const getIconColor = () => {
|
|
126
120
|
if (disabled) {
|
|
127
121
|
return 'mutedColor';
|
|
128
122
|
}
|
|
129
|
-
if (variant === 'inline') {
|
|
130
|
-
return 'inverseColor';
|
|
131
|
-
}
|
|
132
123
|
return this.state.iconHovered ? 'actionSecondaryHoverColor' : 'baseColor';
|
|
133
124
|
};
|
|
134
125
|
return _jsxs(View, {
|
package/es/Tag/v2/props.js
CHANGED
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const allowedProps = ['className', 'text', 'disabled', 'readOnly', 'dismissible', 'margin', 'onClick', 'elementRef', 'size'
|
|
25
|
+
const allowedProps = ['className', 'text', 'disabled', 'readOnly', 'dismissible', 'margin', 'onClick', 'elementRef', 'size'];
|
|
26
26
|
export { allowedProps };
|
package/es/Tag/v2/styles.js
CHANGED
|
@@ -36,7 +36,6 @@ import { calcFocusOutlineStyles } from '@instructure/emotion';
|
|
|
36
36
|
*/
|
|
37
37
|
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
38
38
|
const {
|
|
39
|
-
variant,
|
|
40
39
|
size,
|
|
41
40
|
dismissible,
|
|
42
41
|
onClick,
|
|
@@ -112,65 +111,6 @@ const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
|
112
111
|
pointerEvents: 'none'
|
|
113
112
|
}
|
|
114
113
|
} : {};
|
|
115
|
-
const tagVariantVariants = {
|
|
116
|
-
default: {
|
|
117
|
-
tag: {
|
|
118
|
-
backgroundColor: componentTheme.defaultBackground,
|
|
119
|
-
border: `${componentTheme.defaultBorderWidth} ${componentTheme.defaultBorderStyle} ${componentTheme.defaultBorderColor}`,
|
|
120
|
-
borderRadius: componentTheme.defaultBorderRadius,
|
|
121
|
-
color: componentTheme.defaultColor,
|
|
122
|
-
...(isButton && {
|
|
123
|
-
'&:hover': {
|
|
124
|
-
backgroundColor: componentTheme.defaultBackgroundHover
|
|
125
|
-
}
|
|
126
|
-
})
|
|
127
|
-
},
|
|
128
|
-
tagBefore: {
|
|
129
|
-
...(isButton && {
|
|
130
|
-
borderRadius: componentTheme.defaultBorderRadius
|
|
131
|
-
})
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
inline: {
|
|
135
|
-
tag: {
|
|
136
|
-
backgroundColor: componentTheme.inlineBackground,
|
|
137
|
-
border: `${componentTheme.inlineBorderWidth} ${componentTheme.inlineBorderStyle} ${componentTheme.inlineBorderColor}`,
|
|
138
|
-
borderRadius: componentTheme.inlineBorderRadius,
|
|
139
|
-
color: componentTheme.inlineColor,
|
|
140
|
-
cursor: 'text',
|
|
141
|
-
margin: '0 0.1875rem 0.1875rem',
|
|
142
|
-
...(isButton && {
|
|
143
|
-
'&:hover': {
|
|
144
|
-
backgroundColor: componentTheme.inlineBackgroundHover
|
|
145
|
-
}
|
|
146
|
-
})
|
|
147
|
-
},
|
|
148
|
-
tagBefore: {
|
|
149
|
-
...(isButton && {
|
|
150
|
-
borderRadius: `calc(${componentTheme.inlineBorderRadius} * 1.5)`
|
|
151
|
-
})
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const inlineIconVariant = variant === 'inline' && dismissible ? {
|
|
156
|
-
backgroundColor: componentTheme.inlineIconColor,
|
|
157
|
-
borderRadius: '50%',
|
|
158
|
-
padding: '0.25rem',
|
|
159
|
-
position: 'absolute',
|
|
160
|
-
insetInlineEnd: 0,
|
|
161
|
-
insetInlineStart: 'auto',
|
|
162
|
-
top: 0,
|
|
163
|
-
transform: 'translate(40%, -40%)',
|
|
164
|
-
display: 'flex',
|
|
165
|
-
alignItems: 'center',
|
|
166
|
-
justifyContent: 'center',
|
|
167
|
-
'[class$="-tag"]:hover > &': {
|
|
168
|
-
backgroundColor: componentTheme.inlineIconHoverColor
|
|
169
|
-
},
|
|
170
|
-
'[dir="rtl"] &': {
|
|
171
|
-
transform: 'translate(-40%, -40%)'
|
|
172
|
-
}
|
|
173
|
-
} : {};
|
|
174
114
|
return {
|
|
175
115
|
tag: {
|
|
176
116
|
label: 'tag',
|
|
@@ -181,12 +121,22 @@ const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
|
181
121
|
textAlign: 'center',
|
|
182
122
|
verticalAlign: 'middle',
|
|
183
123
|
userSelect: 'none',
|
|
124
|
+
backgroundColor: componentTheme.defaultBackground,
|
|
125
|
+
border: `${componentTheme.defaultBorderWidth} ${componentTheme.defaultBorderStyle} ${componentTheme.defaultBorderColor}`,
|
|
126
|
+
borderRadius: componentTheme.defaultBorderRadius,
|
|
127
|
+
color: componentTheme.defaultColor,
|
|
128
|
+
...(isButton && {
|
|
129
|
+
'&:hover': {
|
|
130
|
+
backgroundColor: componentTheme.defaultBackgroundHover
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
184
133
|
...sizeVariants[size].tag,
|
|
185
134
|
...buttonVariant.tag,
|
|
186
|
-
...tagVariantVariants[variant].tag,
|
|
187
135
|
'&::before': {
|
|
188
136
|
...buttonVariant.tagBefore,
|
|
189
|
-
...
|
|
137
|
+
...(isButton && {
|
|
138
|
+
borderRadius: componentTheme.defaultBorderRadius
|
|
139
|
+
})
|
|
190
140
|
}
|
|
191
141
|
},
|
|
192
142
|
text: {
|
|
@@ -202,8 +152,7 @@ const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
|
202
152
|
marginInlineStart: componentTheme.iconMargin,
|
|
203
153
|
marginInlineEnd: 0,
|
|
204
154
|
transition: `all ${componentTheme.transitionTiming}`,
|
|
205
|
-
cursor: 'pointer'
|
|
206
|
-
...inlineIconVariant
|
|
155
|
+
cursor: 'pointer'
|
|
207
156
|
}
|
|
208
157
|
};
|
|
209
158
|
};
|
package/lib/Tag/v2/index.js
CHANGED
|
@@ -50,7 +50,6 @@ let Tag = exports.Tag = (_dec = (0, _emotion.withStyleNew)(_styles.default), _de
|
|
|
50
50
|
static defaultProps = {
|
|
51
51
|
size: 'medium',
|
|
52
52
|
dismissible: false,
|
|
53
|
-
variant: 'default',
|
|
54
53
|
disabled: false,
|
|
55
54
|
readOnly: false
|
|
56
55
|
};
|
|
@@ -101,12 +100,8 @@ let Tag = exports.Tag = (_dec = (0, _emotion.withStyleNew)(_styles.default), _de
|
|
|
101
100
|
};
|
|
102
101
|
getIconSize = () => {
|
|
103
102
|
const {
|
|
104
|
-
size
|
|
105
|
-
variant
|
|
103
|
+
size
|
|
106
104
|
} = this.props;
|
|
107
|
-
if (variant === 'inline') {
|
|
108
|
-
return 'xs';
|
|
109
|
-
}
|
|
110
105
|
const sizeMap = {
|
|
111
106
|
small: 'xs',
|
|
112
107
|
medium: 'sm',
|
|
@@ -123,17 +118,13 @@ let Tag = exports.Tag = (_dec = (0, _emotion.withStyleNew)(_styles.default), _de
|
|
|
123
118
|
text,
|
|
124
119
|
onClick,
|
|
125
120
|
margin,
|
|
126
|
-
styles
|
|
127
|
-
variant
|
|
121
|
+
styles
|
|
128
122
|
} = this.props;
|
|
129
123
|
const passthroughProps = _latest.View.omitViewProps((0, _omitProps.omitProps)(this.props, Tag.allowedProps), Tag);
|
|
130
124
|
const getIconColor = () => {
|
|
131
125
|
if (disabled) {
|
|
132
126
|
return 'mutedColor';
|
|
133
127
|
}
|
|
134
|
-
if (variant === 'inline') {
|
|
135
|
-
return 'inverseColor';
|
|
136
|
-
}
|
|
137
128
|
return this.state.iconHovered ? 'actionSecondaryHoverColor' : 'baseColor';
|
|
138
129
|
};
|
|
139
130
|
return (0, _jsxRuntime.jsxs)(_latest.View, {
|
package/lib/Tag/v2/props.js
CHANGED
|
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
|
|
|
28
28
|
* SOFTWARE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
const allowedProps = exports.allowedProps = ['className', 'text', 'disabled', 'readOnly', 'dismissible', 'margin', 'onClick', 'elementRef', 'size'
|
|
31
|
+
const allowedProps = exports.allowedProps = ['className', 'text', 'disabled', 'readOnly', 'dismissible', 'margin', 'onClick', 'elementRef', 'size'];
|
package/lib/Tag/v2/styles.js
CHANGED
|
@@ -41,7 +41,6 @@ var _emotion = require("@instructure/emotion");
|
|
|
41
41
|
*/
|
|
42
42
|
const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
43
43
|
const {
|
|
44
|
-
variant,
|
|
45
44
|
size,
|
|
46
45
|
dismissible,
|
|
47
46
|
onClick,
|
|
@@ -117,65 +116,6 @@ const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
|
117
116
|
pointerEvents: 'none'
|
|
118
117
|
}
|
|
119
118
|
} : {};
|
|
120
|
-
const tagVariantVariants = {
|
|
121
|
-
default: {
|
|
122
|
-
tag: {
|
|
123
|
-
backgroundColor: componentTheme.defaultBackground,
|
|
124
|
-
border: `${componentTheme.defaultBorderWidth} ${componentTheme.defaultBorderStyle} ${componentTheme.defaultBorderColor}`,
|
|
125
|
-
borderRadius: componentTheme.defaultBorderRadius,
|
|
126
|
-
color: componentTheme.defaultColor,
|
|
127
|
-
...(isButton && {
|
|
128
|
-
'&:hover': {
|
|
129
|
-
backgroundColor: componentTheme.defaultBackgroundHover
|
|
130
|
-
}
|
|
131
|
-
})
|
|
132
|
-
},
|
|
133
|
-
tagBefore: {
|
|
134
|
-
...(isButton && {
|
|
135
|
-
borderRadius: componentTheme.defaultBorderRadius
|
|
136
|
-
})
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
inline: {
|
|
140
|
-
tag: {
|
|
141
|
-
backgroundColor: componentTheme.inlineBackground,
|
|
142
|
-
border: `${componentTheme.inlineBorderWidth} ${componentTheme.inlineBorderStyle} ${componentTheme.inlineBorderColor}`,
|
|
143
|
-
borderRadius: componentTheme.inlineBorderRadius,
|
|
144
|
-
color: componentTheme.inlineColor,
|
|
145
|
-
cursor: 'text',
|
|
146
|
-
margin: '0 0.1875rem 0.1875rem',
|
|
147
|
-
...(isButton && {
|
|
148
|
-
'&:hover': {
|
|
149
|
-
backgroundColor: componentTheme.inlineBackgroundHover
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
},
|
|
153
|
-
tagBefore: {
|
|
154
|
-
...(isButton && {
|
|
155
|
-
borderRadius: `calc(${componentTheme.inlineBorderRadius} * 1.5)`
|
|
156
|
-
})
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
const inlineIconVariant = variant === 'inline' && dismissible ? {
|
|
161
|
-
backgroundColor: componentTheme.inlineIconColor,
|
|
162
|
-
borderRadius: '50%',
|
|
163
|
-
padding: '0.25rem',
|
|
164
|
-
position: 'absolute',
|
|
165
|
-
insetInlineEnd: 0,
|
|
166
|
-
insetInlineStart: 'auto',
|
|
167
|
-
top: 0,
|
|
168
|
-
transform: 'translate(40%, -40%)',
|
|
169
|
-
display: 'flex',
|
|
170
|
-
alignItems: 'center',
|
|
171
|
-
justifyContent: 'center',
|
|
172
|
-
'[class$="-tag"]:hover > &': {
|
|
173
|
-
backgroundColor: componentTheme.inlineIconHoverColor
|
|
174
|
-
},
|
|
175
|
-
'[dir="rtl"] &': {
|
|
176
|
-
transform: 'translate(-40%, -40%)'
|
|
177
|
-
}
|
|
178
|
-
} : {};
|
|
179
119
|
return {
|
|
180
120
|
tag: {
|
|
181
121
|
label: 'tag',
|
|
@@ -186,12 +126,22 @@ const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
|
186
126
|
textAlign: 'center',
|
|
187
127
|
verticalAlign: 'middle',
|
|
188
128
|
userSelect: 'none',
|
|
129
|
+
backgroundColor: componentTheme.defaultBackground,
|
|
130
|
+
border: `${componentTheme.defaultBorderWidth} ${componentTheme.defaultBorderStyle} ${componentTheme.defaultBorderColor}`,
|
|
131
|
+
borderRadius: componentTheme.defaultBorderRadius,
|
|
132
|
+
color: componentTheme.defaultColor,
|
|
133
|
+
...(isButton && {
|
|
134
|
+
'&:hover': {
|
|
135
|
+
backgroundColor: componentTheme.defaultBackgroundHover
|
|
136
|
+
}
|
|
137
|
+
}),
|
|
189
138
|
...sizeVariants[size].tag,
|
|
190
139
|
...buttonVariant.tag,
|
|
191
|
-
...tagVariantVariants[variant].tag,
|
|
192
140
|
'&::before': {
|
|
193
141
|
...buttonVariant.tagBefore,
|
|
194
|
-
...
|
|
142
|
+
...(isButton && {
|
|
143
|
+
borderRadius: componentTheme.defaultBorderRadius
|
|
144
|
+
})
|
|
195
145
|
}
|
|
196
146
|
},
|
|
197
147
|
text: {
|
|
@@ -207,8 +157,7 @@ const generateStyle = (componentTheme, props, sharedTokens) => {
|
|
|
207
157
|
marginInlineStart: componentTheme.iconMargin,
|
|
208
158
|
marginInlineEnd: 0,
|
|
209
159
|
transition: `all ${componentTheme.transitionTiming}`,
|
|
210
|
-
cursor: 'pointer'
|
|
211
|
-
...inlineIconVariant
|
|
160
|
+
cursor: 'pointer'
|
|
212
161
|
}
|
|
213
162
|
};
|
|
214
163
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-tag",
|
|
3
|
-
"version": "11.7.4
|
|
3
|
+
"version": "11.7.4",
|
|
4
4
|
"description": "A tag component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/console": "11.7.4
|
|
19
|
-
"@instructure/emotion": "11.7.4
|
|
20
|
-
"@instructure/shared-types": "11.7.4
|
|
21
|
-
"@instructure/ui-dom-utils": "11.7.4
|
|
22
|
-
"@instructure/ui-color-utils": "11.7.4
|
|
23
|
-
"@instructure/ui-icons": "11.7.4
|
|
24
|
-
"@instructure/ui-react-utils": "11.7.4
|
|
25
|
-
"@instructure/ui-themes": "11.7.4
|
|
26
|
-
"@instructure/ui-view": "11.7.4
|
|
18
|
+
"@instructure/console": "11.7.4",
|
|
19
|
+
"@instructure/emotion": "11.7.4",
|
|
20
|
+
"@instructure/shared-types": "11.7.4",
|
|
21
|
+
"@instructure/ui-dom-utils": "11.7.4",
|
|
22
|
+
"@instructure/ui-color-utils": "11.7.4",
|
|
23
|
+
"@instructure/ui-icons": "11.7.4",
|
|
24
|
+
"@instructure/ui-react-utils": "11.7.4",
|
|
25
|
+
"@instructure/ui-themes": "11.7.4",
|
|
26
|
+
"@instructure/ui-view": "11.7.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@testing-library/jest-dom": "^6.9.1",
|
|
30
30
|
"@testing-library/react": "16.3.2",
|
|
31
31
|
"@testing-library/user-event": "^14.6.1",
|
|
32
32
|
"vitest": "^4.1.9",
|
|
33
|
-
"@instructure/ui-axe-check": "11.7.4
|
|
34
|
-
"@instructure/ui-babel-preset": "11.7.4
|
|
33
|
+
"@instructure/ui-axe-check": "11.7.4",
|
|
34
|
+
"@instructure/ui-babel-preset": "11.7.4"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": ">=18 <=19"
|
package/src/Tag/v2/README.md
CHANGED
|
@@ -82,29 +82,6 @@ type: example
|
|
|
82
82
|
/>
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
### Inline variant
|
|
86
|
-
|
|
87
|
-
This variant is designed to look similar to the surrounding text.
|
|
88
|
-
|
|
89
|
-
```js
|
|
90
|
-
---
|
|
91
|
-
type: example
|
|
92
|
-
---
|
|
93
|
-
<Text as="p">
|
|
94
|
-
This is an
|
|
95
|
-
<Tag
|
|
96
|
-
dismissible
|
|
97
|
-
onClick={() => alert('Tag dismissed')}
|
|
98
|
-
size="large"
|
|
99
|
-
text={<AccessibleContent alt="Remove 'inline'">
|
|
100
|
-
inline
|
|
101
|
-
</AccessibleContent>}
|
|
102
|
-
variant="inline"
|
|
103
|
-
/>
|
|
104
|
-
tag.
|
|
105
|
-
</Text>
|
|
106
|
-
```
|
|
107
|
-
|
|
108
85
|
### Guidelines
|
|
109
86
|
|
|
110
87
|
```js
|
package/src/Tag/v2/index.tsx
CHANGED
|
@@ -50,7 +50,6 @@ class Tag extends Component<TagProps> {
|
|
|
50
50
|
static defaultProps = {
|
|
51
51
|
size: 'medium',
|
|
52
52
|
dismissible: false,
|
|
53
|
-
variant: 'default',
|
|
54
53
|
disabled: false,
|
|
55
54
|
readOnly: false
|
|
56
55
|
}
|
|
@@ -105,11 +104,7 @@ class Tag extends Component<TagProps> {
|
|
|
105
104
|
}
|
|
106
105
|
|
|
107
106
|
getIconSize = () => {
|
|
108
|
-
const { size
|
|
109
|
-
|
|
110
|
-
if (variant === 'inline') {
|
|
111
|
-
return 'xs'
|
|
112
|
-
}
|
|
107
|
+
const { size } = this.props
|
|
113
108
|
|
|
114
109
|
const sizeMap = {
|
|
115
110
|
small: 'xs',
|
|
@@ -129,8 +124,7 @@ class Tag extends Component<TagProps> {
|
|
|
129
124
|
text,
|
|
130
125
|
onClick,
|
|
131
126
|
margin,
|
|
132
|
-
styles
|
|
133
|
-
variant
|
|
127
|
+
styles
|
|
134
128
|
} = this.props
|
|
135
129
|
|
|
136
130
|
const passthroughProps = View.omitViewProps(
|
|
@@ -142,9 +136,6 @@ class Tag extends Component<TagProps> {
|
|
|
142
136
|
if (disabled) {
|
|
143
137
|
return 'mutedColor'
|
|
144
138
|
}
|
|
145
|
-
if (variant === 'inline') {
|
|
146
|
-
return 'inverseColor'
|
|
147
|
-
}
|
|
148
139
|
return this.state.iconHovered ? 'actionSecondaryHoverColor' : 'baseColor'
|
|
149
140
|
}
|
|
150
141
|
|
package/src/Tag/v2/props.ts
CHANGED
|
@@ -59,7 +59,6 @@ type TagOwnProps = {
|
|
|
59
59
|
*/
|
|
60
60
|
elementRef?: (element: Element | null) => void
|
|
61
61
|
size?: 'small' | 'medium' | 'large'
|
|
62
|
-
variant?: 'default' | 'inline'
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
type PropKeys = keyof TagOwnProps
|
|
@@ -80,8 +79,7 @@ const allowedProps: AllowedPropKeys = [
|
|
|
80
79
|
'margin',
|
|
81
80
|
'onClick',
|
|
82
81
|
'elementRef',
|
|
83
|
-
'size'
|
|
84
|
-
'variant'
|
|
82
|
+
'size'
|
|
85
83
|
]
|
|
86
84
|
|
|
87
85
|
export type { TagProps, TagStyle }
|
package/src/Tag/v2/styles.ts
CHANGED
|
@@ -41,7 +41,7 @@ const generateStyle = (
|
|
|
41
41
|
props: TagProps,
|
|
42
42
|
sharedTokens: SharedTokens
|
|
43
43
|
): TagStyle => {
|
|
44
|
-
const {
|
|
44
|
+
const { size, dismissible, onClick, disabled } = props
|
|
45
45
|
|
|
46
46
|
const isButton = !!onClick
|
|
47
47
|
|
|
@@ -118,66 +118,6 @@ const generateStyle = (
|
|
|
118
118
|
}
|
|
119
119
|
: {}
|
|
120
120
|
|
|
121
|
-
const tagVariantVariants = {
|
|
122
|
-
default: {
|
|
123
|
-
tag: {
|
|
124
|
-
backgroundColor: componentTheme.defaultBackground,
|
|
125
|
-
border: `${componentTheme.defaultBorderWidth} ${componentTheme.defaultBorderStyle} ${componentTheme.defaultBorderColor}`,
|
|
126
|
-
borderRadius: componentTheme.defaultBorderRadius,
|
|
127
|
-
color: componentTheme.defaultColor,
|
|
128
|
-
...(isButton && {
|
|
129
|
-
'&:hover': { backgroundColor: componentTheme.defaultBackgroundHover }
|
|
130
|
-
})
|
|
131
|
-
},
|
|
132
|
-
tagBefore: {
|
|
133
|
-
...(isButton && {
|
|
134
|
-
borderRadius: componentTheme.defaultBorderRadius
|
|
135
|
-
})
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
inline: {
|
|
139
|
-
tag: {
|
|
140
|
-
backgroundColor: componentTheme.inlineBackground,
|
|
141
|
-
border: `${componentTheme.inlineBorderWidth} ${componentTheme.inlineBorderStyle} ${componentTheme.inlineBorderColor}`,
|
|
142
|
-
borderRadius: componentTheme.inlineBorderRadius,
|
|
143
|
-
color: componentTheme.inlineColor,
|
|
144
|
-
cursor: 'text',
|
|
145
|
-
margin: '0 0.1875rem 0.1875rem',
|
|
146
|
-
...(isButton && {
|
|
147
|
-
'&:hover': { backgroundColor: componentTheme.inlineBackgroundHover }
|
|
148
|
-
})
|
|
149
|
-
},
|
|
150
|
-
tagBefore: {
|
|
151
|
-
...(isButton && {
|
|
152
|
-
borderRadius: `calc(${componentTheme.inlineBorderRadius} * 1.5)`
|
|
153
|
-
})
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const inlineIconVariant =
|
|
159
|
-
variant === 'inline' && dismissible
|
|
160
|
-
? {
|
|
161
|
-
backgroundColor: componentTheme.inlineIconColor,
|
|
162
|
-
borderRadius: '50%',
|
|
163
|
-
padding: '0.25rem',
|
|
164
|
-
position: 'absolute',
|
|
165
|
-
insetInlineEnd: 0,
|
|
166
|
-
insetInlineStart: 'auto',
|
|
167
|
-
top: 0,
|
|
168
|
-
transform: 'translate(40%, -40%)',
|
|
169
|
-
display: 'flex',
|
|
170
|
-
alignItems: 'center',
|
|
171
|
-
justifyContent: 'center',
|
|
172
|
-
|
|
173
|
-
'[class$="-tag"]:hover > &': {
|
|
174
|
-
backgroundColor: componentTheme.inlineIconHoverColor
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
'[dir="rtl"] &': { transform: 'translate(-40%, -40%)' }
|
|
178
|
-
}
|
|
179
|
-
: {}
|
|
180
|
-
|
|
181
121
|
return {
|
|
182
122
|
tag: {
|
|
183
123
|
label: 'tag',
|
|
@@ -188,13 +128,21 @@ const generateStyle = (
|
|
|
188
128
|
textAlign: 'center',
|
|
189
129
|
verticalAlign: 'middle',
|
|
190
130
|
userSelect: 'none',
|
|
131
|
+
backgroundColor: componentTheme.defaultBackground,
|
|
132
|
+
border: `${componentTheme.defaultBorderWidth} ${componentTheme.defaultBorderStyle} ${componentTheme.defaultBorderColor}`,
|
|
133
|
+
borderRadius: componentTheme.defaultBorderRadius,
|
|
134
|
+
color: componentTheme.defaultColor,
|
|
135
|
+
...(isButton && {
|
|
136
|
+
'&:hover': { backgroundColor: componentTheme.defaultBackgroundHover }
|
|
137
|
+
}),
|
|
191
138
|
...sizeVariants[size!].tag,
|
|
192
139
|
...buttonVariant.tag,
|
|
193
|
-
...tagVariantVariants[variant!].tag,
|
|
194
140
|
|
|
195
141
|
'&::before': {
|
|
196
142
|
...buttonVariant.tagBefore,
|
|
197
|
-
...
|
|
143
|
+
...(isButton && {
|
|
144
|
+
borderRadius: componentTheme.defaultBorderRadius
|
|
145
|
+
})
|
|
198
146
|
}
|
|
199
147
|
},
|
|
200
148
|
text: {
|
|
@@ -210,8 +158,7 @@ const generateStyle = (
|
|
|
210
158
|
marginInlineStart: componentTheme.iconMargin,
|
|
211
159
|
marginInlineEnd: 0,
|
|
212
160
|
transition: `all ${componentTheme.transitionTiming}`,
|
|
213
|
-
cursor: 'pointer'
|
|
214
|
-
...inlineIconVariant
|
|
161
|
+
cursor: 'pointer'
|
|
215
162
|
}
|
|
216
163
|
}
|
|
217
164
|
}
|