@atlaskit/page-layout 1.7.13 → 1.8.1

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 (51) hide show
  1. package/CHANGELOG.md +91 -79
  2. package/dist/cjs/common/constants.js +49 -98
  3. package/dist/cjs/common/hooks/use-is-sidebar-collapsing.js +1 -2
  4. package/dist/cjs/common/hooks/use-is-sidebar-dragging.js +1 -2
  5. package/dist/cjs/common/safe-local-storage.js +1 -2
  6. package/dist/cjs/common/utils.js +10 -19
  7. package/dist/cjs/components/resize-control/grab-area.js +13 -12
  8. package/dist/cjs/components/resize-control/index.js +13 -12
  9. package/dist/cjs/components/resize-control/resize-button.js +1 -2
  10. package/dist/cjs/components/resize-control/shadow.js +1 -2
  11. package/dist/cjs/components/skip-links/skip-link-components.js +3 -5
  12. package/dist/cjs/components/skip-links/use-custom-skip-link.js +2 -3
  13. package/dist/cjs/components/slots/banner-slot.js +1 -2
  14. package/dist/cjs/components/slots/content.js +1 -2
  15. package/dist/cjs/components/slots/internal/left-sidebar-inner.js +1 -2
  16. package/dist/cjs/components/slots/internal/left-sidebar-outer.js +1 -2
  17. package/dist/cjs/components/slots/internal/resizable-children-wrapper.js +1 -2
  18. package/dist/cjs/components/slots/internal/slot-focus-ring.js +1 -2
  19. package/dist/cjs/components/slots/left-panel.js +1 -2
  20. package/dist/cjs/components/slots/left-sidebar-without-resize.js +1 -2
  21. package/dist/cjs/components/slots/left-sidebar.js +5 -4
  22. package/dist/cjs/components/slots/main.js +1 -2
  23. package/dist/cjs/components/slots/page-layout.js +1 -2
  24. package/dist/cjs/components/slots/right-panel.js +1 -2
  25. package/dist/cjs/components/slots/right-sidebar.js +1 -2
  26. package/dist/cjs/components/slots/slot-dimensions.js +2 -3
  27. package/dist/cjs/components/slots/top-navigation.js +1 -2
  28. package/dist/cjs/controllers/sidebar-resize-context.js +4 -7
  29. package/dist/cjs/controllers/sidebar-resize-controller.js +9 -10
  30. package/dist/cjs/controllers/skip-link-context.js +4 -7
  31. package/dist/cjs/controllers/skip-link-controller.js +2 -3
  32. package/dist/cjs/controllers/use-page-layout-grid.js +1 -2
  33. package/dist/cjs/controllers/use-update-css-vars.js +1 -2
  34. package/dist/es2019/components/resize-control/grab-area.js +12 -13
  35. package/dist/es2019/components/resize-control/index.js +7 -6
  36. package/dist/es2019/components/slots/left-sidebar.js +2 -0
  37. package/dist/esm/components/resize-control/grab-area.js +13 -11
  38. package/dist/esm/components/resize-control/index.js +12 -10
  39. package/dist/esm/components/slots/left-sidebar.js +4 -2
  40. package/dist/esm/controllers/sidebar-resize-controller.js +7 -7
  41. package/dist/types/common/types.d.ts +10 -2
  42. package/dist/types/components/resize-control/grab-area.d.ts +3 -1
  43. package/dist/types/components/resize-control/index.d.ts +1 -1
  44. package/dist/types/components/resize-control/types.d.ts +1 -0
  45. package/dist/types-ts4.5/common/types.d.ts +10 -2
  46. package/dist/types-ts4.5/components/resize-control/grab-area.d.ts +3 -1
  47. package/dist/types-ts4.5/components/resize-control/index.d.ts +1 -1
  48. package/dist/types-ts4.5/components/resize-control/types.d.ts +1 -0
  49. package/package.json +9 -10
  50. package/report.api.md +1 -0
  51. package/tmp/api-report-tmp.d.ts +1 -0
@@ -8,10 +8,9 @@ exports.default = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
10
  var _responsive = require("@atlaskit/primitives/responsive");
11
- var _default = function _default(_ref) {
11
+ var _default = exports.default = function _default(_ref) {
12
12
  var variableName = _ref.variableName,
13
13
  value = _ref.value,
14
14
  mobileValue = _ref.mobileValue;
15
15
  return /*#__PURE__*/_react.default.createElement("style", null, ":root{--".concat(variableName, ":").concat(value, "px;}"), (0, _platformFeatureFlags.getBooleanFF)('platform.design-system-team.responsive-page-layout-left-sidebar_p8r7g') && mobileValue && "".concat(_responsive.UNSAFE_media.below.sm, " { :root{--").concat(variableName, ":").concat(mobileValue, "px;} }"));
16
- };
17
- exports.default = _default;
16
+ };
@@ -70,5 +70,4 @@ var TopNavigation = function TopNavigation(props) {
70
70
  }), children);
71
71
  });
72
72
  };
73
- var _default = TopNavigation;
74
- exports.default = _default;
73
+ var _default = exports.default = TopNavigation;
@@ -22,7 +22,7 @@ var leftSidebarState = {
22
22
  isFixed: true
23
23
  };
24
24
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
25
- var SidebarResizeContext = /*#__PURE__*/(0, _react.createContext)({
25
+ var SidebarResizeContext = exports.SidebarResizeContext = /*#__PURE__*/(0, _react.createContext)({
26
26
  isLeftSidebarCollapsed: false,
27
27
  expandLeftSidebar: _noop.default,
28
28
  collapseLeftSidebar: _noop.default,
@@ -30,8 +30,7 @@ var SidebarResizeContext = /*#__PURE__*/(0, _react.createContext)({
30
30
  setLeftSidebarState: _noop.default,
31
31
  toggleLeftSidebar: _noop.default
32
32
  });
33
- exports.SidebarResizeContext = SidebarResizeContext;
34
- var usePageLayoutResize = function usePageLayoutResize() {
33
+ var usePageLayoutResize = exports.usePageLayoutResize = function usePageLayoutResize() {
35
34
  var _useContext = (0, _react.useContext)(SidebarResizeContext),
36
35
  setLeftSidebarState = _useContext.setLeftSidebarState,
37
36
  context = (0, _objectWithoutProperties2.default)(_useContext, _excluded);
@@ -55,8 +54,7 @@ var usePageLayoutResize = function usePageLayoutResize() {
55
54
  * you are rendering. This way the left sidebar will be locked for
56
55
  * as long as the popup is open.
57
56
  */
58
- exports.usePageLayoutResize = usePageLayoutResize;
59
- var useLeftSidebarFlyoutLock = function useLeftSidebarFlyoutLock() {
57
+ var useLeftSidebarFlyoutLock = exports.useLeftSidebarFlyoutLock = function useLeftSidebarFlyoutLock() {
60
58
  var _useContext2 = (0, _react.useContext)(SidebarResizeContext),
61
59
  setLeftSidebarState = _useContext2.setLeftSidebarState;
62
60
  (0, _react.useEffect)(function () {
@@ -73,5 +71,4 @@ var useLeftSidebarFlyoutLock = function useLeftSidebarFlyoutLock() {
73
71
  });
74
72
  };
75
73
  }, [setLeftSidebarState]);
76
- };
77
- exports.useLeftSidebarFlyoutLock = useLeftSidebarFlyoutLock;
74
+ };
@@ -26,7 +26,7 @@ var handleDataAttributesAndCb = function handleDataAttributesAndCb() {
26
26
  };
27
27
  var leftSidebarSelector = (0, _utils.getPageLayoutSlotCSSSelector)('left-sidebar');
28
28
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
29
- var SidebarResizeController = function SidebarResizeController(_ref) {
29
+ var SidebarResizeController = exports.SidebarResizeController = function SidebarResizeController(_ref) {
30
30
  var children = _ref.children,
31
31
  onExpand = _ref.onLeftSidebarExpand,
32
32
  onCollapse = _ref.onLeftSidebarCollapse;
@@ -89,7 +89,7 @@ var SidebarResizeController = function SidebarResizeController(_ref) {
89
89
  setLeftSidebarState(flyoutOpenSidebarState);
90
90
 
91
91
  // Flush the desktop transitions, cleanup, and call the `onExpand` still
92
- (_transition$current = transition.current) === null || _transition$current === void 0 ? void 0 : _transition$current.complete();
92
+ (_transition$current = transition.current) === null || _transition$current === void 0 || _transition$current.complete();
93
93
  handleDataAttributesAndCb(stableRef.current.onExpand, flyoutOpenSidebarState);
94
94
  return;
95
95
  }
@@ -100,7 +100,7 @@ var SidebarResizeController = function SidebarResizeController(_ref) {
100
100
  }
101
101
 
102
102
  // flush existing transition
103
- (_transition$current3 = transition.current) === null || _transition$current3 === void 0 ? void 0 : _transition$current3.complete();
103
+ (_transition$current3 = transition.current) === null || _transition$current3 === void 0 || _transition$current3.complete();
104
104
  var width = Math.max(lastLeftSidebarWidth, _constants.DEFAULT_LEFT_SIDEBAR_WIDTH);
105
105
  var updatedLeftSidebarState = {
106
106
  isLeftSidebarCollapsed: false,
@@ -126,7 +126,7 @@ var SidebarResizeController = function SidebarResizeController(_ref) {
126
126
  listener: function listener(event) {
127
127
  if (event.target === sidebar && event.propertyName === 'width') {
128
128
  var _transition$current4;
129
- (_transition$current4 = transition.current) === null || _transition$current4 === void 0 ? void 0 : _transition$current4.complete();
129
+ (_transition$current4 = transition.current) === null || _transition$current4 === void 0 || _transition$current4.complete();
130
130
  }
131
131
  }
132
132
  });
@@ -165,7 +165,7 @@ var SidebarResizeController = function SidebarResizeController(_ref) {
165
165
  setLeftSidebarState(flyoutCloseSidebarState);
166
166
 
167
167
  // Flush the desktop transitions, cleanup, and call the `onCollapse` still
168
- (_transition$current5 = transition.current) === null || _transition$current5 === void 0 ? void 0 : _transition$current5.complete();
168
+ (_transition$current5 = transition.current) === null || _transition$current5 === void 0 || _transition$current5.complete();
169
169
  handleDataAttributesAndCb(stableRef.current.onCollapse, flyoutCloseSidebarState);
170
170
  return;
171
171
  }
@@ -176,7 +176,7 @@ var SidebarResizeController = function SidebarResizeController(_ref) {
176
176
  }
177
177
 
178
178
  // flush existing transition
179
- (_transition$current7 = transition.current) === null || _transition$current7 === void 0 ? void 0 : _transition$current7.complete();
179
+ (_transition$current7 = transition.current) === null || _transition$current7 === void 0 || _transition$current7.complete();
180
180
 
181
181
  // data-attribute is used as a CSS selector to sync the hiding/showing
182
182
  // of the nav contents with expand/collapse animation
@@ -206,7 +206,7 @@ var SidebarResizeController = function SidebarResizeController(_ref) {
206
206
  listener: function listener(event) {
207
207
  if (sidebar === event.target && event.propertyName === 'width') {
208
208
  var _transition$current8;
209
- (_transition$current8 = transition.current) === null || _transition$current8 === void 0 ? void 0 : _transition$current8.complete();
209
+ (_transition$current8 = transition.current) === null || _transition$current8 === void 0 || _transition$current8.complete();
210
210
  }
211
211
  }
212
212
  });
@@ -240,7 +240,7 @@ var SidebarResizeController = function SidebarResizeController(_ref) {
240
240
  (0, _react.useEffect)(function mount() {
241
241
  return function unmount() {
242
242
  var _transition$current9;
243
- (_transition$current9 = transition.current) === null || _transition$current9 === void 0 ? void 0 : _transition$current9.abort();
243
+ (_transition$current9 = transition.current) === null || _transition$current9 === void 0 || _transition$current9.abort();
244
244
  };
245
245
  }, []);
246
246
  var context = (0, _react.useMemo)(function () {
@@ -257,5 +257,4 @@ var SidebarResizeController = function SidebarResizeController(_ref) {
257
257
  return /*#__PURE__*/_react.default.createElement(_sidebarResizeContext.SidebarResizeContext.Provider, {
258
258
  value: context
259
259
  }, children);
260
- };
261
- exports.SidebarResizeController = SidebarResizeController;
260
+ };
@@ -8,17 +8,15 @@ exports.useSkipLinks = exports.useSkipLink = exports.SkipLinksContext = void 0;
8
8
  var _react = require("react");
9
9
  var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
10
10
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
11
- var SkipLinksContext = /*#__PURE__*/(0, _react.createContext)({
11
+ var SkipLinksContext = exports.SkipLinksContext = /*#__PURE__*/(0, _react.createContext)({
12
12
  skipLinksData: [],
13
13
  registerSkipLink: _noop.default,
14
14
  unregisterSkipLink: _noop.default
15
15
  });
16
- exports.SkipLinksContext = SkipLinksContext;
17
- var useSkipLinks = function useSkipLinks() {
16
+ var useSkipLinks = exports.useSkipLinks = function useSkipLinks() {
18
17
  return (0, _react.useContext)(SkipLinksContext);
19
18
  };
20
- exports.useSkipLinks = useSkipLinks;
21
- var useSkipLink = function useSkipLink(id, skipLinkTitle) {
19
+ var useSkipLink = exports.useSkipLink = function useSkipLink(id, skipLinkTitle) {
22
20
  var _useSkipLinks = useSkipLinks(),
23
21
  registerSkipLink = _useSkipLinks.registerSkipLink,
24
22
  unregisterSkipLink = _useSkipLinks.unregisterSkipLink;
@@ -33,5 +31,4 @@ var useSkipLink = function useSkipLink(id, skipLinkTitle) {
33
31
  unregisterSkipLink(id);
34
32
  };
35
33
  }, [id, skipLinkTitle, registerSkipLink, unregisterSkipLink]);
36
- };
37
- exports.useSkipLink = useSkipLink;
34
+ };
@@ -38,7 +38,7 @@ var byDOMOrder = function byDOMOrder(a, b) {
38
38
  };
39
39
 
40
40
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
41
- var SkipLinksController = function SkipLinksController(_ref) {
41
+ var SkipLinksController = exports.SkipLinksController = function SkipLinksController(_ref) {
42
42
  var children = _ref.children;
43
43
  var _useState = (0, _react.useState)([]),
44
44
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -71,5 +71,4 @@ var SkipLinksController = function SkipLinksController(_ref) {
71
71
  return /*#__PURE__*/_react.default.createElement(_skipLinkContext.SkipLinksContext.Provider, {
72
72
  value: context
73
73
  }, children);
74
- };
75
- exports.SkipLinksController = SkipLinksController;
74
+ };
@@ -27,5 +27,4 @@ var publishGridState = function publishGridState(gridState) {
27
27
  (0, _utils.mergeGridStateIntoStorage)('gridState', (0, _defineProperty2.default)({}, slotName, value));
28
28
  });
29
29
  };
30
- var _default = publishGridState;
31
- exports.default = _default;
30
+ var _default = exports.default = publishGridState;
@@ -13,5 +13,4 @@ function useUpdateCssVar(cssVar, value) {
13
13
  };
14
14
  }, [cssVar, value]);
15
15
  }
16
- var _default = useUpdateCssVar;
17
- exports.default = _default;
16
+ var _default = exports.default = useUpdateCssVar;
@@ -1,8 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ /* eslint-disable react/react-in-jsx-scope */
2
3
  /** @jsx jsx */
3
4
 
4
5
  import { css, jsx } from '@emotion/react';
5
- import { B100, B200 } from '@atlaskit/theme/colors';
6
+ import { B200 } from '@atlaskit/theme/colors';
6
7
  import { GRAB_AREA_LINE_SELECTOR, GRAB_AREA_SELECTOR } from '../../common/constants';
7
8
  /**
8
9
  * Determines the color of the grab line.
@@ -23,13 +24,8 @@ const grabAreaStyles = css({
23
24
  ':focus': {
24
25
  outline: 0
25
26
  },
26
- ':enabled': {
27
- ':hover': {
28
- [varLineColor]: `var(--ds-border-selected, ${B100})`
29
- },
30
- ':active, :focus': {
31
- [varLineColor]: `var(--ds-border-selected, ${B200})`
32
- }
27
+ ':enabled:hover, :enabled:focus, :enabled:active': {
28
+ [varLineColor]: `var(--ds-border-selected, ${B200})`
33
29
  }
34
30
  });
35
31
  const grabAreaCollapsedStyles = css({
@@ -40,9 +36,9 @@ const grabAreaCollapsedStyles = css({
40
36
  });
41
37
  const lineStyles = css({
42
38
  display: 'block',
43
- width: 2,
39
+ width: "var(--ds-border-width-outline, 2px)",
44
40
  height: '100%',
45
- backgroundColor: `var(${varLineColor})`,
41
+ backgroundColor: 'var(--ds-line)',
46
42
  transition: 'background-color 200ms'
47
43
  });
48
44
  const grabAreaLineSelector = {
@@ -53,6 +49,7 @@ const grabAreaSelector = {
53
49
  };
54
50
  const GrabArea = ({
55
51
  testId,
52
+ valueTextLabel = 'Width',
56
53
  isDisabled,
57
54
  isLeftSidebarCollapsed,
58
55
  label,
@@ -61,6 +58,7 @@ const GrabArea = ({
61
58
  onMouseDown,
62
59
  onBlur,
63
60
  onFocus,
61
+ ref,
64
62
  ...rest
65
63
  }) => jsx("button", _extends({}, grabAreaSelector, {
66
64
  "aria-label": label,
@@ -68,17 +66,18 @@ const GrabArea = ({
68
66
  disabled: isDisabled,
69
67
  "aria-hidden": isLeftSidebarCollapsed,
70
68
  type: "button"
71
- // The separator role is applied to a button to utilize the native
72
- // interactive and disabled functionality on the resize separator. While a
69
+ // The slider role is applied to a button to utilize the native
70
+ // interactive and disabled functionality on the resize slider. While a
73
71
  // range input would be more semantically accurate, it does not affect
74
72
  // usability.
75
73
  ,
76
- role: "separator",
74
+ role: "slider",
77
75
  css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles],
78
76
  "aria-orientation": "vertical",
79
77
  "aria-valuenow": leftSidebarPercentageExpanded,
80
78
  "aria-valuemin": 0,
81
79
  "aria-valuemax": 100,
80
+ "aria-valuetext": `${valueTextLabel} ${leftSidebarPercentageExpanded}%`,
82
81
  onKeyDown: onKeyDown,
83
82
  onMouseDown: onMouseDown,
84
83
  onFocus: onFocus,
@@ -19,10 +19,9 @@ const cssSelector = {
19
19
  };
20
20
  const resizeControlStyles = css({
21
21
  position: 'absolute',
22
- top: 0,
23
- bottom: 0,
24
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
25
- left: '100%',
22
+ insetBlockEnd: 0,
23
+ insetBlockStart: 0,
24
+ insetInlineStart: '100%',
26
25
  outline: 'none'
27
26
  });
28
27
  const showResizeButtonStyles = css({
@@ -58,8 +57,9 @@ const globalResizingStyles = css({
58
57
  const ResizeControl = ({
59
58
  testId,
60
59
  overrides,
61
- resizeButtonLabel = '',
62
- resizeGrabAreaLabel = 'Resize',
60
+ resizeButtonLabel = 'Current project sidebar',
61
+ valueTextLabel = 'Width',
62
+ resizeGrabAreaLabel = 'Resize Current Project Sidebar',
63
63
  onResizeStart,
64
64
  onResizeEnd
65
65
  }) => {
@@ -334,6 +334,7 @@ const ResizeControl = ({
334
334
  isDisabled: isLeftSidebarCollapsed,
335
335
  isLeftSidebarCollapsed: isLeftSidebarCollapsed,
336
336
  label: resizeGrabAreaLabel,
337
+ valueTextLabel: valueTextLabel,
337
338
  leftSidebarPercentageExpanded: leftSidebarPercentageExpanded,
338
339
  onBlur: onBlur,
339
340
  onFocus: onFocus,
@@ -50,6 +50,7 @@ const LeftSidebar = props => {
50
50
  children,
51
51
  width,
52
52
  isFixed = true,
53
+ valueTextLabel,
53
54
  resizeButtonLabel,
54
55
  resizeGrabAreaLabel,
55
56
  overrides,
@@ -330,6 +331,7 @@ const LeftSidebar = props => {
330
331
  testId: testId && `${testId}-resize-children-wrapper`
331
332
  }, children), jsx(ResizeControl, {
332
333
  testId: testId,
334
+ valueTextLabel: valueTextLabel,
333
335
  resizeGrabAreaLabel: resizeGrabAreaLabel,
334
336
  resizeButtonLabel: resizeButtonLabel
335
337
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
@@ -1,11 +1,12 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
- var _excluded = ["testId", "isDisabled", "isLeftSidebarCollapsed", "label", "leftSidebarPercentageExpanded", "onKeyDown", "onMouseDown", "onBlur", "onFocus"];
4
+ var _excluded = ["testId", "valueTextLabel", "isDisabled", "isLeftSidebarCollapsed", "label", "leftSidebarPercentageExpanded", "onKeyDown", "onMouseDown", "onBlur", "onFocus", "ref"];
5
+ /* eslint-disable react/react-in-jsx-scope */
5
6
  /** @jsx jsx */
6
7
 
7
8
  import { css, jsx } from '@emotion/react';
8
- import { B100, B200 } from '@atlaskit/theme/colors';
9
+ import { B200 } from '@atlaskit/theme/colors';
9
10
  import { GRAB_AREA_LINE_SELECTOR, GRAB_AREA_SELECTOR } from '../../common/constants';
10
11
  /**
11
12
  * Determines the color of the grab line.
@@ -26,10 +27,7 @@ var grabAreaStyles = css({
26
27
  ':focus': {
27
28
  outline: 0
28
29
  },
29
- ':enabled': {
30
- ':hover': _defineProperty({}, varLineColor, "var(--ds-border-selected, ".concat(B100, ")")),
31
- ':active, :focus': _defineProperty({}, varLineColor, "var(--ds-border-selected, ".concat(B200, ")"))
32
- }
30
+ ':enabled:hover, :enabled:focus, :enabled:active': _defineProperty({}, varLineColor, "var(--ds-border-selected, ".concat(B200, ")"))
33
31
  });
34
32
  var grabAreaCollapsedStyles = css({
35
33
  padding: 0,
@@ -39,15 +37,17 @@ var grabAreaCollapsedStyles = css({
39
37
  });
40
38
  var lineStyles = css({
41
39
  display: 'block',
42
- width: 2,
40
+ width: "var(--ds-border-width-outline, 2px)",
43
41
  height: '100%',
44
- backgroundColor: "var(".concat(varLineColor, ")"),
42
+ backgroundColor: 'var(--ds-line)',
45
43
  transition: 'background-color 200ms'
46
44
  });
47
45
  var grabAreaLineSelector = _defineProperty({}, GRAB_AREA_LINE_SELECTOR, true);
48
46
  var grabAreaSelector = _defineProperty({}, GRAB_AREA_SELECTOR, true);
49
47
  var GrabArea = function GrabArea(_ref) {
50
48
  var testId = _ref.testId,
49
+ _ref$valueTextLabel = _ref.valueTextLabel,
50
+ valueTextLabel = _ref$valueTextLabel === void 0 ? 'Width' : _ref$valueTextLabel,
51
51
  isDisabled = _ref.isDisabled,
52
52
  isLeftSidebarCollapsed = _ref.isLeftSidebarCollapsed,
53
53
  label = _ref.label,
@@ -56,6 +56,7 @@ var GrabArea = function GrabArea(_ref) {
56
56
  onMouseDown = _ref.onMouseDown,
57
57
  onBlur = _ref.onBlur,
58
58
  onFocus = _ref.onFocus,
59
+ ref = _ref.ref,
59
60
  rest = _objectWithoutProperties(_ref, _excluded);
60
61
  return jsx("button", _extends({}, grabAreaSelector, {
61
62
  "aria-label": label,
@@ -63,17 +64,18 @@ var GrabArea = function GrabArea(_ref) {
63
64
  disabled: isDisabled,
64
65
  "aria-hidden": isLeftSidebarCollapsed,
65
66
  type: "button"
66
- // The separator role is applied to a button to utilize the native
67
- // interactive and disabled functionality on the resize separator. While a
67
+ // The slider role is applied to a button to utilize the native
68
+ // interactive and disabled functionality on the resize slider. While a
68
69
  // range input would be more semantically accurate, it does not affect
69
70
  // usability.
70
71
  ,
71
- role: "separator",
72
+ role: "slider",
72
73
  css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles],
73
74
  "aria-orientation": "vertical",
74
75
  "aria-valuenow": leftSidebarPercentageExpanded,
75
76
  "aria-valuemin": 0,
76
77
  "aria-valuemax": 100,
78
+ "aria-valuetext": "".concat(valueTextLabel, " ").concat(leftSidebarPercentageExpanded, "%"),
77
79
  onKeyDown: onKeyDown,
78
80
  onMouseDown: onMouseDown,
79
81
  onFocus: onFocus,
@@ -21,10 +21,9 @@ import Shadow from './shadow';
21
21
  var cssSelector = _defineProperty({}, RESIZE_CONTROL_SELECTOR, true);
22
22
  var resizeControlStyles = css({
23
23
  position: 'absolute',
24
- top: 0,
25
- bottom: 0,
26
- // eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage
27
- left: '100%',
24
+ insetBlockEnd: 0,
25
+ insetBlockStart: 0,
26
+ insetInlineStart: '100%',
28
27
  outline: 'none'
29
28
  });
30
29
  var showResizeButtonStyles = css({
@@ -61,9 +60,11 @@ var ResizeControl = function ResizeControl(_ref) {
61
60
  var testId = _ref.testId,
62
61
  overrides = _ref.overrides,
63
62
  _ref$resizeButtonLabe = _ref.resizeButtonLabel,
64
- resizeButtonLabel = _ref$resizeButtonLabe === void 0 ? '' : _ref$resizeButtonLabe,
63
+ resizeButtonLabel = _ref$resizeButtonLabe === void 0 ? 'Current project sidebar' : _ref$resizeButtonLabe,
64
+ _ref$valueTextLabel = _ref.valueTextLabel,
65
+ valueTextLabel = _ref$valueTextLabel === void 0 ? 'Width' : _ref$valueTextLabel,
65
66
  _ref$resizeGrabAreaLa = _ref.resizeGrabAreaLabel,
66
- resizeGrabAreaLabel = _ref$resizeGrabAreaLa === void 0 ? 'Resize' : _ref$resizeGrabAreaLa,
67
+ resizeGrabAreaLabel = _ref$resizeGrabAreaLa === void 0 ? 'Resize Current Project Sidebar' : _ref$resizeGrabAreaLa,
67
68
  onResizeStart = _ref.onResizeStart,
68
69
  onResizeEnd = _ref.onResizeEnd;
69
70
  var _useContext = useContext(SidebarResizeContext),
@@ -93,7 +94,7 @@ var ResizeControl = function ResizeControl(_ref) {
93
94
  }, [leftSidebarState]);
94
95
  var toggleSideBar = useCallback(function (event) {
95
96
  // don't cascade down to the LeftSidebarOuter
96
- event === null || event === void 0 ? void 0 : event.stopPropagation();
97
+ event === null || event === void 0 || event.stopPropagation();
97
98
  toggleLeftSidebar();
98
99
  }, [toggleLeftSidebar]);
99
100
  var onMouseDown = function onMouseDown(event) {
@@ -176,7 +177,7 @@ var ResizeControl = function ResizeControl(_ref) {
176
177
  var onResizeOffLeftOfScreen = function onResizeOffLeftOfScreen() {
177
178
  var _unbindEvents$current;
178
179
  onUpdateResize.cancel();
179
- (_unbindEvents$current = unbindEvents.current) === null || _unbindEvents$current === void 0 ? void 0 : _unbindEvents$current.call(unbindEvents);
180
+ (_unbindEvents$current = unbindEvents.current) === null || _unbindEvents$current === void 0 || _unbindEvents$current.call(unbindEvents);
180
181
  unbindEvents.current = null;
181
182
  document.documentElement.removeAttribute(IS_SIDEBAR_DRAGGING);
182
183
  offset.current = 0;
@@ -242,7 +243,7 @@ var ResizeControl = function ResizeControl(_ref) {
242
243
  }, _defineProperty(_objectSpread3, VAR_LEFT_SIDEBAR_WIDTH, sidebarWidth.current), _defineProperty(_objectSpread3, "lastLeftSidebarWidth", sidebarWidth.current), _objectSpread3));
243
244
  setLeftSidebarState(updatedLeftSidebarState);
244
245
  }
245
- (_unbindEvents$current2 = unbindEvents.current) === null || _unbindEvents$current2 === void 0 ? void 0 : _unbindEvents$current2.call(unbindEvents);
246
+ (_unbindEvents$current2 = unbindEvents.current) === null || _unbindEvents$current2 === void 0 || _unbindEvents$current2.call(unbindEvents);
246
247
  unbindEvents.current = null;
247
248
  onUpdateResize.cancel();
248
249
  sidebarWidth.current = 0;
@@ -253,7 +254,7 @@ var ResizeControl = function ResizeControl(_ref) {
253
254
  var _updatedLeftSidebarSt;
254
255
  setIsGrabAreaFocused(false);
255
256
  // Note: the `collapseSidebar` codepath does not return state, so we need to pull it from the ref
256
- onResizeEnd === null || onResizeEnd === void 0 ? void 0 : onResizeEnd((_updatedLeftSidebarSt = updatedLeftSidebarState) !== null && _updatedLeftSidebarSt !== void 0 ? _updatedLeftSidebarSt : stableSidebarState.current);
257
+ onResizeEnd === null || onResizeEnd === void 0 || onResizeEnd((_updatedLeftSidebarSt = updatedLeftSidebarState) !== null && _updatedLeftSidebarSt !== void 0 ? _updatedLeftSidebarSt : stableSidebarState.current);
257
258
  });
258
259
  };
259
260
  var onKeyDown = function onKeyDown(event) {
@@ -329,6 +330,7 @@ var ResizeControl = function ResizeControl(_ref) {
329
330
  isDisabled: isLeftSidebarCollapsed,
330
331
  isLeftSidebarCollapsed: isLeftSidebarCollapsed,
331
332
  label: resizeGrabAreaLabel,
333
+ valueTextLabel: valueTextLabel,
332
334
  leftSidebarPercentageExpanded: leftSidebarPercentageExpanded,
333
335
  onBlur: onBlur,
334
336
  onFocus: onFocus,
@@ -53,6 +53,7 @@ var LeftSidebar = function LeftSidebar(props) {
53
53
  width = props.width,
54
54
  _props$isFixed = props.isFixed,
55
55
  isFixed = _props$isFixed === void 0 ? true : _props$isFixed,
56
+ valueTextLabel = props.valueTextLabel,
56
57
  resizeButtonLabel = props.resizeButtonLabel,
57
58
  resizeGrabAreaLabel = props.resizeGrabAreaLabel,
58
59
  overrides = props.overrides,
@@ -236,7 +237,7 @@ var LeftSidebar = function LeftSidebar(props) {
236
237
  if (current.isFlyoutOpen) {
237
238
  return current;
238
239
  }
239
- onExpand === null || onExpand === void 0 ? void 0 : onExpand();
240
+ onExpand === null || onExpand === void 0 || onExpand();
240
241
  return _objectSpread(_objectSpread({}, current), {}, {
241
242
  isFlyoutOpen: true
242
243
  });
@@ -252,7 +253,7 @@ var LeftSidebar = function LeftSidebar(props) {
252
253
  if (!current.isFlyoutOpen) {
253
254
  return current;
254
255
  }
255
- onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse();
256
+ onCollapse === null || onCollapse === void 0 || onCollapse();
256
257
  return _objectSpread(_objectSpread({}, current), {}, {
257
258
  isFlyoutOpen: false
258
259
  });
@@ -327,6 +328,7 @@ var LeftSidebar = function LeftSidebar(props) {
327
328
  testId: testId && "".concat(testId, "-resize-children-wrapper")
328
329
  }, children), jsx(ResizeControl, {
329
330
  testId: testId,
331
+ valueTextLabel: valueTextLabel,
330
332
  resizeGrabAreaLabel: resizeGrabAreaLabel,
331
333
  resizeButtonLabel: resizeButtonLabel
332
334
  // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
@@ -79,7 +79,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
79
79
  setLeftSidebarState(flyoutOpenSidebarState);
80
80
 
81
81
  // Flush the desktop transitions, cleanup, and call the `onExpand` still
82
- (_transition$current = transition.current) === null || _transition$current === void 0 ? void 0 : _transition$current.complete();
82
+ (_transition$current = transition.current) === null || _transition$current === void 0 || _transition$current.complete();
83
83
  handleDataAttributesAndCb(stableRef.current.onExpand, flyoutOpenSidebarState);
84
84
  return;
85
85
  }
@@ -90,7 +90,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
90
90
  }
91
91
 
92
92
  // flush existing transition
93
- (_transition$current3 = transition.current) === null || _transition$current3 === void 0 ? void 0 : _transition$current3.complete();
93
+ (_transition$current3 = transition.current) === null || _transition$current3 === void 0 || _transition$current3.complete();
94
94
  var width = Math.max(lastLeftSidebarWidth, DEFAULT_LEFT_SIDEBAR_WIDTH);
95
95
  var updatedLeftSidebarState = {
96
96
  isLeftSidebarCollapsed: false,
@@ -116,7 +116,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
116
116
  listener: function listener(event) {
117
117
  if (event.target === sidebar && event.propertyName === 'width') {
118
118
  var _transition$current4;
119
- (_transition$current4 = transition.current) === null || _transition$current4 === void 0 ? void 0 : _transition$current4.complete();
119
+ (_transition$current4 = transition.current) === null || _transition$current4 === void 0 || _transition$current4.complete();
120
120
  }
121
121
  }
122
122
  });
@@ -155,7 +155,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
155
155
  setLeftSidebarState(flyoutCloseSidebarState);
156
156
 
157
157
  // Flush the desktop transitions, cleanup, and call the `onCollapse` still
158
- (_transition$current5 = transition.current) === null || _transition$current5 === void 0 ? void 0 : _transition$current5.complete();
158
+ (_transition$current5 = transition.current) === null || _transition$current5 === void 0 || _transition$current5.complete();
159
159
  handleDataAttributesAndCb(stableRef.current.onCollapse, flyoutCloseSidebarState);
160
160
  return;
161
161
  }
@@ -166,7 +166,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
166
166
  }
167
167
 
168
168
  // flush existing transition
169
- (_transition$current7 = transition.current) === null || _transition$current7 === void 0 ? void 0 : _transition$current7.complete();
169
+ (_transition$current7 = transition.current) === null || _transition$current7 === void 0 || _transition$current7.complete();
170
170
 
171
171
  // data-attribute is used as a CSS selector to sync the hiding/showing
172
172
  // of the nav contents with expand/collapse animation
@@ -196,7 +196,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
196
196
  listener: function listener(event) {
197
197
  if (sidebar === event.target && event.propertyName === 'width') {
198
198
  var _transition$current8;
199
- (_transition$current8 = transition.current) === null || _transition$current8 === void 0 ? void 0 : _transition$current8.complete();
199
+ (_transition$current8 = transition.current) === null || _transition$current8 === void 0 || _transition$current8.complete();
200
200
  }
201
201
  }
202
202
  });
@@ -230,7 +230,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
230
230
  useEffect(function mount() {
231
231
  return function unmount() {
232
232
  var _transition$current9;
233
- (_transition$current9 = transition.current) === null || _transition$current9 === void 0 ? void 0 : _transition$current9.abort();
233
+ (_transition$current9 = transition.current) === null || _transition$current9 === void 0 || _transition$current9.abort();
234
234
  };
235
235
  }, []);
236
236
  var context = useMemo(function () {
@@ -42,6 +42,14 @@ export interface LeftSidebarProps extends SlotWidthProps {
42
42
  * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests.
43
43
  */
44
44
  testId?: string;
45
+ /**
46
+ * The `aria-valuetext` allows users relying on assistive technologies,
47
+ * particularly screen readers, to determine the purpose of the slider.
48
+ * The default value is "Width".
49
+ * The aria-valuenow property is automatically appended to the valueTextLabel.
50
+ * For Example, valueTextLabel="Width" will render aria-valuetext="Width 62%”.
51
+ */
52
+ valueTextLabel?: string;
45
53
  /**
46
54
  * You can override prop(s) for the mentioned component(s).
47
55
  */
@@ -51,11 +59,11 @@ export interface LeftSidebarProps extends SlotWidthProps {
51
59
  };
52
60
  };
53
61
  /**
54
- * Display label for grab area. This will be announced to the screenreaders when the grab area receives focus
62
+ * Display label for grab area/slider to resize the left side bar. This will be rendered through assistive technologies.
55
63
  */
56
64
  resizeGrabAreaLabel?: string;
57
65
  /**
58
- * Display label for resize button.
66
+ * Display label for expand/collapse button for the left sidebar.
59
67
  */
60
68
  resizeButtonLabel?: string;
61
69
  /**
@@ -1,6 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { ComponentProps, FocusEvent, KeyboardEvent, MouseEvent } from 'react';
3
3
  import { jsx } from '@emotion/react';
4
+ import { LeftSidebarProps } from '../../common/types';
4
5
  export type GrabAreaProps = {
5
6
  isDisabled: boolean;
6
7
  isLeftSidebarCollapsed: boolean;
@@ -11,6 +12,7 @@ export type GrabAreaProps = {
11
12
  onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
12
13
  onMouseDown: (event: MouseEvent<HTMLButtonElement>) => void;
13
14
  testId?: string;
15
+ ref?: React.Ref<HTMLButtonElement>;
14
16
  } & ComponentProps<'button'>;
15
- declare const GrabArea: ({ testId, isDisabled, isLeftSidebarCollapsed, label, leftSidebarPercentageExpanded, onKeyDown, onMouseDown, onBlur, onFocus, ...rest }: GrabAreaProps) => jsx.JSX.Element;
17
+ declare const GrabArea: ({ testId, valueTextLabel, isDisabled, isLeftSidebarCollapsed, label, leftSidebarPercentageExpanded, onKeyDown, onMouseDown, onBlur, onFocus, ref, ...rest }: GrabAreaProps & Partial<LeftSidebarProps>) => jsx.JSX.Element;
16
18
  export default GrabArea;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { ResizeControlProps } from './types';
3
- declare const ResizeControl: ({ testId, overrides, resizeButtonLabel, resizeGrabAreaLabel, onResizeStart, onResizeEnd, }: ResizeControlProps) => jsx.JSX.Element;
3
+ declare const ResizeControl: ({ testId, overrides, resizeButtonLabel, valueTextLabel, resizeGrabAreaLabel, onResizeStart, onResizeEnd, }: ResizeControlProps) => jsx.JSX.Element;
4
4
  export default ResizeControl;
@@ -12,6 +12,7 @@ export type ResizeControlProps = {
12
12
  render?: (Component: ElementType<ResizeButtonProps>, props: ResizeButtonProps) => ReactElement;
13
13
  };
14
14
  };
15
+ valueTextLabel?: string;
15
16
  resizeGrabAreaLabel?: string;
16
17
  resizeButtonLabel?: string;
17
18
  onCollapse?: (leftSidebarState: LeftSidebarState) => void;