@atlaskit/navigation-system 2.12.0 → 2.14.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 (32) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +57 -29
  3. package/dist/cjs/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -2
  4. package/dist/cjs/ui/page-layout/side-nav/side-nav.compiled.css +1 -2
  5. package/dist/cjs/ui/page-layout/side-nav/side-nav.js +3 -6
  6. package/dist/cjs/ui/page-layout/side-nav/toggle-button.js +14 -2
  7. package/dist/cjs/ui/top-nav-items/themed/button.js +29 -25
  8. package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +33 -4
  9. package/dist/es2019/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -2
  10. package/dist/es2019/ui/page-layout/side-nav/side-nav.compiled.css +1 -2
  11. package/dist/es2019/ui/page-layout/side-nav/side-nav.js +3 -6
  12. package/dist/es2019/ui/page-layout/side-nav/toggle-button.js +13 -3
  13. package/dist/es2019/ui/top-nav-items/themed/button.js +29 -25
  14. package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +57 -29
  15. package/dist/esm/ui/page-layout/panel-splitter/side-nav-panel-splitter.js +6 -2
  16. package/dist/esm/ui/page-layout/side-nav/side-nav.compiled.css +1 -2
  17. package/dist/esm/ui/page-layout/side-nav/side-nav.js +3 -6
  18. package/dist/esm/ui/page-layout/side-nav/toggle-button.js +15 -3
  19. package/dist/esm/ui/top-nav-items/themed/button.js +29 -25
  20. package/dist/types/ui/menu-item/link-menu-item.d.ts +1 -17
  21. package/dist/types/ui/menu-item/menu-item.d.ts +19 -14
  22. package/dist/types/ui/menu-item/menu-list-item.d.ts +6 -5
  23. package/dist/types/ui/page-layout/panel-splitter/panel-splitter.d.ts +15 -1
  24. package/dist/types/ui/page-layout/panel-splitter/side-nav-panel-splitter.d.ts +1 -1
  25. package/dist/types/ui/page-layout/side-nav/toggle-button.d.ts +7 -1
  26. package/dist/types-ts4.5/ui/menu-item/link-menu-item.d.ts +1 -17
  27. package/dist/types-ts4.5/ui/menu-item/menu-item.d.ts +19 -14
  28. package/dist/types-ts4.5/ui/menu-item/menu-list-item.d.ts +6 -5
  29. package/dist/types-ts4.5/ui/page-layout/panel-splitter/panel-splitter.d.ts +15 -1
  30. package/dist/types-ts4.5/ui/page-layout/panel-splitter/side-nav-panel-splitter.d.ts +1 -1
  31. package/dist/types-ts4.5/ui/page-layout/side-nav/toggle-button.d.ts +7 -1
  32. package/package.json +9 -9
@@ -116,16 +116,7 @@ const ThemedPressable = /*#__PURE__*/forwardRef(function ThemedPressable({
116
116
  isDisabled: isDisabled
117
117
  }));
118
118
  });
119
- /**
120
- * Intentionally an almost-duplicate of `ThemedPressable` - make sure to update both.
121
- *
122
- * More 'clever' solutions were tried but I couldn't get them working in an acceptable state.
123
- *
124
- * Polymorphism had many typing issues and required sacrificing type safety.
125
- *
126
- * Render props had problems passing down styles through `xcss` to the `children` function.
127
- */
128
- const ThemedAnchor = forwardRefWithGeneric(function ThemedAnchor({
119
+ function ThemedAnchorFn({
129
120
  appearance = 'default',
130
121
  shape = 'default',
131
122
  isSelected,
@@ -144,7 +135,17 @@ const ThemedAnchor = forwardRefWithGeneric(function ThemedAnchor({
144
135
  ,
145
136
  xcss: cx(styles.root, shapeStyles[shape], hasBorder && styles.border, appearanceStyles[appearance], isSelected && styles.selected, isDisabled && styles.disabled)
146
137
  }));
147
- });
138
+ }
139
+ /**
140
+ * Intentionally an almost-duplicate of `ThemedPressable` - make sure to update both.
141
+ *
142
+ * More 'clever' solutions were tried but I couldn't get them working in an acceptable state.
143
+ *
144
+ * Polymorphism had many typing issues and required sacrificing type safety.
145
+ *
146
+ * Render props had problems passing down styles through `xcss` to the `children` function.
147
+ */
148
+ const ThemedAnchor = forwardRefWithGeneric(ThemedAnchorFn);
148
149
  const textButtonStyles = {
149
150
  iconBefore: "_vwz4idpf",
150
151
  text: "_k48p1wq8"
@@ -175,12 +176,7 @@ export const ThemedButton = /*#__PURE__*/forwardRef(function ThemedButton({
175
176
  className: ax([textButtonStyles.text])
176
177
  }, children));
177
178
  });
178
- /**
179
- * __Themed link button__
180
- *
181
- * A themed link button for the top bar.
182
- */
183
- export const ThemedLinkButton = forwardRefWithGeneric(function ThemedLinkButton({
179
+ function ThemedLinkButtonFn({
184
180
  iconBefore: IconBefore,
185
181
  children,
186
182
  ...props
@@ -195,7 +191,13 @@ export const ThemedLinkButton = forwardRefWithGeneric(function ThemedLinkButton(
195
191
  })), /*#__PURE__*/React.createElement("span", {
196
192
  className: ax([textButtonStyles.text])
197
193
  }, children));
198
- });
194
+ }
195
+ /**
196
+ * __Themed link button__
197
+ *
198
+ * A themed link button for the top bar.
199
+ */
200
+ export const ThemedLinkButton = forwardRefWithGeneric(ThemedLinkButtonFn);
199
201
 
200
202
  /**
201
203
  * Props shared by `ThemedIconButtonProps` and `ThemedLinkIconButton`
@@ -266,12 +268,7 @@ export const ThemedIconButton = /*#__PURE__*/forwardRef(function ThemedIconButto
266
268
  color: "currentColor"
267
269
  }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)));
268
270
  });
269
- /**
270
- * __Themed link icon button__
271
- *
272
- * A themed link icon button for the top bar.
273
- */
274
- export const ThemedLinkIconButton = forwardRefWithGeneric(function ThemedLinkIconButton({
271
+ function ThemedLinkIconButtonFn({
275
272
  icon: Icon,
276
273
  label,
277
274
  tooltip,
@@ -330,4 +327,11 @@ export const ThemedLinkIconButton = forwardRefWithGeneric(function ThemedLinkIco
330
327
  label: "",
331
328
  color: "currentColor"
332
329
  }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label)));
333
- });
330
+ }
331
+
332
+ /**
333
+ * __Themed link icon button__
334
+ *
335
+ * A themed link icon button for the top bar.
336
+ */
337
+ export const ThemedLinkIconButton = forwardRefWithGeneric(ThemedLinkIconButtonFn);
@@ -19,6 +19,7 @@ import { draggable } from '@atlaskit/pragmatic-drag-and-drop/element/adapter';
19
19
  import { blockDraggingToIFrames } from '@atlaskit/pragmatic-drag-and-drop/element/block-dragging-to-iframes';
20
20
  import { disableNativeDragPreview } from '@atlaskit/pragmatic-drag-and-drop/element/disable-native-drag-preview';
21
21
  import { preventUnhandled } from '@atlaskit/pragmatic-drag-and-drop/prevent-unhandled';
22
+ import Tooltip from '@atlaskit/tooltip';
22
23
  import VisuallyHidden from '@atlaskit/visually-hidden';
23
24
  import { OnDoubleClickContext, PanelSplitterContext } from './context';
24
25
  import { convertResizeBoundToPixels } from './convert-resize-bound-to-pixels';
@@ -41,6 +42,24 @@ var panelSplitterDragDataSymbol = Symbol('panel-splitter-drag-data');
41
42
  function signPanelSplitterDragData(data) {
42
43
  return _objectSpread(_objectSpread({}, data), {}, _defineProperty({}, panelSplitterDragDataSymbol, true));
43
44
  }
45
+ /**
46
+ * A wrapper component that renders a tooltip if the tooltipContent or shortcut is provided.
47
+ */
48
+ var MaybeTooltip = function MaybeTooltip(_ref) {
49
+ var tooltipContent = _ref.tooltipContent,
50
+ shortcut = _ref.shortcut,
51
+ children = _ref.children;
52
+ if ((tooltipContent || shortcut) && fg('platform-dst-tooltip-shortcuts')) {
53
+ return /*#__PURE__*/React.createElement(Tooltip, {
54
+ content: tooltipContent,
55
+ shortcut: shortcut,
56
+ position: "mouse",
57
+ mousePosition: "right",
58
+ isScreenReaderAnnouncementDisabled: true
59
+ }, children);
60
+ }
61
+ return children;
62
+ };
44
63
  export function isPanelSplitterDragData(data) {
45
64
  return data[panelSplitterDragDataSymbol] === true;
46
65
  }
@@ -49,19 +68,21 @@ function getTextDirection(element) {
49
68
  direction = _window$getComputedSt.direction;
50
69
  return direction === 'rtl' ? 'rtl' : 'ltr';
51
70
  }
52
- var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
53
- var label = _ref.label,
54
- onResizeStart = _ref.onResizeStart,
55
- onResizeEnd = _ref.onResizeEnd,
56
- testId = _ref.testId,
57
- panelId = _ref.panelId,
58
- panelWidth = _ref.panelWidth,
59
- onCompleteResize = _ref.onCompleteResize,
60
- getResizeBounds = _ref.getResizeBounds,
61
- panel = _ref.panel,
62
- portal = _ref.portal,
63
- resizingCssVar = _ref.resizingCssVar,
64
- position = _ref.position;
71
+ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref2) {
72
+ var label = _ref2.label,
73
+ onResizeStart = _ref2.onResizeStart,
74
+ onResizeEnd = _ref2.onResizeEnd,
75
+ testId = _ref2.testId,
76
+ panelId = _ref2.panelId,
77
+ panelWidth = _ref2.panelWidth,
78
+ onCompleteResize = _ref2.onCompleteResize,
79
+ getResizeBounds = _ref2.getResizeBounds,
80
+ panel = _ref2.panel,
81
+ portal = _ref2.portal,
82
+ resizingCssVar = _ref2.resizingCssVar,
83
+ position = _ref2.position,
84
+ tooltipContent = _ref2.tooltipContent,
85
+ shortcut = _ref2.shortcut;
65
86
  var splitterRef = useRef(null);
66
87
  var labelId = useId();
67
88
  // Separate state used for the input range width to remove the UI's dependency on the "persisted" layout state value being updated
@@ -98,8 +119,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
98
119
  element: splitter
99
120
  }), draggable({
100
121
  element: splitter,
101
- onGenerateDragPreview: function onGenerateDragPreview(_ref2) {
102
- var nativeSetDragImage = _ref2.nativeSetDragImage;
122
+ onGenerateDragPreview: function onGenerateDragPreview(_ref3) {
123
+ var nativeSetDragImage = _ref3.nativeSetDragImage;
103
124
  // We will be moving the line to indicate a drag. We can disable the native drag preview
104
125
  disableNativeDragPreview({
105
126
  nativeSetDragImage: nativeSetDragImage
@@ -126,8 +147,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
126
147
  direction: getTextDirection(panel)
127
148
  });
128
149
  },
129
- onDragStart: function onDragStart(_ref3) {
130
- var source = _ref3.source;
150
+ onDragStart: function onDragStart(_ref4) {
151
+ var source = _ref4.source;
131
152
  invariant(isPanelSplitterDragData(source.data));
132
153
  onResizeStart === null || onResizeStart === void 0 || onResizeStart({
133
154
  initialWidth: source.data.initialWidth
@@ -136,9 +157,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
136
157
  // Close any open layers when the user starts resizing
137
158
  openLayerObserver === null || openLayerObserver === void 0 || openLayerObserver.closeLayers();
138
159
  },
139
- onDrag: function onDrag(_ref4) {
140
- var location = _ref4.location,
141
- source = _ref4.source;
160
+ onDrag: function onDrag(_ref5) {
161
+ var location = _ref5.location,
162
+ source = _ref5.source;
142
163
  invariant(isPanelSplitterDragData(source.data));
143
164
  var _source$data = source.data,
144
165
  initialWidth = _source$data.initialWidth,
@@ -159,8 +180,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
159
180
  panel.style.setProperty(resizingCssVar, resizingWidth);
160
181
  source.data.resizingWidth = resizingWidth;
161
182
  },
162
- onDrop: function onDrop(_ref5) {
163
- var source = _ref5.source;
183
+ onDrop: function onDrop(_ref6) {
184
+ var source = _ref6.source;
164
185
  invariant(isPanelSplitterDragData(source.data));
165
186
  preventUnhandled.stop();
166
187
  var finalWidth = getPixelWidth(panel);
@@ -271,6 +292,9 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
271
292
  return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
272
293
  "data-testid": testId ? "".concat(testId, "-container") : undefined,
273
294
  className: ax([containerStyles.root, position === 'start' && containerStyles.positionStart, position === 'end' && containerStyles.positionEnd])
295
+ }, /*#__PURE__*/React.createElement(MaybeTooltip, {
296
+ tooltipContent: tooltipContent,
297
+ shortcut: shortcut
274
298
  }, /*#__PURE__*/React.createElement("div", {
275
299
  ref: splitterRef,
276
300
  "data-testid": testId,
@@ -291,7 +315,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
291
315
  id: labelId
292
316
  }, label)), /*#__PURE__*/React.createElement("span", {
293
317
  className: ax([lineStyles.root])
294
- }))), portal);
318
+ })))), portal);
295
319
  };
296
320
 
297
321
  /**
@@ -309,11 +333,13 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref) {
309
333
  * </SideNav>
310
334
  * ```
311
335
  */
312
- export var PanelSplitter = function PanelSplitter(_ref6) {
313
- var label = _ref6.label,
314
- onResizeStart = _ref6.onResizeStart,
315
- onResizeEnd = _ref6.onResizeEnd,
316
- testId = _ref6.testId;
336
+ export var PanelSplitter = function PanelSplitter(_ref7) {
337
+ var label = _ref7.label,
338
+ onResizeStart = _ref7.onResizeStart,
339
+ onResizeEnd = _ref7.onResizeEnd,
340
+ testId = _ref7.testId,
341
+ tooltipContent = _ref7.tooltipContent,
342
+ shortcut = _ref7.shortcut;
317
343
  var _useState7 = useState(null),
318
344
  _useState8 = _slicedToArray(_useState7, 2),
319
345
  panel = _useState8[0],
@@ -427,6 +453,8 @@ export var PanelSplitter = function PanelSplitter(_ref6) {
427
453
  onCompleteResize: onCompleteResize,
428
454
  getResizeBounds: getResizeBounds,
429
455
  resizingCssVar: resizingCssVar,
430
- position: position
456
+ position: position,
457
+ tooltipContent: tooltipContent,
458
+ shortcut: shortcut
431
459
  });
432
460
  };
@@ -23,7 +23,9 @@ export var SideNavPanelSplitter = function SideNavPanelSplitter(_ref) {
23
23
  onResizeEnd = _ref.onResizeEnd,
24
24
  testId = _ref.testId,
25
25
  _ref$shouldCollapseOn = _ref.shouldCollapseOnDoubleClick,
26
- shouldCollapseOnDoubleClick = _ref$shouldCollapseOn === void 0 ? true : _ref$shouldCollapseOn;
26
+ shouldCollapseOnDoubleClick = _ref$shouldCollapseOn === void 0 ? true : _ref$shouldCollapseOn,
27
+ tooltipContent = _ref.tooltipContent,
28
+ shortcut = _ref.shortcut;
27
29
  var context = useContext(PanelSplitterContext);
28
30
  invariant((context === null || context === void 0 ? void 0 : context.panelId) === sideNavPanelSplitterId, 'SideNavPanelSplitter must be rendered as a child of <SideNav />.');
29
31
  var toggleSideNav = useToggleSideNav({
@@ -35,6 +37,8 @@ export var SideNavPanelSplitter = function SideNavPanelSplitter(_ref) {
35
37
  label: label,
36
38
  onResizeStart: onResizeStart,
37
39
  onResizeEnd: onResizeEnd,
38
- testId: testId
40
+ testId: testId,
41
+ tooltipContent: tooltipContent,
42
+ shortcut: shortcut
39
43
  }));
40
44
  };
@@ -1,7 +1,6 @@
1
1
 
2
2
  ._nd5l1b6c{grid-area:main/aside/aside/aside}
3
3
  ._191wglyw{border-inline-start:none}
4
- ._t51z7r9e{border-inline-end:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}
5
4
  ._t51zglyw{border-inline-end:none}._152timx3{inset-block-start:calc(var(--n_bnrM, 0px) + var(--n_tNvM, 0px))}
6
5
  ._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
7
6
  ._1bah1yb4{justify-content:space-between}
@@ -16,5 +15,5 @@
16
15
  ._kqsw1if8{position:sticky}
17
16
  ._vchhusvi{box-sizing:border-box}
18
17
  @media (min-width:48rem){._14b5hc79{width:var(--n_snvRsz,var(--n_sNvw))}}
19
- @media (min-width:64rem){._165t56xv{height:calc(100vh - var(--n_bnrM, 0px))}._180k1wjm{inset-block-start:calc(var(--n_bnrM, 0px))}._26vxoned{padding-block-start:calc(var(--n_tNvM, 0px))}._1mt19dtb{margin-block-start:calc(var(--n_tNvM, 0px)*-1)}._dm2518uv{display:initial}._dm25glyw{display:none}._p5cl7r9e{border-inline-end:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}._p5clglyw{border-inline-end:none}._qiln1gzg{grid-area:main}._4ap31bhr{background-color:var(--ds-surface-overlay,#fff)}._scbp1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}._qilnk0mc{grid-area:side-nav}._4ap3vuon{background-color:var(--ds-surface,#fff)}._scbpglyw{box-shadow:none}}
18
+ @media (min-width:64rem){._165t56xv{height:calc(100vh - var(--n_bnrM, 0px))}._180k1wjm{inset-block-start:calc(var(--n_bnrM, 0px))}._26vxoned{padding-block-start:calc(var(--n_tNvM, 0px))}._1mt19dtb{margin-block-start:calc(var(--n_tNvM, 0px)*-1)}._dm2518uv{display:initial}._dm25glyw{display:none}._qiln1gzg{grid-area:main}._p5clglyw{border-inline-end:none}._4ap31bhr{background-color:var(--ds-surface-overlay,#fff)}._scbp1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}._qilnk0mc{grid-area:side-nav}._p5cl7r9e{border-inline-end:var(--ds-border-width,1px) solid var(--ds-border,#091e4224)}._4ap3vuon{background-color:var(--ds-surface,#fff)}._scbpglyw{box-shadow:none}}
20
19
  @supports not (-moz-appearance:none){@media (prefers-reduced-motion:no-preference){._139f8iot{transition-property:transform,display}._1tpvfnf5{transition-duration:.2s}._sylc1a5r{transition-behavior:allow-discrete}._1uwsjq3t{transform:translateX(-100%)}}@media (prefers-reduced-motion:no-preference){@starting-style{._oyeijq3t{transform:translateX(-100%)}}._139f8iot{transition-property:transform,display}._1tpvfnf5{transition-duration:.2s}._sylc1a5r{transition-behavior:allow-discrete}}}
@@ -42,11 +42,8 @@ function getResizeBounds() {
42
42
  }
43
43
  var openLayerObserverSideNavNamespace = 'side-nav';
44
44
  var styles = {
45
- root: "_nd5l1b6c _bfhk1bhr _16qs1cd0 _vchhusvi _4t3ieqxy _152timx3 _kqsw1if8 _1bsb1ego _1pbycs5v _14b5hc79 _qilnk0mc _4ap3vuon _scbpglyw",
46
- oldBorder: "_t51z7r9e",
47
- newBorder: "_191wglyw _t51zglyw _p5cl7r9e",
48
- newBorderFlyoutOpen: "_p5clglyw",
49
- flyoutOpen: "_qiln1gzg _4ap31bhr _scbp1cd0 _139f8iot _1tpvfnf5 _sylc1a5r _oyeijq3t",
45
+ root: "_nd5l1b6c _191wglyw _t51zglyw _bfhk1bhr _16qs1cd0 _vchhusvi _4t3ieqxy _152timx3 _kqsw1if8 _1bsb1ego _1pbycs5v _14b5hc79 _qilnk0mc _p5cl7r9e _4ap3vuon _scbpglyw",
46
+ flyoutOpen: "_qiln1gzg _p5clglyw _4ap31bhr _scbp1cd0 _139f8iot _1tpvfnf5 _sylc1a5r _oyeijq3t",
50
47
  flyoutAnimateClosed: "_1e0cglyw _qiln1gzg _139f8iot _1tpvfnf5 _sylc1a5r _1uwsjq3t",
51
48
  flexContainer: "_4t3i1osq _1e0c1txw _2lx21bp4 _1bah1yb4",
52
49
  hiddenMobileAndDesktop: "_1e0cglyw",
@@ -574,7 +571,7 @@ function SideNavInternal(_ref) {
574
571
  style: _defineProperty({}, sideNavVar, clampedWidth),
575
572
  ref: mergedRef,
576
573
  "data-testid": testId,
577
- className: ax([styles.root, fg('platform_design_system_nav4_sidenav_border') ? styles.newBorder : styles.oldBorder, isExpandedOnDesktop && !isExpandedOnMobile && !isFlyoutVisible && styles.hiddenMobileOnly, !isExpandedOnDesktop && isExpandedOnMobile && !isFlyoutVisible && styles.hiddenDesktopOnly, !isExpandedOnDesktop && !isExpandedOnMobile && !isFlyoutVisible && styles.hiddenMobileAndDesktop, (sideNavState === null || sideNavState === void 0 ? void 0 : sideNavState.flyout) === 'open' && styles.flyoutOpen, (sideNavState === null || sideNavState === void 0 ? void 0 : sideNavState.flyout) === 'open' && fg('platform_design_system_nav4_sidenav_border') && styles.newBorderFlyoutOpen, (sideNavState === null || sideNavState === void 0 ? void 0 : sideNavState.flyout) === 'triggered-animate-close' && styles.flyoutAnimateClosed, isFlyoutClosed && fg('navx-full-height-sidebar') && styles.fullHeightSidebar])
574
+ className: ax([styles.root, isExpandedOnDesktop && !isExpandedOnMobile && !isFlyoutVisible && styles.hiddenMobileOnly, !isExpandedOnDesktop && isExpandedOnMobile && !isFlyoutVisible && styles.hiddenDesktopOnly, !isExpandedOnDesktop && !isExpandedOnMobile && !isFlyoutVisible && styles.hiddenMobileAndDesktop, (sideNavState === null || sideNavState === void 0 ? void 0 : sideNavState.flyout) === 'open' && styles.flyoutOpen, (sideNavState === null || sideNavState === void 0 ? void 0 : sideNavState.flyout) === 'triggered-animate-close' && styles.flyoutAnimateClosed, isFlyoutClosed && fg('navx-full-height-sidebar') && styles.fullHeightSidebar])
578
575
  }), /*#__PURE__*/React.createElement(DangerouslyHoistCssVarToDocumentRoot, {
579
576
  variableName: sideNavLiveWidthVar,
580
577
  value: "0px",
@@ -1,8 +1,11 @@
1
1
  /* toggle-button.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
  import "./toggle-button.compiled.css";
4
5
  import { ax, ix } from "@compiled/react/runtime";
5
- import React, { useCallback, useContext, useEffect, useRef, useState } from 'react';
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ import React, { useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
6
9
  import { bind } from 'bind-event-listener';
7
10
  import SidebarCollapseIcon from '@atlaskit/icon/core/sidebar-collapse';
8
11
  import SidebarExpandIcon from '@atlaskit/icon/core/sidebar-expand';
@@ -38,7 +41,8 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
38
41
  collapseLabel = _ref.collapseLabel,
39
42
  testId = _ref.testId,
40
43
  interactionName = _ref.interactionName,
41
- onClick = _ref.onClick;
44
+ onClick = _ref.onClick,
45
+ shortcut = _ref.shortcut;
42
46
  var _useSideNavVisibility = useSideNavVisibility({
43
47
  defaultCollapsed: defaultCollapsed
44
48
  }),
@@ -102,6 +106,14 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
102
106
  className: ax(["_1e0c1bgi _lcxvglyw"])
103
107
  }, isSideNavExpanded ? /*#__PURE__*/React.createElement(SidebarCollapseIcon, props) : /*#__PURE__*/React.createElement(SidebarExpandIcon, props));
104
108
  };
109
+ var tooltipProps = useMemo(function () {
110
+ if (fg('platform-dst-tooltip-shortcuts')) {
111
+ return _objectSpread(_objectSpread({}, toggleButtonTooltipOptions), {}, {
112
+ shortcut: shortcut
113
+ });
114
+ }
115
+ return toggleButtonTooltipOptions;
116
+ }, [shortcut]);
105
117
  var iconButton = /*#__PURE__*/React.createElement(IconButton, {
106
118
  appearance: "subtle",
107
119
  label: isSideNavExpanded ? collapseLabel : expandLabel,
@@ -111,7 +123,7 @@ export var SideNavToggleButton = function SideNavToggleButton(_ref) {
111
123
  isTooltipDisabled: false,
112
124
  interactionName: interactionName,
113
125
  ref: fg('platform_fix_component_state_update_for_suspense') ? elementRef : ref,
114
- tooltip: toggleButtonTooltipOptions
126
+ tooltip: tooltipProps
115
127
  });
116
128
  var isInsideSlot = useContext(SideNavToggleButtonSlotContext);
117
129
 
@@ -124,16 +124,7 @@ var ThemedPressable = /*#__PURE__*/forwardRef(function ThemedPressable(_ref2, re
124
124
  isDisabled: isDisabled
125
125
  }));
126
126
  });
127
- /**
128
- * Intentionally an almost-duplicate of `ThemedPressable` - make sure to update both.
129
- *
130
- * More 'clever' solutions were tried but I couldn't get them working in an acceptable state.
131
- *
132
- * Polymorphism had many typing issues and required sacrificing type safety.
133
- *
134
- * Render props had problems passing down styles through `xcss` to the `children` function.
135
- */
136
- var ThemedAnchor = forwardRefWithGeneric(function ThemedAnchor(_ref3, ref) {
127
+ function ThemedAnchorFn(_ref3, ref) {
137
128
  var _ref3$appearance = _ref3.appearance,
138
129
  appearance = _ref3$appearance === void 0 ? 'default' : _ref3$appearance,
139
130
  _ref3$shape = _ref3.shape,
@@ -153,7 +144,17 @@ var ThemedAnchor = forwardRefWithGeneric(function ThemedAnchor(_ref3, ref) {
153
144
  ,
154
145
  xcss: cx(styles.root, shapeStyles[shape], hasBorder && styles.border, appearanceStyles[appearance], isSelected && styles.selected, isDisabled && styles.disabled)
155
146
  }));
156
- });
147
+ }
148
+ /**
149
+ * Intentionally an almost-duplicate of `ThemedPressable` - make sure to update both.
150
+ *
151
+ * More 'clever' solutions were tried but I couldn't get them working in an acceptable state.
152
+ *
153
+ * Polymorphism had many typing issues and required sacrificing type safety.
154
+ *
155
+ * Render props had problems passing down styles through `xcss` to the `children` function.
156
+ */
157
+ var ThemedAnchor = forwardRefWithGeneric(ThemedAnchorFn);
157
158
  var textButtonStyles = {
158
159
  iconBefore: "_vwz4idpf",
159
160
  text: "_k48p1wq8"
@@ -183,12 +184,7 @@ export var ThemedButton = /*#__PURE__*/forwardRef(function ThemedButton(_ref4, r
183
184
  className: ax([textButtonStyles.text])
184
185
  }, children));
185
186
  });
186
- /**
187
- * __Themed link button__
188
- *
189
- * A themed link button for the top bar.
190
- */
191
- export var ThemedLinkButton = forwardRefWithGeneric(function ThemedLinkButton(_ref5, ref) {
187
+ function ThemedLinkButtonFn(_ref5, ref) {
192
188
  var IconBefore = _ref5.iconBefore,
193
189
  children = _ref5.children,
194
190
  props = _objectWithoutProperties(_ref5, _excluded5);
@@ -202,7 +198,13 @@ export var ThemedLinkButton = forwardRefWithGeneric(function ThemedLinkButton(_r
202
198
  })), /*#__PURE__*/React.createElement("span", {
203
199
  className: ax([textButtonStyles.text])
204
200
  }, children));
205
- });
201
+ }
202
+ /**
203
+ * __Themed link button__
204
+ *
205
+ * A themed link button for the top bar.
206
+ */
207
+ export var ThemedLinkButton = forwardRefWithGeneric(ThemedLinkButtonFn);
206
208
 
207
209
  /**
208
210
  * Props shared by `ThemedIconButtonProps` and `ThemedLinkIconButton`
@@ -275,12 +277,7 @@ export var ThemedIconButton = /*#__PURE__*/forwardRef(function ThemedIconButton(
275
277
  );
276
278
  });
277
279
  });
278
- /**
279
- * __Themed link icon button__
280
- *
281
- * A themed link icon button for the top bar.
282
- */
283
- export var ThemedLinkIconButton = forwardRefWithGeneric(function ThemedLinkIconButton(_ref7, ref) {
280
+ function ThemedLinkIconButtonFn(_ref7, ref) {
284
281
  var _tooltip$content2;
285
282
  var Icon = _ref7.icon,
286
283
  label = _ref7.label,
@@ -341,4 +338,11 @@ export var ThemedLinkIconButton = forwardRefWithGeneric(function ThemedLinkIconB
341
338
  }), /*#__PURE__*/React.createElement(VisuallyHidden, null, label))
342
339
  );
343
340
  });
344
- });
341
+ }
342
+
343
+ /**
344
+ * __Themed link icon button__
345
+ *
346
+ * A themed link icon button for the top bar.
347
+ */
348
+ export var ThemedLinkIconButton = forwardRefWithGeneric(ThemedLinkIconButtonFn);
@@ -19,20 +19,4 @@ export type LinkMenuItemProps<RouterLinkConfig extends Record<string, any> = nev
19
19
  *
20
20
  * A menu item link. It should be used within a `ul`.
21
21
  */
22
- export declare const LinkMenuItem: <RouterLinkConfig extends Record<string, any> = never>(props: import("./types").MenuItemCommonProps & import("./types").MenuItemSlots & {
23
- description?: string;
24
- listItemRef?: React.Ref<HTMLDivElement>;
25
- } & RouterLinkComponentProps<RouterLinkConfig> & {
26
- /**
27
- * The native `target` attribute for the anchor element.
28
- */
29
- target?: HTMLAnchorElement["target"];
30
- /**
31
- * Whether the menu item is selected.
32
- */
33
- isSelected?: boolean;
34
- /**
35
- * Called when the user has clicked on the trigger content.
36
- */
37
- onClick?: MenuItemOnClick<HTMLAnchorElement>;
38
- } & import("react").RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
22
+ export declare const LinkMenuItem: <RouterLinkConfig extends Record<string, any> = never>(props: LinkMenuItemProps<RouterLinkConfig> & React.RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
@@ -4,7 +4,7 @@
4
4
  * @jsx jsx
5
5
  */
6
6
  import React from 'react';
7
- import type { MenuItemOnClick } from './types';
7
+ import type { MenuItemLinkOrButtonCommonProps, MenuItemOnClick } from './types';
8
8
  /**
9
9
  * This is being _internally_ exported so it can be used in other menu item wrapper components, like
10
10
  * ExpandableMenuItemTrigger.
@@ -20,28 +20,33 @@ import type { MenuItemOnClick } from './types';
20
20
  */
21
21
  export declare const nestedOpenPopupCSSSelector = "&:has([aria-expanded=\"true\"][aria-haspopup=\"true\"])";
22
22
  /**
23
- * __MenuItemBase__
24
- *
25
- * The base menu item component used to compose ButtonMenuItem and LinkMenuItem.
23
+ * Includes all props that are used by any menu item, as MenuItembase is the base component for all menu item components.
26
24
  *
27
- * It contains a type argument `<T>`, to specify the type of the interactive element (`button` or `a`).
28
- * This can be inferred from the type of the `onClick` prop.
25
+ * We also include additional `aria` props to support the menu item being a trigger for the FlyoutMenuItem popup and for the
26
+ * expanded content for ExpandableMenuItem.
29
27
  */
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
- } & {
28
+ type MenuItemBaseProps<T extends HTMLAnchorElement | HTMLButtonElement> = MenuItemLinkOrButtonCommonProps & {
34
29
  /**
35
30
  * ID attribute, passed to the interactive element (anchor/button). This is not publicly exposed, and is currently only
36
31
  * used internally by `ExpandableMenuItemTrigger` for the `aria-labelledby` attribute.
37
32
  */
38
33
  id?: string;
39
34
  href?: string | Record<string, any>;
40
- target?: HTMLAnchorElement["target"];
35
+ target?: HTMLAnchorElement['target'];
41
36
  isDisabled?: boolean;
42
37
  isSelected?: boolean;
43
38
  ariaControls?: string;
44
39
  ariaExpanded?: boolean;
45
- ariaHasPopup?: boolean | "dialog";
46
- onClick?: MenuItemOnClick<T> | undefined;
47
- } & React.RefAttributes<T>) => React.ReactElement | null;
40
+ ariaHasPopup?: boolean | 'dialog';
41
+ onClick?: MenuItemOnClick<T>;
42
+ };
43
+ /**
44
+ * __MenuItemBase__
45
+ *
46
+ * The base menu item component used to compose ButtonMenuItem and LinkMenuItem.
47
+ *
48
+ * It contains a type argument `<T>`, to specify the type of the interactive element (`button` or `a`).
49
+ * This can be inferred from the type of the `onClick` prop.
50
+ */
51
+ export declare const MenuItemBase: <T extends HTMLAnchorElement | HTMLButtonElement>(props: MenuItemBaseProps<T> & React.RefAttributes<T>) => React.ReactElement | null;
52
+ export {};
@@ -1,10 +1,11 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { ListItem } from '../../components/list-item';
1
6
  /**
2
7
  * __Menu list item__
3
8
  *
4
9
  * A [list item](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li) with visual styles removed.
5
10
  */
6
- export declare const MenuListItem: import("react").ForwardRefExoticComponent<{
7
- children: import("react").ReactNode;
8
- testId?: string;
9
- xcss?: import("@atlaskit/css").StrictXCSSProp<"display" | "scrollMarginInline", never>;
10
- } & import("react").RefAttributes<HTMLDivElement>>;
11
+ export declare const MenuListItem: typeof ListItem;
@@ -3,6 +3,7 @@
3
3
  * @jsx jsx
4
4
  */
5
5
  import { type ReactNode } from 'react';
6
+ import { type TooltipProps } from '@atlaskit/tooltip';
6
7
  import type { ResizeBounds, ResizeEndCallback, ResizeStartCallback } from './types';
7
8
  export type PanelSplitterProps = {
8
9
  /**
@@ -22,6 +23,19 @@ export type PanelSplitterProps = {
22
23
  * A unique string that appears as data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
23
24
  */
24
25
  testId?: string;
26
+ /**
27
+ * Displays a tooltip with the provided content.
28
+ * The `tooltipContent` will not be announced by screen readers because it pertains to the draggable element, which lacks keyboard functionality.
29
+ * Use the `label` prop to provide accessible information about the panel splitter.
30
+ * Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
31
+ */
32
+ tooltipContent?: TooltipProps['content'];
33
+ /**
34
+ * The keyboard shortcut to display in the tooltip.
35
+ * Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
36
+ * Note this does not handle the keyboard shortcut functionality, it only displays the shortcut in the tooltip.
37
+ */
38
+ shortcut?: TooltipProps['shortcut'];
25
39
  };
26
40
  type PanelSplitterDragData = {
27
41
  panelId: string | symbol | undefined;
@@ -46,5 +60,5 @@ export declare function isPanelSplitterDragData(data: Record<string | symbol, un
46
60
  * </SideNav>
47
61
  * ```
48
62
  */
49
- export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, }: PanelSplitterProps) => ReactNode;
63
+ export declare const PanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, tooltipContent, shortcut, }: PanelSplitterProps) => ReactNode;
50
64
  export {};
@@ -16,5 +16,5 @@ type SideNavPanelSplitterProps = Omit<PanelSplitterProps, 'onDoubleClick'> & {
16
16
  * </SideNav>
17
17
  * ```
18
18
  */
19
- export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, }: SideNavPanelSplitterProps) => ReactNode;
19
+ export declare const SideNavPanelSplitter: ({ label, onResizeStart, onResizeEnd, testId, shouldCollapseOnDoubleClick, tooltipContent, shortcut, }: SideNavPanelSplitterProps) => ReactNode;
20
20
  export {};
@@ -12,7 +12,7 @@ export type SideNavVisibilityChangeAnalyticsAttributes = {
12
12
  *
13
13
  * Button for toggling the side nav. It should be used in the top bar.
14
14
  */
15
- export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, collapseLabel, testId, interactionName, onClick, }: {
15
+ export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, collapseLabel, testId, interactionName, onClick, shortcut, }: {
16
16
  /**
17
17
  * @deprecated
18
18
  *
@@ -49,4 +49,10 @@ export declare const SideNavToggleButton: ({ defaultCollapsed, expandLabel, coll
49
49
  * The callback function that is called when the toggle button is clicked.
50
50
  */
51
51
  onClick?: (e: React.MouseEvent<HTMLElement>, analyticsEvent: UIAnalyticsEvent, attributes?: SideNavVisibilityChangeAnalyticsAttributes) => void;
52
+ /**
53
+ * Display a keyboard shortcut in the tooltip.
54
+ * Only used if the `platform-dst-tooltip-shortcuts` feature flag is enabled.
55
+ * Note this does not handle the keyboard shortcut functionality, it only displays the shortcut in the tooltip.
56
+ */
57
+ shortcut?: string[];
52
58
  }) => JSX.Element;
@@ -19,20 +19,4 @@ export type LinkMenuItemProps<RouterLinkConfig extends Record<string, any> = nev
19
19
  *
20
20
  * A menu item link. It should be used within a `ul`.
21
21
  */
22
- export declare const LinkMenuItem: <RouterLinkConfig extends Record<string, any> = never>(props: import("./types").MenuItemCommonProps & import("./types").MenuItemSlots & {
23
- description?: string;
24
- listItemRef?: React.Ref<HTMLDivElement>;
25
- } & RouterLinkComponentProps<RouterLinkConfig> & {
26
- /**
27
- * The native `target` attribute for the anchor element.
28
- */
29
- target?: HTMLAnchorElement["target"];
30
- /**
31
- * Whether the menu item is selected.
32
- */
33
- isSelected?: boolean;
34
- /**
35
- * Called when the user has clicked on the trigger content.
36
- */
37
- onClick?: MenuItemOnClick<HTMLAnchorElement>;
38
- } & import("react").RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
22
+ export declare const LinkMenuItem: <RouterLinkConfig extends Record<string, any> = never>(props: LinkMenuItemProps<RouterLinkConfig> & React.RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;