@atlaskit/lozenge 11.1.2

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.
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _core = require("@emotion/core");
11
+
12
+ var _colors = require("@atlaskit/theme/colors");
13
+
14
+ var _constants = require("@atlaskit/theme/constants");
15
+
16
+ var _tokens = require("@atlaskit/tokens");
17
+
18
+ /** @jsx jsx */
19
+ var defaultAppearanceStyles = (0, _core.css)({
20
+ backgroundColor: (0, _tokens.token)('color.background.subtleNeutral.resting', _colors.N40),
21
+ color: (0, _tokens.token)('color.text.highEmphasis', _colors.N500)
22
+ });
23
+ var inprogressAppearanceStyles = (0, _core.css)({
24
+ backgroundColor: (0, _tokens.token)('color.background.subtleBrand.resting', _colors.B50),
25
+ color: (0, _tokens.token)('color.text.brand', _colors.B500)
26
+ });
27
+ var movedAppearanceStyles = (0, _core.css)({
28
+ backgroundColor: (0, _tokens.token)('color.background.subtleWarning.resting', _colors.Y75),
29
+ color: (0, _tokens.token)('color.text.warning', _colors.N800)
30
+ });
31
+ var newAppearanceStyles = (0, _core.css)({
32
+ backgroundColor: (0, _tokens.token)('color.background.subtleDiscovery.resting', _colors.P50),
33
+ color: (0, _tokens.token)('color.text.discovery', _colors.P500)
34
+ });
35
+ var removedAppearanceStyles = (0, _core.css)({
36
+ backgroundColor: (0, _tokens.token)('color.background.subtleDanger.resting', _colors.R50),
37
+ color: (0, _tokens.token)('color.text.danger', _colors.R500)
38
+ });
39
+ var successAppearanceStyles = (0, _core.css)({
40
+ backgroundColor: (0, _tokens.token)('color.background.subtleSuccess.resting', _colors.G50),
41
+ color: (0, _tokens.token)('color.text.success', _colors.G500)
42
+ });
43
+ var defaultBoldAppearanceStyles = (0, _core.css)({
44
+ backgroundColor: (0, _tokens.token)('color.background.boldNeutral.resting', _colors.N500),
45
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0)
46
+ });
47
+ var inprogressBoldAppearanceStyles = (0, _core.css)({
48
+ backgroundColor: (0, _tokens.token)('color.background.boldBrand.resting', _colors.B400),
49
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0)
50
+ });
51
+ var movedBoldAppearanceStyles = (0, _core.css)({
52
+ backgroundColor: (0, _tokens.token)('color.background.boldWarning.resting', _colors.Y500),
53
+ color: (0, _tokens.token)('color.text.onBoldWarning', _colors.N800)
54
+ });
55
+ var newBoldAppearanceStyles = (0, _core.css)({
56
+ backgroundColor: (0, _tokens.token)('color.background.boldDiscovery.resting', _colors.P400),
57
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0)
58
+ });
59
+ var removedBoldAppearanceStyles = (0, _core.css)({
60
+ backgroundColor: (0, _tokens.token)('color.background.boldDanger.resting', _colors.R400),
61
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0)
62
+ });
63
+ var successBoldAppearanceStyles = (0, _core.css)({
64
+ backgroundColor: (0, _tokens.token)('color.background.boldSuccess.resting', _colors.G400),
65
+ color: (0, _tokens.token)('color.text.onBold', _colors.N0)
66
+ });
67
+ var subtleAppearances = {
68
+ default: defaultAppearanceStyles,
69
+ inprogress: inprogressAppearanceStyles,
70
+ moved: movedAppearanceStyles,
71
+ new: newAppearanceStyles,
72
+ removed: removedAppearanceStyles,
73
+ success: successAppearanceStyles
74
+ };
75
+ var boldAppearances = {
76
+ default: defaultBoldAppearanceStyles,
77
+ inprogress: inprogressBoldAppearanceStyles,
78
+ moved: movedBoldAppearanceStyles,
79
+ new: newBoldAppearanceStyles,
80
+ removed: removedBoldAppearanceStyles,
81
+ success: successBoldAppearanceStyles
82
+ };
83
+ var contentStyles = (0, _core.css)({
84
+ display: 'inline-block',
85
+ boxSizing: 'border-box',
86
+ width: '100%',
87
+ padding: "0 ".concat((0, _constants.gridSize)() / 2, "px"),
88
+ overflow: 'hidden',
89
+ textOverflow: 'ellipsis',
90
+ verticalAlign: 'top',
91
+ whiteSpace: 'nowrap'
92
+ });
93
+ var containerStyles = (0, _core.css)({
94
+ display: 'inline-block',
95
+ boxSizing: 'border-box',
96
+ maxWidth: '100%',
97
+ padding: '2px 0 3px 0',
98
+ borderRadius: (0, _constants.borderRadius)(),
99
+ fontSize: '11px',
100
+ fontWeight: 700,
101
+ lineHeight: 1,
102
+ textTransform: 'uppercase',
103
+ verticalAlign: 'baseline'
104
+ });
105
+ /**
106
+ * __Lozenge__
107
+ *
108
+ * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
109
+ *
110
+ * - [Examples](https://atlassian.design/components/lozenge/examples)
111
+ * - [Code](https://atlassian.design/components/lozenge/code)
112
+ * - [Usage](https://atlassian.design/components/lozenge/usage)
113
+ */
114
+
115
+ var Lozenge = /*#__PURE__*/(0, _react.memo)(function (_ref) {
116
+ var children = _ref.children,
117
+ testId = _ref.testId,
118
+ _ref$isBold = _ref.isBold,
119
+ isBold = _ref$isBold === void 0 ? false : _ref$isBold,
120
+ _ref$appearance = _ref.appearance,
121
+ appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
122
+ _ref$maxWidth = _ref.maxWidth,
123
+ maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
124
+ _ref$style = _ref.style,
125
+ style = _ref$style === void 0 ? {} : _ref$style;
126
+ return (0, _core.jsx)("span", {
127
+ style: {
128
+ backgroundColor: style.backgroundColor,
129
+ color: style.color
130
+ },
131
+ css: [isBold ? boldAppearances[appearance] : subtleAppearances[appearance], containerStyles],
132
+ "data-testid": testId
133
+ }, (0, _core.jsx)("span", {
134
+ style: {
135
+ maxWidth: maxWidth
136
+ },
137
+ css: contentStyles
138
+ }, children));
139
+ });
140
+ Lozenge.displayName = 'Lozenge';
141
+ var _default = Lozenge;
142
+ exports.default = _default;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "default", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _Lozenge.default;
12
+ }
13
+ });
14
+
15
+ var _Lozenge = _interopRequireDefault(require("./Lozenge"));
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.boldTextColor = exports.boldBackgroundColor = exports.defaultTextColor = exports.defaultBackgroundColor = void 0;
7
+
8
+ var _colors = require("@atlaskit/theme/colors");
9
+
10
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
11
+ // TODO: DSP-1392 this file will be removed, don't import anything from this file elsewhere.
12
+
13
+ /**
14
+ * @deprecated
15
+ */
16
+ var defaultBackgroundColor = {
17
+ default: {
18
+ light: _colors.N40,
19
+ dark: _colors.N40
20
+ },
21
+ inprogress: {
22
+ light: _colors.B50,
23
+ dark: _colors.B50
24
+ },
25
+ moved: {
26
+ light: _colors.Y75,
27
+ dark: _colors.Y75
28
+ },
29
+ new: {
30
+ light: _colors.P50,
31
+ dark: _colors.P50
32
+ },
33
+ removed: {
34
+ light: _colors.R50,
35
+ dark: _colors.R50
36
+ },
37
+ success: {
38
+ light: _colors.G50,
39
+ dark: _colors.G50
40
+ }
41
+ };
42
+ /**
43
+ * @deprecated
44
+ */
45
+
46
+ exports.defaultBackgroundColor = defaultBackgroundColor;
47
+ var defaultTextColor = {
48
+ default: {
49
+ light: _colors.N500,
50
+ dark: _colors.N500
51
+ },
52
+ inprogress: {
53
+ light: _colors.B500,
54
+ dark: _colors.B500
55
+ },
56
+ moved: {
57
+ light: _colors.N800,
58
+ dark: _colors.N800
59
+ },
60
+ new: {
61
+ light: _colors.P500,
62
+ dark: _colors.P500
63
+ },
64
+ removed: {
65
+ light: _colors.R500,
66
+ dark: _colors.R500
67
+ },
68
+ success: {
69
+ light: _colors.G500,
70
+ dark: _colors.G500
71
+ }
72
+ };
73
+ /**
74
+ * @deprecated
75
+ */
76
+
77
+ exports.defaultTextColor = defaultTextColor;
78
+ var boldBackgroundColor = {
79
+ default: {
80
+ light: _colors.N500,
81
+ dark: _colors.N500
82
+ },
83
+ inprogress: {
84
+ light: _colors.B400,
85
+ dark: _colors.B400
86
+ },
87
+ moved: {
88
+ light: _colors.Y500,
89
+ dark: _colors.Y500
90
+ },
91
+ new: {
92
+ light: _colors.P400,
93
+ dark: _colors.P400
94
+ },
95
+ removed: {
96
+ light: _colors.R400,
97
+ dark: _colors.R400
98
+ },
99
+ success: {
100
+ light: _colors.G400,
101
+ dark: _colors.G400
102
+ }
103
+ };
104
+ /**
105
+ * @deprecated
106
+ */
107
+
108
+ exports.boldBackgroundColor = boldBackgroundColor;
109
+ var boldTextColor = {
110
+ default: {
111
+ light: _colors.N0,
112
+ dark: _colors.N0
113
+ },
114
+ inprogress: {
115
+ light: _colors.N0,
116
+ dark: _colors.N0
117
+ },
118
+ moved: {
119
+ light: _colors.N800,
120
+ dark: _colors.N800
121
+ },
122
+ new: {
123
+ light: _colors.N0,
124
+ dark: _colors.N0
125
+ },
126
+ removed: {
127
+ light: _colors.N0,
128
+ dark: _colors.N0
129
+ },
130
+ success: {
131
+ light: _colors.N0,
132
+ dark: _colors.N0
133
+ }
134
+ };
135
+ /**
136
+ * @deprecated
137
+ */
138
+
139
+ exports.boldTextColor = boldTextColor;
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@atlaskit/lozenge",
3
+ "version": "11.1.2",
4
+ "sideEffects": false
5
+ }
@@ -0,0 +1,124 @@
1
+ /** @jsx jsx */
2
+ import { memo } from 'react';
3
+ import { css, jsx } from '@emotion/core';
4
+ import { B400, B50, B500, G400, G50, G500, N0, N40, N500, N800, P400, P50, P500, R400, R50, R500, Y500, Y75 } from '@atlaskit/theme/colors';
5
+ import { borderRadius, gridSize } from '@atlaskit/theme/constants';
6
+ import { token } from '@atlaskit/tokens';
7
+ const defaultAppearanceStyles = css({
8
+ backgroundColor: token('color.background.subtleNeutral.resting', N40),
9
+ color: token('color.text.highEmphasis', N500)
10
+ });
11
+ const inprogressAppearanceStyles = css({
12
+ backgroundColor: token('color.background.subtleBrand.resting', B50),
13
+ color: token('color.text.brand', B500)
14
+ });
15
+ const movedAppearanceStyles = css({
16
+ backgroundColor: token('color.background.subtleWarning.resting', Y75),
17
+ color: token('color.text.warning', N800)
18
+ });
19
+ const newAppearanceStyles = css({
20
+ backgroundColor: token('color.background.subtleDiscovery.resting', P50),
21
+ color: token('color.text.discovery', P500)
22
+ });
23
+ const removedAppearanceStyles = css({
24
+ backgroundColor: token('color.background.subtleDanger.resting', R50),
25
+ color: token('color.text.danger', R500)
26
+ });
27
+ const successAppearanceStyles = css({
28
+ backgroundColor: token('color.background.subtleSuccess.resting', G50),
29
+ color: token('color.text.success', G500)
30
+ });
31
+ const defaultBoldAppearanceStyles = css({
32
+ backgroundColor: token('color.background.boldNeutral.resting', N500),
33
+ color: token('color.text.onBold', N0)
34
+ });
35
+ const inprogressBoldAppearanceStyles = css({
36
+ backgroundColor: token('color.background.boldBrand.resting', B400),
37
+ color: token('color.text.onBold', N0)
38
+ });
39
+ const movedBoldAppearanceStyles = css({
40
+ backgroundColor: token('color.background.boldWarning.resting', Y500),
41
+ color: token('color.text.onBoldWarning', N800)
42
+ });
43
+ const newBoldAppearanceStyles = css({
44
+ backgroundColor: token('color.background.boldDiscovery.resting', P400),
45
+ color: token('color.text.onBold', N0)
46
+ });
47
+ const removedBoldAppearanceStyles = css({
48
+ backgroundColor: token('color.background.boldDanger.resting', R400),
49
+ color: token('color.text.onBold', N0)
50
+ });
51
+ const successBoldAppearanceStyles = css({
52
+ backgroundColor: token('color.background.boldSuccess.resting', G400),
53
+ color: token('color.text.onBold', N0)
54
+ });
55
+ const subtleAppearances = {
56
+ default: defaultAppearanceStyles,
57
+ inprogress: inprogressAppearanceStyles,
58
+ moved: movedAppearanceStyles,
59
+ new: newAppearanceStyles,
60
+ removed: removedAppearanceStyles,
61
+ success: successAppearanceStyles
62
+ };
63
+ const boldAppearances = {
64
+ default: defaultBoldAppearanceStyles,
65
+ inprogress: inprogressBoldAppearanceStyles,
66
+ moved: movedBoldAppearanceStyles,
67
+ new: newBoldAppearanceStyles,
68
+ removed: removedBoldAppearanceStyles,
69
+ success: successBoldAppearanceStyles
70
+ };
71
+ const contentStyles = css({
72
+ display: 'inline-block',
73
+ boxSizing: 'border-box',
74
+ width: '100%',
75
+ padding: `0 ${gridSize() / 2}px`,
76
+ overflow: 'hidden',
77
+ textOverflow: 'ellipsis',
78
+ verticalAlign: 'top',
79
+ whiteSpace: 'nowrap'
80
+ });
81
+ const containerStyles = css({
82
+ display: 'inline-block',
83
+ boxSizing: 'border-box',
84
+ maxWidth: '100%',
85
+ padding: '2px 0 3px 0',
86
+ borderRadius: borderRadius(),
87
+ fontSize: '11px',
88
+ fontWeight: 700,
89
+ lineHeight: 1,
90
+ textTransform: 'uppercase',
91
+ verticalAlign: 'baseline'
92
+ });
93
+ /**
94
+ * __Lozenge__
95
+ *
96
+ * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
97
+ *
98
+ * - [Examples](https://atlassian.design/components/lozenge/examples)
99
+ * - [Code](https://atlassian.design/components/lozenge/code)
100
+ * - [Usage](https://atlassian.design/components/lozenge/usage)
101
+ */
102
+
103
+ const Lozenge = /*#__PURE__*/memo(({
104
+ children,
105
+ testId,
106
+ isBold = false,
107
+ appearance = 'default',
108
+ maxWidth = 200,
109
+ style = {}
110
+ }) => jsx("span", {
111
+ style: {
112
+ backgroundColor: style.backgroundColor,
113
+ color: style.color
114
+ },
115
+ css: [isBold ? boldAppearances[appearance] : subtleAppearances[appearance], containerStyles],
116
+ "data-testid": testId
117
+ }, jsx("span", {
118
+ style: {
119
+ maxWidth
120
+ },
121
+ css: contentStyles
122
+ }, children)));
123
+ Lozenge.displayName = 'Lozenge';
124
+ export default Lozenge;
@@ -0,0 +1 @@
1
+ export { default } from './Lozenge';
@@ -0,0 +1,126 @@
1
+ /* eslint-disable @atlaskit/design-system/ensure-design-token-usage */
2
+ // TODO: DSP-1392 this file will be removed, don't import anything from this file elsewhere.
3
+ import { B400, B50, B500, G400, G50, G500, N0, N40, N500, N800, P400, P50, P500, R400, R50, R500, Y500, Y75 } from '@atlaskit/theme/colors';
4
+ /**
5
+ * @deprecated
6
+ */
7
+
8
+ export const defaultBackgroundColor = {
9
+ default: {
10
+ light: N40,
11
+ dark: N40
12
+ },
13
+ inprogress: {
14
+ light: B50,
15
+ dark: B50
16
+ },
17
+ moved: {
18
+ light: Y75,
19
+ dark: Y75
20
+ },
21
+ new: {
22
+ light: P50,
23
+ dark: P50
24
+ },
25
+ removed: {
26
+ light: R50,
27
+ dark: R50
28
+ },
29
+ success: {
30
+ light: G50,
31
+ dark: G50
32
+ }
33
+ };
34
+ /**
35
+ * @deprecated
36
+ */
37
+
38
+ export const defaultTextColor = {
39
+ default: {
40
+ light: N500,
41
+ dark: N500
42
+ },
43
+ inprogress: {
44
+ light: B500,
45
+ dark: B500
46
+ },
47
+ moved: {
48
+ light: N800,
49
+ dark: N800
50
+ },
51
+ new: {
52
+ light: P500,
53
+ dark: P500
54
+ },
55
+ removed: {
56
+ light: R500,
57
+ dark: R500
58
+ },
59
+ success: {
60
+ light: G500,
61
+ dark: G500
62
+ }
63
+ };
64
+ /**
65
+ * @deprecated
66
+ */
67
+
68
+ export const boldBackgroundColor = {
69
+ default: {
70
+ light: N500,
71
+ dark: N500
72
+ },
73
+ inprogress: {
74
+ light: B400,
75
+ dark: B400
76
+ },
77
+ moved: {
78
+ light: Y500,
79
+ dark: Y500
80
+ },
81
+ new: {
82
+ light: P400,
83
+ dark: P400
84
+ },
85
+ removed: {
86
+ light: R400,
87
+ dark: R400
88
+ },
89
+ success: {
90
+ light: G400,
91
+ dark: G400
92
+ }
93
+ };
94
+ /**
95
+ * @deprecated
96
+ */
97
+
98
+ export const boldTextColor = {
99
+ default: {
100
+ light: N0,
101
+ dark: N0
102
+ },
103
+ inprogress: {
104
+ light: N0,
105
+ dark: N0
106
+ },
107
+ moved: {
108
+ light: N800,
109
+ dark: N800
110
+ },
111
+ new: {
112
+ light: N0,
113
+ dark: N0
114
+ },
115
+ removed: {
116
+ light: N0,
117
+ dark: N0
118
+ },
119
+ success: {
120
+ light: N0,
121
+ dark: N0
122
+ }
123
+ };
124
+ /**
125
+ * @deprecated
126
+ */