@atlaskit/lozenge 13.4.3 → 13.4.5

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,25 @@
1
1
  # @atlaskit/lozenge
2
2
 
3
+ ## 13.4.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a18e28278b0ac`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a18e28278b0ac) -
8
+ Fixed percentage maxWidth truncation in new lozenge component. Text now correctly truncates with
9
+ ellipsis when maxWidth is set to a percentage value (e.g., '50%', '100%').
10
+
11
+ Add aria-controls, aria-expanded, and aria-haspopup props support to LozengeDropdownTrigger for
12
+ improved accessibility when used with DropdownMenu or Popup components. These props are now
13
+ properly passed through to the underlying button element.
14
+
15
+ - Updated dependencies
16
+
17
+ ## 13.4.4
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+
3
23
  ## 13.4.3
4
24
 
5
25
  ### Patch Changes
@@ -123,7 +123,10 @@ var LozengeBase = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
123
123
  onClick = _ref.onClick,
124
124
  style = _ref.style,
125
125
  analyticsContext = _ref.analyticsContext,
126
- interactionName = _ref.interactionName;
126
+ interactionName = _ref.interactionName,
127
+ ariaControls = _ref['aria-controls'],
128
+ ariaExpanded = _ref['aria-expanded'],
129
+ ariaHaspopup = _ref['aria-haspopup'];
127
130
  var isInteractive = typeof onClick === 'function';
128
131
 
129
132
  // Determine the effective color, with fallback logic for legacy appearances
@@ -144,6 +147,11 @@ var LozengeBase = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
144
147
  };
145
148
  var hasTrailingMetric = trailingMetric != null && trailingMetric !== '';
146
149
  var innerContent = /*#__PURE__*/React.createElement("span", {
150
+ style: {
151
+ // When maxWidth is a percentage, constrain the content wrapper
152
+ // so text truncation works correctly within the flex layout
153
+ maxWidth: maxWidthIsPc ? '100%' : undefined
154
+ },
147
155
  className: (0, _runtime.ax)([styles.content, spacing === 'spacious' && styles.contentSpacious, isLoading && styles.loadingContent])
148
156
  }, iconBefore && /*#__PURE__*/React.createElement(_iconRenderer.default, {
149
157
  size: spacing === 'spacious' ? 'medium' : 'small',
@@ -152,7 +160,7 @@ var LozengeBase = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
152
160
  testId: testId && "".concat(testId, "--icon")
153
161
  }), /*#__PURE__*/React.createElement("span", {
154
162
  style: {
155
- maxWidth: maxWidthIsPc ? '100%' : "calc(".concat(maxWidthValue, " - ", "var(--ds-space-100, 8px)", ")"),
163
+ maxWidth: maxWidthIsPc ? undefined : "calc(".concat(maxWidthValue, " - ", "var(--ds-space-100, 8px)", ")"),
156
164
  color: style === null || style === void 0 ? void 0 : style.color
157
165
  },
158
166
  "data-testid": testId && "".concat(testId, "--text"),
@@ -179,6 +187,9 @@ var LozengeBase = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forward
179
187
  isDisabled: true
180
188
  }, {
181
189
  "aria-label": isLoading ? 'Loading' : undefined,
190
+ "aria-controls": ariaControls,
191
+ "aria-expanded": ariaExpanded,
192
+ "aria-haspopup": ariaHaspopup,
182
193
  onClick: isLoading ? undefined : onClick,
183
194
  style: _objectSpread(_objectSpread({}, commonStyleOverrides), {}, {
184
195
  // Specified because Pressable has a default border:none which overrides the border specified on the container
@@ -46,7 +46,10 @@ var LozengeDropdownTrigger = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _re
46
46
  onClick = _ref$onClick === void 0 ? _noop.default : _ref$onClick,
47
47
  style = _ref.style,
48
48
  analyticsContext = _ref.analyticsContext,
49
- interactionName = _ref.interactionName;
49
+ interactionName = _ref.interactionName,
50
+ ariaControls = _ref['aria-controls'],
51
+ ariaExpanded = _ref['aria-expanded'],
52
+ ariaHaspopup = _ref['aria-haspopup'];
50
53
  var baseProps = {
51
54
  appearance: appearance,
52
55
  spacing: spacing,
@@ -61,7 +64,10 @@ var LozengeDropdownTrigger = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _re
61
64
  onClick: onClick,
62
65
  analyticsContext: analyticsContext,
63
66
  interactionName: interactionName,
64
- children: children
67
+ children: children,
68
+ 'aria-controls': ariaControls,
69
+ 'aria-expanded': ariaExpanded,
70
+ 'aria-haspopup': ariaHaspopup
65
71
  };
66
72
  return /*#__PURE__*/React.createElement(_lozengeBase.default, (0, _extends2.default)({
67
73
  ref: ref
@@ -111,7 +111,10 @@ const LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
111
111
  // for dropdown trigger
112
112
  style,
113
113
  analyticsContext,
114
- interactionName
114
+ interactionName,
115
+ 'aria-controls': ariaControls,
116
+ 'aria-expanded': ariaExpanded,
117
+ 'aria-haspopup': ariaHaspopup
115
118
  }, ref) => {
116
119
  const isInteractive = typeof onClick === 'function';
117
120
 
@@ -134,6 +137,11 @@ const LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
134
137
  };
135
138
  const hasTrailingMetric = trailingMetric != null && trailingMetric !== '';
136
139
  const innerContent = /*#__PURE__*/React.createElement("span", {
140
+ style: {
141
+ // When maxWidth is a percentage, constrain the content wrapper
142
+ // so text truncation works correctly within the flex layout
143
+ maxWidth: maxWidthIsPc ? '100%' : undefined
144
+ },
137
145
  className: ax([styles.content, spacing === 'spacious' && styles.contentSpacious, isLoading && styles.loadingContent])
138
146
  }, iconBefore && /*#__PURE__*/React.createElement(IconRenderer, {
139
147
  size: spacing === 'spacious' ? 'medium' : 'small',
@@ -142,7 +150,7 @@ const LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
142
150
  testId: testId && `${testId}--icon`
143
151
  }), /*#__PURE__*/React.createElement("span", {
144
152
  style: {
145
- maxWidth: maxWidthIsPc ? '100%' : `calc(${maxWidthValue} - ${"var(--ds-space-100, 8px)"})`,
153
+ maxWidth: maxWidthIsPc ? undefined : `calc(${maxWidthValue} - ${"var(--ds-space-100, 8px)"})`,
146
154
  color: style === null || style === void 0 ? void 0 : style.color
147
155
  },
148
156
  "data-testid": testId && `${testId}--text`,
@@ -169,6 +177,9 @@ const LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
169
177
  isDisabled: true
170
178
  }, {
171
179
  "aria-label": isLoading ? 'Loading' : undefined,
180
+ "aria-controls": ariaControls,
181
+ "aria-expanded": ariaExpanded,
182
+ "aria-haspopup": ariaHaspopup,
172
183
  onClick: isLoading ? undefined : onClick,
173
184
  style: {
174
185
  // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
@@ -31,7 +31,10 @@ const LozengeDropdownTrigger = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
31
31
  onClick = __noop,
32
32
  style,
33
33
  analyticsContext,
34
- interactionName
34
+ interactionName,
35
+ 'aria-controls': ariaControls,
36
+ 'aria-expanded': ariaExpanded,
37
+ 'aria-haspopup': ariaHaspopup
35
38
  }, ref) => {
36
39
  const baseProps = {
37
40
  appearance,
@@ -47,7 +50,10 @@ const LozengeDropdownTrigger = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
47
50
  onClick,
48
51
  analyticsContext,
49
52
  interactionName,
50
- children
53
+ children,
54
+ 'aria-controls': ariaControls,
55
+ 'aria-expanded': ariaExpanded,
56
+ 'aria-haspopup': ariaHaspopup
51
57
  };
52
58
  return /*#__PURE__*/React.createElement(LozengeBase, _extends({
53
59
  ref: ref
@@ -114,7 +114,10 @@ var LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref
114
114
  onClick = _ref.onClick,
115
115
  style = _ref.style,
116
116
  analyticsContext = _ref.analyticsContext,
117
- interactionName = _ref.interactionName;
117
+ interactionName = _ref.interactionName,
118
+ ariaControls = _ref['aria-controls'],
119
+ ariaExpanded = _ref['aria-expanded'],
120
+ ariaHaspopup = _ref['aria-haspopup'];
118
121
  var isInteractive = typeof onClick === 'function';
119
122
 
120
123
  // Determine the effective color, with fallback logic for legacy appearances
@@ -135,6 +138,11 @@ var LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref
135
138
  };
136
139
  var hasTrailingMetric = trailingMetric != null && trailingMetric !== '';
137
140
  var innerContent = /*#__PURE__*/React.createElement("span", {
141
+ style: {
142
+ // When maxWidth is a percentage, constrain the content wrapper
143
+ // so text truncation works correctly within the flex layout
144
+ maxWidth: maxWidthIsPc ? '100%' : undefined
145
+ },
138
146
  className: ax([styles.content, spacing === 'spacious' && styles.contentSpacious, isLoading && styles.loadingContent])
139
147
  }, iconBefore && /*#__PURE__*/React.createElement(IconRenderer, {
140
148
  size: spacing === 'spacious' ? 'medium' : 'small',
@@ -143,7 +151,7 @@ var LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref
143
151
  testId: testId && "".concat(testId, "--icon")
144
152
  }), /*#__PURE__*/React.createElement("span", {
145
153
  style: {
146
- maxWidth: maxWidthIsPc ? '100%' : "calc(".concat(maxWidthValue, " - ", "var(--ds-space-100, 8px)", ")"),
154
+ maxWidth: maxWidthIsPc ? undefined : "calc(".concat(maxWidthValue, " - ", "var(--ds-space-100, 8px)", ")"),
147
155
  color: style === null || style === void 0 ? void 0 : style.color
148
156
  },
149
157
  "data-testid": testId && "".concat(testId, "--text"),
@@ -170,6 +178,9 @@ var LozengeBase = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (_ref, ref
170
178
  isDisabled: true
171
179
  }, {
172
180
  "aria-label": isLoading ? 'Loading' : undefined,
181
+ "aria-controls": ariaControls,
182
+ "aria-expanded": ariaExpanded,
183
+ "aria-haspopup": ariaHaspopup,
173
184
  onClick: isLoading ? undefined : onClick,
174
185
  style: _objectSpread(_objectSpread({}, commonStyleOverrides), {}, {
175
186
  // Specified because Pressable has a default border:none which overrides the border specified on the container
@@ -37,7 +37,10 @@ var LozengeDropdownTrigger = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function
37
37
  onClick = _ref$onClick === void 0 ? __noop : _ref$onClick,
38
38
  style = _ref.style,
39
39
  analyticsContext = _ref.analyticsContext,
40
- interactionName = _ref.interactionName;
40
+ interactionName = _ref.interactionName,
41
+ ariaControls = _ref['aria-controls'],
42
+ ariaExpanded = _ref['aria-expanded'],
43
+ ariaHaspopup = _ref['aria-haspopup'];
41
44
  var baseProps = {
42
45
  appearance: appearance,
43
46
  spacing: spacing,
@@ -52,7 +55,10 @@ var LozengeDropdownTrigger = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function
52
55
  onClick: onClick,
53
56
  analyticsContext: analyticsContext,
54
57
  interactionName: interactionName,
55
- children: children
58
+ children: children,
59
+ 'aria-controls': ariaControls,
60
+ 'aria-expanded': ariaExpanded,
61
+ 'aria-haspopup': ariaHaspopup
56
62
  };
57
63
  return /*#__PURE__*/React.createElement(LozengeBase, _extends({
58
64
  ref: ref
@@ -38,5 +38,5 @@ export interface LozengeProps {
38
38
  /**
39
39
  * Wrapper component that switches between old and new Lozenge based on feature flag
40
40
  */
41
- declare const LozengeWrapper: import("react").MemoExoticComponent<(props: LozengeProps | NewLozengeProps) => JSX.Element>;
41
+ declare const LozengeWrapper: import('react').MemoExoticComponent<(props: LozengeProps | NewLozengeProps) => JSX.Element>;
42
42
  export default LozengeWrapper;
@@ -5,5 +5,5 @@ import { type LozengeBaseProps } from './types';
5
5
  * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
6
6
  * This is the updated version with the new North Star visual language.
7
7
  */
8
- declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<LozengeBaseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement | HTMLElement>>>;
8
+ declare const LozengeBase: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<LozengeBaseProps, 'ref'> & import('react').RefAttributes<HTMLButtonElement | HTMLElement>>>;
9
9
  export default LozengeBase;
@@ -11,5 +11,5 @@ import { type LozengeDropdownTriggerProps } from './types';
11
11
  * - Built for dropdown menu interactions
12
12
  * - Supports analytics events and UFO press interactions
13
13
  */
14
- declare const LozengeDropdownTrigger: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<LozengeDropdownTriggerProps & import("react").RefAttributes<HTMLElement>>>;
14
+ declare const LozengeDropdownTrigger: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<LozengeDropdownTriggerProps & import('react').RefAttributes<HTMLElement>>>;
15
15
  export default LozengeDropdownTrigger;
@@ -106,6 +106,9 @@ export type LozengeBaseProps = NewLozengeBaseProps & {
106
106
  onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
107
107
  analyticsContext?: Record<string, any>;
108
108
  interactionName?: string;
109
+ 'aria-controls'?: string;
110
+ 'aria-expanded'?: boolean;
111
+ 'aria-haspopup'?: boolean | 'dialog';
109
112
  };
110
113
  /**
111
114
  * Props for the LozengeDropdownTrigger component
@@ -132,5 +135,18 @@ export type LozengeDropdownTriggerProps = NewLozengeProps & {
132
135
  * 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).
133
136
  */
134
137
  interactionName?: string;
138
+ /**
139
+ * Identifies the popup element that the trigger controls.
140
+ * Should match the `id` of the popup content for screen readers to understand the relationship.
141
+ */
142
+ 'aria-controls'?: string;
143
+ /**
144
+ * Announces to assistive technology whether the popup is currently open or closed.
145
+ */
146
+ 'aria-expanded'?: boolean;
147
+ /**
148
+ * Informs assistive technology that this element triggers a popup.
149
+ */
150
+ 'aria-haspopup'?: boolean | 'dialog';
135
151
  };
136
152
  export {};
@@ -38,5 +38,5 @@ export interface LozengeProps {
38
38
  /**
39
39
  * Wrapper component that switches between old and new Lozenge based on feature flag
40
40
  */
41
- declare const LozengeWrapper: import("react").MemoExoticComponent<(props: LozengeProps | NewLozengeProps) => JSX.Element>;
41
+ declare const LozengeWrapper: import('react').MemoExoticComponent<(props: LozengeProps | NewLozengeProps) => JSX.Element>;
42
42
  export default LozengeWrapper;
@@ -5,5 +5,5 @@ import { type LozengeBaseProps } from './types';
5
5
  * A lozenge is a visual indicator used to highlight an item's status for quick recognition.
6
6
  * This is the updated version with the new North Star visual language.
7
7
  */
8
- declare const LozengeBase: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Omit<LozengeBaseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement | HTMLElement>>>;
8
+ declare const LozengeBase: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<LozengeBaseProps, 'ref'> & import('react').RefAttributes<HTMLButtonElement | HTMLElement>>>;
9
9
  export default LozengeBase;
@@ -11,5 +11,5 @@ import { type LozengeDropdownTriggerProps } from './types';
11
11
  * - Built for dropdown menu interactions
12
12
  * - Supports analytics events and UFO press interactions
13
13
  */
14
- declare const LozengeDropdownTrigger: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<LozengeDropdownTriggerProps & import("react").RefAttributes<HTMLElement>>>;
14
+ declare const LozengeDropdownTrigger: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<LozengeDropdownTriggerProps & import('react').RefAttributes<HTMLElement>>>;
15
15
  export default LozengeDropdownTrigger;
@@ -106,6 +106,9 @@ export type LozengeBaseProps = NewLozengeBaseProps & {
106
106
  onClick?: (event: React.MouseEvent<HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent) => void;
107
107
  analyticsContext?: Record<string, any>;
108
108
  interactionName?: string;
109
+ 'aria-controls'?: string;
110
+ 'aria-expanded'?: boolean;
111
+ 'aria-haspopup'?: boolean | 'dialog';
109
112
  };
110
113
  /**
111
114
  * Props for the LozengeDropdownTrigger component
@@ -132,5 +135,18 @@ export type LozengeDropdownTriggerProps = NewLozengeProps & {
132
135
  * 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).
133
136
  */
134
137
  interactionName?: string;
138
+ /**
139
+ * Identifies the popup element that the trigger controls.
140
+ * Should match the `id` of the popup content for screen readers to understand the relationship.
141
+ */
142
+ 'aria-controls'?: string;
143
+ /**
144
+ * Announces to assistive technology whether the popup is currently open or closed.
145
+ */
146
+ 'aria-expanded'?: boolean;
147
+ /**
148
+ * Informs assistive technology that this element triggers a popup.
149
+ */
150
+ 'aria-haspopup'?: boolean | 'dialog';
135
151
  };
136
152
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/lozenge",
3
- "version": "13.4.3",
3
+ "version": "13.4.5",
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/"
@@ -35,7 +35,7 @@
35
35
  "id": "lozenge",
36
36
  "status": {
37
37
  "type": "beta",
38
- "description": "New and ready to use. We'll provide comms and support for any major changes."
38
+ "description": "New and ready to use. These visual updates are currently behind the feature flag: `platform-dst-lozenge-tag-badge-visual-uplifts`. We'll provide comms and support for any major changes."
39
39
  }
40
40
  },
41
41
  {
@@ -54,7 +54,7 @@
54
54
  "@atlaskit/badge": "^18.4.0",
55
55
  "@atlaskit/css": "^0.19.0",
56
56
  "@atlaskit/ds-lib": "^5.3.0",
57
- "@atlaskit/icon": "^31.0.0",
57
+ "@atlaskit/icon": "^32.0.0",
58
58
  "@atlaskit/platform-feature-flags": "^1.1.0",
59
59
  "@atlaskit/primitives": "^18.0.0",
60
60
  "@atlaskit/spinner": "^19.0.0",
@@ -69,8 +69,8 @@
69
69
  "@af/accessibility-testing": "workspace:^",
70
70
  "@af/integration-testing": "workspace:^",
71
71
  "@af/visual-regression": "workspace:^",
72
- "@atlaskit/docs": "^11.3.0",
73
- "@atlaskit/dropdown-menu": "^16.4.0",
72
+ "@atlaskit/docs": "^11.5.0",
73
+ "@atlaskit/dropdown-menu": "^16.5.0",
74
74
  "@atlaskit/heading": "^5.3.0",
75
75
  "@atlaskit/link": "^3.3.0",
76
76
  "@atlaskit/section-message": "^8.12.0",