@atlaskit/top-layer 1.10.1 → 3.0.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 +24 -0
- package/README.md +13 -25
- package/dist/cjs/dialog/dialog-content.compiled.css +5 -18
- package/dist/cjs/dialog/dialog-content.js +22 -20
- package/dist/cjs/internal/placement-to-position-area.js +5 -5
- package/dist/cjs/internal/placement-to-try-fallbacks.js +1 -1
- package/dist/cjs/internal/resolve-css-length-to-pixels.js +1 -1
- package/dist/cjs/internal/resolve-placement.js +3 -3
- package/dist/cjs/internal/use-anchor-position.js +2 -2
- package/dist/cjs/internal/use-animated-visibility.js +3 -17
- package/dist/cjs/popover/popover.compiled.css +4 -10
- package/dist/cjs/popover/popover.js +56 -50
- package/dist/cjs/popover-surface/popover-surface.js +1 -1
- package/dist/es2019/dialog/dialog-content.compiled.css +5 -18
- package/dist/es2019/dialog/dialog-content.js +21 -19
- package/dist/es2019/internal/placement-to-position-area.js +2 -2
- package/dist/es2019/internal/placement-to-try-fallbacks.js +2 -2
- package/dist/es2019/internal/resolve-css-length-to-pixels.js +1 -1
- package/dist/es2019/internal/resolve-placement.js +2 -2
- package/dist/es2019/internal/use-anchor-position.js +3 -3
- package/dist/es2019/internal/use-animated-visibility.js +3 -17
- package/dist/es2019/popover/popover.compiled.css +4 -10
- package/dist/es2019/popover/popover.js +57 -50
- package/dist/es2019/popover-surface/popover-surface.js +1 -1
- package/dist/esm/dialog/dialog-content.compiled.css +5 -18
- package/dist/esm/dialog/dialog-content.js +22 -20
- package/dist/esm/internal/placement-to-position-area.js +5 -5
- package/dist/esm/internal/placement-to-try-fallbacks.js +2 -2
- package/dist/esm/internal/resolve-css-length-to-pixels.js +1 -1
- package/dist/esm/internal/resolve-placement.js +2 -2
- package/dist/esm/internal/use-anchor-position.js +3 -3
- package/dist/esm/internal/use-animated-visibility.js +3 -17
- package/dist/esm/popover/popover.compiled.css +4 -10
- package/dist/esm/popover/popover.js +57 -51
- package/dist/esm/popover-surface/popover-surface.js +1 -1
- package/dist/types/dialog/types.d.ts +24 -11
- package/dist/types/internal/resolve-placement.d.ts +6 -4
- package/dist/types/internal/use-animated-visibility.d.ts +2 -14
- package/dist/types/placement-map/legacy-placements.d.ts +1 -1
- package/dist/types/popover/types.d.ts +23 -41
- package/package.json +4 -4
- package/dist/cjs/popover/animations.js +0 -50
- package/dist/es2019/popover/animations.js +0 -46
- package/dist/esm/popover/animations.js +0 -44
- package/dist/types/popover/animations.d.ts +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/top-layer
|
|
2
2
|
|
|
3
|
+
## 3.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`30abd36d3c8d6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/30abd36d3c8d6) -
|
|
8
|
+
Removes the `onOpenChange` prop from Popover. This prop was not being relied on, and created a
|
|
9
|
+
divergence between the Dialog and Popover APIs.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`c0874b1b13309`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0874b1b13309) -
|
|
14
|
+
Refactor popover motion styles and rename `getPlacement` to `resolvePlacement`.
|
|
15
|
+
|
|
16
|
+
## 2.0.0
|
|
17
|
+
|
|
18
|
+
### Major Changes
|
|
19
|
+
|
|
20
|
+
- [`3f6f3bd7da074`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3f6f3bd7da074) -
|
|
21
|
+
Updates the Top Layer animation API:
|
|
22
|
+
- Renames `animate` to `shouldAnimate` and simplifies the type to just `boolean`, removing unused
|
|
23
|
+
config type
|
|
24
|
+
- Custom animation overrides should now be applied via the `enteringAnimationXcss` and
|
|
25
|
+
`exitingAnimationXcss` props.
|
|
26
|
+
|
|
3
27
|
## 1.10.1
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -12,7 +12,6 @@ placement — compose it with the `useAnchorPosition` hook when you need anchor-
|
|
|
12
12
|
|
|
13
13
|
```tsx
|
|
14
14
|
import { useRef } from 'react';
|
|
15
|
-
import { slideAndFade } from '@atlaskit/top-layer/animations';
|
|
16
15
|
import { getAriaForTrigger } from '@atlaskit/top-layer/get-aria-for-trigger';
|
|
17
16
|
import { Popover } from '@atlaskit/top-layer/popover';
|
|
18
17
|
import { PopoverSurface } from '@atlaskit/top-layer/popover-surface';
|
|
@@ -45,7 +44,7 @@ function MyPopup({ isOpen, onClose }: { isOpen: boolean; onClose: () => void })
|
|
|
45
44
|
role="dialog"
|
|
46
45
|
label="Settings"
|
|
47
46
|
isOpen={isOpen}
|
|
48
|
-
|
|
47
|
+
shouldAnimate
|
|
49
48
|
onClose={onClose}
|
|
50
49
|
>
|
|
51
50
|
<PopoverSurface>Content here</PopoverSurface>
|
|
@@ -87,7 +86,7 @@ Compound component for modal dialogs using the native `<dialog>` element with `.
|
|
|
87
86
|
|
|
88
87
|
## Animations
|
|
89
88
|
|
|
90
|
-
Both `Popover` and `Dialog` support CSS-based entry/exit animations via the `
|
|
89
|
+
Both `Popover` and `Dialog` support CSS-based entry/exit animations via the `shouldAnimate` prop.
|
|
91
90
|
Animations use [`@starting-style`](https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style)
|
|
92
91
|
for entry and
|
|
93
92
|
[`allow-discrete`](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-behavior) on
|
|
@@ -109,15 +108,12 @@ import {
|
|
|
109
108
|
|
|
110
109
|
### Popover animation
|
|
111
110
|
|
|
112
|
-
Pass
|
|
111
|
+
Pass `shouldAnimate` to enable the default popover entry and exit animation:
|
|
113
112
|
|
|
114
113
|
```tsx
|
|
115
|
-
import { slideAndFade } from '@atlaskit/top-layer/animations';
|
|
116
114
|
import { Popover } from '@atlaskit/top-layer/popover';
|
|
117
115
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<Popover animate={animation} role="dialog" label="My popover">
|
|
116
|
+
<Popover shouldAnimate role="dialog" label="My popover" isOpen={isOpen}>
|
|
121
117
|
Content
|
|
122
118
|
</Popover>;
|
|
123
119
|
```
|
|
@@ -125,31 +121,23 @@ const animation = slideAndFade();
|
|
|
125
121
|
For overlay styling (background, shadow, border-radius), wrap children in `PopoverSurface` from
|
|
126
122
|
`@atlaskit/top-layer/popover-surface`.
|
|
127
123
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
- `slideAndFade({ distance? })` — directional slide + opacity (default for tooltip)
|
|
131
|
-
- `fade` — simple opacity transition
|
|
132
|
-
- `scaleAndFade` — scale from 0.95 + opacity (suitable for menus/dropdowns)
|
|
124
|
+
Use `enteringAnimationXcss` and `exitingAnimationXcss` when a composed component needs to override
|
|
125
|
+
the phase-specific animation styles.
|
|
133
126
|
|
|
134
127
|
### Dialog animation
|
|
135
128
|
|
|
136
|
-
Pass
|
|
129
|
+
Pass `shouldAnimate` to enable the default dialog entry and exit animation:
|
|
137
130
|
|
|
138
131
|
```tsx
|
|
139
|
-
import {
|
|
140
|
-
|
|
141
|
-
const animation = dialogSlideUpAndFade();
|
|
132
|
+
import { Dialog } from '@atlaskit/top-layer/dialog';
|
|
142
133
|
|
|
143
|
-
<Dialog
|
|
144
|
-
|
|
145
|
-
</Dialog
|
|
134
|
+
<Dialog shouldAnimate isOpen={isOpen} onClose={onClose} label="My dialog">
|
|
135
|
+
Content
|
|
136
|
+
</Dialog>;
|
|
146
137
|
```
|
|
147
138
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
- `dialogSlideUpAndFade({ distance? })` — slide up + opacity with backdrop fade (matches legacy
|
|
151
|
-
modal entrance)
|
|
152
|
-
- `dialogFade` — simple opacity + backdrop fade
|
|
139
|
+
Use `enteringAnimationXcss` and `exitingAnimationXcss` when a composed component needs to override
|
|
140
|
+
the phase-specific animation styles.
|
|
153
141
|
|
|
154
142
|
### Progressive enhancement
|
|
155
143
|
|
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
._19itglyw{border:none}
|
|
2
|
-
._1iu47kvq[open]{animation:var(--ds-modal-enter,.25s cubic-bezier(.4,0,0,1) ScaleIn95to100)}
|
|
3
2
|
._1m5e1op4::-ms-backdrop{animation:var(--ds-blanket-exit,.2s cubic-bezier(.6,0,.8,.6) FadeOut100to0)}
|
|
4
3
|
._1m5e1op4::backdrop{animation:var(--ds-blanket-exit,.2s cubic-bezier(.6,0,.8,.6) FadeOut100to0)}
|
|
5
|
-
.
|
|
6
|
-
.
|
|
4
|
+
._1m5exbuz::-ms-backdrop{animation:var(--ds-blanket-enter,.25s cubic-bezier(.4,0,0,1) FadeIn0to100)}
|
|
5
|
+
._1m5exbuz::backdrop{animation:var(--ds-blanket-enter,.25s cubic-bezier(.4,0,0,1) FadeIn0to100)}
|
|
6
|
+
._y44v7kvq{animation:var(--ds-modal-enter,.25s cubic-bezier(.4,0,0,1) ScaleIn95to100)}
|
|
7
7
|
._y44vgeqi{animation:var(--ds-modal-exit,.2s cubic-bezier(.6,0,.8,.6) ScaleOut100to95)}._18u01wug{margin-left:auto}
|
|
8
8
|
._19pk1wug{margin-top:auto}
|
|
9
|
-
._1fsl1mzy[open]{transition-duration:var(--ds-duration-long,.25s)}
|
|
10
|
-
._1fyf1a5r::-ms-backdrop{transition-behavior:allow-discrete}
|
|
11
|
-
._1fyf1a5r::backdrop{transition-behavior:allow-discrete}
|
|
12
|
-
._1i0neoah[open]{animation-fill-mode:backwards}
|
|
13
9
|
._1i4q4jg8{overflow-wrap:normal}
|
|
14
|
-
._1jhdq7pw::-ms-backdrop{animation-fill-mode:forwards}
|
|
15
|
-
._1jhdq7pw::backdrop{animation-fill-mode:forwards}
|
|
16
10
|
._1ltk1i5c::-ms-backdrop{background-color:var(--ds-blanket,#050c1f75)}
|
|
17
11
|
._1ltk1i5c::backdrop{background-color:var(--ds-blanket,#050c1f75)}
|
|
18
12
|
._1ltk1j28::-ms-backdrop{background-color:transparent}
|
|
19
13
|
._1ltk1j28::backdrop{background-color:transparent}
|
|
20
14
|
._1nmz4jg8{word-break:normal}
|
|
21
|
-
.
|
|
15
|
+
._1o511hrf{animation-fill-mode:both}
|
|
22
16
|
._1oeci9qs{transition-duration:var(--ds-duration-medium,.2s)}
|
|
23
|
-
._1oil1d08[open]{transition-timing-function:var(--ds-easing-inout-bold,cubic-bezier(.4,0,0,1))}
|
|
24
17
|
._1p1dglyw{text-transform:none}
|
|
25
18
|
._1q51ze3t{padding-block-start:var(--ds-space-0,0)}
|
|
26
|
-
._1rsueoah[open]::-ms-backdrop{animation-fill-mode:backwards}
|
|
27
|
-
._1rsueoah[open]::backdrop{animation-fill-mode:backwards}
|
|
28
19
|
._1s9z1a5r{transition-behavior:allow-discrete}
|
|
29
20
|
._2hwx1wug{margin-right:auto}
|
|
30
21
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
@@ -33,13 +24,9 @@
|
|
|
33
24
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
34
25
|
._c71lglyw{max-height:none}
|
|
35
26
|
._k8m011k7{transition-property:overlay,display}
|
|
36
|
-
._njwk11k7::-ms-backdrop{-ms-transition-property:overlay,display;transition-property:overlay,display}
|
|
37
|
-
._njwk11k7::backdrop{transition-property:overlay,display}
|
|
38
27
|
._o5724jg8{white-space:normal}
|
|
39
28
|
._otyr1wug{margin-bottom:auto}
|
|
40
29
|
._p12fglyw{max-width:none}
|
|
41
30
|
._y3gnv2br{text-align:start}
|
|
42
31
|
._y4tize3t{padding-inline-end:var(--ds-space-0,0)}
|
|
43
|
-
.
|
|
44
|
-
._yhpqi9qs::backdrop{transition-duration:var(--ds-duration-medium,.2s)}
|
|
45
|
-
@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)}}
|
|
32
|
+
@media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._156y147i{transition-duration:var(--ds-duration-instant,0ms)}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* dialog-content.tsx generated by @compiled/babel-plugin
|
|
1
|
+
/* dialog-content.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -10,6 +10,7 @@ exports.Dialog = void 0;
|
|
|
10
10
|
require("./dialog-content.compiled.css");
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _react2 = require("@compiled/react");
|
|
13
14
|
var _bindEventListener = require("bind-event-listener");
|
|
14
15
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
15
16
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
@@ -18,15 +19,6 @@ var _useAnimatedVisibility = require("../internal/use-animated-visibility");
|
|
|
18
19
|
var _useFocusWrap = require("../internal/use-focus-wrap");
|
|
19
20
|
var _useSafariEscapeFix2 = require("../internal/use-safari-escape-fix");
|
|
20
21
|
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
|
-
// These animation styles use the non-strict Compiled cssMap because they rely
|
|
22
|
-
// on `@starting-style`, `[open]`, and `allow-discrete`. Keep them in this
|
|
23
|
-
// component so the Compiled transform can statically extract every referenced
|
|
24
|
-
// style.
|
|
25
|
-
var dialogAnimationStyles = {
|
|
26
|
-
root: "_k8m011k7 _1oeci9qs _1s9z1a5r _1fsl1mzy _1oil1d08",
|
|
27
|
-
motion: "_y44vgeqi _1o51q7pw _1iu47kvq _1i0neoah"
|
|
28
|
-
};
|
|
29
|
-
|
|
30
22
|
// Surface reset — see the rationale on `surfaceResetStyles` in `popover/popover.tsx`.
|
|
31
23
|
// Neutralises inherited text-layout properties (e.g. `white-space: nowrap`) that leak
|
|
32
24
|
// into the top-layer surface. Excludes `color`/`font` (theming) and
|
|
@@ -39,13 +31,17 @@ var dialogAnimationStyles = {
|
|
|
39
31
|
var surfaceResetStyles = {
|
|
40
32
|
root: "_o5724jg8 _1nmz4jg8 _1i4q4jg8 _y3gnv2br _azhwidpf _1p1dglyw"
|
|
41
33
|
};
|
|
42
|
-
var
|
|
43
|
-
|
|
34
|
+
var dialogStyles = {
|
|
35
|
+
root: "_19itglyw _19pk1wug _2hwx1wug _otyr1wug _18u01wug _1q51ze3t _y4tize3t _85i5ze3t _bozgze3t _p12fglyw _c71lglyw _bfhk1j28",
|
|
36
|
+
motion: "_k8m011k7 _1oeci9qs _1s9z1a5r _1o511hrf _bl8aglyw _156y147i",
|
|
37
|
+
enter: "_y44v7kvq",
|
|
38
|
+
exit: "_y44vgeqi"
|
|
44
39
|
};
|
|
45
40
|
var backdropStyles = {
|
|
46
41
|
root: "_1ltk1i5c",
|
|
47
42
|
hidden: "_1ltk1j28",
|
|
48
|
-
|
|
43
|
+
enter: "_1m5exbuz",
|
|
44
|
+
exit: "_1m5e1op4"
|
|
49
45
|
};
|
|
50
46
|
|
|
51
47
|
/**
|
|
@@ -71,9 +67,11 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
|
|
|
71
67
|
onClose = _ref.onClose,
|
|
72
68
|
onEnterFinish = _ref.onEnterFinish,
|
|
73
69
|
onExitFinish = _ref.onExitFinish,
|
|
74
|
-
_ref$
|
|
75
|
-
|
|
70
|
+
_ref$shouldAnimate = _ref.shouldAnimate,
|
|
71
|
+
shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
|
|
76
72
|
consumerXcss = _ref.xcss,
|
|
73
|
+
enteringAnimationXcss = _ref.enteringAnimationXcss,
|
|
74
|
+
exitingAnimationXcss = _ref.exitingAnimationXcss,
|
|
77
75
|
style = _ref.style,
|
|
78
76
|
testId = _ref.testId,
|
|
79
77
|
providedId = _ref.id,
|
|
@@ -87,13 +85,12 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
|
|
|
87
85
|
var _useAnimatedVisibilit = (0, _useAnimatedVisibility.useAnimatedVisibility)({
|
|
88
86
|
isOpen: isOpen,
|
|
89
87
|
animationKind: 'dialog',
|
|
90
|
-
|
|
88
|
+
shouldAnimate: shouldAnimate,
|
|
91
89
|
elementRef: ownRef,
|
|
92
90
|
onEnterFinish: onEnterFinish,
|
|
93
91
|
onExitFinish: onExitFinish
|
|
94
92
|
}),
|
|
95
|
-
phase = _useAnimatedVisibilit.phase
|
|
96
|
-
preset = _useAnimatedVisibilit.preset;
|
|
93
|
+
phase = _useAnimatedVisibilit.phase;
|
|
97
94
|
|
|
98
95
|
// True while the host element is mounted (any phase except `closed`).
|
|
99
96
|
// Used as a dep so listener-rebind effects re-attach after a remount.
|
|
@@ -198,6 +195,7 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
|
|
|
198
195
|
if (!isVisible) {
|
|
199
196
|
return null;
|
|
200
197
|
}
|
|
198
|
+
var shouldAnimateBackdrop = !shouldHideBackdrop && shouldAnimate;
|
|
201
199
|
return /*#__PURE__*/_react.default.createElement("dialog", {
|
|
202
200
|
ref: combinedRef,
|
|
203
201
|
id: dialogId
|
|
@@ -211,7 +209,11 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
|
|
|
211
209
|
"aria-labelledby": label ? undefined : labelledBy,
|
|
212
210
|
style: style,
|
|
213
211
|
onCancel: handleCancel,
|
|
214
|
-
"data-testid": testId
|
|
215
|
-
|
|
212
|
+
"data-testid": testId
|
|
213
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
214
|
+
,
|
|
215
|
+
className: (0, _runtime.ax)([
|
|
216
|
+
// Dialog styles
|
|
217
|
+
dialogStyles.root, surfaceResetStyles.root, shouldAnimate && phase === 'entering' && dialogStyles.enter, shouldAnimate && phase === 'exiting' && dialogStyles.exit, shouldAnimate && dialogStyles.motion, shouldHideBackdrop ? backdropStyles.hidden : backdropStyles.root, shouldAnimateBackdrop && phase === 'entering' && backdropStyles.enter, shouldAnimateBackdrop && phase === 'exiting' && backdropStyles.exit, (0, _react2.cx)(consumerXcss, shouldAnimate && phase === 'entering' && enteringAnimationXcss, shouldAnimate && phase === 'exiting' && exitingAnimationXcss)])
|
|
216
218
|
}, children);
|
|
217
219
|
});
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.placementToPositionArea = placementToPositionArea;
|
|
7
|
-
var
|
|
7
|
+
var _resolvePlacement2 = require("./resolve-placement");
|
|
8
8
|
/**
|
|
9
9
|
* Resolves placement options to CSS `position-area` syntax.
|
|
10
10
|
*
|
|
@@ -24,12 +24,12 @@ var _resolvePlacement = require("./resolve-placement");
|
|
|
24
24
|
*/
|
|
25
25
|
function placementToPositionArea(_ref) {
|
|
26
26
|
var placement = _ref.placement;
|
|
27
|
-
var
|
|
27
|
+
var _resolvePlacement = (0, _resolvePlacement2.resolvePlacement)({
|
|
28
28
|
placement: placement
|
|
29
29
|
}),
|
|
30
|
-
axis =
|
|
31
|
-
edge =
|
|
32
|
-
align =
|
|
30
|
+
axis = _resolvePlacement.axis,
|
|
31
|
+
edge = _resolvePlacement.edge,
|
|
32
|
+
align = _resolvePlacement.align;
|
|
33
33
|
var edgeValue = "".concat(axis, "-").concat(edge);
|
|
34
34
|
if (align === 'center') {
|
|
35
35
|
return edgeValue;
|
|
@@ -49,7 +49,7 @@ function placementToTryFallbacks(_ref3) {
|
|
|
49
49
|
* The browser tries them _in order_ and uses the _first_ one that fits.
|
|
50
50
|
*/
|
|
51
51
|
|
|
52
|
-
var resolved = (0, _resolvePlacement.
|
|
52
|
+
var resolved = (0, _resolvePlacement.resolvePlacement)({
|
|
53
53
|
placement: placement
|
|
54
54
|
});
|
|
55
55
|
var axis = resolved.axis,
|
|
@@ -64,7 +64,7 @@ function resolveCssLengthToPixels(_ref3) {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
// Fast path: bare `${n}px` strings come from the consumer normalisation
|
|
67
|
-
// in `
|
|
67
|
+
// in `resolvePlacement`. Avoid a reflow when we can.
|
|
68
68
|
var pxMatch = value.match(/^(-?\d+(?:\.\d+)?)px$/);
|
|
69
69
|
if (pxMatch) {
|
|
70
70
|
return Number(pxMatch[1]);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.resolvePlacement = resolvePlacement;
|
|
7
7
|
var _resolveCssLength = require("./resolve-css-length");
|
|
8
8
|
/**
|
|
9
9
|
* Default gap between trigger and popover. Resolves to a design
|
|
@@ -19,7 +19,7 @@ var DEFAULT_GAP = "var(--ds-space-100, 8px)";
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
* Fully-resolved placement (internal). Use `
|
|
22
|
+
* Fully-resolved placement (internal). Use `resolvePlacement` for partial input.
|
|
23
23
|
* `offset.gap` and `offset.crossAxisShift.value` are always CSS
|
|
24
24
|
* length strings.
|
|
25
25
|
*/
|
|
@@ -42,7 +42,7 @@ var DEFAULT_GAP = "var(--ds-space-100, 8px)";
|
|
|
42
42
|
* `offset.gap: token('space.100', '8px')`,
|
|
43
43
|
* `offset.crossAxisShift: { value: '0px', direction: 'forwards' }`.
|
|
44
44
|
*/
|
|
45
|
-
function
|
|
45
|
+
function resolvePlacement(_ref) {
|
|
46
46
|
var _placement$offset, _placement$axis, _placement$edge, _placement$align, _placement$offset$cro, _placement$offset2, _placement$offset$cro2, _placement$offset3;
|
|
47
47
|
var placement = _ref.placement;
|
|
48
48
|
var consumerGap = (_placement$offset = placement.offset) === null || _placement$offset === void 0 ? void 0 : _placement$offset.gap;
|
|
@@ -33,7 +33,7 @@ var _setStyle = require("./set-style");
|
|
|
33
33
|
* is never painted at the wrong location.
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
|
-
// `
|
|
36
|
+
// `resolvePlacement` is intentionally NOT re-exported here - import it directly
|
|
37
37
|
// from `./resolve-placement` so search-and-jump lands at the source of truth.
|
|
38
38
|
|
|
39
39
|
/**
|
|
@@ -157,7 +157,7 @@ function crossAxisShiftMargin(_ref2) {
|
|
|
157
157
|
* (or undefined fields vs explicit defaults) does not produce a fresh result.
|
|
158
158
|
*/
|
|
159
159
|
function useStablePlacement(placement) {
|
|
160
|
-
var resolved = (0, _resolvePlacement.
|
|
160
|
+
var resolved = (0, _resolvePlacement.resolvePlacement)({
|
|
161
161
|
placement: placement
|
|
162
162
|
});
|
|
163
163
|
var axis = resolved.axis;
|
|
@@ -67,13 +67,6 @@ function runOnTransitionEndOrTimeout(_ref) {
|
|
|
67
67
|
return teardown;
|
|
68
68
|
}
|
|
69
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
|
-
|
|
77
70
|
/**
|
|
78
71
|
* Visibility lifecycle phase shared between `useAnimatedVisibility`,
|
|
79
72
|
* `useFocusWrap`, `useInitialFocus`, and the `Popover` / `Dialog`
|
|
@@ -138,17 +131,11 @@ function runOnTransitionEndOrTimeout(_ref) {
|
|
|
138
131
|
function useAnimatedVisibility(_ref2) {
|
|
139
132
|
var isOpen = _ref2.isOpen,
|
|
140
133
|
animationKind = _ref2.animationKind,
|
|
141
|
-
|
|
134
|
+
shouldAnimate = _ref2.shouldAnimate,
|
|
142
135
|
elementRef = _ref2.elementRef,
|
|
143
136
|
onEnterFinish = _ref2.onEnterFinish,
|
|
144
137
|
onExitFinish = _ref2.onExitFinish;
|
|
145
|
-
|
|
146
|
-
// and `Dialog`), so there is no longer any CSS injection step. Normalize a
|
|
147
|
-
// falsy `animate` to `null`.
|
|
148
|
-
var preset = animate || null;
|
|
149
|
-
|
|
150
|
-
// False when there is no preset or `prefers-reduced-motion` is set.
|
|
151
|
-
var willAnimate = Boolean(animate) && !(0, _reducedMotion.prefersReducedMotion)();
|
|
138
|
+
var willAnimate = shouldAnimate && !(0, _reducedMotion.prefersReducedMotion)();
|
|
152
139
|
|
|
153
140
|
// Promote `closed → entering`/`closed → open` synchronously during
|
|
154
141
|
// render so the host element mounts in the same commit as the open
|
|
@@ -317,7 +304,6 @@ function useAnimatedVisibility(_ref2) {
|
|
|
317
304
|
}
|
|
318
305
|
}, [phase, willAnimate]);
|
|
319
306
|
return {
|
|
320
|
-
phase: phase
|
|
321
|
-
preset: preset
|
|
307
|
+
phase: phase
|
|
322
308
|
};
|
|
323
309
|
}
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
._15ns179n:popover-open{animation:var(--ds-popover-motion-enter)}
|
|
2
1
|
._19itglyw{border:none}
|
|
3
2
|
._1r041wug{inset:auto}
|
|
4
|
-
.
|
|
5
|
-
._18m9ewfl{overflow-y:visible}
|
|
3
|
+
._y44v179n{animation:var(--ds-popover-motion-enter)}
|
|
4
|
+
._y44vof1f{animation:var(--ds-popover-motion-exit)}._18m9ewfl{overflow-y:visible}
|
|
6
5
|
._18u0idpf{margin-left:0}
|
|
7
6
|
._19bvidpf{padding-left:0}
|
|
8
7
|
._19pkidpf{margin-top:0}
|
|
9
8
|
._1i4q4jg8{overflow-wrap:normal}
|
|
10
9
|
._1nmz4jg8{word-break:normal}
|
|
11
|
-
.
|
|
10
|
+
._1o511hrf{animation-fill-mode:both}
|
|
12
11
|
._1oecdn4k{transition-duration:var(--ds-duration-xshort,.1s)}
|
|
13
12
|
._1p1dglyw{text-transform:none}
|
|
14
|
-
._1pgl1lbj{animation-timing-function:var(--ds-easing-in-practical,cubic-bezier(.6,0,.8,.6))}
|
|
15
|
-
._1psg1ign:popover-open{animation-duration:var(--ds-duration-short,.15s)}
|
|
16
13
|
._1reoewfl{overflow-x:visible}
|
|
17
14
|
._1s9z1a5r{transition-behavior:allow-discrete}
|
|
18
15
|
._2hwxidpf{margin-right:0}
|
|
19
16
|
._4t3i1wug{height:auto}
|
|
20
|
-
._5sagdn4k{animation-duration:var(--ds-duration-xshort,.1s)}
|
|
21
17
|
._azhwidpf{text-indent:0}
|
|
22
18
|
._bfhk1j28{background-color:transparent}
|
|
23
19
|
._ca0qidpf{padding-top:0}
|
|
24
20
|
._k8m011k7{transition-property:overlay,display}
|
|
25
21
|
._n3tdidpf{padding-bottom:0}
|
|
26
|
-
._n70peoah:popover-open{animation-fill-mode:backwards}
|
|
27
22
|
._o5724jg8{white-space:normal}
|
|
28
|
-
._o8i7indk:popover-open{animation-timing-function:var(--ds-easing-out-practical,cubic-bezier(.4,1,.6,1))}
|
|
29
23
|
._otyridpf{margin-bottom:0}
|
|
30
24
|
._u5f3idpf{padding-right:0}
|
|
31
25
|
._y3gnv2br{text-align:start}
|
|
32
|
-
@media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}.
|
|
26
|
+
@media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._156y147i{transition-duration:var(--ds-duration-instant,0ms)}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* popover.tsx generated by @compiled/babel-plugin
|
|
1
|
+
/* popover.tsx generated by @compiled/babel-plugin v2.0.0 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -10,16 +10,16 @@ exports.Popover = void 0;
|
|
|
10
10
|
require("./popover.compiled.css");
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _react2 = require("@compiled/react");
|
|
13
14
|
var _bindEventListener = require("bind-event-listener");
|
|
14
15
|
var _mergeRefs = _interopRequireDefault(require("@atlaskit/ds-lib/merge-refs"));
|
|
15
16
|
var _once = _interopRequireDefault(require("@atlaskit/ds-lib/once"));
|
|
16
17
|
var _useNotifyOpenLayerObserver = require("@atlaskit/layering/use-notify-open-layer-observer");
|
|
18
|
+
var _resolvePlacement2 = require("../internal/resolve-placement");
|
|
17
19
|
var _roleTypes = require("../internal/role-types");
|
|
18
|
-
var _setStyle = require("../internal/set-style");
|
|
19
20
|
var _useAnimatedVisibility = require("../internal/use-animated-visibility");
|
|
20
21
|
var _useFocusWrap = require("../internal/use-focus-wrap");
|
|
21
22
|
var _useInitialFocus = require("../internal/use-initial-focus");
|
|
22
|
-
var _animations = require("./animations");
|
|
23
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); }
|
|
24
24
|
/**
|
|
25
25
|
* Detects `popover="hint"` support via DOM reflection. SSR-safe, cached.
|
|
@@ -34,14 +34,6 @@ var supportsPopoverHint = (0, _once.default)(function () {
|
|
|
34
34
|
return element.popover === 'hint';
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
// These animation styles use the non-strict Compiled cssMap because they rely
|
|
38
|
-
// on `@starting-style`, `:popover-open`, `[dir='rtl']`, and `allow-discrete`.
|
|
39
|
-
// Keep them in this component so the Compiled transform can statically extract
|
|
40
|
-
// every referenced style.
|
|
41
|
-
var popoverAnimationStyles = {
|
|
42
|
-
root: "_y44vof1f _k8m011k7 _1oecdn4k _1s9z1a5r _1o51q7pw _5sagdn4k _1pgl1lbj _15ns179n _12t71ign _n70peoah _1psg1ign _o8i7indk _bl8aglyw _156yru3m _8rmvglyw _2qm2ru3m"
|
|
43
|
-
};
|
|
44
|
-
|
|
45
37
|
// Surface reset — neutralises inherited text-layout properties (e.g.
|
|
46
38
|
// `white-space: nowrap` from an `@atlaskit/select` option) that leak into a
|
|
47
39
|
// top-layer element because, for CSS inheritance, it is still a DOM child of its
|
|
@@ -57,7 +49,35 @@ var surfaceResetStyles = {
|
|
|
57
49
|
root: "_o5724jg8 _1nmz4jg8 _1i4q4jg8 _y3gnv2br _azhwidpf _1p1dglyw"
|
|
58
50
|
};
|
|
59
51
|
var styles = {
|
|
60
|
-
root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28 _4t3i1wug"
|
|
52
|
+
root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28 _4t3i1wug",
|
|
53
|
+
motion: "_k8m011k7 _1oecdn4k _1s9z1a5r _1o511hrf _bl8aglyw _156y147i",
|
|
54
|
+
enter: "_y44v179n",
|
|
55
|
+
exit: "_y44vof1f"
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Intentionally using `Record<string, string>` instead of `React.CSSProperties`
|
|
59
|
+
// to avoid type errors about the CSS variables not being valid property names
|
|
60
|
+
var popupMotionStyles = {
|
|
61
|
+
block: {
|
|
62
|
+
start: {
|
|
63
|
+
'--ds-popover-motion-enter': "var(--ds-popup-enter-top, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInTop8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)",
|
|
64
|
+
'--ds-popover-motion-exit': "var(--ds-popup-exit-top, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutTop8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
65
|
+
},
|
|
66
|
+
end: {
|
|
67
|
+
'--ds-popover-motion-enter': "var(--ds-popup-enter-bottom, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInBottom8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)",
|
|
68
|
+
'--ds-popover-motion-exit': "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)"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
inline: {
|
|
72
|
+
start: {
|
|
73
|
+
'--ds-popover-motion-enter': "var(--ds-popup-enter-left, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInLeft8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)",
|
|
74
|
+
'--ds-popover-motion-exit': "var(--ds-popup-exit-left, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutLeft8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
75
|
+
},
|
|
76
|
+
end: {
|
|
77
|
+
'--ds-popover-motion-enter': "var(--ds-popup-enter-right, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInRight8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)",
|
|
78
|
+
'--ds-popover-motion-exit': "var(--ds-popup-exit-right, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutRight8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
61
81
|
};
|
|
62
82
|
/**
|
|
63
83
|
* Roles registered with the open layer observer as `popup`, so `closeLayers()`
|
|
@@ -102,15 +122,15 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
102
122
|
_ref$mode = _ref.mode,
|
|
103
123
|
modeProp = _ref$mode === void 0 ? 'auto' : _ref$mode,
|
|
104
124
|
onClose = _ref.onClose,
|
|
105
|
-
onOpenChange = _ref.onOpenChange,
|
|
106
125
|
onEnterFinish = _ref.onEnterFinish,
|
|
107
126
|
onExitFinish = _ref.onExitFinish,
|
|
108
|
-
_ref$
|
|
109
|
-
|
|
127
|
+
_ref$shouldAnimate = _ref.shouldAnimate,
|
|
128
|
+
shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
|
|
110
129
|
placement = _ref.placement,
|
|
111
130
|
testId = _ref.testId,
|
|
112
131
|
isOpen = _ref.isOpen,
|
|
113
|
-
|
|
132
|
+
enteringAnimationXcss = _ref.enteringAnimationXcss,
|
|
133
|
+
exitingAnimationXcss = _ref.exitingAnimationXcss,
|
|
114
134
|
role = _ref.role,
|
|
115
135
|
label = _ref.label,
|
|
116
136
|
labelledBy = _ref.labelledBy,
|
|
@@ -123,13 +143,12 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
123
143
|
var _useAnimatedVisibilit = (0, _useAnimatedVisibility.useAnimatedVisibility)({
|
|
124
144
|
isOpen: isOpen,
|
|
125
145
|
animationKind: 'popover',
|
|
126
|
-
|
|
146
|
+
shouldAnimate: shouldAnimate,
|
|
127
147
|
elementRef: ownRef,
|
|
128
148
|
onEnterFinish: onEnterFinish,
|
|
129
149
|
onExitFinish: onExitFinish
|
|
130
150
|
}),
|
|
131
|
-
phase = _useAnimatedVisibilit.phase
|
|
132
|
-
preset = _useAnimatedVisibilit.preset;
|
|
151
|
+
phase = _useAnimatedVisibilit.phase;
|
|
133
152
|
|
|
134
153
|
// True while the host element is mounted (any phase except `closed`).
|
|
135
154
|
// Used as a dep so listener-rebind effects re-attach after a remount.
|
|
@@ -170,6 +189,17 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
170
189
|
// will close other `auto` popovers when opened. Acceptable trade-off given
|
|
171
190
|
// shrinking browser set without `hint` support.
|
|
172
191
|
var mode = modeProp === 'hint' && !supportsPopoverHint() ? 'auto' : modeProp;
|
|
192
|
+
var popupMotionStyle = (0, _react.useMemo)(function () {
|
|
193
|
+
if (!placement || !shouldAnimate) {
|
|
194
|
+
return undefined;
|
|
195
|
+
}
|
|
196
|
+
var _resolvePlacement = (0, _resolvePlacement2.resolvePlacement)({
|
|
197
|
+
placement: placement
|
|
198
|
+
}),
|
|
199
|
+
axis = _resolvePlacement.axis,
|
|
200
|
+
edge = _resolvePlacement.edge;
|
|
201
|
+
return popupMotionStyles[axis][edge];
|
|
202
|
+
}, [placement, shouldAnimate]);
|
|
173
203
|
|
|
174
204
|
// Prevents toggle handler from calling onClose for our own hidePopover() calls.
|
|
175
205
|
var programmaticCloseRef = (0, _react.useRef)(false);
|
|
@@ -191,21 +221,10 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
191
221
|
var handleToggle = (0, _react.useCallback)(function (event) {
|
|
192
222
|
var element = ownRef.current;
|
|
193
223
|
if (event.newState === 'open') {
|
|
194
|
-
if (element) {
|
|
195
|
-
onOpenChange === null || onOpenChange === void 0 || onOpenChange({
|
|
196
|
-
isOpen: true,
|
|
197
|
-
element: element
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
224
|
return;
|
|
201
225
|
}
|
|
202
226
|
if (event.newState === 'closed') {
|
|
203
227
|
if (element) {
|
|
204
|
-
onOpenChange === null || onOpenChange === void 0 || onOpenChange({
|
|
205
|
-
isOpen: false,
|
|
206
|
-
element: element
|
|
207
|
-
});
|
|
208
|
-
|
|
209
228
|
// Nested-popover focus restoration fallback (browser only
|
|
210
229
|
// restores outermost; Firefox skips nested entirely).
|
|
211
230
|
// Restore only when the role moved focus in on open AND the
|
|
@@ -242,7 +261,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
242
261
|
reason: reason
|
|
243
262
|
});
|
|
244
263
|
}
|
|
245
|
-
}, [onClose,
|
|
264
|
+
}, [onClose, role]);
|
|
246
265
|
|
|
247
266
|
// Bind via `useLayoutEffect`, and BEFORE the show/hide layout effect
|
|
248
267
|
// below, so listeners are attached when `showPopover()` synchronously
|
|
@@ -284,23 +303,6 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
284
303
|
};
|
|
285
304
|
}, [handleToggle, handleBeforeToggle, isVisible]);
|
|
286
305
|
|
|
287
|
-
// Placement-dependent animation CSS vars. Kept separate from show/hide
|
|
288
|
-
// so preset reference changes do not re-trigger visibility. The cleanup
|
|
289
|
-
// restores the previous inline values so a preset change does not leave
|
|
290
|
-
// stale custom properties on the element.
|
|
291
|
-
(0, _react.useLayoutEffect)(function () {
|
|
292
|
-
var element = ownRef.current;
|
|
293
|
-
if (!element || !placement) {
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
return (0, _setStyle.setStyle)({
|
|
297
|
-
element: element,
|
|
298
|
-
styles: (0, _animations.getPopupMotionStyles)({
|
|
299
|
-
placement: placement
|
|
300
|
-
})
|
|
301
|
-
});
|
|
302
|
-
}, [preset, placement, isVisible]);
|
|
303
|
-
|
|
304
306
|
// Show/hide based on isOpen. `showPopover`/`hidePopover` are no-ops when
|
|
305
307
|
// already in the target state. Try/catch guards `InvalidStateError` on
|
|
306
308
|
// disconnected elements (StrictMode/concurrent/unmount edge cases).
|
|
@@ -347,7 +349,11 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
|
|
|
347
349
|
role: role,
|
|
348
350
|
"aria-label": label,
|
|
349
351
|
"aria-labelledby": labelledBy,
|
|
350
|
-
"data-testid": testId
|
|
351
|
-
|
|
352
|
+
"data-testid": testId
|
|
353
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Motion styles are selected at runtime from the placement.
|
|
354
|
+
,
|
|
355
|
+
style: popupMotionStyle,
|
|
356
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
|
|
357
|
+
className: (0, _runtime.ax)([styles.root, surfaceResetStyles.root, shouldAnimate && phase === 'entering' && styles.enter, shouldAnimate && phase === 'exiting' && styles.exit, shouldAnimate && styles.motion, (0, _react2.cx)(shouldAnimate && phase === 'entering' && enteringAnimationXcss, shouldAnimate && phase === 'exiting' && exitingAnimationXcss)])
|
|
352
358
|
}, children);
|
|
353
359
|
});
|