@atlaskit/top-layer 1.10.0 → 2.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.
@@ -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
- ._y44vof1f{animation:var(--ds-popover-motion-exit)}._12t71ign:popover-open{transition-duration:var(--ds-duration-short,.15s)}
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
- ._1o51q7pw{animation-fill-mode:forwards}
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}._156yru3m{transition-duration:0s}._8rmvglyw:popover-open{animation-name:none}._2qm2ru3m:popover-open{transition-duration:0s}}
26
+ @media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._156y147i{transition-duration:var(--ds-duration-instant,0ms)}}
@@ -2,10 +2,11 @@
2
2
  import "./popover.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { forwardRef, useCallback, useId, useLayoutEffect, useRef } from 'react';
5
+ import { cx } from '@compiled/react';
5
6
  import { bind } from 'bind-event-listener';
6
7
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
7
8
  import once from '@atlaskit/ds-lib/once';
8
- import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
9
+ import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
9
10
  import { shouldFocusIntoPopover } from '../internal/role-types';
10
11
  import { setStyle } from '../internal/set-style';
11
12
  import { useAnimatedVisibility } from '../internal/use-animated-visibility';
@@ -25,14 +26,6 @@ const supportsPopoverHint = once(() => {
25
26
  return element.popover === 'hint';
26
27
  });
27
28
 
28
- // These animation styles use the non-strict Compiled cssMap because they rely
29
- // on `@starting-style`, `:popover-open`, `[dir='rtl']`, and `allow-discrete`.
30
- // Keep them in this component so the Compiled transform can statically extract
31
- // every referenced style.
32
- const popoverAnimationStyles = {
33
- root: "_y44vof1f _k8m011k7 _1oecdn4k _1s9z1a5r _1o51q7pw _5sagdn4k _1pgl1lbj _15ns179n _12t71ign _n70peoah _1psg1ign _o8i7indk _bl8aglyw _156yru3m _8rmvglyw _2qm2ru3m"
34
- };
35
-
36
29
  // Surface reset — neutralises inherited text-layout properties (e.g.
37
30
  // `white-space: nowrap` from an `@atlaskit/select` option) that leak into a
38
31
  // top-layer element because, for CSS inheritance, it is still a DOM child of its
@@ -48,7 +41,10 @@ const surfaceResetStyles = {
48
41
  root: "_o5724jg8 _1nmz4jg8 _1i4q4jg8 _y3gnv2br _azhwidpf _1p1dglyw"
49
42
  };
50
43
  const styles = {
51
- root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28 _4t3i1wug"
44
+ root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28 _4t3i1wug",
45
+ motion: "_k8m011k7 _1oecdn4k _1s9z1a5r _1o511hrf _bl8aglyw _156y147i",
46
+ enter: "_y44v179n",
47
+ exit: "_y44vof1f"
52
48
  };
53
49
  /**
54
50
  * Roles registered with the open layer observer as `popup`, so `closeLayers()`
@@ -95,11 +91,12 @@ export const Popover = /*#__PURE__*/forwardRef(function Popover({
95
91
  onOpenChange,
96
92
  onEnterFinish,
97
93
  onExitFinish,
98
- animate = false,
94
+ shouldAnimate = false,
99
95
  placement,
100
96
  testId,
101
97
  isOpen,
102
- xcss: consumerXcss,
98
+ enteringAnimationXcss,
99
+ exitingAnimationXcss,
103
100
  // ARIA
104
101
  role,
105
102
  label,
@@ -112,12 +109,11 @@ export const Popover = /*#__PURE__*/forwardRef(function Popover({
112
109
  // `useId()` colons are invalid in CSS selectors and popover target attributes.
113
110
  const popoverId = idProp !== null && idProp !== void 0 ? idProp : `popover-${autoId.replace(/:/g, '')}`;
114
111
  const {
115
- phase,
116
- preset
112
+ phase
117
113
  } = useAnimatedVisibility({
118
114
  isOpen,
119
115
  animationKind: 'popover',
120
- animate,
116
+ shouldAnimate,
121
117
  elementRef: ownRef,
122
118
  onEnterFinish,
123
119
  onExitFinish
@@ -291,7 +287,7 @@ export const Popover = /*#__PURE__*/forwardRef(function Popover({
291
287
  placement
292
288
  })
293
289
  });
294
- }, [preset, placement, isVisible]);
290
+ }, [placement, isVisible]);
295
291
 
296
292
  // Show/hide based on isOpen. `showPopover`/`hidePopover` are no-ops when
297
293
  // already in the target state. Try/catch guards `InvalidStateError` on
@@ -340,6 +336,7 @@ export const Popover = /*#__PURE__*/forwardRef(function Popover({
340
336
  "aria-label": label,
341
337
  "aria-labelledby": labelledBy,
342
338
  "data-testid": testId,
343
- className: ax([styles.root, surfaceResetStyles.root, preset && popoverAnimationStyles.root, consumerXcss])
339
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
340
+ className: ax([styles.root, surfaceResetStyles.root, shouldAnimate && phase === 'entering' && styles.enter, shouldAnimate && phase === 'exiting' && styles.exit, shouldAnimate && styles.motion, cx(shouldAnimate && phase === 'entering' && enteringAnimationXcss, shouldAnimate && phase === 'exiting' && exitingAnimationXcss)])
344
341
  }, children);
345
342
  });
@@ -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
- ._vhgsxbuz[open]::-ms-backdrop{animation:var(--ds-blanket-enter,.25s cubic-bezier(.4,0,0,1) FadeIn0to100)}
6
- ._vhgsxbuz[open]::backdrop{animation:var(--ds-blanket-enter,.25s cubic-bezier(.4,0,0,1) FadeIn0to100)}
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
- ._1o51q7pw{animation-fill-mode:forwards}
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
- ._yhpqi9qs::-ms-backdrop{transition-duration:var(--ds-duration-medium,.2s)}
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)}}
@@ -2,22 +2,14 @@
2
2
  import "./dialog-content.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { forwardRef, useCallback, useEffect, useId, useLayoutEffect, useRef } from 'react';
5
+ import { cx } from '@compiled/react';
5
6
  import { bind } from 'bind-event-listener';
6
7
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
7
8
  import noop from '@atlaskit/ds-lib/noop';
8
- import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
9
+ import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
9
10
  import { useAnimatedVisibility } from '../internal/use-animated-visibility';
10
11
  import { useFocusWrap } from '../internal/use-focus-wrap';
11
12
  import { useSafariEscapeFix } from '../internal/use-safari-escape-fix';
12
- // These animation styles use the non-strict Compiled cssMap because they rely
13
- // on `@starting-style`, `[open]`, and `allow-discrete`. Keep them in this
14
- // component so the Compiled transform can statically extract every referenced
15
- // style.
16
- var dialogAnimationStyles = {
17
- root: "_k8m011k7 _1oeci9qs _1s9z1a5r _1fsl1mzy _1oil1d08",
18
- motion: "_y44vgeqi _1o51q7pw _1iu47kvq _1i0neoah"
19
- };
20
-
21
13
  // Surface reset — see the rationale on `surfaceResetStyles` in `popover/popover.tsx`.
22
14
  // Neutralises inherited text-layout properties (e.g. `white-space: nowrap`) that leak
23
15
  // into the top-layer surface. Excludes `color`/`font` (theming) and
@@ -30,13 +22,17 @@ var dialogAnimationStyles = {
30
22
  var surfaceResetStyles = {
31
23
  root: "_o5724jg8 _1nmz4jg8 _1i4q4jg8 _y3gnv2br _azhwidpf _1p1dglyw"
32
24
  };
33
- var styles = {
34
- dialog: "_19itglyw _19pk1wug _2hwx1wug _otyr1wug _18u01wug _1q51ze3t _y4tize3t _85i5ze3t _bozgze3t _p12fglyw _c71lglyw _bfhk1j28 _bl8aglyw _156y147i _10aiglyw _aeld147i"
25
+ var dialogStyles = {
26
+ root: "_19itglyw _19pk1wug _2hwx1wug _otyr1wug _18u01wug _1q51ze3t _y4tize3t _85i5ze3t _bozgze3t _p12fglyw _c71lglyw _bfhk1j28",
27
+ motion: "_k8m011k7 _1oeci9qs _1s9z1a5r _1o511hrf _bl8aglyw _156y147i",
28
+ enter: "_y44v7kvq",
29
+ exit: "_y44vgeqi"
35
30
  };
36
31
  var backdropStyles = {
37
32
  root: "_1ltk1i5c",
38
33
  hidden: "_1ltk1j28",
39
- motion: "_1m5e1op4 _1jhdq7pw _njwk11k7 _yhpqi9qs _1fyf1a5r _vhgsxbuz _1rsueoah _l57nglyw _1sbq147i _19awglyw _1i6z147i"
34
+ enter: "_1m5exbuz",
35
+ exit: "_1m5e1op4"
40
36
  };
41
37
 
42
38
  /**
@@ -62,9 +58,11 @@ export var Dialog = /*#__PURE__*/forwardRef(function Dialog(_ref, ref) {
62
58
  onClose = _ref.onClose,
63
59
  onEnterFinish = _ref.onEnterFinish,
64
60
  onExitFinish = _ref.onExitFinish,
65
- _ref$animate = _ref.animate,
66
- animate = _ref$animate === void 0 ? false : _ref$animate,
61
+ _ref$shouldAnimate = _ref.shouldAnimate,
62
+ shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
67
63
  consumerXcss = _ref.xcss,
64
+ enteringAnimationXcss = _ref.enteringAnimationXcss,
65
+ exitingAnimationXcss = _ref.exitingAnimationXcss,
68
66
  style = _ref.style,
69
67
  testId = _ref.testId,
70
68
  providedId = _ref.id,
@@ -78,13 +76,12 @@ export var Dialog = /*#__PURE__*/forwardRef(function Dialog(_ref, ref) {
78
76
  var _useAnimatedVisibilit = useAnimatedVisibility({
79
77
  isOpen: isOpen,
80
78
  animationKind: 'dialog',
81
- animate: animate,
79
+ shouldAnimate: shouldAnimate,
82
80
  elementRef: ownRef,
83
81
  onEnterFinish: onEnterFinish,
84
82
  onExitFinish: onExitFinish
85
83
  }),
86
- phase = _useAnimatedVisibilit.phase,
87
- preset = _useAnimatedVisibilit.preset;
84
+ phase = _useAnimatedVisibilit.phase;
88
85
 
89
86
  // True while the host element is mounted (any phase except `closed`).
90
87
  // Used as a dep so listener-rebind effects re-attach after a remount.
@@ -189,6 +186,7 @@ export var Dialog = /*#__PURE__*/forwardRef(function Dialog(_ref, ref) {
189
186
  if (!isVisible) {
190
187
  return null;
191
188
  }
189
+ var shouldAnimateBackdrop = !shouldHideBackdrop && shouldAnimate;
192
190
  return /*#__PURE__*/React.createElement("dialog", {
193
191
  ref: combinedRef,
194
192
  id: dialogId
@@ -202,7 +200,11 @@ export var Dialog = /*#__PURE__*/forwardRef(function Dialog(_ref, ref) {
202
200
  "aria-labelledby": label ? undefined : labelledBy,
203
201
  style: style,
204
202
  onCancel: handleCancel,
205
- "data-testid": testId,
206
- className: ax([styles.dialog, surfaceResetStyles.root, shouldHideBackdrop ? backdropStyles.hidden : backdropStyles.root, preset && backdropStyles.motion, preset && dialogAnimationStyles.root, preset && dialogAnimationStyles.motion, consumerXcss])
203
+ "data-testid": testId
204
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
205
+ ,
206
+ className: ax([
207
+ // Dialog styles
208
+ 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, cx(consumerXcss, shouldAnimate && phase === 'entering' && enteringAnimationXcss, shouldAnimate && phase === 'exiting' && exitingAnimationXcss)])
207
209
  }, children);
208
210
  });
@@ -60,13 +60,6 @@ function runOnTransitionEndOrTimeout(_ref) {
60
60
  return teardown;
61
61
  }
62
62
 
63
- /**
64
- * Animation config for entry/exit transitions.
65
- *
66
- * Currently no configuration is supported via this prop,
67
- * and this is just a placeholder.
68
- */
69
-
70
63
  /**
71
64
  * Visibility lifecycle phase shared between `useAnimatedVisibility`,
72
65
  * `useFocusWrap`, `useInitialFocus`, and the `Popover` / `Dialog`
@@ -131,17 +124,11 @@ function runOnTransitionEndOrTimeout(_ref) {
131
124
  export function useAnimatedVisibility(_ref2) {
132
125
  var isOpen = _ref2.isOpen,
133
126
  animationKind = _ref2.animationKind,
134
- animate = _ref2.animate,
127
+ shouldAnimate = _ref2.shouldAnimate,
135
128
  elementRef = _ref2.elementRef,
136
129
  onEnterFinish = _ref2.onEnterFinish,
137
130
  onExitFinish = _ref2.onExitFinish;
138
- // Styles are applied via the `css` prop on the host element (see `Popover`
139
- // and `Dialog`), so there is no longer any CSS injection step. Normalize a
140
- // falsy `animate` to `null`.
141
- var preset = animate || null;
142
-
143
- // False when there is no preset or `prefers-reduced-motion` is set.
144
- var willAnimate = Boolean(animate) && !prefersReducedMotion();
131
+ var willAnimate = shouldAnimate && !prefersReducedMotion();
145
132
 
146
133
  // Promote `closed → entering`/`closed → open` synchronously during
147
134
  // render so the host element mounts in the same commit as the open
@@ -310,7 +297,6 @@ export function useAnimatedVisibility(_ref2) {
310
297
  }
311
298
  }, [phase, willAnimate]);
312
299
  return {
313
- phase: phase,
314
- preset: preset
300
+ phase: phase
315
301
  };
316
302
  }
@@ -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
- ._y44vof1f{animation:var(--ds-popover-motion-exit)}._12t71ign:popover-open{transition-duration:var(--ds-duration-short,.15s)}
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
- ._1o51q7pw{animation-fill-mode:forwards}
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}._156yru3m{transition-duration:0s}._8rmvglyw:popover-open{animation-name:none}._2qm2ru3m:popover-open{transition-duration:0s}}
26
+ @media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._156y147i{transition-duration:var(--ds-duration-instant,0ms)}}
@@ -2,10 +2,11 @@
2
2
  import "./popover.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { forwardRef, useCallback, useId, useLayoutEffect, useRef } from 'react';
5
+ import { cx } from '@compiled/react';
5
6
  import { bind } from 'bind-event-listener';
6
7
  import mergeRefs from '@atlaskit/ds-lib/merge-refs';
7
8
  import once from '@atlaskit/ds-lib/once';
8
- import { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer';
9
+ import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-layer-observer';
9
10
  import { shouldFocusIntoPopover } from '../internal/role-types';
10
11
  import { setStyle } from '../internal/set-style';
11
12
  import { useAnimatedVisibility } from '../internal/use-animated-visibility';
@@ -25,14 +26,6 @@ var supportsPopoverHint = once(function () {
25
26
  return element.popover === 'hint';
26
27
  });
27
28
 
28
- // These animation styles use the non-strict Compiled cssMap because they rely
29
- // on `@starting-style`, `:popover-open`, `[dir='rtl']`, and `allow-discrete`.
30
- // Keep them in this component so the Compiled transform can statically extract
31
- // every referenced style.
32
- var popoverAnimationStyles = {
33
- root: "_y44vof1f _k8m011k7 _1oecdn4k _1s9z1a5r _1o51q7pw _5sagdn4k _1pgl1lbj _15ns179n _12t71ign _n70peoah _1psg1ign _o8i7indk _bl8aglyw _156yru3m _8rmvglyw _2qm2ru3m"
34
- };
35
-
36
29
  // Surface reset — neutralises inherited text-layout properties (e.g.
37
30
  // `white-space: nowrap` from an `@atlaskit/select` option) that leak into a
38
31
  // top-layer element because, for CSS inheritance, it is still a DOM child of its
@@ -48,7 +41,10 @@ var surfaceResetStyles = {
48
41
  root: "_o5724jg8 _1nmz4jg8 _1i4q4jg8 _y3gnv2br _azhwidpf _1p1dglyw"
49
42
  };
50
43
  var styles = {
51
- root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28 _4t3i1wug"
44
+ root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28 _4t3i1wug",
45
+ motion: "_k8m011k7 _1oecdn4k _1s9z1a5r _1o511hrf _bl8aglyw _156y147i",
46
+ enter: "_y44v179n",
47
+ exit: "_y44vof1f"
52
48
  };
53
49
  /**
54
50
  * Roles registered with the open layer observer as `popup`, so `closeLayers()`
@@ -96,12 +92,13 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
96
92
  onOpenChange = _ref.onOpenChange,
97
93
  onEnterFinish = _ref.onEnterFinish,
98
94
  onExitFinish = _ref.onExitFinish,
99
- _ref$animate = _ref.animate,
100
- animate = _ref$animate === void 0 ? false : _ref$animate,
95
+ _ref$shouldAnimate = _ref.shouldAnimate,
96
+ shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
101
97
  placement = _ref.placement,
102
98
  testId = _ref.testId,
103
99
  isOpen = _ref.isOpen,
104
- consumerXcss = _ref.xcss,
100
+ enteringAnimationXcss = _ref.enteringAnimationXcss,
101
+ exitingAnimationXcss = _ref.exitingAnimationXcss,
105
102
  role = _ref.role,
106
103
  label = _ref.label,
107
104
  labelledBy = _ref.labelledBy,
@@ -114,13 +111,12 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
114
111
  var _useAnimatedVisibilit = useAnimatedVisibility({
115
112
  isOpen: isOpen,
116
113
  animationKind: 'popover',
117
- animate: animate,
114
+ shouldAnimate: shouldAnimate,
118
115
  elementRef: ownRef,
119
116
  onEnterFinish: onEnterFinish,
120
117
  onExitFinish: onExitFinish
121
118
  }),
122
- phase = _useAnimatedVisibilit.phase,
123
- preset = _useAnimatedVisibilit.preset;
119
+ phase = _useAnimatedVisibilit.phase;
124
120
 
125
121
  // True while the host element is mounted (any phase except `closed`).
126
122
  // Used as a dep so listener-rebind effects re-attach after a remount.
@@ -290,7 +286,7 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
290
286
  placement: placement
291
287
  })
292
288
  });
293
- }, [preset, placement, isVisible]);
289
+ }, [placement, isVisible]);
294
290
 
295
291
  // Show/hide based on isOpen. `showPopover`/`hidePopover` are no-ops when
296
292
  // already in the target state. Try/catch guards `InvalidStateError` on
@@ -339,6 +335,7 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
339
335
  "aria-label": label,
340
336
  "aria-labelledby": labelledBy,
341
337
  "data-testid": testId,
342
- className: ax([styles.root, surfaceResetStyles.root, preset && popoverAnimationStyles.root, consumerXcss])
338
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
339
+ className: ax([styles.root, surfaceResetStyles.root, shouldAnimate && phase === 'entering' && styles.enter, shouldAnimate && phase === 'exiting' && styles.exit, shouldAnimate && styles.motion, cx(shouldAnimate && phase === 'entering' && enteringAnimationXcss, shouldAnimate && phase === 'exiting' && exitingAnimationXcss)])
343
340
  }, children);
344
341
  });
@@ -1,6 +1,6 @@
1
- import { type CSSProperties, type ReactNode } from 'react';
2
- import { type CompiledStyles } from '@compiled/react';
3
- import type { TAnimationConfig } from '../internal/use-animated-visibility';
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+ import type { XCSSProp } from '@compiled/react';
3
+ import type { StrictXCSSProp } from '@atlaskit/css';
4
4
  /**
5
5
  * Close reasons produced by the Dialog primitive.
6
6
  *
@@ -23,9 +23,10 @@ type TDialogBaseProps = {
23
23
  /**
24
24
  * Whether the dialog is open.
25
25
  *
26
- * - `true`: calls `showModal()`, entry animation plays via `@starting-style`.
27
- * - `false`: calls `close()`. When an `animate` preset is provided, the exit
28
- * animation plays (via `allow-discrete`) before the dialog becomes logically closed.
26
+ * - `true`: calls `showModal()`. When `shouldAnimate` is `true`, the entry
27
+ * animation plays via `@starting-style`.
28
+ * - `false`: calls `close()`. When `shouldAnimate` is `true`, the exit
29
+ * animation plays via `allow-discrete` before the dialog becomes logically closed.
29
30
  *
30
31
  * **Lifecycle observable to consumers:**
31
32
  *
@@ -48,19 +49,31 @@ type TDialogBaseProps = {
48
49
  reason: TDialogCloseReason;
49
50
  }) => void;
50
51
  /**
51
- * Animation config for entry/exit transitions.
52
+ * Whether the dialog should animate in and out.
52
53
  *
53
- * Pass `true` to use the default dialog animation. Pass a config object to
54
- * customize supported animation settings. Pass `false` or omit to disable.
54
+ * When `true`, default dialog animation styles are applied. Use `enteringAnimationXcss`
55
+ * and `exitingAnimationXcss` to override the animation used for each phase.
55
56
  */
56
- animate?: boolean | TAnimationConfig;
57
+ shouldAnimate?: boolean;
57
58
  /**
58
59
  * Additional Compiled styles applied to the `<dialog>` element.
59
60
  *
60
61
  * Applied after built-in dialog and animation styles so consumers can own
61
62
  * static styling that must live in their package.
62
63
  */
63
- xcss?: CompiledStyles<Record<string, unknown>> | false | null | undefined;
64
+ xcss?: XCSSProp<'margin' | 'height' | 'width' | 'maxWidth' | 'insetBlockStart' | 'insetInlineStart' | 'insetInlineEnd', never>;
65
+ /**
66
+ * Animation styles applied while the dialog is entering.
67
+ *
68
+ * Only applied when `shouldAnimate` is `true`.
69
+ */
70
+ enteringAnimationXcss?: StrictXCSSProp<'animationName' | 'animationDuration' | 'animationTimingFunction' | 'animationDelay', never>;
71
+ /**
72
+ * Animation styles applied while the dialog is exiting.
73
+ *
74
+ * Only applied when `shouldAnimate` is `true`.
75
+ */
76
+ exitingAnimationXcss?: StrictXCSSProp<'animationName' | 'animationDuration' | 'animationTimingFunction' | 'animationDelay', never>;
64
77
  /**
65
78
  * Additional inline styles applied to the `<dialog>` element.
66
79
  *
@@ -1,12 +1,5 @@
1
1
  import { type RefObject } from 'react';
2
2
  type TAnimationKind = 'dialog' | 'popover';
3
- /**
4
- * Animation config for entry/exit transitions.
5
- *
6
- * Currently no configuration is supported via this prop,
7
- * and this is just a placeholder.
8
- */
9
- export type TAnimationConfig = never;
10
3
  type TUseAnimatedVisibilityArgs = {
11
4
  /**
12
5
  * Whether the element is logically open.
@@ -20,7 +13,7 @@ type TUseAnimatedVisibilityArgs = {
20
13
  * Animation config for entry/exit transitions.
21
14
  * Pass `false` or `undefined` to disable animation.
22
15
  */
23
- animate: boolean | TAnimationConfig;
16
+ shouldAnimate: boolean;
24
17
  /**
25
18
  * Ref to the DOM element that plays the entry/exit transitions.
26
19
  * Used to listen for `transitionend`.
@@ -49,11 +42,6 @@ type TUseAnimatedVisibilityResult = {
49
42
  * trapping, listeners that must outlive the exit).
50
43
  */
51
44
  phase: TPhase;
52
- /**
53
- * Resolved animation preset (styles applied via the host element's `css`
54
- * prop), or `null` if animation is disabled.
55
- */
56
- preset: boolean | TAnimationConfig | null;
57
45
  };
58
46
  /**
59
47
  * Visibility lifecycle phase shared between `useAnimatedVisibility`,
@@ -116,5 +104,5 @@ export type TPhase = 'closed' | 'entering' | 'open' | 'exiting';
116
104
  * Every effect dispatches on the single `phase` value instead of a
117
105
  * cross-product of booleans.
118
106
  */
119
- export declare function useAnimatedVisibility({ isOpen, animationKind, animate, elementRef, onEnterFinish, onExitFinish, }: TUseAnimatedVisibilityArgs): TUseAnimatedVisibilityResult;
107
+ export declare function useAnimatedVisibility({ isOpen, animationKind, shouldAnimate, elementRef, onEnterFinish, onExitFinish, }: TUseAnimatedVisibilityArgs): TUseAnimatedVisibilityResult;
120
108
  export {};
@@ -5,5 +5,5 @@
5
5
  * to enumerate every placement (e.g. for a settings dropdown). New code
6
6
  * should use the object-based `TPlacementOptions` directly.
7
7
  */
8
- export declare const LEGACY_PLACEMENTS: readonly ["auto", "auto-start", "auto-end", "top", "top-start", "top-center", "top-end", "bottom", "bottom-start", "bottom-center", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"];
8
+ export declare const LEGACY_PLACEMENTS: readonly ['auto', 'auto-start', 'auto-end', 'top', 'top-start', 'top-center', 'top-end', 'bottom', 'bottom-start', 'bottom-center', 'bottom-end', 'right', 'right-start', 'right-end', 'left', 'left-start', 'left-end'];
9
9
  export type TLegacyPlacement = (typeof LEGACY_PLACEMENTS)[number];
@@ -2,7 +2,6 @@ import { type ReactNode } from 'react';
2
2
  import { type StrictXCSSProp } from '@atlaskit/css';
3
3
  import { type TPlacementOptions } from '../internal/resolve-placement';
4
4
  import { type TAriaRoleRequired, type TRoleRequiringAccessibleName, type TRoleWithImplicitName } from '../internal/role-types';
5
- import type { TAnimationConfig } from '../internal/use-animated-visibility';
6
5
  /**
7
6
  * The reason a popover was closed.
8
7
  *
@@ -33,20 +32,24 @@ export type { TPlacementOptions };
33
32
  type TPopoverBaseProps = {
34
33
  children: ReactNode;
35
34
  /**
36
- * Additional CSS styles applied to the popover root element.
37
- * Use to set `backgroundColor` to match the popup surface colour.
35
+ * Animation styles applied while the popover is entering.
36
+ *
37
+ * Only applied when `shouldAnimate` is `true`.
38
+ */
39
+ enteringAnimationXcss?: StrictXCSSProp<'animationName' | 'animationDuration' | 'animationTimingFunction' | 'animationDelay', never>;
40
+ /**
41
+ * Animation styles applied while the popover is exiting.
42
+ *
43
+ * Only applied when `shouldAnimate` is `true`.
38
44
  */
39
- xcss?: StrictXCSSProp<'animationName', '&:popover-open', {
40
- requiredPseudos: '&:popover-open';
41
- requiredProperties: never;
42
- }>;
45
+ exitingAnimationXcss?: StrictXCSSProp<'animationName' | 'animationDuration' | 'animationTimingFunction' | 'animationDelay', never>;
43
46
  /**
44
- * Animation preset for entry/exit transitions.
47
+ * Whether the popover should animate in and out.
45
48
  *
46
- * Animations use `@starting-style` and `allow-discrete` for progressive
47
- * enhancement: browsers without support show/hide instantly.
49
+ * When `true`, default popover animation styles are applied. Use `enteringAnimationXcss`
50
+ * and `exitingAnimationXcss` to override the animation used for each phase.
48
51
  */
49
- animate?: boolean | TAnimationConfig;
52
+ shouldAnimate?: boolean;
50
53
  /**
51
54
  * Test ID applied to the popover element.
52
55
  */
@@ -61,9 +64,10 @@ type TPopoverBaseProps = {
61
64
  /**
62
65
  * Whether the popover is open.
63
66
  *
64
- * - **`true`:** show the popover (calls `showPopover()`, entry animation plays via `@starting-style`).
65
- * - **`false`:** hide the popover. When an `animate` preset is provided, the exit
66
- * animation plays (via `allow-discrete`) before the popover becomes logically closed.
67
+ * - **`true`:** show the popover (calls `showPopover()`). When `shouldAnimate`
68
+ * is `true`, the entry animation plays via `@starting-style`.
69
+ * - **`false`:** hide the popover. When `shouldAnimate` is `true`, the exit
70
+ * animation plays via `allow-discrete` before the popover becomes logically closed.
67
71
  * Otherwise hides instantly.
68
72
  *
69
73
  * The consumer does not conditionally render the `Popover` - visibility is driven
@@ -112,9 +116,9 @@ type TPopoverBaseProps = {
112
116
  /**
113
117
  * Placement hint for directional animations (e.g. `slideAndFade`).
114
118
  *
115
- * When `animate` is provided, the preset's `getStyles(placement)` is
116
- * called to set CSS custom properties (like `--ds-popover-tx`, `--ds-popover-ty`)
117
- * that control the slide direction. Has no effect without `animate`.
119
+ * When `shouldAnimate` is `true`, placement is used to set CSS custom
120
+ * properties (like `--ds-popover-tx`, `--ds-popover-ty`) that control the
121
+ * slide direction. Has no effect without `shouldAnimate`.
118
122
  *
119
123
  * This does NOT control positioning. Use `useAnchorPosition` for that.
120
124
  */