@atlaskit/drawer 7.12.3 → 7.13.0
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 +16 -0
- package/dist/cjs/components/index.js +14 -11
- package/dist/cjs/components/primitives/index.js +9 -5
- package/dist/cjs/constants.js +2 -1
- package/dist/es2019/components/index.js +14 -11
- package/dist/es2019/components/primitives/index.js +8 -5
- package/dist/es2019/constants.js +1 -0
- package/dist/esm/components/index.js +15 -12
- package/dist/esm/components/primitives/index.js +9 -5
- package/dist/esm/constants.js +1 -0
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/components/primitives/index.d.ts +1 -1
- package/dist/types/components/types.d.ts +5 -0
- package/dist/types/constants.d.ts +2 -0
- package/dist/types-ts4.5/components/index.d.ts +2 -2
- package/dist/types-ts4.5/components/primitives/index.d.ts +1 -1
- package/dist/types-ts4.5/components/types.d.ts +5 -0
- package/dist/types-ts4.5/constants.d.ts +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/drawer
|
|
2
2
|
|
|
3
|
+
## 7.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#116848](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116848)
|
|
8
|
+
[`9b4398682d67b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9b4398682d67b) -
|
|
9
|
+
Drawer can be configured to enter from any direction
|
|
10
|
+
|
|
11
|
+
## 7.12.4
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#116209](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/116209)
|
|
16
|
+
[`0aa2af6a28226`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0aa2af6a28226) -
|
|
17
|
+
Only render escapeManager when open
|
|
18
|
+
|
|
3
19
|
## 7.12.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -29,7 +29,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
29
29
|
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); }; }
|
|
30
30
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable @repo/internal/dom-events/no-unsafe-event-listeners */
|
|
31
31
|
var packageName = "@atlaskit/drawer";
|
|
32
|
-
var packageVersion = "7.
|
|
32
|
+
var packageVersion = "7.13.0";
|
|
33
33
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
34
34
|
var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
|
|
35
35
|
return createAndFireEventOnAtlaskit({
|
|
@@ -49,16 +49,16 @@ var EscapeCloseManager = function EscapeCloseManager(_ref) {
|
|
|
49
49
|
var createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
50
50
|
handleClose = _ref.handleClose;
|
|
51
51
|
var onClose = _react.default.useCallback(function (event) {
|
|
52
|
-
var analyticsEvent = createAnalyticsEvent && createAndFireOnClick(createAnalyticsEvent, 'escKey');
|
|
53
52
|
if (handleClose) {
|
|
54
|
-
|
|
53
|
+
var _analyticsEvent = createAnalyticsEvent && createAndFireOnClick(createAnalyticsEvent, 'escKey');
|
|
54
|
+
handleClose(event, _analyticsEvent);
|
|
55
55
|
}
|
|
56
56
|
}, [handleClose, createAnalyticsEvent]);
|
|
57
57
|
(0, _layering.useCloseOnEscapePress)({
|
|
58
58
|
onClose: onClose
|
|
59
59
|
});
|
|
60
60
|
// only create a dummy component for using ths hook in class component
|
|
61
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement("span", null);
|
|
62
62
|
};
|
|
63
63
|
var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
|
|
64
64
|
(0, _inherits2.default)(DrawerBase, _Component);
|
|
@@ -93,7 +93,7 @@ var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
93
93
|
var _this$props2 = _this.props,
|
|
94
94
|
isOpen = _this$props2.isOpen,
|
|
95
95
|
onKeyDown = _this$props2.onKeyDown;
|
|
96
|
-
if (!(0, _platformFeatureFlags.
|
|
96
|
+
if (!(0, _platformFeatureFlags.fg)('platform.design-system-team.inline-message-layering_wfp1p')) {
|
|
97
97
|
// when feature flag on, we will use the EscapeCloseManager instead
|
|
98
98
|
if (event.key === 'Escape' && isOpen) {
|
|
99
99
|
_this.handleClose(event, 'escKey');
|
|
@@ -154,10 +154,10 @@ var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
154
154
|
_this$props3$zIndex = _this$props3.zIndex,
|
|
155
155
|
zIndex = _this$props3$zIndex === void 0 ? 'unset' : _this$props3$zIndex,
|
|
156
156
|
label = _this$props3.label,
|
|
157
|
-
titleId = _this$props3.titleId
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
157
|
+
titleId = _this$props3.titleId,
|
|
158
|
+
enterFrom = _this$props3.enterFrom;
|
|
159
|
+
var shouldHaveLayeringEnabled = (0, _platformFeatureFlags.fg)('platform.design-system-team.inline-message-layering_wfp1p') && isOpen;
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_portal.default, {
|
|
161
161
|
zIndex: zIndex
|
|
162
162
|
}, /*#__PURE__*/_react.default.createElement(_blanket.default, {
|
|
163
163
|
isOpen: isOpen,
|
|
@@ -172,6 +172,7 @@ var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
172
172
|
onCloseComplete: onCloseComplete,
|
|
173
173
|
onOpenComplete: onOpenComplete,
|
|
174
174
|
width: width,
|
|
175
|
+
enterFrom: enterFrom,
|
|
175
176
|
label: label,
|
|
176
177
|
titleId: titleId,
|
|
177
178
|
shouldUnmountOnExit: shouldUnmountOnExit
|
|
@@ -182,10 +183,12 @@ var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
182
183
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
183
184
|
shouldReturnFocus: shouldReturnFocus,
|
|
184
185
|
scrollContentLabel: scrollContentLabel
|
|
185
|
-
},
|
|
186
|
+
}, shouldHaveLayeringEnabled ? /*#__PURE__*/_react.default.createElement(_layering.UNSAFE_LAYERING, {
|
|
187
|
+
isDisabled: false
|
|
188
|
+
}, children, /*#__PURE__*/_react.default.createElement(EscapeCloseManager, {
|
|
186
189
|
createAnalyticsEvent: this.props.createAnalyticsEvent,
|
|
187
190
|
handleClose: this.handleClose
|
|
188
|
-
}))));
|
|
191
|
+
})) : children));
|
|
189
192
|
}
|
|
190
193
|
}]);
|
|
191
194
|
return DrawerBase;
|
|
@@ -38,7 +38,8 @@ var defaults = {
|
|
|
38
38
|
*/
|
|
39
39
|
var CustomSlideIn = function CustomSlideIn(_ref) {
|
|
40
40
|
var children = _ref.children,
|
|
41
|
-
onFinish = _ref.onFinish
|
|
41
|
+
onFinish = _ref.onFinish,
|
|
42
|
+
enterFrom = _ref.enterFrom;
|
|
42
43
|
var _useExitingPersistenc = (0, _motion.useExitingPersistence)(),
|
|
43
44
|
isExiting = _useExitingPersistenc.isExiting;
|
|
44
45
|
|
|
@@ -51,8 +52,8 @@ var CustomSlideIn = function CustomSlideIn(_ref) {
|
|
|
51
52
|
return (0, _react2.jsx)(_motion.SlideIn, {
|
|
52
53
|
animationTimingFunction: _constants.animationTimingFunction,
|
|
53
54
|
duration: duration,
|
|
54
|
-
enterFrom:
|
|
55
|
-
exitTo:
|
|
55
|
+
enterFrom: enterFrom,
|
|
56
|
+
exitTo: enterFrom,
|
|
56
57
|
fade: "none",
|
|
57
58
|
onFinish: onFinish
|
|
58
59
|
}, children);
|
|
@@ -74,7 +75,9 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
74
75
|
isFocusLockEnabled = _ref2.isFocusLockEnabled,
|
|
75
76
|
width = _ref2.width,
|
|
76
77
|
label = _ref2.label,
|
|
77
|
-
titleId = _ref2.titleId
|
|
78
|
+
titleId = _ref2.titleId,
|
|
79
|
+
_ref2$enterFrom = _ref2.enterFrom,
|
|
80
|
+
enterFrom = _ref2$enterFrom === void 0 ? 'left' : _ref2$enterFrom;
|
|
78
81
|
var getOverrides = (0, _utils.createExtender)(defaults, overrides);
|
|
79
82
|
var _getOverrides = getOverrides('Sidebar'),
|
|
80
83
|
Sidebar = _getOverrides.component,
|
|
@@ -97,7 +100,8 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
97
100
|
return (0, _react2.jsx)(_motion.ExitingPersistence, {
|
|
98
101
|
appear: true
|
|
99
102
|
}, isOpen && (0, _react2.jsx)(CustomSlideIn, {
|
|
100
|
-
onFinish: onFinish
|
|
103
|
+
onFinish: onFinish,
|
|
104
|
+
enterFrom: enterFrom
|
|
101
105
|
}, function (_ref3) {
|
|
102
106
|
var className = _ref3.className;
|
|
103
107
|
return (0, _react2.jsx)(_focusLock.default, {
|
package/dist/cjs/constants.js
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.widths = exports.transitionTimingFunction = exports.transitionDurationMs = exports.transitionDuration = exports.defaultFocusLockSettings = exports.animationTimingFunction = void 0;
|
|
6
|
+
exports.widths = exports.transitionTimingFunction = exports.transitionDurationMs = exports.transitionDuration = exports.directions = exports.defaultFocusLockSettings = exports.animationTimingFunction = void 0;
|
|
7
7
|
var _curves = require("@atlaskit/motion/curves");
|
|
8
8
|
var transitionDuration = exports.transitionDuration = '0.22s';
|
|
9
9
|
var transitionDurationMs = exports.transitionDurationMs = 220;
|
|
10
10
|
var transitionTimingFunction = exports.transitionTimingFunction = _curves.easeOut;
|
|
11
11
|
var widths = exports.widths = ['narrow', 'medium', 'wide', 'extended', 'full'];
|
|
12
|
+
var directions = exports.directions = ['top', 'right', 'bottom', 'left'];
|
|
12
13
|
var animationTimingFunction = exports.animationTimingFunction = function animationTimingFunction() {
|
|
13
14
|
return _curves.easeOut;
|
|
14
15
|
};
|
|
@@ -4,13 +4,13 @@ import React, { Component } from 'react';
|
|
|
4
4
|
import { canUseDOM } from 'exenv';
|
|
5
5
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
6
6
|
import { UNSAFE_LAYERING, useCloseOnEscapePress } from '@atlaskit/layering';
|
|
7
|
-
import {
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
8
|
import Portal from '@atlaskit/portal';
|
|
9
9
|
import { defaultFocusLockSettings } from '../constants';
|
|
10
10
|
import Blanket from './blanket';
|
|
11
11
|
import DrawerPrimitive from './primitives';
|
|
12
12
|
const packageName = "@atlaskit/drawer";
|
|
13
|
-
const packageVersion = "7.
|
|
13
|
+
const packageVersion = "7.13.0";
|
|
14
14
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
15
15
|
const createAndFireOnClick = (createAnalyticsEvent, trigger) => createAndFireEventOnAtlaskit({
|
|
16
16
|
action: 'dismissed',
|
|
@@ -29,8 +29,8 @@ const EscapeCloseManager = ({
|
|
|
29
29
|
handleClose
|
|
30
30
|
}) => {
|
|
31
31
|
const onClose = React.useCallback(event => {
|
|
32
|
-
const analyticsEvent = createAnalyticsEvent && createAndFireOnClick(createAnalyticsEvent, 'escKey');
|
|
33
32
|
if (handleClose) {
|
|
33
|
+
const analyticsEvent = createAnalyticsEvent && createAndFireOnClick(createAnalyticsEvent, 'escKey');
|
|
34
34
|
handleClose(event, analyticsEvent);
|
|
35
35
|
}
|
|
36
36
|
}, [handleClose, createAnalyticsEvent]);
|
|
@@ -38,7 +38,7 @@ const EscapeCloseManager = ({
|
|
|
38
38
|
onClose: onClose
|
|
39
39
|
});
|
|
40
40
|
// only create a dummy component for using ths hook in class component
|
|
41
|
-
return /*#__PURE__*/React.createElement(
|
|
41
|
+
return /*#__PURE__*/React.createElement("span", null);
|
|
42
42
|
};
|
|
43
43
|
export class DrawerBase extends Component {
|
|
44
44
|
constructor(...args) {
|
|
@@ -68,7 +68,7 @@ export class DrawerBase extends Component {
|
|
|
68
68
|
isOpen,
|
|
69
69
|
onKeyDown
|
|
70
70
|
} = this.props;
|
|
71
|
-
if (!
|
|
71
|
+
if (!fg('platform.design-system-team.inline-message-layering_wfp1p')) {
|
|
72
72
|
// when feature flag on, we will use the EscapeCloseManager instead
|
|
73
73
|
if (event.key === 'Escape' && isOpen) {
|
|
74
74
|
this.handleClose(event, 'escKey');
|
|
@@ -123,11 +123,11 @@ export class DrawerBase extends Component {
|
|
|
123
123
|
overrides,
|
|
124
124
|
zIndex = 'unset',
|
|
125
125
|
label,
|
|
126
|
-
titleId
|
|
126
|
+
titleId,
|
|
127
|
+
enterFrom
|
|
127
128
|
} = this.props;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}, /*#__PURE__*/React.createElement(Portal, {
|
|
129
|
+
const shouldHaveLayeringEnabled = fg('platform.design-system-team.inline-message-layering_wfp1p') && isOpen;
|
|
130
|
+
return /*#__PURE__*/React.createElement(Portal, {
|
|
131
131
|
zIndex: zIndex
|
|
132
132
|
}, /*#__PURE__*/React.createElement(Blanket, {
|
|
133
133
|
isOpen: isOpen,
|
|
@@ -142,6 +142,7 @@ export class DrawerBase extends Component {
|
|
|
142
142
|
onCloseComplete: onCloseComplete,
|
|
143
143
|
onOpenComplete: onOpenComplete,
|
|
144
144
|
width: width,
|
|
145
|
+
enterFrom: enterFrom,
|
|
145
146
|
label: label,
|
|
146
147
|
titleId: titleId,
|
|
147
148
|
shouldUnmountOnExit: shouldUnmountOnExit
|
|
@@ -152,10 +153,12 @@ export class DrawerBase extends Component {
|
|
|
152
153
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
153
154
|
shouldReturnFocus: shouldReturnFocus,
|
|
154
155
|
scrollContentLabel: scrollContentLabel
|
|
155
|
-
},
|
|
156
|
+
}, shouldHaveLayeringEnabled ? /*#__PURE__*/React.createElement(UNSAFE_LAYERING, {
|
|
157
|
+
isDisabled: false
|
|
158
|
+
}, children, /*#__PURE__*/React.createElement(EscapeCloseManager, {
|
|
156
159
|
createAnalyticsEvent: this.props.createAnalyticsEvent,
|
|
157
160
|
handleClose: this.handleClose
|
|
158
|
-
}))));
|
|
161
|
+
})) : children));
|
|
159
162
|
}
|
|
160
163
|
}
|
|
161
164
|
_defineProperty(DrawerBase, "defaultProps", {
|
|
@@ -31,7 +31,8 @@ const defaults = {
|
|
|
31
31
|
*/
|
|
32
32
|
const CustomSlideIn = ({
|
|
33
33
|
children,
|
|
34
|
-
onFinish
|
|
34
|
+
onFinish,
|
|
35
|
+
enterFrom
|
|
35
36
|
}) => {
|
|
36
37
|
const {
|
|
37
38
|
isExiting
|
|
@@ -46,8 +47,8 @@ const CustomSlideIn = ({
|
|
|
46
47
|
return jsx(SlideIn, {
|
|
47
48
|
animationTimingFunction: animationTimingFunction,
|
|
48
49
|
duration: duration,
|
|
49
|
-
enterFrom:
|
|
50
|
-
exitTo:
|
|
50
|
+
enterFrom: enterFrom,
|
|
51
|
+
exitTo: enterFrom,
|
|
51
52
|
fade: "none",
|
|
52
53
|
onFinish: onFinish
|
|
53
54
|
}, children);
|
|
@@ -68,7 +69,8 @@ const DrawerPrimitive = ({
|
|
|
68
69
|
isFocusLockEnabled,
|
|
69
70
|
width,
|
|
70
71
|
label,
|
|
71
|
-
titleId
|
|
72
|
+
titleId,
|
|
73
|
+
enterFrom = 'left'
|
|
72
74
|
}) => {
|
|
73
75
|
const getOverrides = createExtender(defaults, overrides);
|
|
74
76
|
const {
|
|
@@ -94,7 +96,8 @@ const DrawerPrimitive = ({
|
|
|
94
96
|
return jsx(ExitingPersistence, {
|
|
95
97
|
appear: true
|
|
96
98
|
}, isOpen && jsx(CustomSlideIn, {
|
|
97
|
-
onFinish: onFinish
|
|
99
|
+
onFinish: onFinish,
|
|
100
|
+
enterFrom: enterFrom
|
|
98
101
|
}, ({
|
|
99
102
|
className
|
|
100
103
|
}) => jsx(FocusLock, {
|
package/dist/es2019/constants.js
CHANGED
|
@@ -3,6 +3,7 @@ export const transitionDuration = '0.22s';
|
|
|
3
3
|
export const transitionDurationMs = 220;
|
|
4
4
|
export const transitionTimingFunction = easeOut;
|
|
5
5
|
export const widths = ['narrow', 'medium', 'wide', 'extended', 'full'];
|
|
6
|
+
export const directions = ['top', 'right', 'bottom', 'left'];
|
|
6
7
|
export const animationTimingFunction = () => easeOut;
|
|
7
8
|
export const defaultFocusLockSettings = {
|
|
8
9
|
isFocusLockEnabled: true,
|
|
@@ -14,13 +14,13 @@ import React, { Component } from 'react';
|
|
|
14
14
|
import { canUseDOM } from 'exenv';
|
|
15
15
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
16
|
import { UNSAFE_LAYERING, useCloseOnEscapePress } from '@atlaskit/layering';
|
|
17
|
-
import {
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
18
|
import Portal from '@atlaskit/portal';
|
|
19
19
|
import { defaultFocusLockSettings } from '../constants';
|
|
20
20
|
import Blanket from './blanket';
|
|
21
21
|
import DrawerPrimitive from './primitives';
|
|
22
22
|
var packageName = "@atlaskit/drawer";
|
|
23
|
-
var packageVersion = "7.
|
|
23
|
+
var packageVersion = "7.13.0";
|
|
24
24
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
25
25
|
var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
|
|
26
26
|
return createAndFireEventOnAtlaskit({
|
|
@@ -40,16 +40,16 @@ var EscapeCloseManager = function EscapeCloseManager(_ref) {
|
|
|
40
40
|
var createAnalyticsEvent = _ref.createAnalyticsEvent,
|
|
41
41
|
handleClose = _ref.handleClose;
|
|
42
42
|
var onClose = React.useCallback(function (event) {
|
|
43
|
-
var analyticsEvent = createAnalyticsEvent && createAndFireOnClick(createAnalyticsEvent, 'escKey');
|
|
44
43
|
if (handleClose) {
|
|
45
|
-
|
|
44
|
+
var _analyticsEvent = createAnalyticsEvent && createAndFireOnClick(createAnalyticsEvent, 'escKey');
|
|
45
|
+
handleClose(event, _analyticsEvent);
|
|
46
46
|
}
|
|
47
47
|
}, [handleClose, createAnalyticsEvent]);
|
|
48
48
|
useCloseOnEscapePress({
|
|
49
49
|
onClose: onClose
|
|
50
50
|
});
|
|
51
51
|
// only create a dummy component for using ths hook in class component
|
|
52
|
-
return /*#__PURE__*/React.createElement(
|
|
52
|
+
return /*#__PURE__*/React.createElement("span", null);
|
|
53
53
|
};
|
|
54
54
|
export var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
55
55
|
_inherits(DrawerBase, _Component);
|
|
@@ -84,7 +84,7 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
84
84
|
var _this$props2 = _this.props,
|
|
85
85
|
isOpen = _this$props2.isOpen,
|
|
86
86
|
onKeyDown = _this$props2.onKeyDown;
|
|
87
|
-
if (!
|
|
87
|
+
if (!fg('platform.design-system-team.inline-message-layering_wfp1p')) {
|
|
88
88
|
// when feature flag on, we will use the EscapeCloseManager instead
|
|
89
89
|
if (event.key === 'Escape' && isOpen) {
|
|
90
90
|
_this.handleClose(event, 'escKey');
|
|
@@ -145,10 +145,10 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
145
145
|
_this$props3$zIndex = _this$props3.zIndex,
|
|
146
146
|
zIndex = _this$props3$zIndex === void 0 ? 'unset' : _this$props3$zIndex,
|
|
147
147
|
label = _this$props3.label,
|
|
148
|
-
titleId = _this$props3.titleId
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
148
|
+
titleId = _this$props3.titleId,
|
|
149
|
+
enterFrom = _this$props3.enterFrom;
|
|
150
|
+
var shouldHaveLayeringEnabled = fg('platform.design-system-team.inline-message-layering_wfp1p') && isOpen;
|
|
151
|
+
return /*#__PURE__*/React.createElement(Portal, {
|
|
152
152
|
zIndex: zIndex
|
|
153
153
|
}, /*#__PURE__*/React.createElement(Blanket, {
|
|
154
154
|
isOpen: isOpen,
|
|
@@ -163,6 +163,7 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
163
163
|
onCloseComplete: onCloseComplete,
|
|
164
164
|
onOpenComplete: onOpenComplete,
|
|
165
165
|
width: width,
|
|
166
|
+
enterFrom: enterFrom,
|
|
166
167
|
label: label,
|
|
167
168
|
titleId: titleId,
|
|
168
169
|
shouldUnmountOnExit: shouldUnmountOnExit
|
|
@@ -173,10 +174,12 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
173
174
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
174
175
|
shouldReturnFocus: shouldReturnFocus,
|
|
175
176
|
scrollContentLabel: scrollContentLabel
|
|
176
|
-
},
|
|
177
|
+
}, shouldHaveLayeringEnabled ? /*#__PURE__*/React.createElement(UNSAFE_LAYERING, {
|
|
178
|
+
isDisabled: false
|
|
179
|
+
}, children, /*#__PURE__*/React.createElement(EscapeCloseManager, {
|
|
177
180
|
createAnalyticsEvent: this.props.createAnalyticsEvent,
|
|
178
181
|
handleClose: this.handleClose
|
|
179
|
-
}))));
|
|
182
|
+
})) : children));
|
|
180
183
|
}
|
|
181
184
|
}]);
|
|
182
185
|
return DrawerBase;
|
|
@@ -34,7 +34,8 @@ var defaults = {
|
|
|
34
34
|
*/
|
|
35
35
|
var CustomSlideIn = function CustomSlideIn(_ref) {
|
|
36
36
|
var children = _ref.children,
|
|
37
|
-
onFinish = _ref.onFinish
|
|
37
|
+
onFinish = _ref.onFinish,
|
|
38
|
+
enterFrom = _ref.enterFrom;
|
|
38
39
|
var _useExitingPersistenc = useExitingPersistence(),
|
|
39
40
|
isExiting = _useExitingPersistenc.isExiting;
|
|
40
41
|
|
|
@@ -47,8 +48,8 @@ var CustomSlideIn = function CustomSlideIn(_ref) {
|
|
|
47
48
|
return jsx(SlideIn, {
|
|
48
49
|
animationTimingFunction: animationTimingFunction,
|
|
49
50
|
duration: duration,
|
|
50
|
-
enterFrom:
|
|
51
|
-
exitTo:
|
|
51
|
+
enterFrom: enterFrom,
|
|
52
|
+
exitTo: enterFrom,
|
|
52
53
|
fade: "none",
|
|
53
54
|
onFinish: onFinish
|
|
54
55
|
}, children);
|
|
@@ -70,7 +71,9 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
70
71
|
isFocusLockEnabled = _ref2.isFocusLockEnabled,
|
|
71
72
|
width = _ref2.width,
|
|
72
73
|
label = _ref2.label,
|
|
73
|
-
titleId = _ref2.titleId
|
|
74
|
+
titleId = _ref2.titleId,
|
|
75
|
+
_ref2$enterFrom = _ref2.enterFrom,
|
|
76
|
+
enterFrom = _ref2$enterFrom === void 0 ? 'left' : _ref2$enterFrom;
|
|
74
77
|
var getOverrides = createExtender(defaults, overrides);
|
|
75
78
|
var _getOverrides = getOverrides('Sidebar'),
|
|
76
79
|
Sidebar = _getOverrides.component,
|
|
@@ -93,7 +96,8 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
93
96
|
return jsx(ExitingPersistence, {
|
|
94
97
|
appear: true
|
|
95
98
|
}, isOpen && jsx(CustomSlideIn, {
|
|
96
|
-
onFinish: onFinish
|
|
99
|
+
onFinish: onFinish,
|
|
100
|
+
enterFrom: enterFrom
|
|
97
101
|
}, function (_ref3) {
|
|
98
102
|
var className = _ref3.className;
|
|
99
103
|
return jsx(FocusLock, {
|
package/dist/esm/constants.js
CHANGED
|
@@ -3,6 +3,7 @@ export var transitionDuration = '0.22s';
|
|
|
3
3
|
export var transitionDurationMs = 220;
|
|
4
4
|
export var transitionTimingFunction = easeOut;
|
|
5
5
|
export var widths = ['narrow', 'medium', 'wide', 'extended', 'full'];
|
|
6
|
+
export var directions = ['top', 'right', 'bottom', 'left'];
|
|
6
7
|
export var animationTimingFunction = function animationTimingFunction() {
|
|
7
8
|
return easeOut;
|
|
8
9
|
};
|
|
@@ -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>, "scrollContentLabel" | "children" | "onKeyDown" | "onClose" | "testId" | "icon" | "closeLabel" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | keyof import("./types").DrawerLabel> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | keyof import("./types").FocusLockSettings>> & Partial<Pick<{
|
|
25
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "scrollContentLabel" | "children" | "onKeyDown" | "onClose" | "testId" | "icon" | "closeLabel" | "enterFrom" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | keyof import("./types").DrawerLabel> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | keyof import("./types").FocusLockSettings>> & Partial<Pick<{
|
|
26
26
|
autoFocusFirstElem?: boolean | (() => HTMLElement | null) | undefined;
|
|
27
27
|
isFocusLockEnabled?: boolean | undefined;
|
|
28
28
|
shouldReturnFocus?: boolean | React.RefObject<HTMLElement> | undefined;
|
|
29
29
|
width: DrawerWidth;
|
|
30
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "scrollContentLabel" | "width" | "children" | "onKeyDown" | "key" | "onClose" | "testId" | "icon" | "closeLabel" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | "analyticsContext" | keyof import("./types").FocusLockSettings | keyof import("./types").DrawerLabel> & React.RefAttributes<any>>;
|
|
30
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "scrollContentLabel" | "width" | "children" | "onKeyDown" | "key" | "onClose" | "testId" | "icon" | "closeLabel" | "enterFrom" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | "analyticsContext" | keyof import("./types").FocusLockSettings | keyof import("./types").DrawerLabel> & React.RefAttributes<any>>;
|
|
31
31
|
export default _default;
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { type DrawerPrimitiveProps } from '../types';
|
|
7
|
-
declare const DrawerPrimitive: ({ children, icon: Icon, closeLabel, scrollContentLabel, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, shouldReturnFocus, autoFocusFirstElem, isFocusLockEnabled, width, label, titleId, }: DrawerPrimitiveProps) => jsx.JSX.Element;
|
|
7
|
+
declare const DrawerPrimitive: ({ children, icon: Icon, closeLabel, scrollContentLabel, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, shouldReturnFocus, autoFocusFirstElem, isFocusLockEnabled, width, label, titleId, enterFrom, }: DrawerPrimitiveProps) => jsx.JSX.Element;
|
|
8
8
|
export default DrawerPrimitive;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentType, type ReactElement, type ReactNode, type RefObject, type SyntheticEvent } from 'react';
|
|
2
2
|
import { type CSSObject } from '@emotion/react';
|
|
3
3
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
4
|
+
import { type Direction } from '@atlaskit/motion';
|
|
4
5
|
export type Widths = {
|
|
5
6
|
extended: {
|
|
6
7
|
width: string;
|
|
@@ -44,6 +45,10 @@ export interface BaseProps {
|
|
|
44
45
|
* Sets the width of the drawer.
|
|
45
46
|
*/
|
|
46
47
|
width?: DrawerWidth;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the direction the draw enters from. The default is "left".
|
|
50
|
+
*/
|
|
51
|
+
enterFrom?: Direction;
|
|
47
52
|
/**
|
|
48
53
|
* A callback function that will be called when the drawer has finished its opening transition.
|
|
49
54
|
*/
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { Direction } from '@atlaskit/motion';
|
|
1
2
|
import type { DrawerWidth, FocusLockSettings } from './components/types';
|
|
2
3
|
export declare const transitionDuration = "0.22s";
|
|
3
4
|
export declare const transitionDurationMs = 220;
|
|
4
5
|
export declare const transitionTimingFunction: import("@atlaskit/motion/curves").AnimationCurve;
|
|
5
6
|
export declare const widths: DrawerWidth[];
|
|
7
|
+
export declare const directions: Direction[];
|
|
6
8
|
export declare const animationTimingFunction: () => import("@atlaskit/motion/curves").AnimationCurve;
|
|
7
9
|
export declare const defaultFocusLockSettings: FocusLockSettings;
|
|
@@ -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>, "scrollContentLabel" | "children" | "onKeyDown" | "onClose" | "testId" | "icon" | "closeLabel" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | keyof import("./types").DrawerLabel> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | keyof import("./types").FocusLockSettings>> & Partial<Pick<{
|
|
25
|
+
declare const _default: React.ForwardRefExoticComponent<Pick<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "scrollContentLabel" | "children" | "onKeyDown" | "onClose" | "testId" | "icon" | "closeLabel" | "enterFrom" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | keyof import("./types").DrawerLabel> & Partial<Pick<Omit<DrawerProps, keyof import("@atlaskit/analytics-next").WithAnalyticsEventsProps>, "width" | keyof import("./types").FocusLockSettings>> & Partial<Pick<{
|
|
26
26
|
autoFocusFirstElem?: boolean | (() => HTMLElement | null) | undefined;
|
|
27
27
|
isFocusLockEnabled?: boolean | undefined;
|
|
28
28
|
shouldReturnFocus?: boolean | React.RefObject<HTMLElement> | undefined;
|
|
29
29
|
width: DrawerWidth;
|
|
30
|
-
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "scrollContentLabel" | "width" | "children" | "onKeyDown" | "key" | "onClose" | "testId" | "icon" | "closeLabel" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | "analyticsContext" | keyof import("./types").FocusLockSettings | keyof import("./types").DrawerLabel> & React.RefAttributes<any>>;
|
|
30
|
+
}, never>> & React.RefAttributes<any> & import("@atlaskit/analytics-next").WithContextProps, "scrollContentLabel" | "width" | "children" | "onKeyDown" | "key" | "onClose" | "testId" | "icon" | "closeLabel" | "enterFrom" | "onOpenComplete" | "onCloseComplete" | "shouldUnmountOnExit" | "overrides" | "zIndex" | "isOpen" | "analyticsContext" | keyof import("./types").FocusLockSettings | keyof import("./types").DrawerLabel> & React.RefAttributes<any>>;
|
|
31
31
|
export default _default;
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
/** @jsx jsx */
|
|
5
5
|
import { jsx } from '@emotion/react';
|
|
6
6
|
import { type DrawerPrimitiveProps } from '../types';
|
|
7
|
-
declare const DrawerPrimitive: ({ children, icon: Icon, closeLabel, scrollContentLabel, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, shouldReturnFocus, autoFocusFirstElem, isFocusLockEnabled, width, label, titleId, }: DrawerPrimitiveProps) => jsx.JSX.Element;
|
|
7
|
+
declare const DrawerPrimitive: ({ children, icon: Icon, closeLabel, scrollContentLabel, onClose, onCloseComplete, onOpenComplete, overrides, testId, in: isOpen, shouldReturnFocus, autoFocusFirstElem, isFocusLockEnabled, width, label, titleId, enterFrom, }: DrawerPrimitiveProps) => jsx.JSX.Element;
|
|
8
8
|
export default DrawerPrimitive;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ComponentType, type ReactElement, type ReactNode, type RefObject, type SyntheticEvent } from 'react';
|
|
2
2
|
import { type CSSObject } from '@emotion/react';
|
|
3
3
|
import { type WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
|
|
4
|
+
import { type Direction } from '@atlaskit/motion';
|
|
4
5
|
export type Widths = {
|
|
5
6
|
extended: {
|
|
6
7
|
width: string;
|
|
@@ -44,6 +45,10 @@ export interface BaseProps {
|
|
|
44
45
|
* Sets the width of the drawer.
|
|
45
46
|
*/
|
|
46
47
|
width?: DrawerWidth;
|
|
48
|
+
/**
|
|
49
|
+
* Sets the direction the draw enters from. The default is "left".
|
|
50
|
+
*/
|
|
51
|
+
enterFrom?: Direction;
|
|
47
52
|
/**
|
|
48
53
|
* A callback function that will be called when the drawer has finished its opening transition.
|
|
49
54
|
*/
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { Direction } from '@atlaskit/motion';
|
|
1
2
|
import type { DrawerWidth, FocusLockSettings } from './components/types';
|
|
2
3
|
export declare const transitionDuration = "0.22s";
|
|
3
4
|
export declare const transitionDurationMs = 220;
|
|
4
5
|
export declare const transitionTimingFunction: import("@atlaskit/motion/curves").AnimationCurve;
|
|
5
6
|
export declare const widths: DrawerWidth[];
|
|
7
|
+
export declare const directions: Direction[];
|
|
6
8
|
export declare const animationTimingFunction: () => import("@atlaskit/motion/curves").AnimationCurve;
|
|
7
9
|
export declare const defaultFocusLockSettings: FocusLockSettings;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/drawer",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.13.0",
|
|
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/"
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@atlaskit/analytics-next": "^9.3.0",
|
|
44
44
|
"@atlaskit/blanket": "^13.2.0",
|
|
45
|
-
"@atlaskit/button": "^18.
|
|
45
|
+
"@atlaskit/button": "^18.1.0",
|
|
46
46
|
"@atlaskit/icon": "^22.5.0",
|
|
47
47
|
"@atlaskit/layering": "^0.3.0",
|
|
48
48
|
"@atlaskit/motion": "^1.7.0",
|