@atlaskit/lozenge 11.1.12 → 11.2.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/CHANGELOG.md +13 -0
- package/codemods/{utils.ts → utils.tsx} +0 -1
- package/dist/cjs/Lozenge/index.js +72 -100
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/Lozenge/index.js +76 -102
- package/dist/es2019/version.json +1 -1
- package/dist/esm/Lozenge/index.js +72 -100
- package/dist/esm/version.json +1 -1
- package/package.json +8 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/lozenge
|
|
2
2
|
|
|
3
|
+
## 11.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`bf235e83ac0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bf235e83ac0) - Internal changes to the way styles are applied. The Lozenge background is now centred properly resulting in it sitting 1px higher, however the text inside the Lozenge is unaffected.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`37246e87cfc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/37246e87cfc) - Adds position static to Box.
|
|
12
|
+
Changes lozenge to use position static instead of relative.
|
|
13
|
+
- [`6e0671cb45c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6e0671cb45c) - Internal change to implementation which should not have any noticeable impact.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 11.1.12
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -9,97 +9,14 @@ var _react = require("react");
|
|
|
9
9
|
|
|
10
10
|
var _core = require("@emotion/core");
|
|
11
11
|
|
|
12
|
+
var _dsExplorations = require("@atlaskit/ds-explorations");
|
|
13
|
+
|
|
12
14
|
var _colors = require("@atlaskit/theme/colors");
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
15
17
|
|
|
16
18
|
/** @jsx jsx */
|
|
17
|
-
|
|
18
|
-
backgroundColor: "var(--ds-background-neutral, ".concat(_colors.N40, ")"),
|
|
19
|
-
color: "var(--ds-text, ".concat(_colors.N500, ")")
|
|
20
|
-
});
|
|
21
|
-
var inprogressAppearanceStyles = (0, _core.css)({
|
|
22
|
-
backgroundColor: "var(--ds-background-information, ".concat(_colors.B50, ")"),
|
|
23
|
-
color: "var(--ds-text-information, ".concat(_colors.B500, ")")
|
|
24
|
-
});
|
|
25
|
-
var movedAppearanceStyles = (0, _core.css)({
|
|
26
|
-
backgroundColor: "var(--ds-background-warning, ".concat(_colors.Y75, ")"),
|
|
27
|
-
color: "var(--ds-text-warning, ".concat(_colors.N800, ")")
|
|
28
|
-
});
|
|
29
|
-
var newAppearanceStyles = (0, _core.css)({
|
|
30
|
-
backgroundColor: "var(--ds-background-discovery, ".concat(_colors.P50, ")"),
|
|
31
|
-
color: "var(--ds-text-discovery, ".concat(_colors.P500, ")")
|
|
32
|
-
});
|
|
33
|
-
var removedAppearanceStyles = (0, _core.css)({
|
|
34
|
-
backgroundColor: "var(--ds-background-danger, ".concat(_colors.R50, ")"),
|
|
35
|
-
color: "var(--ds-text-danger, ".concat(_colors.R500, ")")
|
|
36
|
-
});
|
|
37
|
-
var successAppearanceStyles = (0, _core.css)({
|
|
38
|
-
backgroundColor: "var(--ds-background-success, ".concat(_colors.G50, ")"),
|
|
39
|
-
color: "var(--ds-text-success, ".concat(_colors.G500, ")")
|
|
40
|
-
});
|
|
41
|
-
var defaultBoldAppearanceStyles = (0, _core.css)({
|
|
42
|
-
backgroundColor: "var(--ds-background-neutral-bold, ".concat(_colors.N500, ")"),
|
|
43
|
-
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")")
|
|
44
|
-
});
|
|
45
|
-
var inprogressBoldAppearanceStyles = (0, _core.css)({
|
|
46
|
-
backgroundColor: "var(--ds-background-information-bold, ".concat(_colors.B400, ")"),
|
|
47
|
-
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")")
|
|
48
|
-
});
|
|
49
|
-
var movedBoldAppearanceStyles = (0, _core.css)({
|
|
50
|
-
backgroundColor: "var(--ds-background-warning-bold, ".concat(_colors.Y500, ")"),
|
|
51
|
-
color: "var(--ds-text-warning-inverse, ".concat(_colors.N800, ")")
|
|
52
|
-
});
|
|
53
|
-
var newBoldAppearanceStyles = (0, _core.css)({
|
|
54
|
-
backgroundColor: "var(--ds-background-discovery-bold, ".concat(_colors.P400, ")"),
|
|
55
|
-
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")")
|
|
56
|
-
});
|
|
57
|
-
var removedBoldAppearanceStyles = (0, _core.css)({
|
|
58
|
-
backgroundColor: "var(--ds-background-danger-bold, ".concat(_colors.R400, ")"),
|
|
59
|
-
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")")
|
|
60
|
-
});
|
|
61
|
-
var successBoldAppearanceStyles = (0, _core.css)({
|
|
62
|
-
backgroundColor: "var(--ds-background-success-bold, ".concat(_colors.G400, ")"),
|
|
63
|
-
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")")
|
|
64
|
-
});
|
|
65
|
-
var subtleAppearances = {
|
|
66
|
-
default: defaultAppearanceStyles,
|
|
67
|
-
inprogress: inprogressAppearanceStyles,
|
|
68
|
-
moved: movedAppearanceStyles,
|
|
69
|
-
new: newAppearanceStyles,
|
|
70
|
-
removed: removedAppearanceStyles,
|
|
71
|
-
success: successAppearanceStyles
|
|
72
|
-
};
|
|
73
|
-
var boldAppearances = {
|
|
74
|
-
default: defaultBoldAppearanceStyles,
|
|
75
|
-
inprogress: inprogressBoldAppearanceStyles,
|
|
76
|
-
moved: movedBoldAppearanceStyles,
|
|
77
|
-
new: newBoldAppearanceStyles,
|
|
78
|
-
removed: removedBoldAppearanceStyles,
|
|
79
|
-
success: successBoldAppearanceStyles
|
|
80
|
-
};
|
|
81
|
-
var contentStyles = (0, _core.css)({
|
|
82
|
-
display: 'inline-block',
|
|
83
|
-
boxSizing: 'border-box',
|
|
84
|
-
width: '100%',
|
|
85
|
-
padding: "0 ".concat((0, _constants.gridSize)() / 2, "px"),
|
|
86
|
-
overflow: 'hidden',
|
|
87
|
-
textOverflow: 'ellipsis',
|
|
88
|
-
verticalAlign: 'top',
|
|
89
|
-
whiteSpace: 'nowrap'
|
|
90
|
-
});
|
|
91
|
-
var containerStyles = (0, _core.css)({
|
|
92
|
-
display: 'inline-block',
|
|
93
|
-
boxSizing: 'border-box',
|
|
94
|
-
maxWidth: '100%',
|
|
95
|
-
padding: '2px 0 3px 0',
|
|
96
|
-
borderRadius: (0, _constants.borderRadius)(),
|
|
97
|
-
fontSize: '11px',
|
|
98
|
-
fontWeight: 700,
|
|
99
|
-
lineHeight: 1,
|
|
100
|
-
textTransform: 'uppercase',
|
|
101
|
-
verticalAlign: 'baseline'
|
|
102
|
-
});
|
|
19
|
+
|
|
103
20
|
/**
|
|
104
21
|
* __Lozenge__
|
|
105
22
|
*
|
|
@@ -109,7 +26,6 @@ var containerStyles = (0, _core.css)({
|
|
|
109
26
|
* - [Code](https://atlassian.design/components/lozenge/code)
|
|
110
27
|
* - [Usage](https://atlassian.design/components/lozenge/usage)
|
|
111
28
|
*/
|
|
112
|
-
|
|
113
29
|
var Lozenge = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
114
30
|
var children = _ref.children,
|
|
115
31
|
testId = _ref.testId,
|
|
@@ -121,20 +37,76 @@ var Lozenge = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
121
37
|
maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
|
|
122
38
|
_ref$style = _ref.style,
|
|
123
39
|
style = _ref$style === void 0 ? {} : _ref$style;
|
|
124
|
-
|
|
125
|
-
|
|
40
|
+
var appearanceStyle = isBold ? 'bold' : 'subtle';
|
|
41
|
+
var appearanceType = appearance in backgroundColors[appearanceStyle] ? appearance : 'default';
|
|
42
|
+
var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
|
|
43
|
+
return (0, _core.jsx)(_dsExplorations.UNSAFE_Box, {
|
|
44
|
+
as: "span",
|
|
45
|
+
display: "inlineFlex",
|
|
46
|
+
backgroundColor: backgroundColors[appearanceStyle][appearanceType],
|
|
47
|
+
borderRadius: "normal",
|
|
48
|
+
paddingInline: "sp-50",
|
|
49
|
+
position: "static",
|
|
50
|
+
testId: testId,
|
|
51
|
+
UNSAFE_style: {
|
|
126
52
|
backgroundColor: style.backgroundColor,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
53
|
+
verticalAlign: 'baseline',
|
|
54
|
+
maxWidth: '100%'
|
|
55
|
+
}
|
|
56
|
+
}, (0, _core.jsx)(_dsExplorations.UNSAFE_Text, {
|
|
57
|
+
as: "span",
|
|
58
|
+
fontSize: "11px",
|
|
59
|
+
fontWeight: "700",
|
|
60
|
+
lineHeight: "16px",
|
|
61
|
+
textTransform: "uppercase",
|
|
62
|
+
color: textColors[appearanceStyle][appearanceType],
|
|
63
|
+
shouldTruncate: true,
|
|
64
|
+
UNSAFE_style: {
|
|
65
|
+
color: style.color,
|
|
66
|
+
width: '100%',
|
|
67
|
+
maxWidth: "calc(".concat(maxWidthValue, " - ").concat(_dsExplorations.UNSAFE_SPACING_SCALE['sp-100'], "px)") // to negate paddingInline specified on Box above
|
|
68
|
+
|
|
134
69
|
},
|
|
135
|
-
|
|
70
|
+
testId: testId && "".concat(testId, "--text")
|
|
136
71
|
}, children));
|
|
137
72
|
});
|
|
138
73
|
Lozenge.displayName = 'Lozenge';
|
|
139
|
-
var _default = Lozenge;
|
|
140
|
-
|
|
74
|
+
var _default = Lozenge; // Lozenge colors
|
|
75
|
+
|
|
76
|
+
exports.default = _default;
|
|
77
|
+
var backgroundColors = {
|
|
78
|
+
bold: {
|
|
79
|
+
default: ['neutral.bold', _colors.N500],
|
|
80
|
+
inprogress: ['information.bold', _colors.B400],
|
|
81
|
+
moved: ['warning.bold', _colors.Y500],
|
|
82
|
+
new: ['discovery.bold', _colors.P400],
|
|
83
|
+
removed: ['danger.bold', _colors.R400],
|
|
84
|
+
success: ['success.bold', _colors.G400]
|
|
85
|
+
},
|
|
86
|
+
subtle: {
|
|
87
|
+
default: ['neutral', _colors.N40],
|
|
88
|
+
inprogress: ['information', _colors.B50],
|
|
89
|
+
moved: ['warning', _colors.Y75],
|
|
90
|
+
new: ['discovery', _colors.P50],
|
|
91
|
+
removed: ['danger', _colors.R50],
|
|
92
|
+
success: ['success', _colors.G50]
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var textColors = {
|
|
96
|
+
bold: {
|
|
97
|
+
default: ['inverse', _colors.N0],
|
|
98
|
+
inprogress: ['inverse', _colors.N0],
|
|
99
|
+
moved: ['warning.inverse', _colors.N800],
|
|
100
|
+
new: ['inverse', _colors.N0],
|
|
101
|
+
removed: ['inverse', _colors.N0],
|
|
102
|
+
success: ['inverse', _colors.N0]
|
|
103
|
+
},
|
|
104
|
+
subtle: {
|
|
105
|
+
default: ['color.text', _colors.N500],
|
|
106
|
+
inprogress: ['information', _colors.B500],
|
|
107
|
+
moved: ['warning', _colors.N800],
|
|
108
|
+
new: ['discovery', _colors.P500],
|
|
109
|
+
removed: ['danger', _colors.R500],
|
|
110
|
+
success: ['success', _colors.G500]
|
|
111
|
+
}
|
|
112
|
+
};
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,94 +1,11 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
|
|
1
3
|
/** @jsx jsx */
|
|
2
4
|
import { memo } from 'react';
|
|
3
|
-
import {
|
|
5
|
+
import { jsx } from '@emotion/core';
|
|
6
|
+
import { UNSAFE_Box as Box, UNSAFE_SPACING_SCALE as SPACING_SCALE, UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
|
|
4
7
|
import { B400, B50, B500, G400, G50, G500, N0, N40, N500, N800, P400, P50, P500, R400, R50, R500, Y500, Y75 } from '@atlaskit/theme/colors';
|
|
5
|
-
|
|
6
|
-
const defaultAppearanceStyles = css({
|
|
7
|
-
backgroundColor: `var(--ds-background-neutral, ${N40})`,
|
|
8
|
-
color: `var(--ds-text, ${N500})`
|
|
9
|
-
});
|
|
10
|
-
const inprogressAppearanceStyles = css({
|
|
11
|
-
backgroundColor: `var(--ds-background-information, ${B50})`,
|
|
12
|
-
color: `var(--ds-text-information, ${B500})`
|
|
13
|
-
});
|
|
14
|
-
const movedAppearanceStyles = css({
|
|
15
|
-
backgroundColor: `var(--ds-background-warning, ${Y75})`,
|
|
16
|
-
color: `var(--ds-text-warning, ${N800})`
|
|
17
|
-
});
|
|
18
|
-
const newAppearanceStyles = css({
|
|
19
|
-
backgroundColor: `var(--ds-background-discovery, ${P50})`,
|
|
20
|
-
color: `var(--ds-text-discovery, ${P500})`
|
|
21
|
-
});
|
|
22
|
-
const removedAppearanceStyles = css({
|
|
23
|
-
backgroundColor: `var(--ds-background-danger, ${R50})`,
|
|
24
|
-
color: `var(--ds-text-danger, ${R500})`
|
|
25
|
-
});
|
|
26
|
-
const successAppearanceStyles = css({
|
|
27
|
-
backgroundColor: `var(--ds-background-success, ${G50})`,
|
|
28
|
-
color: `var(--ds-text-success, ${G500})`
|
|
29
|
-
});
|
|
30
|
-
const defaultBoldAppearanceStyles = css({
|
|
31
|
-
backgroundColor: `var(--ds-background-neutral-bold, ${N500})`,
|
|
32
|
-
color: `var(--ds-text-inverse, ${N0})`
|
|
33
|
-
});
|
|
34
|
-
const inprogressBoldAppearanceStyles = css({
|
|
35
|
-
backgroundColor: `var(--ds-background-information-bold, ${B400})`,
|
|
36
|
-
color: `var(--ds-text-inverse, ${N0})`
|
|
37
|
-
});
|
|
38
|
-
const movedBoldAppearanceStyles = css({
|
|
39
|
-
backgroundColor: `var(--ds-background-warning-bold, ${Y500})`,
|
|
40
|
-
color: `var(--ds-text-warning-inverse, ${N800})`
|
|
41
|
-
});
|
|
42
|
-
const newBoldAppearanceStyles = css({
|
|
43
|
-
backgroundColor: `var(--ds-background-discovery-bold, ${P400})`,
|
|
44
|
-
color: `var(--ds-text-inverse, ${N0})`
|
|
45
|
-
});
|
|
46
|
-
const removedBoldAppearanceStyles = css({
|
|
47
|
-
backgroundColor: `var(--ds-background-danger-bold, ${R400})`,
|
|
48
|
-
color: `var(--ds-text-inverse, ${N0})`
|
|
49
|
-
});
|
|
50
|
-
const successBoldAppearanceStyles = css({
|
|
51
|
-
backgroundColor: `var(--ds-background-success-bold, ${G400})`,
|
|
52
|
-
color: `var(--ds-text-inverse, ${N0})`
|
|
53
|
-
});
|
|
54
|
-
const subtleAppearances = {
|
|
55
|
-
default: defaultAppearanceStyles,
|
|
56
|
-
inprogress: inprogressAppearanceStyles,
|
|
57
|
-
moved: movedAppearanceStyles,
|
|
58
|
-
new: newAppearanceStyles,
|
|
59
|
-
removed: removedAppearanceStyles,
|
|
60
|
-
success: successAppearanceStyles
|
|
61
|
-
};
|
|
62
|
-
const boldAppearances = {
|
|
63
|
-
default: defaultBoldAppearanceStyles,
|
|
64
|
-
inprogress: inprogressBoldAppearanceStyles,
|
|
65
|
-
moved: movedBoldAppearanceStyles,
|
|
66
|
-
new: newBoldAppearanceStyles,
|
|
67
|
-
removed: removedBoldAppearanceStyles,
|
|
68
|
-
success: successBoldAppearanceStyles
|
|
69
|
-
};
|
|
70
|
-
const contentStyles = css({
|
|
71
|
-
display: 'inline-block',
|
|
72
|
-
boxSizing: 'border-box',
|
|
73
|
-
width: '100%',
|
|
74
|
-
padding: `0 ${gridSize() / 2}px`,
|
|
75
|
-
overflow: 'hidden',
|
|
76
|
-
textOverflow: 'ellipsis',
|
|
77
|
-
verticalAlign: 'top',
|
|
78
|
-
whiteSpace: 'nowrap'
|
|
79
|
-
});
|
|
80
|
-
const containerStyles = css({
|
|
81
|
-
display: 'inline-block',
|
|
82
|
-
boxSizing: 'border-box',
|
|
83
|
-
maxWidth: '100%',
|
|
84
|
-
padding: '2px 0 3px 0',
|
|
85
|
-
borderRadius: borderRadius(),
|
|
86
|
-
fontSize: '11px',
|
|
87
|
-
fontWeight: 700,
|
|
88
|
-
lineHeight: 1,
|
|
89
|
-
textTransform: 'uppercase',
|
|
90
|
-
verticalAlign: 'baseline'
|
|
91
|
-
});
|
|
8
|
+
|
|
92
9
|
/**
|
|
93
10
|
* __Lozenge__
|
|
94
11
|
*
|
|
@@ -98,7 +15,6 @@ const containerStyles = css({
|
|
|
98
15
|
* - [Code](https://atlassian.design/components/lozenge/code)
|
|
99
16
|
* - [Usage](https://atlassian.design/components/lozenge/usage)
|
|
100
17
|
*/
|
|
101
|
-
|
|
102
18
|
const Lozenge = /*#__PURE__*/memo(({
|
|
103
19
|
children,
|
|
104
20
|
testId,
|
|
@@ -106,18 +22,76 @@ const Lozenge = /*#__PURE__*/memo(({
|
|
|
106
22
|
appearance = 'default',
|
|
107
23
|
maxWidth = 200,
|
|
108
24
|
style = {}
|
|
109
|
-
}) =>
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
25
|
+
}) => {
|
|
26
|
+
const appearanceStyle = isBold ? 'bold' : 'subtle';
|
|
27
|
+
const appearanceType = appearance in backgroundColors[appearanceStyle] ? appearance : 'default';
|
|
28
|
+
const maxWidthValue = typeof maxWidth === 'string' ? maxWidth : `${maxWidth}px`;
|
|
29
|
+
return jsx(Box, {
|
|
30
|
+
as: "span",
|
|
31
|
+
display: "inlineFlex",
|
|
32
|
+
backgroundColor: backgroundColors[appearanceStyle][appearanceType],
|
|
33
|
+
borderRadius: "normal",
|
|
34
|
+
paddingInline: "sp-50",
|
|
35
|
+
position: "static",
|
|
36
|
+
testId: testId,
|
|
37
|
+
UNSAFE_style: {
|
|
38
|
+
backgroundColor: style.backgroundColor,
|
|
39
|
+
verticalAlign: 'baseline',
|
|
40
|
+
maxWidth: '100%'
|
|
41
|
+
}
|
|
42
|
+
}, jsx(Text, {
|
|
43
|
+
as: "span",
|
|
44
|
+
fontSize: "11px",
|
|
45
|
+
fontWeight: "700",
|
|
46
|
+
lineHeight: "16px",
|
|
47
|
+
textTransform: "uppercase",
|
|
48
|
+
color: textColors[appearanceStyle][appearanceType],
|
|
49
|
+
shouldTruncate: true,
|
|
50
|
+
UNSAFE_style: {
|
|
51
|
+
color: style.color,
|
|
52
|
+
width: '100%',
|
|
53
|
+
maxWidth: `calc(${maxWidthValue} - ${SPACING_SCALE['sp-100']}px)` // to negate paddingInline specified on Box above
|
|
54
|
+
|
|
55
|
+
},
|
|
56
|
+
testId: testId && `${testId}--text`
|
|
57
|
+
}, children));
|
|
58
|
+
});
|
|
59
|
+
Lozenge.displayName = 'Lozenge';
|
|
60
|
+
export default Lozenge; // Lozenge colors
|
|
61
|
+
|
|
62
|
+
const backgroundColors = {
|
|
63
|
+
bold: {
|
|
64
|
+
default: ['neutral.bold', N500],
|
|
65
|
+
inprogress: ['information.bold', B400],
|
|
66
|
+
moved: ['warning.bold', Y500],
|
|
67
|
+
new: ['discovery.bold', P400],
|
|
68
|
+
removed: ['danger.bold', R400],
|
|
69
|
+
success: ['success.bold', G400]
|
|
113
70
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
71
|
+
subtle: {
|
|
72
|
+
default: ['neutral', N40],
|
|
73
|
+
inprogress: ['information', B50],
|
|
74
|
+
moved: ['warning', Y75],
|
|
75
|
+
new: ['discovery', P50],
|
|
76
|
+
removed: ['danger', R50],
|
|
77
|
+
success: ['success', G50]
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const textColors = {
|
|
81
|
+
bold: {
|
|
82
|
+
default: ['inverse', N0],
|
|
83
|
+
inprogress: ['inverse', N0],
|
|
84
|
+
moved: ['warning.inverse', N800],
|
|
85
|
+
new: ['inverse', N0],
|
|
86
|
+
removed: ['inverse', N0],
|
|
87
|
+
success: ['inverse', N0]
|
|
119
88
|
},
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
89
|
+
subtle: {
|
|
90
|
+
default: ['color.text', N500],
|
|
91
|
+
inprogress: ['information', B500],
|
|
92
|
+
moved: ['warning', N800],
|
|
93
|
+
new: ['discovery', P500],
|
|
94
|
+
removed: ['danger', R500],
|
|
95
|
+
success: ['success', G500]
|
|
96
|
+
}
|
|
97
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -1,94 +1,11 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
|
|
2
|
+
|
|
1
3
|
/** @jsx jsx */
|
|
2
4
|
import { memo } from 'react';
|
|
3
|
-
import {
|
|
5
|
+
import { jsx } from '@emotion/core';
|
|
6
|
+
import { UNSAFE_Box as Box, UNSAFE_SPACING_SCALE as SPACING_SCALE, UNSAFE_Text as Text } from '@atlaskit/ds-explorations';
|
|
4
7
|
import { B400, B50, B500, G400, G50, G500, N0, N40, N500, N800, P400, P50, P500, R400, R50, R500, Y500, Y75 } from '@atlaskit/theme/colors';
|
|
5
|
-
|
|
6
|
-
var defaultAppearanceStyles = css({
|
|
7
|
-
backgroundColor: "var(--ds-background-neutral, ".concat(N40, ")"),
|
|
8
|
-
color: "var(--ds-text, ".concat(N500, ")")
|
|
9
|
-
});
|
|
10
|
-
var inprogressAppearanceStyles = css({
|
|
11
|
-
backgroundColor: "var(--ds-background-information, ".concat(B50, ")"),
|
|
12
|
-
color: "var(--ds-text-information, ".concat(B500, ")")
|
|
13
|
-
});
|
|
14
|
-
var movedAppearanceStyles = css({
|
|
15
|
-
backgroundColor: "var(--ds-background-warning, ".concat(Y75, ")"),
|
|
16
|
-
color: "var(--ds-text-warning, ".concat(N800, ")")
|
|
17
|
-
});
|
|
18
|
-
var newAppearanceStyles = css({
|
|
19
|
-
backgroundColor: "var(--ds-background-discovery, ".concat(P50, ")"),
|
|
20
|
-
color: "var(--ds-text-discovery, ".concat(P500, ")")
|
|
21
|
-
});
|
|
22
|
-
var removedAppearanceStyles = css({
|
|
23
|
-
backgroundColor: "var(--ds-background-danger, ".concat(R50, ")"),
|
|
24
|
-
color: "var(--ds-text-danger, ".concat(R500, ")")
|
|
25
|
-
});
|
|
26
|
-
var successAppearanceStyles = css({
|
|
27
|
-
backgroundColor: "var(--ds-background-success, ".concat(G50, ")"),
|
|
28
|
-
color: "var(--ds-text-success, ".concat(G500, ")")
|
|
29
|
-
});
|
|
30
|
-
var defaultBoldAppearanceStyles = css({
|
|
31
|
-
backgroundColor: "var(--ds-background-neutral-bold, ".concat(N500, ")"),
|
|
32
|
-
color: "var(--ds-text-inverse, ".concat(N0, ")")
|
|
33
|
-
});
|
|
34
|
-
var inprogressBoldAppearanceStyles = css({
|
|
35
|
-
backgroundColor: "var(--ds-background-information-bold, ".concat(B400, ")"),
|
|
36
|
-
color: "var(--ds-text-inverse, ".concat(N0, ")")
|
|
37
|
-
});
|
|
38
|
-
var movedBoldAppearanceStyles = css({
|
|
39
|
-
backgroundColor: "var(--ds-background-warning-bold, ".concat(Y500, ")"),
|
|
40
|
-
color: "var(--ds-text-warning-inverse, ".concat(N800, ")")
|
|
41
|
-
});
|
|
42
|
-
var newBoldAppearanceStyles = css({
|
|
43
|
-
backgroundColor: "var(--ds-background-discovery-bold, ".concat(P400, ")"),
|
|
44
|
-
color: "var(--ds-text-inverse, ".concat(N0, ")")
|
|
45
|
-
});
|
|
46
|
-
var removedBoldAppearanceStyles = css({
|
|
47
|
-
backgroundColor: "var(--ds-background-danger-bold, ".concat(R400, ")"),
|
|
48
|
-
color: "var(--ds-text-inverse, ".concat(N0, ")")
|
|
49
|
-
});
|
|
50
|
-
var successBoldAppearanceStyles = css({
|
|
51
|
-
backgroundColor: "var(--ds-background-success-bold, ".concat(G400, ")"),
|
|
52
|
-
color: "var(--ds-text-inverse, ".concat(N0, ")")
|
|
53
|
-
});
|
|
54
|
-
var subtleAppearances = {
|
|
55
|
-
default: defaultAppearanceStyles,
|
|
56
|
-
inprogress: inprogressAppearanceStyles,
|
|
57
|
-
moved: movedAppearanceStyles,
|
|
58
|
-
new: newAppearanceStyles,
|
|
59
|
-
removed: removedAppearanceStyles,
|
|
60
|
-
success: successAppearanceStyles
|
|
61
|
-
};
|
|
62
|
-
var boldAppearances = {
|
|
63
|
-
default: defaultBoldAppearanceStyles,
|
|
64
|
-
inprogress: inprogressBoldAppearanceStyles,
|
|
65
|
-
moved: movedBoldAppearanceStyles,
|
|
66
|
-
new: newBoldAppearanceStyles,
|
|
67
|
-
removed: removedBoldAppearanceStyles,
|
|
68
|
-
success: successBoldAppearanceStyles
|
|
69
|
-
};
|
|
70
|
-
var contentStyles = css({
|
|
71
|
-
display: 'inline-block',
|
|
72
|
-
boxSizing: 'border-box',
|
|
73
|
-
width: '100%',
|
|
74
|
-
padding: "0 ".concat(gridSize() / 2, "px"),
|
|
75
|
-
overflow: 'hidden',
|
|
76
|
-
textOverflow: 'ellipsis',
|
|
77
|
-
verticalAlign: 'top',
|
|
78
|
-
whiteSpace: 'nowrap'
|
|
79
|
-
});
|
|
80
|
-
var containerStyles = css({
|
|
81
|
-
display: 'inline-block',
|
|
82
|
-
boxSizing: 'border-box',
|
|
83
|
-
maxWidth: '100%',
|
|
84
|
-
padding: '2px 0 3px 0',
|
|
85
|
-
borderRadius: borderRadius(),
|
|
86
|
-
fontSize: '11px',
|
|
87
|
-
fontWeight: 700,
|
|
88
|
-
lineHeight: 1,
|
|
89
|
-
textTransform: 'uppercase',
|
|
90
|
-
verticalAlign: 'baseline'
|
|
91
|
-
});
|
|
8
|
+
|
|
92
9
|
/**
|
|
93
10
|
* __Lozenge__
|
|
94
11
|
*
|
|
@@ -98,7 +15,6 @@ var containerStyles = css({
|
|
|
98
15
|
* - [Code](https://atlassian.design/components/lozenge/code)
|
|
99
16
|
* - [Usage](https://atlassian.design/components/lozenge/usage)
|
|
100
17
|
*/
|
|
101
|
-
|
|
102
18
|
var Lozenge = /*#__PURE__*/memo(function (_ref) {
|
|
103
19
|
var children = _ref.children,
|
|
104
20
|
testId = _ref.testId,
|
|
@@ -110,19 +26,75 @@ var Lozenge = /*#__PURE__*/memo(function (_ref) {
|
|
|
110
26
|
maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
|
|
111
27
|
_ref$style = _ref.style,
|
|
112
28
|
style = _ref$style === void 0 ? {} : _ref$style;
|
|
113
|
-
|
|
114
|
-
|
|
29
|
+
var appearanceStyle = isBold ? 'bold' : 'subtle';
|
|
30
|
+
var appearanceType = appearance in backgroundColors[appearanceStyle] ? appearance : 'default';
|
|
31
|
+
var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
|
|
32
|
+
return jsx(Box, {
|
|
33
|
+
as: "span",
|
|
34
|
+
display: "inlineFlex",
|
|
35
|
+
backgroundColor: backgroundColors[appearanceStyle][appearanceType],
|
|
36
|
+
borderRadius: "normal",
|
|
37
|
+
paddingInline: "sp-50",
|
|
38
|
+
position: "static",
|
|
39
|
+
testId: testId,
|
|
40
|
+
UNSAFE_style: {
|
|
115
41
|
backgroundColor: style.backgroundColor,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
42
|
+
verticalAlign: 'baseline',
|
|
43
|
+
maxWidth: '100%'
|
|
44
|
+
}
|
|
45
|
+
}, jsx(Text, {
|
|
46
|
+
as: "span",
|
|
47
|
+
fontSize: "11px",
|
|
48
|
+
fontWeight: "700",
|
|
49
|
+
lineHeight: "16px",
|
|
50
|
+
textTransform: "uppercase",
|
|
51
|
+
color: textColors[appearanceStyle][appearanceType],
|
|
52
|
+
shouldTruncate: true,
|
|
53
|
+
UNSAFE_style: {
|
|
54
|
+
color: style.color,
|
|
55
|
+
width: '100%',
|
|
56
|
+
maxWidth: "calc(".concat(maxWidthValue, " - ").concat(SPACING_SCALE['sp-100'], "px)") // to negate paddingInline specified on Box above
|
|
57
|
+
|
|
123
58
|
},
|
|
124
|
-
|
|
59
|
+
testId: testId && "".concat(testId, "--text")
|
|
125
60
|
}, children));
|
|
126
61
|
});
|
|
127
62
|
Lozenge.displayName = 'Lozenge';
|
|
128
|
-
export default Lozenge;
|
|
63
|
+
export default Lozenge; // Lozenge colors
|
|
64
|
+
|
|
65
|
+
var backgroundColors = {
|
|
66
|
+
bold: {
|
|
67
|
+
default: ['neutral.bold', N500],
|
|
68
|
+
inprogress: ['information.bold', B400],
|
|
69
|
+
moved: ['warning.bold', Y500],
|
|
70
|
+
new: ['discovery.bold', P400],
|
|
71
|
+
removed: ['danger.bold', R400],
|
|
72
|
+
success: ['success.bold', G400]
|
|
73
|
+
},
|
|
74
|
+
subtle: {
|
|
75
|
+
default: ['neutral', N40],
|
|
76
|
+
inprogress: ['information', B50],
|
|
77
|
+
moved: ['warning', Y75],
|
|
78
|
+
new: ['discovery', P50],
|
|
79
|
+
removed: ['danger', R50],
|
|
80
|
+
success: ['success', G50]
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var textColors = {
|
|
84
|
+
bold: {
|
|
85
|
+
default: ['inverse', N0],
|
|
86
|
+
inprogress: ['inverse', N0],
|
|
87
|
+
moved: ['warning.inverse', N800],
|
|
88
|
+
new: ['inverse', N0],
|
|
89
|
+
removed: ['inverse', N0],
|
|
90
|
+
success: ['inverse', N0]
|
|
91
|
+
},
|
|
92
|
+
subtle: {
|
|
93
|
+
default: ['color.text', N500],
|
|
94
|
+
inprogress: ['information', B500],
|
|
95
|
+
moved: ['warning', N800],
|
|
96
|
+
new: ['discovery', P500],
|
|
97
|
+
removed: ['danger', R500],
|
|
98
|
+
success: ['success', G500]
|
|
99
|
+
}
|
|
100
|
+
};
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/lozenge",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "A lozenge is a visual indicator used to highlight an item's status for quick recognition.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@atlaskit/codemod-utils": "^4.1.0",
|
|
28
|
-
"@atlaskit/
|
|
29
|
-
"@atlaskit/
|
|
28
|
+
"@atlaskit/ds-explorations": "^0.1.0",
|
|
29
|
+
"@atlaskit/theme": "^12.2.0",
|
|
30
30
|
"@babel/runtime": "^7.0.0",
|
|
31
31
|
"@emotion/core": "^10.0.9"
|
|
32
32
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@atlaskit/button": "*",
|
|
38
38
|
"@atlaskit/docs": "*",
|
|
39
|
-
"@atlaskit/section-message": "^6.
|
|
39
|
+
"@atlaskit/section-message": "^6.2.0",
|
|
40
40
|
"@atlaskit/ssr": "*",
|
|
41
41
|
"@atlaskit/visual-regression": "*",
|
|
42
42
|
"@atlaskit/webdriver-runner": "*",
|
|
@@ -58,7 +58,10 @@
|
|
|
58
58
|
"static",
|
|
59
59
|
"emotion"
|
|
60
60
|
],
|
|
61
|
-
"ui-components":
|
|
61
|
+
"ui-components": [
|
|
62
|
+
"primitives",
|
|
63
|
+
"lite-mode"
|
|
64
|
+
],
|
|
62
65
|
"analytics": "analytics-next",
|
|
63
66
|
"theming": "tokens",
|
|
64
67
|
"deprecation": "no-deprecated-imports"
|