@atlaskit/top-layer 1.10.1 → 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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/top-layer
2
2
 
3
+ ## 2.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [`3f6f3bd7da074`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3f6f3bd7da074) -
8
+ Updates the Top Layer animation API:
9
+ - Renames `animate` to `shouldAnimate` and simplifies the type to just `boolean`, removing unused
10
+ config type
11
+ - Custom animation overrides should now be applied via the `enteringAnimationXcss` and
12
+ `exitingAnimationXcss` props.
13
+
3
14
  ## 1.10.1
4
15
 
5
16
  ### 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
- animate={slideAndFade()}
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 `animate` prop.
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 a preset to `Popover`:
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
- const animation = slideAndFade();
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
- Available popover presets:
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 a preset to `Dialog.Content`:
129
+ Pass `shouldAnimate` to enable the default dialog entry and exit animation:
137
130
 
138
131
  ```tsx
139
- import { dialogSlideUpAndFade } from '@atlaskit/top-layer/animations';
140
-
141
- const animation = dialogSlideUpAndFade();
132
+ import { Dialog } from '@atlaskit/top-layer/dialog';
142
133
 
143
- <Dialog.Content animate={animation}>
144
- <Dialog.Surface>...</Dialog.Surface>
145
- </Dialog.Content>;
134
+ <Dialog shouldAnimate isOpen={isOpen} onClose={onClose} label="My dialog">
135
+ Content
136
+ </Dialog>;
146
137
  ```
147
138
 
148
- Available dialog presets:
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
- ._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)}}
@@ -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 styles = {
43
- dialog: "_19itglyw _19pk1wug _2hwx1wug _otyr1wug _18u01wug _1q51ze3t _y4tize3t _85i5ze3t _bozgze3t _p12fglyw _c71lglyw _bfhk1j28 _bl8aglyw _156y147i _10aiglyw _aeld147i"
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
- motion: "_1m5e1op4 _1jhdq7pw _njwk11k7 _yhpqi9qs _1fyf1a5r _vhgsxbuz _1rsueoah _l57nglyw _1sbq147i _19awglyw _1i6z147i"
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$animate = _ref.animate,
75
- animate = _ref$animate === void 0 ? false : _ref$animate,
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
- animate: animate,
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
- className: (0, _runtime.ax)([styles.dialog, surfaceResetStyles.root, shouldHideBackdrop ? backdropStyles.hidden : backdropStyles.root, preset && backdropStyles.motion, preset && dialogAnimationStyles.root, preset && dialogAnimationStyles.motion, consumerXcss])
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
  });
@@ -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
- animate = _ref2.animate,
134
+ shouldAnimate = _ref2.shouldAnimate,
142
135
  elementRef = _ref2.elementRef,
143
136
  onEnterFinish = _ref2.onEnterFinish,
144
137
  onExitFinish = _ref2.onExitFinish;
145
- // Styles are applied via the `css` prop on the host element (see `Popover`
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
- ._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)}}
@@ -10,6 +10,7 @@ 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"));
@@ -34,14 +35,6 @@ var supportsPopoverHint = (0, _once.default)(function () {
34
35
  return element.popover === 'hint';
35
36
  });
36
37
 
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
38
  // Surface reset — neutralises inherited text-layout properties (e.g.
46
39
  // `white-space: nowrap` from an `@atlaskit/select` option) that leak into a
47
40
  // top-layer element because, for CSS inheritance, it is still a DOM child of its
@@ -57,7 +50,10 @@ var surfaceResetStyles = {
57
50
  root: "_o5724jg8 _1nmz4jg8 _1i4q4jg8 _y3gnv2br _azhwidpf _1p1dglyw"
58
51
  };
59
52
  var styles = {
60
- root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28 _4t3i1wug"
53
+ root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28 _4t3i1wug",
54
+ motion: "_k8m011k7 _1oecdn4k _1s9z1a5r _1o511hrf _bl8aglyw _156y147i",
55
+ enter: "_y44v179n",
56
+ exit: "_y44vof1f"
61
57
  };
62
58
  /**
63
59
  * Roles registered with the open layer observer as `popup`, so `closeLayers()`
@@ -105,12 +101,13 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
105
101
  onOpenChange = _ref.onOpenChange,
106
102
  onEnterFinish = _ref.onEnterFinish,
107
103
  onExitFinish = _ref.onExitFinish,
108
- _ref$animate = _ref.animate,
109
- animate = _ref$animate === void 0 ? false : _ref$animate,
104
+ _ref$shouldAnimate = _ref.shouldAnimate,
105
+ shouldAnimate = _ref$shouldAnimate === void 0 ? false : _ref$shouldAnimate,
110
106
  placement = _ref.placement,
111
107
  testId = _ref.testId,
112
108
  isOpen = _ref.isOpen,
113
- consumerXcss = _ref.xcss,
109
+ enteringAnimationXcss = _ref.enteringAnimationXcss,
110
+ exitingAnimationXcss = _ref.exitingAnimationXcss,
114
111
  role = _ref.role,
115
112
  label = _ref.label,
116
113
  labelledBy = _ref.labelledBy,
@@ -123,13 +120,12 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
123
120
  var _useAnimatedVisibilit = (0, _useAnimatedVisibility.useAnimatedVisibility)({
124
121
  isOpen: isOpen,
125
122
  animationKind: 'popover',
126
- animate: animate,
123
+ shouldAnimate: shouldAnimate,
127
124
  elementRef: ownRef,
128
125
  onEnterFinish: onEnterFinish,
129
126
  onExitFinish: onExitFinish
130
127
  }),
131
- phase = _useAnimatedVisibilit.phase,
132
- preset = _useAnimatedVisibilit.preset;
128
+ phase = _useAnimatedVisibilit.phase;
133
129
 
134
130
  // True while the host element is mounted (any phase except `closed`).
135
131
  // Used as a dep so listener-rebind effects re-attach after a remount.
@@ -299,7 +295,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
299
295
  placement: placement
300
296
  })
301
297
  });
302
- }, [preset, placement, isVisible]);
298
+ }, [placement, isVisible]);
303
299
 
304
300
  // Show/hide based on isOpen. `showPopover`/`hidePopover` are no-ops when
305
301
  // already in the target state. Try/catch guards `InvalidStateError` on
@@ -348,6 +344,7 @@ var Popover = exports.Popover = /*#__PURE__*/(0, _react.forwardRef)(function Pop
348
344
  "aria-label": label,
349
345
  "aria-labelledby": labelledBy,
350
346
  "data-testid": testId,
351
- className: (0, _runtime.ax)([styles.root, surfaceResetStyles.root, preset && popoverAnimationStyles.root, consumerXcss])
347
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
348
+ 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
349
  }, children);
353
350
  });
@@ -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,6 +2,7 @@
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';
@@ -9,15 +10,6 @@ import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-l
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
- const 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 @@ const dialogAnimationStyles = {
30
22
  const surfaceResetStyles = {
31
23
  root: "_o5724jg8 _1nmz4jg8 _1i4q4jg8 _y3gnv2br _azhwidpf _1p1dglyw"
32
24
  };
33
- const styles = {
34
- dialog: "_19itglyw _19pk1wug _2hwx1wug _otyr1wug _18u01wug _1q51ze3t _y4tize3t _85i5ze3t _bozgze3t _p12fglyw _c71lglyw _bfhk1j28 _bl8aglyw _156y147i _10aiglyw _aeld147i"
25
+ const 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
  const 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,8 +58,10 @@ export const Dialog = /*#__PURE__*/forwardRef(function Dialog({
62
58
  onClose,
63
59
  onEnterFinish,
64
60
  onExitFinish,
65
- animate = false,
61
+ shouldAnimate = false,
66
62
  xcss: consumerXcss,
63
+ enteringAnimationXcss,
64
+ exitingAnimationXcss,
67
65
  style,
68
66
  testId,
69
67
  id: providedId,
@@ -76,12 +74,11 @@ export const Dialog = /*#__PURE__*/forwardRef(function Dialog({
76
74
  const ownRef = useRef(null);
77
75
  const combinedRef = mergeRefs([ownRef, ref]);
78
76
  const {
79
- phase,
80
- preset
77
+ phase
81
78
  } = useAnimatedVisibility({
82
79
  isOpen,
83
80
  animationKind: 'dialog',
84
- animate,
81
+ shouldAnimate,
85
82
  elementRef: ownRef,
86
83
  onEnterFinish,
87
84
  onExitFinish
@@ -191,6 +188,7 @@ export const Dialog = /*#__PURE__*/forwardRef(function Dialog({
191
188
  if (!isVisible) {
192
189
  return null;
193
190
  }
191
+ const shouldAnimateBackdrop = !shouldHideBackdrop && shouldAnimate;
194
192
  return /*#__PURE__*/React.createElement("dialog", {
195
193
  ref: combinedRef,
196
194
  id: dialogId
@@ -204,7 +202,11 @@ export const Dialog = /*#__PURE__*/forwardRef(function Dialog({
204
202
  "aria-labelledby": label ? undefined : labelledBy,
205
203
  style: style,
206
204
  onCancel: handleCancel,
207
- "data-testid": testId,
208
- className: ax([styles.dialog, surfaceResetStyles.root, shouldHideBackdrop ? backdropStyles.hidden : backdropStyles.root, preset && backdropStyles.motion, preset && dialogAnimationStyles.root, preset && dialogAnimationStyles.motion, consumerXcss])
205
+ "data-testid": testId
206
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/ui-styling-standard/local-cx-xcss, @compiled/local-cx-xcss
207
+ ,
208
+ className: ax([
209
+ // Dialog styles
210
+ 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)])
209
211
  }, children);
210
212
  });
@@ -60,13 +60,6 @@ function runOnTransitionEndOrTimeout({
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,18 +124,12 @@ function runOnTransitionEndOrTimeout({
131
124
  export function useAnimatedVisibility({
132
125
  isOpen,
133
126
  animationKind,
134
- animate,
127
+ shouldAnimate,
135
128
  elementRef,
136
129
  onEnterFinish,
137
130
  onExitFinish
138
131
  }) {
139
- // Styles are applied via the `css` prop on the host element (see `Popover`
140
- // and `Dialog`), so there is no longer any CSS injection step. Normalize a
141
- // falsy `animate` to `null`.
142
- const preset = animate || null;
143
-
144
- // False when there is no preset or `prefers-reduced-motion` is set.
145
- const willAnimate = Boolean(animate) && !prefersReducedMotion();
132
+ const willAnimate = shouldAnimate && !prefersReducedMotion();
146
133
 
147
134
  // Promote `closed → entering`/`closed → open` synchronously during
148
135
  // render so the host element mounts in the same commit as the open
@@ -302,7 +289,6 @@ export function useAnimatedVisibility({
302
289
  }
303
290
  }, [phase, willAnimate]);
304
291
  return {
305
- phase,
306
- preset
292
+ phase
307
293
  };
308
294
  }
@@ -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,6 +2,7 @@
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';
@@ -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,6 +2,7 @@
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';
@@ -9,15 +10,6 @@ import { useNotifyOpenLayerObserver } from '@atlaskit/layering/use-notify-open-l
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,6 +2,7 @@
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';
@@ -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
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/top-layer",
3
- "version": "1.10.1",
3
+ "version": "2.0.0",
4
4
  "description": "Low-level layering primitives based on popover and dialog",
5
5
  "homepage": "https://atlassian.design/components/top-layer",
6
6
  "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/ds-lib": "^8.0.0",
41
41
  "@atlaskit/layering": "^5.0.0",
42
42
  "@atlaskit/react-compiler-gating": "^0.2.0",
43
- "@atlaskit/tokens": "^16.2.0",
43
+ "@atlaskit/tokens": "^16.3.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@compiled/react": "^1.0.0",
46
46
  "bind-event-listener": "^3.0.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/button": "^24.3.0",
57
57
  "@atlaskit/heading": "^6.2.0",
58
58
  "@atlaskit/lozenge": "^14.1.0",
59
- "@atlaskit/primitives": "^22.1.0",
59
+ "@atlaskit/primitives": "^22.2.0",
60
60
  "@atlaskit/ssr": "workspace:^",
61
61
  "@atlaskit/textfield": "^9.1.0",
62
62
  "@atlassian/ssr-tests": "workspace:^",