@atlaskit/drawer 7.1.7 → 7.1.10

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.
@@ -1,4 +1,6 @@
1
+ import { easeOut } from '@atlaskit/motion/curves';
1
2
  export const transitionDuration = '0.22s';
2
3
  export const transitionDurationMs = 220;
3
- export const transitionTimingFunction = 'cubic-bezier(0.2, 0, 0, 1)';
4
- export const widths = ['narrow', 'medium', 'wide', 'extended', 'full'];
4
+ export const transitionTimingFunction = easeOut;
5
+ export const widths = ['narrow', 'medium', 'wide', 'extended', 'full'];
6
+ export const animationTimingFunction = () => easeOut;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.1.7",
3
+ "version": "7.1.10",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import AkBlanket from '@atlaskit/blanket';
3
+ import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
4
+ import { animationTimingFunction, transitionDurationMs } from '../constants';
5
+
6
+ /**
7
+ * A wrapper around `@atlaskit/blanket` that adds a fade in/out transition.
8
+ */
9
+ var Blanket = function Blanket(_ref) {
10
+ var isOpen = _ref.isOpen,
11
+ onBlanketClicked = _ref.onBlanketClicked;
12
+ return /*#__PURE__*/React.createElement(ExitingPersistence, {
13
+ appear: true
14
+ }, isOpen && /*#__PURE__*/React.createElement(FadeIn
15
+ /**
16
+ * We double the duration because the fade in keyframes have
17
+ * `opacity: 1` at `50%`.
18
+ *
19
+ * The fade out animation uses half the passed duration so it evens out.
20
+ */
21
+ , {
22
+ duration: transitionDurationMs * 2
23
+ /**
24
+ * We don't expose this on `FadeIn` but it does get passed down.
25
+ * TODO: figure out how we want to handle this...
26
+ */
27
+ // @ts-ignore
28
+ ,
29
+ animationTimingFunction: animationTimingFunction
30
+ }, function (_ref2) {
31
+ var className = _ref2.className;
32
+ return /*#__PURE__*/React.createElement("div", {
33
+ className: className
34
+ }, /*#__PURE__*/React.createElement(AkBlanket, {
35
+ isTinted: true,
36
+ onBlanketClicked: onBlanketClicked
37
+ }));
38
+ }));
39
+ };
40
+
41
+ export default Blanket;
@@ -10,24 +10,15 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
10
10
 
11
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; } }
12
12
 
13
- import React, { Children, Component, Fragment } from 'react';
13
+ import React, { Component } from 'react';
14
14
  import { canUseDOM } from 'exenv';
15
- import { Transition, TransitionGroup } from 'react-transition-group';
16
15
  import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
17
- import Blanket from '@atlaskit/blanket';
18
16
  import Portal from '@atlaskit/portal';
19
- import { transitionDurationMs } from '../constants';
17
+ import Blanket from './blanket';
20
18
  import FocusLock from './focus-lock';
21
19
  import DrawerPrimitive from './primitives';
22
- import { Fade } from './transitions';
23
20
  var packageName = "@atlaskit/drawer";
24
- var packageVersion = "7.1.7";
25
-
26
- var OnlyChild = function OnlyChild(_ref) {
27
- var children = _ref.children;
28
- return Children.toArray(children)[0] || null;
29
- };
30
-
21
+ var packageVersion = "7.1.10";
31
22
  var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
32
23
 
33
24
  var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
@@ -148,24 +139,12 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
148
139
  isFocusLockEnabled = _this$props3.isFocusLockEnabled,
149
140
  shouldReturnFocus = _this$props3.shouldReturnFocus,
150
141
  overrides = _this$props3.overrides;
151
- return /*#__PURE__*/React.createElement(Transition, {
152
- in: isOpen,
153
- timeout: {
154
- enter: 0,
155
- exit: transitionDurationMs
156
- },
157
- mountOnEnter: true,
158
- unmountOnExit: true
159
- }, /*#__PURE__*/React.createElement(Portal, {
142
+ return /*#__PURE__*/React.createElement(Portal, {
160
143
  zIndex: "unset"
161
- }, /*#__PURE__*/React.createElement(TransitionGroup, {
162
- component: OnlyChild
163
- }, /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Fade, {
164
- in: isOpen
165
144
  }, /*#__PURE__*/React.createElement(Blanket, {
166
- isTinted: true,
145
+ isOpen: isOpen,
167
146
  onBlanketClicked: this.handleBlanketClick
168
- })), /*#__PURE__*/React.createElement(FocusLock, {
147
+ }), /*#__PURE__*/React.createElement(FocusLock, {
169
148
  autoFocusFirstElem: autoFocusFirstElem,
170
149
  isFocusLockEnabled: isFocusLockEnabled,
171
150
  shouldReturnFocus: shouldReturnFocus
@@ -179,7 +158,7 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
179
158
  width: width,
180
159
  shouldUnmountOnExit: shouldUnmountOnExit,
181
160
  overrides: overrides
182
- }, children))))));
161
+ }, children)));
183
162
  }
184
163
  }]);
185
164
 
@@ -1,31 +1,16 @@
1
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/createClass";
3
- import _inherits from "@babel/runtime/helpers/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
- import _extends from "@babel/runtime/helpers/extends";
7
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
8
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
9
- var _excluded = ["width", "shouldUnmountOnExit", "style"],
10
- _excluded2 = ["children", "icon", "onClose", "onCloseComplete", "onOpenComplete", "overrides", "testId"],
11
- _excluded3 = ["component"],
12
- _excluded4 = ["component"];
13
-
14
- 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); }; }
15
-
16
- 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; } }
17
-
18
- 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; }
19
-
20
- 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; }
2
+ var _excluded = ["children", "icon", "onClose", "onCloseComplete", "onOpenComplete", "overrides", "testId", "in"],
3
+ _excluded2 = ["component"],
4
+ _excluded3 = ["component"];
21
5
 
22
6
  /** @jsx jsx */
23
- import { Component } from 'react';
7
+ import { useCallback, useRef } from 'react';
24
8
  import { css, jsx } from '@emotion/core';
25
9
  import ArrowLeft from '@atlaskit/icon/glyph/arrow-left';
10
+ import { ExitingPersistence, SlideIn, useExitingPersistence } from '@atlaskit/motion';
26
11
  import { N0 } from '@atlaskit/theme/colors';
27
12
  import { gridSize, layers } from '@atlaskit/theme/constants';
28
- import { Slide } from '../transitions';
13
+ import { animationTimingFunction, transitionDurationMs } from '../../constants';
29
14
  import { createExtender } from '../utils';
30
15
  import ContentOverrides from './content';
31
16
  import IconButton from './icon-button';
@@ -49,78 +34,92 @@ var wrapperStyles = css({
49
34
  backgroundColor: "var(--ds-surface-overlay, ".concat(N0, ")"),
50
35
  overflow: 'hidden'
51
36
  });
52
-
53
- var Wrapper = function Wrapper(_ref) {
54
- var _ref$width = _ref.width,
55
- width = _ref$width === void 0 ? 'narrow' : _ref$width,
56
- shouldUnmountOnExit = _ref.shouldUnmountOnExit,
57
- style = _ref.style,
58
- props = _objectWithoutProperties(_ref, _excluded);
59
-
60
- return jsx("div", _extends({
61
- style: _objectSpread(_objectSpread({}, style), {}, {
62
- width: widths[width]
63
- }),
64
- css: wrapperStyles
65
- }, props));
66
- };
67
-
68
37
  var defaults = {
69
38
  Sidebar: SidebarOverrides,
70
39
  Content: ContentOverrides
71
40
  };
41
+ /**
42
+ * This wrapper is used to specify separate durations for enter and exit.
43
+ */
44
+
45
+ var CustomSlideIn = function CustomSlideIn(_ref) {
46
+ var children = _ref.children,
47
+ onFinish = _ref.onFinish;
48
+
49
+ var _useExitingPersistenc = useExitingPersistence(),
50
+ isExiting = _useExitingPersistenc.isExiting;
51
+ /**
52
+ * The actual duration should be the same for both enter and exit,
53
+ * but motion halves the passed duration for exit animations,
54
+ * so we double it when exiting.
55
+ */
56
+
57
+
58
+ var duration = isExiting ? transitionDurationMs * 2 : transitionDurationMs;
59
+ return jsx(SlideIn, {
60
+ animationTimingFunction: animationTimingFunction,
61
+ duration: duration,
62
+ enterFrom: "left",
63
+ exitTo: "left",
64
+ fade: "none",
65
+ onFinish: onFinish
66
+ }, children);
67
+ };
72
68
 
73
- var DrawerPrimitive = /*#__PURE__*/function (_Component) {
74
- _inherits(DrawerPrimitive, _Component);
75
-
76
- var _super = _createSuper(DrawerPrimitive);
77
-
78
- function DrawerPrimitive() {
79
- _classCallCheck(this, DrawerPrimitive);
80
-
81
- return _super.apply(this, arguments);
82
- }
83
-
84
- _createClass(DrawerPrimitive, [{
85
- key: "render",
86
- value: function render() {
87
- var _this$props = this.props,
88
- children = _this$props.children,
89
- Icon = _this$props.icon,
90
- onClose = _this$props.onClose,
91
- onCloseComplete = _this$props.onCloseComplete,
92
- onOpenComplete = _this$props.onOpenComplete,
93
- overrides = _this$props.overrides,
94
- testId = _this$props.testId,
95
- props = _objectWithoutProperties(_this$props, _excluded2);
96
-
97
- var getOverrides = createExtender(defaults, overrides);
98
-
99
- var _getOverrides = getOverrides('Sidebar'),
100
- Sidebar = _getOverrides.component,
101
- sideBarOverrides = _objectWithoutProperties(_getOverrides, _excluded3);
102
-
103
- var _getOverrides2 = getOverrides('Content'),
104
- Content = _getOverrides2.component,
105
- contentOverrides = _objectWithoutProperties(_getOverrides2, _excluded4);
106
-
107
- return jsx(Slide, _extends({
108
- component: Wrapper,
109
- onExited: onCloseComplete,
110
- onEntered: onOpenComplete,
111
- "data-testid": testId
112
- }, props), jsx(Sidebar, sideBarOverrides, jsx(IconButton, {
113
- onClick: onClose,
114
- testId: testId && 'DrawerPrimitiveSidebarCloseButton'
115
- }, Icon ? jsx(Icon, {
116
- size: "large"
117
- }) : jsx(ArrowLeft, {
118
- label: "Close drawer"
119
- }))), jsx(Content, contentOverrides, children));
69
+ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
70
+ var children = _ref2.children,
71
+ Icon = _ref2.icon,
72
+ onClose = _ref2.onClose,
73
+ onCloseComplete = _ref2.onCloseComplete,
74
+ onOpenComplete = _ref2.onOpenComplete,
75
+ overrides = _ref2.overrides,
76
+ testId = _ref2.testId,
77
+ isOpen = _ref2.in,
78
+ props = _objectWithoutProperties(_ref2, _excluded);
79
+
80
+ var getOverrides = createExtender(defaults, overrides);
81
+
82
+ var _getOverrides = getOverrides('Sidebar'),
83
+ Sidebar = _getOverrides.component,
84
+ sideBarOverrides = _objectWithoutProperties(_getOverrides, _excluded2);
85
+
86
+ var _getOverrides2 = getOverrides('Content'),
87
+ Content = _getOverrides2.component,
88
+ contentOverrides = _objectWithoutProperties(_getOverrides2, _excluded3);
89
+
90
+ var ref = useRef(null);
91
+ var onFinish = useCallback(function (state) {
92
+ if (state === 'entering') {
93
+ onOpenComplete === null || onOpenComplete === void 0 ? void 0 : onOpenComplete(ref.current);
94
+ } else if (state === 'exiting') {
95
+ onCloseComplete === null || onCloseComplete === void 0 ? void 0 : onCloseComplete(ref.current);
120
96
  }
121
- }]);
122
-
123
- return DrawerPrimitive;
124
- }(Component);
97
+ }, [onCloseComplete, onOpenComplete]);
98
+ return jsx(ExitingPersistence, {
99
+ appear: true
100
+ }, isOpen && jsx(CustomSlideIn, {
101
+ onFinish: onFinish
102
+ }, function (_ref3) {
103
+ var _props$width;
104
+
105
+ var className = _ref3.className;
106
+ return jsx("div", {
107
+ className: className,
108
+ css: wrapperStyles,
109
+ style: {
110
+ width: widths[(_props$width = props.width) !== null && _props$width !== void 0 ? _props$width : 'narrow']
111
+ },
112
+ "data-testid": testId,
113
+ ref: ref
114
+ }, jsx(Sidebar, sideBarOverrides, jsx(IconButton, {
115
+ onClick: onClose,
116
+ testId: testId && 'DrawerPrimitiveSidebarCloseButton'
117
+ }, Icon ? jsx(Icon, {
118
+ size: "large"
119
+ }) : jsx(ArrowLeft, {
120
+ label: "Close drawer"
121
+ }))), jsx(Content, contentOverrides, children));
122
+ }));
123
+ };
125
124
 
126
- export { DrawerPrimitive as default };
125
+ export default DrawerPrimitive;
@@ -1,4 +1,8 @@
1
+ import { easeOut } from '@atlaskit/motion/curves';
1
2
  export var transitionDuration = '0.22s';
2
3
  export var transitionDurationMs = 220;
3
- export var transitionTimingFunction = 'cubic-bezier(0.2, 0, 0, 1)';
4
- export var widths = ['narrow', 'medium', 'wide', 'extended', 'full'];
4
+ export var transitionTimingFunction = easeOut;
5
+ export var widths = ['narrow', 'medium', 'wide', 'extended', 'full'];
6
+ export var animationTimingFunction = function animationTimingFunction() {
7
+ return easeOut;
8
+ };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.1.7",
3
+ "version": "7.1.10",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare type BlanketProps = {
3
+ isOpen: boolean;
4
+ onBlanketClicked: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
5
+ };
6
+ /**
7
+ * A wrapper around `@atlaskit/blanket` that adds a fade in/out transition.
8
+ */
9
+ declare const Blanket: ({ isOpen, onBlanketClicked }: BlanketProps) => JSX.Element;
10
+ 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<Pick<DrawerProps, "width" | "children" | "onKeyDown" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "shouldUnmountOnExit" | "testId" | "onClose" | "icon" | "onOpenComplete" | "onCloseComplete" | "overrides" | "isOpen">, "children" | "onKeyDown" | "shouldUnmountOnExit" | "testId" | "onClose" | "icon" | "onOpenComplete" | "onCloseComplete" | "overrides" | "isOpen"> & Partial<Pick<Pick<DrawerProps, "width" | "children" | "onKeyDown" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "shouldUnmountOnExit" | "testId" | "onClose" | "icon" | "onOpenComplete" | "onCloseComplete" | "overrides" | "isOpen">, "width" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus">> & Partial<Pick<{
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<{
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" | "isFocusLockEnabled" | "autoFocusFirstElem" | "shouldReturnFocus" | "shouldUnmountOnExit" | "testId" | "onClose" | "icon" | "onOpenComplete" | "onCloseComplete" | "overrides" | "isOpen" | "analyticsContext"> & React.RefAttributes<any>>;
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>>;
31
31
  export default _default;
@@ -1,6 +1,5 @@
1
1
  /** @jsx jsx */
2
- import { Component } from 'react';
2
+ /// <reference types="react" />
3
3
  import { DrawerPrimitiveProps } from '../types';
4
- export default class DrawerPrimitive extends Component<DrawerPrimitiveProps> {
5
- render(): JSX.Element;
6
- }
4
+ declare const DrawerPrimitive: ({ children, icon: Icon, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, ...props }: DrawerPrimitiveProps) => JSX.Element;
5
+ export default DrawerPrimitive;
@@ -18,11 +18,14 @@ export interface BaseProps {
18
18
  icon?: ComponentType<any>;
19
19
  /** Available drawer sizes. */
20
20
  width?: DrawerWidth;
21
- /** Callback function called when the drawer has finished its opening transition. */
22
- onOpenComplete?: (node: HTMLElement) => void;
23
- /** Callback function called when the drawer has finished its close transition. */
24
- onCloseComplete?: (node: HTMLElement) => void;
25
- /** Controls if drawer state should be retained/discarded on close. */
21
+ /** A callback function that will be called when the drawer has finished its opening transition. */
22
+ onOpenComplete?: (node: HTMLElement | null) => void;
23
+ /** A callback function that will be called when the drawer has finished its close transition. */
24
+ onCloseComplete?: (node: HTMLElement | null) => void;
25
+ /**
26
+ * * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release.
27
+ * Boolean that controls if drawer should be retained/discarded
28
+ * */
26
29
  shouldUnmountOnExit?: boolean;
27
30
  /** Override drawer components. */
28
31
  overrides?: OverridesType;
@@ -1,5 +1,6 @@
1
1
  import type { DrawerWidth } from './components/types';
2
2
  export declare const transitionDuration = "0.22s";
3
3
  export declare const transitionDurationMs = 220;
4
- export declare const transitionTimingFunction = "cubic-bezier(0.2, 0, 0, 1)";
4
+ export declare const transitionTimingFunction: import("@atlaskit/motion/curves").AnimationCurve;
5
5
  export declare const widths: DrawerWidth[];
6
+ export declare const animationTimingFunction: () => import("@atlaskit/motion/curves").AnimationCurve;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "7.1.7",
3
+ "version": "7.1.10",
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/"
@@ -27,21 +27,21 @@
27
27
  "@atlaskit/analytics-next": "^8.2.0",
28
28
  "@atlaskit/blanket": "^12.1.0",
29
29
  "@atlaskit/icon": "^21.10.0",
30
+ "@atlaskit/motion": "^1.0.3",
30
31
  "@atlaskit/portal": "^4.0.0",
31
32
  "@atlaskit/theme": "^12.1.0",
32
- "@atlaskit/tokens": "^0.9.0",
33
+ "@atlaskit/tokens": "^0.10.0",
33
34
  "@babel/runtime": "^7.0.0",
34
35
  "@emotion/core": "^10.0.9",
35
36
  "exenv": "^1.2.2",
36
37
  "react-focus-lock": "^2.5.2",
37
- "react-transition-group": "^4.4.1",
38
38
  "tiny-invariant": "^1.2.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^16.8.0"
42
42
  },
43
43
  "devDependencies": {
44
- "@atlaskit/button": "^16.2.0",
44
+ "@atlaskit/button": "^16.3.0",
45
45
  "@atlaskit/checkbox": "^12.3.9",
46
46
  "@atlaskit/code": "^14.3.3",
47
47
  "@atlaskit/docs": "*",
@@ -53,11 +53,13 @@
53
53
  "@atlaskit/visual-regression": "*",
54
54
  "@atlaskit/webdriver-runner": "*",
55
55
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
56
+ "@testing-library/dom": "^7.7.3",
57
+ "@testing-library/react": "^8.0.1",
56
58
  "enzyme": "^3.10.0",
57
59
  "lodash": "^4.17.21",
58
60
  "react-dom": "^16.8.0",
59
61
  "react-lorem-component": "^0.13.0",
60
- "typescript": "3.9.10",
62
+ "typescript": "4.2.4",
61
63
  "wait-for-expect": "^1.2.0"
62
64
  },
63
65
  "techstack": {
@@ -1,185 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports.Slide = exports.Fade = void 0;
11
-
12
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
-
14
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
15
-
16
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
-
18
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
-
20
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
21
-
22
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
23
-
24
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
25
-
26
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
27
-
28
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
29
-
30
- var _react = _interopRequireWildcard(require("react"));
31
-
32
- var _reactTransitionGroup = require("react-transition-group");
33
-
34
- var _constants = require("@atlaskit/theme/constants");
35
-
36
- var _constants2 = require("../constants");
37
-
38
- var _excluded = ["component", "in", "onExited", "onEntered", "defaultStyles", "transitionStyles", "transitionProps"],
39
- _excluded2 = ["shouldUnmountOnExit"];
40
-
41
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
42
-
43
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
44
-
45
- 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; }
46
-
47
- 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) { (0, _defineProperty2.default)(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; }
48
-
49
- 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); }; }
50
-
51
- 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; } }
52
-
53
- var defaultTransitionProps = {
54
- appear: true,
55
- mountOnEnter: true,
56
- unmountOnExit: true
57
- };
58
-
59
- var TransitionHandler = /*#__PURE__*/function (_Component) {
60
- (0, _inherits2.default)(TransitionHandler, _Component);
61
-
62
- var _super = _createSuper(TransitionHandler);
63
-
64
- function TransitionHandler() {
65
- var _this;
66
-
67
- (0, _classCallCheck2.default)(this, TransitionHandler);
68
-
69
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
70
- args[_key] = arguments[_key];
71
- }
72
-
73
- _this = _super.call.apply(_super, [this].concat(args));
74
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onEntered", function (node, isAppearing) {
75
- var onEntered = _this.props.onEntered;
76
-
77
- if (onEntered) {
78
- // Delay onEntered callback to fix DS-6969
79
- // Can remove this hack with DS-7078
80
- _this.enterTimeout = setTimeout(function () {
81
- return onEntered(node, isAppearing);
82
- }, _constants2.transitionDurationMs);
83
- }
84
- });
85
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearEnterTimeout", function () {
86
- if (_this.enterTimeout) {
87
- clearTimeout(_this.enterTimeout);
88
- }
89
- });
90
- return _this;
91
- }
92
-
93
- (0, _createClass2.default)(TransitionHandler, [{
94
- key: "componentWillUnmount",
95
- value: function componentWillUnmount() {
96
- this.clearEnterTimeout();
97
- }
98
- }, {
99
- key: "render",
100
- value: function render() {
101
- var _this$props = this.props,
102
- _this$props$component = _this$props.component,
103
- component = _this$props$component === void 0 ? 'div' : _this$props$component,
104
- inProp = _this$props.in,
105
- onExited = _this$props.onExited,
106
- onEntered = _this$props.onEntered,
107
- defaultStyles = _this$props.defaultStyles,
108
- transitionStyles = _this$props.transitionStyles,
109
- transitionProps = _this$props.transitionProps,
110
- props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
111
- var timeout = {
112
- enter: 0,
113
- exit: _constants2.transitionDurationMs
114
- };
115
- return /*#__PURE__*/_react.default.createElement(_reactTransitionGroup.Transition, (0, _extends2.default)({
116
- in: inProp,
117
- onExited: onExited,
118
- onExiting: this.clearEnterTimeout,
119
- onEntered: this.onEntered,
120
- timeout: timeout
121
- }, transitionProps), function (state) {
122
- var style = _objectSpread(_objectSpread({}, defaultStyles), transitionStyles[state]);
123
-
124
- var Tag = component;
125
- return /*#__PURE__*/_react.default.createElement(Tag, (0, _extends2.default)({
126
- style: style
127
- }, props));
128
- });
129
- }
130
- }]);
131
- return TransitionHandler;
132
- }(_react.Component);
133
-
134
- (0, _defineProperty2.default)(TransitionHandler, "defaultProps", {
135
- component: 'div',
136
- transitionProps: defaultTransitionProps
137
- });
138
-
139
- var Fade = function Fade(_ref) {
140
- var props = (0, _extends2.default)({}, _ref);
141
- return /*#__PURE__*/_react.default.createElement(TransitionHandler, (0, _extends2.default)({
142
- defaultStyles: {
143
- transition: "opacity ".concat(_constants2.transitionDurationMs, "ms ").concat(_constants2.transitionTimingFunction),
144
- opacity: 0,
145
- position: 'fixed',
146
- zIndex: _constants.layers.blanket()
147
- },
148
- transitionStyles: {
149
- entering: {
150
- opacity: 0
151
- },
152
- entered: {
153
- opacity: 1
154
- }
155
- }
156
- }, props));
157
- };
158
-
159
- exports.Fade = Fade;
160
-
161
- var Slide = function Slide(_ref2) {
162
- var _ref2$shouldUnmountOn = _ref2.shouldUnmountOnExit,
163
- shouldUnmountOnExit = _ref2$shouldUnmountOn === void 0 ? true : _ref2$shouldUnmountOn,
164
- props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
165
- return /*#__PURE__*/_react.default.createElement(TransitionHandler, (0, _extends2.default)({
166
- defaultStyles: {
167
- transition: "transform ".concat(_constants2.transitionDurationMs, "ms ").concat(_constants2.transitionTimingFunction, ", ") + "width ".concat(_constants2.transitionDurationMs, "ms ").concat(_constants2.transitionTimingFunction),
168
- transform: 'translate3d(-100%,0,0)'
169
- },
170
- transitionStyles: {
171
- // Unset transform so we do not create a new stacking context for fixed-position children - NAV-159
172
- entered: {
173
- transform: null
174
- },
175
- exited: {
176
- transform: 'translate3d(-100%,0,0)'
177
- }
178
- },
179
- transitionProps: _objectSpread(_objectSpread({}, defaultTransitionProps), {}, {
180
- unmountOnExit: shouldUnmountOnExit
181
- })
182
- }, props));
183
- };
184
-
185
- exports.Slide = Slide;