@atlaskit/drawer 7.1.9 → 7.1.12
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 +18 -0
- package/dist/cjs/components/index.js +3 -2
- package/dist/cjs/components/primitives/content.js +1 -1
- package/dist/cjs/components/primitives/icon-button.js +2 -1
- package/dist/cjs/components/primitives/index.js +2 -1
- package/dist/cjs/components/primitives/sidebar.js +1 -1
- package/dist/cjs/components/utils.js +2 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/components/index.js +5 -2
- package/dist/es2019/components/primitives/content.js +1 -1
- package/dist/es2019/components/primitives/icon-button.js +2 -1
- package/dist/es2019/components/primitives/index.js +2 -1
- package/dist/es2019/components/primitives/sidebar.js +1 -1
- package/dist/es2019/components/utils.js +5 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/components/index.js +4 -2
- package/dist/esm/components/primitives/content.js +1 -1
- package/dist/esm/components/primitives/icon-button.js +2 -1
- package/dist/esm/components/primitives/index.js +2 -1
- package/dist/esm/components/primitives/sidebar.js +1 -1
- package/dist/esm/components/utils.js +2 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/components/types.d.ts +47 -17
- package/package.json +12 -8
- package/report.api.md +196 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/drawer
|
|
2
2
|
|
|
3
|
+
## 7.1.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
|
|
8
|
+
|
|
9
|
+
## 7.1.11
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`fd86b8e4c63`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fd86b8e4c63) - Internal code change turning on new linting rules.
|
|
14
|
+
|
|
15
|
+
## 7.1.10
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 7.1.9
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -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.
|
|
49
|
+
var packageVersion = "7.1.12";
|
|
50
50
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
51
51
|
|
|
52
52
|
var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
|
|
@@ -177,7 +177,8 @@ var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
177
177
|
onCloseComplete: onCloseComplete,
|
|
178
178
|
onOpenComplete: onOpenComplete,
|
|
179
179
|
width: width,
|
|
180
|
-
shouldUnmountOnExit: shouldUnmountOnExit
|
|
180
|
+
shouldUnmountOnExit: shouldUnmountOnExit // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
181
|
+
,
|
|
181
182
|
overrides: overrides
|
|
182
183
|
}, children)));
|
|
183
184
|
}
|
|
@@ -36,7 +36,7 @@ var Content = function Content(_ref) {
|
|
|
36
36
|
* guide suggested as it made more sense as a transformer of the current styles rather than
|
|
37
37
|
* a complete override with no chance of partially changing styles.
|
|
38
38
|
*/
|
|
39
|
-
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
39
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
|
|
40
40
|
(0, _core.jsx)("div", (0, _extends2.default)({
|
|
41
41
|
css: cssFn(defaultStyles)
|
|
42
42
|
}, props))
|
|
@@ -138,7 +138,8 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
138
138
|
label: "Close drawer"
|
|
139
139
|
}))), (0, _core.jsx)(Content, contentOverrides, children));
|
|
140
140
|
}));
|
|
141
|
-
};
|
|
141
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
142
|
+
|
|
142
143
|
|
|
143
144
|
var _default = DrawerPrimitive;
|
|
144
145
|
exports.default = _default;
|
|
@@ -38,7 +38,7 @@ var sidebarCSS = function sidebarCSS() {
|
|
|
38
38
|
var Sidebar = function Sidebar(_ref) {
|
|
39
39
|
var cssFn = _ref.cssFn,
|
|
40
40
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
41
|
-
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
41
|
+
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
|
|
42
42
|
return (0, _core.jsx)("div", (0, _extends2.default)({
|
|
43
43
|
css: cssFn(defaultStyle)
|
|
44
44
|
}, props));
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createExtender = void 0;
|
|
7
7
|
|
|
8
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* @deprecated Please avoid using this function as we intend to remote it in a future release. See DSP-2673 for more information.
|
|
10
12
|
*/
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
2
4
|
import React, { Component } from 'react';
|
|
3
5
|
import { canUseDOM } from 'exenv';
|
|
4
6
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -7,7 +9,7 @@ import Blanket from './blanket';
|
|
|
7
9
|
import FocusLock from './focus-lock';
|
|
8
10
|
import DrawerPrimitive from './primitives';
|
|
9
11
|
const packageName = "@atlaskit/drawer";
|
|
10
|
-
const packageVersion = "7.1.
|
|
12
|
+
const packageVersion = "7.1.12";
|
|
11
13
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
12
14
|
|
|
13
15
|
const createAndFireOnClick = (createAnalyticsEvent, trigger) => createAndFireEventOnAtlaskit({
|
|
@@ -131,7 +133,8 @@ export class DrawerBase extends Component {
|
|
|
131
133
|
onCloseComplete: onCloseComplete,
|
|
132
134
|
onOpenComplete: onOpenComplete,
|
|
133
135
|
width: width,
|
|
134
|
-
shouldUnmountOnExit: shouldUnmountOnExit
|
|
136
|
+
shouldUnmountOnExit: shouldUnmountOnExit // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
137
|
+
,
|
|
135
138
|
overrides: overrides
|
|
136
139
|
}, children)));
|
|
137
140
|
}
|
|
@@ -21,7 +21,7 @@ const Content = ({
|
|
|
21
21
|
* guide suggested as it made more sense as a transformer of the current styles rather than
|
|
22
22
|
* a complete override with no chance of partially changing styles.
|
|
23
23
|
*/
|
|
24
|
-
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
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
26
|
css: cssFn(defaultStyles)
|
|
27
27
|
}, props));
|
|
@@ -23,7 +23,7 @@ const Sidebar = ({
|
|
|
23
23
|
cssFn,
|
|
24
24
|
...props
|
|
25
25
|
}) => {
|
|
26
|
-
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
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
28
|
css: cssFn(defaultStyle)
|
|
29
29
|
}, props));
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
// eslint-disable-next-line @repo/internal/react/consistent-types-definitions
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* @deprecated Please avoid using this function as we intend to remote it in a future release. See DSP-2673 for more information.
|
|
3
5
|
*/
|
|
4
6
|
export const createExtender = function createExtender(defaults,
|
|
5
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* We're defaulting to an Object.create call here to circumvent
|
|
6
9
|
* the fact that {} can't be reconciled
|
|
7
10
|
* with a type that extends Record<string, any>
|
|
8
11
|
*
|
|
@@ -10,7 +13,7 @@ export const createExtender = function createExtender(defaults,
|
|
|
10
13
|
* from nullifying a particular component in the tree.
|
|
11
14
|
* This can be reverted with additional logic,
|
|
12
15
|
* at such a time as this nullification becomes an actual usecase.
|
|
13
|
-
|
|
16
|
+
*/
|
|
14
17
|
overrides = Object.create(Object.prototype)) {
|
|
15
18
|
if (!defaults) {
|
|
16
19
|
throw new Error('a default set of overrides *must* be passed in as the first argument');
|
package/dist/es2019/version.json
CHANGED
|
@@ -10,6 +10,7 @@ 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
|
+
/* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
13
14
|
import React, { Component } from 'react';
|
|
14
15
|
import { canUseDOM } from 'exenv';
|
|
15
16
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
@@ -18,7 +19,7 @@ import Blanket from './blanket';
|
|
|
18
19
|
import FocusLock from './focus-lock';
|
|
19
20
|
import DrawerPrimitive from './primitives';
|
|
20
21
|
var packageName = "@atlaskit/drawer";
|
|
21
|
-
var packageVersion = "7.1.
|
|
22
|
+
var packageVersion = "7.1.12";
|
|
22
23
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
23
24
|
|
|
24
25
|
var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
|
|
@@ -156,7 +157,8 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
156
157
|
onCloseComplete: onCloseComplete,
|
|
157
158
|
onOpenComplete: onOpenComplete,
|
|
158
159
|
width: width,
|
|
159
|
-
shouldUnmountOnExit: shouldUnmountOnExit
|
|
160
|
+
shouldUnmountOnExit: shouldUnmountOnExit // eslint-disable-next-line @repo/internal/react/no-unsafe-overrides
|
|
161
|
+
,
|
|
160
162
|
overrides: overrides
|
|
161
163
|
}, children)));
|
|
162
164
|
}
|
|
@@ -26,7 +26,7 @@ var Content = function Content(_ref) {
|
|
|
26
26
|
* guide suggested as it made more sense as a transformer of the current styles rather than
|
|
27
27
|
* a complete override with no chance of partially changing styles.
|
|
28
28
|
*/
|
|
29
|
-
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
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
31
|
css: cssFn(defaultStyles)
|
|
32
32
|
}, props))
|
|
@@ -120,6 +120,7 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
120
120
|
label: "Close drawer"
|
|
121
121
|
}))), jsx(Content, contentOverrides, children));
|
|
122
122
|
}));
|
|
123
|
-
};
|
|
123
|
+
}; // eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
124
|
+
|
|
124
125
|
|
|
125
126
|
export default DrawerPrimitive;
|
|
@@ -27,7 +27,7 @@ var Sidebar = function Sidebar(_ref) {
|
|
|
27
27
|
var cssFn = _ref.cssFn,
|
|
28
28
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
29
29
|
|
|
30
|
-
// eslint-disable-next-line @repo/internal/react/consistent-css-prop-usage
|
|
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
32
|
css: cssFn(defaultStyle)
|
|
33
33
|
}, props));
|
package/dist/esm/version.json
CHANGED
|
@@ -10,24 +10,38 @@ export declare type Widths = {
|
|
|
10
10
|
};
|
|
11
11
|
export declare type DrawerWidth = 'extended' | 'full' | 'medium' | 'narrow' | 'wide';
|
|
12
12
|
export interface BaseProps {
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* A unique hook to be used for testing.
|
|
15
|
+
*/
|
|
14
16
|
testId?: string;
|
|
15
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* The content of the drawer.
|
|
19
|
+
*/
|
|
16
20
|
children?: ReactNode;
|
|
17
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Icon to be rendered in your drawer as a component, if available.
|
|
23
|
+
*/
|
|
18
24
|
icon?: ComponentType<any>;
|
|
19
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Available drawer sizes.
|
|
27
|
+
*/
|
|
20
28
|
width?: DrawerWidth;
|
|
21
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* A callback function that will be called when the drawer has finished its opening transition.
|
|
31
|
+
*/
|
|
22
32
|
onOpenComplete?: (node: HTMLElement | null) => void;
|
|
23
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* A callback function that will be called when the drawer has finished its close transition.
|
|
35
|
+
*/
|
|
24
36
|
onCloseComplete?: (node: HTMLElement | null) => void;
|
|
25
37
|
/**
|
|
26
|
-
*
|
|
38
|
+
* @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release.
|
|
27
39
|
* Boolean that controls if drawer should be retained/discarded
|
|
28
|
-
|
|
40
|
+
*/
|
|
29
41
|
shouldUnmountOnExit?: boolean;
|
|
30
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Override drawer components.
|
|
44
|
+
*/
|
|
31
45
|
overrides?: OverridesType;
|
|
32
46
|
}
|
|
33
47
|
export declare type DefaultsType = {
|
|
@@ -77,22 +91,38 @@ export interface DrawerPrimitiveProps extends BaseProps {
|
|
|
77
91
|
onClose: (event: SyntheticEvent<HTMLElement>) => void;
|
|
78
92
|
}
|
|
79
93
|
export declare type DrawerProps = BaseProps & FocusLockProps & WithAnalyticsEventsProps & {
|
|
80
|
-
/**
|
|
94
|
+
/**
|
|
95
|
+
* Callback function called while the drawer is displayed and `keydown` event is triggered.
|
|
96
|
+
*/
|
|
81
97
|
onKeyDown?: (event: SyntheticEvent) => void;
|
|
82
|
-
/**
|
|
98
|
+
/**
|
|
99
|
+
* Callback function called when the drawer is closed.
|
|
100
|
+
*/
|
|
83
101
|
onClose?: (event: SyntheticEvent<HTMLElement>, analyticsEvent: any) => void;
|
|
84
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* Controls if the drawer is open or closed.
|
|
104
|
+
*/
|
|
85
105
|
isOpen: boolean;
|
|
86
106
|
};
|
|
87
107
|
export interface FocusLockProps {
|
|
88
|
-
/**
|
|
108
|
+
/**
|
|
109
|
+
* Controls whether to focus the first tabbable element inside the focus lock.
|
|
110
|
+
*/
|
|
89
111
|
autoFocusFirstElem?: boolean | (() => HTMLElement | null);
|
|
90
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Content inside the focus lock.
|
|
114
|
+
*/
|
|
91
115
|
children?: ReactNode;
|
|
92
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* Whether the focus lock is active or not.
|
|
118
|
+
*/
|
|
93
119
|
isFocusLockEnabled?: boolean;
|
|
94
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Whether to return the focus to the previous active element on closing the drawer.
|
|
122
|
+
*/
|
|
95
123
|
shouldReturnFocus?: boolean;
|
|
96
124
|
}
|
|
97
|
-
/**
|
|
125
|
+
/**
|
|
126
|
+
* Type of keyboard event that triggers which key will should close the drawer.
|
|
127
|
+
*/
|
|
98
128
|
export declare type CloseTrigger = 'backButton' | 'blanket' | 'escKey';
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/drawer",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.12",
|
|
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/"
|
|
7
7
|
},
|
|
8
|
-
"repository": "https://bitbucket.org/atlassian/atlassian-frontend",
|
|
8
|
+
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
9
9
|
"author": "Atlassian Pty Ltd",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"main": "dist/cjs/index.js",
|
|
@@ -13,24 +13,25 @@
|
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
15
|
"sideEffects": false,
|
|
16
|
-
"atlaskit:src": "src/index.
|
|
16
|
+
"atlaskit:src": "src/index.tsx",
|
|
17
17
|
"homepage": "https://atlassian.design/components/drawer",
|
|
18
18
|
"atlassian": {
|
|
19
19
|
"team": "Design System Team",
|
|
20
20
|
"deprecatedAutoEntryPoints": true,
|
|
21
21
|
"releaseModel": "scheduled",
|
|
22
22
|
"website": {
|
|
23
|
-
"name": "Drawer"
|
|
23
|
+
"name": "Drawer",
|
|
24
|
+
"category": "Components"
|
|
24
25
|
}
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
28
|
"@atlaskit/analytics-next": "^8.2.0",
|
|
28
29
|
"@atlaskit/blanket": "^12.1.0",
|
|
29
30
|
"@atlaskit/icon": "^21.10.0",
|
|
30
|
-
"@atlaskit/motion": "^1.0
|
|
31
|
+
"@atlaskit/motion": "^1.2.0",
|
|
31
32
|
"@atlaskit/portal": "^4.0.0",
|
|
32
33
|
"@atlaskit/theme": "^12.1.0",
|
|
33
|
-
"@atlaskit/tokens": "^0.
|
|
34
|
+
"@atlaskit/tokens": "^0.10.0",
|
|
34
35
|
"@babel/runtime": "^7.0.0",
|
|
35
36
|
"@emotion/core": "^10.0.9",
|
|
36
37
|
"exenv": "^1.2.2",
|
|
@@ -45,7 +46,8 @@
|
|
|
45
46
|
"@atlaskit/checkbox": "^12.3.9",
|
|
46
47
|
"@atlaskit/code": "^14.3.3",
|
|
47
48
|
"@atlaskit/docs": "*",
|
|
48
|
-
"@atlaskit/dropdown-menu": "^11.
|
|
49
|
+
"@atlaskit/dropdown-menu": "^11.3.0",
|
|
50
|
+
"@atlaskit/ds-lib": "^2.1.0",
|
|
49
51
|
"@atlaskit/menu": "^1.3.0",
|
|
50
52
|
"@atlaskit/section-message": "^6.0.0",
|
|
51
53
|
"@atlaskit/ssr": "*",
|
|
@@ -59,7 +61,7 @@
|
|
|
59
61
|
"lodash": "^4.17.21",
|
|
60
62
|
"react-dom": "^16.8.0",
|
|
61
63
|
"react-lorem-component": "^0.13.0",
|
|
62
|
-
"typescript": "4.
|
|
64
|
+
"typescript": "4.3.5",
|
|
63
65
|
"wait-for-expect": "^1.2.0"
|
|
64
66
|
},
|
|
65
67
|
"techstack": {
|
|
@@ -67,6 +69,8 @@
|
|
|
67
69
|
"import-structure": "atlassian-conventions"
|
|
68
70
|
},
|
|
69
71
|
"@repo/internal": {
|
|
72
|
+
"dom-events": "use-bind-event-listener",
|
|
73
|
+
"design-system": "v1",
|
|
70
74
|
"analytics": "analytics-next",
|
|
71
75
|
"theming": "tokens",
|
|
72
76
|
"styling": [
|
package/report.api.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
## API Report File for "@atlaskit/drawer"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { ComponentType } from 'react';
|
|
7
|
+
import { CSSObject } from '@emotion/core';
|
|
8
|
+
import { default as React_2 } from 'react';
|
|
9
|
+
import { ReactNode } from 'react';
|
|
10
|
+
import { SyntheticEvent } from 'react';
|
|
11
|
+
import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
12
|
+
import { WithContextProps } from '@atlaskit/analytics-next';
|
|
13
|
+
|
|
14
|
+
export declare interface BaseProps {
|
|
15
|
+
/** A unique hook to be used for testing. */
|
|
16
|
+
testId?: string;
|
|
17
|
+
/** The content of the drawer. */
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/** Icon to be rendered in your drawer as a component, if available. */
|
|
20
|
+
icon?: ComponentType<any>;
|
|
21
|
+
/** Available drawer sizes. */
|
|
22
|
+
width?: DrawerWidth;
|
|
23
|
+
/** A callback function that will be called when the drawer has finished its opening transition. */
|
|
24
|
+
onOpenComplete?: (node: HTMLElement | null) => void;
|
|
25
|
+
/** A callback function that will be called when the drawer has finished its close transition. */
|
|
26
|
+
onCloseComplete?: (node: HTMLElement | null) => void;
|
|
27
|
+
/**
|
|
28
|
+
* * @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release.
|
|
29
|
+
* Boolean that controls if drawer should be retained/discarded
|
|
30
|
+
* */
|
|
31
|
+
shouldUnmountOnExit?: boolean;
|
|
32
|
+
/** Override drawer components. */
|
|
33
|
+
overrides?: OverridesType;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Type of keyboard event that triggers which key will should close the drawer. */
|
|
37
|
+
export declare type CloseTrigger = 'backButton' | 'blanket' | 'escKey';
|
|
38
|
+
|
|
39
|
+
export declare type ContentCSSProps = Omit<ContentProps, 'cssFn'>;
|
|
40
|
+
|
|
41
|
+
export declare interface ContentProps extends React.HTMLProps<HTMLDivElement> {
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
|
|
44
|
+
*/
|
|
45
|
+
cssFn: (defaultStyles: CSSObject) => CSSObject;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare const _default: React_2.ForwardRefExoticComponent<
|
|
49
|
+
Pick<
|
|
50
|
+
Pick<
|
|
51
|
+
Omit<DrawerProps, keyof WithAnalyticsEventsProps>,
|
|
52
|
+
| 'children'
|
|
53
|
+
| 'onKeyDown'
|
|
54
|
+
| 'isOpen'
|
|
55
|
+
| 'testId'
|
|
56
|
+
| 'icon'
|
|
57
|
+
| 'onClose'
|
|
58
|
+
| 'onCloseComplete'
|
|
59
|
+
| 'onOpenComplete'
|
|
60
|
+
| 'overrides'
|
|
61
|
+
| 'shouldUnmountOnExit'
|
|
62
|
+
> &
|
|
63
|
+
Partial<
|
|
64
|
+
Pick<
|
|
65
|
+
Omit<DrawerProps, keyof WithAnalyticsEventsProps>,
|
|
66
|
+
| 'width'
|
|
67
|
+
| 'isFocusLockEnabled'
|
|
68
|
+
| 'autoFocusFirstElem'
|
|
69
|
+
| 'shouldReturnFocus'
|
|
70
|
+
>
|
|
71
|
+
> &
|
|
72
|
+
Partial<
|
|
73
|
+
Pick<
|
|
74
|
+
{
|
|
75
|
+
width: DrawerWidth;
|
|
76
|
+
isFocusLockEnabled: boolean;
|
|
77
|
+
shouldReturnFocus: boolean;
|
|
78
|
+
autoFocusFirstElem: boolean;
|
|
79
|
+
},
|
|
80
|
+
never
|
|
81
|
+
>
|
|
82
|
+
> &
|
|
83
|
+
React_2.RefAttributes<any> &
|
|
84
|
+
WithContextProps,
|
|
85
|
+
| 'width'
|
|
86
|
+
| 'children'
|
|
87
|
+
| 'onKeyDown'
|
|
88
|
+
| 'key'
|
|
89
|
+
| 'isOpen'
|
|
90
|
+
| 'analyticsContext'
|
|
91
|
+
| 'testId'
|
|
92
|
+
| 'isFocusLockEnabled'
|
|
93
|
+
| 'autoFocusFirstElem'
|
|
94
|
+
| 'shouldReturnFocus'
|
|
95
|
+
| 'icon'
|
|
96
|
+
| 'onClose'
|
|
97
|
+
| 'onCloseComplete'
|
|
98
|
+
| 'onOpenComplete'
|
|
99
|
+
| 'overrides'
|
|
100
|
+
| 'shouldUnmountOnExit'
|
|
101
|
+
> &
|
|
102
|
+
React_2.RefAttributes<any>
|
|
103
|
+
>;
|
|
104
|
+
export default _default;
|
|
105
|
+
|
|
106
|
+
export declare type DefaultsType = {
|
|
107
|
+
Sidebar: {
|
|
108
|
+
component: React.ComponentType<SidebarProps>;
|
|
109
|
+
cssFn: (defaultStyles: CSSObject) => CSSObject;
|
|
110
|
+
};
|
|
111
|
+
Content: {
|
|
112
|
+
component: React.ComponentType<ContentProps>;
|
|
113
|
+
cssFn: (defaultStyles: CSSObject) => CSSObject;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export declare type DrawerPrimitiveDefaults = Pick<
|
|
118
|
+
DefaultsType,
|
|
119
|
+
'Sidebar' | 'Content'
|
|
120
|
+
>;
|
|
121
|
+
|
|
122
|
+
export declare type DrawerPrimitiveOverrides = Pick<
|
|
123
|
+
OverridesType,
|
|
124
|
+
'Sidebar' | 'Content'
|
|
125
|
+
>;
|
|
126
|
+
|
|
127
|
+
export declare interface DrawerPrimitiveProps extends BaseProps {
|
|
128
|
+
in: boolean;
|
|
129
|
+
onClose: (event: SyntheticEvent<HTMLElement>) => void;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export declare type DrawerProps = BaseProps &
|
|
133
|
+
FocusLockProps &
|
|
134
|
+
WithAnalyticsEventsProps & {
|
|
135
|
+
/** Callback function called while the drawer is displayed and `keydown` event is triggered. */
|
|
136
|
+
onKeyDown?: (event: SyntheticEvent) => void;
|
|
137
|
+
/** Callback function called when the drawer is closed. */
|
|
138
|
+
onClose?: (event: SyntheticEvent<HTMLElement>, analyticsEvent: any) => void;
|
|
139
|
+
/** Controls if the drawer is open or closed. */
|
|
140
|
+
isOpen: boolean;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export declare type DrawerWidth =
|
|
144
|
+
| 'extended'
|
|
145
|
+
| 'full'
|
|
146
|
+
| 'medium'
|
|
147
|
+
| 'narrow'
|
|
148
|
+
| 'wide';
|
|
149
|
+
|
|
150
|
+
export declare interface FocusLockProps {
|
|
151
|
+
/** Controls whether to focus the first tabbable element inside the focus lock. */
|
|
152
|
+
autoFocusFirstElem?: boolean | (() => HTMLElement | null);
|
|
153
|
+
/** Content inside the focus lock. */
|
|
154
|
+
children?: ReactNode;
|
|
155
|
+
/** Whether the focus lock is active or not. */
|
|
156
|
+
isFocusLockEnabled?: boolean;
|
|
157
|
+
/** Whether to return the focus to the previous active element on closing the drawer. */
|
|
158
|
+
shouldReturnFocus?: boolean;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export declare type OverridesType = {
|
|
162
|
+
Sidebar?: {
|
|
163
|
+
component?: React.ComponentType<SidebarProps>;
|
|
164
|
+
/**
|
|
165
|
+
* @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
|
|
166
|
+
*/
|
|
167
|
+
cssFn?: (defaultStyles: CSSObject) => CSSObject;
|
|
168
|
+
};
|
|
169
|
+
Content?: {
|
|
170
|
+
component?: React.ComponentType<ContentProps>;
|
|
171
|
+
/**
|
|
172
|
+
* @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
|
|
173
|
+
*/
|
|
174
|
+
cssFn?: (defaultStyles: CSSObject) => CSSObject;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export declare type SidebarCSSProps = Omit<SidebarProps, 'cssFn'>;
|
|
179
|
+
|
|
180
|
+
export declare interface SidebarProps extends React.HTMLProps<HTMLDivElement> {
|
|
181
|
+
/**
|
|
182
|
+
* @deprecated Please avoid using this prop as we intend to remove the prop completely in a future release. See DSP-2673 for more information.
|
|
183
|
+
*/
|
|
184
|
+
cssFn: (defaultStyles: CSSObject) => CSSObject;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export declare type Widths = {
|
|
188
|
+
extended: string;
|
|
189
|
+
full: string;
|
|
190
|
+
medium: number;
|
|
191
|
+
narrow: number;
|
|
192
|
+
wide: number;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export {};
|
|
196
|
+
```
|