@atlaskit/lozenge 13.4.0 → 13.4.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.
@@ -1,4 +1,5 @@
1
1
  /* lozenge-dropdown-trigger.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import * as React from 'react';
3
4
  import { ax, ix } from "@compiled/react/runtime";
4
5
  import { forwardRef, memo } from 'react';
@@ -24,8 +25,12 @@ var LozengeDropdownTrigger = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function
24
25
  _ref$spacing = _ref.spacing,
25
26
  spacing = _ref$spacing === void 0 ? 'default' : _ref$spacing,
26
27
  iconBefore = _ref.iconBefore,
28
+ trailingMetric = _ref.trailingMetric,
29
+ trailingMetricAppearance = _ref.trailingMetricAppearance,
27
30
  _ref$isSelected = _ref.isSelected,
28
31
  isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
32
+ _ref$isLoading = _ref.isLoading,
33
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
29
34
  _ref$maxWidth = _ref.maxWidth,
30
35
  maxWidth = _ref$maxWidth === void 0 ? 200 : _ref$maxWidth,
31
36
  _ref$onClick = _ref.onClick,
@@ -33,21 +38,25 @@ var LozengeDropdownTrigger = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function
33
38
  style = _ref.style,
34
39
  analyticsContext = _ref.analyticsContext,
35
40
  interactionName = _ref.interactionName;
36
- return /*#__PURE__*/React.createElement(LozengeBase, {
37
- ref: ref,
41
+ var baseProps = {
38
42
  appearance: appearance,
39
43
  spacing: spacing,
40
44
  iconBefore: iconBefore,
45
+ trailingMetric: trailingMetric,
46
+ trailingMetricAppearance: trailingMetricAppearance,
41
47
  isSelected: isSelected,
42
- maxWidth: maxWidth
43
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
44
- ,
48
+ isLoading: isLoading,
49
+ maxWidth: maxWidth,
45
50
  style: style,
46
51
  testId: testId,
47
52
  onClick: onClick,
48
53
  analyticsContext: analyticsContext,
49
- interactionName: interactionName
50
- }, children);
54
+ interactionName: interactionName,
55
+ children: children
56
+ };
57
+ return /*#__PURE__*/React.createElement(LozengeBase, _extends({
58
+ ref: ref
59
+ }, baseProps), children);
51
60
  }));
52
61
  LozengeDropdownTrigger.displayName = 'LozengeDropdownTrigger';
53
62
  export default LozengeDropdownTrigger;
@@ -21,17 +21,21 @@ var Lozenge = function Lozenge(_ref) {
21
21
  style = _ref.style,
22
22
  testId = _ref.testId,
23
23
  children = _ref.children,
24
- iconBefore = _ref.iconBefore;
25
- return /*#__PURE__*/React.createElement(LozengeBase, {
24
+ iconBefore = _ref.iconBefore,
25
+ trailingMetric = _ref.trailingMetric,
26
+ trailingMetricAppearance = _ref.trailingMetricAppearance;
27
+ var baseProps = {
26
28
  appearance: appearance,
27
29
  spacing: spacing,
28
30
  iconBefore: iconBefore,
29
- maxWidth: maxWidth
30
- // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
31
- ,
31
+ trailingMetric: trailingMetric,
32
+ trailingMetricAppearance: trailingMetricAppearance,
33
+ maxWidth: maxWidth,
32
34
  style: style,
33
- testId: testId
34
- }, children);
35
+ testId: testId,
36
+ children: children
37
+ };
38
+ return /*#__PURE__*/React.createElement(LozengeBase, baseProps, children);
35
39
  };
36
40
  Lozenge.displayName = 'Lozenge';
37
41
  export default Lozenge;
@@ -1,4 +1,4 @@
1
1
  export { default } from './lozenge';
2
2
  export type { ThemeAppearance, LozengeProps } from './lozenge';
3
3
  export { default as LozengeDropdownTrigger } from './new/lozenge-dropdown-trigger';
4
- export type { NewLozengeProps, LozengeColor as NewLozengeColor, LozengeDropdownTriggerProps, LozengeSpacing, } from './new/types';
4
+ export type { NewLozengeProps, LozengeColor as NewLozengeColor, LozengeDropdownTriggerProps, LozengeSpacing, SemanticColor, AccentColor, } from './new/types';
@@ -9,10 +9,6 @@ export interface IconRendererProps {
9
9
  * The lozenge color to determine icon color
10
10
  */
11
11
  color: LozengeColor;
12
- /**
13
- * Whether the lozenge is in a selected state
14
- */
15
- isSelected?: boolean;
16
12
  /**
17
13
  * Test ID for the icon
18
14
  */
@@ -26,5 +22,5 @@ export interface IconRendererProps {
26
22
  * Icon renderer for lozenge components
27
23
  * Handles proper sizing and color theming for icons
28
24
  */
29
- export declare const IconRenderer: ({ icon: Icon, color, isSelected, testId, size, }: IconRendererProps) => React.JSX.Element;
25
+ export declare const IconRenderer: ({ icon: Icon, color, testId, size }: IconRendererProps) => React.JSX.Element;
30
26
  export default IconRenderer;
@@ -3,15 +3,15 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { type Ref } from 'react';
6
- import { type LozengeDropdownTriggerProps, type NewLozengeProps } from './types';
7
- interface LozengeBaseProps extends NewLozengeProps, LozengeDropdownTriggerProps {
6
+ import { type LozengeBaseProps } from './types';
7
+ type LozengeBasePropsWithRef = LozengeBaseProps & {
8
8
  ref?: Ref<HTMLElement | HTMLButtonElement>;
9
- }
9
+ };
10
10
  /**
11
11
  * __New Lozenge__
12
12
  *
13
13
  * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
14
14
  * This is the updated version with the new North Star visual language.
15
15
  */
16
- declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<LozengeBaseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement | HTMLElement>>>;
16
+ declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<LozengeBasePropsWithRef, "ref"> & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>>;
17
17
  export default LozengeBase;
@@ -9,7 +9,7 @@ import { type NewLozengeProps } from './types';
9
9
  * - [Usage](https://atlassian.design/components/lozenge/usage)
10
10
  */
11
11
  declare const Lozenge: {
12
- ({ appearance, spacing, maxWidth, style, testId, children, iconBefore, }: NewLozengeProps): JSX.Element;
12
+ ({ appearance, spacing, maxWidth, style, testId, children, iconBefore, trailingMetric, trailingMetricAppearance, }: NewLozengeProps): JSX.Element;
13
13
  displayName: string;
14
14
  };
15
15
  export default Lozenge;
@@ -22,12 +22,7 @@ export type IconProp = ComponentType<Omit<NewIconProps, 'spacing'>>;
22
22
  * Props for the NewLozenge component
23
23
  */
24
24
  export type LozengeSpacing = 'default' | 'spacious';
25
- export interface NewLozengeProps {
26
- /**
27
- * The appearance of the lozenge. Supports both legacy semantic appearances and new accent/semantic colors.
28
- * Legacy appearances (default, success, removed, inprogress, new, moved) are automatically mapped to the new semantic colors.
29
- */
30
- appearance?: ThemeAppearance | LozengeColor;
25
+ type NewLozengeBaseProps = {
31
26
  /**
32
27
  * Elements to be rendered inside the lozenge. This should ideally be just a word or two.
33
28
  */
@@ -62,15 +57,69 @@ export interface NewLozengeProps {
62
57
  * @deprecated This prop is deprecated and will be removed. Use Tag component for non-bold styles.
63
58
  */
64
59
  isBold?: boolean;
65
- }
60
+ };
61
+ type NewLozengeSemanticProps = NewLozengeBaseProps & {
62
+ /**
63
+ * The appearance of the lozenge. Supports legacy semantic appearances and new semantic colors.
64
+ */
65
+ appearance?: ThemeAppearance | SemanticColor;
66
+ /**
67
+ * Numeric metric displayed at the end of the lozenge as a badge.
68
+ */
69
+ trailingMetric?: string;
70
+ /**
71
+ * Overrides the appearance of the trailing metric badge.
72
+ *
73
+ * If not specified, the trailing metric badge inherits the lozenge appearance.
74
+ *
75
+ * This prop is not supported for accent lozenges.
76
+ */
77
+ trailingMetricAppearance?: ThemeAppearance | SemanticColor | 'inverse';
78
+ };
79
+ type NewLozengeAccentProps = NewLozengeBaseProps & {
80
+ /**
81
+ * Accent appearance values.
82
+ */
83
+ appearance: AccentColor;
84
+ /**
85
+ * Trailing metric is not supported for accent lozenges.
86
+ */
87
+ trailingMetric?: never;
88
+ /**
89
+ * Trailing metric appearance is not supported for accent lozenges.
90
+ */
91
+ trailingMetricAppearance?: never;
92
+ };
93
+ export type NewLozengeProps = NewLozengeSemanticProps | NewLozengeAccentProps;
94
+ /**
95
+ * Props for LozengeBase (internal). A single merged type so that Lozenge and
96
+ * LozengeDropdownTrigger can pass their props without union narrowing requiring
97
+ * appearance to match only one branch (AccentColor vs ThemeAppearance | SemanticColor).
98
+ * Must not intersect with LozengeDropdownTriggerProps (which extends NewLozengeProps union).
99
+ */
100
+ export type LozengeBaseProps = NewLozengeBaseProps & {
101
+ appearance?: ThemeAppearance | SemanticColor | AccentColor;
102
+ trailingMetric?: string;
103
+ trailingMetricAppearance?: ThemeAppearance | SemanticColor | 'inverse';
104
+ isSelected?: boolean;
105
+ isLoading?: boolean;
106
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
107
+ analyticsContext?: Record<string, any>;
108
+ interactionName?: string;
109
+ };
66
110
  /**
67
111
  * Props for the LozengeDropdownTrigger component
68
112
  */
69
- export interface LozengeDropdownTriggerProps extends NewLozengeProps {
113
+ export type LozengeDropdownTriggerProps = NewLozengeProps & {
70
114
  /**
71
115
  * Whether the dropdown is currently selected/open.
72
116
  */
73
117
  isSelected?: boolean;
118
+ /**
119
+ * Whether the dropdown trigger is in a loading state.
120
+ * When true, a spinner is shown and the trigger becomes non-interactive.
121
+ */
122
+ isLoading?: boolean;
74
123
  /**
75
124
  * Callback fired when the trigger is clicked. The second argument provides an Atlaskit UI analytics event that can be fired to a listening channel. See the [analytics-next documentation](https://atlaskit.atlassian.com/packages/analytics/analytics-next) for more information.
76
125
  */
@@ -83,4 +132,5 @@ export interface LozengeDropdownTriggerProps extends NewLozengeProps {
83
132
  * An optional name used to identify events for React UFO (Unified Frontend Observability) press interactions. For more information, see [React UFO integration](https://go.atlassian.com/react-ufo-dst-integration).
84
133
  */
85
134
  interactionName?: string;
86
- }
135
+ };
136
+ export {};
@@ -1,4 +1,4 @@
1
1
  export { default } from './lozenge';
2
2
  export type { ThemeAppearance, LozengeProps } from './lozenge';
3
3
  export { default as LozengeDropdownTrigger } from './new/lozenge-dropdown-trigger';
4
- export type { NewLozengeProps, LozengeColor as NewLozengeColor, LozengeDropdownTriggerProps, LozengeSpacing, } from './new/types';
4
+ export type { NewLozengeProps, LozengeColor as NewLozengeColor, LozengeDropdownTriggerProps, LozengeSpacing, SemanticColor, AccentColor, } from './new/types';
@@ -9,10 +9,6 @@ export interface IconRendererProps {
9
9
  * The lozenge color to determine icon color
10
10
  */
11
11
  color: LozengeColor;
12
- /**
13
- * Whether the lozenge is in a selected state
14
- */
15
- isSelected?: boolean;
16
12
  /**
17
13
  * Test ID for the icon
18
14
  */
@@ -26,5 +22,5 @@ export interface IconRendererProps {
26
22
  * Icon renderer for lozenge components
27
23
  * Handles proper sizing and color theming for icons
28
24
  */
29
- export declare const IconRenderer: ({ icon: Icon, color, isSelected, testId, size, }: IconRendererProps) => React.JSX.Element;
25
+ export declare const IconRenderer: ({ icon: Icon, color, testId, size }: IconRendererProps) => React.JSX.Element;
30
26
  export default IconRenderer;
@@ -3,15 +3,15 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { type Ref } from 'react';
6
- import { type LozengeDropdownTriggerProps, type NewLozengeProps } from './types';
7
- interface LozengeBaseProps extends NewLozengeProps, LozengeDropdownTriggerProps {
6
+ import { type LozengeBaseProps } from './types';
7
+ type LozengeBasePropsWithRef = LozengeBaseProps & {
8
8
  ref?: Ref<HTMLElement | HTMLButtonElement>;
9
- }
9
+ };
10
10
  /**
11
11
  * __New Lozenge__
12
12
  *
13
13
  * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
14
14
  * This is the updated version with the new North Star visual language.
15
15
  */
16
- declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<LozengeBaseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement | HTMLElement>>>;
16
+ declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<LozengeBasePropsWithRef, "ref"> & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>>;
17
17
  export default LozengeBase;
@@ -9,7 +9,7 @@ import { type NewLozengeProps } from './types';
9
9
  * - [Usage](https://atlassian.design/components/lozenge/usage)
10
10
  */
11
11
  declare const Lozenge: {
12
- ({ appearance, spacing, maxWidth, style, testId, children, iconBefore, }: NewLozengeProps): JSX.Element;
12
+ ({ appearance, spacing, maxWidth, style, testId, children, iconBefore, trailingMetric, trailingMetricAppearance, }: NewLozengeProps): JSX.Element;
13
13
  displayName: string;
14
14
  };
15
15
  export default Lozenge;
@@ -22,12 +22,7 @@ export type IconProp = ComponentType<Omit<NewIconProps, 'spacing'>>;
22
22
  * Props for the NewLozenge component
23
23
  */
24
24
  export type LozengeSpacing = 'default' | 'spacious';
25
- export interface NewLozengeProps {
26
- /**
27
- * The appearance of the lozenge. Supports both legacy semantic appearances and new accent/semantic colors.
28
- * Legacy appearances (default, success, removed, inprogress, new, moved) are automatically mapped to the new semantic colors.
29
- */
30
- appearance?: ThemeAppearance | LozengeColor;
25
+ type NewLozengeBaseProps = {
31
26
  /**
32
27
  * Elements to be rendered inside the lozenge. This should ideally be just a word or two.
33
28
  */
@@ -62,15 +57,69 @@ export interface NewLozengeProps {
62
57
  * @deprecated This prop is deprecated and will be removed. Use Tag component for non-bold styles.
63
58
  */
64
59
  isBold?: boolean;
65
- }
60
+ };
61
+ type NewLozengeSemanticProps = NewLozengeBaseProps & {
62
+ /**
63
+ * The appearance of the lozenge. Supports legacy semantic appearances and new semantic colors.
64
+ */
65
+ appearance?: ThemeAppearance | SemanticColor;
66
+ /**
67
+ * Numeric metric displayed at the end of the lozenge as a badge.
68
+ */
69
+ trailingMetric?: string;
70
+ /**
71
+ * Overrides the appearance of the trailing metric badge.
72
+ *
73
+ * If not specified, the trailing metric badge inherits the lozenge appearance.
74
+ *
75
+ * This prop is not supported for accent lozenges.
76
+ */
77
+ trailingMetricAppearance?: ThemeAppearance | SemanticColor | 'inverse';
78
+ };
79
+ type NewLozengeAccentProps = NewLozengeBaseProps & {
80
+ /**
81
+ * Accent appearance values.
82
+ */
83
+ appearance: AccentColor;
84
+ /**
85
+ * Trailing metric is not supported for accent lozenges.
86
+ */
87
+ trailingMetric?: never;
88
+ /**
89
+ * Trailing metric appearance is not supported for accent lozenges.
90
+ */
91
+ trailingMetricAppearance?: never;
92
+ };
93
+ export type NewLozengeProps = NewLozengeSemanticProps | NewLozengeAccentProps;
94
+ /**
95
+ * Props for LozengeBase (internal). A single merged type so that Lozenge and
96
+ * LozengeDropdownTrigger can pass their props without union narrowing requiring
97
+ * appearance to match only one branch (AccentColor vs ThemeAppearance | SemanticColor).
98
+ * Must not intersect with LozengeDropdownTriggerProps (which extends NewLozengeProps union).
99
+ */
100
+ export type LozengeBaseProps = NewLozengeBaseProps & {
101
+ appearance?: ThemeAppearance | SemanticColor | AccentColor;
102
+ trailingMetric?: string;
103
+ trailingMetricAppearance?: ThemeAppearance | SemanticColor | 'inverse';
104
+ isSelected?: boolean;
105
+ isLoading?: boolean;
106
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
107
+ analyticsContext?: Record<string, any>;
108
+ interactionName?: string;
109
+ };
66
110
  /**
67
111
  * Props for the LozengeDropdownTrigger component
68
112
  */
69
- export interface LozengeDropdownTriggerProps extends NewLozengeProps {
113
+ export type LozengeDropdownTriggerProps = NewLozengeProps & {
70
114
  /**
71
115
  * Whether the dropdown is currently selected/open.
72
116
  */
73
117
  isSelected?: boolean;
118
+ /**
119
+ * Whether the dropdown trigger is in a loading state.
120
+ * When true, a spinner is shown and the trigger becomes non-interactive.
121
+ */
122
+ isLoading?: boolean;
74
123
  /**
75
124
  * Callback fired when the trigger is clicked. The second argument provides an Atlaskit UI analytics event that can be fired to a listening channel. See the [analytics-next documentation](https://atlaskit.atlassian.com/packages/analytics/analytics-next) for more information.
76
125
  */
@@ -83,4 +132,5 @@ export interface LozengeDropdownTriggerProps extends NewLozengeProps {
83
132
  * An optional name used to identify events for React UFO (Unified Frontend Observability) press interactions. For more information, see [React UFO integration](https://go.atlassian.com/react-ufo-dst-integration).
84
133
  */
85
134
  interactionName?: string;
86
- }
135
+ };
136
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/lozenge",
3
- "version": "13.4.0",
3
+ "version": "13.4.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/"
@@ -50,11 +50,13 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@atlaskit/analytics-next": "^11.1.0",
53
+ "@atlaskit/badge": "^18.4.0",
53
54
  "@atlaskit/css": "^0.19.0",
54
55
  "@atlaskit/ds-lib": "^5.3.0",
55
56
  "@atlaskit/icon": "^30.0.0",
56
57
  "@atlaskit/platform-feature-flags": "^1.1.0",
57
58
  "@atlaskit/primitives": "^18.0.0",
59
+ "@atlaskit/spinner": "^19.0.0",
58
60
  "@atlaskit/tokens": "^11.0.0",
59
61
  "@babel/runtime": "^7.0.0",
60
62
  "@compiled/react": "^0.18.6"
@@ -68,7 +70,7 @@
68
70
  "@af/visual-regression": "workspace:^",
69
71
  "@atlaskit/docs": "^11.3.0",
70
72
  "@atlaskit/dropdown-menu": "^16.4.0",
71
- "@atlaskit/heading": "^5.2.0",
73
+ "@atlaskit/heading": "^5.3.0",
72
74
  "@atlaskit/link": "^3.3.0",
73
75
  "@atlaskit/section-message": "^8.12.0",
74
76
  "@atlassian/feature-flags-test-utils": "^1.0.0",