@atlaskit/top-layer 0.16.0 → 0.18.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.
Files changed (141) hide show
  1. package/AGENTS.md +113 -0
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +4 -4
  4. package/animations/package.json +1 -8
  5. package/dialog/package.json +1 -8
  6. package/dialog-scroll-lock/package.json +1 -8
  7. package/dist/cjs/animations/presets.js +96 -9
  8. package/dist/cjs/dialog/dialog-content.js +12 -30
  9. package/dist/cjs/entry-points/animations.js +12 -0
  10. package/dist/cjs/internal/set-style.js +5 -5
  11. package/dist/cjs/internal/slot.js +1 -1
  12. package/dist/cjs/internal/use-anchor-position-at-point.js +8 -8
  13. package/dist/cjs/internal/use-anchor-position.js +19 -40
  14. package/dist/cjs/internal/use-animated-visibility.js +31 -61
  15. package/dist/cjs/internal/use-initial-focus.js +9 -13
  16. package/dist/cjs/internal/use-width-from-anchor.js +6 -6
  17. package/dist/cjs/popover/popover.js +30 -58
  18. package/dist/cjs/popover-surface/popover-surface.js +4 -3
  19. package/dist/cjs/testing/polyfill.js +9 -9
  20. package/dist/cjs/use-simple-light-dismiss/index.js +3 -3
  21. package/dist/es2019/animations/presets.js +145 -2
  22. package/dist/es2019/dialog/dialog-content.js +12 -30
  23. package/dist/es2019/entry-points/animations.js +1 -1
  24. package/dist/es2019/internal/set-style.js +5 -5
  25. package/dist/es2019/internal/slot.js +1 -1
  26. package/dist/es2019/internal/use-anchor-position-at-point.js +8 -8
  27. package/dist/es2019/internal/use-anchor-position.js +19 -40
  28. package/dist/es2019/internal/use-animated-visibility.js +31 -61
  29. package/dist/es2019/internal/use-initial-focus.js +9 -13
  30. package/dist/es2019/internal/use-width-from-anchor.js +6 -6
  31. package/dist/es2019/popover/popover.js +30 -58
  32. package/dist/es2019/popover-surface/popover-surface.js +1 -1
  33. package/dist/es2019/testing/polyfill.js +7 -11
  34. package/dist/es2019/use-simple-light-dismiss/index.js +3 -3
  35. package/dist/esm/animations/presets.js +93 -9
  36. package/dist/esm/dialog/dialog-content.js +12 -30
  37. package/dist/esm/entry-points/animations.js +1 -1
  38. package/dist/esm/internal/set-style.js +5 -5
  39. package/dist/esm/internal/slot.js +1 -1
  40. package/dist/esm/internal/use-anchor-position-at-point.js +8 -8
  41. package/dist/esm/internal/use-anchor-position.js +19 -40
  42. package/dist/esm/internal/use-animated-visibility.js +31 -61
  43. package/dist/esm/internal/use-initial-focus.js +9 -13
  44. package/dist/esm/internal/use-width-from-anchor.js +6 -6
  45. package/dist/esm/popover/popover.js +30 -58
  46. package/dist/esm/popover-surface/popover-surface.js +1 -1
  47. package/dist/esm/testing/polyfill.js +9 -9
  48. package/dist/esm/use-simple-light-dismiss/index.js +3 -3
  49. package/dist/types/animations/presets.d.ts +16 -0
  50. package/dist/types/entry-points/animations.d.ts +1 -1
  51. package/dist/types/internal/set-style.d.ts +2 -2
  52. package/dist/types/internal/slot.d.ts +2 -2
  53. package/dist/types/internal/use-anchor-position-at-point.d.ts +2 -2
  54. package/dist/types/internal/use-anchor-position.d.ts +0 -4
  55. package/dist/types/internal/use-initial-focus.d.ts +1 -1
  56. package/dist/types/popover/types.d.ts +5 -7
  57. package/dist/types/popover-surface/popover-surface.d.ts +2 -2
  58. package/focus/package.json +1 -8
  59. package/get-aria-for-trigger/package.json +1 -8
  60. package/open-layer-observer/package.json +1 -8
  61. package/package.json +3 -3
  62. package/placement-map/package.json +1 -8
  63. package/popover/package.json +1 -8
  64. package/popover-surface/package.json +1 -8
  65. package/testing/polyfill/package.json +1 -8
  66. package/testing/to-be-visible/package.json +1 -8
  67. package/use-anchor-position/package.json +1 -8
  68. package/use-anchor-position-at-point/package.json +1 -8
  69. package/use-arrow-navigation/package.json +1 -8
  70. package/use-popover-id/package.json +1 -8
  71. package/use-simple-light-dismiss/package.json +1 -8
  72. package/use-width-from-anchor/package.json +1 -8
  73. package/dist/types-ts4.5/animations/presets.d.ts +0 -94
  74. package/dist/types-ts4.5/animations/types.d.ts +0 -38
  75. package/dist/types-ts4.5/dialog/create-close-event.d.ts +0 -23
  76. package/dist/types-ts4.5/dialog/dialog-content.d.ts +0 -24
  77. package/dist/types-ts4.5/dialog/index.d.ts +0 -3
  78. package/dist/types-ts4.5/dialog/types.d.ts +0 -126
  79. package/dist/types-ts4.5/dialog-scroll-lock/index.d.ts +0 -40
  80. package/dist/types-ts4.5/entry-points/animations.d.ts +0 -2
  81. package/dist/types-ts4.5/entry-points/dialog-scroll-lock.d.ts +0 -1
  82. package/dist/types-ts4.5/entry-points/dialog.d.ts +0 -2
  83. package/dist/types-ts4.5/entry-points/focus.d.ts +0 -4
  84. package/dist/types-ts4.5/entry-points/get-aria-for-trigger.d.ts +0 -1
  85. package/dist/types-ts4.5/entry-points/open-layer-observer.d.ts +0 -5
  86. package/dist/types-ts4.5/entry-points/placement-map.d.ts +0 -3
  87. package/dist/types-ts4.5/entry-points/popover-surface.d.ts +0 -2
  88. package/dist/types-ts4.5/entry-points/popover.d.ts +0 -2
  89. package/dist/types-ts4.5/entry-points/use-anchor-position-at-point.d.ts +0 -1
  90. package/dist/types-ts4.5/entry-points/use-anchor-position.d.ts +0 -1
  91. package/dist/types-ts4.5/entry-points/use-arrow-navigation.d.ts +0 -3
  92. package/dist/types-ts4.5/entry-points/use-popover-id.d.ts +0 -11
  93. package/dist/types-ts4.5/entry-points/use-simple-light-dismiss.d.ts +0 -2
  94. package/dist/types-ts4.5/entry-points/use-width-from-anchor.d.ts +0 -1
  95. package/dist/types-ts4.5/focus/get-first-focusable.d.ts +0 -8
  96. package/dist/types-ts4.5/focus/get-focusables.d.ts +0 -13
  97. package/dist/types-ts4.5/focus/get-last-focusable.d.ts +0 -8
  98. package/dist/types-ts4.5/focus/get-next-focusable.d.ts +0 -13
  99. package/dist/types-ts4.5/focus/is-in-same-layer.d.ts +0 -8
  100. package/dist/types-ts4.5/focus/is-nested-layer-focused.d.ts +0 -8
  101. package/dist/types-ts4.5/focus/selectors.d.ts +0 -4
  102. package/dist/types-ts4.5/focus/types.d.ts +0 -5
  103. package/dist/types-ts4.5/index.d.ts +0 -0
  104. package/dist/types-ts4.5/internal/anchor-positioning-fallback.d.ts +0 -26
  105. package/dist/types-ts4.5/internal/combine.d.ts +0 -14
  106. package/dist/types-ts4.5/internal/ensure-preset-styles.d.ts +0 -6
  107. package/dist/types-ts4.5/internal/get-aria-for-trigger.d.ts +0 -93
  108. package/dist/types-ts4.5/internal/placement-to-position-area.d.ts +0 -21
  109. package/dist/types-ts4.5/internal/placement-to-try-fallbacks.d.ts +0 -36
  110. package/dist/types-ts4.5/internal/reduced-motion.d.ts +0 -14
  111. package/dist/types-ts4.5/internal/resolve-css-length-to-pixels.d.ts +0 -20
  112. package/dist/types-ts4.5/internal/resolve-css-length.d.ts +0 -8
  113. package/dist/types-ts4.5/internal/resolve-placement.d.ts +0 -58
  114. package/dist/types-ts4.5/internal/role-to-aria-has-popup.d.ts +0 -13
  115. package/dist/types-ts4.5/internal/role-types.d.ts +0 -71
  116. package/dist/types-ts4.5/internal/set-style.d.ts +0 -11
  117. package/dist/types-ts4.5/internal/should-focus-into-popover.d.ts +0 -8
  118. package/dist/types-ts4.5/internal/slot.d.ts +0 -29
  119. package/dist/types-ts4.5/internal/use-anchor-position-at-point.d.ts +0 -67
  120. package/dist/types-ts4.5/internal/use-anchor-position.d.ts +0 -91
  121. package/dist/types-ts4.5/internal/use-animated-visibility.d.ts +0 -109
  122. package/dist/types-ts4.5/internal/use-animation-preset.d.ts +0 -11
  123. package/dist/types-ts4.5/internal/use-focus-wrap.d.ts +0 -25
  124. package/dist/types-ts4.5/internal/use-initial-focus.d.ts +0 -73
  125. package/dist/types-ts4.5/internal/use-preset-styles.d.ts +0 -15
  126. package/dist/types-ts4.5/internal/use-width-from-anchor.d.ts +0 -21
  127. package/dist/types-ts4.5/placement-map/index.d.ts +0 -51
  128. package/dist/types-ts4.5/placement-map/legacy-placements.d.ts +0 -27
  129. package/dist/types-ts4.5/placement-map/placement-mapping.d.ts +0 -13
  130. package/dist/types-ts4.5/popover/create-close-event.d.ts +0 -25
  131. package/dist/types-ts4.5/popover/index.d.ts +0 -3
  132. package/dist/types-ts4.5/popover/popover.d.ts +0 -17
  133. package/dist/types-ts4.5/popover/types.d.ts +0 -193
  134. package/dist/types-ts4.5/popover-surface/index.d.ts +0 -2
  135. package/dist/types-ts4.5/popover-surface/popover-surface.d.ts +0 -21
  136. package/dist/types-ts4.5/testing/polyfill.d.ts +0 -25
  137. package/dist/types-ts4.5/testing/to-be-visible.d.ts +0 -23
  138. package/dist/types-ts4.5/use-arrow-navigation/index.d.ts +0 -3
  139. package/dist/types-ts4.5/use-arrow-navigation/is-at-current-menu-level.d.ts +0 -48
  140. package/dist/types-ts4.5/use-arrow-navigation/use-arrow-navigation.d.ts +0 -102
  141. package/dist/types-ts4.5/use-simple-light-dismiss/index.d.ts +0 -45
package/AGENTS.md ADDED
@@ -0,0 +1,113 @@
1
+ ## General
2
+
3
+ In your language in comments, and user facing copy, please avoid em-dashes and contractions (prefer
4
+ "do not" over "don't")
5
+
6
+ ## TypeScript authoring patterns:
7
+
8
+ - Avoid `any`. Always look for opportunities to have more accurate types
9
+ - Avoid `switch` statements, prefer `if` statements in functions with early returns
10
+ - Avoid conditional assignment of variables. (Use functions, IIFE, etc. to avoid needing to use
11
+ `let`)
12
+ - Avoid nested ternaries. Extract to a function with early returns instead.
13
+ - Prefer explicit conversions for types (e.g. `Boolean(value)` and not `!!value` for booleans,
14
+ `Number(value)` for numbers, and `String(value)` for strings. For strings you can also use
15
+ template literals)
16
+ - Never use `for` with missing parameters, e.g. `for(;;)`. Use other clearer patterns (`while(true)`
17
+ in this case)
18
+ - Prefer function definitions `function getName(){}` over function assignment
19
+ `const getName = function(){}`.
20
+ - Do not author `class`. For stateful constructs, use a factory function that closes over its state
21
+ and returns a plain object (e.g. `createClaudeClient({ apiKey })` instead of
22
+ `new ClaudeClient(apiKey)`). Third-party classes you must instantiate (e.g. SDK clients) are fine
23
+ to `new` inside the factory.
24
+ - Prefer inline exports (`export function`, `export const`) over grouped `export { ... }` blocks at
25
+ the bottom of a file. This is also true for default exports (eg
26
+ `default export function hello(){}`)
27
+ - Prefer discriminated unions for result types `{type: 'error', message: string}` over
28
+ `{error: true, message?: string}`
29
+ - Avoid the `void` keyword: do not use `void` as a return type annotation (use explicit return types
30
+ or omit), and do not use the `void` operator (e.g. `void someExpression()`). You can use
31
+ `Promise<void>` though.
32
+ - For functions that might return values, prefer functions that return an explicit `null` over
33
+ `undefined`.
34
+ - For function parameters, prefer named arguments (e.g. a single destructured options object) over
35
+ positional parameters, even for single-parameter functions
36
+ - Avoid regex when a clearer approach exists; use it when it would greatly simplify things.
37
+ - If a module needs a helper function, put it above the caller. Ideally do not rely on hoisting
38
+ - Always use blocks for conditions, do not do inline conditionals like
39
+ `if(condition) doSomething();`
40
+ - Do not use non null assertions (e.g. `value!.condition`). Use `invariant` from `tiny-invariant`
41
+ (if the value should be there), or optional chaining (if it legitimately could be `null`)
42
+ - When adding listeners to raw `EventTarget` objects (outside JSX), use `bind-event-listener`
43
+ - When a function has cleanup actions (unsubscribe, cancel, teardown), return a cleanup function
44
+ (`TCleanupFn` from `@/types`). This mirrors the `useEffect` cleanup pattern
45
+ - Use optional chaining
46
+ - For arrays, prefer array methods (eg `map`, `filter` and `reduce`) over manual looping
47
+ - Start type names with a `T` to make it clear they are types.
48
+ - Avoid abbreviated variable names. Use descriptive names that read clearly (e.g. `transaction` not
49
+ `tx`, `user` not `u`, `config` not `cfg`, `event` not `e`). This applies to all variables
50
+ including lambda/callback parameters. Exceptions: `ctx` for canvas/React contexts, and `a`/`b` in
51
+ sort comparators.
52
+ - For unused parameters or variables, prefix with `_` (e.g. `(_, index) => ...`, or `_unusedName` if
53
+ a descriptive marker reads better). ESLint accepts this via `argsIgnorePattern: '^_'`. Do not
54
+ invent placeholder names like `unused`.
55
+ - When making functions that return booleans, always prefer function names that express a positive.
56
+ `function isValidUser():boolean {}` and not `function isInvalidUser(): boolean {}`
57
+ - Prefer TypeScript `type` over `interface` unless there is functionality that requires an
58
+ `interface`
59
+
60
+ ## In code comments
61
+
62
+ - Place comments on the line directly above the code they describe. Never place comments to the
63
+ right of code on the same line.
64
+ - Code comments should be minimal, clear and accurate
65
+ - Add code comments for anything that is non-obvious by looking at the code
66
+ - Use `// comment` for single-line comments. Use JSDoc-style for multi-line documentation comments
67
+ (markdown is encouraged inside)
68
+ - Do not use decorative separator comments (e.g. `// ── Section ──`, `// ───────...`). Use a plain
69
+ `// Section` comment instead or JSDoc blocks for larger comments:
70
+
71
+ ```ts
72
+ /**
73
+ * **Bold title**
74
+ *
75
+ * Some more content goes here
76
+ */`
77
+ ```
78
+
79
+ ## React rules
80
+
81
+ - Always use named functions for components (eg `export function App() {})`
82
+ - Prefer discriminated unions to model state, rather than having disconnected pieces of state. This
83
+ is the React embodiment of the discriminated unions rule in the TypeScript section above
84
+ - Do not add `className` or `style` props to components as they are unbounded APIs
85
+ - `forwardRef` is needed as this is a `react@18+` project.
86
+
87
+ ```ts
88
+ // Do not do this:
89
+ const [isLoading, setIsLoading] = useState(false);
90
+ const [loaded, setLoaded] = useState(false);
91
+
92
+ // Prefer discriminated unions, which makes illegal states impossible:
93
+ type TState =
94
+ | { type: 'idle' }
95
+ | {
96
+ type: 'loading';
97
+ }
98
+ | {
99
+ type: 'loaded';
100
+ };
101
+ const [state, setState] = useState<TState>({ type: 'idle' });
102
+ ```
103
+
104
+ - Do not export class name strings from files (e.g. no `export const cardClasses = '...'`)
105
+ - Never call a function from a parent context (e.g. a context action, a prop callback) during render
106
+ to update that parent's state. This causes React's "Cannot update a component while rendering a
107
+ different component" error. Use `useEffect` instead. Updating local state during render (the
108
+ getDerivedStateFromProps pattern) is fine.
109
+ - If a react component needs to return a type, it should be `ReactNode` and not a JSX type.
110
+
111
+ ## Versioning
112
+
113
+ This package is still on `0.x` releases. All changes should be a `minor` (`0.x`) release.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/top-layer
2
2
 
3
+ ## 0.18.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b7ed2b39d3ef8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b7ed2b39d3ef8) -
8
+ Internal: align code with package conventions. No functional changes
9
+
10
+ ## 0.17.0
11
+
12
+ ### Minor Changes
13
+
14
+ - [`2fd74328732bf`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2fd74328732bf) -
15
+ Add dialogMotion animation preset with token-based motion values and backdrop animation
16
+
3
17
  ## 0.16.0
4
18
 
5
19
  ### Minor Changes
package/README.md CHANGED
@@ -55,8 +55,8 @@ function MyPopup({ isOpen, onClose }: { isOpen: boolean; onClose: () => void })
55
55
  }
56
56
  ```
57
57
 
58
- - Focus restoration is automatic. The browser handles it for outermost popovers; `Popover`
59
- snapshots `document.activeElement` on open and restores it on close for nested cases.
58
+ - Focus restoration is automatic. The browser handles it for outermost popovers; `Popover` snapshots
59
+ `document.activeElement` on open and restores it on close for nested cases.
60
60
  - For default overlay styling (background, shadow, border-radius), wrap content in `PopoverSurface`
61
61
  from `@atlaskit/top-layer/popover-surface`.
62
62
  - For trigger-less or custom-positioned UI (flag, tooltip, react-select menu portal), use `Popover`
@@ -88,8 +88,8 @@ Compound component for modal dialogs using the native `<dialog>` element with `.
88
88
  ## Animations
89
89
 
90
90
  Both `Popover` and `Dialog` support CSS-based entry/exit animations via the `animate` prop.
91
- Animations use
92
- [`@starting-style`](https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style) for entry and
91
+ Animations use [`@starting-style`](https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style)
92
+ for entry and
93
93
  [`allow-discrete`](https://developer.mozilla.org/en-US/docs/Web/CSS/transition-behavior) on
94
94
  `display`/`overlay` for exit — no JavaScript animation coordination required.
95
95
 
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/animations.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/animations.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/animations.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/dialog.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/dialog.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/dialog.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/dialog-scroll-lock.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/dialog-scroll-lock.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/dialog-scroll-lock.d.ts"
17
10
  }
@@ -4,23 +4,80 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.dialogFade = dialogFade;
7
+ exports.dialogMotion = dialogMotion;
7
8
  exports.dialogSlideUpAndFade = dialogSlideUpAndFade;
8
9
  exports.fade = fade;
10
+ exports.popupMotion = popupMotion;
9
11
  exports.scaleAndFade = scaleAndFade;
10
12
  exports.slideAndFade = slideAndFade;
11
13
  var _resolvePlacement = require("../internal/resolve-placement");
12
- // slideAndFade
14
+ // ══════════════════════════════════════════════════════════════════════════════
15
+ // Popover presets
16
+ // ══════════════════════════════════════════════════════════════════════════════
13
17
 
14
- function getSlideAndFadeProperties(_ref) {
15
- var placement = _ref.placement,
16
- distance = _ref.distance;
17
- var pos = "".concat(distance, "px");
18
- var neg = "-".concat(distance, "px");
18
+ // ── popupMotion ──
19
+
20
+ var POPUP_MOTION_CSS = "\n [data-ds-popover-popup-motion] {\n animation: var(--ds-popover-motion-exit);\n animation-fill-mode: forwards;\n transition:\n overlay 150ms allow-discrete,\n display 150ms allow-discrete;\n }\n\n [data-ds-popover-popup-motion]:popover-open {\n animation: var(--ds-popover-motion-enter);\n animation-fill-mode: backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n [data-ds-popover-popup-motion],\n [data-ds-popover-popup-motion]:popover-open {\n animation: none;\n transition-duration: 0s;\n }\n }\n";
21
+ function getPopupMotionProperties(_ref) {
22
+ var placement = _ref.placement;
19
23
  var _getPlacement = (0, _resolvePlacement.getPlacement)({
20
24
  placement: placement
21
25
  }),
22
26
  axis = _getPlacement.axis,
23
27
  edge = _getPlacement.edge;
28
+ if (axis === 'block' && edge === 'start') {
29
+ return {
30
+ '--ds-popover-motion-enter': "var(--ds-popup-enter-top, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInTop8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)",
31
+ '--ds-popover-motion-exit': "var(--ds-popup-exit-top, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutTop8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
32
+ };
33
+ }
34
+ if (axis === 'inline' && edge === 'start') {
35
+ return {
36
+ '--ds-popover-motion-enter': "var(--ds-popup-enter-left, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInLeft8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)",
37
+ '--ds-popover-motion-exit': "var(--ds-popup-exit-left, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutLeft8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
38
+ };
39
+ }
40
+ if (axis === 'inline' && edge === 'end') {
41
+ return {
42
+ '--ds-popover-motion-enter': "var(--ds-popup-enter-right, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInRight8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)",
43
+ '--ds-popover-motion-exit': "var(--ds-popup-exit-right, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutRight8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
44
+ };
45
+ }
46
+ // Default: block/end (popover below trigger)
47
+ return {
48
+ '--ds-popover-motion-enter': "var(--ds-popup-enter-bottom, 150ms cubic-bezier(0.4, 1, 0.6, 1) SlideInBottom8px, 150ms cubic-bezier(0.4, 1, 0.6, 1) FadeIn0to100)",
49
+ '--ds-popover-motion-exit': "var(--ds-popup-exit-bottom, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) SlideOutBottom8px, 100ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)"
50
+ };
51
+ }
52
+
53
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
54
+ function popupMotion() {
55
+ return {
56
+ name: 'popup-motion',
57
+ css: POPUP_MOTION_CSS,
58
+ enterDurationMs: 150,
59
+ exitDurationMs: 100,
60
+ getProperties: function getProperties(_ref2) {
61
+ var placement = _ref2.placement;
62
+ return getPopupMotionProperties({
63
+ placement: placement
64
+ });
65
+ }
66
+ };
67
+ }
68
+
69
+ // ── slideAndFade ──
70
+
71
+ function getSlideAndFadeProperties(_ref3) {
72
+ var placement = _ref3.placement,
73
+ distance = _ref3.distance;
74
+ var pos = "".concat(distance, "px");
75
+ var neg = "-".concat(distance, "px");
76
+ var _getPlacement2 = (0, _resolvePlacement.getPlacement)({
77
+ placement: placement
78
+ }),
79
+ axis = _getPlacement2.axis,
80
+ edge = _getPlacement2.edge;
24
81
  if (axis === 'block' && edge === 'start') {
25
82
  return {
26
83
  '--ds-popover-tx': '0',
@@ -73,14 +130,15 @@ var SLIDE_AND_FADE_CSS = "\n[data-ds-popover-slide-and-fade] {\n opacity: 0;\n
73
130
  * <Popover animate={slideAndFade({ distance: 8 })} />
74
131
  * ```
75
132
  */
133
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
76
134
  function slideAndFade(options) {
77
135
  var _options$distance;
78
136
  var distance = (_options$distance = options === null || options === void 0 ? void 0 : options.distance) !== null && _options$distance !== void 0 ? _options$distance : 4;
79
137
  return {
80
138
  name: 'slide-and-fade',
81
139
  css: SLIDE_AND_FADE_CSS,
82
- getProperties: function getProperties(_ref2) {
83
- var placement = _ref2.placement;
140
+ getProperties: function getProperties(_ref4) {
141
+ var placement = _ref4.placement;
84
142
  return getSlideAndFadeProperties({
85
143
  placement: placement,
86
144
  distance: distance
@@ -147,7 +205,36 @@ function scaleAndFade() {
147
205
  // Dialog presets
148
206
  // ══════════════════════════════════════════════════════════════════════════════
149
207
 
150
- // dialogSlideUpAndFade
208
+ // ── dialogMotion ──
209
+
210
+ var DIALOG_MOTION_CSS = "\n [data-ds-dialog-motion] {\n animation: ".concat("var(--ds-modal-exit, 200ms cubic-bezier(0.6, 0, 0.8, 0.6) ScaleOut100to95)", ";\n animation-fill-mode: forwards;\n transition:\n overlay 200ms allow-discrete,\n display 200ms allow-discrete;\n }\n\n [data-ds-dialog-motion][open] {\n animation: ", "var(--ds-modal-enter, 250ms cubic-bezier(0.4, 0, 0, 1) ScaleIn95to100)", ";\n animation-fill-mode: backwards;\n }\n\n [data-ds-dialog-motion]::backdrop {\n animation: ", "var(--ds-blanket-exit, 200ms cubic-bezier(0.6, 0, 0.8, 0.6) FadeOut100to0)", ";\n animation-fill-mode: forwards;\n background-color: var(--ds-blanket, #050C1F75);\n transition:\n overlay 200ms allow-discrete,\n display 200ms allow-discrete;\n }\n\n [data-ds-dialog-motion][open]::backdrop {\n animation: ", "var(--ds-blanket-enter, 250ms cubic-bezier(0.4, 0, 0, 1) FadeIn0to100)", ";\n animation-fill-mode: backwards;\n }\n\n @media (prefers-reduced-motion: reduce) {\n [data-ds-dialog-motion],\n [data-ds-dialog-motion][open],\n [data-ds-dialog-motion]::backdrop,\n [data-ds-dialog-motion][open]::backdrop {\n animation: none;\n transition-duration: 0s;\n }\n }\n");
211
+
212
+ /**
213
+ * Dialog motion animation.
214
+ *
215
+ * Includes backdrop fade animation.
216
+ *
217
+ * @example
218
+ * ```tsx
219
+ * import { dialogMotion } from '@atlaskit/top-layer/animations';
220
+ *
221
+ * <Dialog animate={dialogMotion()} isOpen={isOpen} onClose={handleClose} label="...">
222
+ * ...
223
+ * </Dialog>
224
+ * ```
225
+ */
226
+ // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
227
+ function dialogMotion() {
228
+ // Bare preset name; `Dialog` prefixes it via `data-ds-dialog-{name}`.
229
+ return {
230
+ name: 'motion',
231
+ css: DIALOG_MOTION_CSS,
232
+ enterDurationMs: 250,
233
+ exitDurationMs: 200
234
+ };
235
+ }
236
+
237
+ // ── dialogSlideUpAndFade ──
151
238
 
152
239
  var DIALOG_SLIDE_UP_AND_FADE_CSS = "\n[data-ds-dialog-slide-up-and-fade] {\n opacity: 0;\n transform: translateY(calc(-1 * var(--ds-dialog-ty, 12px)));\n transition:\n opacity 175ms cubic-bezier(0.15, 1, 0.3, 1),\n transform 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[data-ds-dialog-slide-up-and-fade][open] {\n opacity: 1;\n transform: none;\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-dialog-slide-up-and-fade][open] {\n opacity: 0;\n transform: translateY(var(--ds-dialog-ty, 12px));\n }\n}\n\n[data-ds-dialog-slide-up-and-fade]::backdrop {\n background-color: transparent;\n transition:\n background-color 175ms cubic-bezier(0.15, 1, 0.3, 1),\n overlay 175ms allow-discrete,\n display 175ms allow-discrete;\n}\n\n[data-ds-dialog-slide-up-and-fade][open]::backdrop {\n background-color: var(--ds-blanket, #050C1F75);\n transition-duration: 350ms;\n}\n\n@starting-style {\n [data-ds-dialog-slide-up-and-fade][open]::backdrop {\n background-color: transparent;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n [data-ds-dialog-slide-up-and-fade],\n [data-ds-dialog-slide-up-and-fade][open],\n [data-ds-dialog-slide-up-and-fade]::backdrop,\n [data-ds-dialog-slide-up-and-fade][open]::backdrop {\n transition-duration: 0s;\n }\n}\n";
153
240
 
@@ -57,8 +57,6 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
57
57
  var dialogId = providedId !== null && providedId !== void 0 ? providedId : generatedId;
58
58
  var ownRef = (0, _react.useRef)(null);
59
59
  var combinedRef = (0, _mergeRefs.default)([ownRef, ref]);
60
-
61
- // Animation lifecycle
62
60
  var _useAnimatedVisibilit = (0, _useAnimatedVisibility.useAnimatedVisibility)({
63
61
  isOpen: isOpen,
64
62
  animate: animate,
@@ -68,31 +66,22 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
68
66
  phase = _useAnimatedVisibilit.phase,
69
67
  preset = _useAnimatedVisibilit.preset;
70
68
 
71
- // Pre-computed phase predicate. `isVisible` means "host element is
72
- // mounted and on screen" (any phase except `closed`), used as a dep
73
- // signal for the backdrop-click rebind effect so it re-attaches to
74
- // the fresh <dialog> element after a close → reopen unmount/remount
75
- // cycle.
69
+ // True while the host element is mounted (any phase except `closed`).
70
+ // Used as a dep so listener-rebind effects re-attach after a remount.
76
71
  var isVisible = phase !== 'closed';
77
72
 
78
- // Focus wrap
79
- // Native <dialog>.showModal() traps focus but wraps through <body> at
80
- // the boundary (A → B → C → body → A). This hook intercepts Tab to
81
- // wrap directly (A → B → C → A), matching the WAI-ARIA APG pattern.
82
- //
83
- // Takes `phase` directly: the listener stays attached while
84
- // `phase !== 'closed'`, i.e. through the animated-exit window.
85
- // Gating on `isOpen` would unbind the listener at the start of an
86
- // exit animation while the dialog is still visible, letting focus
87
- // escape (WCAG 2.4.3 Focus Order regression).
73
+ // Native `<dialog>.showModal()` traps focus but wraps through `<body>` at
74
+ // the boundary (A → B → C → body → A). This hook intercepts Tab to wrap
75
+ // directly (A → B → C → A), matching the WAI-ARIA APG pattern. Passing
76
+ // `phase` keeps the listener attached through the animated-exit window
77
+ // (WCAG 2.4.3 Focus Order regression guard).
88
78
  (0, _useFocusWrap.useFocusWrap)({
89
79
  elementRef: ownRef,
90
80
  role: 'dialog',
91
81
  phase: phase
92
82
  });
93
83
 
94
- // Open layer observer registration
95
- // Notifies the open layer observer so app-coordination features
84
+ // Notify the open layer observer so app-coordination features
96
85
  // (open-count subscriptions) work with top-layer dialogs.
97
86
  (0, _openLayerObserver.useNotifyOpenLayerObserver)({
98
87
  type: 'modal',
@@ -100,8 +89,6 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
100
89
  // No-op: no current use case for programmatic close via OpenLayerObserver.
101
90
  onClose: _noop.default
102
91
  });
103
-
104
- // Show/hide the dialog in response to isOpen changes.
105
92
  (0, _react.useLayoutEffect)(function () {
106
93
  var dialog = ownRef.current;
107
94
  if (!dialog) {
@@ -159,15 +146,10 @@ var Dialog = exports.Dialog = /*#__PURE__*/(0, _react.forwardRef)(function Dialo
159
146
  // any atomic class, so the override always wins.
160
147
  var escapedId = CSS.escape(dialogId);
161
148
 
162
- // The `<dialog>` host element is only rendered while open or its exit
163
- // animation is playing. After exit completes the phase returns to
164
- // `closed` and we unmount the dialog entirely so it does not leave an
165
- // empty `role="dialog"` element in the accessibility tree. The element
166
- // re-mounts on the next `isOpen=true` commit; `showModal()` is called
167
- // from the existing `useLayoutEffect([isOpen])` on that same commit,
168
- // and listeners (cancel, click) re-bind via the `[onClose, isVisible]`
169
- // effect re-running after remount (React clears the ref on unmount, so
170
- // we need the listener effect to re-run with the fresh element).
149
+ // Unmount the `<dialog>` once exit completes so it does not leave an
150
+ // empty `role="dialog"` element in the accessibility tree. On the next
151
+ // open the element remounts and the `[isOpen]` and `[onClose, isVisible]`
152
+ // effects re-run against the fresh element.
171
153
  if (!isVisible) {
172
154
  return null;
173
155
  }
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "dialogFade", {
9
9
  return _presets.dialogFade;
10
10
  }
11
11
  });
12
+ Object.defineProperty(exports, "dialogMotion", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _presets.dialogMotion;
16
+ }
17
+ });
12
18
  Object.defineProperty(exports, "dialogSlideUpAndFade", {
13
19
  enumerable: true,
14
20
  get: function get() {
@@ -21,6 +27,12 @@ Object.defineProperty(exports, "fade", {
21
27
  return _presets.fade;
22
28
  }
23
29
  });
30
+ Object.defineProperty(exports, "popupMotion", {
31
+ enumerable: true,
32
+ get: function get() {
33
+ return _presets.popupMotion;
34
+ }
35
+ });
24
36
  Object.defineProperty(exports, "scaleAndFade", {
25
37
  enumerable: true,
26
38
  get: function get() {
@@ -9,7 +9,7 @@ exports.setStyle = setStyle;
9
9
  * restores the prior inline values (so we do not stomp consumer styles).
10
10
  */
11
11
  function setStyle(_ref) {
12
- var el = _ref.el,
12
+ var element = _ref.element,
13
13
  styles = _ref.styles;
14
14
  // Snapshot the prior inline value (NOT the computed style - we only want
15
15
  // to restore values that the consumer/our previous run inlined). An empty
@@ -18,23 +18,23 @@ function setStyle(_ref) {
18
18
  var property = _ref2.property;
19
19
  return {
20
20
  property: property,
21
- value: el.style.getPropertyValue(property)
21
+ value: element.style.getPropertyValue(property)
22
22
  };
23
23
  });
24
24
  styles.forEach(function (_ref3) {
25
25
  var property = _ref3.property,
26
26
  value = _ref3.value;
27
- el.style.setProperty(property, value);
27
+ element.style.setProperty(property, value);
28
28
  });
29
29
  return function cleanup() {
30
30
  priorValues.forEach(function (_ref4) {
31
31
  var property = _ref4.property,
32
32
  value = _ref4.value;
33
33
  if (value === '') {
34
- el.style.removeProperty(property);
34
+ element.style.removeProperty(property);
35
35
  return;
36
36
  }
37
- el.style.setProperty(property, value);
37
+ element.style.setProperty(property, value);
38
38
  });
39
39
  };
40
40
  }
@@ -52,7 +52,7 @@ function isSlotChild(child) {
52
52
  var Slot = exports.Slot = /*#__PURE__*/(0, _react.forwardRef)(function Slot(slotProps, ref) {
53
53
  var rawChildren = slotProps.children,
54
54
  props = (0, _objectWithoutProperties2.default)(slotProps, _excluded);
55
- // `SlotProps` intersects `Record<string, unknown>`, so `children` is typed as `unknown`.
55
+ // `TSlotProps` intersects `Record<string, unknown>`, so `children` is typed as `unknown`.
56
56
  var children = rawChildren;
57
57
  if (!isSlotChild(children)) {
58
58
  return children;
@@ -11,7 +11,7 @@ var _useAnchorPosition = require("./use-anchor-position");
11
11
  * anchor should be placed.
12
12
  *
13
13
  * Axis-named (`x`/`y`) rather than edge-named (`left`/`top`) so the
14
- * shape is unambiguous in RTL writing modes — there is no ambiguity
14
+ * shape is unambiguous in RTL writing modes - there is no ambiguity
15
15
  * about whether a coordinate is logical (`inline-start`/`block-start`)
16
16
  * or physical (`left`/`top`). Viewport coordinates are always
17
17
  * physical, so we name them with the physical axis labels.
@@ -22,19 +22,19 @@ var _useAnchorPosition = require("./use-anchor-position");
22
22
  * Dynamic `inset-*` overrides are written by the positioning effect.
23
23
  *
24
24
  * Uses `Object.assign` rather than Compiled CSS (element is outside the React tree)
25
- * or the internal `setStyle` helper (we own this element entirely — it is created
26
- * and removed by this hook — so the snapshot/restore semantics `setStyle`
25
+ * or the internal `setStyle` helper (we own this element entirely - it is created
26
+ * and removed by this hook - so the snapshot/restore semantics `setStyle`
27
27
  * provides for caller-owned elements would be dead work here).
28
28
  */
29
- function applyStaticAnchorStyles(el) {
30
- Object.assign(el.style, {
29
+ function applyStaticAnchorStyles(element) {
30
+ Object.assign(element.style, {
31
31
  position: 'fixed',
32
32
  // `top`/`left` rather than `inset-block-start`/`inset-inline-start`
33
33
  // for consistency with the dynamic positioning effect below, which
34
34
  // uses physical properties (see comment there for the rationale).
35
35
  top: '0',
36
36
  left: '0',
37
- // Zero size — placement decides which side the popover sits on.
37
+ // Zero size - placement decides which side the popover sits on.
38
38
  width: '0',
39
39
  height: '0',
40
40
  // Prevent the overlay from intercepting pointer events.
@@ -80,7 +80,7 @@ function useAnchorPositionAtPoint(_ref) {
80
80
  var syntheticAnchorRef = (0, _react.useRef)(null);
81
81
 
82
82
  // `getPoint` is kept in a ref so the layout effect can call the
83
- // latest version without listing it as a dep — that would re-fire
83
+ // latest version without listing it as a dep - that would re-fire
84
84
  // on every render and re-latch the point.
85
85
  var getPointRef = (0, _react.useRef)(getPoint);
86
86
  getPointRef.current = getPoint;
@@ -116,7 +116,7 @@ function useAnchorPositionAtPoint(_ref) {
116
116
  };
117
117
  }, [isEnabled]);
118
118
 
119
- // Mirror `isEnabled` so both hooks stay in sync — when disabled,
119
+ // Mirror `isEnabled` so both hooks stay in sync - when disabled,
120
120
  // neither this hook nor the inner one touches the popover, leaving
121
121
  // any other positioning the consumer has set up free to take effect.
122
122
  (0, _useAnchorPosition.useAnchorPosition)({