@atlaskit/drawer 12.0.4 → 12.0.6
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 +12 -0
- package/dist/cjs/drawer-panel/drawer-close-button.js +4 -3
- package/dist/cjs/drawer-panel/drawer-content.js +2 -2
- package/dist/cjs/drawer-panel/drawer-panel.js +4 -3
- package/dist/cjs/drawer-panel/drawer-sidebar.compiled.css +2 -2
- package/dist/cjs/drawer-panel/drawer-sidebar.js +3 -3
- package/dist/cjs/drawer.js +3 -3
- package/dist/cjs/ensure-is-inside-drawer-context.js +13 -0
- package/dist/cjs/on-close-context.js +13 -0
- package/dist/cjs/use-ensure-is-inside-drawer.js +14 -0
- package/dist/cjs/use-on-close.js +11 -0
- package/dist/es2019/drawer-panel/drawer-close-button.js +3 -1
- package/dist/es2019/drawer-panel/drawer-content.js +1 -1
- package/dist/es2019/drawer-panel/drawer-panel.js +2 -1
- package/dist/es2019/drawer-panel/drawer-sidebar.compiled.css +2 -2
- package/dist/es2019/drawer-panel/drawer-sidebar.js +2 -2
- package/dist/es2019/drawer.js +3 -3
- package/dist/es2019/ensure-is-inside-drawer-context.js +8 -0
- package/dist/es2019/on-close-context.js +7 -0
- package/dist/es2019/use-ensure-is-inside-drawer.js +7 -0
- package/dist/es2019/use-on-close.js +3 -0
- package/dist/esm/drawer-panel/drawer-close-button.js +3 -1
- package/dist/esm/drawer-panel/drawer-content.js +1 -1
- package/dist/esm/drawer-panel/drawer-panel.js +2 -1
- package/dist/esm/drawer-panel/drawer-sidebar.compiled.css +2 -2
- package/dist/esm/drawer-panel/drawer-sidebar.js +2 -2
- package/dist/esm/drawer.js +3 -3
- package/dist/esm/ensure-is-inside-drawer-context.js +8 -0
- package/dist/esm/on-close-context.js +7 -0
- package/dist/esm/use-ensure-is-inside-drawer.js +7 -0
- package/dist/esm/use-on-close.js +5 -0
- package/dist/types/ensure-is-inside-drawer-context.d.ts +7 -0
- package/dist/types/on-close-context.d.ts +7 -0
- package/dist/types/use-ensure-is-inside-drawer.d.ts +1 -0
- package/dist/types/use-on-close.d.ts +2 -0
- package/dist/types-ts4.5/ensure-is-inside-drawer-context.d.ts +7 -0
- package/dist/types-ts4.5/on-close-context.d.ts +7 -0
- package/dist/types-ts4.5/use-ensure-is-inside-drawer.d.ts +1 -0
- package/dist/types-ts4.5/use-on-close.d.ts +2 -0
- package/package.json +6 -6
- package/dist/cjs/context.js +0 -26
- package/dist/es2019/context.js +0 -17
- package/dist/esm/context.js +0 -19
- package/dist/types/context.d.ts +0 -12
- package/dist/types-ts4.5/context.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
10
|
var _new = require("@atlaskit/button/new");
|
|
11
11
|
var _arrowLeft = _interopRequireDefault(require("@atlaskit/icon/core/arrow-left"));
|
|
12
|
-
var
|
|
12
|
+
var _useEnsureIsInsideDrawer = require("../use-ensure-is-inside-drawer");
|
|
13
|
+
var _useOnClose = require("../use-on-close");
|
|
13
14
|
/**
|
|
14
15
|
* __Drawer close button
|
|
15
16
|
*
|
|
@@ -21,8 +22,8 @@ var DrawerCloseButton = exports.DrawerCloseButton = function DrawerCloseButton(_
|
|
|
21
22
|
label = _ref$label === void 0 ? 'Close drawer' : _ref$label,
|
|
22
23
|
_ref$testId = _ref.testId,
|
|
23
24
|
testId = _ref$testId === void 0 ? 'DrawerCloseButton' : _ref$testId;
|
|
24
|
-
(0,
|
|
25
|
-
var onClose = (0,
|
|
25
|
+
(0, _useEnsureIsInsideDrawer.useEnsureIsInsideDrawer)();
|
|
26
|
+
var onClose = (0, _useOnClose.useOnClose)();
|
|
26
27
|
return /*#__PURE__*/_react.default.createElement(_new.IconButton, {
|
|
27
28
|
onClick: onClose,
|
|
28
29
|
testId: testId,
|
|
@@ -14,7 +14,7 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
15
|
var _reactScrolllock = _interopRequireDefault(require("react-scrolllock"));
|
|
16
16
|
var _useCallbackRef = require("use-callback-ref");
|
|
17
|
-
var
|
|
17
|
+
var _useEnsureIsInsideDrawer = require("../use-ensure-is-inside-drawer");
|
|
18
18
|
var _usePreventProgrammaticScroll = _interopRequireDefault(require("./hooks/use-prevent-programmatic-scroll"));
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
var styles = {
|
|
@@ -58,7 +58,7 @@ var DrawerContent = exports.DrawerContent = function DrawerContent(_ref2) {
|
|
|
58
58
|
var children = _ref2.children,
|
|
59
59
|
scrollContentLabel = _ref2.scrollContentLabel,
|
|
60
60
|
xcss = _ref2.xcss;
|
|
61
|
-
(0,
|
|
61
|
+
(0, _useEnsureIsInsideDrawer.useEnsureIsInsideDrawer)();
|
|
62
62
|
(0, _usePreventProgrammaticScroll.default)();
|
|
63
63
|
return /*#__PURE__*/React.createElement(_reactScrolllock.default, null, /*#__PURE__*/React.createElement(DrawerContentBase, {
|
|
64
64
|
scrollContentLabel: scrollContentLabel,
|
|
@@ -12,7 +12,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
12
12
|
var React = _react;
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _motion = require("@atlaskit/motion");
|
|
15
|
-
var
|
|
15
|
+
var _ensureIsInsideDrawerContext = require("../ensure-is-inside-drawer-context");
|
|
16
|
+
var _onCloseContext = require("../on-close-context");
|
|
16
17
|
var _focusLock = _interopRequireDefault(require("./focus-lock"));
|
|
17
18
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
18
19
|
var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
@@ -92,9 +93,9 @@ var DrawerPanel = exports.DrawerPanel = function DrawerPanel(_ref2) {
|
|
|
92
93
|
role: "dialog",
|
|
93
94
|
"aria-label": label,
|
|
94
95
|
"aria-labelledby": titleId
|
|
95
|
-
}, /*#__PURE__*/React.createElement(
|
|
96
|
+
}, /*#__PURE__*/React.createElement(_ensureIsInsideDrawerContext.EnsureIsInsideDrawerContext.Provider, {
|
|
96
97
|
value: true
|
|
97
|
-
}, /*#__PURE__*/React.createElement(
|
|
98
|
+
}, /*#__PURE__*/React.createElement(_onCloseContext.OnCloseContext.Provider, {
|
|
98
99
|
value: onClose
|
|
99
100
|
}, children))));
|
|
100
101
|
}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
._1bsbxncg{width:var(--ds-space-800,4pc)}
|
|
2
2
|
._1e0c1txw{display:flex}
|
|
3
3
|
._1o9zidpf{flex-shrink:0}
|
|
4
|
+
._1q511ejb{padding-block-start:var(--ds-space-300,24px)}
|
|
4
5
|
._2lx21bp4{flex-direction:column}
|
|
5
6
|
._4cvr1h6o{align-items:center}
|
|
6
7
|
._4t3i1kxc{height:100vh}
|
|
7
|
-
.
|
|
8
|
-
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
8
|
+
._85i5pxbi{padding-block-end:var(--ds-space-200,1pc)}
|
|
9
9
|
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
10
10
|
._vchhusvi{box-sizing:border-box}
|
|
@@ -9,10 +9,10 @@ exports.DrawerSidebar = void 0;
|
|
|
9
9
|
require("./drawer-sidebar.compiled.css");
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
|
-
var
|
|
12
|
+
var _useEnsureIsInsideDrawer = require("../use-ensure-is-inside-drawer");
|
|
13
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
14
|
var styles = {
|
|
15
|
-
default: "_4cvr1h6o _vchhusvi _syazazsu _1e0c1txw _1o9zidpf _2lx21bp4 _4t3i1kxc
|
|
15
|
+
default: "_4cvr1h6o _vchhusvi _syazazsu _1e0c1txw _1o9zidpf _2lx21bp4 _4t3i1kxc _85i5pxbi _1q511ejb _1bsbxncg"
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -23,7 +23,7 @@ var styles = {
|
|
|
23
23
|
var DrawerSidebar = exports.DrawerSidebar = function DrawerSidebar(_ref) {
|
|
24
24
|
var children = _ref.children,
|
|
25
25
|
xcss = _ref.xcss;
|
|
26
|
-
(0,
|
|
26
|
+
(0, _useEnsureIsInsideDrawer.useEnsureIsInsideDrawer)();
|
|
27
27
|
return /*#__PURE__*/React.createElement("div", {
|
|
28
28
|
className: (0, _runtime.ax)([styles.default, xcss]),
|
|
29
29
|
"data-testid": "drawer-sidebar"
|
package/dist/cjs/drawer.js
CHANGED
|
@@ -67,7 +67,7 @@ var Drawer = exports.Drawer = function Drawer(_ref2) {
|
|
|
67
67
|
action: 'dismissed',
|
|
68
68
|
componentName: 'drawer',
|
|
69
69
|
packageName: "@atlaskit/drawer",
|
|
70
|
-
packageVersion: "
|
|
70
|
+
packageVersion: "12.0.6",
|
|
71
71
|
analyticsData: {
|
|
72
72
|
trigger: 'escKey'
|
|
73
73
|
}
|
|
@@ -90,7 +90,7 @@ var Drawer = exports.Drawer = function Drawer(_ref2) {
|
|
|
90
90
|
action: 'dismissed',
|
|
91
91
|
componentName: 'drawer',
|
|
92
92
|
packageName: "@atlaskit/drawer",
|
|
93
|
-
packageVersion: "
|
|
93
|
+
packageVersion: "12.0.6",
|
|
94
94
|
analyticsData: {
|
|
95
95
|
trigger: 'blanket'
|
|
96
96
|
}
|
|
@@ -102,7 +102,7 @@ var Drawer = exports.Drawer = function Drawer(_ref2) {
|
|
|
102
102
|
action: 'dismissed',
|
|
103
103
|
componentName: 'drawer',
|
|
104
104
|
packageName: "@atlaskit/drawer",
|
|
105
|
-
packageVersion: "
|
|
105
|
+
packageVersion: "12.0.6",
|
|
106
106
|
analyticsData: {
|
|
107
107
|
trigger: 'backButton'
|
|
108
108
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EnsureIsInsideDrawerContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* __Ensure is inside drawer context__
|
|
10
|
+
*
|
|
11
|
+
* An context that ensures that the component is inside a drawer.
|
|
12
|
+
*/
|
|
13
|
+
var EnsureIsInsideDrawerContext = exports.EnsureIsInsideDrawerContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.OnCloseContext = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
/**
|
|
9
|
+
* __On close context__
|
|
10
|
+
*
|
|
11
|
+
* An context that provides the on close function for the drawer.
|
|
12
|
+
*/
|
|
13
|
+
var OnCloseContext = exports.OnCloseContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useEnsureIsInsideDrawer = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
10
|
+
var _ensureIsInsideDrawerContext = require("./ensure-is-inside-drawer-context");
|
|
11
|
+
var useEnsureIsInsideDrawer = exports.useEnsureIsInsideDrawer = function useEnsureIsInsideDrawer() {
|
|
12
|
+
var context = (0, _react.useContext)(_ensureIsInsideDrawerContext.EnsureIsInsideDrawerContext);
|
|
13
|
+
(0, _tinyInvariant.default)(context, 'Drawer sub-components must be used within a Drawer component.');
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useOnClose = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _onCloseContext = require("./on-close-context");
|
|
9
|
+
var useOnClose = exports.useOnClose = function useOnClose() {
|
|
10
|
+
return (0, _react.useContext)(_onCloseContext.OnCloseContext);
|
|
11
|
+
};
|
|
@@ -2,7 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IconButton } from '@atlaskit/button/new';
|
|
4
4
|
import ArrowLeft from '@atlaskit/icon/core/arrow-left';
|
|
5
|
-
import { useEnsureIsInsideDrawer
|
|
5
|
+
import { useEnsureIsInsideDrawer } from '../use-ensure-is-inside-drawer';
|
|
6
|
+
import { useOnClose } from '../use-on-close';
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* __Drawer close button
|
|
8
10
|
*
|
|
@@ -5,7 +5,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
5
5
|
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
6
6
|
import ScrollLock from 'react-scrolllock';
|
|
7
7
|
import { mergeRefs } from 'use-callback-ref';
|
|
8
|
-
import { useEnsureIsInsideDrawer } from '../
|
|
8
|
+
import { useEnsureIsInsideDrawer } from '../use-ensure-is-inside-drawer';
|
|
9
9
|
import usePreventProgrammaticScroll from './hooks/use-prevent-programmatic-scroll';
|
|
10
10
|
const styles = {
|
|
11
11
|
default: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo1wug _18m91wug _19pk1ejb"
|
|
@@ -4,7 +4,8 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useCallback, useRef } from 'react';
|
|
6
6
|
import { ExitingPersistence, SlideIn } from '@atlaskit/motion';
|
|
7
|
-
import { EnsureIsInsideDrawerContext
|
|
7
|
+
import { EnsureIsInsideDrawerContext } from '../ensure-is-inside-drawer-context';
|
|
8
|
+
import { OnCloseContext } from '../on-close-context';
|
|
8
9
|
import FocusLock from './focus-lock';
|
|
9
10
|
const LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
10
11
|
const styles = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
._1bsbxncg{width:var(--ds-space-800,4pc)}
|
|
2
2
|
._1e0c1txw{display:flex}
|
|
3
3
|
._1o9zidpf{flex-shrink:0}
|
|
4
|
+
._1q511ejb{padding-block-start:var(--ds-space-300,24px)}
|
|
4
5
|
._2lx21bp4{flex-direction:column}
|
|
5
6
|
._4cvr1h6o{align-items:center}
|
|
6
7
|
._4t3i1kxc{height:100vh}
|
|
7
|
-
.
|
|
8
|
-
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
8
|
+
._85i5pxbi{padding-block-end:var(--ds-space-200,1pc)}
|
|
9
9
|
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
10
10
|
._vchhusvi{box-sizing:border-box}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import "./drawer-sidebar.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { useEnsureIsInsideDrawer } from '../
|
|
5
|
+
import { useEnsureIsInsideDrawer } from '../use-ensure-is-inside-drawer';
|
|
6
6
|
const styles = {
|
|
7
|
-
default: "_4cvr1h6o _vchhusvi _syazazsu _1e0c1txw _1o9zidpf _2lx21bp4 _4t3i1kxc
|
|
7
|
+
default: "_4cvr1h6o _vchhusvi _syazazsu _1e0c1txw _1o9zidpf _2lx21bp4 _4t3i1kxc _85i5pxbi _1q511ejb _1bsbxncg"
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/es2019/drawer.js
CHANGED
|
@@ -52,7 +52,7 @@ export const Drawer = ({
|
|
|
52
52
|
action: 'dismissed',
|
|
53
53
|
componentName: 'drawer',
|
|
54
54
|
packageName: "@atlaskit/drawer",
|
|
55
|
-
packageVersion: "
|
|
55
|
+
packageVersion: "12.0.6",
|
|
56
56
|
analyticsData: {
|
|
57
57
|
trigger: 'escKey'
|
|
58
58
|
}
|
|
@@ -73,7 +73,7 @@ export const Drawer = ({
|
|
|
73
73
|
action: 'dismissed',
|
|
74
74
|
componentName: 'drawer',
|
|
75
75
|
packageName: "@atlaskit/drawer",
|
|
76
|
-
packageVersion: "
|
|
76
|
+
packageVersion: "12.0.6",
|
|
77
77
|
analyticsData: {
|
|
78
78
|
trigger: 'blanket'
|
|
79
79
|
}
|
|
@@ -83,7 +83,7 @@ export const Drawer = ({
|
|
|
83
83
|
action: 'dismissed',
|
|
84
84
|
componentName: 'drawer',
|
|
85
85
|
packageName: "@atlaskit/drawer",
|
|
86
|
-
packageVersion: "
|
|
86
|
+
packageVersion: "12.0.6",
|
|
87
87
|
analyticsData: {
|
|
88
88
|
trigger: 'backButton'
|
|
89
89
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import invariant from 'tiny-invariant';
|
|
3
|
+
import { EnsureIsInsideDrawerContext } from './ensure-is-inside-drawer-context';
|
|
4
|
+
export const useEnsureIsInsideDrawer = () => {
|
|
5
|
+
const context = useContext(EnsureIsInsideDrawerContext);
|
|
6
|
+
invariant(context, 'Drawer sub-components must be used within a Drawer component.');
|
|
7
|
+
};
|
|
@@ -2,7 +2,9 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { IconButton } from '@atlaskit/button/new';
|
|
4
4
|
import ArrowLeft from '@atlaskit/icon/core/arrow-left';
|
|
5
|
-
import { useEnsureIsInsideDrawer
|
|
5
|
+
import { useEnsureIsInsideDrawer } from '../use-ensure-is-inside-drawer';
|
|
6
|
+
import { useOnClose } from '../use-on-close';
|
|
7
|
+
|
|
6
8
|
/**
|
|
7
9
|
* __Drawer close button
|
|
8
10
|
*
|
|
@@ -6,7 +6,7 @@ import { ax, ix } from "@compiled/react/runtime";
|
|
|
6
6
|
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
7
7
|
import ScrollLock from 'react-scrolllock';
|
|
8
8
|
import { mergeRefs } from 'use-callback-ref';
|
|
9
|
-
import { useEnsureIsInsideDrawer } from '../
|
|
9
|
+
import { useEnsureIsInsideDrawer } from '../use-ensure-is-inside-drawer';
|
|
10
10
|
import usePreventProgrammaticScroll from './hooks/use-prevent-programmatic-scroll';
|
|
11
11
|
var styles = {
|
|
12
12
|
default: "_16jlkb7n _1o9zkb7n _i0dlf1ug _1reo1wug _18m91wug _19pk1ejb"
|
|
@@ -4,7 +4,8 @@ import * as React from 'react';
|
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useCallback, useRef } from 'react';
|
|
6
6
|
import { ExitingPersistence, SlideIn } from '@atlaskit/motion';
|
|
7
|
-
import { EnsureIsInsideDrawerContext
|
|
7
|
+
import { EnsureIsInsideDrawerContext } from '../ensure-is-inside-drawer-context';
|
|
8
|
+
import { OnCloseContext } from '../on-close-context';
|
|
8
9
|
import FocusLock from './focus-lock';
|
|
9
10
|
var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
10
11
|
var styles = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
._1bsbxncg{width:var(--ds-space-800,4pc)}
|
|
2
2
|
._1e0c1txw{display:flex}
|
|
3
3
|
._1o9zidpf{flex-shrink:0}
|
|
4
|
+
._1q511ejb{padding-block-start:var(--ds-space-300,24px)}
|
|
4
5
|
._2lx21bp4{flex-direction:column}
|
|
5
6
|
._4cvr1h6o{align-items:center}
|
|
6
7
|
._4t3i1kxc{height:100vh}
|
|
7
|
-
.
|
|
8
|
-
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
8
|
+
._85i5pxbi{padding-block-end:var(--ds-space-200,1pc)}
|
|
9
9
|
._syazazsu{color:var(--ds-text-subtle,#505258)}
|
|
10
10
|
._vchhusvi{box-sizing:border-box}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import "./drawer-sidebar.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
|
-
import { useEnsureIsInsideDrawer } from '../
|
|
5
|
+
import { useEnsureIsInsideDrawer } from '../use-ensure-is-inside-drawer';
|
|
6
6
|
var styles = {
|
|
7
|
-
default: "_4cvr1h6o _vchhusvi _syazazsu _1e0c1txw _1o9zidpf _2lx21bp4 _4t3i1kxc
|
|
7
|
+
default: "_4cvr1h6o _vchhusvi _syazazsu _1e0c1txw _1o9zidpf _2lx21bp4 _4t3i1kxc _85i5pxbi _1q511ejb _1bsbxncg"
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
/**
|
package/dist/esm/drawer.js
CHANGED
|
@@ -57,7 +57,7 @@ export var Drawer = function Drawer(_ref2) {
|
|
|
57
57
|
action: 'dismissed',
|
|
58
58
|
componentName: 'drawer',
|
|
59
59
|
packageName: "@atlaskit/drawer",
|
|
60
|
-
packageVersion: "
|
|
60
|
+
packageVersion: "12.0.6",
|
|
61
61
|
analyticsData: {
|
|
62
62
|
trigger: 'escKey'
|
|
63
63
|
}
|
|
@@ -80,7 +80,7 @@ export var Drawer = function Drawer(_ref2) {
|
|
|
80
80
|
action: 'dismissed',
|
|
81
81
|
componentName: 'drawer',
|
|
82
82
|
packageName: "@atlaskit/drawer",
|
|
83
|
-
packageVersion: "
|
|
83
|
+
packageVersion: "12.0.6",
|
|
84
84
|
analyticsData: {
|
|
85
85
|
trigger: 'blanket'
|
|
86
86
|
}
|
|
@@ -92,7 +92,7 @@ export var Drawer = function Drawer(_ref2) {
|
|
|
92
92
|
action: 'dismissed',
|
|
93
93
|
componentName: 'drawer',
|
|
94
94
|
packageName: "@atlaskit/drawer",
|
|
95
|
-
packageVersion: "
|
|
95
|
+
packageVersion: "12.0.6",
|
|
96
96
|
analyticsData: {
|
|
97
97
|
trigger: 'backButton'
|
|
98
98
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import invariant from 'tiny-invariant';
|
|
3
|
+
import { EnsureIsInsideDrawerContext } from './ensure-is-inside-drawer-context';
|
|
4
|
+
export var useEnsureIsInsideDrawer = function useEnsureIsInsideDrawer() {
|
|
5
|
+
var context = useContext(EnsureIsInsideDrawerContext);
|
|
6
|
+
invariant(context, 'Drawer sub-components must be used within a Drawer component.');
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Context, type SyntheticEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __On close context__
|
|
4
|
+
*
|
|
5
|
+
* An context that provides the on close function for the drawer.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OnCloseContext: Context<((event: SyntheticEvent<HTMLElement>, analyticsEvent?: any) => void) | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useEnsureIsInsideDrawer: () => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Context, type SyntheticEvent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* __On close context__
|
|
4
|
+
*
|
|
5
|
+
* An context that provides the on close function for the drawer.
|
|
6
|
+
*/
|
|
7
|
+
export declare const OnCloseContext: Context<((event: SyntheticEvent<HTMLElement>, analyticsEvent?: any) => void) | undefined>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useEnsureIsInsideDrawer: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/drawer",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.6",
|
|
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/"
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"@atlaskit/css": "^0.19.0",
|
|
51
51
|
"@atlaskit/icon": "^34.0.0",
|
|
52
52
|
"@atlaskit/layering": "^3.6.0",
|
|
53
|
-
"@atlaskit/motion": "^5.
|
|
53
|
+
"@atlaskit/motion": "^5.6.0",
|
|
54
54
|
"@atlaskit/portal": "^5.4.0",
|
|
55
55
|
"@atlaskit/theme": "^23.0.0",
|
|
56
|
-
"@atlaskit/tokens": "^
|
|
56
|
+
"@atlaskit/tokens": "^13.0.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
58
58
|
"@compiled/react": "^0.20.0",
|
|
59
59
|
"bind-event-listener": "^3.0.0",
|
|
@@ -73,13 +73,13 @@
|
|
|
73
73
|
"@atlaskit/code": "^17.4.0",
|
|
74
74
|
"@atlaskit/docs": "^11.7.0",
|
|
75
75
|
"@atlaskit/dropdown-menu": "^16.8.0",
|
|
76
|
-
"@atlaskit/ds-lib": "^
|
|
76
|
+
"@atlaskit/ds-lib": "^7.0.0",
|
|
77
77
|
"@atlaskit/form": "^15.5.0",
|
|
78
78
|
"@atlaskit/inline-message": "^15.6.0",
|
|
79
79
|
"@atlaskit/link": "^3.4.0",
|
|
80
80
|
"@atlaskit/menu": "^8.4.0",
|
|
81
|
-
"@atlaskit/modal-dialog": "^14.
|
|
82
|
-
"@atlaskit/primitives": "^
|
|
81
|
+
"@atlaskit/modal-dialog": "^14.15.0",
|
|
82
|
+
"@atlaskit/primitives": "^19.0.0",
|
|
83
83
|
"@atlaskit/section-message": "^8.12.0",
|
|
84
84
|
"@atlassian/react-compiler-gating": "workspace:^",
|
|
85
85
|
"@atlassian/ssr-tests": "workspace:^",
|
package/dist/cjs/context.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useOnClose = exports.useEnsureIsInsideDrawer = exports.OnCloseContext = exports.EnsureIsInsideDrawerContext = void 0;
|
|
8
|
-
var _react = require("react");
|
|
9
|
-
var _tinyInvariant = _interopRequireDefault(require("tiny-invariant"));
|
|
10
|
-
/**
|
|
11
|
-
* Context used to share the `onClose` prop value with sub-components.
|
|
12
|
-
*/
|
|
13
|
-
var OnCloseContext = exports.OnCloseContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
14
|
-
var useOnClose = exports.useOnClose = function useOnClose() {
|
|
15
|
-
return (0, _react.useContext)(OnCloseContext);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Used to ensure Drawer sub-components are used within a Drawer component,
|
|
20
|
-
* and provide a useful error message if not.
|
|
21
|
-
*/
|
|
22
|
-
var EnsureIsInsideDrawerContext = exports.EnsureIsInsideDrawerContext = /*#__PURE__*/(0, _react.createContext)(false);
|
|
23
|
-
var useEnsureIsInsideDrawer = exports.useEnsureIsInsideDrawer = function useEnsureIsInsideDrawer() {
|
|
24
|
-
var context = (0, _react.useContext)(EnsureIsInsideDrawerContext);
|
|
25
|
-
(0, _tinyInvariant.default)(context, 'Drawer sub-components must be used within a Drawer component.');
|
|
26
|
-
};
|
package/dist/es2019/context.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
import invariant from 'tiny-invariant';
|
|
3
|
-
/**
|
|
4
|
-
* Context used to share the `onClose` prop value with sub-components.
|
|
5
|
-
*/
|
|
6
|
-
export const OnCloseContext = /*#__PURE__*/createContext(undefined);
|
|
7
|
-
export const useOnClose = () => useContext(OnCloseContext);
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Used to ensure Drawer sub-components are used within a Drawer component,
|
|
11
|
-
* and provide a useful error message if not.
|
|
12
|
-
*/
|
|
13
|
-
export const EnsureIsInsideDrawerContext = /*#__PURE__*/createContext(false);
|
|
14
|
-
export const useEnsureIsInsideDrawer = () => {
|
|
15
|
-
const context = useContext(EnsureIsInsideDrawerContext);
|
|
16
|
-
invariant(context, 'Drawer sub-components must be used within a Drawer component.');
|
|
17
|
-
};
|
package/dist/esm/context.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
import invariant from 'tiny-invariant';
|
|
3
|
-
/**
|
|
4
|
-
* Context used to share the `onClose` prop value with sub-components.
|
|
5
|
-
*/
|
|
6
|
-
export var OnCloseContext = /*#__PURE__*/createContext(undefined);
|
|
7
|
-
export var useOnClose = function useOnClose() {
|
|
8
|
-
return useContext(OnCloseContext);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Used to ensure Drawer sub-components are used within a Drawer component,
|
|
13
|
-
* and provide a useful error message if not.
|
|
14
|
-
*/
|
|
15
|
-
export var EnsureIsInsideDrawerContext = /*#__PURE__*/createContext(false);
|
|
16
|
-
export var useEnsureIsInsideDrawer = function useEnsureIsInsideDrawer() {
|
|
17
|
-
var context = useContext(EnsureIsInsideDrawerContext);
|
|
18
|
-
invariant(context, 'Drawer sub-components must be used within a Drawer component.');
|
|
19
|
-
};
|
package/dist/types/context.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Context, type SyntheticEvent } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Context used to share the `onClose` prop value with sub-components.
|
|
4
|
-
*/
|
|
5
|
-
export declare const OnCloseContext: Context<((event: SyntheticEvent<HTMLElement>, analyticsEvent?: any) => void) | undefined>;
|
|
6
|
-
export declare const useOnClose: () => ((event: SyntheticEvent<HTMLElement>, analyticsEvent?: any) => void) | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Used to ensure Drawer sub-components are used within a Drawer component,
|
|
9
|
-
* and provide a useful error message if not.
|
|
10
|
-
*/
|
|
11
|
-
export declare const EnsureIsInsideDrawerContext: Context<boolean>;
|
|
12
|
-
export declare const useEnsureIsInsideDrawer: () => void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type Context, type SyntheticEvent } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Context used to share the `onClose` prop value with sub-components.
|
|
4
|
-
*/
|
|
5
|
-
export declare const OnCloseContext: Context<((event: SyntheticEvent<HTMLElement>, analyticsEvent?: any) => void) | undefined>;
|
|
6
|
-
export declare const useOnClose: () => ((event: SyntheticEvent<HTMLElement>, analyticsEvent?: any) => void) | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Used to ensure Drawer sub-components are used within a Drawer component,
|
|
9
|
-
* and provide a useful error message if not.
|
|
10
|
-
*/
|
|
11
|
-
export declare const EnsureIsInsideDrawerContext: Context<boolean>;
|
|
12
|
-
export declare const useEnsureIsInsideDrawer: () => void;
|