@atlaskit/lozenge 13.1.1 → 13.2.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/index.js +8 -1
  3. package/dist/cjs/lozenge.js +19 -6
  4. package/dist/cjs/new/icon-renderer.js +73 -0
  5. package/dist/cjs/new/lozenge-base.compiled.css +153 -0
  6. package/dist/cjs/new/lozenge-base.js +140 -0
  7. package/dist/cjs/new/lozenge-dropdown-trigger.js +59 -0
  8. package/dist/cjs/new/lozenge.js +44 -0
  9. package/dist/cjs/new/types.js +5 -0
  10. package/dist/cjs/new/utils.js +35 -0
  11. package/dist/es2019/index.js +2 -1
  12. package/dist/es2019/lozenge.js +18 -6
  13. package/dist/es2019/new/icon-renderer.js +67 -0
  14. package/dist/es2019/new/lozenge-base.compiled.css +153 -0
  15. package/dist/es2019/new/lozenge-base.js +133 -0
  16. package/dist/es2019/new/lozenge-dropdown-trigger.js +47 -0
  17. package/dist/es2019/new/lozenge.js +34 -0
  18. package/dist/es2019/new/types.js +1 -0
  19. package/dist/es2019/new/utils.js +28 -0
  20. package/dist/esm/index.js +2 -1
  21. package/dist/esm/lozenge.js +18 -6
  22. package/dist/esm/new/icon-renderer.js +66 -0
  23. package/dist/esm/new/lozenge-base.compiled.css +153 -0
  24. package/dist/esm/new/lozenge-base.js +131 -0
  25. package/dist/esm/new/lozenge-dropdown-trigger.js +50 -0
  26. package/dist/esm/new/lozenge.js +35 -0
  27. package/dist/esm/new/types.js +1 -0
  28. package/dist/esm/new/utils.js +29 -0
  29. package/dist/types/index.d.ts +2 -0
  30. package/dist/types/lozenge.d.ts +6 -9
  31. package/dist/types/new/icon-renderer.d.ts +26 -0
  32. package/dist/types/new/lozenge-base.d.ts +9 -0
  33. package/dist/types/new/lozenge-dropdown-trigger.d.ts +15 -0
  34. package/dist/types/new/lozenge.d.ts +15 -0
  35. package/dist/types/new/types.d.ts +104 -0
  36. package/dist/types/new/utils.d.ts +6 -0
  37. package/dist/types-ts4.5/index.d.ts +2 -0
  38. package/dist/types-ts4.5/lozenge.d.ts +6 -9
  39. package/dist/types-ts4.5/new/icon-renderer.d.ts +26 -0
  40. package/dist/types-ts4.5/new/lozenge-base.d.ts +9 -0
  41. package/dist/types-ts4.5/new/lozenge-dropdown-trigger.d.ts +15 -0
  42. package/dist/types-ts4.5/new/lozenge.d.ts +15 -0
  43. package/dist/types-ts4.5/new/types.d.ts +104 -0
  44. package/dist/types-ts4.5/new/utils.d.ts +6 -0
  45. package/package.json +12 -9
@@ -3,6 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { type CSSProperties, type ReactNode } from 'react';
6
+ import { type NewLozengeProps } from './new/types';
6
7
  export type ThemeAppearance = 'default' | 'inprogress' | 'moved' | 'new' | 'removed' | 'success';
7
8
  export interface LozengeProps {
8
9
  /**
@@ -15,6 +16,7 @@ export interface LozengeProps {
15
16
  children?: ReactNode;
16
17
  /**
17
18
  * Determines whether to apply the bold style or not.
19
+ * @deprecated This prop is deprecated and will be removed in an upcoming major release. Use Tag component for non-bold styles.
18
20
  */
19
21
  isBold?: boolean;
20
22
  /**
@@ -23,6 +25,7 @@ export interface LozengeProps {
23
25
  maxWidth?: number | string;
24
26
  /**
25
27
  * Style customization to apply to the badge. Only `backgroundColor` and `color` are supported.
28
+ * @deprecated This prop is deprecated and will be removed in an upcoming major release. Accent colors will be supported through the `appearance` prop in a future release.
26
29
  */
27
30
  style?: Pick<CSSProperties, 'backgroundColor' | 'color'>;
28
31
  /**
@@ -33,13 +36,7 @@ export interface LozengeProps {
33
36
  testId?: string;
34
37
  }
35
38
  /**
36
- * __Lozenge__
37
- *
38
- * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
39
- *
40
- * - [Examples](https://atlassian.design/components/lozenge/examples)
41
- * - [Code](https://atlassian.design/components/lozenge/code)
42
- * - [Usage](https://atlassian.design/components/lozenge/usage)
39
+ * Wrapper component that switches between old and new Lozenge based on feature flag
43
40
  */
44
- declare const Lozenge: import("react").MemoExoticComponent<({ children, testId, isBold, appearance, maxWidth, style, }: LozengeProps) => JSX.Element>;
45
- export default Lozenge;
41
+ declare const LozengeWrapper: import("react").MemoExoticComponent<(props: LozengeProps | NewLozengeProps) => JSX.Element>;
42
+ export default LozengeWrapper;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { type IconProp, type LozengeColor } from './types';
3
+ export interface IconRendererProps {
4
+ /**
5
+ * The icon component to render
6
+ */
7
+ icon: IconProp;
8
+ /**
9
+ * The lozenge color to determine icon color
10
+ */
11
+ color: LozengeColor;
12
+ /**
13
+ * Whether the lozenge is in a selected state
14
+ */
15
+ isSelected?: boolean;
16
+ /**
17
+ * Test ID for the icon
18
+ */
19
+ testId?: string;
20
+ }
21
+ /**
22
+ * Icon renderer for lozenge components
23
+ * Handles proper sizing and color theming for icons
24
+ */
25
+ export declare const IconRenderer: ({ icon: Icon, color, isSelected, testId }: IconRendererProps) => React.JSX.Element;
26
+ export default IconRenderer;
@@ -0,0 +1,9 @@
1
+ import { type LozengeDropdownTriggerProps, type NewLozengeProps } from './types';
2
+ /**
3
+ * __New Lozenge__
4
+ *
5
+ * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
6
+ * This is the updated version with the new North Star visual language.
7
+ */
8
+ declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<(NewLozengeProps | LozengeDropdownTriggerProps) & import("react").RefAttributes<HTMLButtonElement | HTMLElement>>>;
9
+ export default LozengeBase;
@@ -0,0 +1,15 @@
1
+ import { type LozengeDropdownTriggerProps } from './types';
2
+ /**
3
+ * __Lozenge Dropdown Trigger__
4
+ *
5
+ * An interactive lozenge component that acts as a dropdown trigger.
6
+ * Built on LozengeBase with dropdown interaction patterns.
7
+ *
8
+ * - Supports all color variants from the lozenge
9
+ * - Shows selected state with dedicated color tokens
10
+ * - Includes a chevron icon on the right of the text
11
+ * - Built for dropdown menu interactions
12
+ * - Supports analytics events and UFO press interactions
13
+ */
14
+ declare const LozengeDropdownTrigger: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<LozengeDropdownTriggerProps & import("react").RefAttributes<HTMLElement>>>;
15
+ export default LozengeDropdownTrigger;
@@ -0,0 +1,15 @@
1
+ import { type NewLozengeProps } from './types';
2
+ /**
3
+ * __Lozenge__
4
+ *
5
+ * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
6
+ *
7
+ * - [Examples](https://atlassian.design/components/lozenge/examples)
8
+ * - [Code](https://atlassian.design/components/lozenge/code)
9
+ * - [Usage](https://atlassian.design/components/lozenge/usage)
10
+ */
11
+ declare const Lozenge: {
12
+ ({ appearance, maxWidth, style, testId, children, iconBefore, }: NewLozengeProps): JSX.Element;
13
+ displayName: string;
14
+ };
15
+ export default Lozenge;
@@ -0,0 +1,104 @@
1
+ import type { ComponentType, CSSProperties, ReactNode } from 'react';
2
+ import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { type NewIconProps } from '@atlaskit/icon/types';
4
+ import { type ThemeAppearance } from '../lozenge';
5
+ /**
6
+ * Semantic color types for the new lozenge API
7
+ */
8
+ export type SemanticColor = 'success' | 'warning' | 'danger' | 'information' | 'neutral' | 'discovery';
9
+ /**
10
+ * Accent color types for the new lozenge API
11
+ */
12
+ export type AccentColor = 'accent-red' | 'accent-orange' | 'accent-yellow' | 'accent-lime' | 'accent-green' | 'accent-teal' | 'accent-blue' | 'accent-purple' | 'accent-magenta' | 'accent-gray';
13
+ /**
14
+ * Union type of all supported color variants
15
+ */
16
+ export type LozengeColor = SemanticColor | AccentColor;
17
+ /**
18
+ * Icon component prop type
19
+ */
20
+ export type IconProp = ComponentType<Omit<NewIconProps, 'spacing'>>;
21
+ /**
22
+ * Props for the NewLozenge component
23
+ */
24
+ export interface NewLozengeProps {
25
+ /**
26
+ * The appearance of the lozenge. Supports both legacy semantic appearances and new accent/semantic colors.
27
+ * Legacy appearances (default, success, removed, inprogress, new, moved) are automatically mapped to the new semantic colors.
28
+ */
29
+ appearance?: ThemeAppearance | LozengeColor;
30
+ /**
31
+ * Elements to be rendered inside the lozenge. This should ideally be just a word or two.
32
+ */
33
+ children?: ReactNode;
34
+ /**
35
+ * Icon to display before the text content. Should be an ADS icon component.
36
+ */
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
+ /**
49
+ * max-width of lozenge container. Default to 200px.
50
+ */
51
+ maxWidth?: number | string;
52
+ /**
53
+ * Style customization to apply to the lozenge. Only `backgroundColor` and `color` are supported.
54
+ * @deprecated This prop is deprecated and will be removed in a future version.
55
+ */
56
+ 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
+ /**
74
+ * A `testId` prop is provided for specified elements, which is a unique
75
+ * string that appears as a data attribute `data-testid` in the rendered code,
76
+ * serving as a hook for automated tests
77
+ */
78
+ testId?: string;
79
+ /**
80
+ * @deprecated This prop is deprecated and will be removed. Use Tag component for non-bold styles.
81
+ */
82
+ isBold?: boolean;
83
+ }
84
+ /**
85
+ * Props for the LozengeDropdownTrigger component
86
+ */
87
+ export interface LozengeDropdownTriggerProps extends Omit<NewLozengeProps, 'onClick' | 'isInteractive'> {
88
+ /**
89
+ * Whether the dropdown is currently selected/open.
90
+ */
91
+ isSelected?: boolean;
92
+ /**
93
+ * 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.
94
+ */
95
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
96
+ /**
97
+ * Additional information to be included in the `context` of Atlaskit analytics events that come from the lozenge dropdown trigger.
98
+ */
99
+ analyticsContext?: Record<string, any>;
100
+ /**
101
+ * 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).
102
+ */
103
+ interactionName?: string;
104
+ }
@@ -0,0 +1,6 @@
1
+ import { type LozengeColor } from './types';
2
+ export declare const resolveLozengeColor: (appearance?: string) => LozengeColor;
3
+ export declare const getThemeStyles: (resolvedColor: LozengeColor) => {
4
+ category: string;
5
+ key: string;
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/lozenge",
3
- "version": "13.1.1",
3
+ "version": "13.2.0",
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/"
@@ -32,12 +32,13 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/codemod-utils": "^4.2.0",
36
- "@atlaskit/css": "^0.16.0",
35
+ "@atlaskit/analytics-next": "^11.1.0",
36
+ "@atlaskit/css": "^0.17.0",
37
+ "@atlaskit/ds-lib": "^5.3.0",
38
+ "@atlaskit/icon": "^29.1.0",
37
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
- "@atlaskit/primitives": "^16.2.0",
39
- "@atlaskit/theme": "^21.0.0",
40
- "@atlaskit/tokens": "^8.1.0",
40
+ "@atlaskit/primitives": "^16.4.0",
41
+ "@atlaskit/tokens": "^8.5.0",
41
42
  "@babel/runtime": "^7.0.0",
42
43
  "@compiled/react": "^0.18.6"
43
44
  },
@@ -49,11 +50,10 @@
49
50
  "@af/integration-testing": "workspace:^",
50
51
  "@af/visual-regression": "workspace:^",
51
52
  "@atlaskit/docs": "^11.2.0",
52
- "@atlaskit/ds-lib": "^5.2.0",
53
+ "@atlaskit/dropdown-menu": "^16.3.0",
53
54
  "@atlaskit/heading": "^5.2.0",
54
55
  "@atlaskit/link": "^3.2.0",
55
- "@atlaskit/section-message": "^8.9.0",
56
- "@atlaskit/ssr": "workspace:^",
56
+ "@atlaskit/section-message": "^8.10.0",
57
57
  "@atlassian/feature-flags-test-utils": "^1.0.0",
58
58
  "@atlassian/ssr-tests": "workspace:^",
59
59
  "@testing-library/react": "^13.4.0",
@@ -85,6 +85,9 @@
85
85
  "platform-feature-flags": {
86
86
  "platform-lozenge-custom-letterspacing": {
87
87
  "type": "boolean"
88
+ },
89
+ "platform-dst-lozenge-tag-badge-visual-uplifts": {
90
+ "type": "boolean"
88
91
  }
89
92
  },
90
93
  "homepage": "https://atlassian.design/components/lozenge/"