@atlaskit/drawer 7.4.7 → 7.4.9

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 (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/components/blanket.js +3 -13
  3. package/dist/cjs/components/index.js +21 -60
  4. package/dist/cjs/components/primitives/content.js +2 -10
  5. package/dist/cjs/components/primitives/drawer-wrapper.js +5 -19
  6. package/dist/cjs/components/primitives/focus-lock.js +6 -33
  7. package/dist/cjs/components/primitives/hooks/use-prevent-programmatic-scroll.js +4 -12
  8. package/dist/cjs/components/primitives/icon-button.js +9 -11
  9. package/dist/cjs/components/primitives/index.js +24 -43
  10. package/dist/cjs/components/primitives/sidebar.js +1 -11
  11. package/dist/cjs/components/utils.js +4 -12
  12. package/dist/cjs/constants.js +0 -4
  13. package/dist/cjs/index.js +0 -2
  14. package/dist/cjs/version.json +1 -1
  15. package/dist/es2019/components/blanket.js +1 -4
  16. package/dist/es2019/components/index.js +3 -24
  17. package/dist/es2019/components/primitives/content.js +2 -4
  18. package/dist/es2019/components/primitives/drawer-wrapper.js +3 -3
  19. package/dist/es2019/components/primitives/focus-lock.js +2 -7
  20. package/dist/es2019/components/primitives/hooks/use-prevent-programmatic-scroll.js +2 -4
  21. package/dist/es2019/components/primitives/icon-button.js +7 -6
  22. package/dist/es2019/components/primitives/index.js +9 -7
  23. package/dist/es2019/components/primitives/sidebar.js +1 -4
  24. package/dist/es2019/components/utils.js +0 -5
  25. package/dist/es2019/version.json +1 -1
  26. package/dist/esm/components/blanket.js +3 -6
  27. package/dist/esm/components/index.js +21 -49
  28. package/dist/esm/components/primitives/content.js +3 -6
  29. package/dist/esm/components/primitives/drawer-wrapper.js +6 -11
  30. package/dist/esm/components/primitives/focus-lock.js +6 -22
  31. package/dist/esm/components/primitives/hooks/use-prevent-programmatic-scroll.js +5 -8
  32. package/dist/esm/components/primitives/icon-button.js +9 -8
  33. package/dist/esm/components/primitives/index.js +27 -31
  34. package/dist/esm/components/primitives/sidebar.js +2 -6
  35. package/dist/esm/components/utils.js +4 -10
  36. package/dist/esm/version.json +1 -1
  37. package/package.json +2 -2
@@ -18,29 +18,24 @@ overrides = Object.create(Object.prototype)) {
18
18
  if (!defaults) {
19
19
  throw new Error('a default set of overrides *must* be passed in as the first argument');
20
20
  }
21
-
22
21
  return function getOverrides(key) {
23
22
  const {
24
23
  cssFn: defaultCssFn,
25
24
  component: defaultComponent
26
25
  } = defaults[key];
27
-
28
26
  if (!overrides[key]) {
29
27
  return {
30
28
  cssFn: defaultCssFn,
31
29
  component: defaultComponent
32
30
  };
33
31
  }
34
-
35
32
  const {
36
33
  cssFn: customCssFn,
37
34
  component: customComponent
38
35
  } = overrides[key];
39
-
40
36
  const composedCssFn = state => {
41
37
  return customCssFn(defaultCssFn(state), state);
42
38
  };
43
-
44
39
  return {
45
40
  cssFn: customCssFn ? composedCssFn : defaultCssFn,
46
41
  component: customComponent || defaultComponent
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.4.7",
3
+ "version": "7.4.9",
4
4
  "sideEffects": false
5
5
  }
@@ -5,14 +5,13 @@ import AkBlanket from '@atlaskit/blanket';
5
5
  import Box from '@atlaskit/ds-explorations/box';
6
6
  import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
7
7
  import { animationTimingFunction, transitionDurationMs } from '../constants';
8
-
9
8
  /**
10
9
  * A wrapper around `@atlaskit/blanket` that adds a fade in/out transition.
11
10
  */
12
11
  var Blanket = function Blanket(_ref) {
13
12
  var isOpen = _ref.isOpen,
14
- onBlanketClicked = _ref.onBlanketClicked,
15
- testId = _ref.testId;
13
+ onBlanketClicked = _ref.onBlanketClicked,
14
+ testId = _ref.testId;
16
15
  return jsx(ExitingPersistence, {
17
16
  appear: true
18
17
  }, isOpen && jsx(FadeIn
@@ -21,8 +20,7 @@ var Blanket = function Blanket(_ref) {
21
20
  * `opacity: 1` at `50%`.
22
21
  *
23
22
  * The fade out animation uses half the passed duration so it evens out.
24
- */
25
- , {
23
+ */, {
26
24
  duration: transitionDurationMs * 2
27
25
  /**
28
26
  * We don't expose this on `FadeIn` but it does get passed down.
@@ -43,5 +41,4 @@ var Blanket = function Blanket(_ref) {
43
41
  }));
44
42
  }));
45
43
  };
46
-
47
44
  export default Blanket;
@@ -5,15 +5,10 @@ import _inherits from "@babel/runtime/helpers/inherits";
5
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
6
6
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
7
7
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
-
9
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
-
11
9
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
-
13
10
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
-
15
11
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
-
17
12
  /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
18
13
  import React, { Component } from 'react';
19
14
  import { canUseDOM } from 'exenv';
@@ -23,9 +18,8 @@ import { defaultFocusLockSettings } from '../constants';
23
18
  import Blanket from './blanket';
24
19
  import DrawerPrimitive from './primitives';
25
20
  var packageName = "@atlaskit/drawer";
26
- var packageVersion = "7.4.7";
21
+ var packageVersion = "7.4.9";
27
22
  var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
28
-
29
23
  var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
30
24
  return createAndFireEventOnAtlaskit({
31
25
  action: 'dismissed',
@@ -38,70 +32,52 @@ var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, t
38
32
  }
39
33
  })(createAnalyticsEvent);
40
34
  };
41
-
42
35
  export var DrawerBase = /*#__PURE__*/function (_Component) {
43
36
  _inherits(DrawerBase, _Component);
44
-
45
37
  var _super = _createSuper(DrawerBase);
46
-
47
38
  function DrawerBase() {
48
39
  var _this;
49
-
50
40
  _classCallCheck(this, DrawerBase);
51
-
52
41
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
53
42
  args[_key] = arguments[_key];
54
43
  }
55
-
56
44
  _this = _super.call.apply(_super, [this].concat(args));
57
-
58
45
  _defineProperty(_assertThisInitialized(_this), "state", {
59
46
  renderPortal: false
60
47
  });
61
-
62
48
  _defineProperty(_assertThisInitialized(_this), "body", canUseDOM ? document.querySelector('body') : undefined);
63
-
64
49
  _defineProperty(_assertThisInitialized(_this), "handleBlanketClick", function (event) {
65
50
  _this.handleClose(event, 'blanket');
66
51
  });
67
-
68
52
  _defineProperty(_assertThisInitialized(_this), "handleBackButtonClick", function (event) {
69
53
  _this.handleClose(event, 'backButton');
70
54
  });
71
-
72
55
  _defineProperty(_assertThisInitialized(_this), "handleClose", function (event, trigger) {
73
56
  var _this$props = _this.props,
74
- createAnalyticsEvent = _this$props.createAnalyticsEvent,
75
- onClose = _this$props.onClose;
57
+ createAnalyticsEvent = _this$props.createAnalyticsEvent,
58
+ onClose = _this$props.onClose;
76
59
  var analyticsEvent = createAnalyticsEvent && createAndFireOnClick(createAnalyticsEvent, trigger);
77
-
78
60
  if (onClose) {
79
61
  onClose(event, analyticsEvent);
80
62
  }
81
63
  });
82
-
83
64
  _defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (event) {
84
65
  var _this$props2 = _this.props,
85
- isOpen = _this$props2.isOpen,
86
- onKeyDown = _this$props2.onKeyDown;
87
-
66
+ isOpen = _this$props2.isOpen,
67
+ onKeyDown = _this$props2.onKeyDown;
88
68
  if (event.key === 'Escape' && isOpen) {
89
69
  _this.handleClose(event, 'escKey');
90
70
  }
91
-
92
71
  if (onKeyDown) {
93
72
  onKeyDown(event);
94
73
  }
95
74
  });
96
-
97
75
  return _this;
98
76
  }
99
-
100
77
  _createClass(DrawerBase, [{
101
78
  key: "componentDidMount",
102
79
  value: function componentDidMount() {
103
80
  var isOpen = this.props.isOpen;
104
-
105
81
  if (isOpen) {
106
82
  window.addEventListener('keydown', this.handleKeyDown);
107
83
  }
@@ -115,7 +91,6 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
115
91
  key: "componentDidUpdate",
116
92
  value: function componentDidUpdate(prevProps) {
117
93
  var isOpen = this.props.isOpen;
118
-
119
94
  if (isOpen !== prevProps.isOpen) {
120
95
  if (isOpen) {
121
96
  window.addEventListener('keydown', this.handleKeyDown);
@@ -130,22 +105,21 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
130
105
  if (!this.body) {
131
106
  return null;
132
107
  }
133
-
134
108
  var _this$props3 = this.props,
135
- testId = _this$props3.testId,
136
- isOpen = _this$props3.isOpen,
137
- children = _this$props3.children,
138
- icon = _this$props3.icon,
139
- width = _this$props3.width,
140
- shouldUnmountOnExit = _this$props3.shouldUnmountOnExit,
141
- onCloseComplete = _this$props3.onCloseComplete,
142
- onOpenComplete = _this$props3.onOpenComplete,
143
- autoFocusFirstElem = _this$props3.autoFocusFirstElem,
144
- isFocusLockEnabled = _this$props3.isFocusLockEnabled,
145
- shouldReturnFocus = _this$props3.shouldReturnFocus,
146
- overrides = _this$props3.overrides,
147
- _this$props3$zIndex = _this$props3.zIndex,
148
- zIndex = _this$props3$zIndex === void 0 ? 'unset' : _this$props3$zIndex;
109
+ testId = _this$props3.testId,
110
+ isOpen = _this$props3.isOpen,
111
+ children = _this$props3.children,
112
+ icon = _this$props3.icon,
113
+ width = _this$props3.width,
114
+ shouldUnmountOnExit = _this$props3.shouldUnmountOnExit,
115
+ onCloseComplete = _this$props3.onCloseComplete,
116
+ onOpenComplete = _this$props3.onOpenComplete,
117
+ autoFocusFirstElem = _this$props3.autoFocusFirstElem,
118
+ isFocusLockEnabled = _this$props3.isFocusLockEnabled,
119
+ shouldReturnFocus = _this$props3.shouldReturnFocus,
120
+ overrides = _this$props3.overrides,
121
+ _this$props3$zIndex = _this$props3.zIndex,
122
+ zIndex = _this$props3$zIndex === void 0 ? 'unset' : _this$props3$zIndex;
149
123
  return /*#__PURE__*/React.createElement(Portal, {
150
124
  zIndex: zIndex
151
125
  }, /*#__PURE__*/React.createElement(Blanket, {
@@ -160,7 +134,8 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
160
134
  onCloseComplete: onCloseComplete,
161
135
  onOpenComplete: onOpenComplete,
162
136
  width: width,
163
- shouldUnmountOnExit: shouldUnmountOnExit // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
137
+ shouldUnmountOnExit: shouldUnmountOnExit
138
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
164
139
  ,
165
140
  overrides: overrides,
166
141
  autoFocusFirstElem: autoFocusFirstElem,
@@ -169,14 +144,11 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
169
144
  }, children));
170
145
  }
171
146
  }]);
172
-
173
147
  return DrawerBase;
174
148
  }(Component);
175
-
176
149
  _defineProperty(DrawerBase, "defaultProps", _objectSpread({
177
150
  width: 'narrow'
178
151
  }, defaultFocusLockSettings));
179
-
180
152
  export default withAnalyticsContext({
181
153
  componentName: 'drawer',
182
154
  packageName: packageName,
@@ -1,8 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["cssFn"];
4
-
5
4
  /** @jsx jsx */
5
+
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { gridSize } from '@atlaskit/theme/constants';
8
8
  var defaultStyles = {
@@ -10,15 +10,12 @@ var defaultStyles = {
10
10
  overflow: 'auto',
11
11
  marginTop: 3 * gridSize()
12
12
  };
13
-
14
13
  var contentCSS = function contentCSS() {
15
14
  return defaultStyles;
16
15
  };
17
-
18
16
  var Content = function Content(_ref) {
19
17
  var cssFn = _ref.cssFn,
20
- props = _objectWithoutProperties(_ref, _excluded);
21
-
18
+ props = _objectWithoutProperties(_ref, _excluded);
22
19
  return (
23
20
  /**
24
21
  * I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
@@ -26,13 +23,13 @@ var Content = function Content(_ref) {
26
23
  * guide suggested as it made more sense as a transformer of the current styles rather than
27
24
  * a complete override with no chance of partially changing styles.
28
25
  */
26
+
29
27
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props, @repo/internal/react/use-primitives
30
28
  jsx("div", _extends({
31
29
  css: css(cssFn(defaultStyles))
32
30
  }, props))
33
31
  );
34
32
  };
35
-
36
33
  export default {
37
34
  component: Content,
38
35
  cssFn: contentCSS
@@ -1,10 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
-
3
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
-
5
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
-
7
4
  /** @jsx jsx */
5
+
8
6
  import { forwardRef, useCallback } from 'react';
9
7
  import { jsx } from '@emotion/react';
10
8
  import { useMergeRefs } from 'use-callback-ref';
@@ -33,18 +31,16 @@ var wrapperStyles = {
33
31
  left: 0,
34
32
  height: '100vh'
35
33
  };
36
-
37
34
  /**
38
35
  * A wrapper that controls the styling of the drawer with a few hacks with refs to get our Touch±Scroll locks working.
39
36
  */
40
37
  var DrawerWrapper = /*#__PURE__*/forwardRef(function (_ref, scrollRef) {
41
38
  var children = _ref.children,
42
- className = _ref.className,
43
- _ref$width = _ref.width,
44
- width = _ref$width === void 0 ? 'narrow' : _ref$width,
45
- testId = _ref.testId,
46
- drawerRef = _ref.drawerRef;
47
-
39
+ className = _ref.className,
40
+ _ref$width = _ref.width,
41
+ width = _ref$width === void 0 ? 'narrow' : _ref$width,
42
+ testId = _ref.testId,
43
+ drawerRef = _ref.drawerRef;
48
44
  /**
49
45
  * We use a callback ref to assign the `<Content />` component to the forwarded `scrollRef`.
50
46
  * This ref comes from `react-scrolllock` to allow touch scrolling, eg.: `<ScrollLock><TouchScrollable>{children}</TouchScrollable><ScrollLock>`
@@ -55,7 +51,6 @@ var DrawerWrapper = /*#__PURE__*/forwardRef(function (_ref, scrollRef) {
55
51
  */
56
52
  var assignSecondChildRef = useCallback(function (node) {
57
53
  var _node$children;
58
-
59
54
  if (node !== null && node !== void 0 && (_node$children = node.children) !== null && _node$children !== void 0 && _node$children.length && typeof scrollRef === 'function') {
60
55
  scrollRef(node.children[node.children.length - 1]);
61
56
  }
@@ -4,48 +4,35 @@ import _inherits from "@babel/runtime/helpers/inherits";
4
4
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
5
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
6
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
7
-
8
7
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
-
10
8
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11
-
12
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
-
14
10
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
-
16
11
  import React, { Component } from 'react';
17
12
  import ReactFocusLock from 'react-focus-lock';
18
13
  import ScrollLock from 'react-scrolllock';
19
14
  import invariant from 'tiny-invariant';
20
15
  import { defaultFocusLockSettings } from '../../constants';
21
-
22
16
  // Thin wrapper over react-focus-lock. This wrapper only exists to ensure API compatibility.
23
17
  // This component should be deleted during https://ecosystem.atlassian.net/browse/AK-5658
24
18
  var FocusLock = /*#__PURE__*/function (_Component) {
25
19
  _inherits(FocusLock, _Component);
26
-
27
20
  var _super = _createSuper(FocusLock);
28
-
29
21
  function FocusLock() {
30
22
  _classCallCheck(this, FocusLock);
31
-
32
23
  return _super.apply(this, arguments);
33
24
  }
34
-
35
25
  _createClass(FocusLock, [{
36
26
  key: "componentDidMount",
37
27
  value: function componentDidMount() {
38
28
  var _this$props = this.props,
39
- isFocusLockEnabled = _this$props.isFocusLockEnabled,
40
- autoFocusFirstElem = _this$props.autoFocusFirstElem;
41
-
29
+ isFocusLockEnabled = _this$props.isFocusLockEnabled,
30
+ autoFocusFirstElem = _this$props.autoFocusFirstElem;
42
31
  if (process.env.NODE_ENV !== 'production' && !process.env.CI) {
43
32
  invariant(typeof autoFocusFirstElem === 'boolean', '@atlaskit/drawer: Passing a function as autoFocus is deprecated. Instead call focus on the element ref or use the autofocus property.');
44
33
  }
45
-
46
34
  if (typeof autoFocusFirstElem === 'function' && isFocusLockEnabled) {
47
35
  var elem = autoFocusFirstElem();
48
-
49
36
  if (elem && elem.focus) {
50
37
  elem.focus();
51
38
  }
@@ -55,10 +42,10 @@ var FocusLock = /*#__PURE__*/function (_Component) {
55
42
  key: "render",
56
43
  value: function render() {
57
44
  var _this$props2 = this.props,
58
- isFocusLockEnabled = _this$props2.isFocusLockEnabled,
59
- autoFocusFirstElem = _this$props2.autoFocusFirstElem,
60
- shouldReturnFocus = _this$props2.shouldReturnFocus,
61
- children = _this$props2.children;
45
+ isFocusLockEnabled = _this$props2.isFocusLockEnabled,
46
+ autoFocusFirstElem = _this$props2.autoFocusFirstElem,
47
+ shouldReturnFocus = _this$props2.shouldReturnFocus,
48
+ children = _this$props2.children;
62
49
  return /*#__PURE__*/React.createElement(ReactFocusLock, {
63
50
  disabled: !isFocusLockEnabled,
64
51
  autoFocus: !!autoFocusFirstElem,
@@ -66,10 +53,7 @@ var FocusLock = /*#__PURE__*/function (_Component) {
66
53
  }, /*#__PURE__*/React.createElement(ScrollLock, null, children));
67
54
  }
68
55
  }]);
69
-
70
56
  return FocusLock;
71
57
  }(Component);
72
-
73
58
  _defineProperty(FocusLock, "defaultProps", _objectSpread({}, defaultFocusLockSettings));
74
-
75
59
  export { FocusLock as default };
@@ -1,6 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useCallback, useEffect, useLayoutEffect, useState } from 'react';
3
3
  import { bind } from 'bind-event-listener';
4
+
4
5
  /**
5
6
  * Returns how far the body is scrolled from the top of the viewport.
6
7
  *
@@ -13,12 +14,11 @@ import { bind } from 'bind-event-listener';
13
14
  *
14
15
  * Scroll distance is the height of overflow outside the viewport.
15
16
  */
16
-
17
17
  function getScrollDistance() {
18
18
  var _document$documentEle, _document$body;
19
-
20
19
  return window.pageYOffset || ((_document$documentEle = document.documentElement) === null || _document$documentEle === void 0 ? void 0 : _document$documentEle.scrollTop) || ((_document$body = document.body) === null || _document$body === void 0 ? void 0 : _document$body.scrollTop) || 0;
21
20
  }
21
+
22
22
  /**
23
23
  * Prevents programmatic scrolling of the viewport with `scrollIntoView`.
24
24
  * Should be used in conjunction with a scroll lock to prevent a user from scrolling.
@@ -27,14 +27,11 @@ function getScrollDistance() {
27
27
  *
28
28
  * @returns scroll top offset of the viewport
29
29
  */
30
-
31
-
32
30
  export default function usePreventProgrammaticScroll() {
33
31
  var _useState = useState(0),
34
- _useState2 = _slicedToArray(_useState, 2),
35
- scrollTopOffset = _useState2[0],
36
- setScrollTopOffset = _useState2[1];
37
-
32
+ _useState2 = _slicedToArray(_useState, 2),
33
+ scrollTopOffset = _useState2[0],
34
+ setScrollTopOffset = _useState2[1];
38
35
  useLayoutEffect(function () {
39
36
  setScrollTopOffset(getScrollDistance());
40
37
  }, []);
@@ -1,11 +1,12 @@
1
1
  /** @jsx jsx */
2
+
2
3
  import { css, jsx } from '@emotion/react';
3
4
  import { B50, N30A } from '@atlaskit/theme/colors';
4
5
  var iconButtonStyles = css({
5
- padding: "var(--ds-scale-100, 8px)",
6
+ padding: "var(--ds-space-100, 8px)",
6
7
  backgroundColor: 'inherit',
7
8
  border: 'none',
8
- borderRadius: "var(--ds-scale-1000, 80px)",
9
+ borderRadius: "var(--ds-space-1000, 80px)",
9
10
  color: 'inherit',
10
11
  cursor: 'pointer',
11
12
  lineHeight: "var(--ds-font-lineHeight-100, 1)",
@@ -16,12 +17,12 @@ var iconButtonStyles = css({
16
17
  backgroundColor: "var(--ds-background-neutral-subtle-pressed, ".concat(B50, ")")
17
18
  }
18
19
  });
19
-
20
20
  var IconButton = function IconButton(_ref) {
21
21
  var children = _ref.children,
22
- onClick = _ref.onClick,
23
- testId = _ref.testId;
24
- return (// eslint-disable-next-line @repo/internal/react/use-primitives
22
+ onClick = _ref.onClick,
23
+ testId = _ref.testId;
24
+ return (
25
+ // eslint-disable-next-line @repo/internal/react/use-primitives
25
26
  jsx("button", {
26
27
  type: "button",
27
28
  css: iconButtonStyles,
@@ -29,7 +30,7 @@ var IconButton = function IconButton(_ref) {
29
30
  "data-testid": testId
30
31
  }, children)
31
32
  );
32
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
33
-
33
+ };
34
34
 
35
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
35
36
  export default IconButton;
@@ -1,8 +1,8 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  var _excluded = ["component"],
3
- _excluded2 = ["component"];
4
-
3
+ _excluded2 = ["component"];
5
4
  /** @jsx jsx */
5
+
6
6
  import { useCallback, useRef } from 'react';
7
7
  import { jsx } from '@emotion/react';
8
8
  import ArrowLeft from '@atlaskit/icon/glyph/arrow-left';
@@ -13,30 +13,30 @@ import ContentOverrides from './content';
13
13
  import DrawerWrapper from './drawer-wrapper';
14
14
  import FocusLock from './focus-lock';
15
15
  import IconButton from './icon-button';
16
- import SidebarOverrides from './sidebar'; // Misc.
16
+ import SidebarOverrides from './sidebar';
17
+
18
+ // Misc.
17
19
  // ------------------------------
18
20
 
19
21
  var defaults = {
20
22
  Sidebar: SidebarOverrides,
21
23
  Content: ContentOverrides
22
24
  };
25
+
23
26
  /**
24
27
  * This wrapper is used to specify separate durations for enter and exit.
25
28
  */
26
-
27
29
  var CustomSlideIn = function CustomSlideIn(_ref) {
28
30
  var children = _ref.children,
29
- onFinish = _ref.onFinish;
30
-
31
+ onFinish = _ref.onFinish;
31
32
  var _useExitingPersistenc = useExitingPersistence(),
32
- isExiting = _useExitingPersistenc.isExiting;
33
+ isExiting = _useExitingPersistenc.isExiting;
34
+
33
35
  /**
34
36
  * The actual duration should be the same for both enter and exit,
35
37
  * but motion halves the passed duration for exit animations,
36
38
  * so we double it when exiting.
37
39
  */
38
-
39
-
40
40
  var duration = isExiting ? transitionDurationMs * 2 : transitionDurationMs;
41
41
  return jsx(SlideIn, {
42
42
  animationTimingFunction: animationTimingFunction,
@@ -47,34 +47,30 @@ var CustomSlideIn = function CustomSlideIn(_ref) {
47
47
  onFinish: onFinish
48
48
  }, children);
49
49
  };
50
-
51
50
  var DrawerPrimitive = function DrawerPrimitive(_ref2) {
52
51
  var children = _ref2.children,
53
- Icon = _ref2.icon,
54
- onClose = _ref2.onClose,
55
- onCloseComplete = _ref2.onCloseComplete,
56
- onOpenComplete = _ref2.onOpenComplete,
57
- overrides = _ref2.overrides,
58
- testId = _ref2.testId,
59
- isOpen = _ref2.in,
60
- shouldReturnFocus = _ref2.shouldReturnFocus,
61
- autoFocusFirstElem = _ref2.autoFocusFirstElem,
62
- isFocusLockEnabled = _ref2.isFocusLockEnabled,
63
- width = _ref2.width;
52
+ Icon = _ref2.icon,
53
+ onClose = _ref2.onClose,
54
+ onCloseComplete = _ref2.onCloseComplete,
55
+ onOpenComplete = _ref2.onOpenComplete,
56
+ overrides = _ref2.overrides,
57
+ testId = _ref2.testId,
58
+ isOpen = _ref2.in,
59
+ shouldReturnFocus = _ref2.shouldReturnFocus,
60
+ autoFocusFirstElem = _ref2.autoFocusFirstElem,
61
+ isFocusLockEnabled = _ref2.isFocusLockEnabled,
62
+ width = _ref2.width;
64
63
  var getOverrides = createExtender(defaults, overrides);
65
-
66
64
  var _getOverrides = getOverrides('Sidebar'),
67
- Sidebar = _getOverrides.component,
68
- sideBarOverrides = _objectWithoutProperties(_getOverrides, _excluded);
69
-
65
+ Sidebar = _getOverrides.component,
66
+ sideBarOverrides = _objectWithoutProperties(_getOverrides, _excluded);
70
67
  var _getOverrides2 = getOverrides('Content'),
71
- Content = _getOverrides2.component,
72
- contentOverrides = _objectWithoutProperties(_getOverrides2, _excluded2);
68
+ Content = _getOverrides2.component,
69
+ contentOverrides = _objectWithoutProperties(_getOverrides2, _excluded2);
70
+
73
71
  /**
74
72
  * A ref to point to our wrapper, passed to `onCloseComplete` and `onOpenComplete` callbacks.
75
73
  */
76
-
77
-
78
74
  var drawerRef = useRef(null);
79
75
  var onFinish = useCallback(function (state) {
80
76
  if (state === 'entering') {
@@ -107,7 +103,7 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
107
103
  label: "Close drawer"
108
104
  }))), jsx(Content, contentOverrides, children)));
109
105
  }));
110
- }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
111
-
106
+ };
112
107
 
108
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
113
109
  export default DrawerPrimitive;
@@ -1,8 +1,8 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
  var _excluded = ["cssFn"];
4
-
5
4
  /** @jsx jsx */
5
+
6
6
  import { css, jsx } from '@emotion/react';
7
7
  import { N500 } from '@atlaskit/theme/colors';
8
8
  import { gridSize } from '@atlaskit/theme/constants';
@@ -18,21 +18,17 @@ var defaultStyle = {
18
18
  paddingTop: 3 * gridSize(),
19
19
  width: 8 * gridSize()
20
20
  };
21
-
22
21
  var sidebarCSS = function sidebarCSS() {
23
22
  return defaultStyle;
24
23
  };
25
-
26
24
  var Sidebar = function Sidebar(_ref) {
27
25
  var cssFn = _ref.cssFn,
28
- props = _objectWithoutProperties(_ref, _excluded);
29
-
26
+ props = _objectWithoutProperties(_ref, _excluded);
30
27
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props, @repo/internal/react/use-primitives
31
28
  return jsx("div", _extends({
32
29
  css: css(cssFn(defaultStyle))
33
30
  }, props));
34
31
  };
35
-
36
32
  export default {
37
33
  component: Sidebar,
38
34
  cssFn: sidebarCSS
@@ -5,31 +5,25 @@
5
5
  */
6
6
  export var createExtender = function createExtender(defaults) {
7
7
  var overrides = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Object.create(Object.prototype);
8
-
9
8
  if (!defaults) {
10
9
  throw new Error('a default set of overrides *must* be passed in as the first argument');
11
10
  }
12
-
13
11
  return function getOverrides(key) {
14
12
  var _defaults$key = defaults[key],
15
- defaultCssFn = _defaults$key.cssFn,
16
- defaultComponent = _defaults$key.component;
17
-
13
+ defaultCssFn = _defaults$key.cssFn,
14
+ defaultComponent = _defaults$key.component;
18
15
  if (!overrides[key]) {
19
16
  return {
20
17
  cssFn: defaultCssFn,
21
18
  component: defaultComponent
22
19
  };
23
20
  }
24
-
25
21
  var _overrides$key = overrides[key],
26
- customCssFn = _overrides$key.cssFn,
27
- customComponent = _overrides$key.component;
28
-
22
+ customCssFn = _overrides$key.cssFn,
23
+ customComponent = _overrides$key.component;
29
24
  var composedCssFn = function composedCssFn(state) {
30
25
  return customCssFn(defaultCssFn(state), state);
31
26
  };
32
-
33
27
  return {
34
28
  cssFn: customCssFn ? composedCssFn : defaultCssFn,
35
29
  component: customComponent || defaultComponent