@atlaskit/lozenge 11.3.0 → 11.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/lozenge
2
2
 
3
+ ## 11.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`25e09731caa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/25e09731caa) - Fixes:
8
+
9
+ - Removes `vertical-align: baseline` from Lozenge which was being applied incorrectly.
10
+ - Removes a default prop which was causing unintended re-renders.
11
+
12
+ - Updated dependencies
13
+
14
+ ## 11.3.1
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 11.3.0
4
21
 
5
22
  ### Minor Changes
@@ -7,23 +7,21 @@ import {
7
7
  getJSXAttributesByName,
8
8
  } from '@atlaskit/codemod-utils';
9
9
 
10
- export const createRemoveFuncWithDefaultSpecifierFor = (
11
- component: string,
12
- prop: string,
13
- comment?: string,
14
- ) => (j: core.JSCodeshift, source: Collection<Node>) => {
15
- const specifier = getDefaultSpecifier(j, source, component);
10
+ export const createRemoveFuncWithDefaultSpecifierFor =
11
+ (component: string, prop: string, comment?: string) =>
12
+ (j: core.JSCodeshift, source: Collection<Node>) => {
13
+ const specifier = getDefaultSpecifier(j, source, component);
16
14
 
17
- if (!specifier) {
18
- return;
19
- }
15
+ if (!specifier) {
16
+ return;
17
+ }
20
18
 
21
- source.findJSXElements(specifier).forEach((element) => {
22
- getJSXAttributesByName(j, element, prop).forEach((attribute: any) => {
23
- if (comment) {
24
- addCommentToStartOfFile({ j, base: source, message: comment });
25
- }
26
- j(attribute).remove();
19
+ source.findJSXElements(specifier).forEach((element) => {
20
+ getJSXAttributesByName(j, element, prop).forEach((attribute: any) => {
21
+ if (comment) {
22
+ addCommentToStartOfFile({ j, base: source, message: comment });
23
+ }
24
+ j(attribute).remove();
25
+ });
27
26
  });
28
- });
29
- };
27
+ };
@@ -41,8 +41,7 @@ var Lozenge = /*#__PURE__*/(0, _react.memo)(function (_ref) {
41
41
  appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
42
42
  _ref$maxWidth = _ref.maxWidth,
43
43
  maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
44
- _ref$style = _ref.style,
45
- style = _ref$style === void 0 ? {} : _ref$style;
44
+ style = _ref.style;
46
45
  var appearanceStyle = isBold ? 'bold' : 'subtle';
47
46
  var appearanceType = appearance in backgroundColors[appearanceStyle] ? appearance : 'default';
48
47
  var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
@@ -54,13 +53,12 @@ var Lozenge = /*#__PURE__*/(0, _react.memo)(function (_ref) {
54
53
  paddingInline: "scale.050",
55
54
  position: "static",
56
55
  testId: testId,
56
+ overflow: "hidden",
57
57
  UNSAFE_style: {
58
- backgroundColor: style.backgroundColor,
59
- verticalAlign: 'baseline',
58
+ backgroundColor: style === null || style === void 0 ? void 0 : style.backgroundColor,
60
59
  maxWidth: '100%'
61
60
  }
62
61
  }, /*#__PURE__*/_react.default.createElement(_text.default, {
63
- as: "span",
64
62
  fontSize: "11px",
65
63
  fontWeight: "700",
66
64
  lineHeight: "16px",
@@ -68,11 +66,9 @@ var Lozenge = /*#__PURE__*/(0, _react.memo)(function (_ref) {
68
66
  color: textColors[appearanceStyle][appearanceType],
69
67
  shouldTruncate: true,
70
68
  UNSAFE_style: {
71
- color: style.color,
72
- width: '100%',
73
- // eslint-disable-next-line @atlaskit/design-system/no-unsafe-design-token-usage
74
- maxWidth: "calc(".concat(maxWidthValue, " - ", "var(--ds-scale-100, 8px)", ")") // to negate paddingInline specified on Box above
75
-
69
+ color: style === null || style === void 0 ? void 0 : style.color,
70
+ // to negate paddingInline specified on Box above
71
+ maxWidth: "calc(".concat(maxWidthValue, " - ", "var(--ds-space-100, 8px)", ")")
76
72
  },
77
73
  testId: testId && "".concat(testId, "--text")
78
74
  }, children));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/lozenge",
3
- "version": "11.3.0",
3
+ "version": "11.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -20,7 +20,7 @@ const Lozenge = /*#__PURE__*/memo(({
20
20
  isBold = false,
21
21
  appearance = 'default',
22
22
  maxWidth = 200,
23
- style = {}
23
+ style
24
24
  }) => {
25
25
  const appearanceStyle = isBold ? 'bold' : 'subtle';
26
26
  const appearanceType = appearance in backgroundColors[appearanceStyle] ? appearance : 'default';
@@ -33,13 +33,12 @@ const Lozenge = /*#__PURE__*/memo(({
33
33
  paddingInline: "scale.050",
34
34
  position: "static",
35
35
  testId: testId,
36
+ overflow: "hidden",
36
37
  UNSAFE_style: {
37
- backgroundColor: style.backgroundColor,
38
- verticalAlign: 'baseline',
38
+ backgroundColor: style === null || style === void 0 ? void 0 : style.backgroundColor,
39
39
  maxWidth: '100%'
40
40
  }
41
41
  }, /*#__PURE__*/React.createElement(Text, {
42
- as: "span",
43
42
  fontSize: "11px",
44
43
  fontWeight: "700",
45
44
  lineHeight: "16px",
@@ -47,11 +46,9 @@ const Lozenge = /*#__PURE__*/memo(({
47
46
  color: textColors[appearanceStyle][appearanceType],
48
47
  shouldTruncate: true,
49
48
  UNSAFE_style: {
50
- color: style.color,
51
- width: '100%',
52
- // eslint-disable-next-line @atlaskit/design-system/no-unsafe-design-token-usage
53
- maxWidth: `calc(${maxWidthValue} - ${"var(--ds-scale-100, 8px)"})` // to negate paddingInline specified on Box above
54
-
49
+ color: style === null || style === void 0 ? void 0 : style.color,
50
+ // to negate paddingInline specified on Box above
51
+ maxWidth: `calc(${maxWidthValue} - ${"var(--ds-space-100, 8px)"})`
55
52
  },
56
53
  testId: testId && `${testId}--text`
57
54
  }, children));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/lozenge",
3
- "version": "11.3.0",
3
+ "version": "11.3.2",
4
4
  "sideEffects": false
5
5
  }
@@ -23,8 +23,7 @@ var Lozenge = /*#__PURE__*/memo(function (_ref) {
23
23
  appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
24
24
  _ref$maxWidth = _ref.maxWidth,
25
25
  maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
26
- _ref$style = _ref.style,
27
- style = _ref$style === void 0 ? {} : _ref$style;
26
+ style = _ref.style;
28
27
  var appearanceStyle = isBold ? 'bold' : 'subtle';
29
28
  var appearanceType = appearance in backgroundColors[appearanceStyle] ? appearance : 'default';
30
29
  var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
@@ -36,13 +35,12 @@ var Lozenge = /*#__PURE__*/memo(function (_ref) {
36
35
  paddingInline: "scale.050",
37
36
  position: "static",
38
37
  testId: testId,
38
+ overflow: "hidden",
39
39
  UNSAFE_style: {
40
- backgroundColor: style.backgroundColor,
41
- verticalAlign: 'baseline',
40
+ backgroundColor: style === null || style === void 0 ? void 0 : style.backgroundColor,
42
41
  maxWidth: '100%'
43
42
  }
44
43
  }, /*#__PURE__*/React.createElement(Text, {
45
- as: "span",
46
44
  fontSize: "11px",
47
45
  fontWeight: "700",
48
46
  lineHeight: "16px",
@@ -50,11 +48,9 @@ var Lozenge = /*#__PURE__*/memo(function (_ref) {
50
48
  color: textColors[appearanceStyle][appearanceType],
51
49
  shouldTruncate: true,
52
50
  UNSAFE_style: {
53
- color: style.color,
54
- width: '100%',
55
- // eslint-disable-next-line @atlaskit/design-system/no-unsafe-design-token-usage
56
- maxWidth: "calc(".concat(maxWidthValue, " - ", "var(--ds-scale-100, 8px)", ")") // to negate paddingInline specified on Box above
57
-
51
+ color: style === null || style === void 0 ? void 0 : style.color,
52
+ // to negate paddingInline specified on Box above
53
+ maxWidth: "calc(".concat(maxWidthValue, " - ", "var(--ds-space-100, 8px)", ")")
58
54
  },
59
55
  testId: testId && "".concat(testId, "--text")
60
56
  }, children));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/lozenge",
3
- "version": "11.3.0",
3
+ "version": "11.3.2",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/lozenge",
3
- "version": "11.3.0",
3
+ "version": "11.3.2",
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/"
@@ -12,14 +12,6 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
- "typesVersions": {
16
- ">=4.0 <4.5": {
17
- "*": [
18
- "dist/types-ts4.0/*",
19
- "dist/types-ts4.0/index.d.ts"
20
- ]
21
- }
22
- },
23
15
  "sideEffects": false,
24
16
  "atlaskit:src": "src/index.tsx",
25
17
  "atlassian": {
@@ -34,9 +26,9 @@
34
26
  },
35
27
  "dependencies": {
36
28
  "@atlaskit/codemod-utils": "^4.1.0",
37
- "@atlaskit/ds-explorations": "^1.0.0",
29
+ "@atlaskit/ds-explorations": "^1.6.0",
38
30
  "@atlaskit/theme": "^12.2.0",
39
- "@atlaskit/tokens": "^0.10.20",
31
+ "@atlaskit/tokens": "^0.11.0",
40
32
  "@babel/runtime": "^7.0.0"
41
33
  },
42
34
  "peerDependencies": {
package/report.api.md CHANGED
@@ -15,14 +15,16 @@ import { MemoExoticComponent } from 'react';
15
15
  import { ReactNode } from 'react';
16
16
 
17
17
  // @public
18
- const Lozenge: MemoExoticComponent<({
19
- children,
20
- testId,
21
- isBold,
22
- appearance,
23
- maxWidth,
24
- style,
25
- }: LozengeProps) => jsx.JSX.Element>;
18
+ const Lozenge: MemoExoticComponent<
19
+ ({
20
+ children,
21
+ testId,
22
+ isBold,
23
+ appearance,
24
+ maxWidth,
25
+ style,
26
+ }: LozengeProps) => jsx.JSX.Element
27
+ >;
26
28
  export default Lozenge;
27
29
 
28
30
  // @public (undocumented)
@@ -1,41 +0,0 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
- export declare type ThemeAppearance = 'default' | 'inprogress' | 'moved' | 'new' | 'removed' | 'success';
3
- export interface LozengeProps {
4
- /**
5
- * The appearance type.
6
- */
7
- appearance?: ThemeAppearance;
8
- /**
9
- * Elements to be rendered inside the lozenge. This should ideally be just a word or two.
10
- */
11
- children?: ReactNode;
12
- /**
13
- * Determines whether to apply the bold style or not.
14
- */
15
- isBold?: boolean;
16
- /**
17
- * max-width of lozenge container. Default to 200px.
18
- */
19
- maxWidth?: number | string;
20
- /**
21
- * Style customization to apply to the badge. Only `backgroundColor` and `color` are supported.
22
- */
23
- style?: Pick<CSSProperties, 'backgroundColor' | 'color'>;
24
- /**
25
- * A `testId` prop is provided for specified elements, which is a unique
26
- * string that appears as a data attribute `data-testid` in the rendered code,
27
- * serving as a hook for automated tests
28
- */
29
- testId?: string;
30
- }
31
- /**
32
- * __Lozenge__
33
- *
34
- * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
35
- *
36
- * - [Examples](https://atlassian.design/components/lozenge/examples)
37
- * - [Code](https://atlassian.design/components/lozenge/code)
38
- * - [Usage](https://atlassian.design/components/lozenge/usage)
39
- */
40
- declare const Lozenge: React.MemoExoticComponent<({ children, testId, isBold, appearance, maxWidth, style, }: LozengeProps) => JSX.Element>;
41
- export default Lozenge;
@@ -1,2 +0,0 @@
1
- export { default } from './Lozenge';
2
- export type { ThemeAppearance } from './Lozenge';
@@ -1,120 +0,0 @@
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';