@atlaskit/top-layer 1.6.0 → 1.6.1
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 +8 -0
- package/compass.yml +10 -1
- package/dist/cjs/dialog/dialog-content.compiled.css +0 -10
- package/dist/cjs/dialog/dialog-content.js +5 -28
- package/dist/cjs/entry-points/animations.js +1 -49
- package/dist/cjs/internal/use-animated-visibility.js +14 -17
- package/dist/cjs/popover/animations.js +1 -147
- package/dist/cjs/popover/popover.compiled.css +0 -10
- package/dist/cjs/popover/popover.js +8 -11
- package/dist/cjs/testing/polyfill.js +3 -0
- package/dist/es2019/dialog/dialog-content.compiled.css +0 -10
- package/dist/es2019/dialog/dialog-content.js +4 -28
- package/dist/es2019/entry-points/animations.js +0 -2
- package/dist/es2019/internal/use-animated-visibility.js +14 -18
- package/dist/es2019/popover/animations.js +1 -145
- package/dist/es2019/popover/popover.compiled.css +0 -10
- package/dist/es2019/popover/popover.js +7 -11
- package/dist/es2019/testing/polyfill.js +3 -0
- package/dist/esm/dialog/dialog-content.compiled.css +0 -10
- package/dist/esm/dialog/dialog-content.js +5 -28
- package/dist/esm/entry-points/animations.js +0 -2
- package/dist/esm/internal/use-animated-visibility.js +14 -18
- package/dist/esm/popover/animations.js +1 -144
- package/dist/esm/popover/popover.compiled.css +0 -10
- package/dist/esm/popover/popover.js +8 -11
- package/dist/esm/testing/polyfill.js +3 -0
- package/dist/types/dialog/types.d.ts +5 -5
- package/dist/types/entry-points/animations.d.ts +0 -2
- package/dist/types/internal/use-animated-visibility.d.ts +15 -33
- package/dist/types/popover/animations.d.ts +7 -52
- package/dist/types/popover/types.d.ts +6 -3
- package/package.json +4 -4
- package/dist/cjs/dialog/animations.js +0 -90
- package/dist/es2019/dialog/animations.js +0 -80
- package/dist/esm/dialog/animations.js +0 -82
- package/dist/types/dialog/animations.d.ts +0 -57
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/top-layer
|
|
2
2
|
|
|
3
|
+
## 1.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`650f4c7ce7fb2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/650f4c7ce7fb2) -
|
|
8
|
+
Type-only fixes for TypeScript 7 (tsgo) compatibility with the updated DOM lib. No runtime or
|
|
9
|
+
public API changes.
|
|
10
|
+
|
|
3
11
|
## 1.6.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/compass.yml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
configVersion: 1
|
|
2
2
|
id: ari:cloud:compass:a436116f-02ce-4520-8fbb-7301462a1674:component/c5751cc6-3513-4070-9deb-af31e86aed34/680f1177-ac84-4787-a7d1-258dd657dc9f
|
|
3
3
|
name: '@atlaskit/top-layer'
|
|
4
|
-
ownerId: ari:cloud:
|
|
4
|
+
ownerId: ari:cloud:teams::team/814283d6-8695-4329-b2f8-d78b2645722f # Design System Team (ADS)
|
|
5
5
|
labels:
|
|
6
6
|
- platform-code
|
|
7
7
|
- platform-afm
|
|
@@ -27,6 +27,9 @@ customFields:
|
|
|
27
27
|
- name: Technical Owner
|
|
28
28
|
type: user
|
|
29
29
|
value: ari:cloud:identity::user/557058:86a9b692-7997-49cb-9984-080801b1de91 # Jared Crowe
|
|
30
|
+
- name: Reviewer Team
|
|
31
|
+
type: text
|
|
32
|
+
value: ari:cloud:teams::team/be19136e-6275-419f-be0c-fcee844b8684 # Design System Engineers
|
|
30
33
|
- name: Required Reviewers Opt In
|
|
31
34
|
type: boolean
|
|
32
35
|
value: true
|
|
@@ -36,3 +39,9 @@ customFields:
|
|
|
36
39
|
- name: Required Reviewer Approvals
|
|
37
40
|
type: number
|
|
38
41
|
value: 1
|
|
42
|
+
- name: Trusted Committers
|
|
43
|
+
type: text
|
|
44
|
+
value: ari:cloud:teams::team/814283d6-8695-4329-b2f8-d78b2645722f # Design System Team (ADS)
|
|
45
|
+
- name: Trusted Reviewer Teams
|
|
46
|
+
type: text
|
|
47
|
+
value: ari:cloud:teams::team/42f4416b-e028-4daa-b2a5-afe213ac75e1 # Design System Designers
|
|
@@ -20,23 +20,15 @@
|
|
|
20
20
|
._1o51q7pw{animation-fill-mode:forwards}
|
|
21
21
|
._1oeci9qs{transition-duration:var(--ds-duration-medium,.2s)}
|
|
22
22
|
._1oil1d08[open]{transition-timing-function:var(--ds-easing-inout-bold,cubic-bezier(.4,0,0,1))}
|
|
23
|
-
._1pgl1lbj{animation-timing-function:var(--ds-easing-in-practical,cubic-bezier(.6,0,.8,.6))}
|
|
24
23
|
._1q51ze3t{padding-block-start:var(--ds-space-0,0)}
|
|
25
|
-
._1rjx1d08[open]{animation-timing-function:var(--ds-easing-inout-bold,cubic-bezier(.4,0,0,1))}
|
|
26
24
|
._1rsueoah[open]::-ms-backdrop{animation-fill-mode:backwards}
|
|
27
25
|
._1rsueoah[open]::backdrop{animation-fill-mode:backwards}
|
|
28
26
|
._1s9z1a5r{transition-behavior:allow-discrete}
|
|
29
|
-
._1szp1mzy[open]{animation-duration:var(--ds-duration-long,.25s)}
|
|
30
27
|
._2hwx1wug{margin-right:auto}
|
|
31
|
-
._5sagi9qs{animation-duration:var(--ds-duration-medium,.2s)}
|
|
32
28
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
33
|
-
._8ar61bym[open]{animation-name:var(--ds-keyframe-fade-in,FadeIn0to100)}
|
|
34
|
-
._8ar6yjsl[open]{animation-name:k1c1nn4,var(--ds-keyframe-fade-in,FadeIn0to100)}
|
|
35
29
|
._bfhk1j28{background-color:transparent}
|
|
36
30
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
37
31
|
._c71lglyw{max-height:none}
|
|
38
|
-
._j7hq1a5s{animation-name:var(--ds-keyframe-fade-out,FadeOut100to0)}
|
|
39
|
-
._j7hqcmlg{animation-name:ku52lnv,var(--ds-keyframe-fade-out,FadeOut100to0)}
|
|
40
32
|
._k8m011k7{transition-property:overlay,display}
|
|
41
33
|
._njwk11k7::-ms-backdrop{-ms-transition-property:overlay,display;transition-property:overlay,display}
|
|
42
34
|
._njwk11k7::backdrop{transition-property:overlay,display}
|
|
@@ -45,6 +37,4 @@
|
|
|
45
37
|
._y4tize3t{padding-inline-end:var(--ds-space-0,0)}
|
|
46
38
|
._yhpqi9qs::-ms-backdrop{transition-duration:var(--ds-duration-medium,.2s)}
|
|
47
39
|
._yhpqi9qs::backdrop{transition-duration:var(--ds-duration-medium,.2s)}
|
|
48
|
-
@keyframes k1c1nn4{0%{transform:translateY(calc(var(--ds-dialog-ty, 9pt)))}to{transform:none}}
|
|
49
|
-
@keyframes ku52lnv{0%{transform:none}to{transform:translateY(calc(var(--ds-dialog-ty, 9pt)*-1))}}
|
|
50
40
|
@media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._156y147i{transition-duration:var(--ds-duration-instant,0ms)}._10aiglyw[open]{animation-name:none}._aeld147i[open]{transition-duration:var(--ds-duration-instant,0ms)}._l57nglyw::-ms-backdrop{animation-name:none}._l57nglyw::backdrop{animation-name:none}._1sbq147i::-ms-backdrop{transition-duration:var(--ds-duration-instant,0ms)}._1sbq147i::backdrop{transition-duration:var(--ds-duration-instant,0ms)}._19awglyw[open]::-ms-backdrop{animation-name:none}._19awglyw[open]::backdrop{animation-name:none}._1i6z147i[open]::-ms-backdrop{transition-duration:var(--ds-duration-instant,0ms)}._1i6z147i[open]::backdrop{transition-duration:var(--ds-duration-instant,0ms)}}
|
|
@@ -14,23 +14,16 @@ var _bindEventListener = require("bind-event-listener");
|
|
|
14
14
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
15
15
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
16
16
|
var _openLayerObserver = require("@atlaskit/layering/experimental/open-layer-observer");
|
|
17
|
-
var _setStyle = require("../internal/set-style");
|
|
18
17
|
var _useAnimatedVisibility = require("../internal/use-animated-visibility");
|
|
19
18
|
var _useFocusWrap = require("../internal/use-focus-wrap");
|
|
20
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); }
|
|
21
|
-
var slideInKeyframes = null;
|
|
22
|
-
var slideOutKeyframes = null;
|
|
23
|
-
|
|
24
20
|
// These animation styles use the non-strict Compiled cssMap because they rely
|
|
25
21
|
// on `@starting-style`, `[open]`, and `allow-discrete`. Keep them in this
|
|
26
22
|
// component so the Compiled transform can statically extract every referenced
|
|
27
23
|
// style.
|
|
28
24
|
var dialogAnimationStyles = {
|
|
29
25
|
root: "_k8m011k7 _1oeci9qs _1s9z1a5r _1fsl1mzy _1oil1d08",
|
|
30
|
-
motion: "_y44vgeqi _1o51q7pw _1iu47kvq _1i0neoah"
|
|
31
|
-
'slide-up-and-fade': "_j7hqcmlg _5sagi9qs _1pgl1lbj _8ar6yjsl _1szp1mzy _1rjx1d08",
|
|
32
|
-
fade: "_j7hq1a5s _5sagi9qs _1pgl1lbj _8ar61bym _1szp1mzy _1rjx1d08",
|
|
33
|
-
custom: ""
|
|
26
|
+
motion: "_y44vgeqi _1o51q7pw _1iu47kvq _1i0neoah"
|
|
34
27
|
};
|
|
35
28
|
var styles = {
|
|
36
29
|
dialog: "_19itglyw _19pk1wug _2hwx1wug _otyr1wug _18u01wug _1q51ze3t _y4tize3t _85i5ze3t _bozgze3t _p12fglyw _c71lglyw _bfhk1j28 _bl8aglyw _156y147i _10aiglyw _aeld147i"
|
|
@@ -64,7 +57,8 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
|
|
|
64
57
|
onClose = _ref.onClose,
|
|
65
58
|
onEnterFinish = _ref.onEnterFinish,
|
|
66
59
|
onExitFinish = _ref.onExitFinish,
|
|
67
|
-
animate = _ref.animate,
|
|
60
|
+
_ref$animate = _ref.animate,
|
|
61
|
+
animate = _ref$animate === void 0 ? false : _ref$animate,
|
|
68
62
|
consumerXcss = _ref.xcss,
|
|
69
63
|
style = _ref.style,
|
|
70
64
|
testId = _ref.testId,
|
|
@@ -78,6 +72,7 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
|
|
|
78
72
|
var combinedRef = (0, _mergeRefs.default)([ownRef, ref]);
|
|
79
73
|
var _useAnimatedVisibilit = (0, _useAnimatedVisibility.useAnimatedVisibility)({
|
|
80
74
|
isOpen: isOpen,
|
|
75
|
+
animationKind: 'dialog',
|
|
81
76
|
animate: animate,
|
|
82
77
|
elementRef: ownRef,
|
|
83
78
|
onEnterFinish: onEnterFinish,
|
|
@@ -129,24 +124,6 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
|
|
|
129
124
|
}
|
|
130
125
|
}, [isOpen]);
|
|
131
126
|
|
|
132
|
-
// Apply preset-provided animation custom properties (e.g. the
|
|
133
|
-
// `--ds-dialog-ty` slide distance for `dialogSlideUpAndFade`). The
|
|
134
|
-
// cleanup restores the previous inline values so a preset change does
|
|
135
|
-
// not leave stale custom properties on the element. Dialog presets do
|
|
136
|
-
// not vary by placement, so an empty placement is passed.
|
|
137
|
-
(0, _react.useLayoutEffect)(function () {
|
|
138
|
-
var dialog = ownRef.current;
|
|
139
|
-
if (!dialog || !(preset !== null && preset !== void 0 && preset.getStyles)) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
return (0, _setStyle.setStyle)({
|
|
143
|
-
element: dialog,
|
|
144
|
-
styles: preset.getStyles({
|
|
145
|
-
placement: {}
|
|
146
|
-
})
|
|
147
|
-
});
|
|
148
|
-
}, [preset, isVisible]);
|
|
149
|
-
|
|
150
127
|
// Handle native Escape (cancel event)
|
|
151
128
|
var handleCancel = (0, _react.useCallback)(function (event) {
|
|
152
129
|
// Only handle a cancel targeting THIS dialog. Native `cancel` does not
|
|
@@ -207,6 +184,6 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
|
|
|
207
184
|
style: style,
|
|
208
185
|
onCancel: handleCancel,
|
|
209
186
|
"data-testid": testId,
|
|
210
|
-
className: (0, _runtime.ax)([styles.dialog, shouldHideBackdrop ? backdropStyles.hidden : backdropStyles.root, preset && backdropStyles.motion, preset && dialogAnimationStyles.root, preset && dialogAnimationStyles
|
|
187
|
+
className: (0, _runtime.ax)([styles.dialog, shouldHideBackdrop ? backdropStyles.hidden : backdropStyles.root, preset && backdropStyles.motion, preset && dialogAnimationStyles.root, preset && dialogAnimationStyles.motion, consumerXcss])
|
|
211
188
|
}, children);
|
|
212
189
|
});
|
|
@@ -1,49 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "dialogFade", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _animations.dialogFade;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "dialogMotion", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _animations.dialogMotion;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "dialogSlideUpAndFade", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _animations.dialogSlideUpAndFade;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "fade", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _animations2.fade;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "popupMotion", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _animations2.popupMotion;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "scaleAndFade", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _animations2.scaleAndFade;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "slideAndFade", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _animations2.slideAndFade;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
var _animations = require("../dialog/animations");
|
|
49
|
-
var _animations2 = require("../popover/animations");
|
|
1
|
+
"use strict";
|
|
@@ -9,17 +9,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _bindEventListener = require("bind-event-listener");
|
|
11
11
|
var _reducedMotion = require("./reduced-motion");
|
|
12
|
-
/**
|
|
13
|
-
* A self-contained animation preset for top-layer elements.
|
|
14
|
-
*
|
|
15
|
-
* Contains a stable preset name used by the host component to select its
|
|
16
|
-
* component-local Compiled style entry, plus optional per-placement inline
|
|
17
|
-
* styles.
|
|
18
|
-
*
|
|
19
|
-
* The actual Compiled styles are kept static and component-local so the
|
|
20
|
-
* Compiled transform can extract them at build time.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
12
|
/**
|
|
24
13
|
* Using the recommended motion timings for safety net.
|
|
25
14
|
*
|
|
@@ -78,6 +67,13 @@ function runOnTransitionEndOrTimeout(_ref) {
|
|
|
78
67
|
return teardown;
|
|
79
68
|
}
|
|
80
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Animation config for entry/exit transitions.
|
|
72
|
+
*
|
|
73
|
+
* Currently no configuration is supported via this prop,
|
|
74
|
+
* and this is just a placeholder.
|
|
75
|
+
*/
|
|
76
|
+
|
|
81
77
|
/**
|
|
82
78
|
* Visibility lifecycle phase shared between `useAnimatedVisibility`,
|
|
83
79
|
* `useFocusWrap`, `useInitialFocus`, and the `Popover` / `Dialog`
|
|
@@ -141,6 +137,7 @@ function runOnTransitionEndOrTimeout(_ref) {
|
|
|
141
137
|
*/
|
|
142
138
|
function useAnimatedVisibility(_ref2) {
|
|
143
139
|
var isOpen = _ref2.isOpen,
|
|
140
|
+
animationKind = _ref2.animationKind,
|
|
144
141
|
animate = _ref2.animate,
|
|
145
142
|
elementRef = _ref2.elementRef,
|
|
146
143
|
onEnterFinish = _ref2.onEnterFinish,
|
|
@@ -194,7 +191,7 @@ function useAnimatedVisibility(_ref2) {
|
|
|
194
191
|
// move to `open`. The fallback guarantees settle on swallowed events
|
|
195
192
|
// (zero-duration, browser quirk, mid-transition unmount).
|
|
196
193
|
(0, _react.useEffect)(function () {
|
|
197
|
-
if (phase !== 'entering'
|
|
194
|
+
if (phase !== 'entering') {
|
|
198
195
|
return;
|
|
199
196
|
}
|
|
200
197
|
var element = elementRef.current;
|
|
@@ -203,7 +200,7 @@ function useAnimatedVisibility(_ref2) {
|
|
|
203
200
|
}
|
|
204
201
|
return runOnTransitionEndOrTimeout({
|
|
205
202
|
element: element,
|
|
206
|
-
safetyNetMs: safetyNetMsMap[
|
|
203
|
+
safetyNetMs: safetyNetMsMap[animationKind].enter + 50,
|
|
207
204
|
onSettled: function onSettled() {
|
|
208
205
|
var _onEnterFinishRef$cur;
|
|
209
206
|
// Fire the consumer callback before transitioning phase so any
|
|
@@ -216,7 +213,7 @@ function useAnimatedVisibility(_ref2) {
|
|
|
216
213
|
});
|
|
217
214
|
}
|
|
218
215
|
});
|
|
219
|
-
}, [phase,
|
|
216
|
+
}, [phase, animationKind, elementRef]);
|
|
220
217
|
|
|
221
218
|
// Non-animated entry callback. The lifecycle goes `closed → open`
|
|
222
219
|
// directly with no `entering` phase; fire `onEnterFinish` on that jump.
|
|
@@ -237,7 +234,7 @@ function useAnimatedVisibility(_ref2) {
|
|
|
237
234
|
// Animated exit: wait for `transitionend` (or a safety-net timeout),
|
|
238
235
|
// fire `onExitFinish`, then move to `closed` to unmount the host.
|
|
239
236
|
(0, _react.useEffect)(function () {
|
|
240
|
-
if (phase !== 'exiting' || !willAnimate
|
|
237
|
+
if (phase !== 'exiting' || !willAnimate) {
|
|
241
238
|
return;
|
|
242
239
|
}
|
|
243
240
|
var element = elementRef.current;
|
|
@@ -246,7 +243,7 @@ function useAnimatedVisibility(_ref2) {
|
|
|
246
243
|
}
|
|
247
244
|
return runOnTransitionEndOrTimeout({
|
|
248
245
|
element: element,
|
|
249
|
-
safetyNetMs: safetyNetMsMap[
|
|
246
|
+
safetyNetMs: safetyNetMsMap[animationKind].exit + 50,
|
|
250
247
|
onSettled: function onSettled() {
|
|
251
248
|
var _onExitFinishRef$curr;
|
|
252
249
|
// Fire the consumer callback before transitioning phase to
|
|
@@ -261,7 +258,7 @@ function useAnimatedVisibility(_ref2) {
|
|
|
261
258
|
});
|
|
262
259
|
}
|
|
263
260
|
});
|
|
264
|
-
}, [phase, willAnimate,
|
|
261
|
+
}, [phase, willAnimate, animationKind, elementRef]);
|
|
265
262
|
|
|
266
263
|
// Non-animated exit: wait for the browser's `toggle` (closed) or
|
|
267
264
|
// `close` event before unmounting, so the consumer's listener (close
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
exports.popupMotion = popupMotion;
|
|
8
|
-
exports.scaleAndFade = scaleAndFade;
|
|
9
|
-
exports.slideAndFade = slideAndFade;
|
|
6
|
+
exports.getPopupMotionStyles = getPopupMotionStyles;
|
|
10
7
|
var _resolvePlacement = require("../internal/resolve-placement");
|
|
11
8
|
function getPopupMotionStyles(_ref) {
|
|
12
9
|
var placement = _ref.placement;
|
|
@@ -50,147 +47,4 @@ function getPopupMotionStyles(_ref) {
|
|
|
50
47
|
property: '--ds-popover-motion-exit',
|
|
51
48
|
value: "var(--ds-popup-exit-bottom, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutBottom8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
52
49
|
}];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
56
|
-
function popupMotion() {
|
|
57
|
-
return {
|
|
58
|
-
kind: 'popover',
|
|
59
|
-
name: 'motion',
|
|
60
|
-
getStyles: getPopupMotionStyles
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function getSlideAndFadeStyles(_ref2) {
|
|
64
|
-
var placement = _ref2.placement,
|
|
65
|
-
distance = _ref2.distance;
|
|
66
|
-
var pos = "".concat(distance, "px");
|
|
67
|
-
var neg = "-".concat(distance, "px");
|
|
68
|
-
var _getPlacement2 = (0, _resolvePlacement.getPlacement)({
|
|
69
|
-
placement: placement
|
|
70
|
-
}),
|
|
71
|
-
axis = _getPlacement2.axis,
|
|
72
|
-
edge = _getPlacement2.edge;
|
|
73
|
-
if (axis === 'block' && edge === 'start') {
|
|
74
|
-
return [{
|
|
75
|
-
property: '--ds-popover-tx',
|
|
76
|
-
value: '0'
|
|
77
|
-
}, {
|
|
78
|
-
property: '--ds-popover-ty',
|
|
79
|
-
value: pos
|
|
80
|
-
}];
|
|
81
|
-
}
|
|
82
|
-
if (axis === 'block' && edge === 'end') {
|
|
83
|
-
return [{
|
|
84
|
-
property: '--ds-popover-tx',
|
|
85
|
-
value: '0'
|
|
86
|
-
}, {
|
|
87
|
-
property: '--ds-popover-ty',
|
|
88
|
-
value: neg
|
|
89
|
-
}];
|
|
90
|
-
}
|
|
91
|
-
if (axis === 'inline' && edge === 'start') {
|
|
92
|
-
return [{
|
|
93
|
-
property: '--ds-popover-tx',
|
|
94
|
-
value: pos
|
|
95
|
-
}, {
|
|
96
|
-
property: '--ds-popover-ty',
|
|
97
|
-
value: '0'
|
|
98
|
-
}];
|
|
99
|
-
}
|
|
100
|
-
if (axis === 'inline' && edge === 'end') {
|
|
101
|
-
return [{
|
|
102
|
-
property: '--ds-popover-tx',
|
|
103
|
-
value: neg
|
|
104
|
-
}, {
|
|
105
|
-
property: '--ds-popover-ty',
|
|
106
|
-
value: '0'
|
|
107
|
-
}];
|
|
108
|
-
}
|
|
109
|
-
return [{
|
|
110
|
-
property: '--ds-popover-tx',
|
|
111
|
-
value: '0'
|
|
112
|
-
}, {
|
|
113
|
-
property: '--ds-popover-ty',
|
|
114
|
-
value: neg
|
|
115
|
-
}];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Directional slide + opacity animation.
|
|
120
|
-
*
|
|
121
|
-
* The popover slides in from the direction opposite its placement edge
|
|
122
|
-
* (e.g. a `block-end` popover slides down from above).
|
|
123
|
-
*
|
|
124
|
-
* @param options.distance - Slide distance in pixels. Defaults to `4`.
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* ```tsx
|
|
128
|
-
* import { slideAndFade } from '@atlaskit/top-layer/animations';
|
|
129
|
-
*
|
|
130
|
-
* // Default 4px slide (tooltip)
|
|
131
|
-
* <Popover animate={slideAndFade()} />
|
|
132
|
-
*
|
|
133
|
-
* // Custom 8px slide (popup / dropdown)
|
|
134
|
-
* <Popover animate={slideAndFade({ distance: 8 })} />
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
138
|
-
function slideAndFade(options) {
|
|
139
|
-
var _options$distance;
|
|
140
|
-
var distance = (_options$distance = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance !== void 0 ? _options$distance : 4;
|
|
141
|
-
return {
|
|
142
|
-
kind: 'popover',
|
|
143
|
-
name: 'slide-and-fade',
|
|
144
|
-
getStyles: function getStyles(_ref3) {
|
|
145
|
-
var placement = _ref3.placement;
|
|
146
|
-
return getSlideAndFadeStyles({
|
|
147
|
-
placement: placement,
|
|
148
|
-
distance: distance
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// fade
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Simple opacity transition, no transform.
|
|
158
|
-
*
|
|
159
|
-
* Suitable for popup dialogs or content that does not need directional motion.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```tsx
|
|
163
|
-
* import { fade } from '@atlaskit/top-layer/animations';
|
|
164
|
-
*
|
|
165
|
-
* <Popover animate={fade()} />
|
|
166
|
-
* ```
|
|
167
|
-
*/
|
|
168
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
169
|
-
function fade() {
|
|
170
|
-
return {
|
|
171
|
-
kind: 'popover',
|
|
172
|
-
name: 'fade'
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// scaleAndFade
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Scale from 0.95 + opacity transition.
|
|
180
|
-
*
|
|
181
|
-
* Suitable for menus, dropdowns, and select options.
|
|
182
|
-
*
|
|
183
|
-
* @example
|
|
184
|
-
* ```tsx
|
|
185
|
-
* import { scaleAndFade } from '@atlaskit/top-layer/animations';
|
|
186
|
-
*
|
|
187
|
-
* <Popover animate={scaleAndFade()} />
|
|
188
|
-
* ```
|
|
189
|
-
*/
|
|
190
|
-
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
191
|
-
function scaleAndFade() {
|
|
192
|
-
return {
|
|
193
|
-
kind: 'popover',
|
|
194
|
-
name: 'scale-and-fade'
|
|
195
|
-
};
|
|
196
50
|
}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
._18u0idpf{margin-left:0}
|
|
8
8
|
._19bvidpf{padding-left:0}
|
|
9
9
|
._19pkidpf{margin-top:0}
|
|
10
|
-
._1a5xt94y{--dir:1px}
|
|
11
10
|
._1o51q7pw{animation-fill-mode:forwards}
|
|
12
11
|
._1oecdn4k{transition-duration:var(--ds-duration-xshort,.1s)}
|
|
13
12
|
._1pgl1lbj{animation-timing-function:var(--ds-easing-in-practical,cubic-bezier(.6,0,.8,.6))}
|
|
@@ -16,21 +15,12 @@
|
|
|
16
15
|
._1s9z1a5r{transition-behavior:allow-discrete}
|
|
17
16
|
._2hwxidpf{margin-right:0}
|
|
18
17
|
._5sagdn4k{animation-duration:var(--ds-duration-xshort,.1s)}
|
|
19
|
-
._71re1bym:popover-open{animation-name:var(--ds-keyframe-fade-in,FadeIn0to100)}
|
|
20
|
-
._71re1v6b:popover-open{animation-name:var(--ds-keyframe-fade-in,FadeIn0to100),var(--ds-keyframe-scale-in-small,ScaleIn95to100)}
|
|
21
|
-
._71rervlo:popover-open{animation-name:k1ut9kob,var(--ds-keyframe-fade-in,FadeIn0to100)}
|
|
22
18
|
._bfhk1j28{background-color:transparent}
|
|
23
19
|
._ca0qidpf{padding-top:0}
|
|
24
|
-
._j7hq1a5s{animation-name:var(--ds-keyframe-fade-out,FadeOut100to0)}
|
|
25
|
-
._j7hq1l2h{animation-name:k1e4c1ew,var(--ds-keyframe-fade-out,FadeOut100to0)}
|
|
26
|
-
._j7hqneez{animation-name:var(--ds-keyframe-fade-out,FadeOut100to0),var(--ds-keyframe-scale-out-small,ScaleOut100to95)}
|
|
27
20
|
._k8m011k7{transition-property:overlay,display}
|
|
28
21
|
._n3tdidpf{padding-bottom:0}
|
|
29
22
|
._n70peoah:popover-open{animation-fill-mode:backwards}
|
|
30
23
|
._o8i7indk:popover-open{animation-timing-function:var(--ds-easing-out-practical,cubic-bezier(.4,1,.6,1))}
|
|
31
24
|
._otyridpf{margin-bottom:0}
|
|
32
25
|
._u5f3idpf{padding-right:0}
|
|
33
|
-
[dir=rtl] ._34bx1n1a{--dir:-1px}
|
|
34
|
-
@keyframes k1e4c1ew{0%{transform:none}to{transform:translate(calc(var(--dir)*var(--ds-popover-tx, 0)),var(--ds-popover-ty,0))}}
|
|
35
|
-
@keyframes k1ut9kob{0%{transform:translate(calc(var(--dir)*var(--ds-popover-tx, 0)),var(--ds-popover-ty,0))}to{transform:none}}
|
|
36
26
|
@media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._156yru3m{transition-duration:0s}._8rmvglyw:popover-open{animation-name:none}._2qm2ru3m:popover-open{transition-duration:0s}}
|
|
@@ -19,6 +19,7 @@ var _setStyle = require("../internal/set-style");
|
|
|
19
19
|
var _useAnimatedVisibility = require("../internal/use-animated-visibility");
|
|
20
20
|
var _useFocusWrap = require("../internal/use-focus-wrap");
|
|
21
21
|
var _useInitialFocus = require("../internal/use-initial-focus");
|
|
22
|
+
var _animations = require("./animations");
|
|
22
23
|
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); }
|
|
23
24
|
/**
|
|
24
25
|
* Detects `popover="hint"` support via DOM reflection. SSR-safe, cached.
|
|
@@ -32,19 +33,13 @@ var supportsPopoverHint = (0, _once.default)(function () {
|
|
|
32
33
|
element.setAttribute('popover', 'hint');
|
|
33
34
|
return element.popover === 'hint';
|
|
34
35
|
});
|
|
35
|
-
var slideInKeyframes = null;
|
|
36
|
-
var slideOutKeyframes = null;
|
|
37
36
|
|
|
38
37
|
// These animation styles use the non-strict Compiled cssMap because they rely
|
|
39
38
|
// on `@starting-style`, `:popover-open`, `[dir='rtl']`, and `allow-discrete`.
|
|
40
39
|
// Keep them in this component so the Compiled transform can statically extract
|
|
41
40
|
// every referenced style.
|
|
42
41
|
var popoverAnimationStyles = {
|
|
43
|
-
root: "_k8m011k7 _1oecdn4k _1s9z1a5r
|
|
44
|
-
motion: "_y44vof1f _1o51q7pw _15ns179n _n70peoah",
|
|
45
|
-
'slide-and-fade': "_j7hq1l2h _5sagdn4k _1pgl1lbj _71rervlo _1psg1ign _o8i7indk",
|
|
46
|
-
fade: "_j7hq1a5s _5sagdn4k _1pgl1lbj _71re1bym _1psg1ign _o8i7indk",
|
|
47
|
-
'scale-and-fade': "_j7hqneez _5sagdn4k _1pgl1lbj _71re1v6b _1psg1ign _o8i7indk"
|
|
42
|
+
root: "_y44vof1f _k8m011k7 _1oecdn4k _1s9z1a5r _1o51q7pw _5sagdn4k _1pgl1lbj _15ns179n _12t71ign _n70peoah _1psg1ign _o8i7indk _bl8aglyw _156yru3m _8rmvglyw _2qm2ru3m"
|
|
48
43
|
};
|
|
49
44
|
var styles = {
|
|
50
45
|
root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28"
|
|
@@ -95,7 +90,8 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
95
90
|
onOpenChange = _ref.onOpenChange,
|
|
96
91
|
onEnterFinish = _ref.onEnterFinish,
|
|
97
92
|
onExitFinish = _ref.onExitFinish,
|
|
98
|
-
animate = _ref.animate,
|
|
93
|
+
_ref$animate = _ref.animate,
|
|
94
|
+
animate = _ref$animate === void 0 ? false : _ref$animate,
|
|
99
95
|
placement = _ref.placement,
|
|
100
96
|
testId = _ref.testId,
|
|
101
97
|
isOpen = _ref.isOpen,
|
|
@@ -111,6 +107,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
111
107
|
var popoverId = idProp !== null && idProp !== void 0 ? idProp : "popover-".concat(autoId.replace(/:/g, ''));
|
|
112
108
|
var _useAnimatedVisibilit = (0, _useAnimatedVisibility.useAnimatedVisibility)({
|
|
113
109
|
isOpen: isOpen,
|
|
110
|
+
animationKind: 'popover',
|
|
114
111
|
animate: animate,
|
|
115
112
|
elementRef: ownRef,
|
|
116
113
|
onEnterFinish: onEnterFinish,
|
|
@@ -278,12 +275,12 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
278
275
|
// stale custom properties on the element.
|
|
279
276
|
(0, _react.useLayoutEffect)(function () {
|
|
280
277
|
var element = ownRef.current;
|
|
281
|
-
if (!element || !
|
|
278
|
+
if (!element || !placement) {
|
|
282
279
|
return;
|
|
283
280
|
}
|
|
284
281
|
return (0, _setStyle.setStyle)({
|
|
285
282
|
element: element,
|
|
286
|
-
styles:
|
|
283
|
+
styles: (0, _animations.getPopupMotionStyles)({
|
|
287
284
|
placement: placement
|
|
288
285
|
})
|
|
289
286
|
});
|
|
@@ -336,6 +333,6 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
336
333
|
"aria-label": label,
|
|
337
334
|
"aria-labelledby": labelledBy,
|
|
338
335
|
"data-testid": testId,
|
|
339
|
-
className: (0, _runtime.ax)([styles.root, preset && popoverAnimationStyles.root,
|
|
336
|
+
className: (0, _runtime.ax)([styles.root, preset && popoverAnimationStyles.root, consumerXcss])
|
|
340
337
|
}, children);
|
|
341
338
|
});
|
|
@@ -526,6 +526,9 @@ if (typeof HTMLElement !== 'undefined') {
|
|
|
526
526
|
// delegate every other selector to the original implementation.
|
|
527
527
|
// Spec: https://html.spec.whatwg.org/multipage/semantics-other.html#selector-popover-open
|
|
528
528
|
var originalMatches = Element.prototype.matches;
|
|
529
|
+
// The DOM lib types `Element.prototype.matches` as a set of type-predicate
|
|
530
|
+
// overloads. This polyfill intentionally replaces it with a plain boolean
|
|
531
|
+
// implementation, so we cast to the original member type.
|
|
529
532
|
Element.prototype.matches = function patchedMatches(selector) {
|
|
530
533
|
if (selector === ':popover-open') {
|
|
531
534
|
return this.hasAttribute('data-popover-open');
|
|
@@ -20,23 +20,15 @@
|
|
|
20
20
|
._1o51q7pw{animation-fill-mode:forwards}
|
|
21
21
|
._1oeci9qs{transition-duration:var(--ds-duration-medium,.2s)}
|
|
22
22
|
._1oil1d08[open]{transition-timing-function:var(--ds-easing-inout-bold,cubic-bezier(.4,0,0,1))}
|
|
23
|
-
._1pgl1lbj{animation-timing-function:var(--ds-easing-in-practical,cubic-bezier(.6,0,.8,.6))}
|
|
24
23
|
._1q51ze3t{padding-block-start:var(--ds-space-0,0)}
|
|
25
|
-
._1rjx1d08[open]{animation-timing-function:var(--ds-easing-inout-bold,cubic-bezier(.4,0,0,1))}
|
|
26
24
|
._1rsueoah[open]::-ms-backdrop{animation-fill-mode:backwards}
|
|
27
25
|
._1rsueoah[open]::backdrop{animation-fill-mode:backwards}
|
|
28
26
|
._1s9z1a5r{transition-behavior:allow-discrete}
|
|
29
|
-
._1szp1mzy[open]{animation-duration:var(--ds-duration-long,.25s)}
|
|
30
27
|
._2hwx1wug{margin-right:auto}
|
|
31
|
-
._5sagi9qs{animation-duration:var(--ds-duration-medium,.2s)}
|
|
32
28
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
33
|
-
._8ar61bym[open]{animation-name:var(--ds-keyframe-fade-in,FadeIn0to100)}
|
|
34
|
-
._8ar6ftdr[open]{animation-name:k1s4adx,var(--ds-keyframe-fade-in,FadeIn0to100)}
|
|
35
29
|
._bfhk1j28{background-color:transparent}
|
|
36
30
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
37
31
|
._c71lglyw{max-height:none}
|
|
38
|
-
._j7hq1a5s{animation-name:var(--ds-keyframe-fade-out,FadeOut100to0)}
|
|
39
|
-
._j7hq1x6c{animation-name:k1gxuu8c,var(--ds-keyframe-fade-out,FadeOut100to0)}
|
|
40
32
|
._k8m011k7{transition-property:overlay,display}
|
|
41
33
|
._njwk11k7::-ms-backdrop{-ms-transition-property:overlay,display;transition-property:overlay,display}
|
|
42
34
|
._njwk11k7::backdrop{transition-property:overlay,display}
|
|
@@ -45,6 +37,4 @@
|
|
|
45
37
|
._y4tize3t{padding-inline-end:var(--ds-space-0,0)}
|
|
46
38
|
._yhpqi9qs::-ms-backdrop{transition-duration:var(--ds-duration-medium,.2s)}
|
|
47
39
|
._yhpqi9qs::backdrop{transition-duration:var(--ds-duration-medium,.2s)}
|
|
48
|
-
@keyframes k1gxuu8c{0%{transform:none}to{transform:translateY(calc(var(--ds-dialog-ty, 9pt)*-1))}}
|
|
49
|
-
@keyframes k1s4adx{0%{transform:translateY(calc(var(--ds-dialog-ty, 9pt)))}to{transform:none}}
|
|
50
40
|
@media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._156y147i{transition-duration:var(--ds-duration-instant,0ms)}._10aiglyw[open]{animation-name:none}._aeld147i[open]{transition-duration:var(--ds-duration-instant,0ms)}._l57nglyw::-ms-backdrop{animation-name:none}._l57nglyw::backdrop{animation-name:none}._1sbq147i::-ms-backdrop{transition-duration:var(--ds-duration-instant,0ms)}._1sbq147i::backdrop{transition-duration:var(--ds-duration-instant,0ms)}._19awglyw[open]::-ms-backdrop{animation-name:none}._19awglyw[open]::backdrop{animation-name:none}._1i6z147i[open]::-ms-backdrop{transition-duration:var(--ds-duration-instant,0ms)}._1i6z147i[open]::backdrop{transition-duration:var(--ds-duration-instant,0ms)}}
|
|
@@ -6,22 +6,15 @@ import { bind } from 'bind-event-listener';
|
|
|
6
6
|
import mergeRefs from '@atlaskit/ds-lib/merge-refs';
|
|
7
7
|
import noop from '@atlaskit/ds-lib/noop';
|
|
8
8
|
import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
|
|
9
|
-
import { setStyle } from '../internal/set-style';
|
|
10
9
|
import { useAnimatedVisibility } from '../internal/use-animated-visibility';
|
|
11
10
|
import { useFocusWrap } from '../internal/use-focus-wrap';
|
|
12
|
-
const slideInKeyframes = null;
|
|
13
|
-
const slideOutKeyframes = null;
|
|
14
|
-
|
|
15
11
|
// These animation styles use the non-strict Compiled cssMap because they rely
|
|
16
12
|
// on `@starting-style`, `[open]`, and `allow-discrete`. Keep them in this
|
|
17
13
|
// component so the Compiled transform can statically extract every referenced
|
|
18
14
|
// style.
|
|
19
15
|
const dialogAnimationStyles = {
|
|
20
16
|
root: "_k8m011k7 _1oeci9qs _1s9z1a5r _1fsl1mzy _1oil1d08",
|
|
21
|
-
motion: "_y44vgeqi _1o51q7pw _1iu47kvq _1i0neoah"
|
|
22
|
-
'slide-up-and-fade': "_j7hq1x6c _5sagi9qs _1pgl1lbj _8ar6ftdr _1szp1mzy _1rjx1d08",
|
|
23
|
-
fade: "_j7hq1a5s _5sagi9qs _1pgl1lbj _8ar61bym _1szp1mzy _1rjx1d08",
|
|
24
|
-
custom: ""
|
|
17
|
+
motion: "_y44vgeqi _1o51q7pw _1iu47kvq _1i0neoah"
|
|
25
18
|
};
|
|
26
19
|
const styles = {
|
|
27
20
|
dialog: "_19itglyw _19pk1wug _2hwx1wug _otyr1wug _18u01wug _1q51ze3t _y4tize3t _85i5ze3t _bozgze3t _p12fglyw _c71lglyw _bfhk1j28 _bl8aglyw _156y147i _10aiglyw _aeld147i"
|
|
@@ -55,7 +48,7 @@ export const Dialog = /*#__PURE__*/forwardRef(function Dialog({
|
|
|
55
48
|
onClose,
|
|
56
49
|
onEnterFinish,
|
|
57
50
|
onExitFinish,
|
|
58
|
-
animate,
|
|
51
|
+
animate = false,
|
|
59
52
|
xcss: consumerXcss,
|
|
60
53
|
style,
|
|
61
54
|
testId,
|
|
@@ -73,6 +66,7 @@ export const Dialog = /*#__PURE__*/forwardRef(function Dialog({
|
|
|
73
66
|
preset
|
|
74
67
|
} = useAnimatedVisibility({
|
|
75
68
|
isOpen,
|
|
69
|
+
animationKind: 'dialog',
|
|
76
70
|
animate,
|
|
77
71
|
elementRef: ownRef,
|
|
78
72
|
onEnterFinish,
|
|
@@ -122,24 +116,6 @@ export const Dialog = /*#__PURE__*/forwardRef(function Dialog({
|
|
|
122
116
|
}
|
|
123
117
|
}, [isOpen]);
|
|
124
118
|
|
|
125
|
-
// Apply preset-provided animation custom properties (e.g. the
|
|
126
|
-
// `--ds-dialog-ty` slide distance for `dialogSlideUpAndFade`). The
|
|
127
|
-
// cleanup restores the previous inline values so a preset change does
|
|
128
|
-
// not leave stale custom properties on the element. Dialog presets do
|
|
129
|
-
// not vary by placement, so an empty placement is passed.
|
|
130
|
-
useLayoutEffect(() => {
|
|
131
|
-
const dialog = ownRef.current;
|
|
132
|
-
if (!dialog || !(preset !== null && preset !== void 0 && preset.getStyles)) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
return setStyle({
|
|
136
|
-
element: dialog,
|
|
137
|
-
styles: preset.getStyles({
|
|
138
|
-
placement: {}
|
|
139
|
-
})
|
|
140
|
-
});
|
|
141
|
-
}, [preset, isVisible]);
|
|
142
|
-
|
|
143
119
|
// Handle native Escape (cancel event)
|
|
144
120
|
const handleCancel = useCallback(event => {
|
|
145
121
|
// Only handle a cancel targeting THIS dialog. Native `cancel` does not
|
|
@@ -200,6 +176,6 @@ export const Dialog = /*#__PURE__*/forwardRef(function Dialog({
|
|
|
200
176
|
style: style,
|
|
201
177
|
onCancel: handleCancel,
|
|
202
178
|
"data-testid": testId,
|
|
203
|
-
className: ax([styles.dialog, shouldHideBackdrop ? backdropStyles.hidden : backdropStyles.root, preset && backdropStyles.motion, preset && dialogAnimationStyles.root, preset && dialogAnimationStyles
|
|
179
|
+
className: ax([styles.dialog, shouldHideBackdrop ? backdropStyles.hidden : backdropStyles.root, preset && backdropStyles.motion, preset && dialogAnimationStyles.root, preset && dialogAnimationStyles.motion, consumerXcss])
|
|
204
180
|
}, children);
|
|
205
181
|
});
|