@atlaskit/drawer 13.1.1 → 13.3.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.
@@ -0,0 +1,262 @@
1
+ /* drawer-top-layer.tsx generated by @compiled/babel-plugin v0.39.1 */
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _typeof from "@babel/runtime/helpers/typeof";
4
+ import "./drawer-top-layer.compiled.css";
5
+ import * as React from 'react';
6
+ import { ax, ix } from "@compiled/react/runtime";
7
+ import { useCallback, useEffect, useRef } from 'react';
8
+ import { cx } from '@compiled/react';
9
+ import { bind } from 'bind-event-listener';
10
+ import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
11
+ import { createCloseEvent, Dialog } from '@atlaskit/top-layer/dialog';
12
+ import { DialogScrollLock } from '@atlaskit/top-layer/dialog-scroll-lock';
13
+ import { EnsureIsInsideDrawerContext } from '../ensure-is-inside-drawer-context';
14
+ import { OnCloseContext } from '../on-close-context';
15
+ import useDrawerStack from '../use-drawer-stack';
16
+ var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
17
+
18
+ // Legacy drawer panel uses `SlideIn duration="small"`, which resolves to
19
+ // 100ms on enter and 50ms on exit.
20
+ var slideEnterDurationMs = 100;
21
+ var slideExitDurationMs = 50;
22
+
23
+ // Legacy drawer blanket is a separate `FadeIn duration="large"`, which resolves
24
+ // to 700ms on enter and 350ms on exit. These intentionally differ from the panel
25
+ // slide timings to preserve the old visual behavior.
26
+ var fadeEnterDurationMs = 700;
27
+ var fadeExitDurationMs = 350;
28
+ var animate = {
29
+ kind: 'dialog',
30
+ name: 'custom'
31
+ };
32
+ var styles = {
33
+ root: "_k8m05ji5 _1oec14ed _6fl4dkwg _1s9z1a5r _1kdeglyw _1fsl1yx9 _1ltk1j28 _njwkivc9 _yhpq1ttt _13ku1fu8 _1fyf1a5r _d7fr1i5c _4v7ipwmj _1dar1j28 _156yru3m _aeldru3m _1sbqru3m _1i6zru3m",
34
+ surface: "_1reo15vq _18m915vq _1e0c1txw _1bsb1osq _4t3i1osq _bfhk1bhr _1q1l1bhr _ect4ttxp"
35
+ };
36
+ var drawerAnimationStyles = {
37
+ left: "_t9ecjq3t _1hqtjq3t",
38
+ right: "_t9ecxwn4 _1hqtxwn4",
39
+ top: "_t9ecz6y5 _1hqtz6y5",
40
+ bottom: "_t9ec3k1b _1hqt3k1b"
41
+ };
42
+
43
+ // Width presets mirror the legacy `DrawerPanel`. Applied to the `<dialog>` (the
44
+ // sized, edge-pinned element) and clamped to the viewport for mobile safety.
45
+ var WIDTH_MAP = {
46
+ narrow: '360px',
47
+ medium: '480px',
48
+ wide: '600px',
49
+ extended: '95vw',
50
+ full: '100vw'
51
+ };
52
+
53
+ /**
54
+ * Resolve the native `<dialog>` accessible name props. Prefer the consumer's
55
+ * `label`, then their `titleId`. If neither is supplied (legacy allowed this),
56
+ * fall back to a generic name so the dialog is never unlabelled. Note:
57
+ * `@atlaskit/drawer` has no i18n setup, so this fallback is English only;
58
+ * consumers should pass a localised `label` or `titleId`.
59
+ */
60
+ function getAccessibleName(_ref) {
61
+ var label = _ref.label,
62
+ titleId = _ref.titleId;
63
+ if (label) {
64
+ return {
65
+ label: label
66
+ };
67
+ }
68
+ if (titleId) {
69
+ return {
70
+ labelledBy: titleId
71
+ };
72
+ }
73
+ return {
74
+ label: 'Drawer'
75
+ };
76
+ }
77
+
78
+ /**
79
+ * **DrawerTopLayer**
80
+ *
81
+ * Top-layer (`platform-dst-top-layer`) implementation of `Drawer`. Renders a
82
+ * native `<dialog>` via `@atlaskit/top-layer`, replacing Portal, Blanket,
83
+ * react-focus-lock, react-scrolllock and `@atlaskit/layering` with native
84
+ * modality, `::backdrop`, focus trap and return, and `DialogScrollLock`.
85
+ *
86
+ * The `Dialog` primitive owns the entry and exit animation lifecycle (it keeps
87
+ * the host element mounted through the exit transition, then fires
88
+ * `onExitFinish`), so no `ExitingPersistence` wrapper is needed: the drawer
89
+ * renders `<Dialog isOpen={isOpen}>` directly. `useDrawerStack` tracks stack
90
+ * depth so only the foreground drawer shows a `::backdrop`.
91
+ *
92
+ * `isFocusLockEnabled` is intentionally unsupported: a native modal `<dialog>`
93
+ * always traps focus, so `isFocusLockEnabled={false}` is a no-op under this gate.
94
+ */
95
+ export function DrawerTopLayer(_ref2) {
96
+ var _ref2$width = _ref2.width,
97
+ width = _ref2$width === void 0 ? 'narrow' : _ref2$width,
98
+ isOpen = _ref2.isOpen,
99
+ _ref2$shouldReturnFoc = _ref2.shouldReturnFocus,
100
+ shouldReturnFocus = _ref2$shouldReturnFoc === void 0 ? true : _ref2$shouldReturnFoc,
101
+ onKeyDown = _ref2.onKeyDown,
102
+ testId = _ref2.testId,
103
+ children = _ref2.children,
104
+ onClose = _ref2.onClose,
105
+ onCloseComplete = _ref2.onCloseComplete,
106
+ onOpenComplete = _ref2.onOpenComplete,
107
+ label = _ref2.label,
108
+ titleId = _ref2.titleId,
109
+ _ref2$enterFrom = _ref2.enterFrom,
110
+ enterFrom = _ref2$enterFrom === void 0 ? 'left' : _ref2$enterFrom;
111
+ var stackIndex = useDrawerStack({
112
+ isOpen: isOpen
113
+ });
114
+
115
+ /**
116
+ * Points to the panel surface. Passed to `onOpenComplete` / `onCloseComplete`.
117
+ */
118
+ var contentRef = useRef(null);
119
+ // Cache the last content element so `onCloseComplete` still receives a node
120
+ // after children unmount (with reduced motion `contentRef` can clear before
121
+ // `onExitFinish` fires).
122
+ var lastContentElRef = useRef(null);
123
+ // Callback ref runs at commit (not during render), so both refs stay
124
+ // populated without a render-time side effect. `lastContentElRef` only
125
+ // overwrites with a non-null node, preserving it across the unmount.
126
+ var setContentEl = useCallback(function (el) {
127
+ contentRef.current = el;
128
+ if (el) {
129
+ lastContentElRef.current = el;
130
+ }
131
+ }, []);
132
+
133
+ // Analytics-wrapped close handlers, one per legacy trigger.
134
+ var handleEscapeClose = usePlatformLeafEventHandler({
135
+ fn: function fn(evt, analyticsEvent) {
136
+ return onClose === null || onClose === void 0 ? void 0 : onClose(evt, analyticsEvent);
137
+ },
138
+ action: 'dismissed',
139
+ componentName: 'drawer',
140
+ packageName: "@atlaskit/drawer",
141
+ packageVersion: "13.2.0",
142
+ analyticsData: {
143
+ trigger: 'escKey'
144
+ }
145
+ });
146
+ var handleBlanketClose = usePlatformLeafEventHandler({
147
+ fn: function fn(evt, analyticsEvent) {
148
+ return onClose === null || onClose === void 0 ? void 0 : onClose(evt, analyticsEvent);
149
+ },
150
+ action: 'dismissed',
151
+ componentName: 'drawer',
152
+ packageName: "@atlaskit/drawer",
153
+ packageVersion: "13.2.0",
154
+ analyticsData: {
155
+ trigger: 'blanket'
156
+ }
157
+ });
158
+ var handleBackButtonClose = usePlatformLeafEventHandler({
159
+ fn: function fn(evt, analyticsEvent) {
160
+ return onClose === null || onClose === void 0 ? void 0 : onClose(evt, analyticsEvent);
161
+ },
162
+ action: 'dismissed',
163
+ componentName: 'drawer',
164
+ packageName: "@atlaskit/drawer",
165
+ packageVersion: "13.2.0",
166
+ analyticsData: {
167
+ trigger: 'backButton'
168
+ }
169
+ });
170
+
171
+ // Bridge the Dialog primitive's `onClose({ reason })` to the legacy
172
+ // `onClose(event, analyticsEvent)` contract via a synthetic event. Drawer
173
+ // has no `shouldCloseOn*` props, so both reasons always forward.
174
+ var handleDialogClose = useCallback(function (_ref3) {
175
+ var reason = _ref3.reason;
176
+ var event = createCloseEvent({
177
+ reason: reason
178
+ });
179
+ if (reason === 'escape') {
180
+ handleEscapeClose(event);
181
+ } else {
182
+ handleBlanketClose(event);
183
+ }
184
+ }, [handleEscapeClose, handleBlanketClose]);
185
+
186
+ // Mirror the legacy window `keydown` listener so `onKeyDown` still fires
187
+ // while the drawer is open.
188
+ var handleKeyDown = useCallback(function (evt) {
189
+ onKeyDown === null || onKeyDown === void 0 || onKeyDown(evt);
190
+ }, [onKeyDown]);
191
+ useEffect(function () {
192
+ if (!isOpen) {
193
+ return;
194
+ }
195
+ return bind(window, {
196
+ type: 'keydown',
197
+ listener: handleKeyDown
198
+ });
199
+ }, [isOpen, handleKeyDown]);
200
+
201
+ // `onOpenComplete` once the entry animation settles (via `Dialog`'s
202
+ // `onEnterFinish`, which the underlying hook fires for animated,
203
+ // non-animated and reduced-motion paths).
204
+ var handleEnterFinish = useCallback(function () {
205
+ onOpenComplete === null || onOpenComplete === void 0 || onOpenComplete(contentRef.current);
206
+ }, [onOpenComplete]);
207
+
208
+ // `onCloseComplete` once the exit animation settles (via `Dialog`'s
209
+ // `onExitFinish`). This is also where a custom `shouldReturnFocus={ref}` is
210
+ // honoured: native `<dialog>` restores focus to the trigger at the start of
211
+ // close, so the consumer's ref is focused now that the exit is done.
212
+ // `shouldReturnFocus={false}` is a documented best-effort limitation; native
213
+ // always restores focus to the trigger.
214
+ var handleExitFinish = useCallback(function () {
215
+ var _contentRef$current;
216
+ onCloseComplete === null || onCloseComplete === void 0 || onCloseComplete((_contentRef$current = contentRef.current) !== null && _contentRef$current !== void 0 ? _contentRef$current : lastContentElRef.current);
217
+ lastContentElRef.current = null;
218
+ if (_typeof(shouldReturnFocus) === 'object' && shouldReturnFocus !== null && shouldReturnFocus !== void 0 && shouldReturnFocus.current) {
219
+ shouldReturnFocus.current.focus();
220
+ }
221
+ }, [onCloseComplete, shouldReturnFocus]);
222
+
223
+ // Pin the `<dialog>` full-height to the inline-start edge (overriding the
224
+ // primitive's centred `margin: auto`); width from the preset, clamped to the
225
+ // viewport. `enterFrom` only drives the slide animation, not the pin edge;
226
+ // it matches the legacy panel, which always pins `inset-inline-start`.
227
+ var dialogStyle = {
228
+ margin: 0,
229
+ insetBlockStart: 0,
230
+ insetInlineStart: 0,
231
+ insetInlineEnd: 'auto',
232
+ height: '100dvh',
233
+ maxHeight: '100dvh',
234
+ width: "min(".concat(WIDTH_MAP[width], ", 100vw)")
235
+ };
236
+ var accessibleName = getAccessibleName({
237
+ label: label,
238
+ titleId: titleId
239
+ });
240
+ return /*#__PURE__*/React.createElement(Dialog, _extends({
241
+ isOpen: isOpen,
242
+ onClose: handleDialogClose,
243
+ onEnterFinish: handleEnterFinish,
244
+ onExitFinish: handleExitFinish,
245
+ animate: animate,
246
+ xcss: cx(styles.root, drawerAnimationStyles[enterFrom]),
247
+ shouldHideBackdrop: stackIndex > 0,
248
+ testId: testId
249
+ }, accessibleName, {
250
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
251
+ style: dialogStyle
252
+ }), /*#__PURE__*/React.createElement(DialogScrollLock, {
253
+ isOpen: true
254
+ }), /*#__PURE__*/React.createElement("div", {
255
+ ref: setContentEl,
256
+ className: ax([styles.surface])
257
+ }, /*#__PURE__*/React.createElement(EnsureIsInsideDrawerContext.Provider, {
258
+ value: true
259
+ }, /*#__PURE__*/React.createElement(OnCloseContext.Provider, {
260
+ value: handleBackButtonClose
261
+ }, children))));
262
+ }
@@ -1,6 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useCallback, useEffect, useLayoutEffect, useState } from 'react';
3
3
  import { bind } from 'bind-event-listener';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
 
5
6
  /**
6
7
  * Returns how far the body is scrolled from the top of the viewport.
@@ -41,6 +42,11 @@ export default function usePreventProgrammaticScroll() {
41
42
  }
42
43
  }, [scrollTopOffset]);
43
44
  useEffect(function () {
45
+ // The top-layer drawer relies on native modality + `DialogScrollLock`; the
46
+ // programmatic-scroll guard is intentionally dropped under the flag.
47
+ if (fg('platform-dst-top-layer')) {
48
+ return;
49
+ }
44
50
  return bind(window, {
45
51
  type: 'scroll',
46
52
  listener: onWindowScroll
@@ -4,9 +4,11 @@ import React, { useCallback, useEffect } from 'react';
4
4
  import { canUseDOM } from 'exenv';
5
5
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
6
6
  import { Layering, useCloseOnEscapePress } from '@atlaskit/layering';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import Portal from '@atlaskit/portal';
8
9
  import Blanket from './blanket';
9
10
  import { DrawerPanel } from './drawer-panel/drawer-panel';
11
+ import { DrawerTopLayer } from './drawer-panel/drawer-top-layer';
10
12
  // escape close manager for layering
11
13
  var EscapeCloseManager = function EscapeCloseManager(_ref) {
12
14
  var onClose = _ref.onClose;
@@ -19,17 +21,7 @@ var EscapeCloseManager = function EscapeCloseManager(_ref) {
19
21
  });
20
22
  return /*#__PURE__*/React.createElement("span", null);
21
23
  };
22
-
23
- /**
24
- * __Drawer__
25
- *
26
- * A drawer is a panel that slides in from the left side of the screen.
27
- *
28
- * - [Examples](https://atlassian.design/components/drawer/examples)
29
- * - [Code](https://atlassian.design/components/drawer/code)
30
- * - [Usage](https://atlassian.design/components/drawer/usage)
31
- */
32
- export var Drawer = function Drawer(_ref2) {
24
+ var DrawerBase = function DrawerBase(_ref2) {
33
25
  var _ref2$width = _ref2.width,
34
26
  width = _ref2$width === void 0 ? 'narrow' : _ref2$width,
35
27
  isOpen = _ref2.isOpen,
@@ -57,7 +49,7 @@ export var Drawer = function Drawer(_ref2) {
57
49
  action: 'dismissed',
58
50
  componentName: 'drawer',
59
51
  packageName: "@atlaskit/drawer",
60
- packageVersion: "13.1.0",
52
+ packageVersion: "13.2.0",
61
53
  analyticsData: {
62
54
  trigger: 'escKey'
63
55
  }
@@ -80,7 +72,7 @@ export var Drawer = function Drawer(_ref2) {
80
72
  action: 'dismissed',
81
73
  componentName: 'drawer',
82
74
  packageName: "@atlaskit/drawer",
83
- packageVersion: "13.1.0",
75
+ packageVersion: "13.2.0",
84
76
  analyticsData: {
85
77
  trigger: 'blanket'
86
78
  }
@@ -92,7 +84,7 @@ export var Drawer = function Drawer(_ref2) {
92
84
  action: 'dismissed',
93
85
  componentName: 'drawer',
94
86
  packageName: "@atlaskit/drawer",
95
- packageVersion: "13.1.0",
87
+ packageVersion: "13.2.0",
96
88
  analyticsData: {
97
89
  trigger: 'backButton'
98
90
  }
@@ -125,4 +117,23 @@ export var Drawer = function Drawer(_ref2) {
125
117
  }, children, /*#__PURE__*/React.createElement(EscapeCloseManager, {
126
118
  onClose: handleClose
127
119
  })) : children));
120
+ };
121
+
122
+ /**
123
+ * __Drawer__
124
+ *
125
+ * A drawer is a panel that slides in from the left side of the screen.
126
+ *
127
+ * - [Examples](https://atlassian.design/components/drawer/examples)
128
+ * - [Code](https://atlassian.design/components/drawer/code)
129
+ * - [Usage](https://atlassian.design/components/drawer/usage)
130
+ */
131
+ export var Drawer = function Drawer(props) {
132
+ if (fg('platform-dst-top-layer')) {
133
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props -- internal implementation component takes the same DrawerProps
134
+ return /*#__PURE__*/React.createElement(DrawerTopLayer, props);
135
+ }
136
+
137
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props -- internal implementation component takes the same DrawerProps
138
+ return /*#__PURE__*/React.createElement(DrawerBase, props);
128
139
  };
@@ -0,0 +1,82 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import { useEffect } from 'react';
3
+ import useLazyCallback from '@atlaskit/ds-lib/use-lazy-callback';
4
+ import usePreviousValue from '@atlaskit/ds-lib/use-previous-value';
5
+ import useStateRef from '@atlaskit/ds-lib/use-state-ref';
6
+
7
+ /**
8
+ * **Major versions will not know about each other**
9
+ *
10
+ * An array holding references to all currently open drawers. This only works
11
+ * for drawers of the same major version, because the reference differs between
12
+ * majors (for example V13 will not know about any from V14).
13
+ *
14
+ * Adapted from `useModalStack` in `@atlaskit/modal-dialog`. The top-layer drawer
15
+ * path uses this to know its position in the stack so that only the foreground
16
+ * drawer renders a visible `::backdrop` (this avoids cumulative darkening for
17
+ * nested or stacked drawers). Unlike the modal version, the register is timed
18
+ * off `isOpen` rather than `@atlaskit/motion`'s `useExitingPersistence`: the
19
+ * `Dialog` primitive owns its own exit lifecycle, so the top-layer drawer needs
20
+ * no `ExitingPersistence` wrapper.
21
+ */
22
+ var drawerStackRegister = [];
23
+ /**
24
+ * Returns the position of the calling drawer in the drawer stack. A stack index
25
+ * of `0` is the foreground (top of the stack); higher numbers are further back.
26
+ */
27
+ export default function useDrawerStack(_ref) {
28
+ var isOpen = _ref.isOpen,
29
+ onStackChange = _ref.onStackChange;
30
+ var _useStateRef = useStateRef(0),
31
+ _useStateRef2 = _slicedToArray(_useStateRef, 2),
32
+ stackIndexRef = _useStateRef2[0],
33
+ setStackIndex = _useStateRef2[1];
34
+ var currentStackIndex = stackIndexRef.current;
35
+ var previousStackIndex = usePreviousValue(stackIndexRef.current);
36
+
37
+ // Kept stable for the lifetime of the component so it can be the identity in
38
+ // the shared register. This is why it is a lazy callback and not a
39
+ // useMemo/useCallback value.
40
+ var updateStack = useLazyCallback(function () {
41
+ var newStackIndex = drawerStackRegister.indexOf(updateStack);
42
+ // Read from the ref rather than state: this closure only ever sees the
43
+ // initial state value.
44
+ if (stackIndexRef.current !== newStackIndex) {
45
+ setStackIndex(newStackIndex);
46
+ stackIndexRef.current = newStackIndex;
47
+ }
48
+ });
49
+ useEffect(function () {
50
+ if (!isOpen) {
51
+ return;
52
+ }
53
+ // Opening: join the front of the register (the newest open drawer is the
54
+ // foreground at index 0), then notify every open drawer to recompute.
55
+ if (drawerStackRegister.indexOf(updateStack) === -1) {
56
+ drawerStackRegister.unshift(updateStack);
57
+ }
58
+ drawerStackRegister.forEach(function (callback) {
59
+ return callback();
60
+ });
61
+ return function () {
62
+ // Closing or unmounting: leave the register and notify the rest.
63
+ var index = drawerStackRegister.indexOf(updateStack);
64
+ if (index !== -1) {
65
+ drawerStackRegister.splice(index, 1);
66
+ }
67
+ drawerStackRegister.forEach(function (callback) {
68
+ return callback();
69
+ });
70
+ };
71
+ }, [isOpen, updateStack]);
72
+ useEffect(function () {
73
+ if (previousStackIndex === undefined) {
74
+ // Initial render: nothing to notify about.
75
+ return;
76
+ }
77
+ if (previousStackIndex !== currentStackIndex) {
78
+ onStackChange === null || onStackChange === void 0 || onStackChange(currentStackIndex);
79
+ }
80
+ }, [onStackChange, previousStackIndex, currentStackIndex]);
81
+ return currentStackIndex;
82
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { type ReactNode } from 'react';
6
+ import { type DrawerProps } from '../types';
7
+ /**
8
+ * **DrawerTopLayer**
9
+ *
10
+ * Top-layer (`platform-dst-top-layer`) implementation of `Drawer`. Renders a
11
+ * native `<dialog>` via `@atlaskit/top-layer`, replacing Portal, Blanket,
12
+ * react-focus-lock, react-scrolllock and `@atlaskit/layering` with native
13
+ * modality, `::backdrop`, focus trap and return, and `DialogScrollLock`.
14
+ *
15
+ * The `Dialog` primitive owns the entry and exit animation lifecycle (it keeps
16
+ * the host element mounted through the exit transition, then fires
17
+ * `onExitFinish`), so no `ExitingPersistence` wrapper is needed: the drawer
18
+ * renders `<Dialog isOpen={isOpen}>` directly. `useDrawerStack` tracks stack
19
+ * depth so only the foreground drawer shows a `::backdrop`.
20
+ *
21
+ * `isFocusLockEnabled` is intentionally unsupported: a native modal `<dialog>`
22
+ * always traps focus, so `isFocusLockEnabled={false}` is a no-op under this gate.
23
+ */
24
+ export declare function DrawerTopLayer({ width, isOpen, shouldReturnFocus, onKeyDown, testId, children, onClose, onCloseComplete, onOpenComplete, label, titleId, enterFrom, }: DrawerProps): ReactNode;
@@ -9,4 +9,4 @@ import type { DrawerProps } from './types';
9
9
  * - [Code](https://atlassian.design/components/drawer/code)
10
10
  * - [Usage](https://atlassian.design/components/drawer/usage)
11
11
  */
12
- export declare const Drawer: ({ width, isOpen, isFocusLockEnabled, shouldReturnFocus, autoFocusFirstElem, onKeyDown, testId, children, onClose, onCloseComplete, onOpenComplete, zIndex, label, titleId, enterFrom, }: DrawerProps) => React.JSX.Element | null;
12
+ export declare const Drawer: (props: DrawerProps) => React.JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ type TDrawerStackOpts = {
2
+ /**
3
+ * Whether the calling drawer is open. The drawer joins the stack while open
4
+ * and leaves it on close or unmount.
5
+ */
6
+ isOpen: boolean;
7
+ /**
8
+ * Fired when the calling drawer's position in the stack changes.
9
+ */
10
+ onStackChange?: (newStackIndex: number) => void;
11
+ };
12
+ /**
13
+ * Returns the position of the calling drawer in the drawer stack. A stack index
14
+ * of `0` is the foreground (top of the stack); higher numbers are further back.
15
+ */
16
+ export default function useDrawerStack({ isOpen, onStackChange }: TDrawerStackOpts): number;
17
+ export {};
package/drawer.docs.tsx CHANGED
@@ -11,7 +11,7 @@ const documentation: StructuredContentSource = {
11
11
  status: 'intent-to-deprecate',
12
12
  import: {
13
13
  name: 'Drawer',
14
- package: '@atlaskit/drawer',
14
+ package: '@atlaskit/drawer/drawer',
15
15
  type: 'default',
16
16
  packagePath: path.resolve(__dirname),
17
17
  packageJson: require('./package.json'),
@@ -52,7 +52,7 @@ const documentation: StructuredContentSource = {
52
52
  status: 'intent-to-deprecate',
53
53
  import: {
54
54
  name: 'DrawerContent',
55
- package: '@atlaskit/drawer',
55
+ package: '@atlaskit/drawer/drawer-content',
56
56
  type: 'named',
57
57
  packagePath: path.resolve(__dirname),
58
58
  packageJson: require('./package.json'),
@@ -83,7 +83,7 @@ const documentation: StructuredContentSource = {
83
83
  status: 'intent-to-deprecate',
84
84
  import: {
85
85
  name: 'DrawerSidebar',
86
- package: '@atlaskit/drawer',
86
+ package: '@atlaskit/drawer/drawer-sidebar',
87
87
  type: 'named',
88
88
  packagePath: path.resolve(__dirname),
89
89
  packageJson: require('./package.json'),
@@ -114,7 +114,7 @@ const documentation: StructuredContentSource = {
114
114
  status: 'intent-to-deprecate',
115
115
  import: {
116
116
  name: 'DrawerCloseButton',
117
- package: '@atlaskit/drawer',
117
+ package: '@atlaskit/drawer/drawer-close-button',
118
118
  type: 'named',
119
119
  packagePath: path.resolve(__dirname),
120
120
  packageJson: require('./package.json'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/drawer",
3
- "version": "13.1.1",
3
+ "version": "13.3.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/"
@@ -16,6 +16,11 @@
16
16
  "**/*.compiled.css"
17
17
  ],
18
18
  "atlaskit:src": "src/index.tsx",
19
+ "platform-feature-flags": {
20
+ "platform-dst-top-layer": {
21
+ "type": "boolean"
22
+ }
23
+ },
19
24
  "homepage": "https://atlassian.design/components/drawer",
20
25
  "atlassian": {
21
26
  "react-compiler": {
@@ -36,17 +41,20 @@
36
41
  }
37
42
  },
38
43
  "dependencies": {
39
- "@atlaskit/analytics-next": "^12.1.0",
44
+ "@atlaskit/analytics-next": "^12.2.0",
40
45
  "@atlaskit/blanket": "^16.1.0",
41
46
  "@atlaskit/button": "^24.3.0",
42
47
  "@atlaskit/css": "^1.0.0",
43
- "@atlaskit/icon": "^36.1.0",
48
+ "@atlaskit/ds-lib": "^8.0.0",
49
+ "@atlaskit/icon": "^36.2.0",
44
50
  "@atlaskit/layering": "^4.1.0",
45
- "@atlaskit/motion": "^7.2.0",
51
+ "@atlaskit/motion": "^7.3.0",
52
+ "@atlaskit/platform-feature-flags": "^2.0.0",
46
53
  "@atlaskit/portal": "^6.1.0",
47
54
  "@atlaskit/react-compiler-gating": "^0.2.0",
48
55
  "@atlaskit/theme": "^26.1.0",
49
- "@atlaskit/tokens": "^15.2.0",
56
+ "@atlaskit/tokens": "^15.5.0",
57
+ "@atlaskit/top-layer": "^1.6.0",
50
58
  "@babel/runtime": "^7.0.0",
51
59
  "@compiled/react": "^0.20.0",
52
60
  "bind-event-listener": "^3.0.0",
@@ -66,14 +74,14 @@
66
74
  "@atlaskit/code": "^18.2.0",
67
75
  "@atlaskit/docs": "^12.0.0",
68
76
  "@atlaskit/dropdown-menu": "^17.1.0",
69
- "@atlaskit/ds-lib": "^8.0.0",
70
77
  "@atlaskit/form": "^16.1.0",
71
78
  "@atlaskit/inline-message": "^16.1.0",
72
79
  "@atlaskit/link": "^4.1.0",
73
80
  "@atlaskit/menu": "^9.1.0",
74
81
  "@atlaskit/modal-dialog": "^16.1.0",
75
- "@atlaskit/primitives": "^20.2.0",
82
+ "@atlaskit/primitives": "^20.5.0",
76
83
  "@atlaskit/section-message": "^9.2.0",
84
+ "@atlassian/feature-flags-test-utils": "^1.1.0",
77
85
  "@atlassian/ssr-tests": "workspace:^",
78
86
  "@atlassian/structured-docs-types": "workspace:^",
79
87
  "@testing-library/react": "^16.3.0",