@atlaskit/drawer 13.2.0 → 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.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/drawer-panel/drawer-top-layer.compiled.css +27 -1
- package/dist/cjs/drawer-panel/drawer-top-layer.js +27 -12
- package/dist/cjs/drawer.js +3 -3
- package/dist/es2019/drawer-panel/drawer-top-layer.compiled.css +27 -1
- package/dist/es2019/drawer-panel/drawer-top-layer.js +28 -11
- package/dist/es2019/drawer.js +3 -3
- package/dist/esm/drawer-panel/drawer-top-layer.compiled.css +27 -1
- package/dist/esm/drawer-panel/drawer-top-layer.js +28 -13
- package/dist/esm/drawer.js +3 -3
- package/drawer.docs.tsx +4 -4
- package/package.json +6 -6
- package/dist/cjs/drawer-panel/drawer-slide-in.js +0 -67
- package/dist/es2019/drawer-panel/drawer-slide-in.js +0 -107
- package/dist/esm/drawer-panel/drawer-slide-in.js +0 -61
- package/dist/types/drawer-panel/drawer-slide-in.d.ts +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/drawer
|
|
2
2
|
|
|
3
|
+
## 13.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`530dfb5aee695`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/530dfb5aee695) -
|
|
8
|
+
Updates how animations are applied to Drawer when the `platform-dst-top-layer` feature gate is
|
|
9
|
+
enabled.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 13.2.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1,8 +1,34 @@
|
|
|
1
|
+
._13ku1fu8::-ms-backdrop{transition-timing-function:cubic-bezier(.15,1,.3,1)}
|
|
2
|
+
._13ku1fu8::backdrop{transition-timing-function:cubic-bezier(.15,1,.3,1)}
|
|
1
3
|
._18m915vq{overflow-y:hidden}
|
|
2
4
|
._1bsb1osq{width:100%}
|
|
3
5
|
._1e0c1txw{display:flex}
|
|
6
|
+
._1fsl1yx9[open]{transition-duration:.1s}
|
|
7
|
+
._1fyf1a5r::-ms-backdrop{transition-behavior:allow-discrete}
|
|
8
|
+
._1fyf1a5r::backdrop{transition-behavior:allow-discrete}
|
|
9
|
+
._1kdeglyw[open]{transform:none}
|
|
10
|
+
._1ltk1j28::-ms-backdrop{background-color:transparent}
|
|
11
|
+
._1ltk1j28::backdrop{background-color:transparent}
|
|
12
|
+
._1oec14ed{transition-duration:50ms}
|
|
4
13
|
._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
|
|
5
14
|
._1reo15vq{overflow-x:hidden}
|
|
15
|
+
._1s9z1a5r{transition-behavior:allow-discrete}
|
|
6
16
|
._4t3i1osq{height:100%}
|
|
17
|
+
._4v7ipwmj[open]::-ms-backdrop{transition-duration:.7s}
|
|
18
|
+
._4v7ipwmj[open]::backdrop{transition-duration:.7s}
|
|
19
|
+
._6fl4dkwg{transition-timing-function:cubic-bezier(.2,0,0,1)}
|
|
7
20
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
8
|
-
.
|
|
21
|
+
._d7fr1i5c[open]::-ms-backdrop{background-color:var(--ds-blanket,#050c1f75)}
|
|
22
|
+
._d7fr1i5c[open]::backdrop{background-color:var(--ds-blanket,#050c1f75)}
|
|
23
|
+
._ect4ttxp{font-family:var(--ds-font-family-body,"Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
24
|
+
._k8m05ji5{transition-property:transform,overlay,display}
|
|
25
|
+
._njwkivc9::-ms-backdrop{-ms-transition-property:background-color,overlay,display;transition-property:background-color,overlay,display}
|
|
26
|
+
._njwkivc9::backdrop{transition-property:background-color,overlay,display}
|
|
27
|
+
._t9ec3k1b{transform:translateY(100%)}
|
|
28
|
+
._t9ecjq3t{transform:translateX(-100%)}
|
|
29
|
+
._t9ecxwn4{transform:translateX(100%)}
|
|
30
|
+
._t9ecz6y5{transform:translateY(-100%)}
|
|
31
|
+
._yhpq1ttt::-ms-backdrop{transition-duration:.35s}
|
|
32
|
+
._yhpq1ttt::backdrop{transition-duration:.35s}
|
|
33
|
+
@media (prefers-reduced-motion:reduce){._156yru3m{transition-duration:0s}._aeldru3m[open]{transition-duration:0s}._1sbqru3m::-ms-backdrop{transition-duration:0s}._1sbqru3m::backdrop{transition-duration:0s}._1i6zru3m[open]::-ms-backdrop{transition-duration:0s}._1i6zru3m[open]::backdrop{transition-duration:0s}}
|
|
34
|
+
@starting-style{._1dar1j28[open]::-ms-backdrop{background-color:transparent}._1dar1j28[open]::backdrop{background-color:transparent}._1hqt3k1b[open]{transform:translateY(100%)}._1hqtjq3t[open]{transform:translateX(-100%)}._1hqtxwn4[open]{transform:translateX(100%)}._1hqtz6y5[open]{transform:translateY(-100%)}}
|
|
@@ -13,6 +13,7 @@ var React = _react;
|
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
16
|
+
var _react2 = require("@compiled/react");
|
|
16
17
|
var _bindEventListener = require("bind-event-listener");
|
|
17
18
|
var _usePlatformLeafEventHandler = require("@atlaskit/analytics-next/usePlatformLeafEventHandler");
|
|
18
19
|
var _dialog = require("@atlaskit/top-layer/dialog");
|
|
@@ -20,12 +21,33 @@ var _dialogScrollLock = require("@atlaskit/top-layer/dialog-scroll-lock");
|
|
|
20
21
|
var _ensureIsInsideDrawerContext = require("../ensure-is-inside-drawer-context");
|
|
21
22
|
var _onCloseContext = require("../on-close-context");
|
|
22
23
|
var _useDrawerStack = _interopRequireDefault(require("../use-drawer-stack"));
|
|
23
|
-
var _drawerSlideIn = require("./drawer-slide-in");
|
|
24
24
|
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" != _typeof3(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); }
|
|
25
25
|
var LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
26
|
+
|
|
27
|
+
// Legacy drawer panel uses `SlideIn duration="small"`, which resolves to
|
|
28
|
+
// 100ms on enter and 50ms on exit.
|
|
29
|
+
var slideEnterDurationMs = 100;
|
|
30
|
+
var slideExitDurationMs = 50;
|
|
31
|
+
|
|
32
|
+
// Legacy drawer blanket is a separate `FadeIn duration="large"`, which resolves
|
|
33
|
+
// to 700ms on enter and 350ms on exit. These intentionally differ from the panel
|
|
34
|
+
// slide timings to preserve the old visual behavior.
|
|
35
|
+
var fadeEnterDurationMs = 700;
|
|
36
|
+
var fadeExitDurationMs = 350;
|
|
37
|
+
var animate = {
|
|
38
|
+
kind: 'dialog',
|
|
39
|
+
name: 'custom'
|
|
40
|
+
};
|
|
26
41
|
var styles = {
|
|
42
|
+
root: "_k8m05ji5 _1oec14ed _6fl4dkwg _1s9z1a5r _1kdeglyw _1fsl1yx9 _1ltk1j28 _njwkivc9 _yhpq1ttt _13ku1fu8 _1fyf1a5r _d7fr1i5c _4v7ipwmj _1dar1j28 _156yru3m _aeldru3m _1sbqru3m _1i6zru3m",
|
|
27
43
|
surface: "_1reo15vq _18m915vq _1e0c1txw _1bsb1osq _4t3i1osq _bfhk1bhr _1q1l1bhr _ect4ttxp"
|
|
28
44
|
};
|
|
45
|
+
var drawerAnimationStyles = {
|
|
46
|
+
left: "_t9ecjq3t _1hqtjq3t",
|
|
47
|
+
right: "_t9ecxwn4 _1hqtxwn4",
|
|
48
|
+
top: "_t9ecz6y5 _1hqtz6y5",
|
|
49
|
+
bottom: "_t9ec3k1b _1hqt3k1b"
|
|
50
|
+
};
|
|
29
51
|
|
|
30
52
|
// Width presets mirror the legacy `DrawerPanel`. Applied to the `<dialog>` (the
|
|
31
53
|
// sized, edge-pinned element) and clamped to the viewport for mobile safety.
|
|
@@ -125,7 +147,7 @@ function DrawerTopLayer(_ref2) {
|
|
|
125
147
|
action: 'dismissed',
|
|
126
148
|
componentName: 'drawer',
|
|
127
149
|
packageName: "@atlaskit/drawer",
|
|
128
|
-
packageVersion: "13.
|
|
150
|
+
packageVersion: "13.2.0",
|
|
129
151
|
analyticsData: {
|
|
130
152
|
trigger: 'escKey'
|
|
131
153
|
}
|
|
@@ -137,7 +159,7 @@ function DrawerTopLayer(_ref2) {
|
|
|
137
159
|
action: 'dismissed',
|
|
138
160
|
componentName: 'drawer',
|
|
139
161
|
packageName: "@atlaskit/drawer",
|
|
140
|
-
packageVersion: "13.
|
|
162
|
+
packageVersion: "13.2.0",
|
|
141
163
|
analyticsData: {
|
|
142
164
|
trigger: 'blanket'
|
|
143
165
|
}
|
|
@@ -149,7 +171,7 @@ function DrawerTopLayer(_ref2) {
|
|
|
149
171
|
action: 'dismissed',
|
|
150
172
|
componentName: 'drawer',
|
|
151
173
|
packageName: "@atlaskit/drawer",
|
|
152
|
-
packageVersion: "13.
|
|
174
|
+
packageVersion: "13.2.0",
|
|
153
175
|
analyticsData: {
|
|
154
176
|
trigger: 'backButton'
|
|
155
177
|
}
|
|
@@ -220,14 +242,6 @@ function DrawerTopLayer(_ref2) {
|
|
|
220
242
|
maxHeight: '100dvh',
|
|
221
243
|
width: "min(".concat(WIDTH_MAP[width], ", 100vw)")
|
|
222
244
|
};
|
|
223
|
-
|
|
224
|
-
// Memoized so the preset object (and its CSS string) is rebuilt only when
|
|
225
|
-
// `enterFrom` changes, not on every render.
|
|
226
|
-
var animate = (0, _react.useMemo)(function () {
|
|
227
|
-
return (0, _drawerSlideIn.drawerSlideIn)({
|
|
228
|
-
from: enterFrom
|
|
229
|
-
});
|
|
230
|
-
}, [enterFrom]);
|
|
231
245
|
var accessibleName = getAccessibleName({
|
|
232
246
|
label: label,
|
|
233
247
|
titleId: titleId
|
|
@@ -238,6 +252,7 @@ function DrawerTopLayer(_ref2) {
|
|
|
238
252
|
onEnterFinish: handleEnterFinish,
|
|
239
253
|
onExitFinish: handleExitFinish,
|
|
240
254
|
animate: animate,
|
|
255
|
+
xcss: (0, _react2.cx)(styles.root, drawerAnimationStyles[enterFrom]),
|
|
241
256
|
shouldHideBackdrop: stackIndex > 0,
|
|
242
257
|
testId: testId
|
|
243
258
|
}, accessibleName, {
|
package/dist/cjs/drawer.js
CHANGED
|
@@ -59,7 +59,7 @@ var DrawerBase = function DrawerBase(_ref2) {
|
|
|
59
59
|
action: 'dismissed',
|
|
60
60
|
componentName: 'drawer',
|
|
61
61
|
packageName: "@atlaskit/drawer",
|
|
62
|
-
packageVersion: "13.
|
|
62
|
+
packageVersion: "13.2.0",
|
|
63
63
|
analyticsData: {
|
|
64
64
|
trigger: 'escKey'
|
|
65
65
|
}
|
|
@@ -82,7 +82,7 @@ var DrawerBase = function DrawerBase(_ref2) {
|
|
|
82
82
|
action: 'dismissed',
|
|
83
83
|
componentName: 'drawer',
|
|
84
84
|
packageName: "@atlaskit/drawer",
|
|
85
|
-
packageVersion: "13.
|
|
85
|
+
packageVersion: "13.2.0",
|
|
86
86
|
analyticsData: {
|
|
87
87
|
trigger: 'blanket'
|
|
88
88
|
}
|
|
@@ -94,7 +94,7 @@ var DrawerBase = function DrawerBase(_ref2) {
|
|
|
94
94
|
action: 'dismissed',
|
|
95
95
|
componentName: 'drawer',
|
|
96
96
|
packageName: "@atlaskit/drawer",
|
|
97
|
-
packageVersion: "13.
|
|
97
|
+
packageVersion: "13.2.0",
|
|
98
98
|
analyticsData: {
|
|
99
99
|
trigger: 'backButton'
|
|
100
100
|
}
|
|
@@ -1,8 +1,34 @@
|
|
|
1
|
+
._13ku1fu8::-ms-backdrop{transition-timing-function:cubic-bezier(.15,1,.3,1)}
|
|
2
|
+
._13ku1fu8::backdrop{transition-timing-function:cubic-bezier(.15,1,.3,1)}
|
|
1
3
|
._18m915vq{overflow-y:hidden}
|
|
2
4
|
._1bsb1osq{width:100%}
|
|
3
5
|
._1e0c1txw{display:flex}
|
|
6
|
+
._1fsl1yx9[open]{transition-duration:.1s}
|
|
7
|
+
._1fyf1a5r::-ms-backdrop{transition-behavior:allow-discrete}
|
|
8
|
+
._1fyf1a5r::backdrop{transition-behavior:allow-discrete}
|
|
9
|
+
._1kdeglyw[open]{transform:none}
|
|
10
|
+
._1ltk1j28::-ms-backdrop{background-color:transparent}
|
|
11
|
+
._1ltk1j28::backdrop{background-color:transparent}
|
|
12
|
+
._1oec14ed{transition-duration:50ms}
|
|
4
13
|
._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
|
|
5
14
|
._1reo15vq{overflow-x:hidden}
|
|
15
|
+
._1s9z1a5r{transition-behavior:allow-discrete}
|
|
6
16
|
._4t3i1osq{height:100%}
|
|
17
|
+
._4v7ipwmj[open]::-ms-backdrop{transition-duration:.7s}
|
|
18
|
+
._4v7ipwmj[open]::backdrop{transition-duration:.7s}
|
|
19
|
+
._6fl4dkwg{transition-timing-function:cubic-bezier(.2,0,0,1)}
|
|
7
20
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
8
|
-
.
|
|
21
|
+
._d7fr1i5c[open]::-ms-backdrop{background-color:var(--ds-blanket,#050c1f75)}
|
|
22
|
+
._d7fr1i5c[open]::backdrop{background-color:var(--ds-blanket,#050c1f75)}
|
|
23
|
+
._ect4ttxp{font-family:var(--ds-font-family-body,"Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
24
|
+
._k8m05ji5{transition-property:transform,overlay,display}
|
|
25
|
+
._njwkivc9::-ms-backdrop{-ms-transition-property:background-color,overlay,display;transition-property:background-color,overlay,display}
|
|
26
|
+
._njwkivc9::backdrop{transition-property:background-color,overlay,display}
|
|
27
|
+
._t9ec3k1b{transform:translateY(100%)}
|
|
28
|
+
._t9ecjq3t{transform:translateX(-100%)}
|
|
29
|
+
._t9ecxwn4{transform:translateX(100%)}
|
|
30
|
+
._t9ecz6y5{transform:translateY(-100%)}
|
|
31
|
+
._yhpq1ttt::-ms-backdrop{transition-duration:.35s}
|
|
32
|
+
._yhpq1ttt::backdrop{transition-duration:.35s}
|
|
33
|
+
@media (prefers-reduced-motion:reduce){._156yru3m{transition-duration:0s}._aeldru3m[open]{transition-duration:0s}._1sbqru3m::-ms-backdrop{transition-duration:0s}._1sbqru3m::backdrop{transition-duration:0s}._1i6zru3m[open]::-ms-backdrop{transition-duration:0s}._1i6zru3m[open]::backdrop{transition-duration:0s}}
|
|
34
|
+
@starting-style{._1dar1j28[open]::-ms-backdrop{background-color:transparent}._1dar1j28[open]::backdrop{background-color:transparent}._1hqt3k1b[open]{transform:translateY(100%)}._1hqtjq3t[open]{transform:translateX(-100%)}._1hqtxwn4[open]{transform:translateX(100%)}._1hqtz6y5[open]{transform:translateY(-100%)}}
|
|
@@ -3,7 +3,8 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import "./drawer-top-layer.compiled.css";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
-
import { useCallback, useEffect,
|
|
6
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
7
|
+
import { cx } from '@compiled/react';
|
|
7
8
|
import { bind } from 'bind-event-listener';
|
|
8
9
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
9
10
|
import { createCloseEvent, Dialog } from '@atlaskit/top-layer/dialog';
|
|
@@ -11,11 +12,32 @@ import { DialogScrollLock } from '@atlaskit/top-layer/dialog-scroll-lock';
|
|
|
11
12
|
import { EnsureIsInsideDrawerContext } from '../ensure-is-inside-drawer-context';
|
|
12
13
|
import { OnCloseContext } from '../on-close-context';
|
|
13
14
|
import useDrawerStack from '../use-drawer-stack';
|
|
14
|
-
import { drawerSlideIn } from './drawer-slide-in';
|
|
15
15
|
const LOCAL_CURRENT_SURFACE_CSS_VAR = '--ds-elevation-surface-current';
|
|
16
|
+
|
|
17
|
+
// Legacy drawer panel uses `SlideIn duration="small"`, which resolves to
|
|
18
|
+
// 100ms on enter and 50ms on exit.
|
|
19
|
+
const slideEnterDurationMs = 100;
|
|
20
|
+
const slideExitDurationMs = 50;
|
|
21
|
+
|
|
22
|
+
// Legacy drawer blanket is a separate `FadeIn duration="large"`, which resolves
|
|
23
|
+
// to 700ms on enter and 350ms on exit. These intentionally differ from the panel
|
|
24
|
+
// slide timings to preserve the old visual behavior.
|
|
25
|
+
const fadeEnterDurationMs = 700;
|
|
26
|
+
const fadeExitDurationMs = 350;
|
|
27
|
+
const animate = {
|
|
28
|
+
kind: 'dialog',
|
|
29
|
+
name: 'custom'
|
|
30
|
+
};
|
|
16
31
|
const styles = {
|
|
32
|
+
root: "_k8m05ji5 _1oec14ed _6fl4dkwg _1s9z1a5r _1kdeglyw _1fsl1yx9 _1ltk1j28 _njwkivc9 _yhpq1ttt _13ku1fu8 _1fyf1a5r _d7fr1i5c _4v7ipwmj _1dar1j28 _156yru3m _aeldru3m _1sbqru3m _1i6zru3m",
|
|
17
33
|
surface: "_1reo15vq _18m915vq _1e0c1txw _1bsb1osq _4t3i1osq _bfhk1bhr _1q1l1bhr _ect4ttxp"
|
|
18
34
|
};
|
|
35
|
+
const drawerAnimationStyles = {
|
|
36
|
+
left: "_t9ecjq3t _1hqtjq3t",
|
|
37
|
+
right: "_t9ecxwn4 _1hqtxwn4",
|
|
38
|
+
top: "_t9ecz6y5 _1hqtz6y5",
|
|
39
|
+
bottom: "_t9ec3k1b _1hqt3k1b"
|
|
40
|
+
};
|
|
19
41
|
|
|
20
42
|
// Width presets mirror the legacy `DrawerPanel`. Applied to the `<dialog>` (the
|
|
21
43
|
// sized, edge-pinned element) and clamped to the viewport for mobile safety.
|
|
@@ -112,7 +134,7 @@ export function DrawerTopLayer({
|
|
|
112
134
|
action: 'dismissed',
|
|
113
135
|
componentName: 'drawer',
|
|
114
136
|
packageName: "@atlaskit/drawer",
|
|
115
|
-
packageVersion: "13.
|
|
137
|
+
packageVersion: "13.2.0",
|
|
116
138
|
analyticsData: {
|
|
117
139
|
trigger: 'escKey'
|
|
118
140
|
}
|
|
@@ -122,7 +144,7 @@ export function DrawerTopLayer({
|
|
|
122
144
|
action: 'dismissed',
|
|
123
145
|
componentName: 'drawer',
|
|
124
146
|
packageName: "@atlaskit/drawer",
|
|
125
|
-
packageVersion: "13.
|
|
147
|
+
packageVersion: "13.2.0",
|
|
126
148
|
analyticsData: {
|
|
127
149
|
trigger: 'blanket'
|
|
128
150
|
}
|
|
@@ -132,7 +154,7 @@ export function DrawerTopLayer({
|
|
|
132
154
|
action: 'dismissed',
|
|
133
155
|
componentName: 'drawer',
|
|
134
156
|
packageName: "@atlaskit/drawer",
|
|
135
|
-
packageVersion: "13.
|
|
157
|
+
packageVersion: "13.2.0",
|
|
136
158
|
analyticsData: {
|
|
137
159
|
trigger: 'backButton'
|
|
138
160
|
}
|
|
@@ -204,12 +226,6 @@ export function DrawerTopLayer({
|
|
|
204
226
|
maxHeight: '100dvh',
|
|
205
227
|
width: `min(${WIDTH_MAP[width]}, 100vw)`
|
|
206
228
|
};
|
|
207
|
-
|
|
208
|
-
// Memoized so the preset object (and its CSS string) is rebuilt only when
|
|
209
|
-
// `enterFrom` changes, not on every render.
|
|
210
|
-
const animate = useMemo(() => drawerSlideIn({
|
|
211
|
-
from: enterFrom
|
|
212
|
-
}), [enterFrom]);
|
|
213
229
|
const accessibleName = getAccessibleName({
|
|
214
230
|
label,
|
|
215
231
|
titleId
|
|
@@ -220,6 +236,7 @@ export function DrawerTopLayer({
|
|
|
220
236
|
onEnterFinish: handleEnterFinish,
|
|
221
237
|
onExitFinish: handleExitFinish,
|
|
222
238
|
animate: animate,
|
|
239
|
+
xcss: cx(styles.root, drawerAnimationStyles[enterFrom]),
|
|
223
240
|
shouldHideBackdrop: stackIndex > 0,
|
|
224
241
|
testId: testId
|
|
225
242
|
}, accessibleName, {
|
package/dist/es2019/drawer.js
CHANGED
|
@@ -44,7 +44,7 @@ const DrawerBase = ({
|
|
|
44
44
|
action: 'dismissed',
|
|
45
45
|
componentName: 'drawer',
|
|
46
46
|
packageName: "@atlaskit/drawer",
|
|
47
|
-
packageVersion: "13.
|
|
47
|
+
packageVersion: "13.2.0",
|
|
48
48
|
analyticsData: {
|
|
49
49
|
trigger: 'escKey'
|
|
50
50
|
}
|
|
@@ -65,7 +65,7 @@ const DrawerBase = ({
|
|
|
65
65
|
action: 'dismissed',
|
|
66
66
|
componentName: 'drawer',
|
|
67
67
|
packageName: "@atlaskit/drawer",
|
|
68
|
-
packageVersion: "13.
|
|
68
|
+
packageVersion: "13.2.0",
|
|
69
69
|
analyticsData: {
|
|
70
70
|
trigger: 'blanket'
|
|
71
71
|
}
|
|
@@ -75,7 +75,7 @@ const DrawerBase = ({
|
|
|
75
75
|
action: 'dismissed',
|
|
76
76
|
componentName: 'drawer',
|
|
77
77
|
packageName: "@atlaskit/drawer",
|
|
78
|
-
packageVersion: "13.
|
|
78
|
+
packageVersion: "13.2.0",
|
|
79
79
|
analyticsData: {
|
|
80
80
|
trigger: 'backButton'
|
|
81
81
|
}
|
|
@@ -1,8 +1,34 @@
|
|
|
1
|
+
._13ku1fu8::-ms-backdrop{transition-timing-function:cubic-bezier(.15,1,.3,1)}
|
|
2
|
+
._13ku1fu8::backdrop{transition-timing-function:cubic-bezier(.15,1,.3,1)}
|
|
1
3
|
._18m915vq{overflow-y:hidden}
|
|
2
4
|
._1bsb1osq{width:100%}
|
|
3
5
|
._1e0c1txw{display:flex}
|
|
6
|
+
._1fsl1yx9[open]{transition-duration:.1s}
|
|
7
|
+
._1fyf1a5r::-ms-backdrop{transition-behavior:allow-discrete}
|
|
8
|
+
._1fyf1a5r::backdrop{transition-behavior:allow-discrete}
|
|
9
|
+
._1kdeglyw[open]{transform:none}
|
|
10
|
+
._1ltk1j28::-ms-backdrop{background-color:transparent}
|
|
11
|
+
._1ltk1j28::backdrop{background-color:transparent}
|
|
12
|
+
._1oec14ed{transition-duration:50ms}
|
|
4
13
|
._1q1l1bhr{--ds-elevation-surface-current:var(--ds-surface-overlay,#fff)}
|
|
5
14
|
._1reo15vq{overflow-x:hidden}
|
|
15
|
+
._1s9z1a5r{transition-behavior:allow-discrete}
|
|
6
16
|
._4t3i1osq{height:100%}
|
|
17
|
+
._4v7ipwmj[open]::-ms-backdrop{transition-duration:.7s}
|
|
18
|
+
._4v7ipwmj[open]::backdrop{transition-duration:.7s}
|
|
19
|
+
._6fl4dkwg{transition-timing-function:cubic-bezier(.2,0,0,1)}
|
|
7
20
|
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
8
|
-
.
|
|
21
|
+
._d7fr1i5c[open]::-ms-backdrop{background-color:var(--ds-blanket,#050c1f75)}
|
|
22
|
+
._d7fr1i5c[open]::backdrop{background-color:var(--ds-blanket,#050c1f75)}
|
|
23
|
+
._ect4ttxp{font-family:var(--ds-font-family-body,"Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}
|
|
24
|
+
._k8m05ji5{transition-property:transform,overlay,display}
|
|
25
|
+
._njwkivc9::-ms-backdrop{-ms-transition-property:background-color,overlay,display;transition-property:background-color,overlay,display}
|
|
26
|
+
._njwkivc9::backdrop{transition-property:background-color,overlay,display}
|
|
27
|
+
._t9ec3k1b{transform:translateY(100%)}
|
|
28
|
+
._t9ecjq3t{transform:translateX(-100%)}
|
|
29
|
+
._t9ecxwn4{transform:translateX(100%)}
|
|
30
|
+
._t9ecz6y5{transform:translateY(-100%)}
|
|
31
|
+
._yhpq1ttt::-ms-backdrop{transition-duration:.35s}
|
|
32
|
+
._yhpq1ttt::backdrop{transition-duration:.35s}
|
|
33
|
+
@media (prefers-reduced-motion:reduce){._156yru3m{transition-duration:0s}._aeldru3m[open]{transition-duration:0s}._1sbqru3m::-ms-backdrop{transition-duration:0s}._1sbqru3m::backdrop{transition-duration:0s}._1i6zru3m[open]::-ms-backdrop{transition-duration:0s}._1i6zru3m[open]::backdrop{transition-duration:0s}}
|
|
34
|
+
@starting-style{._1dar1j28[open]::-ms-backdrop{background-color:transparent}._1dar1j28[open]::backdrop{background-color:transparent}._1hqt3k1b[open]{transform:translateY(100%)}._1hqtjq3t[open]{transform:translateX(-100%)}._1hqtxwn4[open]{transform:translateX(100%)}._1hqtz6y5[open]{transform:translateY(-100%)}}
|
|
@@ -4,7 +4,8 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
4
4
|
import "./drawer-top-layer.compiled.css";
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
-
import { useCallback, useEffect,
|
|
7
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
8
|
+
import { cx } from '@compiled/react';
|
|
8
9
|
import { bind } from 'bind-event-listener';
|
|
9
10
|
import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next/usePlatformLeafEventHandler';
|
|
10
11
|
import { createCloseEvent, Dialog } from '@atlaskit/top-layer/dialog';
|
|
@@ -12,11 +13,32 @@ import { DialogScrollLock } from '@atlaskit/top-layer/dialog-scroll-lock';
|
|
|
12
13
|
import { EnsureIsInsideDrawerContext } from '../ensure-is-inside-drawer-context';
|
|
13
14
|
import { OnCloseContext } from '../on-close-context';
|
|
14
15
|
import useDrawerStack from '../use-drawer-stack';
|
|
15
|
-
import { drawerSlideIn } from './drawer-slide-in';
|
|
16
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
|
+
};
|
|
17
32
|
var styles = {
|
|
33
|
+
root: "_k8m05ji5 _1oec14ed _6fl4dkwg _1s9z1a5r _1kdeglyw _1fsl1yx9 _1ltk1j28 _njwkivc9 _yhpq1ttt _13ku1fu8 _1fyf1a5r _d7fr1i5c _4v7ipwmj _1dar1j28 _156yru3m _aeldru3m _1sbqru3m _1i6zru3m",
|
|
18
34
|
surface: "_1reo15vq _18m915vq _1e0c1txw _1bsb1osq _4t3i1osq _bfhk1bhr _1q1l1bhr _ect4ttxp"
|
|
19
35
|
};
|
|
36
|
+
var drawerAnimationStyles = {
|
|
37
|
+
left: "_t9ecjq3t _1hqtjq3t",
|
|
38
|
+
right: "_t9ecxwn4 _1hqtxwn4",
|
|
39
|
+
top: "_t9ecz6y5 _1hqtz6y5",
|
|
40
|
+
bottom: "_t9ec3k1b _1hqt3k1b"
|
|
41
|
+
};
|
|
20
42
|
|
|
21
43
|
// Width presets mirror the legacy `DrawerPanel`. Applied to the `<dialog>` (the
|
|
22
44
|
// sized, edge-pinned element) and clamped to the viewport for mobile safety.
|
|
@@ -116,7 +138,7 @@ export function DrawerTopLayer(_ref2) {
|
|
|
116
138
|
action: 'dismissed',
|
|
117
139
|
componentName: 'drawer',
|
|
118
140
|
packageName: "@atlaskit/drawer",
|
|
119
|
-
packageVersion: "13.
|
|
141
|
+
packageVersion: "13.2.0",
|
|
120
142
|
analyticsData: {
|
|
121
143
|
trigger: 'escKey'
|
|
122
144
|
}
|
|
@@ -128,7 +150,7 @@ export function DrawerTopLayer(_ref2) {
|
|
|
128
150
|
action: 'dismissed',
|
|
129
151
|
componentName: 'drawer',
|
|
130
152
|
packageName: "@atlaskit/drawer",
|
|
131
|
-
packageVersion: "13.
|
|
153
|
+
packageVersion: "13.2.0",
|
|
132
154
|
analyticsData: {
|
|
133
155
|
trigger: 'blanket'
|
|
134
156
|
}
|
|
@@ -140,7 +162,7 @@ export function DrawerTopLayer(_ref2) {
|
|
|
140
162
|
action: 'dismissed',
|
|
141
163
|
componentName: 'drawer',
|
|
142
164
|
packageName: "@atlaskit/drawer",
|
|
143
|
-
packageVersion: "13.
|
|
165
|
+
packageVersion: "13.2.0",
|
|
144
166
|
analyticsData: {
|
|
145
167
|
trigger: 'backButton'
|
|
146
168
|
}
|
|
@@ -211,14 +233,6 @@ export function DrawerTopLayer(_ref2) {
|
|
|
211
233
|
maxHeight: '100dvh',
|
|
212
234
|
width: "min(".concat(WIDTH_MAP[width], ", 100vw)")
|
|
213
235
|
};
|
|
214
|
-
|
|
215
|
-
// Memoized so the preset object (and its CSS string) is rebuilt only when
|
|
216
|
-
// `enterFrom` changes, not on every render.
|
|
217
|
-
var animate = useMemo(function () {
|
|
218
|
-
return drawerSlideIn({
|
|
219
|
-
from: enterFrom
|
|
220
|
-
});
|
|
221
|
-
}, [enterFrom]);
|
|
222
236
|
var accessibleName = getAccessibleName({
|
|
223
237
|
label: label,
|
|
224
238
|
titleId: titleId
|
|
@@ -229,6 +243,7 @@ export function DrawerTopLayer(_ref2) {
|
|
|
229
243
|
onEnterFinish: handleEnterFinish,
|
|
230
244
|
onExitFinish: handleExitFinish,
|
|
231
245
|
animate: animate,
|
|
246
|
+
xcss: cx(styles.root, drawerAnimationStyles[enterFrom]),
|
|
232
247
|
shouldHideBackdrop: stackIndex > 0,
|
|
233
248
|
testId: testId
|
|
234
249
|
}, accessibleName, {
|
package/dist/esm/drawer.js
CHANGED
|
@@ -49,7 +49,7 @@ var DrawerBase = function DrawerBase(_ref2) {
|
|
|
49
49
|
action: 'dismissed',
|
|
50
50
|
componentName: 'drawer',
|
|
51
51
|
packageName: "@atlaskit/drawer",
|
|
52
|
-
packageVersion: "13.
|
|
52
|
+
packageVersion: "13.2.0",
|
|
53
53
|
analyticsData: {
|
|
54
54
|
trigger: 'escKey'
|
|
55
55
|
}
|
|
@@ -72,7 +72,7 @@ var DrawerBase = function DrawerBase(_ref2) {
|
|
|
72
72
|
action: 'dismissed',
|
|
73
73
|
componentName: 'drawer',
|
|
74
74
|
packageName: "@atlaskit/drawer",
|
|
75
|
-
packageVersion: "13.
|
|
75
|
+
packageVersion: "13.2.0",
|
|
76
76
|
analyticsData: {
|
|
77
77
|
trigger: 'blanket'
|
|
78
78
|
}
|
|
@@ -84,7 +84,7 @@ var DrawerBase = function DrawerBase(_ref2) {
|
|
|
84
84
|
action: 'dismissed',
|
|
85
85
|
componentName: 'drawer',
|
|
86
86
|
packageName: "@atlaskit/drawer",
|
|
87
|
-
packageVersion: "13.
|
|
87
|
+
packageVersion: "13.2.0",
|
|
88
88
|
analyticsData: {
|
|
89
89
|
trigger: 'backButton'
|
|
90
90
|
}
|
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.
|
|
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/"
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"@atlaskit/button": "^24.3.0",
|
|
47
47
|
"@atlaskit/css": "^1.0.0",
|
|
48
48
|
"@atlaskit/ds-lib": "^8.0.0",
|
|
49
|
-
"@atlaskit/icon": "^36.
|
|
49
|
+
"@atlaskit/icon": "^36.2.0",
|
|
50
50
|
"@atlaskit/layering": "^4.1.0",
|
|
51
|
-
"@atlaskit/motion": "^7.
|
|
51
|
+
"@atlaskit/motion": "^7.3.0",
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
53
53
|
"@atlaskit/portal": "^6.1.0",
|
|
54
54
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
55
55
|
"@atlaskit/theme": "^26.1.0",
|
|
56
|
-
"@atlaskit/tokens": "^15.
|
|
57
|
-
"@atlaskit/top-layer": "^1.
|
|
56
|
+
"@atlaskit/tokens": "^15.5.0",
|
|
57
|
+
"@atlaskit/top-layer": "^1.6.0",
|
|
58
58
|
"@babel/runtime": "^7.0.0",
|
|
59
59
|
"@compiled/react": "^0.20.0",
|
|
60
60
|
"bind-event-listener": "^3.0.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@atlaskit/link": "^4.1.0",
|
|
80
80
|
"@atlaskit/menu": "^9.1.0",
|
|
81
81
|
"@atlaskit/modal-dialog": "^16.1.0",
|
|
82
|
-
"@atlaskit/primitives": "^20.
|
|
82
|
+
"@atlaskit/primitives": "^20.5.0",
|
|
83
83
|
"@atlaskit/section-message": "^9.2.0",
|
|
84
84
|
"@atlassian/feature-flags-test-utils": "^1.1.0",
|
|
85
85
|
"@atlassian/ssr-tests": "workspace:^",
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.drawerSlideIn = drawerSlideIn;
|
|
7
|
-
/**
|
|
8
|
-
* Off-screen transform per entry edge. A drawer slides in from the edge it is
|
|
9
|
-
* pinned to and exits back to the same edge (legacy `SlideIn` used
|
|
10
|
-
* `exitTo={enterFrom}`), so enter and exit are symmetric.
|
|
11
|
-
*/
|
|
12
|
-
var HIDDEN_TRANSFORM = {
|
|
13
|
-
left: 'translateX(-100%)',
|
|
14
|
-
right: 'translateX(100%)',
|
|
15
|
-
top: 'translateY(-100%)',
|
|
16
|
-
bottom: 'translateY(100%)'
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// Match the legacy `CustomSlideIn`: `duration="small"` (100ms) on enter,
|
|
20
|
-
// `small * 0.5` (50ms) on exit, `ease-out` timing. Drawer slides with no panel
|
|
21
|
-
// fade (`fade="none"`); only the backdrop fades.
|
|
22
|
-
var ENTER_MS = 100;
|
|
23
|
-
var EXIT_MS = 50;
|
|
24
|
-
var EASE = 'cubic-bezier(0.2,0,0,1)'; // @atlaskit/motion `easeOut`
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Builds the slide CSS for a single entry edge, scoped to
|
|
28
|
-
* `[data-ds-dialog-drawer-slide-{from}]` (the `Dialog` primitive stamps
|
|
29
|
-
* `data-ds-dialog-{name}` on the `<dialog>` element).
|
|
30
|
-
*
|
|
31
|
-
* - base selector → hidden/exit state + exit duration
|
|
32
|
-
* - `[open]` → visible state + enter duration
|
|
33
|
-
* - `@starting-style` → initial (pre-paint) state so the entry transition runs
|
|
34
|
-
*
|
|
35
|
-
* The `::backdrop` fades its blanket colour in step with the panel. Stacked
|
|
36
|
-
* drawers hide their backdrop via the `Dialog` `shouldHideBackdrop` prop (an
|
|
37
|
-
* ID-scoped `<style>` whose specificity beats this rule).
|
|
38
|
-
*/
|
|
39
|
-
function buildCss(name, hidden) {
|
|
40
|
-
var sel = "[data-ds-dialog-".concat(name, "]");
|
|
41
|
-
return "\n".concat(sel, " {\n transform: ").concat(hidden, ";\n transition:\n transform ").concat(EXIT_MS, "ms ").concat(EASE, ",\n overlay ").concat(EXIT_MS, "ms allow-discrete,\n display ").concat(EXIT_MS, "ms allow-discrete;\n}\n\n").concat(sel, "[open] {\n transform: none;\n transition-duration: ").concat(ENTER_MS, "ms;\n}\n\n@starting-style {\n ").concat(sel, "[open] {\n transform: ").concat(hidden, ";\n }\n}\n\n").concat(sel, "::backdrop {\n background-color: transparent;\n transition:\n background-color ").concat(EXIT_MS, "ms ").concat(EASE, ",\n overlay ").concat(EXIT_MS, "ms allow-discrete,\n display ").concat(EXIT_MS, "ms allow-discrete;\n}\n\n").concat(sel, "[open]::backdrop {\n background-color: var(--ds-blanket, #050C1F75);\n transition-duration: ").concat(ENTER_MS, "ms;\n}\n\n@starting-style {\n ").concat(sel, "[open]::backdrop {\n background-color: transparent;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n ").concat(sel, ",\n ").concat(sel, "[open],\n ").concat(sel, "::backdrop,\n ").concat(sel, "[open]::backdrop {\n transition-duration: 0s;\n }\n}\n");
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Directional slide animation for the top-layer `Drawer`, passed to the
|
|
45
|
-
* `Dialog` primitive's `animate` prop. Local to `@atlaskit/drawer` (not a
|
|
46
|
-
* shared top-layer preset). The panel slides in from its pinned viewport edge
|
|
47
|
-
* while the `::backdrop` fades.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```tsx
|
|
51
|
-
* <Dialog animate={drawerSlideIn({ from: 'left' })} isOpen={isOpen} onClose={onClose} label="...">
|
|
52
|
-
* ...
|
|
53
|
-
* </Dialog>
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
function drawerSlideIn() {
|
|
57
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
58
|
-
_ref$from = _ref.from,
|
|
59
|
-
from = _ref$from === void 0 ? 'left' : _ref$from;
|
|
60
|
-
var name = "drawer-slide-".concat(from);
|
|
61
|
-
return {
|
|
62
|
-
name: name,
|
|
63
|
-
css: buildCss(name, HIDDEN_TRANSFORM[from]),
|
|
64
|
-
enterDurationMs: ENTER_MS,
|
|
65
|
-
exitDurationMs: EXIT_MS
|
|
66
|
-
};
|
|
67
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Off-screen transform per entry edge. A drawer slides in from the edge it is
|
|
3
|
-
* pinned to and exits back to the same edge (legacy `SlideIn` used
|
|
4
|
-
* `exitTo={enterFrom}`), so enter and exit are symmetric.
|
|
5
|
-
*/
|
|
6
|
-
const HIDDEN_TRANSFORM = {
|
|
7
|
-
left: 'translateX(-100%)',
|
|
8
|
-
right: 'translateX(100%)',
|
|
9
|
-
top: 'translateY(-100%)',
|
|
10
|
-
bottom: 'translateY(100%)'
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// Match the legacy `CustomSlideIn`: `duration="small"` (100ms) on enter,
|
|
14
|
-
// `small * 0.5` (50ms) on exit, `ease-out` timing. Drawer slides with no panel
|
|
15
|
-
// fade (`fade="none"`); only the backdrop fades.
|
|
16
|
-
const ENTER_MS = 100;
|
|
17
|
-
const EXIT_MS = 50;
|
|
18
|
-
const EASE = 'cubic-bezier(0.2,0,0,1)'; // @atlaskit/motion `easeOut`
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Builds the slide CSS for a single entry edge, scoped to
|
|
22
|
-
* `[data-ds-dialog-drawer-slide-{from}]` (the `Dialog` primitive stamps
|
|
23
|
-
* `data-ds-dialog-{name}` on the `<dialog>` element).
|
|
24
|
-
*
|
|
25
|
-
* - base selector → hidden/exit state + exit duration
|
|
26
|
-
* - `[open]` → visible state + enter duration
|
|
27
|
-
* - `@starting-style` → initial (pre-paint) state so the entry transition runs
|
|
28
|
-
*
|
|
29
|
-
* The `::backdrop` fades its blanket colour in step with the panel. Stacked
|
|
30
|
-
* drawers hide their backdrop via the `Dialog` `shouldHideBackdrop` prop (an
|
|
31
|
-
* ID-scoped `<style>` whose specificity beats this rule).
|
|
32
|
-
*/
|
|
33
|
-
function buildCss(name, hidden) {
|
|
34
|
-
const sel = `[data-ds-dialog-${name}]`;
|
|
35
|
-
return `
|
|
36
|
-
${sel} {
|
|
37
|
-
transform: ${hidden};
|
|
38
|
-
transition:
|
|
39
|
-
transform ${EXIT_MS}ms ${EASE},
|
|
40
|
-
overlay ${EXIT_MS}ms allow-discrete,
|
|
41
|
-
display ${EXIT_MS}ms allow-discrete;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
${sel}[open] {
|
|
45
|
-
transform: none;
|
|
46
|
-
transition-duration: ${ENTER_MS}ms;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@starting-style {
|
|
50
|
-
${sel}[open] {
|
|
51
|
-
transform: ${hidden};
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
${sel}::backdrop {
|
|
56
|
-
background-color: transparent;
|
|
57
|
-
transition:
|
|
58
|
-
background-color ${EXIT_MS}ms ${EASE},
|
|
59
|
-
overlay ${EXIT_MS}ms allow-discrete,
|
|
60
|
-
display ${EXIT_MS}ms allow-discrete;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
${sel}[open]::backdrop {
|
|
64
|
-
background-color: var(--ds-blanket, #050C1F75);
|
|
65
|
-
transition-duration: ${ENTER_MS}ms;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
@starting-style {
|
|
69
|
-
${sel}[open]::backdrop {
|
|
70
|
-
background-color: transparent;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
@media (prefers-reduced-motion: reduce) {
|
|
75
|
-
${sel},
|
|
76
|
-
${sel}[open],
|
|
77
|
-
${sel}::backdrop,
|
|
78
|
-
${sel}[open]::backdrop {
|
|
79
|
-
transition-duration: 0s;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
`;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Directional slide animation for the top-layer `Drawer`, passed to the
|
|
86
|
-
* `Dialog` primitive's `animate` prop. Local to `@atlaskit/drawer` (not a
|
|
87
|
-
* shared top-layer preset). The panel slides in from its pinned viewport edge
|
|
88
|
-
* while the `::backdrop` fades.
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* ```tsx
|
|
92
|
-
* <Dialog animate={drawerSlideIn({ from: 'left' })} isOpen={isOpen} onClose={onClose} label="...">
|
|
93
|
-
* ...
|
|
94
|
-
* </Dialog>
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
export function drawerSlideIn({
|
|
98
|
-
from = 'left'
|
|
99
|
-
} = {}) {
|
|
100
|
-
const name = `drawer-slide-${from}`;
|
|
101
|
-
return {
|
|
102
|
-
name,
|
|
103
|
-
css: buildCss(name, HIDDEN_TRANSFORM[from]),
|
|
104
|
-
enterDurationMs: ENTER_MS,
|
|
105
|
-
exitDurationMs: EXIT_MS
|
|
106
|
-
};
|
|
107
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Off-screen transform per entry edge. A drawer slides in from the edge it is
|
|
3
|
-
* pinned to and exits back to the same edge (legacy `SlideIn` used
|
|
4
|
-
* `exitTo={enterFrom}`), so enter and exit are symmetric.
|
|
5
|
-
*/
|
|
6
|
-
var HIDDEN_TRANSFORM = {
|
|
7
|
-
left: 'translateX(-100%)',
|
|
8
|
-
right: 'translateX(100%)',
|
|
9
|
-
top: 'translateY(-100%)',
|
|
10
|
-
bottom: 'translateY(100%)'
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
// Match the legacy `CustomSlideIn`: `duration="small"` (100ms) on enter,
|
|
14
|
-
// `small * 0.5` (50ms) on exit, `ease-out` timing. Drawer slides with no panel
|
|
15
|
-
// fade (`fade="none"`); only the backdrop fades.
|
|
16
|
-
var ENTER_MS = 100;
|
|
17
|
-
var EXIT_MS = 50;
|
|
18
|
-
var EASE = 'cubic-bezier(0.2,0,0,1)'; // @atlaskit/motion `easeOut`
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Builds the slide CSS for a single entry edge, scoped to
|
|
22
|
-
* `[data-ds-dialog-drawer-slide-{from}]` (the `Dialog` primitive stamps
|
|
23
|
-
* `data-ds-dialog-{name}` on the `<dialog>` element).
|
|
24
|
-
*
|
|
25
|
-
* - base selector → hidden/exit state + exit duration
|
|
26
|
-
* - `[open]` → visible state + enter duration
|
|
27
|
-
* - `@starting-style` → initial (pre-paint) state so the entry transition runs
|
|
28
|
-
*
|
|
29
|
-
* The `::backdrop` fades its blanket colour in step with the panel. Stacked
|
|
30
|
-
* drawers hide their backdrop via the `Dialog` `shouldHideBackdrop` prop (an
|
|
31
|
-
* ID-scoped `<style>` whose specificity beats this rule).
|
|
32
|
-
*/
|
|
33
|
-
function buildCss(name, hidden) {
|
|
34
|
-
var sel = "[data-ds-dialog-".concat(name, "]");
|
|
35
|
-
return "\n".concat(sel, " {\n transform: ").concat(hidden, ";\n transition:\n transform ").concat(EXIT_MS, "ms ").concat(EASE, ",\n overlay ").concat(EXIT_MS, "ms allow-discrete,\n display ").concat(EXIT_MS, "ms allow-discrete;\n}\n\n").concat(sel, "[open] {\n transform: none;\n transition-duration: ").concat(ENTER_MS, "ms;\n}\n\n@starting-style {\n ").concat(sel, "[open] {\n transform: ").concat(hidden, ";\n }\n}\n\n").concat(sel, "::backdrop {\n background-color: transparent;\n transition:\n background-color ").concat(EXIT_MS, "ms ").concat(EASE, ",\n overlay ").concat(EXIT_MS, "ms allow-discrete,\n display ").concat(EXIT_MS, "ms allow-discrete;\n}\n\n").concat(sel, "[open]::backdrop {\n background-color: var(--ds-blanket, #050C1F75);\n transition-duration: ").concat(ENTER_MS, "ms;\n}\n\n@starting-style {\n ").concat(sel, "[open]::backdrop {\n background-color: transparent;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n ").concat(sel, ",\n ").concat(sel, "[open],\n ").concat(sel, "::backdrop,\n ").concat(sel, "[open]::backdrop {\n transition-duration: 0s;\n }\n}\n");
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Directional slide animation for the top-layer `Drawer`, passed to the
|
|
39
|
-
* `Dialog` primitive's `animate` prop. Local to `@atlaskit/drawer` (not a
|
|
40
|
-
* shared top-layer preset). The panel slides in from its pinned viewport edge
|
|
41
|
-
* while the `::backdrop` fades.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```tsx
|
|
45
|
-
* <Dialog animate={drawerSlideIn({ from: 'left' })} isOpen={isOpen} onClose={onClose} label="...">
|
|
46
|
-
* ...
|
|
47
|
-
* </Dialog>
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
export function drawerSlideIn() {
|
|
51
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
52
|
-
_ref$from = _ref.from,
|
|
53
|
-
from = _ref$from === void 0 ? 'left' : _ref$from;
|
|
54
|
-
var name = "drawer-slide-".concat(from);
|
|
55
|
-
return {
|
|
56
|
-
name: name,
|
|
57
|
-
css: buildCss(name, HIDDEN_TRANSFORM[from]),
|
|
58
|
-
enterDurationMs: ENTER_MS,
|
|
59
|
-
exitDurationMs: EXIT_MS
|
|
60
|
-
};
|
|
61
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type Direction } from '@atlaskit/motion/types';
|
|
2
|
-
import { type TAnimationPreset } from '@atlaskit/top-layer/animations';
|
|
3
|
-
type TDrawerSlideInOptions = {
|
|
4
|
-
/**
|
|
5
|
-
* The edge the drawer slides in from. Defaults to `left`.
|
|
6
|
-
*/
|
|
7
|
-
from?: Direction;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Directional slide animation for the top-layer `Drawer`, passed to the
|
|
11
|
-
* `Dialog` primitive's `animate` prop. Local to `@atlaskit/drawer` (not a
|
|
12
|
-
* shared top-layer preset). The panel slides in from its pinned viewport edge
|
|
13
|
-
* while the `::backdrop` fades.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* <Dialog animate={drawerSlideIn({ from: 'left' })} isOpen={isOpen} onClose={onClose} label="...">
|
|
18
|
-
* ...
|
|
19
|
-
* </Dialog>
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export declare function drawerSlideIn({ from }?: TDrawerSlideInOptions): TAnimationPreset;
|
|
23
|
-
export {};
|