@atlaskit/navigation-system 0.177.2 → 0.178.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 (115) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/cjs/ui/menu-item/expandable-menu-item/expandable-menu-item-trigger.js +16 -3
  3. package/dist/cjs/ui/menu-item/menu-item.compiled.css +2 -2
  4. package/dist/cjs/ui/menu-item/menu-item.js +5 -4
  5. package/dist/es2019/ui/menu-item/expandable-menu-item/expandable-menu-item-trigger.js +17 -4
  6. package/dist/es2019/ui/menu-item/menu-item.compiled.css +2 -2
  7. package/dist/es2019/ui/menu-item/menu-item.js +4 -3
  8. package/dist/esm/ui/menu-item/expandable-menu-item/expandable-menu-item-trigger.js +17 -4
  9. package/dist/esm/ui/menu-item/menu-item.compiled.css +2 -2
  10. package/dist/esm/ui/menu-item/menu-item.js +5 -4
  11. package/dist/types/components/skip-links/skip-link.d.ts +1 -1
  12. package/dist/types/components/skip-links/skip-links-container.d.ts +1 -2
  13. package/dist/types/context/skip-links/skip-links-context.d.ts +15 -2
  14. package/dist/types/context/skip-links/skip-links-data-context.d.ts +0 -1
  15. package/dist/types/context/top-nav-start/top-nav-start-context.d.ts +0 -1
  16. package/dist/types/ui/menu-item/button-menu-item.d.ts +4 -4
  17. package/dist/types/ui/menu-item/container-avatar.d.ts +0 -1
  18. package/dist/types/ui/menu-item/drag-handle.d.ts +0 -1
  19. package/dist/types/ui/menu-item/expandable-menu-item/expandable-menu-item-context.d.ts +1 -2
  20. package/dist/types/ui/menu-item/expandable-menu-item/expandable-menu-item-level-context.d.ts +0 -1
  21. package/dist/types/ui/menu-item/expandable-menu-item/expandable-menu-item-trigger.d.ts +5 -5
  22. package/dist/types/ui/menu-item/flyout-menu-item/flyout-menu-item-context.d.ts +0 -1
  23. package/dist/types/ui/menu-item/flyout-menu-item/flyout-menu-item-trigger.d.ts +2 -2
  24. package/dist/types/ui/menu-item/link-menu-item.d.ts +6 -11
  25. package/dist/types/ui/menu-item/menu-item.d.ts +16 -11
  26. package/dist/types/ui/menu-item/menu-list-item.d.ts +1 -2
  27. package/dist/types/ui/menu-item/menu-list.d.ts +0 -1
  28. package/dist/types/ui/menu-item/top-level-spacer.d.ts +0 -1
  29. package/dist/types/ui/menu-item/use-scroll-menu-item-into-view.d.ts +0 -1
  30. package/dist/types/ui/menu-section/divider.d.ts +0 -1
  31. package/dist/types/ui/menu-section/menu-section-context.d.ts +0 -1
  32. package/dist/types/ui/page-layout/aside.d.ts +0 -1
  33. package/dist/types/ui/page-layout/banner.d.ts +0 -1
  34. package/dist/types/ui/page-layout/hoist-slot-sizes-context.d.ts +0 -1
  35. package/dist/types/ui/page-layout/hoist-utils.d.ts +2 -2
  36. package/dist/types/ui/page-layout/main/main-sticky-context.d.ts +0 -1
  37. package/dist/types/ui/page-layout/main/main.d.ts +0 -1
  38. package/dist/types/ui/page-layout/panel-splitter/get-width.d.ts +2 -2
  39. package/dist/types/ui/page-layout/panel.d.ts +0 -1
  40. package/dist/types/ui/page-layout/side-nav/side-nav-footer.d.ts +1 -1
  41. package/dist/types/ui/page-layout/side-nav/side-nav.d.ts +0 -1
  42. package/dist/types/ui/page-layout/side-nav/toggle-button-context.d.ts +0 -1
  43. package/dist/types/ui/page-layout/side-nav/toggle-button.d.ts +4 -4
  44. package/dist/types/ui/page-layout/top-nav/top-nav.d.ts +0 -1
  45. package/dist/types/ui/top-nav-items/chat-button.d.ts +3 -3
  46. package/dist/types/ui/top-nav-items/nav-logo/app-logo.d.ts +1 -1
  47. package/dist/types/ui/top-nav-items/nav-logo/custom-logo.d.ts +1 -1
  48. package/dist/types/ui/top-nav-items/search.d.ts +5 -5
  49. package/dist/types/ui/top-nav-items/themed/button.d.ts +2 -2
  50. package/dist/types/ui/top-nav-items/themed/has-custom-theme-context.d.ts +0 -1
  51. package/dist/types/ui/top-nav-items/themed/use-custom-theme.d.ts +0 -1
  52. package/dist/types-ts4.5/components/skip-links/skip-link.d.ts +1 -1
  53. package/dist/types-ts4.5/components/skip-links/skip-links-container.d.ts +1 -2
  54. package/dist/types-ts4.5/context/skip-links/skip-links-context.d.ts +15 -2
  55. package/dist/types-ts4.5/context/skip-links/skip-links-data-context.d.ts +0 -1
  56. package/dist/types-ts4.5/context/top-nav-start/top-nav-start-context.d.ts +0 -1
  57. package/dist/types-ts4.5/ui/menu-item/button-menu-item.d.ts +4 -4
  58. package/dist/types-ts4.5/ui/menu-item/container-avatar.d.ts +0 -1
  59. package/dist/types-ts4.5/ui/menu-item/drag-handle.d.ts +0 -1
  60. package/dist/types-ts4.5/ui/menu-item/expandable-menu-item/expandable-menu-item-context.d.ts +1 -2
  61. package/dist/types-ts4.5/ui/menu-item/expandable-menu-item/expandable-menu-item-level-context.d.ts +0 -1
  62. package/dist/types-ts4.5/ui/menu-item/expandable-menu-item/expandable-menu-item-trigger.d.ts +5 -5
  63. package/dist/types-ts4.5/ui/menu-item/flyout-menu-item/flyout-menu-item-context.d.ts +0 -1
  64. package/dist/types-ts4.5/ui/menu-item/flyout-menu-item/flyout-menu-item-trigger.d.ts +2 -2
  65. package/dist/types-ts4.5/ui/menu-item/link-menu-item.d.ts +6 -11
  66. package/dist/types-ts4.5/ui/menu-item/menu-item.d.ts +16 -11
  67. package/dist/types-ts4.5/ui/menu-item/menu-list-item.d.ts +1 -2
  68. package/dist/types-ts4.5/ui/menu-item/menu-list.d.ts +0 -1
  69. package/dist/types-ts4.5/ui/menu-item/top-level-spacer.d.ts +0 -1
  70. package/dist/types-ts4.5/ui/menu-item/use-scroll-menu-item-into-view.d.ts +0 -1
  71. package/dist/types-ts4.5/ui/menu-section/divider.d.ts +0 -1
  72. package/dist/types-ts4.5/ui/menu-section/menu-section-context.d.ts +0 -1
  73. package/dist/types-ts4.5/ui/page-layout/aside.d.ts +0 -1
  74. package/dist/types-ts4.5/ui/page-layout/banner.d.ts +0 -1
  75. package/dist/types-ts4.5/ui/page-layout/hoist-slot-sizes-context.d.ts +0 -1
  76. package/dist/types-ts4.5/ui/page-layout/hoist-utils.d.ts +2 -2
  77. package/dist/types-ts4.5/ui/page-layout/main/main-sticky-context.d.ts +0 -1
  78. package/dist/types-ts4.5/ui/page-layout/main/main.d.ts +0 -1
  79. package/dist/types-ts4.5/ui/page-layout/panel-splitter/get-width.d.ts +2 -2
  80. package/dist/types-ts4.5/ui/page-layout/panel.d.ts +0 -1
  81. package/dist/types-ts4.5/ui/page-layout/side-nav/side-nav-footer.d.ts +1 -1
  82. package/dist/types-ts4.5/ui/page-layout/side-nav/side-nav.d.ts +0 -1
  83. package/dist/types-ts4.5/ui/page-layout/side-nav/toggle-button-context.d.ts +0 -1
  84. package/dist/types-ts4.5/ui/page-layout/side-nav/toggle-button.d.ts +4 -4
  85. package/dist/types-ts4.5/ui/page-layout/top-nav/top-nav.d.ts +0 -1
  86. package/dist/types-ts4.5/ui/top-nav-items/chat-button.d.ts +3 -3
  87. package/dist/types-ts4.5/ui/top-nav-items/nav-logo/app-logo.d.ts +1 -1
  88. package/dist/types-ts4.5/ui/top-nav-items/nav-logo/custom-logo.d.ts +1 -1
  89. package/dist/types-ts4.5/ui/top-nav-items/search.d.ts +5 -5
  90. package/dist/types-ts4.5/ui/top-nav-items/themed/button.d.ts +2 -2
  91. package/dist/types-ts4.5/ui/top-nav-items/themed/has-custom-theme-context.d.ts +0 -1
  92. package/dist/types-ts4.5/ui/top-nav-items/themed/use-custom-theme.d.ts +0 -1
  93. package/examples/company-hub-mock.tsx +0 -4
  94. package/examples/confluence-mock.tsx +1 -4
  95. package/examples/drag-and-drop-jira-scaling-vr.tsx +25 -0
  96. package/examples/expandable-menu-item.tsx +1 -0
  97. package/examples/page-layout.tsx +0 -3
  98. package/package.json +5 -3
  99. package/src/__tests__/informational-vr-tests/__snapshots__/layering/layers-in-main-slot-short-viewport--desktop--platform-dst-nav4-layering-in-main-slot-fixes-false.png +0 -0
  100. package/src/__tests__/informational-vr-tests/__snapshots__/layering/layers-in-main-slot-short-viewport--desktop--platform-dst-nav4-layering-in-main-slot-fixes-true.png +0 -0
  101. package/src/__tests__/informational-vr-tests/__snapshots__/layering/side-nav-expanded-on-mobile--mobile.png +0 -0
  102. package/src/__tests__/informational-vr-tests/__snapshots__/layering/side-nav-expanded-on-mobile-without-panel--mobile.png +0 -0
  103. package/src/__tests__/informational-vr-tests/layering.vr.tsx +6 -0
  104. package/src/__tests__/vr-tests/__snapshots__/a11y-scaling/app--desktop.png +0 -0
  105. package/src/__tests__/vr-tests/a11y-scaling.vr.tsx +12 -0
  106. package/src/ui/menu-item/__tests__/playwright/scroll-into-view.spec.tsx +9 -10
  107. package/src/ui/menu-item/__tests__/unit/expandable-menu-item.test.tsx +88 -63
  108. package/src/ui/menu-item/__tests__/vr-tests/__snapshots__/menu-item/button-menu-item-example--desktop-webkit.png +0 -0
  109. package/src/ui/menu-item/__tests__/vr-tests/__snapshots__/menu-item/button-menu-item-rtlexample--desktop-webkit.png +0 -0
  110. package/src/ui/menu-item/__tests__/vr-tests/__snapshots__/menu-item/link-menu-item-example--desktop-webkit.png +0 -0
  111. package/src/ui/menu-item/__tests__/vr-tests/__snapshots__/menu-item/link-menu-item-rtlexample--desktop-webkit.png +0 -0
  112. package/src/ui/menu-item/__tests__/vr-tests/expandable.vr.tsx +8 -8
  113. package/src/ui/menu-item/expandable-menu-item/expandable-menu-item-trigger.tsx +19 -2
  114. package/src/ui/menu-item/menu-item.tsx +10 -8
  115. package/src/ui/page-layout/__tests__/unit/react-safety.test.tsx +0 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # @atlassian/navigation-system
2
2
 
3
+ ## 0.178.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#199487](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/199487)
8
+ [`87e1e76c9c3aa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/87e1e76c9c3aa) -
9
+ The `elemBefore` chevron icon button in the link (selectable) variants of
10
+ `ExpandableMenuItemTrigger` is now labelled by the menu item (specifically, its anchor element)
11
+ through the `aria-labelledby` attribute. This is to provide context on what will be expanded or
12
+ collapsed to screen readers.
13
+
14
+ This change is behind a feature flag.
15
+
16
+ - [#199487](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/199487)
17
+ [`87e1e76c9c3aa`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/87e1e76c9c3aa) -
18
+ The `ExpandableMenuItemTrigger` `testId` is now passed down to the `elemBefore` chevron icon
19
+ button in the link (selectable) variants of `ExpandableMenuItemTrigger`.
20
+
21
+ ### Patch Changes
22
+
23
+ - [#199297](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/199297)
24
+ [`3805d3e955d32`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3805d3e955d32) -
25
+ Improve menu item scaling with browser font size by using rem for height.
26
+ - [`5bed2aeb9093f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5bed2aeb9093f) -
27
+ Internal refactoring of tests
28
+ - Updated dependencies
29
+
30
+ ## 0.177.3
31
+
32
+ ### Patch Changes
33
+
34
+ - [#197413](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/197413)
35
+ [`6909340c54a0b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6909340c54a0b) -
36
+ Minor internal refactor to cleanup unused styles. No external impact.
37
+ - Updated dependencies
38
+
3
39
  ## 0.177.2
4
40
 
5
41
  ### Patch Changes
@@ -14,6 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
14
14
  var _new = require("@atlaskit/button/new");
15
15
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
16
16
  var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _menuItem = require("../menu-item");
18
19
  var _useScrollMenuItemIntoView = require("../use-scroll-menu-item-into-view");
19
20
  var _expandableMenuItemContext = require("./expandable-menu-item-context");
@@ -68,6 +69,7 @@ var ExpandableMenuItemTrigger = exports.ExpandableMenuItemTrigger = /*#__PURE__*
68
69
  isDragging = _ref2.isDragging,
69
70
  hasDragIndicator = _ref2.hasDragIndicator,
70
71
  dropIndicator = _ref2.dropIndicator;
72
+ var id = (0, _react.useId)();
71
73
  var onExpansionToggle = (0, _expandableMenuItemContext.useOnExpansionToggle)();
72
74
  var isExpanded = (0, _expandableMenuItemContext.useIsExpanded)();
73
75
  var setIsExpanded = (0, _expandableMenuItemContext.useSetIsExpanded)();
@@ -100,12 +102,22 @@ var ExpandableMenuItemTrigger = exports.ExpandableMenuItemTrigger = /*#__PURE__*
100
102
  providedElemBefore: providedElemBefore
101
103
  });
102
104
  },
103
- "aria-expanded": isExpanded,
104
- label: isExpanded ? 'Collapse' : 'Expand',
105
+ "aria-expanded": isExpanded
106
+ // We are labelling the icon button using the containing menu item's content, to provide context to
107
+ // screen readers on what will actually be expanded or collapsed. Screen readers will also use the
108
+ // `aria-expanded` attribute to indicate the expanded state of the menu item.
109
+ // We are not using the `aria-label` attribute here as it is not supported by the `IconButton` component.
110
+ ,
111
+ "aria-labelledby": (0, _platformFeatureFlags.fg)('platform_dst_expandable_menu_item_elembefore_label') ? id : undefined
112
+ // IconButton requires a label prop, however it will not be used by screen readers as we are setting
113
+ // `aria-labelledby`, which will be used instead.
114
+ ,
115
+ label: (0, _platformFeatureFlags.fg)('platform_dst_expandable_menu_item_elembefore_label') ? '' : isExpanded ? 'Collapse' : 'Expand',
105
116
  appearance: "subtle",
106
117
  spacing: "compact",
107
118
  onClick: handleIconClick,
108
- interactionName: interactionName
119
+ interactionName: interactionName,
120
+ testId: testId ? "".concat(testId, "--elem-before-button") : undefined
109
121
  }) : /*#__PURE__*/_react.default.createElement(ExpandableMenuItemIcon, {
110
122
  isExpanded: isExpanded,
111
123
  isSelected: isSelected,
@@ -117,6 +129,7 @@ var ExpandableMenuItemTrigger = exports.ExpandableMenuItemTrigger = /*#__PURE__*
117
129
  ref: itemRef,
118
130
  className: (0, _runtime.ax)([wrapperStyles.root, providedElemBefore && wrapperStyles.showProvidedElemBefore])
119
131
  }, /*#__PURE__*/_react.default.createElement(_menuItem.MenuItemBase, {
132
+ id: id,
120
133
  actions: actions,
121
134
  actionsOnHover: actionsOnHover,
122
135
  elemBefore: elemBefore,
@@ -46,8 +46,8 @@
46
46
  ._4cvr1h6o{align-items:center}
47
47
  ._4t3i1crf{height:9pt}
48
48
  ._4t3i1tcg{height:24px}
49
- ._4t3ickbl{height:3pc}
50
- ._4t3izwfg{height:2pc}
49
+ ._4t3i1wto{height:3rem}
50
+ ._4t3iviql{height:2rem}
51
51
  ._85i51b66{padding-block-end:var(--ds-space-050,4px)}
52
52
  ._85i5v77o{padding-block-end:var(--ds-space-025,2px)}
53
53
  ._91ju1txw{--elem-after-display:flex}
@@ -146,14 +146,13 @@ var onTopOfButtonOrAnchorStyles = {
146
146
  */
147
147
  var nestedOpenPopupCSSSelector = exports.nestedOpenPopupCSSSelector = '&:has([aria-expanded="true"][aria-haspopup="true"])';
148
148
  var containerStyles = {
149
- root: "_2rkoglpi _vchhusvi _1e0c11p5 _yv0e7dup _2z05hkll _1lmcu4vt _1ul9t9kd _4t3izwfg _4cvr1h6o _uiztglyw _syaz1gjq _ek6gglyw _1yyu1j28 _91ju1txw _1swv108i _1ojv1txw _irr3108i _1brr1txw _109x1txw",
149
+ root: "_2rkoglpi _vchhusvi _1e0c11p5 _yv0e7dup _2z05hkll _1lmcu4vt _1ul9t9kd _4t3iviql _4cvr1h6o _uiztglyw _syaz1gjq _ek6gglyw _1yyu1j28 _91ju1txw _1swv108i _1ojv1txw _irr3108i _1brr1txw _109x1txw",
150
150
  removeElemAfter: "_91juglyw",
151
151
  showHoverActions: "_ek6g1txw",
152
- removeElemAfterOnHover: "_1mfcglyw _1sjuglyw",
153
152
  removeElemAfterOnHoverOrOpenNestedPopup: "_1djyglyw _1mfcglyw _1sjuglyw",
154
153
  selected: "_bfhkfg4m _syazaqb7 _1yyu1fvw _1swvi1yw _30l3aqb7 _irr3i1yw",
155
154
  disabled: "_syaz1lh4 _irr3n7od",
156
- hasDescription: "_4t3ickbl",
155
+ hasDescription: "_4t3i1wto",
157
156
  dragging: "_tzy41ou4"
158
157
  };
159
158
  var buttonOrAnchorStyles = {
@@ -223,7 +222,8 @@ function getTextColor(_ref2) {
223
222
  * This can be inferred from the type of the `onClick` prop.
224
223
  */
225
224
  var MenuItemBaseNoRef = function MenuItemBaseNoRef(_ref3, forwardedRef) {
226
- var testId = _ref3.testId,
225
+ var id = _ref3.id,
226
+ testId = _ref3.testId,
227
227
  actions = _ref3.actions,
228
228
  actionsOnHover = _ref3.actionsOnHover,
229
229
  children = _ref3.children,
@@ -348,6 +348,7 @@ var MenuItemBaseNoRef = function MenuItemBaseNoRef(_ref3, forwardedRef) {
348
348
  'aria-controls': ariaControls,
349
349
  'aria-haspopup': ariaHasPopup,
350
350
  ref: (0, _mergeRefs.default)([forwardedRef, tooltipProps.ref]),
351
+ id: id,
351
352
  testId: testId,
352
353
  interactionName: interactionName
353
354
  });
@@ -2,10 +2,11 @@
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./expandable-menu-item-trigger.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
- import React, { forwardRef, useCallback, useRef } from 'react';
5
+ import React, { forwardRef, useCallback, useId, useRef } from 'react';
6
6
  import { IconButton } from '@atlaskit/button/new';
7
7
  import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
8
8
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { MenuItemBase, nestedOpenPopupCSSSelector } from '../menu-item';
10
11
  import { useScrollMenuItemIntoView } from '../use-scroll-menu-item-into-view';
11
12
  import { useIsExpanded, useOnExpansionToggle, useSetIsExpanded } from './expandable-menu-item-context';
@@ -61,6 +62,7 @@ export const ExpandableMenuItemTrigger = /*#__PURE__*/forwardRef(({
61
62
  hasDragIndicator,
62
63
  dropIndicator
63
64
  }, forwardedRef) => {
65
+ const id = useId();
64
66
  const onExpansionToggle = useOnExpansionToggle();
65
67
  const isExpanded = useIsExpanded();
66
68
  const setIsExpanded = useSetIsExpanded();
@@ -91,12 +93,22 @@ export const ExpandableMenuItemTrigger = /*#__PURE__*/forwardRef(({
91
93
  isSelected: isSelected,
92
94
  providedElemBefore: providedElemBefore
93
95
  }),
94
- "aria-expanded": isExpanded,
95
- label: isExpanded ? 'Collapse' : 'Expand',
96
+ "aria-expanded": isExpanded
97
+ // We are labelling the icon button using the containing menu item's content, to provide context to
98
+ // screen readers on what will actually be expanded or collapsed. Screen readers will also use the
99
+ // `aria-expanded` attribute to indicate the expanded state of the menu item.
100
+ // We are not using the `aria-label` attribute here as it is not supported by the `IconButton` component.
101
+ ,
102
+ "aria-labelledby": fg('platform_dst_expandable_menu_item_elembefore_label') ? id : undefined
103
+ // IconButton requires a label prop, however it will not be used by screen readers as we are setting
104
+ // `aria-labelledby`, which will be used instead.
105
+ ,
106
+ label: fg('platform_dst_expandable_menu_item_elembefore_label') ? '' : isExpanded ? 'Collapse' : 'Expand',
96
107
  appearance: "subtle",
97
108
  spacing: "compact",
98
109
  onClick: handleIconClick,
99
- interactionName: interactionName
110
+ interactionName: interactionName,
111
+ testId: testId ? `${testId}--elem-before-button` : undefined
100
112
  }) : /*#__PURE__*/React.createElement(ExpandableMenuItemIcon, {
101
113
  isExpanded: isExpanded,
102
114
  isSelected: isSelected,
@@ -108,6 +120,7 @@ export const ExpandableMenuItemTrigger = /*#__PURE__*/forwardRef(({
108
120
  ref: itemRef,
109
121
  className: ax([wrapperStyles.root, providedElemBefore && wrapperStyles.showProvidedElemBefore])
110
122
  }, /*#__PURE__*/React.createElement(MenuItemBase, {
123
+ id: id,
111
124
  actions: actions,
112
125
  actionsOnHover: actionsOnHover,
113
126
  elemBefore: elemBefore,
@@ -46,8 +46,8 @@
46
46
  ._4cvr1h6o{align-items:center}
47
47
  ._4t3i1crf{height:9pt}
48
48
  ._4t3i1tcg{height:24px}
49
- ._4t3ickbl{height:3pc}
50
- ._4t3izwfg{height:2pc}
49
+ ._4t3i1wto{height:3rem}
50
+ ._4t3iviql{height:2rem}
51
51
  ._85i51b66{padding-block-end:var(--ds-space-050,4px)}
52
52
  ._85i5v77o{padding-block-end:var(--ds-space-025,2px)}
53
53
  ._91ju1txw{--elem-after-display:flex}
@@ -129,14 +129,13 @@ const onTopOfButtonOrAnchorStyles = {
129
129
  */
130
130
  export const nestedOpenPopupCSSSelector = '&:has([aria-expanded="true"][aria-haspopup="true"])';
131
131
  const containerStyles = {
132
- root: "_2rkoglpi _vchhusvi _1e0c11p5 _yv0e7dup _2z05hkll _1lmcu4vt _1ul9t9kd _4t3izwfg _4cvr1h6o _uiztglyw _syaz1gjq _ek6gglyw _1yyu1j28 _91ju1txw _1swv108i _1ojv1txw _irr3108i _1brr1txw _109x1txw",
132
+ root: "_2rkoglpi _vchhusvi _1e0c11p5 _yv0e7dup _2z05hkll _1lmcu4vt _1ul9t9kd _4t3iviql _4cvr1h6o _uiztglyw _syaz1gjq _ek6gglyw _1yyu1j28 _91ju1txw _1swv108i _1ojv1txw _irr3108i _1brr1txw _109x1txw",
133
133
  removeElemAfter: "_91juglyw",
134
134
  showHoverActions: "_ek6g1txw",
135
- removeElemAfterOnHover: "_1mfcglyw _1sjuglyw",
136
135
  removeElemAfterOnHoverOrOpenNestedPopup: "_1djyglyw _1mfcglyw _1sjuglyw",
137
136
  selected: "_bfhkfg4m _syazaqb7 _1yyu1fvw _1swvi1yw _30l3aqb7 _irr3i1yw",
138
137
  disabled: "_syaz1lh4 _irr3n7od",
139
- hasDescription: "_4t3ickbl",
138
+ hasDescription: "_4t3i1wto",
140
139
  dragging: "_tzy41ou4"
141
140
  };
142
141
  const buttonOrAnchorStyles = {
@@ -207,6 +206,7 @@ function getTextColor({
207
206
  * This can be inferred from the type of the `onClick` prop.
208
207
  */
209
208
  const MenuItemBaseNoRef = ({
209
+ id,
210
210
  testId,
211
211
  actions,
212
212
  actionsOnHover,
@@ -332,6 +332,7 @@ const MenuItemBaseNoRef = ({
332
332
  'aria-controls': ariaControls,
333
333
  'aria-haspopup': ariaHasPopup,
334
334
  ref: mergeRefs([forwardedRef, tooltipProps.ref]),
335
+ id,
335
336
  testId,
336
337
  interactionName
337
338
  };
@@ -2,10 +2,11 @@
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import "./expandable-menu-item-trigger.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
- import React, { forwardRef, useCallback, useRef } from 'react';
5
+ import React, { forwardRef, useCallback, useId, useRef } from 'react';
6
6
  import { IconButton } from '@atlaskit/button/new';
7
7
  import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
8
8
  import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { MenuItemBase, nestedOpenPopupCSSSelector } from '../menu-item';
10
11
  import { useScrollMenuItemIntoView } from '../use-scroll-menu-item-into-view';
11
12
  import { useIsExpanded, useOnExpansionToggle, useSetIsExpanded } from './expandable-menu-item-context';
@@ -59,6 +60,7 @@ export var ExpandableMenuItemTrigger = /*#__PURE__*/forwardRef(function (_ref2,
59
60
  isDragging = _ref2.isDragging,
60
61
  hasDragIndicator = _ref2.hasDragIndicator,
61
62
  dropIndicator = _ref2.dropIndicator;
63
+ var id = useId();
62
64
  var onExpansionToggle = useOnExpansionToggle();
63
65
  var isExpanded = useIsExpanded();
64
66
  var setIsExpanded = useSetIsExpanded();
@@ -91,12 +93,22 @@ export var ExpandableMenuItemTrigger = /*#__PURE__*/forwardRef(function (_ref2,
91
93
  providedElemBefore: providedElemBefore
92
94
  });
93
95
  },
94
- "aria-expanded": isExpanded,
95
- label: isExpanded ? 'Collapse' : 'Expand',
96
+ "aria-expanded": isExpanded
97
+ // We are labelling the icon button using the containing menu item's content, to provide context to
98
+ // screen readers on what will actually be expanded or collapsed. Screen readers will also use the
99
+ // `aria-expanded` attribute to indicate the expanded state of the menu item.
100
+ // We are not using the `aria-label` attribute here as it is not supported by the `IconButton` component.
101
+ ,
102
+ "aria-labelledby": fg('platform_dst_expandable_menu_item_elembefore_label') ? id : undefined
103
+ // IconButton requires a label prop, however it will not be used by screen readers as we are setting
104
+ // `aria-labelledby`, which will be used instead.
105
+ ,
106
+ label: fg('platform_dst_expandable_menu_item_elembefore_label') ? '' : isExpanded ? 'Collapse' : 'Expand',
96
107
  appearance: "subtle",
97
108
  spacing: "compact",
98
109
  onClick: handleIconClick,
99
- interactionName: interactionName
110
+ interactionName: interactionName,
111
+ testId: testId ? "".concat(testId, "--elem-before-button") : undefined
100
112
  }) : /*#__PURE__*/React.createElement(ExpandableMenuItemIcon, {
101
113
  isExpanded: isExpanded,
102
114
  isSelected: isSelected,
@@ -108,6 +120,7 @@ export var ExpandableMenuItemTrigger = /*#__PURE__*/forwardRef(function (_ref2,
108
120
  ref: itemRef,
109
121
  className: ax([wrapperStyles.root, providedElemBefore && wrapperStyles.showProvidedElemBefore])
110
122
  }, /*#__PURE__*/React.createElement(MenuItemBase, {
123
+ id: id,
111
124
  actions: actions,
112
125
  actionsOnHover: actionsOnHover,
113
126
  elemBefore: elemBefore,
@@ -46,8 +46,8 @@
46
46
  ._4cvr1h6o{align-items:center}
47
47
  ._4t3i1crf{height:9pt}
48
48
  ._4t3i1tcg{height:24px}
49
- ._4t3ickbl{height:3pc}
50
- ._4t3izwfg{height:2pc}
49
+ ._4t3i1wto{height:3rem}
50
+ ._4t3iviql{height:2rem}
51
51
  ._85i51b66{padding-block-end:var(--ds-space-050,4px)}
52
52
  ._85i5v77o{padding-block-end:var(--ds-space-025,2px)}
53
53
  ._91ju1txw{--elem-after-display:flex}
@@ -135,14 +135,13 @@ var onTopOfButtonOrAnchorStyles = {
135
135
  */
136
136
  export var nestedOpenPopupCSSSelector = '&:has([aria-expanded="true"][aria-haspopup="true"])';
137
137
  var containerStyles = {
138
- root: "_2rkoglpi _vchhusvi _1e0c11p5 _yv0e7dup _2z05hkll _1lmcu4vt _1ul9t9kd _4t3izwfg _4cvr1h6o _uiztglyw _syaz1gjq _ek6gglyw _1yyu1j28 _91ju1txw _1swv108i _1ojv1txw _irr3108i _1brr1txw _109x1txw",
138
+ root: "_2rkoglpi _vchhusvi _1e0c11p5 _yv0e7dup _2z05hkll _1lmcu4vt _1ul9t9kd _4t3iviql _4cvr1h6o _uiztglyw _syaz1gjq _ek6gglyw _1yyu1j28 _91ju1txw _1swv108i _1ojv1txw _irr3108i _1brr1txw _109x1txw",
139
139
  removeElemAfter: "_91juglyw",
140
140
  showHoverActions: "_ek6g1txw",
141
- removeElemAfterOnHover: "_1mfcglyw _1sjuglyw",
142
141
  removeElemAfterOnHoverOrOpenNestedPopup: "_1djyglyw _1mfcglyw _1sjuglyw",
143
142
  selected: "_bfhkfg4m _syazaqb7 _1yyu1fvw _1swvi1yw _30l3aqb7 _irr3i1yw",
144
143
  disabled: "_syaz1lh4 _irr3n7od",
145
- hasDescription: "_4t3ickbl",
144
+ hasDescription: "_4t3i1wto",
146
145
  dragging: "_tzy41ou4"
147
146
  };
148
147
  var buttonOrAnchorStyles = {
@@ -212,7 +211,8 @@ function getTextColor(_ref2) {
212
211
  * This can be inferred from the type of the `onClick` prop.
213
212
  */
214
213
  var MenuItemBaseNoRef = function MenuItemBaseNoRef(_ref3, forwardedRef) {
215
- var testId = _ref3.testId,
214
+ var id = _ref3.id,
215
+ testId = _ref3.testId,
216
216
  actions = _ref3.actions,
217
217
  actionsOnHover = _ref3.actionsOnHover,
218
218
  children = _ref3.children,
@@ -337,6 +337,7 @@ var MenuItemBaseNoRef = function MenuItemBaseNoRef(_ref3, forwardedRef) {
337
337
  'aria-controls': ariaControls,
338
338
  'aria-haspopup': ariaHasPopup,
339
339
  ref: mergeRefs([forwardedRef, tooltipProps.ref]),
340
+ id: id,
340
341
  testId: testId,
341
342
  interactionName: interactionName
342
343
  });
@@ -12,5 +12,5 @@ import type { SkipLinkData } from '../../context/skip-links/types';
12
12
  export declare const SkipLink: ({ id, children, onBeforeNavigate, }: {
13
13
  id: string;
14
14
  children: ReactNode;
15
- onBeforeNavigate?: SkipLinkData['onBeforeNavigate'];
15
+ onBeforeNavigate?: SkipLinkData["onBeforeNavigate"];
16
16
  }) => JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * A container element for the skip links
4
3
  * The default label will be used when the `skipLinksLabel` attribute is not
@@ -9,5 +8,5 @@
9
8
  */
10
9
  export declare const SkipLinksContainer: ({ label, testId }: {
11
10
  label: string;
12
- testId?: string | undefined;
11
+ testId?: string;
13
12
  }) => JSX.Element | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type SkipLinkData } from './types';
3
2
  export type SkipLinksContextData = {
4
3
  registerSkipLink: (skipLinkData: SkipLinkData) => void;
@@ -20,4 +19,18 @@ export declare const useSkipLinkInternal: ({ id, label, listIndex, onBeforeNavig
20
19
  /**
21
20
  * Call `useSkipLink` to register a skip link for important elements on the page.
22
21
  */
23
- export declare const useSkipLink: (id: string, label: string, listIndex?: number) => void;
22
+ export declare const useSkipLink: (
23
+ /**
24
+ * The unique ID for the skip link.
25
+ * You can use the `useSkipLinkId` hook to generate a unique ID.
26
+ */
27
+ id: string,
28
+ /**
29
+ * The label for the skip link.
30
+ */
31
+ label: string,
32
+ /**
33
+ * You can optionally set the position of the skip link in the list of skip links.
34
+ * Positions are zero-indexed.
35
+ */
36
+ listIndex?: number) => void;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type SkipLinkData } from './types';
3
2
  /**
4
3
  * Provides a way to store skip links
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Context for the TopNavStart container element
4
3
  * Used to power the side nav flyout by allowing the side nav to bind event listeners to the element, so we can
@@ -31,8 +31,8 @@ export type ButtonMenuItemProps = MenuItemLinkOrButtonCommonProps & {
31
31
  * A menu item button. It should be used within a `ul`, as it renders a list item.
32
32
  */
33
33
  export declare const ButtonMenuItem: React.ForwardRefExoticComponent<import("./types").MenuItemCommonProps & import("./types").MenuItemSlots & {
34
- description?: string | undefined;
35
- listItemRef?: React.Ref<HTMLDivElement> | undefined;
34
+ description?: string;
35
+ listItemRef?: React.Ref<HTMLDivElement>;
36
36
  } & {
37
37
  /**
38
38
  * We are not using a discriminated union to enforce that the `actions` and `actionsOnHover`
@@ -47,9 +47,9 @@ export declare const ButtonMenuItem: React.ForwardRefExoticComponent<import("./t
47
47
  *
48
48
  * The menu item will not be interactive and will not respond to hover or focus.
49
49
  */
50
- isDisabled?: boolean | undefined;
50
+ isDisabled?: boolean;
51
51
  /**
52
52
  * Called when the user has clicked on the trigger content.
53
53
  */
54
- onClick?: MenuItemOnClick<HTMLButtonElement> | undefined;
54
+ onClick?: MenuItemOnClick<HTMLButtonElement>;
55
55
  } & React.RefAttributes<HTMLButtonElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export type ContainerAvatarProps = {
3
2
  /**
4
3
  * The source of the avatar image.
@@ -3,5 +3,4 @@
3
3
  * @jsxRuntime classic
4
4
  * @jsx jsx
5
5
  */
6
- /// <reference types="react" />
7
6
  export default function DragHandle(): JSX.Element;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  type onExpansionToggle = (isExpanded: boolean) => void;
3
2
  /**
4
3
  * Whether all ancestor menu items of the current menu item are expanded. Used to know if the current menu item is
@@ -22,7 +21,7 @@ export declare const OnExpansionToggleContext: import("react").Context<onExpansi
22
21
  */
23
22
  export declare const LevelContext: import("react").Context<number>;
24
23
  export declare const useIsExpanded: () => boolean;
25
- export declare const useSetIsExpanded: () => (value: boolean) => void;
24
+ export declare const useSetIsExpanded: () => ((value: boolean) => void);
26
25
  export declare const useOnExpansionToggle: () => onExpansionToggle | null;
27
26
  export declare const useLevel: () => number;
28
27
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * A context for storing the level value of the ExpandableMenuItem.
4
3
  */
@@ -96,7 +96,7 @@ export declare const ExpandableMenuItemTrigger: React.ForwardRefExoticComponent<
96
96
  /**
97
97
  * Indicates that the menu item is selected.
98
98
  */
99
- isSelected?: boolean | undefined;
99
+ isSelected?: boolean;
100
100
  /**
101
101
  * If provided, the chevron icon (expand/collapse symbol) will be rendered within a separate
102
102
  * icon button element. Clicking on this icon button will not trigger the `onClick` event. It
@@ -104,7 +104,7 @@ export declare const ExpandableMenuItemTrigger: React.ForwardRefExoticComponent<
104
104
  *
105
105
  * If a `href` is not provided, the chevron icon is rendered as part of the element.
106
106
  */
107
- href?: string | undefined;
107
+ href?: string;
108
108
  /**
109
109
  * Called when the user has clicked on the trigger content.
110
110
  *
@@ -115,7 +115,7 @@ export declare const ExpandableMenuItemTrigger: React.ForwardRefExoticComponent<
115
115
  * If you need a callback for when the user expands or collapses the expandable, use
116
116
  * `onExpansionToggle` on the `ExpandableMenuItem` component instead.
117
117
  */
118
- onClick?: ((event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent, analyticsAttributes: {
118
+ onClick?: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>, analyticsEvent: UIAnalyticsEvent, analyticsAttributes: {
119
119
  isExpanded: boolean;
120
- }) => void) | undefined;
121
- } & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
120
+ }) => void;
121
+ } & React.RefAttributes<HTMLAnchorElement | HTMLButtonElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * __Is open context__
4
3
  *
@@ -78,9 +78,9 @@ export declare const FlyoutMenuItemTrigger: import("react").ForwardRefExoticComp
78
78
  *
79
79
  * If you are controlling the open state of the flyout menu, use this to update your state.
80
80
  */
81
- onClick?: MenuItemOnClick<HTMLButtonElement> | undefined;
81
+ onClick?: MenuItemOnClick<HTMLButtonElement>;
82
82
  /**
83
83
  * Indicates that the menu item is selected.
84
84
  */
85
- isSelected?: boolean | undefined;
85
+ isSelected?: boolean;
86
86
  } & import("react").RefAttributes<HTMLButtonElement>>;
@@ -1,8 +1,3 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import { type Ref } from 'react';
6
1
  import type { RouterLinkComponentProps } from '@atlaskit/app-provider';
7
2
  import type { MenuItemLinkOrButtonCommonProps, MenuItemOnClick } from './types';
8
3
  export type LinkMenuItemProps<RouterLinkConfig extends Record<string, any> = never> = MenuItemLinkOrButtonCommonProps & RouterLinkComponentProps<RouterLinkConfig> & {
@@ -25,19 +20,19 @@ export type LinkMenuItemProps<RouterLinkConfig extends Record<string, any> = nev
25
20
  * A menu item link. It should be used within a `ul`.
26
21
  */
27
22
  export declare const LinkMenuItem: <RouterLinkConfig extends Record<string, any> = never>(props: import("./types").MenuItemCommonProps & import("./types").MenuItemSlots & {
28
- description?: string | undefined;
29
- listItemRef?: Ref<HTMLDivElement> | undefined;
23
+ description?: string;
24
+ listItemRef?: React.Ref<HTMLDivElement>;
30
25
  } & RouterLinkComponentProps<RouterLinkConfig> & {
31
26
  /**
32
27
  * The native `target` attribute for the anchor element.
33
28
  */
34
- target?: string | undefined;
29
+ target?: HTMLAnchorElement["target"];
35
30
  /**
36
31
  * Whether the menu item is selected.
37
32
  */
38
- isSelected?: boolean | undefined;
33
+ isSelected?: boolean;
39
34
  /**
40
35
  * Called when the user has clicked on the trigger content.
41
36
  */
42
- onClick?: MenuItemOnClick<HTMLAnchorElement> | undefined;
43
- } & import("react").RefAttributes<HTMLAnchorElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
37
+ onClick?: MenuItemOnClick<HTMLAnchorElement>;
38
+ } & import("react").RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
@@ -27,16 +27,21 @@ export declare const nestedOpenPopupCSSSelector = "&:has([aria-expanded=\"true\"
27
27
  * It contains a type argument `<T>`, to specify the type of the interactive element (`button` or `a`).
28
28
  * This can be inferred from the type of the `onClick` prop.
29
29
  */
30
- export declare const MenuItemBase: <T extends HTMLButtonElement | HTMLAnchorElement>(props: import("./types").MenuItemCommonProps & import("./types").MenuItemSlots & {
31
- description?: string | undefined;
32
- listItemRef?: React.Ref<HTMLDivElement> | undefined;
30
+ export declare const MenuItemBase: <T extends HTMLAnchorElement | HTMLButtonElement>(props: import("./types").MenuItemCommonProps & import("./types").MenuItemSlots & {
31
+ description?: string;
32
+ listItemRef?: React.Ref<HTMLDivElement>;
33
33
  } & {
34
- href?: string | Record<string, any> | undefined;
35
- target?: string | undefined;
36
- isDisabled?: boolean | undefined;
37
- isSelected?: boolean | undefined;
38
- ariaControls?: string | undefined;
39
- ariaExpanded?: boolean | undefined;
40
- ariaHasPopup?: boolean | "dialog" | undefined;
34
+ /**
35
+ * ID attribute, passed to the interactive element (anchor/button). This is not publicly exposed, and is currently only
36
+ * used internally by `ExpandableMenuItemTrigger` for the `aria-labelledby` attribute.
37
+ */
38
+ id?: string;
39
+ href?: string | Record<string, any>;
40
+ target?: HTMLAnchorElement["target"];
41
+ isDisabled?: boolean;
42
+ isSelected?: boolean;
43
+ ariaControls?: string;
44
+ ariaExpanded?: boolean;
45
+ ariaHasPopup?: boolean | "dialog";
41
46
  onClick?: MenuItemOnClick<T> | undefined;
42
- } & React.RefAttributes<T>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
47
+ } & React.RefAttributes<T>) => React.ReactElement | null;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * __Menu list item__
4
3
  *
@@ -6,6 +5,6 @@
6
5
  */
7
6
  export declare const MenuListItem: import("react").ForwardRefExoticComponent<{
8
7
  children: import("react").ReactNode;
9
- testId?: string | undefined;
8
+ testId?: string;
10
9
  xcss?: import("@atlaskit/css").StrictXCSSProp<"display" | "scrollMarginInline", never>;
11
10
  } & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type ListProps } from '../../components/list';
3
2
  /**
4
3
  * __Menu list__
@@ -2,7 +2,6 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- /// <reference types="react" />
6
5
  /**
7
6
  * Use this component to create visual separation between the:
8
7
  *
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Scrolls the element into view once it is selected, and once all its ancestors (expandable
4
3
  * parent menu items) are expanded.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * __Divider__
4
3
  *
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  /**
3
2
  * Context for the current menu section. It holds a unique ID for the section, used for associating the section heading
4
3
  * as an accessible label for the group.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { StrictXCSSProp } from '@atlaskit/css';
3
2
  import type { CommonSlotProps } from './types';
4
3
  /**
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { StrictXCSSProp } from '@atlaskit/css';
3
2
  import type { CommonSlotProps } from './types';
4
3
  /**