@atlaskit/page-layout 4.2.17 → 4.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/page-layout
2
2
 
3
+ ## 4.2.19
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 4.2.18
10
+
11
+ ### Patch Changes
12
+
13
+ - [`325389664a406`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/325389664a406) -
14
+ Refactor to make props explicit. Remove spread props behind a feature flag. If successful, they
15
+ will be removed in a future major.
16
+
3
17
  ## 4.2.17
4
18
 
5
19
  ### Patch Changes
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
@@ -8,22 +9,25 @@ exports.default = void 0;
8
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _react = require("@emotion/react");
12
+ var React = _interopRequireWildcard(require("react"));
13
+ var _react2 = require("@emotion/react");
14
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
15
  var _colors = require("@atlaskit/theme/colors");
13
16
  var _constants = require("../../common/constants");
14
- var _excluded = ["testId", "valueTextLabel", "isDisabled", "isLeftSidebarCollapsed", "label", "leftSidebarPercentageExpanded", "onKeyDown", "onMouseDown", "onBlur", "onFocus", "ref"];
17
+ var _excluded = ["testId", "valueTextLabel", "isDisabled", "isLeftSidebarCollapsed", "label", "leftSidebarPercentageExpanded", "onKeyDown", "onMouseDown", "onBlur", "onFocus"];
15
18
  /**
16
19
  * @jsxRuntime classic
17
20
  * @jsx jsx
18
21
  */
19
22
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
23
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
24
  /**
21
25
  * Determines the color of the grab line.
22
26
  *
23
27
  * Used on internal leaf node, so naming collisions won't matter.
24
28
  */
25
29
  var varLineColor = '--ds-line';
26
- var grabAreaStyles = (0, _react.css)({
30
+ var grabAreaStyles = (0, _react2.css)({
27
31
  width: "var(--ds-space-200, 16px)",
28
32
  height: '100%',
29
33
  padding: 0,
@@ -39,7 +43,7 @@ var grabAreaStyles = (0, _react.css)({
39
43
  },
40
44
  '&:enabled:hover, &:enabled:focus, &:enabled:active': (0, _defineProperty2.default)({}, varLineColor, "var(--ds-border-selected, ".concat(_colors.B200, ")"))
41
45
  });
42
- var grabAreaCollapsedStyles = (0, _react.css)({
46
+ var grabAreaCollapsedStyles = (0, _react2.css)({
43
47
  height: "calc(100% - ".concat("var(--ds-space-600, 3rem)", " * 2)"),
44
48
  padding: 0,
45
49
  position: 'absolute',
@@ -48,7 +52,7 @@ var grabAreaCollapsedStyles = (0, _react.css)({
48
52
  cursor: 'default',
49
53
  insetBlockEnd: 0
50
54
  });
51
- var lineStyles = (0, _react.css)({
55
+ var lineStyles = (0, _react2.css)({
52
56
  display: 'block',
53
57
  width: '2px',
54
58
  height: '100%',
@@ -57,7 +61,7 @@ var lineStyles = (0, _react.css)({
57
61
  });
58
62
  var grabAreaLineSelector = (0, _defineProperty2.default)({}, _constants.GRAB_AREA_LINE_SELECTOR, true);
59
63
  var grabAreaSelector = (0, _defineProperty2.default)({}, _constants.GRAB_AREA_SELECTOR, true);
60
- var GrabArea = function GrabArea(_ref) {
64
+ var GrabArea = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
61
65
  var testId = _ref.testId,
62
66
  _ref$valueTextLabel = _ref.valueTextLabel,
63
67
  valueTextLabel = _ref$valueTextLabel === void 0 ? 'Width' : _ref$valueTextLabel,
@@ -69,9 +73,10 @@ var GrabArea = function GrabArea(_ref) {
69
73
  onMouseDown = _ref.onMouseDown,
70
74
  onBlur = _ref.onBlur,
71
75
  onFocus = _ref.onFocus,
72
- ref = _ref.ref,
73
76
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
74
- return (0, _react.jsx)("button", (0, _extends2.default)({}, grabAreaSelector, {
77
+ return (0, _react2.jsx)("button", (0, _extends2.default)({
78
+ ref: ref
79
+ }, grabAreaSelector, {
75
80
  "aria-label": label,
76
81
  "data-testid": testId,
77
82
  disabled: isDisabled,
@@ -83,7 +88,7 @@ var GrabArea = function GrabArea(_ref) {
83
88
  // usability.
84
89
  ,
85
90
  role: "slider",
86
- css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles],
91
+ css: isLeftSidebarCollapsed ? [grabAreaStyles, grabAreaCollapsedStyles] : grabAreaStyles,
87
92
  "aria-orientation": "vertical",
88
93
  "aria-valuenow": leftSidebarPercentageExpanded,
89
94
  "aria-valuemin": 0,
@@ -93,11 +98,10 @@ var GrabArea = function GrabArea(_ref) {
93
98
  onMouseDown: onMouseDown,
94
99
  onFocus: onFocus,
95
100
  onBlur: onBlur
96
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
97
- }, rest), (0, _react.jsx)("span", (0, _extends2.default)({
101
+ }, (0, _platformFeatureFlags.fg)('platform_dst_spread-props-page-layout') ? {} : rest), (0, _react2.jsx)("span", (0, _extends2.default)({
98
102
  css: lineStyles
99
103
  }, grabAreaLineSelector)));
100
- };
104
+ });
101
105
 
102
106
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
103
107
  var _default = exports.default = GrabArea;
@@ -275,6 +275,7 @@ var ResizeControl = function ResizeControl(_ref) {
275
275
  if (isSpaceOrEnter) {
276
276
  toggleSideBar(event);
277
277
  event.preventDefault();
278
+ return true; // Added return value
278
279
  }
279
280
  if (isLeftOrTopArrow || isRightOrBottomArrow) {
280
281
  event.preventDefault(); // prevent content scroll
@@ -306,7 +307,9 @@ var ResizeControl = function ResizeControl(_ref) {
306
307
  onResizeEnd && onResizeEnd(updatedLeftSidebarState);
307
308
  }, 50);
308
309
  });
310
+ return true; // Added return value
309
311
  }
312
+ return false; // Added default return value for all other cases
310
313
  };
311
314
  var onFocus = (0, _react.useCallback)(function () {
312
315
  setIsGrabAreaFocused(true);
@@ -319,7 +322,6 @@ var ResizeControl = function ResizeControl(_ref) {
319
322
  return (0, _react2.jsx)(Component, props);
320
323
  }
321
324
  }, overrides && overrides.ResizeButton);
322
-
323
325
  // This width is calculated once only on mount.
324
326
  // This means resizing the window will cause this value to be incorrect for screen reader users,
325
327
  // however this comes with a substantial performance gain and so is considered acceptable.
@@ -12,10 +12,12 @@ var _react = require("@emotion/react");
12
12
  var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/migration/chevron-right"));
13
13
  var _curves = require("@atlaskit/motion/curves");
14
14
  var _durations = require("@atlaskit/motion/durations");
15
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
15
16
  var _responsive = require("@atlaskit/primitives/responsive");
16
17
  var _colors = require("@atlaskit/theme/colors");
17
18
  var _constants = require("../../common/constants");
18
- var _excluded = ["isLeftSidebarCollapsed", "label", "testId"];
19
+ var _excluded = ["isLeftSidebarCollapsed", "label", "onClick", "testId"],
20
+ _excluded2 = ["css"];
19
21
  /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
20
22
  /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
21
23
  /**
@@ -23,7 +25,7 @@ var _excluded = ["isLeftSidebarCollapsed", "label", "testId"];
23
25
  * @jsx jsx
24
26
  */
25
27
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
- var increaseHitAreaStyles = (0, _react.css)({
28
+ var hitAreaSpanStyles = (0, _react.css)({
27
29
  position: 'absolute',
28
30
  insetBlockEnd: "var(--ds-space-negative-300, -24px)",
29
31
  insetBlockStart: "var(--ds-space-negative-300, -24px)",
@@ -78,27 +80,30 @@ var cssSelector = (0, _defineProperty2.default)({}, _constants.RESIZE_BUTTON_SEL
78
80
  var ResizeButton = function ResizeButton(_ref) {
79
81
  var isLeftSidebarCollapsed = _ref.isLeftSidebarCollapsed,
80
82
  label = _ref.label,
83
+ onClick = _ref.onClick,
81
84
  testId = _ref.testId,
82
85
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
86
+ // Extract css from props if it exists to avoid conflicts
87
+ var _ref2 = props,
88
+ _ignoredCss = _ref2.css,
89
+ restProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
83
90
  return (0, _react.jsx)("button", (0, _extends2.default)({}, cssSelector, {
84
91
  // DO NOT remove. used as a CSS selector.
85
92
  "aria-expanded": !isLeftSidebarCollapsed,
86
93
  "aria-label": label,
87
- type: "button"
88
- // The error goes away when we remove the spread ...props
89
- ,
94
+ type: "button",
90
95
  css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
91
96
  "data-testid": testId
92
97
  // Prevents focus staying attached to the button when pressed
93
98
  ,
94
- onMouseDown: preventDefault
95
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
96
- }, props), (0, _react.jsx)(_chevronRight.default, {
99
+ onMouseDown: preventDefault,
100
+ onClick: onClick
101
+ }, (0, _platformFeatureFlags.fg)('platform_dst_spread-props-page-layout') ? {} : restProps), (0, _react.jsx)(_chevronRight.default, {
97
102
  label: "",
98
103
  color: "currentColor",
99
104
  size: "small"
100
105
  }), (0, _react.jsx)("span", {
101
- css: increaseHitAreaStyles
106
+ css: hitAreaSpanStyles
102
107
  }));
103
108
  };
104
109
 
@@ -85,7 +85,7 @@ var SkipLinkWrapper = exports.SkipLinkWrapper = function SkipLinkWrapper(_ref) {
85
85
  });
86
86
  var regularLinksWithIdx = arr.filter(function (link) {
87
87
  return link.listIndex === undefined;
88
- }).map(function (link, idx, currArr) {
88
+ }).map(function (link, idx) {
89
89
  var listIndex = _assignIndex(idx, usedIndexes);
90
90
  usedIndexes.push(listIndex);
91
91
  return _objectSpread(_objectSpread({}, link), {}, {
@@ -112,27 +112,24 @@ var SkipLinkWrapper = exports.SkipLinkWrapper = function SkipLinkWrapper(_ref) {
112
112
  };
113
113
  var emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
114
114
  var label = skipLinksLabel || _constants.DEFAULT_I18N_PROPS_SKIP_LINKS;
115
- return (
116
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
117
- (0, _react.jsx)("div", {
118
- onFocus: attachEscHandler,
119
- onBlur: removeEscHandler,
120
- css: [skipLinkStyles, prefersReducedMotionStyles],
121
- "data-skip-link-wrapper": true
122
- }, emptyLabelOverride ? null : (0, _react.jsx)("p", {
123
- css: skipLinkHeadingStyles
124
- }, label), (0, _react.jsx)("ol", {
125
- css: skipLinkListStyles
126
- }, sortSkipLinks(skipLinksData).map(function (_ref2) {
127
- var id = _ref2.id,
128
- skipLinkTitle = _ref2.skipLinkTitle;
129
- return (0, _react.jsx)(SkipLink, {
130
- key: id,
131
- href: "#".concat(id),
132
- isFocusable: true
133
- }, skipLinkTitle);
134
- })))
135
- );
115
+ return (0, _react.jsx)("div", {
116
+ onFocus: attachEscHandler,
117
+ onBlur: removeEscHandler,
118
+ css: [skipLinkStyles, prefersReducedMotionStyles],
119
+ "data-skip-link-wrapper": true
120
+ }, emptyLabelOverride ? null : (0, _react.jsx)("p", {
121
+ css: skipLinkHeadingStyles
122
+ }, label), (0, _react.jsx)("ol", {
123
+ css: skipLinkListStyles
124
+ }, sortSkipLinks(skipLinksData).map(function (_ref2) {
125
+ var id = _ref2.id,
126
+ skipLinkTitle = _ref2.skipLinkTitle;
127
+ return (0, _react.jsx)(SkipLink, {
128
+ key: id,
129
+ href: "#".concat(id),
130
+ isFocusable: true
131
+ }, skipLinkTitle);
132
+ })));
136
133
  };
137
134
  var _handleBlur = function handleBlur(event) {
138
135
  // @ts-ignore
@@ -143,7 +143,7 @@ var SidebarResizeController = exports.SidebarResizeController = function Sidebar
143
143
  };
144
144
  transition.current = value;
145
145
  }, [isOpen, mobileMediaQuery, isResizing, isLeftSidebarCollapsed, lastLeftSidebarWidth, flyoutLockCount, isFixed, leftSidebarWidth, hasInit]);
146
- var collapseLeftSidebar = (0, _react.useCallback)(function (event, collapseWithoutTransition) {
146
+ var collapseLeftSidebar = (0, _react.useCallback)(function (_event, collapseWithoutTransition) {
147
147
  var _transition$current6, _transition$current7;
148
148
  if (!isOpen) {
149
149
  return;
@@ -3,9 +3,10 @@ import _extends from "@babel/runtime/helpers/extends";
3
3
  * @jsxRuntime classic
4
4
  * @jsx jsx
5
5
  */
6
-
6
+ import * as React from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { B200 } from '@atlaskit/theme/colors';
10
11
  import { GRAB_AREA_LINE_SELECTOR, GRAB_AREA_SELECTOR } from '../../common/constants';
11
12
  /**
@@ -54,7 +55,7 @@ const grabAreaLineSelector = {
54
55
  const grabAreaSelector = {
55
56
  [GRAB_AREA_SELECTOR]: true
56
57
  };
57
- const GrabArea = ({
58
+ const GrabArea = /*#__PURE__*/React.forwardRef(({
58
59
  testId,
59
60
  valueTextLabel = 'Width',
60
61
  isDisabled,
@@ -65,34 +66,36 @@ const GrabArea = ({
65
66
  onMouseDown,
66
67
  onBlur,
67
68
  onFocus,
68
- ref,
69
69
  ...rest
70
- }) => jsx("button", _extends({}, grabAreaSelector, {
71
- "aria-label": label,
72
- "data-testid": testId,
73
- disabled: isDisabled,
74
- "aria-hidden": isLeftSidebarCollapsed,
75
- type: "button"
76
- // The slider role is applied to a button to utilize the native
77
- // interactive and disabled functionality on the resize slider. While a
78
- // range input would be more semantically accurate, it does not affect
79
- // usability.
80
- ,
81
- role: "slider",
82
- css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles],
83
- "aria-orientation": "vertical",
84
- "aria-valuenow": leftSidebarPercentageExpanded,
85
- "aria-valuemin": 0,
86
- "aria-valuemax": 100,
87
- "aria-valuetext": `${valueTextLabel} ${leftSidebarPercentageExpanded}%`,
88
- onKeyDown: onKeyDown,
89
- onMouseDown: onMouseDown,
90
- onFocus: onFocus,
91
- onBlur: onBlur
92
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
93
- }, rest), jsx("span", _extends({
94
- css: lineStyles
95
- }, grabAreaLineSelector)));
70
+ }, ref) => {
71
+ return jsx("button", _extends({
72
+ ref: ref
73
+ }, grabAreaSelector, {
74
+ "aria-label": label,
75
+ "data-testid": testId,
76
+ disabled: isDisabled,
77
+ "aria-hidden": isLeftSidebarCollapsed,
78
+ type: "button"
79
+ // The slider role is applied to a button to utilize the native
80
+ // interactive and disabled functionality on the resize slider. While a
81
+ // range input would be more semantically accurate, it does not affect
82
+ // usability.
83
+ ,
84
+ role: "slider",
85
+ css: isLeftSidebarCollapsed ? [grabAreaStyles, grabAreaCollapsedStyles] : grabAreaStyles,
86
+ "aria-orientation": "vertical",
87
+ "aria-valuenow": leftSidebarPercentageExpanded,
88
+ "aria-valuemin": 0,
89
+ "aria-valuemax": 100,
90
+ "aria-valuetext": `${valueTextLabel} ${leftSidebarPercentageExpanded}%`,
91
+ onKeyDown: onKeyDown,
92
+ onMouseDown: onMouseDown,
93
+ onFocus: onFocus,
94
+ onBlur: onBlur
95
+ }, fg('platform_dst_spread-props-page-layout') ? {} : rest), jsx("span", _extends({
96
+ css: lineStyles
97
+ }, grabAreaLineSelector)));
98
+ });
96
99
 
97
100
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
98
101
  export default GrabArea;
@@ -275,6 +275,7 @@ const ResizeControl = ({
275
275
  if (isSpaceOrEnter) {
276
276
  toggleSideBar(event);
277
277
  event.preventDefault();
278
+ return true; // Added return value
278
279
  }
279
280
  if (isLeftOrTopArrow || isRightOrBottomArrow) {
280
281
  event.preventDefault(); // prevent content scroll
@@ -312,7 +313,9 @@ const ResizeControl = ({
312
313
  onResizeEnd && onResizeEnd(updatedLeftSidebarState);
313
314
  }, 50);
314
315
  });
316
+ return true; // Added return value
315
317
  }
318
+ return false; // Added default return value for all other cases
316
319
  };
317
320
  const onFocus = useCallback(() => {
318
321
  setIsGrabAreaFocused(true);
@@ -324,7 +327,6 @@ const ResizeControl = ({
324
327
  render: (Component, props) => jsx(Component, props),
325
328
  ...(overrides && overrides.ResizeButton)
326
329
  };
327
-
328
330
  // This width is calculated once only on mount.
329
331
  // This means resizing the window will cause this value to be incorrect for screen reader users,
330
332
  // however this comes with a substantial performance gain and so is considered acceptable.
@@ -11,10 +11,11 @@ import { css, jsx } from '@emotion/react';
11
11
  import ChevronRight from '@atlaskit/icon/core/migration/chevron-right';
12
12
  import { easeOut } from '@atlaskit/motion/curves';
13
13
  import { durations } from '@atlaskit/motion/durations';
14
+ import { fg } from '@atlaskit/platform-feature-flags';
14
15
  import { UNSAFE_media } from '@atlaskit/primitives/responsive';
15
16
  import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
16
17
  import { RESIZE_BUTTON_SELECTOR } from '../../common/constants';
17
- const increaseHitAreaStyles = css({
18
+ const hitAreaSpanStyles = css({
18
19
  position: 'absolute',
19
20
  insetBlockEnd: `${"var(--ds-space-negative-300, -24px)"}`,
20
21
  insetBlockStart: `${"var(--ds-space-negative-300, -24px)"}`,
@@ -76,28 +77,34 @@ const cssSelector = {
76
77
  const ResizeButton = ({
77
78
  isLeftSidebarCollapsed,
78
79
  label,
80
+ onClick,
79
81
  testId,
80
82
  ...props
81
- }) => jsx("button", _extends({}, cssSelector, {
82
- // DO NOT remove. used as a CSS selector.
83
- "aria-expanded": !isLeftSidebarCollapsed,
84
- "aria-label": label,
85
- type: "button"
86
- // The error goes away when we remove the spread ...props
87
- ,
88
- css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
89
- "data-testid": testId
90
- // Prevents focus staying attached to the button when pressed
91
- ,
92
- onMouseDown: preventDefault
93
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
94
- }, props), jsx(ChevronRight, {
95
- label: "",
96
- color: "currentColor",
97
- size: "small"
98
- }), jsx("span", {
99
- css: increaseHitAreaStyles
100
- }));
83
+ }) => {
84
+ // Extract css from props if it exists to avoid conflicts
85
+ const {
86
+ css: _ignoredCss,
87
+ ...restProps
88
+ } = props;
89
+ return jsx("button", _extends({}, cssSelector, {
90
+ // DO NOT remove. used as a CSS selector.
91
+ "aria-expanded": !isLeftSidebarCollapsed,
92
+ "aria-label": label,
93
+ type: "button",
94
+ css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
95
+ "data-testid": testId
96
+ // Prevents focus staying attached to the button when pressed
97
+ ,
98
+ onMouseDown: preventDefault,
99
+ onClick: onClick
100
+ }, fg('platform_dst_spread-props-page-layout') ? {} : restProps), jsx(ChevronRight, {
101
+ label: "",
102
+ color: "currentColor",
103
+ size: "small"
104
+ }), jsx("span", {
105
+ css: hitAreaSpanStyles
106
+ }));
107
+ };
101
108
 
102
109
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
103
110
  export default ResizeButton;
@@ -74,7 +74,7 @@ export const SkipLinkWrapper = ({
74
74
  return arr;
75
75
  }
76
76
  const usedIndexes = customLinks.map(a => a.listIndex);
77
- const regularLinksWithIdx = arr.filter(link => link.listIndex === undefined).map((link, idx, currArr) => {
77
+ const regularLinksWithIdx = arr.filter(link => link.listIndex === undefined).map((link, idx) => {
78
78
  const listIndex = assignIndex(idx, usedIndexes);
79
79
  usedIndexes.push(listIndex);
80
80
  return {
@@ -96,26 +96,23 @@ export const SkipLinkWrapper = ({
96
96
  const removeEscHandler = () => window.removeEventListener('keydown', escapeHandler, false);
97
97
  const emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
98
98
  const label = skipLinksLabel || DEFAULT_I18N_PROPS_SKIP_LINKS;
99
- return (
100
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
101
- jsx("div", {
102
- onFocus: attachEscHandler,
103
- onBlur: removeEscHandler,
104
- css: [skipLinkStyles, prefersReducedMotionStyles],
105
- "data-skip-link-wrapper": true
106
- }, emptyLabelOverride ? null : jsx("p", {
107
- css: skipLinkHeadingStyles
108
- }, label), jsx("ol", {
109
- css: skipLinkListStyles
110
- }, sortSkipLinks(skipLinksData).map(({
111
- id,
112
- skipLinkTitle
113
- }) => jsx(SkipLink, {
114
- key: id,
115
- href: `#${id}`,
116
- isFocusable: true
117
- }, skipLinkTitle))))
118
- );
99
+ return jsx("div", {
100
+ onFocus: attachEscHandler,
101
+ onBlur: removeEscHandler,
102
+ css: [skipLinkStyles, prefersReducedMotionStyles],
103
+ "data-skip-link-wrapper": true
104
+ }, emptyLabelOverride ? null : jsx("p", {
105
+ css: skipLinkHeadingStyles
106
+ }, label), jsx("ol", {
107
+ css: skipLinkListStyles
108
+ }, sortSkipLinks(skipLinksData).map(({
109
+ id,
110
+ skipLinkTitle
111
+ }) => jsx(SkipLink, {
112
+ key: id,
113
+ href: `#${id}`,
114
+ isFocusable: true
115
+ }, skipLinkTitle))));
119
116
  };
120
117
  const handleBlur = event => {
121
118
  // @ts-ignore
@@ -131,7 +131,7 @@ export const SidebarResizeController = ({
131
131
  };
132
132
  transition.current = value;
133
133
  }, [isOpen, mobileMediaQuery, isResizing, isLeftSidebarCollapsed, lastLeftSidebarWidth, flyoutLockCount, isFixed, leftSidebarWidth, hasInit]);
134
- const collapseLeftSidebar = useCallback((event, collapseWithoutTransition) => {
134
+ const collapseLeftSidebar = useCallback((_event, collapseWithoutTransition) => {
135
135
  var _transition$current6, _transition$current7;
136
136
  if (!isOpen) {
137
137
  return;
@@ -1,14 +1,15 @@
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", "valueTextLabel", "isDisabled", "isLeftSidebarCollapsed", "label", "leftSidebarPercentageExpanded", "onKeyDown", "onMouseDown", "onBlur", "onFocus", "ref"];
4
+ var _excluded = ["testId", "valueTextLabel", "isDisabled", "isLeftSidebarCollapsed", "label", "leftSidebarPercentageExpanded", "onKeyDown", "onMouseDown", "onBlur", "onFocus"];
5
5
  /**
6
6
  * @jsxRuntime classic
7
7
  * @jsx jsx
8
8
  */
9
-
9
+ import * as React from 'react';
10
10
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
11
11
  import { css, jsx } from '@emotion/react';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
12
13
  import { B200 } from '@atlaskit/theme/colors';
13
14
  import { GRAB_AREA_LINE_SELECTOR, GRAB_AREA_SELECTOR } from '../../common/constants';
14
15
  /**
@@ -51,7 +52,7 @@ var lineStyles = css({
51
52
  });
52
53
  var grabAreaLineSelector = _defineProperty({}, GRAB_AREA_LINE_SELECTOR, true);
53
54
  var grabAreaSelector = _defineProperty({}, GRAB_AREA_SELECTOR, true);
54
- var GrabArea = function GrabArea(_ref) {
55
+ var GrabArea = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
55
56
  var testId = _ref.testId,
56
57
  _ref$valueTextLabel = _ref.valueTextLabel,
57
58
  valueTextLabel = _ref$valueTextLabel === void 0 ? 'Width' : _ref$valueTextLabel,
@@ -63,9 +64,10 @@ var GrabArea = function GrabArea(_ref) {
63
64
  onMouseDown = _ref.onMouseDown,
64
65
  onBlur = _ref.onBlur,
65
66
  onFocus = _ref.onFocus,
66
- ref = _ref.ref,
67
67
  rest = _objectWithoutProperties(_ref, _excluded);
68
- return jsx("button", _extends({}, grabAreaSelector, {
68
+ return jsx("button", _extends({
69
+ ref: ref
70
+ }, grabAreaSelector, {
69
71
  "aria-label": label,
70
72
  "data-testid": testId,
71
73
  disabled: isDisabled,
@@ -77,7 +79,7 @@ var GrabArea = function GrabArea(_ref) {
77
79
  // usability.
78
80
  ,
79
81
  role: "slider",
80
- css: [grabAreaStyles, isLeftSidebarCollapsed && grabAreaCollapsedStyles],
82
+ css: isLeftSidebarCollapsed ? [grabAreaStyles, grabAreaCollapsedStyles] : grabAreaStyles,
81
83
  "aria-orientation": "vertical",
82
84
  "aria-valuenow": leftSidebarPercentageExpanded,
83
85
  "aria-valuemin": 0,
@@ -87,11 +89,10 @@ var GrabArea = function GrabArea(_ref) {
87
89
  onMouseDown: onMouseDown,
88
90
  onFocus: onFocus,
89
91
  onBlur: onBlur
90
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
91
- }, rest), jsx("span", _extends({
92
+ }, fg('platform_dst_spread-props-page-layout') ? {} : rest), jsx("span", _extends({
92
93
  css: lineStyles
93
94
  }, grabAreaLineSelector)));
94
- };
95
+ });
95
96
 
96
97
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
97
98
  export default GrabArea;
@@ -272,6 +272,7 @@ var ResizeControl = function ResizeControl(_ref) {
272
272
  if (isSpaceOrEnter) {
273
273
  toggleSideBar(event);
274
274
  event.preventDefault();
275
+ return true; // Added return value
275
276
  }
276
277
  if (isLeftOrTopArrow || isRightOrBottomArrow) {
277
278
  event.preventDefault(); // prevent content scroll
@@ -303,7 +304,9 @@ var ResizeControl = function ResizeControl(_ref) {
303
304
  onResizeEnd && onResizeEnd(updatedLeftSidebarState);
304
305
  }, 50);
305
306
  });
307
+ return true; // Added return value
306
308
  }
309
+ return false; // Added default return value for all other cases
307
310
  };
308
311
  var onFocus = useCallback(function () {
309
312
  setIsGrabAreaFocused(true);
@@ -316,7 +319,6 @@ var ResizeControl = function ResizeControl(_ref) {
316
319
  return jsx(Component, props);
317
320
  }
318
321
  }, overrides && overrides.ResizeButton);
319
-
320
322
  // This width is calculated once only on mount.
321
323
  // This means resizing the window will cause this value to be incorrect for screen reader users,
322
324
  // however this comes with a substantial performance gain and so is considered acceptable.
@@ -1,7 +1,8 @@
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 = ["isLeftSidebarCollapsed", "label", "testId"];
4
+ var _excluded = ["isLeftSidebarCollapsed", "label", "onClick", "testId"],
5
+ _excluded2 = ["css"];
5
6
  /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-values */
6
7
  /* eslint-disable @atlaskit/ui-styling-standard/no-imported-style-values */
7
8
  /**
@@ -14,10 +15,11 @@ import { css, jsx } from '@emotion/react';
14
15
  import ChevronRight from '@atlaskit/icon/core/migration/chevron-right';
15
16
  import { easeOut } from '@atlaskit/motion/curves';
16
17
  import { durations } from '@atlaskit/motion/durations';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
17
19
  import { UNSAFE_media } from '@atlaskit/primitives/responsive';
18
20
  import { B100, B200, N0, N200, N30A } from '@atlaskit/theme/colors';
19
21
  import { RESIZE_BUTTON_SELECTOR } from '../../common/constants';
20
- var increaseHitAreaStyles = css({
22
+ var hitAreaSpanStyles = css({
21
23
  position: 'absolute',
22
24
  insetBlockEnd: "var(--ds-space-negative-300, -24px)",
23
25
  insetBlockStart: "var(--ds-space-negative-300, -24px)",
@@ -72,27 +74,30 @@ var cssSelector = _defineProperty({}, RESIZE_BUTTON_SELECTOR, true);
72
74
  var ResizeButton = function ResizeButton(_ref) {
73
75
  var isLeftSidebarCollapsed = _ref.isLeftSidebarCollapsed,
74
76
  label = _ref.label,
77
+ onClick = _ref.onClick,
75
78
  testId = _ref.testId,
76
79
  props = _objectWithoutProperties(_ref, _excluded);
80
+ // Extract css from props if it exists to avoid conflicts
81
+ var _ref2 = props,
82
+ _ignoredCss = _ref2.css,
83
+ restProps = _objectWithoutProperties(_ref2, _excluded2);
77
84
  return jsx("button", _extends({}, cssSelector, {
78
85
  // DO NOT remove. used as a CSS selector.
79
86
  "aria-expanded": !isLeftSidebarCollapsed,
80
87
  "aria-label": label,
81
- type: "button"
82
- // The error goes away when we remove the spread ...props
83
- ,
88
+ type: "button",
84
89
  css: [resizeIconButtonStyles, mobileStyles, !isLeftSidebarCollapsed && resizeIconButtonExpandedStyles],
85
90
  "data-testid": testId
86
91
  // Prevents focus staying attached to the button when pressed
87
92
  ,
88
- onMouseDown: preventDefault
89
- // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
90
- }, props), jsx(ChevronRight, {
93
+ onMouseDown: preventDefault,
94
+ onClick: onClick
95
+ }, fg('platform_dst_spread-props-page-layout') ? {} : restProps), jsx(ChevronRight, {
91
96
  label: "",
92
97
  color: "currentColor",
93
98
  size: "small"
94
99
  }), jsx("span", {
95
- css: increaseHitAreaStyles
100
+ css: hitAreaSpanStyles
96
101
  }));
97
102
  };
98
103
 
@@ -82,7 +82,7 @@ export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
82
82
  });
83
83
  var regularLinksWithIdx = arr.filter(function (link) {
84
84
  return link.listIndex === undefined;
85
- }).map(function (link, idx, currArr) {
85
+ }).map(function (link, idx) {
86
86
  var listIndex = _assignIndex(idx, usedIndexes);
87
87
  usedIndexes.push(listIndex);
88
88
  return _objectSpread(_objectSpread({}, link), {}, {
@@ -109,27 +109,24 @@ export var SkipLinkWrapper = function SkipLinkWrapper(_ref) {
109
109
  };
110
110
  var emptyLabelOverride = !!(skipLinksLabel !== null && skipLinksLabel !== void 0 && skipLinksLabel.match(/^\s+$/));
111
111
  var label = skipLinksLabel || DEFAULT_I18N_PROPS_SKIP_LINKS;
112
- return (
113
- // eslint-disable-next-line @atlassian/a11y/no-static-element-interactions
114
- jsx("div", {
115
- onFocus: attachEscHandler,
116
- onBlur: removeEscHandler,
117
- css: [skipLinkStyles, prefersReducedMotionStyles],
118
- "data-skip-link-wrapper": true
119
- }, emptyLabelOverride ? null : jsx("p", {
120
- css: skipLinkHeadingStyles
121
- }, label), jsx("ol", {
122
- css: skipLinkListStyles
123
- }, sortSkipLinks(skipLinksData).map(function (_ref2) {
124
- var id = _ref2.id,
125
- skipLinkTitle = _ref2.skipLinkTitle;
126
- return jsx(SkipLink, {
127
- key: id,
128
- href: "#".concat(id),
129
- isFocusable: true
130
- }, skipLinkTitle);
131
- })))
132
- );
112
+ return jsx("div", {
113
+ onFocus: attachEscHandler,
114
+ onBlur: removeEscHandler,
115
+ css: [skipLinkStyles, prefersReducedMotionStyles],
116
+ "data-skip-link-wrapper": true
117
+ }, emptyLabelOverride ? null : jsx("p", {
118
+ css: skipLinkHeadingStyles
119
+ }, label), jsx("ol", {
120
+ css: skipLinkListStyles
121
+ }, sortSkipLinks(skipLinksData).map(function (_ref2) {
122
+ var id = _ref2.id,
123
+ skipLinkTitle = _ref2.skipLinkTitle;
124
+ return jsx(SkipLink, {
125
+ key: id,
126
+ href: "#".concat(id),
127
+ isFocusable: true
128
+ }, skipLinkTitle);
129
+ })));
133
130
  };
134
131
  var _handleBlur = function handleBlur(event) {
135
132
  // @ts-ignore
@@ -134,7 +134,7 @@ export var SidebarResizeController = function SidebarResizeController(_ref) {
134
134
  };
135
135
  transition.current = value;
136
136
  }, [isOpen, mobileMediaQuery, isResizing, isLeftSidebarCollapsed, lastLeftSidebarWidth, flyoutLockCount, isFixed, leftSidebarWidth, hasInit]);
137
- var collapseLeftSidebar = useCallback(function (event, collapseWithoutTransition) {
137
+ var collapseLeftSidebar = useCallback(function (_event, collapseWithoutTransition) {
138
138
  var _transition$current6, _transition$current7;
139
139
  if (!isOpen) {
140
140
  return;
@@ -2,10 +2,10 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import { type ComponentProps, type FocusEvent, type KeyboardEvent, type MouseEvent } from 'react';
6
- import { jsx } from '@emotion/react';
5
+ import * as React from 'react';
6
+ import { type FocusEvent, type KeyboardEvent, type MouseEvent } from 'react';
7
7
  import { type LeftSidebarProps } from '../../common/types';
8
- type GrabAreaProps = {
8
+ declare const GrabArea: React.ForwardRefExoticComponent<{
9
9
  isDisabled: boolean;
10
10
  isLeftSidebarCollapsed: boolean;
11
11
  label: string;
@@ -15,7 +15,6 @@ type GrabAreaProps = {
15
15
  onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
16
16
  onMouseDown: (event: MouseEvent<HTMLButtonElement>) => void;
17
17
  testId?: string;
18
- ref?: React.Ref<HTMLButtonElement>;
19
- } & ComponentProps<'button'>;
20
- declare const GrabArea: ({ testId, valueTextLabel, isDisabled, isLeftSidebarCollapsed, label, leftSidebarPercentageExpanded, onKeyDown, onMouseDown, onBlur, onFocus, ref, ...rest }: GrabAreaProps & Partial<LeftSidebarProps>) => jsx.JSX.Element;
18
+ valueTextLabel?: string;
19
+ } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & Partial<LeftSidebarProps> & React.RefAttributes<HTMLButtonElement>>;
21
20
  export default GrabArea;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { type ResizeButtonProps } from './types';
3
- declare const ResizeButton: ({ isLeftSidebarCollapsed, label, testId, ...props }: ResizeButtonProps) => jsx.JSX.Element;
3
+ declare const ResizeButton: ({ isLeftSidebarCollapsed, label, onClick, testId, ...props }: ResizeButtonProps) => jsx.JSX.Element;
4
4
  export default ResizeButton;
@@ -2,10 +2,10 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import { type ComponentProps, type FocusEvent, type KeyboardEvent, type MouseEvent } from 'react';
6
- import { jsx } from '@emotion/react';
5
+ import * as React from 'react';
6
+ import { type FocusEvent, type KeyboardEvent, type MouseEvent } from 'react';
7
7
  import { type LeftSidebarProps } from '../../common/types';
8
- type GrabAreaProps = {
8
+ declare const GrabArea: React.ForwardRefExoticComponent<{
9
9
  isDisabled: boolean;
10
10
  isLeftSidebarCollapsed: boolean;
11
11
  label: string;
@@ -15,7 +15,6 @@ type GrabAreaProps = {
15
15
  onKeyDown: (event: KeyboardEvent<HTMLButtonElement>) => void;
16
16
  onMouseDown: (event: MouseEvent<HTMLButtonElement>) => void;
17
17
  testId?: string;
18
- ref?: React.Ref<HTMLButtonElement>;
19
- } & ComponentProps<'button'>;
20
- declare const GrabArea: ({ testId, valueTextLabel, isDisabled, isLeftSidebarCollapsed, label, leftSidebarPercentageExpanded, onKeyDown, onMouseDown, onBlur, onFocus, ref, ...rest }: GrabAreaProps & Partial<LeftSidebarProps>) => jsx.JSX.Element;
18
+ valueTextLabel?: string;
19
+ } & Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & Partial<LeftSidebarProps> & React.RefAttributes<HTMLButtonElement>>;
21
20
  export default GrabArea;
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import { type ResizeButtonProps } from './types';
3
- declare const ResizeButton: ({ isLeftSidebarCollapsed, label, testId, ...props }: ResizeButtonProps) => jsx.JSX.Element;
3
+ declare const ResizeButton: ({ isLeftSidebarCollapsed, label, onClick, testId, ...props }: ResizeButtonProps) => jsx.JSX.Element;
4
4
  export default ResizeButton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/page-layout",
3
- "version": "4.2.17",
3
+ "version": "4.2.19",
4
4
  "description": "A collection of components which let you compose an application's page layout.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -37,14 +37,14 @@
37
37
  },
38
38
  "homepage": "https://atlassian.design/components/page-layout/",
39
39
  "dependencies": {
40
- "@atlaskit/ds-lib": "^5.1.0",
40
+ "@atlaskit/ds-lib": "^5.2.0",
41
41
  "@atlaskit/icon": "^28.5.0",
42
42
  "@atlaskit/link": "^3.2.0",
43
43
  "@atlaskit/motion": "^5.3.0",
44
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
45
- "@atlaskit/primitives": "^16.0.0",
45
+ "@atlaskit/primitives": "^16.1.0",
46
46
  "@atlaskit/theme": "^21.0.0",
47
- "@atlaskit/tokens": "^7.0.0",
47
+ "@atlaskit/tokens": "^8.0.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
50
50
  "bind-event-listener": "^3.0.0",
@@ -57,16 +57,16 @@
57
57
  "devDependencies": {
58
58
  "@af/accessibility-testing": "workspace:^",
59
59
  "@af/integration-testing": "workspace:^",
60
- "@atlaskit/atlassian-navigation": "^5.3.0",
61
- "@atlaskit/button": "^23.5.0",
60
+ "@atlaskit/atlassian-navigation": "^5.4.0",
61
+ "@atlaskit/button": "^23.6.0",
62
62
  "@atlaskit/docs": "^11.2.0",
63
63
  "@atlaskit/logo": "^19.9.0",
64
64
  "@atlaskit/menu": "^8.4.0",
65
- "@atlaskit/popup": "^4.4.0",
66
- "@atlaskit/section-message": "^8.7.0",
65
+ "@atlaskit/popup": "^4.6.0",
66
+ "@atlaskit/section-message": "^8.9.0",
67
67
  "@atlaskit/side-navigation": "^11.0.0",
68
- "@atlaskit/tooltip": "^20.5.0",
69
- "@atlassian/ssr-tests": "^0.3.0",
68
+ "@atlaskit/tooltip": "^20.8.0",
69
+ "@atlassian/ssr-tests": "workspace:^",
70
70
  "@testing-library/react": "^13.4.0",
71
71
  "@testing-library/react-hooks": "^8.0.1",
72
72
  "@types/raf-schd": "^4.0.1",
@@ -76,6 +76,9 @@
76
76
  "platform_dst_popup-disable-focuslock": {
77
77
  "type": "boolean",
78
78
  "referenceOnly": "true"
79
+ },
80
+ "platform_dst_spread-props-page-layout": {
81
+ "type": "boolean"
79
82
  }
80
83
  },
81
84
  "keywords": [