@atlaskit/drawer 7.1.12 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/constants/package.json +8 -1
  3. package/dist/cjs/components/blanket.js +4 -2
  4. package/dist/cjs/components/index.js +3 -2
  5. package/dist/cjs/components/primitives/content.js +3 -3
  6. package/dist/cjs/components/primitives/icon-button.js +3 -3
  7. package/dist/cjs/components/primitives/index.js +10 -10
  8. package/dist/cjs/components/primitives/sidebar.js +3 -3
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/components/blanket.js +4 -2
  11. package/dist/es2019/components/index.js +3 -2
  12. package/dist/es2019/components/primitives/content.js +2 -2
  13. package/dist/es2019/components/primitives/icon-button.js +1 -1
  14. package/dist/es2019/components/primitives/index.js +1 -1
  15. package/dist/es2019/components/primitives/sidebar.js +2 -2
  16. package/dist/es2019/version.json +1 -1
  17. package/dist/esm/components/blanket.js +4 -2
  18. package/dist/esm/components/index.js +3 -2
  19. package/dist/esm/components/primitives/content.js +2 -2
  20. package/dist/esm/components/primitives/icon-button.js +1 -1
  21. package/dist/esm/components/primitives/index.js +1 -1
  22. package/dist/esm/components/primitives/sidebar.js +2 -2
  23. package/dist/esm/version.json +1 -1
  24. package/dist/types/components/blanket.d.ts +2 -1
  25. package/dist/types/components/index.d.ts +2 -2
  26. package/dist/types/components/primitives/content.d.ts +2 -3
  27. package/dist/types/components/primitives/index.d.ts +2 -2
  28. package/dist/types/components/primitives/sidebar.d.ts +1 -1
  29. package/dist/types/components/types.d.ts +1 -1
  30. package/dist/types-ts4.0/components/blanket.d.ts +11 -0
  31. package/dist/types-ts4.0/components/focus-lock.d.ts +6 -0
  32. package/dist/types-ts4.0/components/index.d.ts +31 -0
  33. package/dist/types-ts4.0/components/primitives/content.d.ts +8 -0
  34. package/dist/types-ts4.0/components/primitives/icon-button.d.ts +8 -0
  35. package/dist/types-ts4.0/components/primitives/index.d.ts +5 -0
  36. package/dist/types-ts4.0/components/primitives/sidebar.d.ts +9 -0
  37. package/dist/types-ts4.0/components/types.d.ts +128 -0
  38. package/dist/types-ts4.0/components/utils.d.ts +7 -0
  39. package/dist/types-ts4.0/constants.d.ts +6 -0
  40. package/dist/types-ts4.0/index.d.ts +2 -0
  41. package/package.json +15 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/drawer
2
2
 
3
+ ## 7.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
9
+ ## 7.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`cc4fe7bdf0c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cc4fe7bdf0c) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
14
+
15
+ ### Patch Changes
16
+
17
+ - [`11da403db81`](https://bitbucket.org/atlassian/atlassian-frontend/commits/11da403db81) - Internal change to add optional `testId` prop pass-through to blanket component. There should be no change in behaviour.
18
+ - Updated dependencies
19
+
3
20
  ## 7.1.12
4
21
 
5
22
  ### Patch Changes
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/constants.js",
5
5
  "module:es2019": "../dist/es2019/constants.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/constants.d.ts"
7
+ "types": "../dist/types/constants.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/constants.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -20,7 +20,8 @@ var _constants = require("../constants");
20
20
  */
21
21
  var Blanket = function Blanket(_ref) {
22
22
  var isOpen = _ref.isOpen,
23
- onBlanketClicked = _ref.onBlanketClicked;
23
+ onBlanketClicked = _ref.onBlanketClicked,
24
+ testId = _ref.testId;
24
25
  return /*#__PURE__*/_react.default.createElement(_motion.ExitingPersistence, {
25
26
  appear: true
26
27
  }, isOpen && /*#__PURE__*/_react.default.createElement(_motion.FadeIn
@@ -45,7 +46,8 @@ var Blanket = function Blanket(_ref) {
45
46
  className: className
46
47
  }, /*#__PURE__*/_react.default.createElement(_blanket.default, {
47
48
  isTinted: true,
48
- onBlanketClicked: onBlanketClicked
49
+ onBlanketClicked: onBlanketClicked,
50
+ testId: testId
49
51
  }));
50
52
  }));
51
53
  };
@@ -46,7 +46,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
46
46
  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; } }
47
47
 
48
48
  var packageName = "@atlaskit/drawer";
49
- var packageVersion = "7.1.12";
49
+ var packageVersion = "7.2.1";
50
50
  var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
51
51
 
52
52
  var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
@@ -164,7 +164,8 @@ var DrawerBase = /*#__PURE__*/function (_Component) {
164
164
  zIndex: "unset"
165
165
  }, /*#__PURE__*/_react.default.createElement(_blanket.default, {
166
166
  isOpen: isOpen,
167
- onBlanketClicked: this.handleBlanketClick
167
+ onBlanketClicked: this.handleBlanketClick,
168
+ testId: testId && "".concat(testId, "--blanket")
168
169
  }), /*#__PURE__*/_react.default.createElement(_focusLock.default, {
169
170
  autoFocusFirstElem: autoFocusFirstElem,
170
171
  isFocusLockEnabled: isFocusLockEnabled,
@@ -11,7 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
13
 
14
- var _core = require("@emotion/core");
14
+ var _react = require("@emotion/react");
15
15
 
16
16
  var _constants = require("@atlaskit/theme/constants");
17
17
 
@@ -37,8 +37,8 @@ var Content = function Content(_ref) {
37
37
  * a complete override with no chance of partially changing styles.
38
38
  */
39
39
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
40
- (0, _core.jsx)("div", (0, _extends2.default)({
41
- css: cssFn(defaultStyles)
40
+ (0, _react.jsx)("div", (0, _extends2.default)({
41
+ css: (0, _react.css)(cssFn(defaultStyles))
42
42
  }, props))
43
43
  );
44
44
  };
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
- var _core = require("@emotion/core");
8
+ var _react = require("@emotion/react");
9
9
 
10
10
  var _colors = require("@atlaskit/theme/colors");
11
11
 
@@ -13,7 +13,7 @@ var _constants = require("@atlaskit/theme/constants");
13
13
 
14
14
  /** @jsx jsx */
15
15
  var gridSize = (0, _constants.gridSize)();
16
- var iconButtonStyles = (0, _core.css)({
16
+ var iconButtonStyles = (0, _react.css)({
17
17
  display: 'flex',
18
18
  width: 5 * gridSize,
19
19
  height: 5 * gridSize,
@@ -41,7 +41,7 @@ var IconButton = function IconButton(_ref) {
41
41
  var children = _ref.children,
42
42
  onClick = _ref.onClick,
43
43
  testId = _ref.testId;
44
- return (0, _core.jsx)("button", {
44
+ return (0, _react.jsx)("button", {
45
45
  type: "button",
46
46
  css: iconButtonStyles,
47
47
  onClick: onClick,
@@ -11,7 +11,7 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
 
12
12
  var _react = require("react");
13
13
 
14
- var _core = require("@emotion/core");
14
+ var _react2 = require("@emotion/react");
15
15
 
16
16
  var _arrowLeft = _interopRequireDefault(require("@atlaskit/icon/glyph/arrow-left"));
17
17
 
@@ -43,7 +43,7 @@ var widths = {
43
43
  medium: 60 * (0, _constants.gridSize)(),
44
44
  wide: 75 * (0, _constants.gridSize)()
45
45
  };
46
- var wrapperStyles = (0, _core.css)({
46
+ var wrapperStyles = (0, _react2.css)({
47
47
  display: 'flex',
48
48
  height: '100vh',
49
49
  position: 'fixed',
@@ -75,7 +75,7 @@ var CustomSlideIn = function CustomSlideIn(_ref) {
75
75
 
76
76
 
77
77
  var duration = isExiting ? _constants2.transitionDurationMs * 2 : _constants2.transitionDurationMs;
78
- return (0, _core.jsx)(_motion.SlideIn, {
78
+ return (0, _react2.jsx)(_motion.SlideIn, {
79
79
  animationTimingFunction: _constants2.animationTimingFunction,
80
80
  duration: duration,
81
81
  enterFrom: "left",
@@ -113,15 +113,15 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
113
113
  onCloseComplete === null || onCloseComplete === void 0 ? void 0 : onCloseComplete(ref.current);
114
114
  }
115
115
  }, [onCloseComplete, onOpenComplete]);
116
- return (0, _core.jsx)(_motion.ExitingPersistence, {
116
+ return (0, _react2.jsx)(_motion.ExitingPersistence, {
117
117
  appear: true
118
- }, isOpen && (0, _core.jsx)(CustomSlideIn, {
118
+ }, isOpen && (0, _react2.jsx)(CustomSlideIn, {
119
119
  onFinish: onFinish
120
120
  }, function (_ref3) {
121
121
  var _props$width;
122
122
 
123
123
  var className = _ref3.className;
124
- return (0, _core.jsx)("div", {
124
+ return (0, _react2.jsx)("div", {
125
125
  className: className,
126
126
  css: wrapperStyles,
127
127
  style: {
@@ -129,14 +129,14 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
129
129
  },
130
130
  "data-testid": testId,
131
131
  ref: ref
132
- }, (0, _core.jsx)(Sidebar, sideBarOverrides, (0, _core.jsx)(_iconButton.default, {
132
+ }, (0, _react2.jsx)(Sidebar, sideBarOverrides, (0, _react2.jsx)(_iconButton.default, {
133
133
  onClick: onClose,
134
134
  testId: testId && 'DrawerPrimitiveSidebarCloseButton'
135
- }, Icon ? (0, _core.jsx)(Icon, {
135
+ }, Icon ? (0, _react2.jsx)(Icon, {
136
136
  size: "large"
137
- }) : (0, _core.jsx)(_arrowLeft.default, {
137
+ }) : (0, _react2.jsx)(_arrowLeft.default, {
138
138
  label: "Close drawer"
139
- }))), (0, _core.jsx)(Content, contentOverrides, children));
139
+ }))), (0, _react2.jsx)(Content, contentOverrides, children));
140
140
  }));
141
141
  }; // eslint-disable-next-line @repo/internal/react/require-jsdoc
142
142
 
@@ -11,7 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
11
11
 
12
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
13
 
14
- var _core = require("@emotion/core");
14
+ var _react = require("@emotion/react");
15
15
 
16
16
  var _colors = require("@atlaskit/theme/colors");
17
17
 
@@ -39,8 +39,8 @@ var Sidebar = function Sidebar(_ref) {
39
39
  var cssFn = _ref.cssFn,
40
40
  props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
41
41
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
42
- return (0, _core.jsx)("div", (0, _extends2.default)({
43
- css: cssFn(defaultStyle)
42
+ return (0, _react.jsx)("div", (0, _extends2.default)({
43
+ css: (0, _react.css)(cssFn(defaultStyle))
44
44
  }, props));
45
45
  };
46
46
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.1.12",
3
+ "version": "7.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -8,7 +8,8 @@ import { animationTimingFunction, transitionDurationMs } from '../constants';
8
8
  */
9
9
  const Blanket = ({
10
10
  isOpen,
11
- onBlanketClicked
11
+ onBlanketClicked,
12
+ testId
12
13
  }) => {
13
14
  return /*#__PURE__*/React.createElement(ExitingPersistence, {
14
15
  appear: true
@@ -34,7 +35,8 @@ const Blanket = ({
34
35
  className: className
35
36
  }, /*#__PURE__*/React.createElement(AkBlanket, {
36
37
  isTinted: true,
37
- onBlanketClicked: onBlanketClicked
38
+ onBlanketClicked: onBlanketClicked,
39
+ testId: testId
38
40
  }))));
39
41
  };
40
42
 
@@ -9,7 +9,7 @@ import Blanket from './blanket';
9
9
  import FocusLock from './focus-lock';
10
10
  import DrawerPrimitive from './primitives';
11
11
  const packageName = "@atlaskit/drawer";
12
- const packageVersion = "7.1.12";
12
+ const packageVersion = "7.2.1";
13
13
  const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
14
14
 
15
15
  const createAndFireOnClick = (createAnalyticsEvent, trigger) => createAndFireEventOnAtlaskit({
@@ -120,7 +120,8 @@ export class DrawerBase extends Component {
120
120
  zIndex: "unset"
121
121
  }, /*#__PURE__*/React.createElement(Blanket, {
122
122
  isOpen: isOpen,
123
- onBlanketClicked: this.handleBlanketClick
123
+ onBlanketClicked: this.handleBlanketClick,
124
+ testId: testId && `${testId}--blanket`
124
125
  }), /*#__PURE__*/React.createElement(FocusLock, {
125
126
  autoFocusFirstElem: autoFocusFirstElem,
126
127
  isFocusLockEnabled: isFocusLockEnabled,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
4
+ import { css, jsx } from '@emotion/react';
5
5
  import { gridSize } from '@atlaskit/theme/constants';
6
6
  const defaultStyles = {
7
7
  flex: 1,
@@ -23,7 +23,7 @@ const Content = ({
23
23
  */
24
24
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
25
25
  jsx("div", _extends({
26
- css: cssFn(defaultStyles)
26
+ css: css(cssFn(defaultStyles))
27
27
  }, props));
28
28
 
29
29
  export default {
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/react';
3
3
  import { B50, N30A } from '@atlaskit/theme/colors';
4
4
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
5
5
  const gridSize = getGridSize();
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { useCallback, useRef } from 'react';
3
- import { css, jsx } from '@emotion/core';
3
+ import { css, jsx } from '@emotion/react';
4
4
  import ArrowLeft from '@atlaskit/icon/glyph/arrow-left';
5
5
  import { ExitingPersistence, SlideIn, useExitingPersistence } from '@atlaskit/motion';
6
6
  import { N0 } from '@atlaskit/theme/colors';
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
 
3
3
  /** @jsx jsx */
4
- import { jsx } from '@emotion/core';
4
+ import { css, jsx } from '@emotion/react';
5
5
  import { N500 } from '@atlaskit/theme/colors';
6
6
  import { gridSize } from '@atlaskit/theme/constants';
7
7
  const defaultStyle = {
@@ -25,7 +25,7 @@ const Sidebar = ({
25
25
  }) => {
26
26
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
27
27
  return jsx("div", _extends({
28
- css: cssFn(defaultStyle)
28
+ css: css(cssFn(defaultStyle))
29
29
  }, props));
30
30
  };
31
31
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.1.12",
3
+ "version": "7.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -8,7 +8,8 @@ import { animationTimingFunction, transitionDurationMs } from '../constants';
8
8
  */
9
9
  var Blanket = function Blanket(_ref) {
10
10
  var isOpen = _ref.isOpen,
11
- onBlanketClicked = _ref.onBlanketClicked;
11
+ onBlanketClicked = _ref.onBlanketClicked,
12
+ testId = _ref.testId;
12
13
  return /*#__PURE__*/React.createElement(ExitingPersistence, {
13
14
  appear: true
14
15
  }, isOpen && /*#__PURE__*/React.createElement(FadeIn
@@ -33,7 +34,8 @@ var Blanket = function Blanket(_ref) {
33
34
  className: className
34
35
  }, /*#__PURE__*/React.createElement(AkBlanket, {
35
36
  isTinted: true,
36
- onBlanketClicked: onBlanketClicked
37
+ onBlanketClicked: onBlanketClicked,
38
+ testId: testId
37
39
  }));
38
40
  }));
39
41
  };
@@ -19,7 +19,7 @@ import Blanket from './blanket';
19
19
  import FocusLock from './focus-lock';
20
20
  import DrawerPrimitive from './primitives';
21
21
  var packageName = "@atlaskit/drawer";
22
- var packageVersion = "7.1.12";
22
+ var packageVersion = "7.2.1";
23
23
  var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
24
24
 
25
25
  var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
@@ -144,7 +144,8 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
144
144
  zIndex: "unset"
145
145
  }, /*#__PURE__*/React.createElement(Blanket, {
146
146
  isOpen: isOpen,
147
- onBlanketClicked: this.handleBlanketClick
147
+ onBlanketClicked: this.handleBlanketClick,
148
+ testId: testId && "".concat(testId, "--blanket")
148
149
  }), /*#__PURE__*/React.createElement(FocusLock, {
149
150
  autoFocusFirstElem: autoFocusFirstElem,
150
151
  isFocusLockEnabled: isFocusLockEnabled,
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["cssFn"];
4
4
 
5
5
  /** @jsx jsx */
6
- import { jsx } from '@emotion/core';
6
+ import { css, jsx } from '@emotion/react';
7
7
  import { gridSize } from '@atlaskit/theme/constants';
8
8
  var defaultStyles = {
9
9
  flex: 1,
@@ -28,7 +28,7 @@ var Content = function Content(_ref) {
28
28
  */
29
29
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
30
30
  jsx("div", _extends({
31
- css: cssFn(defaultStyles)
31
+ css: css(cssFn(defaultStyles))
32
32
  }, props))
33
33
  );
34
34
  };
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { css, jsx } from '@emotion/core';
2
+ import { css, jsx } from '@emotion/react';
3
3
  import { B50, N30A } from '@atlaskit/theme/colors';
4
4
  import { gridSize as getGridSize } from '@atlaskit/theme/constants';
5
5
  var gridSize = getGridSize();
@@ -5,7 +5,7 @@ var _excluded = ["children", "icon", "onClose", "onCloseComplete", "onOpenComple
5
5
 
6
6
  /** @jsx jsx */
7
7
  import { useCallback, useRef } from 'react';
8
- import { css, jsx } from '@emotion/core';
8
+ import { css, jsx } from '@emotion/react';
9
9
  import ArrowLeft from '@atlaskit/icon/glyph/arrow-left';
10
10
  import { ExitingPersistence, SlideIn, useExitingPersistence } from '@atlaskit/motion';
11
11
  import { N0 } from '@atlaskit/theme/colors';
@@ -3,7 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProper
3
3
  var _excluded = ["cssFn"];
4
4
 
5
5
  /** @jsx jsx */
6
- import { jsx } from '@emotion/core';
6
+ import { css, jsx } from '@emotion/react';
7
7
  import { N500 } from '@atlaskit/theme/colors';
8
8
  import { gridSize } from '@atlaskit/theme/constants';
9
9
  var defaultStyle = {
@@ -29,7 +29,7 @@ var Sidebar = function Sidebar(_ref) {
29
29
 
30
30
  // eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
31
31
  return jsx("div", _extends({
32
- css: cssFn(defaultStyle)
32
+ css: css(cssFn(defaultStyle))
33
33
  }, props));
34
34
  };
35
35
 
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.1.12",
3
+ "version": "7.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -2,9 +2,10 @@ import React from 'react';
2
2
  declare type BlanketProps = {
3
3
  isOpen: boolean;
4
4
  onBlanketClicked: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
5
+ testId?: string;
5
6
  };
6
7
  /**
7
8
  * A wrapper around `@atlaskit/blanket` that adds a fade in/out transition.
8
9
  */
9
- declare const Blanket: ({ isOpen, onBlanketClicked }: BlanketProps) => JSX.Element;
10
+ declare const Blanket: ({ isOpen, onBlanketClicked, testId }: BlanketProps) => JSX.Element;
10
11
  export default Blanket;
@@ -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" | "isOpen" | "testId" | "icon" | "onClose" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus">> & Partial<Pick<{
25
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "children" | "onKeyDown" | "onClose" | "isOpen" | "testId" | "icon" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus">> & Partial<Pick<{
26
26
  width: DrawerWidth;
27
27
  isFocusLockEnabled: boolean;
28
28
  shouldReturnFocus: boolean;
29
29
  autoFocusFirstElem: boolean;
30
- }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "width" | "children" | "onKeyDown" | "key" | "isOpen" | "analyticsContext" | "testId" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "icon" | "onClose" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & React.RefAttributes<any>>;
30
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "width" | "children" | "onKeyDown" | "key" | "onClose" | "isOpen" | "testId" | "analyticsContext" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "icon" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & React.RefAttributes<any>>;
31
31
  export default _default;
@@ -1,9 +1,8 @@
1
1
  /** @jsx jsx */
2
- /// <reference types="react" />
3
- import { CSSObject } from '@emotion/core';
2
+ import { CSSObject, jsx } from '@emotion/react';
4
3
  import { ContentProps } from '../types';
5
4
  declare const _default: {
6
- component: ({ cssFn, ...props }: ContentProps) => JSX.Element;
5
+ component: ({ cssFn, ...props }: ContentProps) => jsx.JSX.Element;
7
6
  cssFn: () => CSSObject;
8
7
  };
9
8
  export default _default;
@@ -1,5 +1,5 @@
1
1
  /** @jsx jsx */
2
- /// <reference types="react" />
2
+ import { jsx } from '@emotion/react';
3
3
  import { DrawerPrimitiveProps } from '../types';
4
- declare const DrawerPrimitive: ({ children, icon: Icon, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, ...props }: DrawerPrimitiveProps) => JSX.Element;
4
+ declare const DrawerPrimitive: ({ children, icon: Icon, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, ...props }: DrawerPrimitiveProps) => jsx.JSX.Element;
5
5
  export default DrawerPrimitive;
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import { FC } from 'react';
3
- import { CSSObject } from '@emotion/core';
3
+ import { CSSObject } from '@emotion/react';
4
4
  import { SidebarProps } from '../types';
5
5
  declare const _default: {
6
6
  component: FC<SidebarProps>;
@@ -1,5 +1,5 @@
1
1
  import { ComponentType, ReactNode, SyntheticEvent } from 'react';
2
- import { CSSObject } from '@emotion/core';
2
+ import { CSSObject } from '@emotion/react';
3
3
  import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
4
  export declare type Widths = {
5
5
  extended: string;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ declare type BlanketProps = {
3
+ isOpen: boolean;
4
+ onBlanketClicked: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
5
+ testId?: string;
6
+ };
7
+ /**
8
+ * A wrapper around `@atlaskit/blanket` that adds a fade in/out transition.
9
+ */
10
+ declare const Blanket: ({ isOpen, onBlanketClicked, testId }: BlanketProps) => JSX.Element;
11
+ export default Blanket;
@@ -0,0 +1,6 @@
1
+ import { Component } from 'react';
2
+ import { FocusLockProps } from './types';
3
+ export default class FocusLock extends Component<FocusLockProps> {
4
+ componentDidMount(): void;
5
+ render(): JSX.Element;
6
+ }
@@ -0,0 +1,31 @@
1
+ import React, { Component } from 'react';
2
+ import { DrawerProps, DrawerWidth } from './types';
3
+ export declare class DrawerBase extends Component<DrawerProps, {
4
+ renderPortal: boolean;
5
+ }> {
6
+ static defaultProps: {
7
+ width: DrawerWidth;
8
+ isFocusLockEnabled: boolean;
9
+ shouldReturnFocus: boolean;
10
+ autoFocusFirstElem: boolean;
11
+ };
12
+ state: {
13
+ renderPortal: boolean;
14
+ };
15
+ body: HTMLBodyElement | null | undefined;
16
+ componentDidMount(): void;
17
+ componentWillUnmount(): void;
18
+ componentDidUpdate(prevProps: DrawerProps): void;
19
+ private handleBlanketClick;
20
+ private handleBackButtonClick;
21
+ private handleClose;
22
+ handleKeyDown: (event: KeyboardEvent) => void;
23
+ render(): JSX.Element | null;
24
+ }
25
+ declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "children" | "onKeyDown" | "onClose" | "isOpen" | "testId" | "icon" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus">> & Partial<Pick<{
26
+ width: DrawerWidth;
27
+ isFocusLockEnabled: boolean;
28
+ shouldReturnFocus: boolean;
29
+ autoFocusFirstElem: boolean;
30
+ }, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "width" | "children" | "onKeyDown" | "key" | "onClose" | "isOpen" | "testId" | "analyticsContext" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "icon" | "onCloseComplete" | "onOpenComplete" | "overrides" | "shouldUnmountOnExit"> & React.RefAttributes<any>>;
31
+ export default _default;
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { CSSObject, jsx } from '@emotion/react';
3
+ import { ContentProps } from '../types';
4
+ declare const _default: {
5
+ component: ({ cssFn, ...props }: ContentProps) => jsx.JSX.Element;
6
+ cssFn: () => CSSObject;
7
+ };
8
+ export default _default;
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { FC, MouseEventHandler } from 'react';
3
+ interface IconButtonProps {
4
+ testId?: string;
5
+ onClick?: MouseEventHandler<HTMLButtonElement>;
6
+ }
7
+ declare const IconButton: FC<IconButtonProps>;
8
+ export default IconButton;
@@ -0,0 +1,5 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { DrawerPrimitiveProps } from '../types';
4
+ declare const DrawerPrimitive: ({ children, icon: Icon, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, ...props }: DrawerPrimitiveProps) => jsx.JSX.Element;
5
+ export default DrawerPrimitive;
@@ -0,0 +1,9 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ import { CSSObject } from '@emotion/react';
4
+ import { SidebarProps } from '../types';
5
+ declare const _default: {
6
+ component: FC<SidebarProps>;
7
+ cssFn: () => CSSObject;
8
+ };
9
+ export default _default;
@@ -0,0 +1,128 @@
1
+ import { ComponentType, ReactNode, SyntheticEvent } from 'react';
2
+ import { CSSObject } from '@emotion/react';
3
+ import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
4
+ export declare type Widths = {
5
+ extended: string;
6
+ full: string;
7
+ medium: number;
8
+ narrow: number;
9
+ wide: number;
10
+ };
11
+ export declare type DrawerWidth = 'extended' | 'full' | 'medium' | 'narrow' | 'wide';
12
+ export interface BaseProps {
13
+ /**
14
+ * A unique hook to be used for testing.
15
+ */
16
+ testId?: string;
17
+ /**
18
+ * The content of the drawer.
19
+ */
20
+ children?: ReactNode;
21
+ /**
22
+ * Icon to be rendered in your drawer as a component, if available.
23
+ */
24
+ icon?: ComponentType<any>;
25
+ /**
26
+ * Available drawer sizes.
27
+ */
28
+ width?: DrawerWidth;
29
+ /**
30
+ * A callback function that will be called when the drawer has finished its opening transition.
31
+ */
32
+ onOpenComplete?: (node: HTMLElement | null) => void;
33
+ /**
34
+ * A callback function that will be called when the drawer has finished its close transition.
35
+ */
36
+ onCloseComplete?: (node: HTMLElement | null) => void;
37
+ /**
38
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release.
39
+ * Boolean that controls if drawer should be retained/discarded
40
+ */
41
+ shouldUnmountOnExit?: boolean;
42
+ /**
43
+ * Override drawer components.
44
+ */
45
+ overrides?: OverridesType;
46
+ }
47
+ export declare type DefaultsType = {
48
+ Sidebar: {
49
+ component: React.ComponentType<SidebarProps>;
50
+ cssFn: (defaultStyles: CSSObject) => CSSObject;
51
+ };
52
+ Content: {
53
+ component: React.ComponentType<ContentProps>;
54
+ cssFn: (defaultStyles: CSSObject) => CSSObject;
55
+ };
56
+ };
57
+ export declare type OverridesType = {
58
+ Sidebar?: {
59
+ component?: React.ComponentType<SidebarProps>;
60
+ /**
61
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
62
+ */
63
+ cssFn?: (defaultStyles: CSSObject) => CSSObject;
64
+ };
65
+ Content?: {
66
+ component?: React.ComponentType<ContentProps>;
67
+ /**
68
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
69
+ */
70
+ cssFn?: (defaultStyles: CSSObject) => CSSObject;
71
+ };
72
+ };
73
+ export declare type DrawerPrimitiveDefaults = Pick<DefaultsType, 'Sidebar' | 'Content'>;
74
+ export declare type DrawerPrimitiveOverrides = Pick<OverridesType, 'Sidebar' | 'Content'>;
75
+ export interface SidebarProps extends React.HTMLProps<HTMLDivElement> {
76
+ /**
77
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
78
+ */
79
+ cssFn: (defaultStyles: CSSObject) => CSSObject;
80
+ }
81
+ export declare type SidebarCSSProps = Omit<SidebarProps, 'cssFn'>;
82
+ export interface ContentProps extends React.HTMLProps<HTMLDivElement> {
83
+ /**
84
+ * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
85
+ */
86
+ cssFn: (defaultStyles: CSSObject) => CSSObject;
87
+ }
88
+ export declare type ContentCSSProps = Omit<ContentProps, 'cssFn'>;
89
+ export interface DrawerPrimitiveProps extends BaseProps {
90
+ in: boolean;
91
+ onClose: (event: SyntheticEvent<HTMLElement>) => void;
92
+ }
93
+ export declare type DrawerProps = BaseProps & FocusLockProps & WithAnalyticsEventsProps & {
94
+ /**
95
+ * Callback function called while the drawer is displayed and `keydown` event is triggered.
96
+ */
97
+ onKeyDown?: (event: SyntheticEvent) => void;
98
+ /**
99
+ * Callback function called when the drawer is closed.
100
+ */
101
+ onClose?: (event: SyntheticEvent<HTMLElement>, analyticsEvent: any) => void;
102
+ /**
103
+ * Controls if the drawer is open or closed.
104
+ */
105
+ isOpen: boolean;
106
+ };
107
+ export interface FocusLockProps {
108
+ /**
109
+ * Controls whether to focus the first tabbable element inside the focus lock.
110
+ */
111
+ autoFocusFirstElem?: boolean | (() => HTMLElement | null);
112
+ /**
113
+ * Content inside the focus lock.
114
+ */
115
+ children?: ReactNode;
116
+ /**
117
+ * Whether the focus lock is active or not.
118
+ */
119
+ isFocusLockEnabled?: boolean;
120
+ /**
121
+ * Whether to return the focus to the previous active element on closing the drawer.
122
+ */
123
+ shouldReturnFocus?: boolean;
124
+ }
125
+ /**
126
+ * Type of keyboard event that triggers which key will should close the drawer.
127
+ */
128
+ export declare type CloseTrigger = 'backButton' | 'blanket' | 'escKey';
@@ -0,0 +1,7 @@
1
+ declare type OverridesFunc<X extends Record<string, any>, Y extends Record<string, any>> = (key: string) => Record<string, any>;
2
+ export declare type ExtenderType = <D extends Record<string, any>, O extends Record<string, any>>(d: D, o?: O) => OverridesFunc<D, O>;
3
+ /**
4
+ * @deprecated Please avoid using this function as we intend to remote it in a future release. See DSP-2673 for more information.
5
+ */
6
+ export declare const createExtender: ExtenderType;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { DrawerWidth } from './components/types';
2
+ export declare const transitionDuration = "0.22s";
3
+ export declare const transitionDurationMs = 220;
4
+ export declare const transitionTimingFunction: import("@atlaskit/motion/curves").AnimationCurve;
5
+ export declare const widths: DrawerWidth[];
6
+ export declare const animationTimingFunction: () => import("@atlaskit/motion/curves").AnimationCurve;
@@ -0,0 +1,2 @@
1
+ export { default } from './components';
2
+ export type { BaseProps, CloseTrigger, ContentCSSProps, ContentProps, DefaultsType, DrawerPrimitiveDefaults, DrawerPrimitiveOverrides, DrawerPrimitiveProps, DrawerProps, DrawerWidth, FocusLockProps, OverridesType, SidebarCSSProps, SidebarProps, Widths, } from './components/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.1.12",
3
+ "version": "7.2.1",
4
4
  "description": "A drawer is a panel that slides in from the left side of the screen.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.tsx",
17
24
  "homepage": "https://atlassian.design/components/drawer",
@@ -30,10 +37,10 @@
30
37
  "@atlaskit/icon": "^21.10.0",
31
38
  "@atlaskit/motion": "^1.2.0",
32
39
  "@atlaskit/portal": "^4.0.0",
33
- "@atlaskit/theme": "^12.1.0",
40
+ "@atlaskit/theme": "^12.2.0",
34
41
  "@atlaskit/tokens": "^0.10.0",
35
42
  "@babel/runtime": "^7.0.0",
36
- "@emotion/core": "^10.0.9",
43
+ "@emotion/react": "^11.7.1",
37
44
  "exenv": "^1.2.2",
38
45
  "react-focus-lock": "^2.5.2",
39
46
  "tiny-invariant": "^1.2.0"
@@ -46,22 +53,22 @@
46
53
  "@atlaskit/checkbox": "^12.3.9",
47
54
  "@atlaskit/code": "^14.3.3",
48
55
  "@atlaskit/docs": "*",
49
- "@atlaskit/dropdown-menu": "^11.3.0",
56
+ "@atlaskit/dropdown-menu": "^11.5.0",
50
57
  "@atlaskit/ds-lib": "^2.1.0",
51
58
  "@atlaskit/menu": "^1.3.0",
52
- "@atlaskit/section-message": "^6.0.0",
59
+ "@atlaskit/section-message": "^6.2.0",
53
60
  "@atlaskit/ssr": "*",
54
61
  "@atlaskit/textarea": "^4.3.1",
55
62
  "@atlaskit/visual-regression": "*",
56
63
  "@atlaskit/webdriver-runner": "*",
57
64
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
58
- "@testing-library/dom": "^7.7.3",
59
- "@testing-library/react": "^8.0.1",
65
+ "@testing-library/dom": "^8.17.1",
66
+ "@testing-library/react": "^12.1.5",
60
67
  "enzyme": "^3.10.0",
61
68
  "lodash": "^4.17.21",
62
69
  "react-dom": "^16.8.0",
63
70
  "react-lorem-component": "^0.13.0",
64
- "typescript": "4.3.5",
71
+ "typescript": "4.5.5",
65
72
  "wait-for-expect": "^1.2.0"
66
73
  },
67
74
  "techstack": {