@atlaskit/lozenge 13.2.2 → 13.3.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 +8 -0
- package/dist/cjs/lozenge.js +16 -2
- package/dist/cjs/new/lozenge.js +0 -1
- package/dist/es2019/lozenge.js +16 -2
- package/dist/es2019/new/lozenge.js +0 -1
- package/dist/esm/lozenge.js +16 -2
- package/dist/esm/new/lozenge.js +0 -1
- package/dist/types/new/lozenge-base.d.ts +9 -1
- package/dist/types/new/types.d.ts +1 -27
- package/dist/types-ts4.5/new/lozenge-base.d.ts +9 -1
- package/dist/types-ts4.5/new/types.d.ts +1 -27
- package/lozenge-dropdown-trigger/package.json +17 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/lozenge
|
|
2
2
|
|
|
3
|
+
## 13.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`3f338c9019166`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3f338c9019166) -
|
|
8
|
+
Added “./lozenge-dropdown-trigger” entrypoint. Mapped the new semantic values to the existing
|
|
9
|
+
appearance to ensure backward compatibility.
|
|
10
|
+
|
|
3
11
|
## 13.2.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/lozenge.js
CHANGED
|
@@ -44,7 +44,21 @@ var styles = {
|
|
|
44
44
|
'text.subtle': "_syazi7uo",
|
|
45
45
|
'text.bold': "_syazwwip"
|
|
46
46
|
};
|
|
47
|
-
var appearanceTypes = ['default', 'inprogress', 'moved', 'new', 'removed'
|
|
47
|
+
var appearanceTypes = ['default', 'inprogress', 'moved', 'new', 'removed'];
|
|
48
|
+
var newSemanticColors = ['success', 'discovery', 'warning', 'danger', 'information', 'neutral'];
|
|
49
|
+
var appearanceMapping = {
|
|
50
|
+
neutral: 'default',
|
|
51
|
+
default: 'default',
|
|
52
|
+
information: 'inprogress',
|
|
53
|
+
inprogress: 'inprogress',
|
|
54
|
+
warning: 'moved',
|
|
55
|
+
moved: 'moved',
|
|
56
|
+
removed: 'removed',
|
|
57
|
+
danger: 'removed',
|
|
58
|
+
success: 'success',
|
|
59
|
+
discovery: 'new',
|
|
60
|
+
new: 'new'
|
|
61
|
+
};
|
|
48
62
|
/**
|
|
49
63
|
* __Lozenge__
|
|
50
64
|
*
|
|
@@ -66,7 +80,7 @@ var LegacyLozenge = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
|
66
80
|
style = _ref.style;
|
|
67
81
|
var appearanceStyle = isBold ? 'bold' : 'subtle';
|
|
68
82
|
var appearanceType = (0, _react.useMemo)(function () {
|
|
69
|
-
return appearanceTypes.includes(appearance) ? appearance : 'default';
|
|
83
|
+
return appearanceTypes.includes(appearance) || newSemanticColors.includes(appearance) ? appearanceMapping[appearance] : 'default';
|
|
70
84
|
}, [appearance]);
|
|
71
85
|
var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
|
|
72
86
|
var maxWidthIsPc = typeof maxWidth === 'string' && /%$/.test(maxWidth);
|
package/dist/cjs/new/lozenge.js
CHANGED
|
@@ -32,7 +32,6 @@ var Lozenge = function Lozenge(_ref) {
|
|
|
32
32
|
return /*#__PURE__*/React.createElement(_lozengeBase.default, {
|
|
33
33
|
appearance: appearance,
|
|
34
34
|
iconBefore: iconBefore,
|
|
35
|
-
isInteractive: true,
|
|
36
35
|
maxWidth: maxWidth
|
|
37
36
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
38
37
|
,
|
package/dist/es2019/lozenge.js
CHANGED
|
@@ -35,7 +35,21 @@ const styles = {
|
|
|
35
35
|
'text.subtle': "_syazi7uo",
|
|
36
36
|
'text.bold': "_syazwwip"
|
|
37
37
|
};
|
|
38
|
-
const appearanceTypes = ['default', 'inprogress', 'moved', 'new', 'removed'
|
|
38
|
+
const appearanceTypes = ['default', 'inprogress', 'moved', 'new', 'removed'];
|
|
39
|
+
const newSemanticColors = ['success', 'discovery', 'warning', 'danger', 'information', 'neutral'];
|
|
40
|
+
const appearanceMapping = {
|
|
41
|
+
neutral: 'default',
|
|
42
|
+
default: 'default',
|
|
43
|
+
information: 'inprogress',
|
|
44
|
+
inprogress: 'inprogress',
|
|
45
|
+
warning: 'moved',
|
|
46
|
+
moved: 'moved',
|
|
47
|
+
removed: 'removed',
|
|
48
|
+
danger: 'removed',
|
|
49
|
+
success: 'success',
|
|
50
|
+
discovery: 'new',
|
|
51
|
+
new: 'new'
|
|
52
|
+
};
|
|
39
53
|
/**
|
|
40
54
|
* __Lozenge__
|
|
41
55
|
*
|
|
@@ -54,7 +68,7 @@ const LegacyLozenge = /*#__PURE__*/memo(({
|
|
|
54
68
|
style
|
|
55
69
|
}) => {
|
|
56
70
|
const appearanceStyle = isBold ? 'bold' : 'subtle';
|
|
57
|
-
const appearanceType = useMemo(() => appearanceTypes.includes(appearance) ? appearance : 'default', [appearance]);
|
|
71
|
+
const appearanceType = useMemo(() => appearanceTypes.includes(appearance) || newSemanticColors.includes(appearance) ? appearanceMapping[appearance] : 'default', [appearance]);
|
|
58
72
|
const maxWidthValue = typeof maxWidth === 'string' ? maxWidth : `${maxWidth}px`;
|
|
59
73
|
const maxWidthIsPc = typeof maxWidth === 'string' && /%$/.test(maxWidth);
|
|
60
74
|
return /*#__PURE__*/React.createElement("span", {
|
package/dist/esm/lozenge.js
CHANGED
|
@@ -35,7 +35,21 @@ var styles = {
|
|
|
35
35
|
'text.subtle': "_syazi7uo",
|
|
36
36
|
'text.bold': "_syazwwip"
|
|
37
37
|
};
|
|
38
|
-
var appearanceTypes = ['default', 'inprogress', 'moved', 'new', 'removed'
|
|
38
|
+
var appearanceTypes = ['default', 'inprogress', 'moved', 'new', 'removed'];
|
|
39
|
+
var newSemanticColors = ['success', 'discovery', 'warning', 'danger', 'information', 'neutral'];
|
|
40
|
+
var appearanceMapping = {
|
|
41
|
+
neutral: 'default',
|
|
42
|
+
default: 'default',
|
|
43
|
+
information: 'inprogress',
|
|
44
|
+
inprogress: 'inprogress',
|
|
45
|
+
warning: 'moved',
|
|
46
|
+
moved: 'moved',
|
|
47
|
+
removed: 'removed',
|
|
48
|
+
danger: 'removed',
|
|
49
|
+
success: 'success',
|
|
50
|
+
discovery: 'new',
|
|
51
|
+
new: 'new'
|
|
52
|
+
};
|
|
39
53
|
/**
|
|
40
54
|
* __Lozenge__
|
|
41
55
|
*
|
|
@@ -57,7 +71,7 @@ var LegacyLozenge = /*#__PURE__*/memo(function (_ref) {
|
|
|
57
71
|
style = _ref.style;
|
|
58
72
|
var appearanceStyle = isBold ? 'bold' : 'subtle';
|
|
59
73
|
var appearanceType = useMemo(function () {
|
|
60
|
-
return appearanceTypes.includes(appearance) ? appearance : 'default';
|
|
74
|
+
return appearanceTypes.includes(appearance) || newSemanticColors.includes(appearance) ? appearanceMapping[appearance] : 'default';
|
|
61
75
|
}, [appearance]);
|
|
62
76
|
var maxWidthValue = typeof maxWidth === 'string' ? maxWidth : "".concat(maxWidth, "px");
|
|
63
77
|
var maxWidthIsPc = typeof maxWidth === 'string' && /%$/.test(maxWidth);
|
package/dist/esm/new/lozenge.js
CHANGED
|
@@ -23,7 +23,6 @@ var Lozenge = function Lozenge(_ref) {
|
|
|
23
23
|
return /*#__PURE__*/React.createElement(LozengeBase, {
|
|
24
24
|
appearance: appearance,
|
|
25
25
|
iconBefore: iconBefore,
|
|
26
|
-
isInteractive: true,
|
|
27
26
|
maxWidth: maxWidth
|
|
28
27
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
29
28
|
,
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type Ref } from 'react';
|
|
1
6
|
import { type LozengeDropdownTriggerProps, type NewLozengeProps } from './types';
|
|
7
|
+
interface LozengeBaseProps extends NewLozengeProps, LozengeDropdownTriggerProps {
|
|
8
|
+
ref?: Ref<HTMLElement | HTMLButtonElement>;
|
|
9
|
+
}
|
|
2
10
|
/**
|
|
3
11
|
* __New Lozenge__
|
|
4
12
|
*
|
|
5
13
|
* A lozenge is a visual indicator used to highlight an item's status for quick recognition.
|
|
6
14
|
* This is the updated version with the new North Star visual language.
|
|
7
15
|
*/
|
|
8
|
-
declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<
|
|
16
|
+
declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<LozengeBaseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement | HTMLElement>>>;
|
|
9
17
|
export default LozengeBase;
|
|
@@ -35,16 +35,6 @@ export interface NewLozengeProps {
|
|
|
35
35
|
* Icon to display before the text content. Should be an ADS icon component.
|
|
36
36
|
*/
|
|
37
37
|
iconBefore?: IconProp;
|
|
38
|
-
/**
|
|
39
|
-
* Whether the lozenge is interactive (dropdown trigger). Only used internally.
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
isInteractive?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Whether the lozenge is selected (for dropdown triggers). Only used internally.
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
isSelected?: boolean;
|
|
48
38
|
/**
|
|
49
39
|
* max-width of lozenge container. Default to 200px.
|
|
50
40
|
*/
|
|
@@ -54,22 +44,6 @@ export interface NewLozengeProps {
|
|
|
54
44
|
* @deprecated This prop is deprecated and will be removed in a future version.
|
|
55
45
|
*/
|
|
56
46
|
style?: Pick<CSSProperties, 'backgroundColor' | 'color'>;
|
|
57
|
-
/**
|
|
58
|
-
* Callback fired when the lozenge is clicked (only for interactive lozenges).
|
|
59
|
-
* The second argument provides an Atlaskit UI analytics event.
|
|
60
|
-
* @internal
|
|
61
|
-
*/
|
|
62
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
63
|
-
/**
|
|
64
|
-
* Additional information to be included in the `context` of Atlaskit analytics events.
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
analyticsContext?: Record<string, any>;
|
|
68
|
-
/**
|
|
69
|
-
* An optional name used to identify events for React UFO press interactions.
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
interactionName?: string;
|
|
73
47
|
/**
|
|
74
48
|
* A `testId` prop is provided for specified elements, which is a unique
|
|
75
49
|
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
@@ -84,7 +58,7 @@ export interface NewLozengeProps {
|
|
|
84
58
|
/**
|
|
85
59
|
* Props for the LozengeDropdownTrigger component
|
|
86
60
|
*/
|
|
87
|
-
export interface LozengeDropdownTriggerProps extends
|
|
61
|
+
export interface LozengeDropdownTriggerProps extends NewLozengeProps {
|
|
88
62
|
/**
|
|
89
63
|
* Whether the dropdown is currently selected/open.
|
|
90
64
|
*/
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
import { type Ref } from 'react';
|
|
1
6
|
import { type LozengeDropdownTriggerProps, type NewLozengeProps } from './types';
|
|
7
|
+
interface LozengeBaseProps extends NewLozengeProps, LozengeDropdownTriggerProps {
|
|
8
|
+
ref?: Ref<HTMLElement | HTMLButtonElement>;
|
|
9
|
+
}
|
|
2
10
|
/**
|
|
3
11
|
* __New Lozenge__
|
|
4
12
|
*
|
|
5
13
|
* A lozenge is a visual indicator used to highlight an item's status for quick recognition.
|
|
6
14
|
* This is the updated version with the new North Star visual language.
|
|
7
15
|
*/
|
|
8
|
-
declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<
|
|
16
|
+
declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<LozengeBaseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement | HTMLElement>>>;
|
|
9
17
|
export default LozengeBase;
|
|
@@ -35,16 +35,6 @@ export interface NewLozengeProps {
|
|
|
35
35
|
* Icon to display before the text content. Should be an ADS icon component.
|
|
36
36
|
*/
|
|
37
37
|
iconBefore?: IconProp;
|
|
38
|
-
/**
|
|
39
|
-
* Whether the lozenge is interactive (dropdown trigger). Only used internally.
|
|
40
|
-
* @internal
|
|
41
|
-
*/
|
|
42
|
-
isInteractive?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Whether the lozenge is selected (for dropdown triggers). Only used internally.
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
isSelected?: boolean;
|
|
48
38
|
/**
|
|
49
39
|
* max-width of lozenge container. Default to 200px.
|
|
50
40
|
*/
|
|
@@ -54,22 +44,6 @@ export interface NewLozengeProps {
|
|
|
54
44
|
* @deprecated This prop is deprecated and will be removed in a future version.
|
|
55
45
|
*/
|
|
56
46
|
style?: Pick<CSSProperties, 'backgroundColor' | 'color'>;
|
|
57
|
-
/**
|
|
58
|
-
* Callback fired when the lozenge is clicked (only for interactive lozenges).
|
|
59
|
-
* The second argument provides an Atlaskit UI analytics event.
|
|
60
|
-
* @internal
|
|
61
|
-
*/
|
|
62
|
-
onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
|
|
63
|
-
/**
|
|
64
|
-
* Additional information to be included in the `context` of Atlaskit analytics events.
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
analyticsContext?: Record<string, any>;
|
|
68
|
-
/**
|
|
69
|
-
* An optional name used to identify events for React UFO press interactions.
|
|
70
|
-
* @internal
|
|
71
|
-
*/
|
|
72
|
-
interactionName?: string;
|
|
73
47
|
/**
|
|
74
48
|
* A `testId` prop is provided for specified elements, which is a unique
|
|
75
49
|
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
@@ -84,7 +58,7 @@ export interface NewLozengeProps {
|
|
|
84
58
|
/**
|
|
85
59
|
* Props for the LozengeDropdownTrigger component
|
|
86
60
|
*/
|
|
87
|
-
export interface LozengeDropdownTriggerProps extends
|
|
61
|
+
export interface LozengeDropdownTriggerProps extends NewLozengeProps {
|
|
88
62
|
/**
|
|
89
63
|
* Whether the dropdown is currently selected/open.
|
|
90
64
|
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/lozenge/lozenge-dropdown-trigger",
|
|
3
|
+
"main": "../dist/cjs/new/lozenge-dropdown-trigger.js",
|
|
4
|
+
"module": "../dist/esm/new/lozenge-dropdown-trigger.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/new/lozenge-dropdown-trigger.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/new/lozenge-dropdown-trigger.d.ts",
|
|
10
|
+
"typesVersions": {
|
|
11
|
+
">=4.5 <5.9": {
|
|
12
|
+
"*": [
|
|
13
|
+
"../dist/types-ts4.5/new/lozenge-dropdown-trigger.d.ts"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
CHANGED