@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,5 @@
1
+ {
2
+ "name": "@atlaskit/lozenge",
3
+ "version": "11.1.2",
4
+ "sideEffects": false
5
+ }
@@ -0,0 +1,129 @@
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
+ var defaultAppearanceStyles = css({
8
+ backgroundColor: token('color.background.subtleNeutral.resting', N40),
9
+ color: token('color.text.highEmphasis', N500)
10
+ });
11
+ var inprogressAppearanceStyles = css({
12
+ backgroundColor: token('color.background.subtleBrand.resting', B50),
13
+ color: token('color.text.brand', B500)
14
+ });
15
+ var movedAppearanceStyles = css({
16
+ backgroundColor: token('color.background.subtleWarning.resting', Y75),
17
+ color: token('color.text.warning', N800)
18
+ });
19
+ var newAppearanceStyles = css({
20
+ backgroundColor: token('color.background.subtleDiscovery.resting', P50),
21
+ color: token('color.text.discovery', P500)
22
+ });
23
+ var removedAppearanceStyles = css({
24
+ backgroundColor: token('color.background.subtleDanger.resting', R50),
25
+ color: token('color.text.danger', R500)
26
+ });
27
+ var successAppearanceStyles = css({
28
+ backgroundColor: token('color.background.subtleSuccess.resting', G50),
29
+ color: token('color.text.success', G500)
30
+ });
31
+ var defaultBoldAppearanceStyles = css({
32
+ backgroundColor: token('color.background.boldNeutral.resting', N500),
33
+ color: token('color.text.onBold', N0)
34
+ });
35
+ var inprogressBoldAppearanceStyles = css({
36
+ backgroundColor: token('color.background.boldBrand.resting', B400),
37
+ color: token('color.text.onBold', N0)
38
+ });
39
+ var movedBoldAppearanceStyles = css({
40
+ backgroundColor: token('color.background.boldWarning.resting', Y500),
41
+ color: token('color.text.onBoldWarning', N800)
42
+ });
43
+ var newBoldAppearanceStyles = css({
44
+ backgroundColor: token('color.background.boldDiscovery.resting', P400),
45
+ color: token('color.text.onBold', N0)
46
+ });
47
+ var removedBoldAppearanceStyles = css({
48
+ backgroundColor: token('color.background.boldDanger.resting', R400),
49
+ color: token('color.text.onBold', N0)
50
+ });
51
+ var successBoldAppearanceStyles = css({
52
+ backgroundColor: token('color.background.boldSuccess.resting', G400),
53
+ color: token('color.text.onBold', N0)
54
+ });
55
+ var subtleAppearances = {
56
+ default: defaultAppearanceStyles,
57
+ inprogress: inprogressAppearanceStyles,
58
+ moved: movedAppearanceStyles,
59
+ new: newAppearanceStyles,
60
+ removed: removedAppearanceStyles,
61
+ success: successAppearanceStyles
62
+ };
63
+ var boldAppearances = {
64
+ default: defaultBoldAppearanceStyles,
65
+ inprogress: inprogressBoldAppearanceStyles,
66
+ moved: movedBoldAppearanceStyles,
67
+ new: newBoldAppearanceStyles,
68
+ removed: removedBoldAppearanceStyles,
69
+ success: successBoldAppearanceStyles
70
+ };
71
+ var contentStyles = css({
72
+ display: 'inline-block',
73
+ boxSizing: 'border-box',
74
+ width: '100%',
75
+ padding: "0 ".concat(gridSize() / 2, "px"),
76
+ overflow: 'hidden',
77
+ textOverflow: 'ellipsis',
78
+ verticalAlign: 'top',
79
+ whiteSpace: 'nowrap'
80
+ });
81
+ var 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
+ var Lozenge = /*#__PURE__*/memo(function (_ref) {
104
+ var children = _ref.children,
105
+ testId = _ref.testId,
106
+ _ref$isBold = _ref.isBold,
107
+ isBold = _ref$isBold === void 0 ? false : _ref$isBold,
108
+ _ref$appearance = _ref.appearance,
109
+ appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
110
+ _ref$maxWidth = _ref.maxWidth,
111
+ maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
112
+ _ref$style = _ref.style,
113
+ style = _ref$style === void 0 ? {} : _ref$style;
114
+ return jsx("span", {
115
+ style: {
116
+ backgroundColor: style.backgroundColor,
117
+ color: style.color
118
+ },
119
+ css: [isBold ? boldAppearances[appearance] : subtleAppearances[appearance], containerStyles],
120
+ "data-testid": testId
121
+ }, jsx("span", {
122
+ style: {
123
+ maxWidth: maxWidth
124
+ },
125
+ css: contentStyles
126
+ }, children));
127
+ });
128
+ Lozenge.displayName = 'Lozenge';
129
+ 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 var 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 var 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 var 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 var 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
+ */
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "@atlaskit/lozenge",
3
+ "version": "11.1.2",
4
+ "sideEffects": false
5
+ }
@@ -0,0 +1,42 @@
1
+ /** @jsx jsx */
2
+ import { CSSProperties, ReactNode } from 'react';
3
+ export declare type ThemeAppearance = 'default' | 'inprogress' | 'moved' | 'new' | 'removed' | 'success';
4
+ export interface LozengeProps {
5
+ /**
6
+ * The appearance type.
7
+ */
8
+ appearance?: ThemeAppearance;
9
+ /**
10
+ * Elements to be rendered inside the lozenge. This should ideally be just a word or two.
11
+ */
12
+ children?: ReactNode;
13
+ /**
14
+ * Determines whether to apply the bold style or not.
15
+ */
16
+ isBold?: boolean;
17
+ /**
18
+ * max-width of lozenge container. Default to 200px.
19
+ */
20
+ maxWidth?: number | string;
21
+ /**
22
+ * Style customization to apply to the badge. Only `backgroundColor` and `color` are supported.
23
+ */
24
+ style?: Pick<CSSProperties, 'backgroundColor' | 'color'>;
25
+ /**
26
+ * A `testId` prop is provided for specified elements, which is a unique
27
+ * string that appears as a data attribute `data-testid` in the rendered code,
28
+ * serving as a hook for automated tests
29
+ */
30
+ testId?: string;
31
+ }
32
+ /**
33
+ * __Lozenge__
34
+ *
35
+ * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
36
+ *
37
+ * - [Examples](https://atlassian.design/components/lozenge/examples)
38
+ * - [Code](https://atlassian.design/components/lozenge/code)
39
+ * - [Usage](https://atlassian.design/components/lozenge/usage)
40
+ */
41
+ declare const Lozenge: import("react").MemoExoticComponent<({ children, testId, isBold, appearance, maxWidth, style, }: LozengeProps) => JSX.Element>;
42
+ export default Lozenge;
@@ -0,0 +1,2 @@
1
+ export { default } from './Lozenge';
2
+ export type { ThemeAppearance } from './Lozenge';
@@ -0,0 +1,120 @@
1
+ /**
2
+ * @deprecated
3
+ */
4
+ export declare const defaultBackgroundColor: {
5
+ default: {
6
+ light: string;
7
+ dark: string;
8
+ };
9
+ inprogress: {
10
+ light: string;
11
+ dark: string;
12
+ };
13
+ moved: {
14
+ light: string;
15
+ dark: string;
16
+ };
17
+ new: {
18
+ light: string;
19
+ dark: string;
20
+ };
21
+ removed: {
22
+ light: string;
23
+ dark: string;
24
+ };
25
+ success: {
26
+ light: string;
27
+ dark: string;
28
+ };
29
+ };
30
+ /**
31
+ * @deprecated
32
+ */
33
+ export declare const defaultTextColor: {
34
+ default: {
35
+ light: string;
36
+ dark: string;
37
+ };
38
+ inprogress: {
39
+ light: string;
40
+ dark: string;
41
+ };
42
+ moved: {
43
+ light: string;
44
+ dark: string;
45
+ };
46
+ new: {
47
+ light: string;
48
+ dark: string;
49
+ };
50
+ removed: {
51
+ light: string;
52
+ dark: string;
53
+ };
54
+ success: {
55
+ light: string;
56
+ dark: string;
57
+ };
58
+ };
59
+ /**
60
+ * @deprecated
61
+ */
62
+ export declare const boldBackgroundColor: {
63
+ default: {
64
+ light: string;
65
+ dark: string;
66
+ };
67
+ inprogress: {
68
+ light: string;
69
+ dark: string;
70
+ };
71
+ moved: {
72
+ light: string;
73
+ dark: string;
74
+ };
75
+ new: {
76
+ light: string;
77
+ dark: string;
78
+ };
79
+ removed: {
80
+ light: string;
81
+ dark: string;
82
+ };
83
+ success: {
84
+ light: string;
85
+ dark: string;
86
+ };
87
+ };
88
+ /**
89
+ * @deprecated
90
+ */
91
+ export declare const boldTextColor: {
92
+ default: {
93
+ light: string;
94
+ dark: string;
95
+ };
96
+ inprogress: {
97
+ light: string;
98
+ dark: string;
99
+ };
100
+ moved: {
101
+ light: string;
102
+ dark: string;
103
+ };
104
+ new: {
105
+ light: string;
106
+ dark: string;
107
+ };
108
+ removed: {
109
+ light: string;
110
+ dark: string;
111
+ };
112
+ success: {
113
+ light: string;
114
+ dark: string;
115
+ };
116
+ };
117
+ /**
118
+ * @deprecated
119
+ */
120
+ export declare type ThemeAppearance = 'default' | 'inprogress' | 'moved' | 'new' | 'removed' | 'success';
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@atlaskit/lozenge",
3
+ "version": "11.1.2",
4
+ "description": "A lozenge is a visual indicator used to highlight an item's status for quick recognition.",
5
+ "publishConfig": {
6
+ "registry": "https://registry.npmjs.org/"
7
+ },
8
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend",
9
+ "author": "Atlassian Pty Ltd",
10
+ "license": "Apache-2.0",
11
+ "main": "dist/cjs/index.js",
12
+ "module": "dist/esm/index.js",
13
+ "module:es2019": "dist/es2019/index.js",
14
+ "types": "dist/types/index.d.ts",
15
+ "sideEffects": false,
16
+ "atlaskit:src": "src/index.tsx",
17
+ "atlassian": {
18
+ "team": "Design System Team",
19
+ "deprecatedAutoEntryPoints": true,
20
+ "inPublicMirror": true,
21
+ "releaseModel": "scheduled",
22
+ "website": {
23
+ "name": "Lozenge"
24
+ }
25
+ },
26
+ "dependencies": {
27
+ "@atlaskit/codemod-utils": "^3.4.0",
28
+ "@atlaskit/theme": "^12.0.0",
29
+ "@atlaskit/tokens": "^0.2.0",
30
+ "@babel/runtime": "^7.0.0",
31
+ "@emotion/core": "^10.0.9"
32
+ },
33
+ "peerDependencies": {
34
+ "react": "^16.8.0"
35
+ },
36
+ "devDependencies": {
37
+ "@atlaskit/build-utils": "*",
38
+ "@atlaskit/button": "*",
39
+ "@atlaskit/docs": "*",
40
+ "@atlaskit/section-message": "^6.1.0",
41
+ "@atlaskit/ssr": "*",
42
+ "@atlaskit/visual-regression": "*",
43
+ "@atlaskit/webdriver-runner": "*",
44
+ "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
45
+ "@testing-library/react": "^8.0.1",
46
+ "jscodeshift": "^0.13.0",
47
+ "react-dom": "^16.8.0",
48
+ "typescript": "3.9.6",
49
+ "wait-for-expect": "^1.2.0"
50
+ },
51
+ "techstack": {
52
+ "@atlassian/frontend": {
53
+ "import-structure": "atlassian-conventions"
54
+ },
55
+ "@repo/internal": {
56
+ "design-system": "v1",
57
+ "styling": "emotion",
58
+ "ui-components": "lite-mode",
59
+ "analytics": "analytics-next",
60
+ "theming": "tokens",
61
+ "deprecation": "no-deprecated-imports"
62
+ }
63
+ },
64
+ "homepage": "https://atlassian.design/components/lozenge/",
65
+ "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
66
+ }