@atlaskit/drawer 7.14.1 → 7.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/components/index.js +99 -139
- package/dist/cjs/components/primitives/focus-lock.js +43 -72
- package/dist/es2019/components/index.js +93 -118
- package/dist/es2019/components/primitives/focus-lock.js +37 -52
- package/dist/esm/components/index.js +97 -140
- package/dist/esm/components/primitives/focus-lock.js +44 -74
- package/dist/types/components/index.d.ts +18 -30
- package/dist/types/components/primitives/focus-lock.d.ts +9 -12
- package/dist/types/components/types.d.ts +1 -1
- package/dist/types-ts4.5/components/index.d.ts +18 -30
- package/dist/types-ts4.5/components/primitives/focus-lock.d.ts +9 -12
- package/dist/types-ts4.5/components/types.d.ts +1 -1
- package/package.json +5 -9
|
@@ -1,81 +1,51 @@
|
|
|
1
|
-
import
|
|
2
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
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); }; }
|
|
11
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
12
|
-
import React, { Component } from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
13
2
|
import ReactFocusLock from 'react-focus-lock';
|
|
14
3
|
import ScrollLock from 'react-scrolllock';
|
|
15
4
|
import invariant from 'tiny-invariant';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
5
|
+
/**
|
|
6
|
+
* __Focus lock__
|
|
7
|
+
*
|
|
8
|
+
* Thin wrapper over react-focus-lock. This wrapper only exists to ensure API compatibility.
|
|
9
|
+
* This component should be deleted during https://ecosystem.atlassian.net/browse/AK-5658
|
|
10
|
+
*/
|
|
11
|
+
var FocusLock = function FocusLock(_ref) {
|
|
12
|
+
var _ref$isFocusLockEnabl = _ref.isFocusLockEnabled,
|
|
13
|
+
isFocusLockEnabled = _ref$isFocusLockEnabl === void 0 ? true : _ref$isFocusLockEnabl,
|
|
14
|
+
_ref$autoFocusFirstEl = _ref.autoFocusFirstElem,
|
|
15
|
+
autoFocusFirstElem = _ref$autoFocusFirstEl === void 0 ? true : _ref$autoFocusFirstEl,
|
|
16
|
+
_ref$shouldReturnFocu = _ref.shouldReturnFocus,
|
|
17
|
+
shouldReturnFocus = _ref$shouldReturnFocu === void 0 ? true : _ref$shouldReturnFocu,
|
|
18
|
+
children = _ref.children;
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !process.env.CI) {
|
|
21
|
+
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.');
|
|
27
22
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return shouldReturnFocus;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
});
|
|
36
|
-
_defineProperty(_assertThisInitialized(_this), "onDeactivation", function () {
|
|
37
|
-
var shouldReturnFocus = _this.props.shouldReturnFocus;
|
|
38
|
-
if (typeof shouldReturnFocus !== 'boolean') {
|
|
39
|
-
window.setTimeout(function () {
|
|
40
|
-
var _shouldReturnFocus$cu;
|
|
41
|
-
shouldReturnFocus === null || shouldReturnFocus === void 0 || (_shouldReturnFocus$cu = shouldReturnFocus.current) === null || _shouldReturnFocus$cu === void 0 || _shouldReturnFocus$cu.focus();
|
|
42
|
-
}, 0);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return _this;
|
|
46
|
-
}
|
|
47
|
-
_createClass(FocusLock, [{
|
|
48
|
-
key: "componentDidMount",
|
|
49
|
-
value: function componentDidMount() {
|
|
50
|
-
var _this$props = this.props,
|
|
51
|
-
isFocusLockEnabled = _this$props.isFocusLockEnabled,
|
|
52
|
-
autoFocusFirstElem = _this$props.autoFocusFirstElem;
|
|
53
|
-
if (typeof process !== 'undefined' && process.env.NODE_ENV !== 'production' && !process.env.CI) {
|
|
54
|
-
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.');
|
|
55
|
-
}
|
|
56
|
-
if (typeof autoFocusFirstElem === 'function' && isFocusLockEnabled) {
|
|
57
|
-
var elem = autoFocusFirstElem();
|
|
58
|
-
if (elem && elem.focus) {
|
|
59
|
-
elem.focus();
|
|
60
|
-
}
|
|
23
|
+
if (typeof autoFocusFirstElem === 'function' && isFocusLockEnabled) {
|
|
24
|
+
var elem = autoFocusFirstElem();
|
|
25
|
+
if (elem && elem.focus) {
|
|
26
|
+
elem.focus();
|
|
61
27
|
}
|
|
62
28
|
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
29
|
+
}, [autoFocusFirstElem, isFocusLockEnabled]);
|
|
30
|
+
var getFocusTarget = function getFocusTarget() {
|
|
31
|
+
if (typeof shouldReturnFocus === 'boolean') {
|
|
32
|
+
return shouldReturnFocus;
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
};
|
|
36
|
+
var onDeactivation = function onDeactivation() {
|
|
37
|
+
if (typeof shouldReturnFocus !== 'boolean') {
|
|
38
|
+
window.setTimeout(function () {
|
|
39
|
+
var _shouldReturnFocus$cu;
|
|
40
|
+
shouldReturnFocus === null || shouldReturnFocus === void 0 || (_shouldReturnFocus$cu = shouldReturnFocus.current) === null || _shouldReturnFocus$cu === void 0 || _shouldReturnFocus$cu.focus();
|
|
41
|
+
}, 0);
|
|
76
42
|
}
|
|
77
|
-
}
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
43
|
+
};
|
|
44
|
+
return /*#__PURE__*/React.createElement(ReactFocusLock, {
|
|
45
|
+
disabled: !isFocusLockEnabled,
|
|
46
|
+
autoFocus: !!autoFocusFirstElem,
|
|
47
|
+
returnFocus: getFocusTarget(),
|
|
48
|
+
onDeactivation: onDeactivation
|
|
49
|
+
}, /*#__PURE__*/React.createElement(ScrollLock, null, children));
|
|
50
|
+
};
|
|
51
|
+
export default FocusLock;
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { type DrawerProps
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DrawerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* __Drawer base__
|
|
5
|
+
*
|
|
6
|
+
* A drawer is a panel that slides in from the left side of the screen.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/drawer/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/drawer/code)
|
|
10
|
+
* - [Usage](https://atlassian.design/components/drawer/usage)
|
|
11
|
+
*/
|
|
12
|
+
export declare const DrawerBase: ({ width, isOpen, isFocusLockEnabled, shouldReturnFocus, autoFocusFirstElem, onKeyDown, createAnalyticsEvent, onClose, testId, children, icon, closeLabel, scrollContentLabel, shouldUnmountOnExit, onCloseComplete, onOpenComplete, overrides, zIndex, label, titleId, enterFrom, }: DrawerProps) => JSX.Element | null;
|
|
25
13
|
/**
|
|
26
14
|
* __Drawer__
|
|
27
15
|
*
|
|
@@ -31,10 +19,10 @@ export declare class DrawerBase extends Component<DrawerProps, {
|
|
|
31
19
|
* - [Code](https://atlassian.design/components/drawer/code)
|
|
32
20
|
* - [Usage](https://atlassian.design/components/drawer/usage)
|
|
33
21
|
*/
|
|
34
|
-
declare const Drawer: React.ForwardRefExoticComponent<Pick<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
22
|
+
declare const Drawer: React.ForwardRefExoticComponent<Pick<Omit<import("./types").BaseProps & import("./types").FocusLockSettings & import("@atlaskit/analytics-next").WithAnalyticsEventsProps & import("./types").DrawerLabel & {
|
|
23
|
+
onKeyDown?: ((event: React.SyntheticEvent<Element, Event>) => void) | undefined;
|
|
24
|
+
onClose?: ((event: React.SyntheticEvent<HTMLElement, Event>, analyticsEvent: any) => void) | undefined;
|
|
25
|
+
isOpen: boolean;
|
|
26
|
+
zIndex?: number | "unset" | undefined;
|
|
27
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "onKeyDown" | "key" | "onClose" | "zIndex" | "isOpen" | "analyticsContext" | keyof import("./types").BaseProps | keyof import("./types").FocusLockSettings | keyof import("./types").DrawerLabel> & React.RefAttributes<any>>;
|
|
40
28
|
export default Drawer;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { type FocusLockProps } from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onDeactivation: () => void;
|
|
12
|
-
render(): JSX.Element;
|
|
13
|
-
}
|
|
3
|
+
/**
|
|
4
|
+
* __Focus lock__
|
|
5
|
+
*
|
|
6
|
+
* Thin wrapper over react-focus-lock. This wrapper only exists to ensure API compatibility.
|
|
7
|
+
* This component should be deleted during https://ecosystem.atlassian.net/browse/AK-5658
|
|
8
|
+
*/
|
|
9
|
+
declare const FocusLock: ({ isFocusLockEnabled, autoFocusFirstElem, shouldReturnFocus, children, }: FocusLockProps) => JSX.Element;
|
|
10
|
+
export default FocusLock;
|
|
@@ -147,7 +147,7 @@ export type DrawerProps = BaseProps & FocusLockSettings & WithAnalyticsEventsPro
|
|
|
147
147
|
* This is passed to the portal component.
|
|
148
148
|
* Defaults to `unset`.
|
|
149
149
|
*/
|
|
150
|
-
zIndex?: number;
|
|
150
|
+
zIndex?: number | 'unset';
|
|
151
151
|
};
|
|
152
152
|
export interface FocusLockSettings {
|
|
153
153
|
/**
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import { type DrawerProps
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DrawerProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* __Drawer base__
|
|
5
|
+
*
|
|
6
|
+
* A drawer is a panel that slides in from the left side of the screen.
|
|
7
|
+
*
|
|
8
|
+
* - [Examples](https://atlassian.design/components/drawer/examples)
|
|
9
|
+
* - [Code](https://atlassian.design/components/drawer/code)
|
|
10
|
+
* - [Usage](https://atlassian.design/components/drawer/usage)
|
|
11
|
+
*/
|
|
12
|
+
export declare const DrawerBase: ({ width, isOpen, isFocusLockEnabled, shouldReturnFocus, autoFocusFirstElem, onKeyDown, createAnalyticsEvent, onClose, testId, children, icon, closeLabel, scrollContentLabel, shouldUnmountOnExit, onCloseComplete, onOpenComplete, overrides, zIndex, label, titleId, enterFrom, }: DrawerProps) => JSX.Element | null;
|
|
25
13
|
/**
|
|
26
14
|
* __Drawer__
|
|
27
15
|
*
|
|
@@ -31,10 +19,10 @@ export declare class DrawerBase extends Component<DrawerProps, {
|
|
|
31
19
|
* - [Code](https://atlassian.design/components/drawer/code)
|
|
32
20
|
* - [Usage](https://atlassian.design/components/drawer/usage)
|
|
33
21
|
*/
|
|
34
|
-
declare const Drawer: React.ForwardRefExoticComponent<Pick<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
22
|
+
declare const Drawer: React.ForwardRefExoticComponent<Pick<Omit<import("./types").BaseProps & import("./types").FocusLockSettings & import("@atlaskit/analytics-next").WithAnalyticsEventsProps & import("./types").DrawerLabel & {
|
|
23
|
+
onKeyDown?: ((event: React.SyntheticEvent<Element, Event>) => void) | undefined;
|
|
24
|
+
onClose?: ((event: React.SyntheticEvent<HTMLElement, Event>, analyticsEvent: any) => void) | undefined;
|
|
25
|
+
isOpen: boolean;
|
|
26
|
+
zIndex?: number | "unset" | undefined;
|
|
27
|
+
}, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "onKeyDown" | "key" | "onClose" | "zIndex" | "isOpen" | "analyticsContext" | keyof import("./types").BaseProps | keyof import("./types").FocusLockSettings | keyof import("./types").DrawerLabel> & React.RefAttributes<any>>;
|
|
40
28
|
export default Drawer;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { type FocusLockProps } from '../types';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
onDeactivation: () => void;
|
|
12
|
-
render(): JSX.Element;
|
|
13
|
-
}
|
|
3
|
+
/**
|
|
4
|
+
* __Focus lock__
|
|
5
|
+
*
|
|
6
|
+
* Thin wrapper over react-focus-lock. This wrapper only exists to ensure API compatibility.
|
|
7
|
+
* This component should be deleted during https://ecosystem.atlassian.net/browse/AK-5658
|
|
8
|
+
*/
|
|
9
|
+
declare const FocusLock: ({ isFocusLockEnabled, autoFocusFirstElem, shouldReturnFocus, children, }: FocusLockProps) => JSX.Element;
|
|
10
|
+
export default FocusLock;
|
|
@@ -147,7 +147,7 @@ export type DrawerProps = BaseProps & FocusLockSettings & WithAnalyticsEventsPro
|
|
|
147
147
|
* This is passed to the portal component.
|
|
148
148
|
* Defaults to `unset`.
|
|
149
149
|
*/
|
|
150
|
-
zIndex?: number;
|
|
150
|
+
zIndex?: number | 'unset';
|
|
151
151
|
};
|
|
152
152
|
export interface FocusLockSettings {
|
|
153
153
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/drawer",
|
|
3
|
-
"version": "7.14.
|
|
3
|
+
"version": "7.14.3",
|
|
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/"
|
|
@@ -29,10 +29,6 @@
|
|
|
29
29
|
"homepage": "https://atlassian.design/components/drawer",
|
|
30
30
|
"atlassian": {
|
|
31
31
|
"team": "Design System Team",
|
|
32
|
-
"releaseModel": "continuous",
|
|
33
|
-
"productPushConsumption": [
|
|
34
|
-
"jira"
|
|
35
|
-
],
|
|
36
32
|
"website": {
|
|
37
33
|
"name": "Drawer",
|
|
38
34
|
"category": "Components"
|
|
@@ -42,14 +38,14 @@
|
|
|
42
38
|
"dependencies": {
|
|
43
39
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
44
40
|
"@atlaskit/blanket": "^13.3.0",
|
|
45
|
-
"@atlaskit/button": "^
|
|
46
|
-
"@atlaskit/icon": "^22.
|
|
41
|
+
"@atlaskit/button": "^20.1.0",
|
|
42
|
+
"@atlaskit/icon": "^22.16.0",
|
|
47
43
|
"@atlaskit/layering": "^0.4.0",
|
|
48
44
|
"@atlaskit/motion": "^1.9.0",
|
|
49
45
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
50
46
|
"@atlaskit/portal": "^4.9.0",
|
|
51
47
|
"@atlaskit/theme": "^13.0.0",
|
|
52
|
-
"@atlaskit/tokens": "^1.
|
|
48
|
+
"@atlaskit/tokens": "^1.59.0",
|
|
53
49
|
"@babel/runtime": "^7.0.0",
|
|
54
50
|
"@emotion/react": "^11.7.1",
|
|
55
51
|
"bind-event-listener": "^3.0.0",
|
|
@@ -66,7 +62,7 @@
|
|
|
66
62
|
"@af/accessibility-testing": "*",
|
|
67
63
|
"@af/integration-testing": "*",
|
|
68
64
|
"@af/visual-regression": "*",
|
|
69
|
-
"@atlaskit/ds-lib": "^2.
|
|
65
|
+
"@atlaskit/ds-lib": "^2.5.0",
|
|
70
66
|
"@atlaskit/ssr": "*",
|
|
71
67
|
"@atlaskit/visual-regression": "*",
|
|
72
68
|
"@testing-library/react": "^12.1.5",
|