@atlaskit/drawer 7.10.0 → 7.12.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 +710 -691
- package/dist/cjs/components/blanket.js +16 -8
- package/dist/cjs/components/index.js +4 -2
- package/dist/cjs/components/primitives/content.js +41 -14
- package/dist/cjs/components/primitives/drawer-wrapper.js +10 -2
- package/dist/cjs/components/primitives/index.js +11 -2
- package/dist/cjs/components/primitives/sidebar.js +5 -1
- package/dist/es2019/components/blanket.js +8 -1
- package/dist/es2019/components/index.js +4 -2
- package/dist/es2019/components/primitives/content.js +37 -11
- package/dist/es2019/components/primitives/drawer-wrapper.js +11 -2
- package/dist/es2019/components/primitives/index.js +12 -2
- package/dist/es2019/components/primitives/sidebar.js +5 -1
- package/dist/esm/components/blanket.js +16 -8
- package/dist/esm/components/index.js +4 -2
- package/dist/esm/components/primitives/content.js +41 -13
- package/dist/esm/components/primitives/drawer-wrapper.js +11 -2
- package/dist/esm/components/primitives/index.js +12 -2
- package/dist/esm/components/primitives/sidebar.js +5 -1
- package/dist/types/components/blanket.d.ts +3 -0
- package/dist/types/components/index.d.ts +2 -2
- package/dist/types/components/primitives/content.d.ts +4 -1
- package/dist/types/components/primitives/drawer-wrapper.d.ts +3 -0
- package/dist/types/components/primitives/index.d.ts +4 -1
- package/dist/types/components/primitives/sidebar.d.ts +3 -0
- package/dist/types/components/types.d.ts +8 -0
- package/dist/types-ts4.5/components/blanket.d.ts +3 -0
- package/dist/types-ts4.5/components/index.d.ts +2 -2
- package/dist/types-ts4.5/components/primitives/content.d.ts +4 -1
- package/dist/types-ts4.5/components/primitives/drawer-wrapper.d.ts +3 -0
- package/dist/types-ts4.5/components/primitives/index.d.ts +4 -1
- package/dist/types-ts4.5/components/primitives/sidebar.d.ts +3 -0
- package/dist/types-ts4.5/components/types.d.ts +8 -0
- package/package.json +100 -102
- package/report.api.md +117 -128
|
@@ -10,8 +10,13 @@ var _react2 = require("@emotion/react");
|
|
|
10
10
|
var _blanket = _interopRequireDefault(require("@atlaskit/blanket"));
|
|
11
11
|
var _motion = require("@atlaskit/motion");
|
|
12
12
|
var _constants = require("../constants");
|
|
13
|
+
/**
|
|
14
|
+
* @jsxRuntime classic
|
|
15
|
+
*/
|
|
13
16
|
/** @jsx jsx */
|
|
14
17
|
|
|
18
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
19
|
+
|
|
15
20
|
var blanketStyles = (0, _react2.css)({
|
|
16
21
|
position: 'relative'
|
|
17
22
|
});
|
|
@@ -42,14 +47,17 @@ var Blanket = function Blanket(_ref) {
|
|
|
42
47
|
animationTimingFunction: _constants.animationTimingFunction
|
|
43
48
|
}, function (_ref2) {
|
|
44
49
|
var className = _ref2.className;
|
|
45
|
-
return (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
return (
|
|
51
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
52
|
+
(0, _react2.jsx)("div", {
|
|
53
|
+
css: blanketStyles,
|
|
54
|
+
className: className
|
|
55
|
+
}, (0, _react2.jsx)(_blanket.default, {
|
|
56
|
+
isTinted: true,
|
|
57
|
+
onBlanketClicked: onBlanketClicked,
|
|
58
|
+
testId: testId && testId
|
|
59
|
+
}))
|
|
60
|
+
);
|
|
53
61
|
}));
|
|
54
62
|
};
|
|
55
63
|
var _default = exports.default = Blanket;
|
|
@@ -27,7 +27,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
27
27
|
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); }; }
|
|
28
28
|
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 */
|
|
29
29
|
var packageName = "@atlaskit/drawer";
|
|
30
|
-
var packageVersion = "7.
|
|
30
|
+
var packageVersion = "7.12.0";
|
|
31
31
|
var createAndFireEventOnAtlaskit = (0, _analyticsNext.createAndFireEvent)('atlaskit');
|
|
32
32
|
var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
|
|
33
33
|
return createAndFireEventOnAtlaskit({
|
|
@@ -120,6 +120,7 @@ var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
120
120
|
children = _this$props3.children,
|
|
121
121
|
icon = _this$props3.icon,
|
|
122
122
|
closeLabel = _this$props3.closeLabel,
|
|
123
|
+
scrollContentLabel = _this$props3.scrollContentLabel,
|
|
123
124
|
width = _this$props3.width,
|
|
124
125
|
shouldUnmountOnExit = _this$props3.shouldUnmountOnExit,
|
|
125
126
|
onCloseComplete = _this$props3.onCloseComplete,
|
|
@@ -155,7 +156,8 @@ var DrawerBase = exports.DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
155
156
|
overrides: overrides,
|
|
156
157
|
autoFocusFirstElem: autoFocusFirstElem,
|
|
157
158
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
158
|
-
shouldReturnFocus: shouldReturnFocus
|
|
159
|
+
shouldReturnFocus: shouldReturnFocus,
|
|
160
|
+
scrollContentLabel: scrollContentLabel
|
|
159
161
|
}, children));
|
|
160
162
|
}
|
|
161
163
|
}]);
|
|
@@ -6,10 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react = require("
|
|
11
|
-
var
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
var _excluded = ["cssFn", "scrollContentLabel"];
|
|
14
|
+
/**
|
|
15
|
+
* @jsxRuntime classic
|
|
16
|
+
*/
|
|
12
17
|
/** @jsx jsx */
|
|
18
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
19
|
var defaultStyles = {
|
|
14
20
|
flex: 1,
|
|
15
21
|
overflow: 'auto',
|
|
@@ -20,20 +26,41 @@ var contentCSS = function contentCSS() {
|
|
|
20
26
|
};
|
|
21
27
|
var Content = function Content(_ref) {
|
|
22
28
|
var cssFn = _ref.cssFn,
|
|
29
|
+
_ref$scrollContentLab = _ref.scrollContentLabel,
|
|
30
|
+
scrollContentLabel = _ref$scrollContentLab === void 0 ? 'Scrollable content' : _ref$scrollContentLab,
|
|
23
31
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
var _useState = (0, _react.useState)(false),
|
|
33
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
34
|
+
showContentFocus = _useState2[0],
|
|
35
|
+
setContentFocus = _useState2[1];
|
|
36
|
+
var scrollableRef = (0, _react.useRef)(null);
|
|
37
|
+
(0, _react.useEffect)(function () {
|
|
38
|
+
var setLazyContentFocus = function setLazyContentFocus() {
|
|
39
|
+
var target = scrollableRef.current;
|
|
40
|
+
target && setContentFocus(target.scrollHeight > target.clientHeight);
|
|
41
|
+
};
|
|
42
|
+
setLazyContentFocus();
|
|
43
|
+
}, []);
|
|
31
44
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
45
|
+
/**
|
|
46
|
+
* I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
|
|
47
|
+
* than the defaultStyles as the overrides guide suggests. I went with what the overrides
|
|
48
|
+
* guide suggested as it made more sense as a transformer of the current styles rather than
|
|
49
|
+
* a complete override with no chance of partially changing styles.
|
|
50
|
+
*/
|
|
51
|
+
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
52
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
53
|
+
css: (0, _react2.css)(cssFn(defaultStyles)),
|
|
54
|
+
ref: scrollableRef
|
|
55
|
+
// tabindex is allowed here so that keyboard users can scroll content
|
|
56
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
57
|
+
,
|
|
58
|
+
tabIndex: showContentFocus ? 0 : undefined,
|
|
59
|
+
role: showContentFocus ? 'region' : undefined,
|
|
60
|
+
"aria-label": showContentFocus ? scrollContentLabel : undefined,
|
|
61
|
+
"data-testId": "drawer-contents"
|
|
62
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
63
|
+
}, props));
|
|
37
64
|
};
|
|
38
65
|
var _default = exports.default = {
|
|
39
66
|
component: Content,
|
|
@@ -13,7 +13,11 @@ var _colors = require("@atlaskit/theme/colors");
|
|
|
13
13
|
var _tokens = require("@atlaskit/tokens");
|
|
14
14
|
var _usePreventProgrammaticScroll = _interopRequireDefault(require("./hooks/use-prevent-programmatic-scroll"));
|
|
15
15
|
var _css;
|
|
16
|
+
/**
|
|
17
|
+
* @jsxRuntime classic
|
|
18
|
+
*/
|
|
16
19
|
/** @jsx jsx */
|
|
20
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
21
|
var wrapperWidth = exports.wrapperWidth = {
|
|
18
22
|
full: {
|
|
19
23
|
width: '100vw'
|
|
@@ -67,8 +71,12 @@ var DrawerWrapper = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, scrollRe
|
|
|
67
71
|
var ref = (0, _useCallbackRef.useMergeRefs)([drawerRef, assignSecondChildRef]);
|
|
68
72
|
(0, _usePreventProgrammaticScroll.default)();
|
|
69
73
|
return (0, _react2.jsx)("div", {
|
|
70
|
-
css: wrapperStyles
|
|
71
|
-
style
|
|
74
|
+
css: wrapperStyles
|
|
75
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
76
|
+
,
|
|
77
|
+
style: wrapperWidth[width]
|
|
78
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
79
|
+
,
|
|
72
80
|
className: className,
|
|
73
81
|
"data-testid": testId,
|
|
74
82
|
ref: ref,
|
|
@@ -20,7 +20,11 @@ var _focusLock = _interopRequireDefault(require("./focus-lock"));
|
|
|
20
20
|
var _sidebar = _interopRequireDefault(require("./sidebar"));
|
|
21
21
|
var _excluded = ["component"],
|
|
22
22
|
_excluded2 = ["component"];
|
|
23
|
+
/**
|
|
24
|
+
* @jsxRuntime classic
|
|
25
|
+
*/
|
|
23
26
|
/** @jsx jsx */
|
|
27
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
24
28
|
// Misc.
|
|
25
29
|
// ------------------------------
|
|
26
30
|
|
|
@@ -58,6 +62,7 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
58
62
|
Icon = _ref2.icon,
|
|
59
63
|
_ref2$closeLabel = _ref2.closeLabel,
|
|
60
64
|
closeLabel = _ref2$closeLabel === void 0 ? 'Close drawer' : _ref2$closeLabel,
|
|
65
|
+
scrollContentLabel = _ref2.scrollContentLabel,
|
|
61
66
|
onClose = _ref2.onClose,
|
|
62
67
|
onCloseComplete = _ref2.onCloseComplete,
|
|
63
68
|
onOpenComplete = _ref2.onOpenComplete,
|
|
@@ -99,7 +104,9 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
99
104
|
autoFocusFirstElem: autoFocusFirstElem,
|
|
100
105
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
101
106
|
shouldReturnFocus: shouldReturnFocus
|
|
102
|
-
}, (0, _react2.jsx)(_drawerWrapper.default
|
|
107
|
+
}, (0, _react2.jsx)(_drawerWrapper.default
|
|
108
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
109
|
+
, {
|
|
103
110
|
className: className,
|
|
104
111
|
width: width,
|
|
105
112
|
testId: testId,
|
|
@@ -117,7 +124,9 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
117
124
|
label: closeLabel,
|
|
118
125
|
shape: "circle",
|
|
119
126
|
appearance: "subtle"
|
|
120
|
-
})), (0, _react2.jsx)(Content,
|
|
127
|
+
})), (0, _react2.jsx)(Content, (0, _extends2.default)({
|
|
128
|
+
scrollContentLabel: scrollContentLabel
|
|
129
|
+
}, contentOverrides), children)));
|
|
121
130
|
}));
|
|
122
131
|
};
|
|
123
132
|
|
|
@@ -10,7 +10,11 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
10
10
|
var _react = require("@emotion/react");
|
|
11
11
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
12
|
var _excluded = ["cssFn"];
|
|
13
|
+
/**
|
|
14
|
+
* @jsxRuntime classic
|
|
15
|
+
*/
|
|
13
16
|
/** @jsx jsx */
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
14
18
|
var defaultStyle = {
|
|
15
19
|
alignItems: 'center',
|
|
16
20
|
boxSizing: 'border-box',
|
|
@@ -29,7 +33,7 @@ var sidebarCSS = function sidebarCSS() {
|
|
|
29
33
|
var Sidebar = function Sidebar(_ref) {
|
|
30
34
|
var cssFn = _ref.cssFn,
|
|
31
35
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
32
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
|
|
36
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
33
37
|
return (0, _react.jsx)("div", (0, _extends2.default)({
|
|
34
38
|
css: (0, _react.css)(cssFn(defaultStyle))
|
|
35
39
|
}, props));
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import React from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
8
|
import { css, jsx } from '@emotion/react';
|
|
4
9
|
import AkBlanket from '@atlaskit/blanket';
|
|
5
10
|
import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
|
|
@@ -35,7 +40,9 @@ const Blanket = ({
|
|
|
35
40
|
animationTimingFunction: animationTimingFunction
|
|
36
41
|
}, ({
|
|
37
42
|
className
|
|
38
|
-
}) =>
|
|
43
|
+
}) =>
|
|
44
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
45
|
+
jsx("div", {
|
|
39
46
|
css: blanketStyles,
|
|
40
47
|
className: className
|
|
41
48
|
}, jsx(AkBlanket, {
|
|
@@ -8,7 +8,7 @@ import { defaultFocusLockSettings } from '../constants';
|
|
|
8
8
|
import Blanket from './blanket';
|
|
9
9
|
import DrawerPrimitive from './primitives';
|
|
10
10
|
const packageName = "@atlaskit/drawer";
|
|
11
|
-
const packageVersion = "7.
|
|
11
|
+
const packageVersion = "7.12.0";
|
|
12
12
|
const createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
13
13
|
const createAndFireOnClick = (createAnalyticsEvent, trigger) => createAndFireEventOnAtlaskit({
|
|
14
14
|
action: 'dismissed',
|
|
@@ -89,6 +89,7 @@ export class DrawerBase extends Component {
|
|
|
89
89
|
children,
|
|
90
90
|
icon,
|
|
91
91
|
closeLabel,
|
|
92
|
+
scrollContentLabel,
|
|
92
93
|
width,
|
|
93
94
|
shouldUnmountOnExit,
|
|
94
95
|
onCloseComplete,
|
|
@@ -124,7 +125,8 @@ export class DrawerBase extends Component {
|
|
|
124
125
|
overrides: overrides,
|
|
125
126
|
autoFocusFirstElem: autoFocusFirstElem,
|
|
126
127
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
127
|
-
shouldReturnFocus: shouldReturnFocus
|
|
128
|
+
shouldReturnFocus: shouldReturnFocus,
|
|
129
|
+
scrollContentLabel: scrollContentLabel
|
|
128
130
|
}, children));
|
|
129
131
|
}
|
|
130
132
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
*/
|
|
2
5
|
/** @jsx jsx */
|
|
3
6
|
|
|
7
|
+
import { useEffect, useRef, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
10
|
import { css, jsx } from '@emotion/react';
|
|
5
11
|
const defaultStyles = {
|
|
6
12
|
flex: 1,
|
|
@@ -10,19 +16,39 @@ const defaultStyles = {
|
|
|
10
16
|
const contentCSS = () => defaultStyles;
|
|
11
17
|
const Content = ({
|
|
12
18
|
cssFn,
|
|
19
|
+
scrollContentLabel = 'Scrollable content',
|
|
13
20
|
...props
|
|
14
|
-
}) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
}) => {
|
|
22
|
+
const [showContentFocus, setContentFocus] = useState(false);
|
|
23
|
+
const scrollableRef = useRef(null);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const setLazyContentFocus = () => {
|
|
26
|
+
const target = scrollableRef.current;
|
|
27
|
+
target && setContentFocus(target.scrollHeight > target.clientHeight);
|
|
28
|
+
};
|
|
29
|
+
setLazyContentFocus();
|
|
30
|
+
}, []);
|
|
21
31
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
32
|
+
/**
|
|
33
|
+
* I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
|
|
34
|
+
* than the defaultStyles as the overrides guide suggests. I went with what the overrides
|
|
35
|
+
* guide suggested as it made more sense as a transformer of the current styles rather than
|
|
36
|
+
* a complete override with no chance of partially changing styles.
|
|
37
|
+
*/
|
|
38
|
+
return jsx("div", _extends({
|
|
39
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
40
|
+
css: css(cssFn(defaultStyles)),
|
|
41
|
+
ref: scrollableRef
|
|
42
|
+
// tabindex is allowed here so that keyboard users can scroll content
|
|
43
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
44
|
+
,
|
|
45
|
+
tabIndex: showContentFocus ? 0 : undefined,
|
|
46
|
+
role: showContentFocus ? 'region' : undefined,
|
|
47
|
+
"aria-label": showContentFocus ? scrollContentLabel : undefined,
|
|
48
|
+
"data-testId": "drawer-contents"
|
|
49
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
50
|
+
}, props));
|
|
51
|
+
};
|
|
26
52
|
export default {
|
|
27
53
|
component: Content,
|
|
28
54
|
cssFn: contentCSS
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import { forwardRef, useCallback } from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
8
|
import { css, jsx } from '@emotion/react';
|
|
4
9
|
import { useMergeRefs } from 'use-callback-ref';
|
|
5
10
|
import { N0 } from '@atlaskit/theme/colors';
|
|
@@ -62,8 +67,12 @@ const DrawerWrapper = /*#__PURE__*/forwardRef(({
|
|
|
62
67
|
const ref = useMergeRefs([drawerRef, assignSecondChildRef]);
|
|
63
68
|
usePreventProgrammaticScroll();
|
|
64
69
|
return jsx("div", {
|
|
65
|
-
css: wrapperStyles
|
|
66
|
-
style
|
|
70
|
+
css: wrapperStyles
|
|
71
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
72
|
+
,
|
|
73
|
+
style: wrapperWidth[width]
|
|
74
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
75
|
+
,
|
|
67
76
|
className: className,
|
|
68
77
|
"data-testid": testId,
|
|
69
78
|
ref: ref,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
*/
|
|
2
5
|
/** @jsx jsx */
|
|
3
6
|
|
|
4
7
|
import { useCallback, useRef } from 'react';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
10
|
import { jsx } from '@emotion/react';
|
|
6
11
|
import { IconButton } from '@atlaskit/button/new';
|
|
7
12
|
import ArrowLeft from '@atlaskit/icon/glyph/arrow-left';
|
|
@@ -51,6 +56,7 @@ const DrawerPrimitive = ({
|
|
|
51
56
|
children,
|
|
52
57
|
icon: Icon,
|
|
53
58
|
closeLabel = 'Close drawer',
|
|
59
|
+
scrollContentLabel,
|
|
54
60
|
onClose,
|
|
55
61
|
onCloseComplete,
|
|
56
62
|
onOpenComplete,
|
|
@@ -95,7 +101,9 @@ const DrawerPrimitive = ({
|
|
|
95
101
|
autoFocusFirstElem: autoFocusFirstElem,
|
|
96
102
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
97
103
|
shouldReturnFocus: shouldReturnFocus
|
|
98
|
-
}, jsx(DrawerWrapper
|
|
104
|
+
}, jsx(DrawerWrapper
|
|
105
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
106
|
+
, {
|
|
99
107
|
className: className,
|
|
100
108
|
width: width,
|
|
101
109
|
testId: testId,
|
|
@@ -111,7 +119,9 @@ const DrawerPrimitive = ({
|
|
|
111
119
|
label: closeLabel,
|
|
112
120
|
shape: "circle",
|
|
113
121
|
appearance: "subtle"
|
|
114
|
-
})), jsx(Content,
|
|
122
|
+
})), jsx(Content, _extends({
|
|
123
|
+
scrollContentLabel: scrollContentLabel
|
|
124
|
+
}, contentOverrides), children)))));
|
|
115
125
|
};
|
|
116
126
|
|
|
117
127
|
// eslint-disable-next-line @repo/internal/react/require-jsdoc
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
/**
|
|
3
|
+
* @jsxRuntime classic
|
|
4
|
+
*/
|
|
2
5
|
/** @jsx jsx */
|
|
3
6
|
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
4
8
|
import { css, jsx } from '@emotion/react';
|
|
5
9
|
import { N500 } from '@atlaskit/theme/colors';
|
|
6
10
|
const defaultStyle = {
|
|
@@ -20,7 +24,7 @@ const Sidebar = ({
|
|
|
20
24
|
cssFn,
|
|
21
25
|
...props
|
|
22
26
|
}) => {
|
|
23
|
-
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props
|
|
27
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @repo/internal/react/no-unsafe-spread-props, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
24
28
|
return jsx("div", _extends({
|
|
25
29
|
css: css(cssFn(defaultStyle))
|
|
26
30
|
}, props));
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
*/
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import React from 'react';
|
|
6
|
+
|
|
7
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
3
8
|
import { css, jsx } from '@emotion/react';
|
|
4
9
|
import AkBlanket from '@atlaskit/blanket';
|
|
5
10
|
import { ExitingPersistence, FadeIn } from '@atlaskit/motion';
|
|
@@ -34,14 +39,17 @@ var Blanket = function Blanket(_ref) {
|
|
|
34
39
|
animationTimingFunction: animationTimingFunction
|
|
35
40
|
}, function (_ref2) {
|
|
36
41
|
var className = _ref2.className;
|
|
37
|
-
return
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
return (
|
|
43
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
44
|
+
jsx("div", {
|
|
45
|
+
css: blanketStyles,
|
|
46
|
+
className: className
|
|
47
|
+
}, jsx(AkBlanket, {
|
|
48
|
+
isTinted: true,
|
|
49
|
+
onBlanketClicked: onBlanketClicked,
|
|
50
|
+
testId: testId && testId
|
|
51
|
+
}))
|
|
52
|
+
);
|
|
45
53
|
}));
|
|
46
54
|
};
|
|
47
55
|
export default Blanket;
|
|
@@ -18,7 +18,7 @@ import { defaultFocusLockSettings } from '../constants';
|
|
|
18
18
|
import Blanket from './blanket';
|
|
19
19
|
import DrawerPrimitive from './primitives';
|
|
20
20
|
var packageName = "@atlaskit/drawer";
|
|
21
|
-
var packageVersion = "7.
|
|
21
|
+
var packageVersion = "7.12.0";
|
|
22
22
|
var createAndFireEventOnAtlaskit = createAndFireEvent('atlaskit');
|
|
23
23
|
var createAndFireOnClick = function createAndFireOnClick(createAnalyticsEvent, trigger) {
|
|
24
24
|
return createAndFireEventOnAtlaskit({
|
|
@@ -111,6 +111,7 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
111
111
|
children = _this$props3.children,
|
|
112
112
|
icon = _this$props3.icon,
|
|
113
113
|
closeLabel = _this$props3.closeLabel,
|
|
114
|
+
scrollContentLabel = _this$props3.scrollContentLabel,
|
|
114
115
|
width = _this$props3.width,
|
|
115
116
|
shouldUnmountOnExit = _this$props3.shouldUnmountOnExit,
|
|
116
117
|
onCloseComplete = _this$props3.onCloseComplete,
|
|
@@ -146,7 +147,8 @@ export var DrawerBase = /*#__PURE__*/function (_Component) {
|
|
|
146
147
|
overrides: overrides,
|
|
147
148
|
autoFocusFirstElem: autoFocusFirstElem,
|
|
148
149
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
149
|
-
shouldReturnFocus: shouldReturnFocus
|
|
150
|
+
shouldReturnFocus: shouldReturnFocus,
|
|
151
|
+
scrollContentLabel: scrollContentLabel
|
|
150
152
|
}, children));
|
|
151
153
|
}
|
|
152
154
|
}]);
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["cssFn"];
|
|
4
|
+
var _excluded = ["cssFn", "scrollContentLabel"];
|
|
5
|
+
/**
|
|
6
|
+
* @jsxRuntime classic
|
|
7
|
+
*/
|
|
4
8
|
/** @jsx jsx */
|
|
5
9
|
|
|
10
|
+
import { useEffect, useRef, useState } from 'react';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
13
|
import { css, jsx } from '@emotion/react';
|
|
7
14
|
var defaultStyles = {
|
|
8
15
|
flex: 1,
|
|
@@ -14,20 +21,41 @@ var contentCSS = function contentCSS() {
|
|
|
14
21
|
};
|
|
15
22
|
var Content = function Content(_ref) {
|
|
16
23
|
var cssFn = _ref.cssFn,
|
|
24
|
+
_ref$scrollContentLab = _ref.scrollContentLabel,
|
|
25
|
+
scrollContentLabel = _ref$scrollContentLab === void 0 ? 'Scrollable content' : _ref$scrollContentLab,
|
|
17
26
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
var _useState = useState(false),
|
|
28
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
29
|
+
showContentFocus = _useState2[0],
|
|
30
|
+
setContentFocus = _useState2[1];
|
|
31
|
+
var scrollableRef = useRef(null);
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
var setLazyContentFocus = function setLazyContentFocus() {
|
|
34
|
+
var target = scrollableRef.current;
|
|
35
|
+
target && setContentFocus(target.scrollHeight > target.clientHeight);
|
|
36
|
+
};
|
|
37
|
+
setLazyContentFocus();
|
|
38
|
+
}, []);
|
|
25
39
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
/**
|
|
41
|
+
* I noticed the implementation at @atlaskit/checkbox would send the props to cssFn rather
|
|
42
|
+
* than the defaultStyles as the overrides guide suggests. I went with what the overrides
|
|
43
|
+
* guide suggested as it made more sense as a transformer of the current styles rather than
|
|
44
|
+
* a complete override with no chance of partially changing styles.
|
|
45
|
+
*/
|
|
46
|
+
return jsx("div", _extends({
|
|
47
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
48
|
+
css: css(cssFn(defaultStyles)),
|
|
49
|
+
ref: scrollableRef
|
|
50
|
+
// tabindex is allowed here so that keyboard users can scroll content
|
|
51
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
52
|
+
,
|
|
53
|
+
tabIndex: showContentFocus ? 0 : undefined,
|
|
54
|
+
role: showContentFocus ? 'region' : undefined,
|
|
55
|
+
"aria-label": showContentFocus ? scrollContentLabel : undefined,
|
|
56
|
+
"data-testId": "drawer-contents"
|
|
57
|
+
// eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
|
|
58
|
+
}, props));
|
|
31
59
|
};
|
|
32
60
|
export default {
|
|
33
61
|
component: Content,
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
var _css;
|
|
3
|
+
/**
|
|
4
|
+
* @jsxRuntime classic
|
|
5
|
+
*/
|
|
3
6
|
/** @jsx jsx */
|
|
4
7
|
import { forwardRef, useCallback } from 'react';
|
|
8
|
+
|
|
9
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
5
10
|
import { css, jsx } from '@emotion/react';
|
|
6
11
|
import { useMergeRefs } from 'use-callback-ref';
|
|
7
12
|
import { N0 } from '@atlaskit/theme/colors';
|
|
@@ -60,8 +65,12 @@ var DrawerWrapper = /*#__PURE__*/forwardRef(function (_ref, scrollRef) {
|
|
|
60
65
|
var ref = useMergeRefs([drawerRef, assignSecondChildRef]);
|
|
61
66
|
usePreventProgrammaticScroll();
|
|
62
67
|
return jsx("div", {
|
|
63
|
-
css: wrapperStyles
|
|
64
|
-
style
|
|
68
|
+
css: wrapperStyles
|
|
69
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
70
|
+
,
|
|
71
|
+
style: wrapperWidth[width]
|
|
72
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
73
|
+
,
|
|
65
74
|
className: className,
|
|
66
75
|
"data-testid": testId,
|
|
67
76
|
ref: ref,
|
|
@@ -2,9 +2,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["component"],
|
|
4
4
|
_excluded2 = ["component"];
|
|
5
|
+
/**
|
|
6
|
+
* @jsxRuntime classic
|
|
7
|
+
*/
|
|
5
8
|
/** @jsx jsx */
|
|
6
9
|
|
|
7
10
|
import { useCallback, useRef } from 'react';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
13
|
import { jsx } from '@emotion/react';
|
|
9
14
|
import { IconButton } from '@atlaskit/button/new';
|
|
10
15
|
import ArrowLeft from '@atlaskit/icon/glyph/arrow-left';
|
|
@@ -53,6 +58,7 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
53
58
|
Icon = _ref2.icon,
|
|
54
59
|
_ref2$closeLabel = _ref2.closeLabel,
|
|
55
60
|
closeLabel = _ref2$closeLabel === void 0 ? 'Close drawer' : _ref2$closeLabel,
|
|
61
|
+
scrollContentLabel = _ref2.scrollContentLabel,
|
|
56
62
|
onClose = _ref2.onClose,
|
|
57
63
|
onCloseComplete = _ref2.onCloseComplete,
|
|
58
64
|
onOpenComplete = _ref2.onOpenComplete,
|
|
@@ -94,7 +100,9 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
94
100
|
autoFocusFirstElem: autoFocusFirstElem,
|
|
95
101
|
isFocusLockEnabled: isFocusLockEnabled,
|
|
96
102
|
shouldReturnFocus: shouldReturnFocus
|
|
97
|
-
}, jsx(DrawerWrapper
|
|
103
|
+
}, jsx(DrawerWrapper
|
|
104
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
105
|
+
, {
|
|
98
106
|
className: className,
|
|
99
107
|
width: width,
|
|
100
108
|
testId: testId,
|
|
@@ -112,7 +120,9 @@ var DrawerPrimitive = function DrawerPrimitive(_ref2) {
|
|
|
112
120
|
label: closeLabel,
|
|
113
121
|
shape: "circle",
|
|
114
122
|
appearance: "subtle"
|
|
115
|
-
})), jsx(Content,
|
|
123
|
+
})), jsx(Content, _extends({
|
|
124
|
+
scrollContentLabel: scrollContentLabel
|
|
125
|
+
}, contentOverrides), children)));
|
|
116
126
|
}));
|
|
117
127
|
};
|
|
118
128
|
|