@atlaskit/drawer 7.9.0 → 7.11.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 (34) hide show
  1. package/CHANGELOG.md +702 -687
  2. package/dist/cjs/components/blanket.js +11 -8
  3. package/dist/cjs/components/index.js +4 -2
  4. package/dist/cjs/components/primitives/content.js +37 -14
  5. package/dist/cjs/components/primitives/drawer-wrapper.js +6 -2
  6. package/dist/cjs/components/primitives/index.js +19 -10
  7. package/dist/es2019/components/blanket.js +3 -1
  8. package/dist/es2019/components/index.js +4 -2
  9. package/dist/es2019/components/primitives/content.js +32 -11
  10. package/dist/es2019/components/primitives/drawer-wrapper.js +6 -2
  11. package/dist/es2019/components/primitives/index.js +16 -9
  12. package/dist/esm/components/blanket.js +11 -8
  13. package/dist/esm/components/index.js +4 -2
  14. package/dist/esm/components/primitives/content.js +36 -13
  15. package/dist/esm/components/primitives/drawer-wrapper.js +6 -2
  16. package/dist/esm/components/primitives/index.js +18 -9
  17. package/dist/types/components/index.d.ts +3 -3
  18. package/dist/types/components/primitives/content.d.ts +3 -3
  19. package/dist/types/components/primitives/drawer-wrapper.d.ts +2 -2
  20. package/dist/types/components/primitives/index.d.ts +2 -2
  21. package/dist/types/components/primitives/sidebar.d.ts +3 -3
  22. package/dist/types/components/types.d.ts +8 -0
  23. package/dist/types-ts4.5/components/index.d.ts +3 -3
  24. package/dist/types-ts4.5/components/primitives/content.d.ts +3 -3
  25. package/dist/types-ts4.5/components/primitives/drawer-wrapper.d.ts +2 -2
  26. package/dist/types-ts4.5/components/primitives/index.d.ts +2 -2
  27. package/dist/types-ts4.5/components/primitives/sidebar.d.ts +3 -3
  28. package/dist/types-ts4.5/components/types.d.ts +8 -0
  29. package/package.json +3 -4
  30. package/dist/cjs/components/primitives/icon-button.js +0 -39
  31. package/dist/es2019/components/primitives/icon-button.js +0 -32
  32. package/dist/esm/components/primitives/icon-button.js +0 -33
  33. package/dist/types/components/primitives/icon-button.d.ts +0 -9
  34. package/dist/types-ts4.5/components/primitives/icon-button.d.ts +0 -9
@@ -42,14 +42,17 @@ var Blanket = function Blanket(_ref) {
42
42
  animationTimingFunction: _constants.animationTimingFunction
43
43
  }, function (_ref2) {
44
44
  var className = _ref2.className;
45
- return (0, _react2.jsx)("div", {
46
- css: blanketStyles,
47
- className: className
48
- }, (0, _react2.jsx)(_blanket.default, {
49
- isTinted: true,
50
- onBlanketClicked: onBlanketClicked,
51
- testId: testId && testId
52
- }));
45
+ return (
46
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
47
+ (0, _react2.jsx)("div", {
48
+ css: blanketStyles,
49
+ className: className
50
+ }, (0, _react2.jsx)(_blanket.default, {
51
+ isTinted: true,
52
+ onBlanketClicked: onBlanketClicked,
53
+ testId: testId && testId
54
+ }))
55
+ );
53
56
  }));
54
57
  };
55
58
  var _default = exports.default = Blanket;
@@ -27,7 +27,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
27
27
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
28
28
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
29
29
  var packageName = "@atlaskit/drawer";
30
- var packageVersion = "7.9.0";
30
+ var packageVersion = "7.11.0";
31
31
  var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
32
32
  var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
33
33
  return createAndFireEventOnAtlaskit({
@@ -120,6 +120,7 @@ var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
120
120
  children = _this$props3.children,
121
121
  icon = _this$props3.icon,
122
122
  closeLabel = _this$props3.closeLabel,
123
+ scrollContentLabel = _this$props3.scrollContentLabel,
123
124
  width = _this$props3.width,
124
125
  shouldUnmountOnExit = _this$props3.shouldUnmountOnExit,
125
126
  onCloseComplete = _this$props3.onCloseComplete,
@@ -155,7 +156,8 @@ var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
155
156
  overrides: overrides,
156
157
  autoFocusFirstElem: autoFocusFirstElem,
157
158
  isFocusLockEnabled: isFocusLockEnabled,
158
- shouldReturnFocus: shouldReturnFocus
159
+ shouldReturnFocus: shouldReturnFocus,
160
+ scrollContentLabel: scrollContentLabel
159
161
  }, children));
160
162
  }
161
163
  }]);
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
10
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
- var _react = require("@emotion/react");
11
- var _excluded = ["cssFn"];
11
+ var _react = require("react");
12
+ var _react2 = require("@emotion/react");
13
+ var _excluded = ["cssFn", "scrollContentLabel"];
12
14
  /** @jsx jsx */
13
15
  var defaultStyles = {
14
16
  flex: 1,
@@ -20,20 +22,41 @@ var contentCSS = function contentCSS() {
20
22
  };
21
23
  var Content = function Content(_ref) {
22
24
  var cssFn = _ref.cssFn,
25
+ _ref$scrollContentLab = _ref.scrollContentLabel,
26
+ scrollContentLabel = _ref$scrollContentLab === void 0 ? 'Scrollable content' : _ref$scrollContentLab,
23
27
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
24
- return (
25
- /**
26
- * I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
27
- * than the defaultStyles as the overrides guide suggests. I went with what the overrides
28
- * guide suggested as it made more sense as a transformer of the current styles rather than
29
- * a complete override with no chance of partially changing styles.
30
- */
28
+ var _useState = (0, _react.useState)(false),
29
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
+ showContentFocus = _useState2[0],
31
+ setContentFocus = _useState2[1];
32
+ var scrollableRef = (0, _react.useRef)(null);
33
+ (0, _react.useEffect)(function () {
34
+ var setLazyContentFocus = function setLazyContentFocus() {
35
+ var target = scrollableRef.current;
36
+ target && setContentFocus(target.scrollHeight > target.clientHeight);
37
+ };
38
+ setLazyContentFocus();
39
+ }, []);
31
40
 
32
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
33
- (0, _react.jsx)("div", (0, _extends2.default)({
34
- css: (0, _react.css)(cssFn(defaultStyles))
35
- }, props))
36
- );
41
+ /**
42
+ * I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
43
+ * than the defaultStyles as the overrides guide suggests. I went with what the overrides
44
+ * guide suggested as it made more sense as a transformer of the current styles rather than
45
+ * a complete override with no chance of partially changing styles.
46
+ */
47
+ return (0, _react2.jsx)("div", (0, _extends2.default)({
48
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
49
+ css: (0, _react2.css)(cssFn(defaultStyles)),
50
+ ref: scrollableRef
51
+ // tabindex is allowed here so that keyboard users can scroll content
52
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
53
+ ,
54
+ tabIndex: showContentFocus ? 0 : undefined,
55
+ role: showContentFocus ? 'region' : undefined,
56
+ "aria-label": showContentFocus ? scrollContentLabel : undefined,
57
+ "data-testId": "drawer-contents"
58
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
59
+ }, props));
37
60
  };
38
61
  var _default = exports.default = {
39
62
  component: Content,
@@ -67,8 +67,12 @@ var DrawerWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, scrollRe
67
67
  var ref = (0, _useCallbackRef.useMergeRefs)([drawerRef, assignSecondChildRef]);
68
68
  (0, _usePreventProgrammaticScroll.default)();
69
69
  return (0, _react2.jsx)("div", {
70
- css: wrapperStyles,
71
- style: wrapperWidth[width],
70
+ css: wrapperStyles
71
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
72
+ ,
73
+ style: wrapperWidth[width]
74
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
75
+ ,
72
76
  className: className,
73
77
  "data-testid": testId,
74
78
  ref: ref,
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
8
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
10
  var _react = require("react");
10
11
  var _react2 = require("@emotion/react");
12
+ var _new = require("@atlaskit/button/new");
11
13
  var _arrowLeft = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-left"));
12
14
  var _motion = require("@atlaskit/motion");
13
15
  var _constants = require("../../constants");
@@ -15,7 +17,6 @@ var _utils = require("../utils");
15
17
  var _content = _interopRequireDefault(require("./content"));
16
18
  var _drawerWrapper = _interopRequireDefault(require("./drawer-wrapper"));
17
19
  var _focusLock = _interopRequireDefault(require("./focus-lock"));
18
- var _iconButton = _interopRequireDefault(require("./icon-button"));
19
20
  var _sidebar = _interopRequireDefault(require("./sidebar"));
20
21
  var _excluded = ["component"],
21
22
  _excluded2 = ["component"];
@@ -57,6 +58,7 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
57
58
  Icon = _ref2.icon,
58
59
  _ref2$closeLabel = _ref2.closeLabel,
59
60
  closeLabel = _ref2$closeLabel === void 0 ? 'Close drawer' : _ref2$closeLabel,
61
+ scrollContentLabel = _ref2.scrollContentLabel,
60
62
  onClose = _ref2.onClose,
61
63
  onCloseComplete = _ref2.onCloseComplete,
62
64
  onOpenComplete = _ref2.onOpenComplete,
@@ -98,22 +100,29 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
98
100
  autoFocusFirstElem: autoFocusFirstElem,
99
101
  isFocusLockEnabled: isFocusLockEnabled,
100
102
  shouldReturnFocus: shouldReturnFocus
101
- }, (0, _react2.jsx)(_drawerWrapper.default, {
103
+ }, (0, _react2.jsx)(_drawerWrapper.default
104
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
105
+ , {
102
106
  className: className,
103
107
  width: width,
104
108
  testId: testId,
105
109
  drawerRef: drawerRef,
106
110
  label: label,
107
111
  titleId: titleId
108
- }, (0, _react2.jsx)(Sidebar, sideBarOverrides, (0, _react2.jsx)(_iconButton.default, {
112
+ }, (0, _react2.jsx)(Sidebar, sideBarOverrides, (0, _react2.jsx)(_new.IconButton, {
109
113
  onClick: onClose,
110
- testId: testId && 'DrawerPrimitiveSidebarCloseButton'
111
- }, Icon ? (0, _react2.jsx)(Icon, {
112
- size: "large",
113
- label: closeLabel
114
- }) : (0, _react2.jsx)(_arrowLeft.default, {
115
- label: closeLabel
116
- }))), (0, _react2.jsx)(Content, contentOverrides, children)));
114
+ testId: testId && 'DrawerPrimitiveSidebarCloseButton',
115
+ icon: Icon ? function (iconProps) {
116
+ return (0, _react2.jsx)(Icon, (0, _extends2.default)({}, iconProps, {
117
+ size: "large"
118
+ }));
119
+ } : _arrowLeft.default,
120
+ label: closeLabel,
121
+ shape: "circle",
122
+ appearance: "subtle"
123
+ })), (0, _react2.jsx)(Content, (0, _extends2.default)({
124
+ scrollContentLabel: scrollContentLabel
125
+ }, contentOverrides), children)));
117
126
  }));
118
127
  };
119
128
 
@@ -35,7 +35,9 @@ const Blanket = ({
35
35
  animationTimingFunction: animationTimingFunction
36
36
  }, ({
37
37
  className
38
- }) => jsx("div", {
38
+ }) =>
39
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
40
+ jsx("div", {
39
41
  css: blanketStyles,
40
42
  className: className
41
43
  }, jsx(AkBlanket, {
@@ -8,7 +8,7 @@ import { defaultFocusLockSettings } from '../constants';
8
8
  import Blanket from './blanket';
9
9
  import DrawerPrimitive from './primitives';
10
10
  const packageName = "@atlaskit/drawer";
11
- const packageVersion = "7.9.0";
11
+ const packageVersion = "7.11.0";
12
12
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
13
13
  const createAndFireOnClick = (createAnalyticsEvent, trigger) => createAndFireEventOnAtlaskit({
14
14
  action: 'dismissed',
@@ -89,6 +89,7 @@ export class DrawerBase extends Component {
89
89
  children,
90
90
  icon,
91
91
  closeLabel,
92
+ scrollContentLabel,
92
93
  width,
93
94
  shouldUnmountOnExit,
94
95
  onCloseComplete,
@@ -124,7 +125,8 @@ export class DrawerBase extends Component {
124
125
  overrides: overrides,
125
126
  autoFocusFirstElem: autoFocusFirstElem,
126
127
  isFocusLockEnabled: isFocusLockEnabled,
127
- shouldReturnFocus: shouldReturnFocus
128
+ shouldReturnFocus: shouldReturnFocus,
129
+ scrollContentLabel: scrollContentLabel
128
130
  }, children));
129
131
  }
130
132
  }
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
 
4
+ import { useEffect, useRef, useState } from 'react';
4
5
  import { css, jsx } from '@emotion/react';
5
6
  const defaultStyles = {
6
7
  flex: 1,
@@ -10,19 +11,39 @@ const defaultStyles = {
10
11
  const contentCSS = () => defaultStyles;
11
12
  const Content = ({
12
13
  cssFn,
14
+ scrollContentLabel = 'Scrollable content',
13
15
  ...props
14
- }) =>
15
- /**
16
- * I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
17
- * than the defaultStyles as the overrides guide suggests. I went with what the overrides
18
- * guide suggested as it made more sense as a transformer of the current styles rather than
19
- * a complete override with no chance of partially changing styles.
20
- */
16
+ }) => {
17
+ const [showContentFocus, setContentFocus] = useState(false);
18
+ const scrollableRef = useRef(null);
19
+ useEffect(() => {
20
+ const setLazyContentFocus = () => {
21
+ const target = scrollableRef.current;
22
+ target && setContentFocus(target.scrollHeight > target.clientHeight);
23
+ };
24
+ setLazyContentFocus();
25
+ }, []);
21
26
 
22
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
23
- jsx("div", _extends({
24
- css: css(cssFn(defaultStyles))
25
- }, props));
27
+ /**
28
+ * I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
29
+ * than the defaultStyles as the overrides guide suggests. I went with what the overrides
30
+ * guide suggested as it made more sense as a transformer of the current styles rather than
31
+ * a complete override with no chance of partially changing styles.
32
+ */
33
+ return jsx("div", _extends({
34
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
35
+ css: css(cssFn(defaultStyles)),
36
+ ref: scrollableRef
37
+ // tabindex is allowed here so that keyboard users can scroll content
38
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
39
+ ,
40
+ tabIndex: showContentFocus ? 0 : undefined,
41
+ role: showContentFocus ? 'region' : undefined,
42
+ "aria-label": showContentFocus ? scrollContentLabel : undefined,
43
+ "data-testId": "drawer-contents"
44
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
45
+ }, props));
46
+ };
26
47
  export default {
27
48
  component: Content,
28
49
  cssFn: contentCSS
@@ -62,8 +62,12 @@ const DrawerWrapper = /*#__PURE__*/forwardRef(({
62
62
  const ref = useMergeRefs([drawerRef, assignSecondChildRef]);
63
63
  usePreventProgrammaticScroll();
64
64
  return jsx("div", {
65
- css: wrapperStyles,
66
- style: wrapperWidth[width],
65
+ css: wrapperStyles
66
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
67
+ ,
68
+ style: wrapperWidth[width]
69
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
70
+ ,
67
71
  className: className,
68
72
  "data-testid": testId,
69
73
  ref: ref,
@@ -1,7 +1,9 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  /** @jsx jsx */
2
3
 
3
4
  import { useCallback, useRef } from 'react';
4
5
  import { jsx } from '@emotion/react';
6
+ import { IconButton } from '@atlaskit/button/new';
5
7
  import ArrowLeft from '@atlaskit/icon/glyph/arrow-left';
6
8
  import { ExitingPersistence, SlideIn, useExitingPersistence } from '@atlaskit/motion';
7
9
  import { animationTimingFunction, transitionDurationMs } from '../../constants';
@@ -9,7 +11,6 @@ import { createExtender } from '../utils';
9
11
  import ContentOverrides from './content';
10
12
  import DrawerWrapper from './drawer-wrapper';
11
13
  import FocusLock from './focus-lock';
12
- import IconButton from './icon-button';
13
14
  import SidebarOverrides from './sidebar';
14
15
 
15
16
  // Misc.
@@ -50,6 +51,7 @@ const DrawerPrimitive = ({
50
51
  children,
51
52
  icon: Icon,
52
53
  closeLabel = 'Close drawer',
54
+ scrollContentLabel,
53
55
  onClose,
54
56
  onCloseComplete,
55
57
  onOpenComplete,
@@ -94,7 +96,9 @@ const DrawerPrimitive = ({
94
96
  autoFocusFirstElem: autoFocusFirstElem,
95
97
  isFocusLockEnabled: isFocusLockEnabled,
96
98
  shouldReturnFocus: shouldReturnFocus
97
- }, jsx(DrawerWrapper, {
99
+ }, jsx(DrawerWrapper
100
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
101
+ , {
98
102
  className: className,
99
103
  width: width,
100
104
  testId: testId,
@@ -103,13 +107,16 @@ const DrawerPrimitive = ({
103
107
  titleId: titleId
104
108
  }, jsx(Sidebar, sideBarOverrides, jsx(IconButton, {
105
109
  onClick: onClose,
106
- testId: testId && 'DrawerPrimitiveSidebarCloseButton'
107
- }, Icon ? jsx(Icon, {
108
- size: "large",
109
- label: closeLabel
110
- }) : jsx(ArrowLeft, {
111
- label: closeLabel
112
- }))), jsx(Content, contentOverrides, children)))));
110
+ testId: testId && 'DrawerPrimitiveSidebarCloseButton',
111
+ icon: Icon ? iconProps => jsx(Icon, _extends({}, iconProps, {
112
+ size: "large"
113
+ })) : ArrowLeft,
114
+ label: closeLabel,
115
+ shape: "circle",
116
+ appearance: "subtle"
117
+ })), jsx(Content, _extends({
118
+ scrollContentLabel: scrollContentLabel
119
+ }, contentOverrides), children)))));
113
120
  };
114
121
 
115
122
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
@@ -34,14 +34,17 @@ var Blanket = function Blanket(_ref) {
34
34
  animationTimingFunction: animationTimingFunction
35
35
  }, function (_ref2) {
36
36
  var className = _ref2.className;
37
- return jsx("div", {
38
- css: blanketStyles,
39
- className: className
40
- }, jsx(AkBlanket, {
41
- isTinted: true,
42
- onBlanketClicked: onBlanketClicked,
43
- testId: testId && testId
44
- }));
37
+ return (
38
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
39
+ jsx("div", {
40
+ css: blanketStyles,
41
+ className: className
42
+ }, jsx(AkBlanket, {
43
+ isTinted: true,
44
+ onBlanketClicked: onBlanketClicked,
45
+ testId: testId && testId
46
+ }))
47
+ );
45
48
  }));
46
49
  };
47
50
  export default Blanket;
@@ -18,7 +18,7 @@ import { defaultFocusLockSettings } from '../constants';
18
18
  import Blanket from './blanket';
19
19
  import DrawerPrimitive from './primitives';
20
20
  var packageName = "@atlaskit/drawer";
21
- var packageVersion = "7.9.0";
21
+ var packageVersion = "7.11.0";
22
22
  var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
23
23
  var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
24
24
  return createAndFireEventOnAtlaskit({
@@ -111,6 +111,7 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
111
111
  children = _this$props3.children,
112
112
  icon = _this$props3.icon,
113
113
  closeLabel = _this$props3.closeLabel,
114
+ scrollContentLabel = _this$props3.scrollContentLabel,
114
115
  width = _this$props3.width,
115
116
  shouldUnmountOnExit = _this$props3.shouldUnmountOnExit,
116
117
  onCloseComplete = _this$props3.onCloseComplete,
@@ -146,7 +147,8 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
146
147
  overrides: overrides,
147
148
  autoFocusFirstElem: autoFocusFirstElem,
148
149
  isFocusLockEnabled: isFocusLockEnabled,
149
- shouldReturnFocus: shouldReturnFocus
150
+ shouldReturnFocus: shouldReturnFocus,
151
+ scrollContentLabel: scrollContentLabel
150
152
  }, children));
151
153
  }
152
154
  }]);
@@ -1,8 +1,10 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["cssFn"];
4
+ var _excluded = ["cssFn", "scrollContentLabel"];
4
5
  /** @jsx jsx */
5
6
 
7
+ import { useEffect, useRef, useState } from 'react';
6
8
  import { css, jsx } from '@emotion/react';
7
9
  var defaultStyles = {
8
10
  flex: 1,
@@ -14,20 +16,41 @@ var contentCSS = function contentCSS() {
14
16
  };
15
17
  var Content = function Content(_ref) {
16
18
  var cssFn = _ref.cssFn,
19
+ _ref$scrollContentLab = _ref.scrollContentLabel,
20
+ scrollContentLabel = _ref$scrollContentLab === void 0 ? 'Scrollable content' : _ref$scrollContentLab,
17
21
  props = _objectWithoutProperties(_ref, _excluded);
18
- return (
19
- /**
20
- * I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
21
- * than the defaultStyles as the overrides guide suggests. I went with what the overrides
22
- * guide suggested as it made more sense as a transformer of the current styles rather than
23
- * a complete override with no chance of partially changing styles.
24
- */
22
+ var _useState = useState(false),
23
+ _useState2 = _slicedToArray(_useState, 2),
24
+ showContentFocus = _useState2[0],
25
+ setContentFocus = _useState2[1];
26
+ var scrollableRef = useRef(null);
27
+ useEffect(function () {
28
+ var setLazyContentFocus = function setLazyContentFocus() {
29
+ var target = scrollableRef.current;
30
+ target && setContentFocus(target.scrollHeight > target.clientHeight);
31
+ };
32
+ setLazyContentFocus();
33
+ }, []);
25
34
 
26
- // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
27
- jsx("div", _extends({
28
- css: css(cssFn(defaultStyles))
29
- }, props))
30
- );
35
+ /**
36
+ * I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
37
+ * than the defaultStyles as the overrides guide suggests. I went with what the overrides
38
+ * guide suggested as it made more sense as a transformer of the current styles rather than
39
+ * a complete override with no chance of partially changing styles.
40
+ */
41
+ return jsx("div", _extends({
42
+ // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
43
+ css: css(cssFn(defaultStyles)),
44
+ ref: scrollableRef
45
+ // tabindex is allowed here so that keyboard users can scroll content
46
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
47
+ ,
48
+ tabIndex: showContentFocus ? 0 : undefined,
49
+ role: showContentFocus ? 'region' : undefined,
50
+ "aria-label": showContentFocus ? scrollContentLabel : undefined,
51
+ "data-testId": "drawer-contents"
52
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
53
+ }, props));
31
54
  };
32
55
  export default {
33
56
  component: Content,
@@ -60,8 +60,12 @@ var DrawerWrapper = /*#__PURE__*/forwardRef(function (_ref, scrollRef) {
60
60
  var ref = useMergeRefs([drawerRef, assignSecondChildRef]);
61
61
  usePreventProgrammaticScroll();
62
62
  return jsx("div", {
63
- css: wrapperStyles,
64
- style: wrapperWidth[width],
63
+ css: wrapperStyles
64
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
65
+ ,
66
+ style: wrapperWidth[width]
67
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
68
+ ,
65
69
  className: className,
66
70
  "data-testid": testId,
67
71
  ref: ref,
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
1
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
3
  var _excluded = ["component"],
3
4
  _excluded2 = ["component"];
@@ -5,6 +6,7 @@ var _excluded = ["component"],
5
6
 
6
7
  import { useCallback, useRef } from 'react';
7
8
  import { jsx } from '@emotion/react';
9
+ import { IconButton } from '@atlaskit/button/new';
8
10
  import ArrowLeft from '@atlaskit/icon/glyph/arrow-left';
9
11
  import { ExitingPersistence, SlideIn, useExitingPersistence } from '@atlaskit/motion';
10
12
  import { animationTimingFunction, transitionDurationMs } from '../../constants';
@@ -12,7 +14,6 @@ import { createExtender } from '../utils';
12
14
  import ContentOverrides from './content';
13
15
  import DrawerWrapper from './drawer-wrapper';
14
16
  import FocusLock from './focus-lock';
15
- import IconButton from './icon-button';
16
17
  import SidebarOverrides from './sidebar';
17
18
 
18
19
  // Misc.
@@ -52,6 +53,7 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
52
53
  Icon = _ref2.icon,
53
54
  _ref2$closeLabel = _ref2.closeLabel,
54
55
  closeLabel = _ref2$closeLabel === void 0 ? 'Close drawer' : _ref2$closeLabel,
56
+ scrollContentLabel = _ref2.scrollContentLabel,
55
57
  onClose = _ref2.onClose,
56
58
  onCloseComplete = _ref2.onCloseComplete,
57
59
  onOpenComplete = _ref2.onOpenComplete,
@@ -93,7 +95,9 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
93
95
  autoFocusFirstElem: autoFocusFirstElem,
94
96
  isFocusLockEnabled: isFocusLockEnabled,
95
97
  shouldReturnFocus: shouldReturnFocus
96
- }, jsx(DrawerWrapper, {
98
+ }, jsx(DrawerWrapper
99
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
100
+ , {
97
101
  className: className,
98
102
  width: width,
99
103
  testId: testId,
@@ -102,13 +106,18 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
102
106
  titleId: titleId
103
107
  }, jsx(Sidebar, sideBarOverrides, jsx(IconButton, {
104
108
  onClick: onClose,
105
- testId: testId && 'DrawerPrimitiveSidebarCloseButton'
106
- }, Icon ? jsx(Icon, {
107
- size: "large",
108
- label: closeLabel
109
- }) : jsx(ArrowLeft, {
110
- label: closeLabel
111
- }))), jsx(Content, contentOverrides, children)));
109
+ testId: testId && 'DrawerPrimitiveSidebarCloseButton',
110
+ icon: Icon ? function (iconProps) {
111
+ return jsx(Icon, _extends({}, iconProps, {
112
+ size: "large"
113
+ }));
114
+ } : ArrowLeft,
115
+ label: closeLabel,
116
+ shape: "circle",
117
+ appearance: "subtle"
118
+ })), jsx(Content, _extends({
119
+ scrollContentLabel: scrollContentLabel
120
+ }, contentOverrides), children)));
112
121
  }));
113
122
  };
114
123
 
@@ -1,5 +1,5 @@
1
1
  import React, { Component } from 'react';
2
- import { DrawerProps, DrawerWidth } from './types';
2
+ import { type DrawerProps, type DrawerWidth } from './types';
3
3
  export declare class DrawerBase extends Component<DrawerProps, {
4
4
  renderPortal: boolean;
5
5
  }> {
@@ -22,10 +22,10 @@ export declare class DrawerBase extends Component<DrawerProps, {
22
22
  handleKeyDown: (event: KeyboardEvent) => void;
23
23
  render(): JSX.Element | null;
24
24
  }
25
- declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "children" | "onKeyDown" | "onClose" | "testId" | "icon" | "closeLabel" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | keyof import("./types").DrawerLabel> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | keyof import("./types").FocusLockSettings>> & Partial<Pick<{
25
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "scrollContentLabel" | "children" | "onKeyDown" | "onClose" | "testId" | "icon" | "closeLabel" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | keyof import("./types").DrawerLabel> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | keyof import("./types").FocusLockSettings>> & Partial<Pick<{
26
26
  autoFocusFirstElem?: boolean | (() => HTMLElement | null) | undefined;
27
27
  isFocusLockEnabled?: boolean | undefined;
28
28
  shouldReturnFocus?: boolean | React.RefObject<HTMLElement> | undefined;
29
29
  width: DrawerWidth;
30
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "width" | "children" | "onKeyDown" | "key" | "onClose" | "testId" | "icon" | "closeLabel" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | "analyticsContext" | keyof import("./types").FocusLockSettings | keyof import("./types").DrawerLabel> & React.RefAttributes<any>>;
30
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "scrollContentLabel" | "width" | "children" | "onKeyDown" | "key" | "onClose" | "testId" | "icon" | "closeLabel" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | "analyticsContext" | keyof import("./types").FocusLockSettings | keyof import("./types").DrawerLabel> & React.RefAttributes<any>>;
31
31
  export default _default;
@@ -1,8 +1,8 @@
1
1
  /** @jsx jsx */
2
- import { CSSObject, jsx } from '@emotion/react';
3
- import { ContentProps } from '../types';
2
+ import { type CSSObject, jsx } from '@emotion/react';
3
+ import { type ContentProps } from '../types';
4
4
  declare const _default: {
5
- component: ({ cssFn, ...props }: ContentProps) => jsx.JSX.Element;
5
+ component: ({ cssFn, scrollContentLabel, ...props }: ContentProps) => jsx.JSX.Element;
6
6
  cssFn: () => CSSObject;
7
7
  };
8
8
  export default _default;
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
- import { ReactElement, Ref } from 'react';
3
- import { DrawerPrimitiveProps, Widths } from '../types';
2
+ import { type ReactElement, type Ref } from 'react';
3
+ import { type DrawerPrimitiveProps, type Widths } from '../types';
4
4
  export declare const wrapperWidth: Widths;
5
5
  interface FocusLockRefTargetProps extends Pick<DrawerPrimitiveProps, 'width' | 'testId' | 'label' | 'titleId'> {
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
2
  import { jsx } from '@emotion/react';
3
- import { DrawerPrimitiveProps } from '../types';
4
- declare const DrawerPrimitive: ({ children, icon: Icon, closeLabel, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, shouldReturnFocus, autoFocusFirstElem, isFocusLockEnabled, width, label, titleId, }: DrawerPrimitiveProps) => jsx.JSX.Element;
3
+ import { type DrawerPrimitiveProps } from '../types';
4
+ declare const DrawerPrimitive: ({ children, icon: Icon, closeLabel, scrollContentLabel, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, shouldReturnFocus, autoFocusFirstElem, isFocusLockEnabled, width, label, titleId, }: DrawerPrimitiveProps) => jsx.JSX.Element;
5
5
  export default DrawerPrimitive;