@atlaskit/top-layer 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/compass.yml +10 -1
  3. package/dist/cjs/dialog/dialog-content.compiled.css +0 -10
  4. package/dist/cjs/dialog/dialog-content.js +5 -28
  5. package/dist/cjs/entry-points/animations.js +1 -49
  6. package/dist/cjs/internal/use-animated-visibility.js +14 -17
  7. package/dist/cjs/popover/animations.js +1 -147
  8. package/dist/cjs/popover/popover.compiled.css +0 -10
  9. package/dist/cjs/popover/popover.js +8 -11
  10. package/dist/cjs/testing/polyfill.js +3 -0
  11. package/dist/es2019/dialog/dialog-content.compiled.css +0 -10
  12. package/dist/es2019/dialog/dialog-content.js +4 -28
  13. package/dist/es2019/entry-points/animations.js +0 -2
  14. package/dist/es2019/internal/use-animated-visibility.js +14 -18
  15. package/dist/es2019/popover/animations.js +1 -145
  16. package/dist/es2019/popover/popover.compiled.css +0 -10
  17. package/dist/es2019/popover/popover.js +7 -11
  18. package/dist/es2019/testing/polyfill.js +3 -0
  19. package/dist/esm/dialog/dialog-content.compiled.css +0 -10
  20. package/dist/esm/dialog/dialog-content.js +5 -28
  21. package/dist/esm/entry-points/animations.js +0 -2
  22. package/dist/esm/internal/use-animated-visibility.js +14 -18
  23. package/dist/esm/popover/animations.js +1 -144
  24. package/dist/esm/popover/popover.compiled.css +0 -10
  25. package/dist/esm/popover/popover.js +8 -11
  26. package/dist/esm/testing/polyfill.js +3 -0
  27. package/dist/types/dialog/types.d.ts +5 -5
  28. package/dist/types/entry-points/animations.d.ts +0 -2
  29. package/dist/types/internal/use-animated-visibility.d.ts +15 -33
  30. package/dist/types/popover/animations.d.ts +7 -52
  31. package/dist/types/popover/types.d.ts +6 -3
  32. package/package.json +4 -4
  33. package/dist/cjs/dialog/animations.js +0 -90
  34. package/dist/es2019/dialog/animations.js +0 -80
  35. package/dist/esm/dialog/animations.js +0 -82
  36. package/dist/types/dialog/animations.d.ts +0 -57
@@ -1,5 +1,5 @@
1
1
  import { getPlacement } from '../internal/resolve-placement';
2
- function getPopupMotionStyles(_ref) {
2
+ export function getPopupMotionStyles(_ref) {
3
3
  var placement = _ref.placement;
4
4
  var _getPlacement = getPlacement({
5
5
  placement: placement
@@ -41,147 +41,4 @@ function getPopupMotionStyles(_ref) {
41
41
  property: '--ds-popover-motion-exit',
42
42
  value: "var(--ds-popup-exit-bottom, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutBottom8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
43
43
  }];
44
- }
45
-
46
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
47
- export function popupMotion() {
48
- return {
49
- kind: 'popover',
50
- name: 'motion',
51
- getStyles: getPopupMotionStyles
52
- };
53
- }
54
- function getSlideAndFadeStyles(_ref2) {
55
- var placement = _ref2.placement,
56
- distance = _ref2.distance;
57
- var pos = "".concat(distance, "px");
58
- var neg = "-".concat(distance, "px");
59
- var _getPlacement2 = getPlacement({
60
- placement: placement
61
- }),
62
- axis = _getPlacement2.axis,
63
- edge = _getPlacement2.edge;
64
- if (axis === 'block' && edge === 'start') {
65
- return [{
66
- property: '--ds-popover-tx',
67
- value: '0'
68
- }, {
69
- property: '--ds-popover-ty',
70
- value: pos
71
- }];
72
- }
73
- if (axis === 'block' && edge === 'end') {
74
- return [{
75
- property: '--ds-popover-tx',
76
- value: '0'
77
- }, {
78
- property: '--ds-popover-ty',
79
- value: neg
80
- }];
81
- }
82
- if (axis === 'inline' && edge === 'start') {
83
- return [{
84
- property: '--ds-popover-tx',
85
- value: pos
86
- }, {
87
- property: '--ds-popover-ty',
88
- value: '0'
89
- }];
90
- }
91
- if (axis === 'inline' && edge === 'end') {
92
- return [{
93
- property: '--ds-popover-tx',
94
- value: neg
95
- }, {
96
- property: '--ds-popover-ty',
97
- value: '0'
98
- }];
99
- }
100
- return [{
101
- property: '--ds-popover-tx',
102
- value: '0'
103
- }, {
104
- property: '--ds-popover-ty',
105
- value: neg
106
- }];
107
- }
108
-
109
- /**
110
- * Directional slide + opacity animation.
111
- *
112
- * The popover slides in from the direction opposite its placement edge
113
- * (e.g. a `block-end` popover slides down from above).
114
- *
115
- * @param options.distance - Slide distance in pixels. Defaults to `4`.
116
- *
117
- * @example
118
- * ```tsx
119
- * import { slideAndFade } from '@atlaskit/top-layer/animations';
120
- *
121
- * // Default 4px slide (tooltip)
122
- * <Popover animate={slideAndFade()} />
123
- *
124
- * // Custom 8px slide (popup / dropdown)
125
- * <Popover animate={slideAndFade({ distance: 8 })} />
126
- * ```
127
- */
128
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
129
- export function slideAndFade(options) {
130
- var _options$distance;
131
- var distance = (_options$distance = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance !== void 0 ? _options$distance : 4;
132
- return {
133
- kind: 'popover',
134
- name: 'slide-and-fade',
135
- getStyles: function getStyles(_ref3) {
136
- var placement = _ref3.placement;
137
- return getSlideAndFadeStyles({
138
- placement: placement,
139
- distance: distance
140
- });
141
- }
142
- };
143
- }
144
-
145
- // fade
146
-
147
- /**
148
- * Simple opacity transition, no transform.
149
- *
150
- * Suitable for popup dialogs or content that does not need directional motion.
151
- *
152
- * @example
153
- * ```tsx
154
- * import { fade } from '@atlaskit/top-layer/animations';
155
- *
156
- * <Popover animate={fade()} />
157
- * ```
158
- */
159
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
160
- export function fade() {
161
- return {
162
- kind: 'popover',
163
- name: 'fade'
164
- };
165
- }
166
-
167
- // scaleAndFade
168
-
169
- /**
170
- * Scale from 0.95 + opacity transition.
171
- *
172
- * Suitable for menus, dropdowns, and select options.
173
- *
174
- * @example
175
- * ```tsx
176
- * import { scaleAndFade } from '@atlaskit/top-layer/animations';
177
- *
178
- * <Popover animate={scaleAndFade()} />
179
- * ```
180
- */
181
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
182
- export function scaleAndFade() {
183
- return {
184
- kind: 'popover',
185
- name: 'scale-and-fade'
186
- };
187
44
  }
@@ -7,7 +7,6 @@
7
7
  ._18u0idpf{margin-left:0}
8
8
  ._19bvidpf{padding-left:0}
9
9
  ._19pkidpf{margin-top:0}
10
- ._1a5xt94y{--dir:1px}
11
10
  ._1o51q7pw{animation-fill-mode:forwards}
12
11
  ._1oecdn4k{transition-duration:var(--ds-duration-xshort,.1s)}
13
12
  ._1pgl1lbj{animation-timing-function:var(--ds-easing-in-practical,cubic-bezier(.6,0,.8,.6))}
@@ -16,21 +15,12 @@
16
15
  ._1s9z1a5r{transition-behavior:allow-discrete}
17
16
  ._2hwxidpf{margin-right:0}
18
17
  ._5sagdn4k{animation-duration:var(--ds-duration-xshort,.1s)}
19
- ._71re1bym:popover-open{animation-name:var(--ds-keyframe-fade-in,FadeIn0to100)}
20
- ._71re1v6b:popover-open{animation-name:var(--ds-keyframe-fade-in,FadeIn0to100),var(--ds-keyframe-scale-in-small,ScaleIn95to100)}
21
- ._71rervlo:popover-open{animation-name:k1ut9kob,var(--ds-keyframe-fade-in,FadeIn0to100)}
22
18
  ._bfhk1j28{background-color:transparent}
23
19
  ._ca0qidpf{padding-top:0}
24
- ._j7hq1a5s{animation-name:var(--ds-keyframe-fade-out,FadeOut100to0)}
25
- ._j7hq1l2h{animation-name:k1e4c1ew,var(--ds-keyframe-fade-out,FadeOut100to0)}
26
- ._j7hqneez{animation-name:var(--ds-keyframe-fade-out,FadeOut100to0),var(--ds-keyframe-scale-out-small,ScaleOut100to95)}
27
20
  ._k8m011k7{transition-property:overlay,display}
28
21
  ._n3tdidpf{padding-bottom:0}
29
22
  ._n70peoah:popover-open{animation-fill-mode:backwards}
30
23
  ._o8i7indk:popover-open{animation-timing-function:var(--ds-easing-out-practical,cubic-bezier(.4,1,.6,1))}
31
24
  ._otyridpf{margin-bottom:0}
32
25
  ._u5f3idpf{padding-right:0}
33
- [dir=rtl] ._34bx1n1a{--dir:-1px}
34
- @keyframes k1e4c1ew{0%{transform:none}to{transform:translate(calc(var(--dir)*var(--ds-popover-tx, 0)),var(--ds-popover-ty,0))}}
35
- @keyframes k1ut9kob{0%{transform:translate(calc(var(--dir)*var(--ds-popover-tx, 0)),var(--ds-popover-ty,0))}to{transform:none}}
36
26
  @media (prefers-reduced-motion:reduce){._bl8aglyw{animation-name:none}._156yru3m{transition-duration:0s}._8rmvglyw:popover-open{animation-name:none}._2qm2ru3m:popover-open{transition-duration:0s}}
@@ -11,6 +11,7 @@ import { setStyle } from '../internal/set-style';
11
11
  import { useAnimatedVisibility } from '../internal/use-animated-visibility';
12
12
  import { useFocusWrap } from '../internal/use-focus-wrap';
13
13
  import { useInitialFocus } from '../internal/use-initial-focus';
14
+ import { getPopupMotionStyles } from './animations';
14
15
  /**
15
16
  * Detects `popover="hint"` support via DOM reflection. SSR-safe, cached.
16
17
  */
@@ -23,19 +24,13 @@ var supportsPopoverHint = once(function () {
23
24
  element.setAttribute('popover', 'hint');
24
25
  return element.popover === 'hint';
25
26
  });
26
- var slideInKeyframes = null;
27
- var slideOutKeyframes = null;
28
27
 
29
28
  // These animation styles use the non-strict Compiled cssMap because they rely
30
29
  // on `@starting-style`, `:popover-open`, `[dir='rtl']`, and `allow-discrete`.
31
30
  // Keep them in this component so the Compiled transform can statically extract
32
31
  // every referenced style.
33
32
  var popoverAnimationStyles = {
34
- root: "_k8m011k7 _1oecdn4k _1s9z1a5r _1a5xt94y _12t71ign _34bx1n1a _bl8aglyw _156yru3m _8rmvglyw _2qm2ru3m",
35
- motion: "_y44vof1f _1o51q7pw _15ns179n _n70peoah",
36
- 'slide-and-fade': "_j7hq1l2h _5sagdn4k _1pgl1lbj _71rervlo _1psg1ign _o8i7indk",
37
- fade: "_j7hq1a5s _5sagdn4k _1pgl1lbj _71re1bym _1psg1ign _o8i7indk",
38
- 'scale-and-fade': "_j7hqneez _5sagdn4k _1pgl1lbj _71re1v6b _1psg1ign _o8i7indk"
33
+ root: "_y44vof1f _k8m011k7 _1oecdn4k _1s9z1a5r _1o51q7pw _5sagdn4k _1pgl1lbj _15ns179n _12t71ign _n70peoah _1psg1ign _o8i7indk _bl8aglyw _156yru3m _8rmvglyw _2qm2ru3m"
39
34
  };
40
35
  var styles = {
41
36
  root: "_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _19pkidpf _2hwxidpf _otyridpf _18u0idpf _1r041wug _1reoewfl _18m9ewfl _bfhk1j28"
@@ -86,7 +81,8 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
86
81
  onOpenChange = _ref.onOpenChange,
87
82
  onEnterFinish = _ref.onEnterFinish,
88
83
  onExitFinish = _ref.onExitFinish,
89
- animate = _ref.animate,
84
+ _ref$animate = _ref.animate,
85
+ animate = _ref$animate === void 0 ? false : _ref$animate,
90
86
  placement = _ref.placement,
91
87
  testId = _ref.testId,
92
88
  isOpen = _ref.isOpen,
@@ -102,6 +98,7 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
102
98
  var popoverId = idProp !== null && idProp !== void 0 ? idProp : "popover-".concat(autoId.replace(/:/g, ''));
103
99
  var _useAnimatedVisibilit = useAnimatedVisibility({
104
100
  isOpen: isOpen,
101
+ animationKind: 'popover',
105
102
  animate: animate,
106
103
  elementRef: ownRef,
107
104
  onEnterFinish: onEnterFinish,
@@ -269,12 +266,12 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
269
266
  // stale custom properties on the element.
270
267
  useLayoutEffect(function () {
271
268
  var element = ownRef.current;
272
- if (!element || !(preset !== null && preset !== void 0 && preset.getStyles) || !placement) {
269
+ if (!element || !placement) {
273
270
  return;
274
271
  }
275
272
  return setStyle({
276
273
  element: element,
277
- styles: preset.getStyles({
274
+ styles: getPopupMotionStyles({
278
275
  placement: placement
279
276
  })
280
277
  });
@@ -327,6 +324,6 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
327
324
  "aria-label": label,
328
325
  "aria-labelledby": labelledBy,
329
326
  "data-testid": testId,
330
- className: ax([styles.root, preset && popoverAnimationStyles.root, preset && popoverAnimationStyles[preset.name], consumerXcss])
327
+ className: ax([styles.root, preset && popoverAnimationStyles.root, consumerXcss])
331
328
  }, children);
332
329
  });
@@ -524,6 +524,9 @@ if (typeof HTMLElement !== 'undefined') {
524
524
  // delegate every other selector to the original implementation.
525
525
  // Spec: https://html.spec.whatwg.org/multipage/semantics-other.html#selector-popover-open
526
526
  var originalMatches = Element.prototype.matches;
527
+ // The DOM lib types `Element.prototype.matches` as a set of type-predicate
528
+ // overloads. This polyfill intentionally replaces it with a plain boolean
529
+ // implementation, so we cast to the original member type.
527
530
  Element.prototype.matches = function patchedMatches(selector) {
528
531
  if (selector === ':popover-open') {
529
532
  return this.hasAttribute('data-popover-open');
@@ -1,6 +1,6 @@
1
1
  import { type CSSProperties, type ReactNode } from 'react';
2
2
  import { type CompiledStyles } from '@compiled/react';
3
- import type { TDialogAnimationPreset } from './animations';
3
+ import type { TAnimationConfig } from '../internal/use-animated-visibility';
4
4
  /**
5
5
  * Close reasons produced by the Dialog primitive.
6
6
  *
@@ -48,12 +48,12 @@ type TDialogBaseProps = {
48
48
  reason: TDialogCloseReason;
49
49
  }) => void;
50
50
  /**
51
- * Animation preset for entry/exit transitions.
51
+ * Animation config for entry/exit transitions.
52
52
  *
53
- * Pass a `TAnimationPreset` (e.g. `dialogSlideUpAndFade()`) to enable
54
- * CSS-based entry and exit animation. Pass `false` (or omit) to disable.
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.
55
55
  */
56
- animate?: TDialogAnimationPreset | false;
56
+ animate?: boolean | TAnimationConfig;
57
57
  /**
58
58
  * Additional Compiled styles applied to the `<dialog>` element.
59
59
  *
@@ -1,2 +0,0 @@
1
- export { dialogMotion, dialogSlideUpAndFade, dialogFade, type TDialogAnimationPreset, } from '../dialog/animations';
2
- export { popupMotion, slideAndFade, fade, scaleAndFade, type TPopoverAnimationPreset, } from '../popover/animations';
@@ -1,44 +1,26 @@
1
1
  import { type RefObject } from 'react';
2
- import type { TPlacementOptions } from './resolve-placement';
3
- type TAnimationPresetKind = 'dialog' | 'popover';
2
+ type TAnimationKind = 'dialog' | 'popover';
4
3
  /**
5
- * A self-contained animation preset for top-layer elements.
4
+ * Animation config for entry/exit transitions.
6
5
  *
7
- * Contains a stable preset name used by the host component to select its
8
- * component-local Compiled style entry, plus optional per-placement inline
9
- * styles.
10
- *
11
- * The actual Compiled styles are kept static and component-local so the
12
- * Compiled transform can extract them at build time.
6
+ * Currently no configuration is supported via this prop,
7
+ * and this is just a placeholder.
13
8
  */
14
- export type TAnimationPreset<Kind extends TAnimationPresetKind, Name = string> = {
15
- kind: Kind;
16
- /**
17
- * Stable preset name used to select a component-local Compiled style entry.
18
- */
19
- name: Name;
20
- /**
21
- * Per-placement inline styles (e.g. directional offset custom properties for
22
- * `slideAndFade`). Only used by presets that vary by placement or by a
23
- * configurable distance.
24
- */
25
- getStyles?: (args: {
26
- placement: TPlacementOptions;
27
- }) => Array<{
28
- property: string;
29
- value: string;
30
- }>;
31
- };
32
- type TUseAnimatedVisibilityArgs<Kind extends TAnimationPresetKind, Name> = {
9
+ export type TAnimationConfig = never;
10
+ type TUseAnimatedVisibilityArgs = {
33
11
  /**
34
12
  * Whether the element is logically open.
35
13
  */
36
14
  isOpen: boolean;
37
15
  /**
38
- * Animation preset for entry/exit transitions.
16
+ * Animation kind used to select default safety-net timings.
17
+ */
18
+ animationKind: TAnimationKind;
19
+ /**
20
+ * Animation config for entry/exit transitions.
39
21
  * Pass `false` or `undefined` to disable animation.
40
22
  */
41
- animate: TAnimationPreset<Kind, Name> | false | undefined;
23
+ animate: boolean | TAnimationConfig;
42
24
  /**
43
25
  * Ref to the DOM element that plays the entry/exit transitions.
44
26
  * Used to listen for `transitionend`.
@@ -56,7 +38,7 @@ type TUseAnimatedVisibilityArgs<Kind extends TAnimationPresetKind, Name> = {
56
38
  */
57
39
  onExitFinish?: () => void;
58
40
  };
59
- type TUseAnimatedVisibilityResult<Kind extends TAnimationPresetKind, Name> = {
41
+ type TUseAnimatedVisibilityResult = {
60
42
  /**
61
43
  * Current visibility phase. See `TPhase` for the full lifecycle.
62
44
  *
@@ -71,7 +53,7 @@ type TUseAnimatedVisibilityResult<Kind extends TAnimationPresetKind, Name> = {
71
53
  * Resolved animation preset (styles applied via the host element's `css`
72
54
  * prop), or `null` if animation is disabled.
73
55
  */
74
- preset: TAnimationPreset<Kind, Name> | null;
56
+ preset: boolean | TAnimationConfig | null;
75
57
  };
76
58
  /**
77
59
  * Visibility lifecycle phase shared between `useAnimatedVisibility`,
@@ -134,5 +116,5 @@ export type TPhase = 'closed' | 'entering' | 'open' | 'exiting';
134
116
  * Every effect dispatches on the single `phase` value instead of a
135
117
  * cross-product of booleans.
136
118
  */
137
- export declare function useAnimatedVisibility<Kind extends TAnimationPresetKind, Name>({ isOpen, animate, elementRef, onEnterFinish, onExitFinish, }: TUseAnimatedVisibilityArgs<Kind, Name>): TUseAnimatedVisibilityResult<Kind, Name>;
119
+ export declare function useAnimatedVisibility({ isOpen, animationKind, animate, elementRef, onEnterFinish, onExitFinish, }: TUseAnimatedVisibilityArgs): TUseAnimatedVisibilityResult;
138
120
  export {};
@@ -1,52 +1,7 @@
1
- import type { TAnimationPreset } from '../internal/use-animated-visibility';
2
- export type TPopoverAnimationPresetName = 'motion' | 'slide-and-fade' | 'scale-and-fade' | 'fade';
3
- export type TPopoverAnimationPreset = TAnimationPreset<'popover', TPopoverAnimationPresetName>;
4
- export declare function popupMotion(): TPopoverAnimationPreset;
5
- /**
6
- * Directional slide + opacity animation.
7
- *
8
- * The popover slides in from the direction opposite its placement edge
9
- * (e.g. a `block-end` popover slides down from above).
10
- *
11
- * @param options.distance - Slide distance in pixels. Defaults to `4`.
12
- *
13
- * @example
14
- * ```tsx
15
- * import { slideAndFade } from '@atlaskit/top-layer/animations';
16
- *
17
- * // Default 4px slide (tooltip)
18
- * <Popover animate={slideAndFade()} />
19
- *
20
- * // Custom 8px slide (popup / dropdown)
21
- * <Popover animate={slideAndFade({ distance: 8 })} />
22
- * ```
23
- */
24
- export declare function slideAndFade(options?: {
25
- distance?: number;
26
- }): TPopoverAnimationPreset;
27
- /**
28
- * Simple opacity transition, no transform.
29
- *
30
- * Suitable for popup dialogs or content that does not need directional motion.
31
- *
32
- * @example
33
- * ```tsx
34
- * import { fade } from '@atlaskit/top-layer/animations';
35
- *
36
- * <Popover animate={fade()} />
37
- * ```
38
- */
39
- export declare function fade(): TPopoverAnimationPreset;
40
- /**
41
- * Scale from 0.95 + opacity transition.
42
- *
43
- * Suitable for menus, dropdowns, and select options.
44
- *
45
- * @example
46
- * ```tsx
47
- * import { scaleAndFade } from '@atlaskit/top-layer/animations';
48
- *
49
- * <Popover animate={scaleAndFade()} />
50
- * ```
51
- */
52
- export declare function scaleAndFade(): TPopoverAnimationPreset;
1
+ import { type TPlacementOptions } from '../internal/resolve-placement';
2
+ export declare function getPopupMotionStyles({ placement, }: {
3
+ placement: TPlacementOptions;
4
+ }): Array<{
5
+ property: string;
6
+ value: string;
7
+ }>;
@@ -2,7 +2,7 @@ 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 TPopoverAnimationPreset } from './animations';
5
+ import type { TAnimationConfig } from '../internal/use-animated-visibility';
6
6
  /**
7
7
  * The reason a popover was closed.
8
8
  *
@@ -36,14 +36,17 @@ type TPopoverBaseProps = {
36
36
  * Additional CSS styles applied to the popover root element.
37
37
  * Use to set `backgroundColor` to match the popup surface colour.
38
38
  */
39
- xcss?: StrictXCSSProp<'backgroundColor', never>;
39
+ xcss?: StrictXCSSProp<'animationName', '&:popover-open', {
40
+ requiredPseudos: '&:popover-open';
41
+ requiredProperties: never;
42
+ }>;
40
43
  /**
41
44
  * Animation preset for entry/exit transitions.
42
45
  *
43
46
  * Animations use `@starting-style` and `allow-discrete` for progressive
44
47
  * enhancement: browsers without support show/hide instantly.
45
48
  */
46
- animate?: false | TPopoverAnimationPreset;
49
+ animate?: boolean | TAnimationConfig;
47
50
  /**
48
51
  * Test ID applied to the popover element.
49
52
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/top-layer",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
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",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/ds-lib": "^8.0.0",
40
40
  "@atlaskit/layering": "^4.1.0",
41
41
  "@atlaskit/react-compiler-gating": "^0.2.0",
42
- "@atlaskit/tokens": "^15.5.0",
42
+ "@atlaskit/tokens": "^15.7.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@compiled/react": "^0.20.0",
45
45
  "bind-event-listener": "^3.0.0",
@@ -55,11 +55,11 @@
55
55
  "@atlaskit/button": "^24.3.0",
56
56
  "@atlaskit/heading": "^6.2.0",
57
57
  "@atlaskit/lozenge": "^14.1.0",
58
- "@atlaskit/primitives": "^20.5.0",
58
+ "@atlaskit/primitives": "^20.6.0",
59
59
  "@atlaskit/ssr": "workspace:^",
60
60
  "@atlaskit/textfield": "^9.1.0",
61
61
  "@atlassian/ssr-tests": "workspace:^",
62
- "@atlassian/testing-library": "^0.10.0",
62
+ "@atlassian/testing-library": "^0.11.0",
63
63
  "@testing-library/jest-dom": "^6.4.5",
64
64
  "@testing-library/react": "^16.3.0",
65
65
  "@types/raf-schd": "^4.0.1",
@@ -1,90 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.dialogFade = dialogFade;
7
- exports.dialogMotion = dialogMotion;
8
- exports.dialogSlideUpAndFade = dialogSlideUpAndFade;
9
- // `custom` variant currently exists for typing reasons for Drawer
10
- // not indicative of final API
11
-
12
- /**
13
- * Dialog motion animation.
14
- *
15
- * Includes backdrop fade animation.
16
- *
17
- * @example
18
- * ```tsx
19
- * import { dialogMotion } from '@atlaskit/top-layer/animations';
20
- *
21
- * <Dialog animate={dialogMotion()} isOpen={isOpen} onClose={handleClose} label="...">
22
- * ...
23
- * </Dialog>
24
- * ```
25
- */
26
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
27
- function dialogMotion() {
28
- return {
29
- kind: 'dialog',
30
- name: 'motion'
31
- };
32
- }
33
-
34
- /**
35
- * Slide up + opacity animation for dialogs.
36
- *
37
- * Entry slides up from below; exit slides up and out (asymmetric).
38
- * Includes backdrop fade animation.
39
- *
40
- * @param options.distance - Slide distance in pixels. Defaults to `12`.
41
- *
42
- * @example
43
- * ```tsx
44
- * import { dialogSlideUpAndFade } from '@atlaskit/top-layer/animations';
45
- *
46
- * const animation = dialogSlideUpAndFade();
47
- * <Dialog animate={animation} isOpen={isOpen} onClose={handleClose} label="...">
48
- * ...
49
- * </Dialog>
50
- * ```
51
- */
52
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
53
- function dialogSlideUpAndFade(options) {
54
- var _options$distance;
55
- var distance = (_options$distance = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance !== void 0 ? _options$distance : 12;
56
-
57
- // The configurable distance is applied via the `--ds-dialog-ty` custom property
58
- return {
59
- kind: 'dialog',
60
- name: 'slide-up-and-fade',
61
- getStyles: function getStyles() {
62
- return [{
63
- property: '--ds-dialog-ty',
64
- value: "".concat(distance, "px")
65
- }];
66
- }
67
- };
68
- }
69
-
70
- /**
71
- * Simple opacity transition for dialogs, no transform.
72
- *
73
- * Includes backdrop fade animation.
74
- *
75
- * @example
76
- * ```tsx
77
- * import { dialogFade } from '@atlaskit/top-layer/animations';
78
- *
79
- * <Dialog animate={dialogFade()} isOpen={isOpen} onClose={handleClose} label="...">
80
- * ...
81
- * </Dialog>
82
- * ```
83
- */
84
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
85
- function dialogFade() {
86
- return {
87
- kind: 'dialog',
88
- name: 'fade'
89
- };
90
- }
@@ -1,80 +0,0 @@
1
- // `custom` variant currently exists for typing reasons for Drawer
2
- // not indicative of final API
3
-
4
- /**
5
- * Dialog motion animation.
6
- *
7
- * Includes backdrop fade animation.
8
- *
9
- * @example
10
- * ```tsx
11
- * import { dialogMotion } from '@atlaskit/top-layer/animations';
12
- *
13
- * <Dialog animate={dialogMotion()} isOpen={isOpen} onClose={handleClose} label="...">
14
- * ...
15
- * </Dialog>
16
- * ```
17
- */
18
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
19
- export function dialogMotion() {
20
- return {
21
- kind: 'dialog',
22
- name: 'motion'
23
- };
24
- }
25
-
26
- /**
27
- * Slide up + opacity animation for dialogs.
28
- *
29
- * Entry slides up from below; exit slides up and out (asymmetric).
30
- * Includes backdrop fade animation.
31
- *
32
- * @param options.distance - Slide distance in pixels. Defaults to `12`.
33
- *
34
- * @example
35
- * ```tsx
36
- * import { dialogSlideUpAndFade } from '@atlaskit/top-layer/animations';
37
- *
38
- * const animation = dialogSlideUpAndFade();
39
- * <Dialog animate={animation} isOpen={isOpen} onClose={handleClose} label="...">
40
- * ...
41
- * </Dialog>
42
- * ```
43
- */
44
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
45
- export function dialogSlideUpAndFade(options) {
46
- var _options$distance;
47
- const distance = (_options$distance = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance !== void 0 ? _options$distance : 12;
48
-
49
- // The configurable distance is applied via the `--ds-dialog-ty` custom property
50
- return {
51
- kind: 'dialog',
52
- name: 'slide-up-and-fade',
53
- getStyles: () => [{
54
- property: '--ds-dialog-ty',
55
- value: `${distance}px`
56
- }]
57
- };
58
- }
59
-
60
- /**
61
- * Simple opacity transition for dialogs, no transform.
62
- *
63
- * Includes backdrop fade animation.
64
- *
65
- * @example
66
- * ```tsx
67
- * import { dialogFade } from '@atlaskit/top-layer/animations';
68
- *
69
- * <Dialog animate={dialogFade()} isOpen={isOpen} onClose={handleClose} label="...">
70
- * ...
71
- * </Dialog>
72
- * ```
73
- */
74
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
75
- export function dialogFade() {
76
- return {
77
- kind: 'dialog',
78
- name: 'fade'
79
- };
80
- }