@atlaskit/top-layer 0.17.0 → 1.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.
Files changed (132) hide show
  1. package/AGENTS.md +113 -0
  2. package/CHANGELOG.md +33 -0
  3. package/animations/package.json +1 -8
  4. package/dialog/package.json +1 -8
  5. package/dialog-scroll-lock/package.json +1 -8
  6. package/dist/cjs/dialog/dialog-content.js +12 -30
  7. package/dist/cjs/internal/set-style.js +5 -5
  8. package/dist/cjs/internal/slot.js +1 -1
  9. package/dist/cjs/internal/use-anchor-position-at-point.js +8 -8
  10. package/dist/cjs/internal/use-anchor-position.js +19 -40
  11. package/dist/cjs/internal/use-animated-visibility.js +31 -61
  12. package/dist/cjs/internal/use-initial-focus.js +9 -13
  13. package/dist/cjs/internal/use-width-from-anchor.js +6 -6
  14. package/dist/cjs/popover/popover.js +30 -58
  15. package/dist/cjs/popover-surface/popover-surface.js +4 -3
  16. package/dist/cjs/testing/polyfill.js +9 -9
  17. package/dist/cjs/use-simple-light-dismiss/index.js +3 -3
  18. package/dist/es2019/dialog/dialog-content.js +12 -30
  19. package/dist/es2019/internal/set-style.js +5 -5
  20. package/dist/es2019/internal/slot.js +1 -1
  21. package/dist/es2019/internal/use-anchor-position-at-point.js +8 -8
  22. package/dist/es2019/internal/use-anchor-position.js +19 -40
  23. package/dist/es2019/internal/use-animated-visibility.js +31 -61
  24. package/dist/es2019/internal/use-initial-focus.js +9 -13
  25. package/dist/es2019/internal/use-width-from-anchor.js +6 -6
  26. package/dist/es2019/popover/popover.js +30 -58
  27. package/dist/es2019/popover-surface/popover-surface.js +1 -1
  28. package/dist/es2019/testing/polyfill.js +7 -11
  29. package/dist/es2019/use-simple-light-dismiss/index.js +3 -3
  30. package/dist/esm/dialog/dialog-content.js +12 -30
  31. package/dist/esm/internal/set-style.js +5 -5
  32. package/dist/esm/internal/slot.js +1 -1
  33. package/dist/esm/internal/use-anchor-position-at-point.js +8 -8
  34. package/dist/esm/internal/use-anchor-position.js +19 -40
  35. package/dist/esm/internal/use-animated-visibility.js +31 -61
  36. package/dist/esm/internal/use-initial-focus.js +9 -13
  37. package/dist/esm/internal/use-width-from-anchor.js +6 -6
  38. package/dist/esm/popover/popover.js +30 -58
  39. package/dist/esm/popover-surface/popover-surface.js +1 -1
  40. package/dist/esm/testing/polyfill.js +9 -9
  41. package/dist/esm/use-simple-light-dismiss/index.js +3 -3
  42. package/dist/types/internal/set-style.d.ts +2 -2
  43. package/dist/types/internal/slot.d.ts +2 -2
  44. package/dist/types/internal/use-anchor-position-at-point.d.ts +2 -2
  45. package/dist/types/internal/use-anchor-position.d.ts +0 -4
  46. package/dist/types/internal/use-initial-focus.d.ts +1 -1
  47. package/dist/types/popover/types.d.ts +5 -7
  48. package/dist/types/popover-surface/popover-surface.d.ts +2 -2
  49. package/focus/package.json +1 -8
  50. package/get-aria-for-trigger/package.json +1 -8
  51. package/open-layer-observer/package.json +1 -8
  52. package/package.json +11 -19
  53. package/placement-map/package.json +1 -8
  54. package/popover/package.json +1 -8
  55. package/popover-surface/package.json +1 -8
  56. package/testing/polyfill/package.json +1 -8
  57. package/testing/to-be-visible/package.json +1 -8
  58. package/use-anchor-position/package.json +1 -8
  59. package/use-anchor-position-at-point/package.json +1 -8
  60. package/use-arrow-navigation/package.json +1 -8
  61. package/use-popover-id/package.json +1 -8
  62. package/use-simple-light-dismiss/package.json +1 -8
  63. package/use-width-from-anchor/package.json +1 -8
  64. package/dist/types-ts4.5/animations/presets.d.ts +0 -110
  65. package/dist/types-ts4.5/animations/types.d.ts +0 -38
  66. package/dist/types-ts4.5/dialog/create-close-event.d.ts +0 -23
  67. package/dist/types-ts4.5/dialog/dialog-content.d.ts +0 -24
  68. package/dist/types-ts4.5/dialog/index.d.ts +0 -3
  69. package/dist/types-ts4.5/dialog/types.d.ts +0 -126
  70. package/dist/types-ts4.5/dialog-scroll-lock/index.d.ts +0 -40
  71. package/dist/types-ts4.5/entry-points/animations.d.ts +0 -2
  72. package/dist/types-ts4.5/entry-points/dialog-scroll-lock.d.ts +0 -1
  73. package/dist/types-ts4.5/entry-points/dialog.d.ts +0 -2
  74. package/dist/types-ts4.5/entry-points/focus.d.ts +0 -4
  75. package/dist/types-ts4.5/entry-points/get-aria-for-trigger.d.ts +0 -1
  76. package/dist/types-ts4.5/entry-points/open-layer-observer.d.ts +0 -5
  77. package/dist/types-ts4.5/entry-points/placement-map.d.ts +0 -3
  78. package/dist/types-ts4.5/entry-points/popover-surface.d.ts +0 -2
  79. package/dist/types-ts4.5/entry-points/popover.d.ts +0 -2
  80. package/dist/types-ts4.5/entry-points/use-anchor-position-at-point.d.ts +0 -1
  81. package/dist/types-ts4.5/entry-points/use-anchor-position.d.ts +0 -1
  82. package/dist/types-ts4.5/entry-points/use-arrow-navigation.d.ts +0 -3
  83. package/dist/types-ts4.5/entry-points/use-popover-id.d.ts +0 -11
  84. package/dist/types-ts4.5/entry-points/use-simple-light-dismiss.d.ts +0 -2
  85. package/dist/types-ts4.5/entry-points/use-width-from-anchor.d.ts +0 -1
  86. package/dist/types-ts4.5/focus/get-first-focusable.d.ts +0 -8
  87. package/dist/types-ts4.5/focus/get-focusables.d.ts +0 -13
  88. package/dist/types-ts4.5/focus/get-last-focusable.d.ts +0 -8
  89. package/dist/types-ts4.5/focus/get-next-focusable.d.ts +0 -13
  90. package/dist/types-ts4.5/focus/is-in-same-layer.d.ts +0 -8
  91. package/dist/types-ts4.5/focus/is-nested-layer-focused.d.ts +0 -8
  92. package/dist/types-ts4.5/focus/selectors.d.ts +0 -4
  93. package/dist/types-ts4.5/focus/types.d.ts +0 -5
  94. package/dist/types-ts4.5/index.d.ts +0 -0
  95. package/dist/types-ts4.5/internal/anchor-positioning-fallback.d.ts +0 -26
  96. package/dist/types-ts4.5/internal/combine.d.ts +0 -14
  97. package/dist/types-ts4.5/internal/ensure-preset-styles.d.ts +0 -6
  98. package/dist/types-ts4.5/internal/get-aria-for-trigger.d.ts +0 -93
  99. package/dist/types-ts4.5/internal/placement-to-position-area.d.ts +0 -21
  100. package/dist/types-ts4.5/internal/placement-to-try-fallbacks.d.ts +0 -36
  101. package/dist/types-ts4.5/internal/reduced-motion.d.ts +0 -14
  102. package/dist/types-ts4.5/internal/resolve-css-length-to-pixels.d.ts +0 -20
  103. package/dist/types-ts4.5/internal/resolve-css-length.d.ts +0 -8
  104. package/dist/types-ts4.5/internal/resolve-placement.d.ts +0 -58
  105. package/dist/types-ts4.5/internal/role-to-aria-has-popup.d.ts +0 -13
  106. package/dist/types-ts4.5/internal/role-types.d.ts +0 -71
  107. package/dist/types-ts4.5/internal/set-style.d.ts +0 -11
  108. package/dist/types-ts4.5/internal/should-focus-into-popover.d.ts +0 -8
  109. package/dist/types-ts4.5/internal/slot.d.ts +0 -29
  110. package/dist/types-ts4.5/internal/use-anchor-position-at-point.d.ts +0 -67
  111. package/dist/types-ts4.5/internal/use-anchor-position.d.ts +0 -91
  112. package/dist/types-ts4.5/internal/use-animated-visibility.d.ts +0 -109
  113. package/dist/types-ts4.5/internal/use-animation-preset.d.ts +0 -11
  114. package/dist/types-ts4.5/internal/use-focus-wrap.d.ts +0 -25
  115. package/dist/types-ts4.5/internal/use-initial-focus.d.ts +0 -73
  116. package/dist/types-ts4.5/internal/use-preset-styles.d.ts +0 -15
  117. package/dist/types-ts4.5/internal/use-width-from-anchor.d.ts +0 -21
  118. package/dist/types-ts4.5/placement-map/index.d.ts +0 -51
  119. package/dist/types-ts4.5/placement-map/legacy-placements.d.ts +0 -27
  120. package/dist/types-ts4.5/placement-map/placement-mapping.d.ts +0 -13
  121. package/dist/types-ts4.5/popover/create-close-event.d.ts +0 -25
  122. package/dist/types-ts4.5/popover/index.d.ts +0 -3
  123. package/dist/types-ts4.5/popover/popover.d.ts +0 -17
  124. package/dist/types-ts4.5/popover/types.d.ts +0 -193
  125. package/dist/types-ts4.5/popover-surface/index.d.ts +0 -2
  126. package/dist/types-ts4.5/popover-surface/popover-surface.d.ts +0 -21
  127. package/dist/types-ts4.5/testing/polyfill.d.ts +0 -25
  128. package/dist/types-ts4.5/testing/to-be-visible.d.ts +0 -23
  129. package/dist/types-ts4.5/use-arrow-navigation/index.d.ts +0 -3
  130. package/dist/types-ts4.5/use-arrow-navigation/is-at-current-menu-level.d.ts +0 -48
  131. package/dist/types-ts4.5/use-arrow-navigation/use-arrow-navigation.d.ts +0 -102
  132. package/dist/types-ts4.5/use-simple-light-dismiss/index.d.ts +0 -45
@@ -21,9 +21,9 @@ var supportsPopoverHint = once(function () {
21
21
  return false;
22
22
  }
23
23
  // eslint-disable-next-line @atlaskit/platform/no-direct-document-usage -- feature detection
24
- var el = document.createElement('div');
25
- el.setAttribute('popover', 'hint');
26
- return el.popover === 'hint';
24
+ var element = document.createElement('div');
25
+ element.setAttribute('popover', 'hint');
26
+ return element.popover === 'hint';
27
27
  });
28
28
 
29
29
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- popover UA reset requires values not in cssMap's type union
@@ -66,9 +66,7 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
66
66
  var autoId = useId();
67
67
  var ownRef = useRef(null);
68
68
  var combinedRef = mergeRefs([ownRef, ref].filter(Boolean));
69
- // React 18 `useId()` returns IDs with colons (invalid in CSS selectors
70
- // and popover target attributes). Strip them; remove once React 18 is
71
- // dropped (React 19.2 uses underscores).
69
+ // `useId()` colons are invalid in CSS selectors and popover target attributes.
72
70
  var popoverId = idProp !== null && idProp !== void 0 ? idProp : "popover-".concat(autoId.replace(/:/g, ''));
73
71
  var _useAnimatedVisibilit = useAnimatedVisibility({
74
72
  isOpen: isOpen,
@@ -80,21 +78,15 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
80
78
  phase = _useAnimatedVisibilit.phase,
81
79
  preset = _useAnimatedVisibilit.preset;
82
80
 
83
- // Pre-computed phase predicate. `isVisible` mirrors "host element is
84
- // mounted and on screen" (any phase except `closed`); used as a dep
85
- // signal for listener-re-bind effects so they re-attach to the fresh
86
- // host element after a close → reopen unmount/remount cycle.
81
+ // True while the host element is mounted (any phase except `closed`).
82
+ // Used as a dep so listener-rebind effects re-attach after a remount.
87
83
  var isVisible = phase !== 'closed';
88
84
 
89
85
  // Focus management: initial focus on entry (role-dependent), Tab cycling
90
86
  // for dialog roles. Restoration is native for outermost popovers; nested
91
- // focus-capturing roles are handled below via `beforetoggle` snapshot.
92
- // See: notes/architecture/focus-restoration.md
93
- //
94
- // Both hooks take `phase` directly: `useFocusWrap` keeps its listener
95
- // attached while `phase !== 'closed'` (so focus stays trapped through
96
- // the animated-exit window — WCAG 2.4.3 regression guard);
97
- // `useInitialFocus` moves focus on the transition into `'open'`.
87
+ // focus-capturing roles are handled below via the `beforetoggle` snapshot.
88
+ // Passing `phase` keeps `useFocusWrap` attached through the animated-exit
89
+ // window (WCAG 2.4.3 guard). See notes/architecture/focus-restoration.md.
98
90
  useFocusWrap({
99
91
  elementRef: ownRef,
100
92
  role: role,
@@ -191,7 +183,6 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
191
183
 
192
184
  // Browser dismiss (Escape/click-outside).
193
185
  var reason = closeReasonRef.current;
194
- // reset for next dismiss
195
186
  closeReasonRef.current = 'light-dismiss';
196
187
  // Optional: `manual` mode has no `onClose` in the forwarded type.
197
188
  onClose === null || onClose === void 0 || onClose({
@@ -200,21 +191,12 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
200
191
  }
201
192
  }, [onClose, onOpenChange, role]);
202
193
 
203
- // Bind toggle/beforetoggle/keydown listeners via `useLayoutEffect` so
204
- // they are attached BEFORE the show/hide layout effect calls
205
- // `el.showPopover()`. `showPopover()` dispatches `beforetoggle`
206
- // synchronously; binding the listener in a regular `useEffect`
207
- // (which runs after layout effects) misses that first dispatch and
208
- // the `previouslyFocusedElementRef` snapshot never gets taken — which
209
- // breaks nested-popover focus restoration on close.
210
- //
211
- // `isVisible` is in deps so the listeners re-bind to the new host
212
- // element after a host unmount/remount cycle. The cleanup detaches
213
- // the old listeners.
214
- //
215
- // This layout effect MUST appear in the file before the show/hide
216
- // layout effect — React runs layout effects in source order on the
217
- // same commit, and we need listeners attached first.
194
+ // Bind via `useLayoutEffect`, and BEFORE the show/hide layout effect
195
+ // below, so listeners are attached when `showPopover()` synchronously
196
+ // dispatches `beforetoggle`. A regular `useEffect` would miss that
197
+ // first dispatch, dropping the `previouslyFocusedElementRef` snapshot
198
+ // and breaking nested-popover focus restoration on close. React runs
199
+ // layout effects in source order on the same commit.
218
200
  useLayoutEffect(function () {
219
201
  var element = ownRef.current;
220
202
  if (!element) {
@@ -250,13 +232,10 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
250
232
  }, [handleToggle, handleBeforeToggle, isVisible]);
251
233
 
252
234
  // Placement-dependent animation CSS vars. Kept separate from show/hide
253
- // so preset reference changes do not re-trigger visibility. `isVisible`
254
- // is in deps so the CSS vars are re-applied to the new host element after
255
- // a remount cycle (otherwise the freshly mounted element would have no
256
- // transform / placement vars set).
235
+ // so preset reference changes do not re-trigger visibility.
257
236
  useLayoutEffect(function () {
258
- var el = ownRef.current;
259
- if (!el || !(preset !== null && preset !== void 0 && preset.getProperties) || !placement) {
237
+ var element = ownRef.current;
238
+ if (!element || !(preset !== null && preset !== void 0 && preset.getProperties) || !placement) {
260
239
  return;
261
240
  }
262
241
  var props = preset.getProperties({
@@ -266,7 +245,7 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
266
245
  var _ref3 = _slicedToArray(_ref2, 2),
267
246
  key = _ref3[0],
268
247
  value = _ref3[1];
269
- el.style.setProperty(key, String(value));
248
+ element.style.setProperty(key, String(value));
270
249
  });
271
250
  }, [preset, placement, isVisible]);
272
251
 
@@ -274,42 +253,35 @@ export var Popover = /*#__PURE__*/forwardRef(function Popover(_ref, ref) {
274
253
  // already in the target state. Try/catch guards `InvalidStateError` on
275
254
  // disconnected elements (StrictMode/concurrent/unmount edge cases).
276
255
  useLayoutEffect(function () {
277
- var el = ownRef.current;
278
- if (!el) {
256
+ var element = ownRef.current;
257
+ if (!element) {
279
258
  return;
280
259
  }
281
260
  if (isOpen) {
282
261
  programmaticCloseRef.current = false;
283
- // Reset the close-reason snapshot at the start of every open
284
- // cycle. The ref outlives the host element (lives on the
285
- // component, not the DOM), so a stale 'escape' from a prior
286
- // cycle would otherwise leak into the next close — especially
287
- // in the no-animation path where the host unmounts before
288
- // `handleToggle` has a chance to reset the ref itself.
262
+ // Clear stale 'escape' from a prior cycle: the ref outlives
263
+ // the host element, and the no-animation path unmounts before
264
+ // `handleToggle` can reset it.
289
265
  closeReasonRef.current = 'light-dismiss';
290
266
  try {
291
- el.showPopover();
267
+ element.showPopover();
292
268
  } catch (_unused) {}
293
269
  return function () {
294
270
  programmaticCloseRef.current = true;
295
271
  try {
296
- el.hidePopover();
272
+ element.hidePopover();
297
273
  } catch (_unused2) {}
298
274
  };
299
275
  }
300
276
  programmaticCloseRef.current = true;
301
277
  try {
302
- el.hidePopover();
278
+ element.hidePopover();
303
279
  } catch (_unused3) {}
304
280
  }, [isOpen]);
305
281
 
306
- // The host element is only rendered while the popover is open or its exit
307
- // animation is playing. Once the phase returns to `closed`, we unmount
308
- // the host entirely so it does not leave an empty `role="..."` /
309
- // `popover` element in the accessibility tree. The element re-mounts on
310
- // the next `isOpen=true` commit; refs and event listeners re-bind via
311
- // the existing layout effect and `useEffect`. The popover `id` is stable
312
- // across opens (derived from `useId()` or the consumer-supplied `idProp`).
282
+ // Unmount the host once exit completes so it does not leave an empty
283
+ // `role`/`popover` element in the accessibility tree. The element
284
+ // remounts on the next open; the `popoverId` is stable across opens.
313
285
  if (!isVisible) {
314
286
  return null;
315
287
  }
@@ -1,7 +1,7 @@
1
1
  /* popover-surface.tsx generated by @compiled/babel-plugin v0.39.1 */
2
2
  import "./popover-surface.compiled.css";
3
+ import * as React from 'react';
3
4
  import { ax, ix } from "@compiled/react/runtime";
4
- import React from 'react';
5
5
  var styles = {
6
6
  root: "_2rkofajl _1reo1wug _18m91wug _bfhk1bhr _16qs130s"
7
7
  };
@@ -352,17 +352,17 @@ function isInChainTo(_ref12) {
352
352
  function hidePopoversInStackNotInChainTo(_ref13) {
353
353
  var stack = _ref13.stack,
354
354
  target = _ref13.target;
355
- var snapshot = stack.slice();
356
- for (var i = snapshot.length - 1; i >= 0; i -= 1) {
357
- var popover = snapshot[i];
358
- if (isInChainTo({
355
+ var snapshot = stack.slice().reverse();
356
+ var stopIndex = snapshot.findIndex(function (popover) {
357
+ return isInChainTo({
359
358
  candidate: popover,
360
359
  target: target
361
- })) {
362
- break;
363
- }
364
- popover.hidePopover();
365
- }
360
+ });
361
+ });
362
+ var toHide = stopIndex === -1 ? snapshot : snapshot.slice(0, stopIndex);
363
+ toHide.forEach(function (popover) {
364
+ return popover.hidePopover();
365
+ });
366
366
  }
367
367
 
368
368
  // Two-phase light-dismiss: pointerdown stores the nearest open popover for
@@ -53,13 +53,13 @@ export function useSimpleLightDismiss(_ref) {
53
53
  var unbindClickOutside = bind(document, {
54
54
  type: 'click',
55
55
  listener: function listener(event) {
56
- var el = popoverRef.current;
57
- if (!el) {
56
+ var element = popoverRef.current;
57
+ if (!element) {
58
58
  return;
59
59
  }
60
60
 
61
61
  // If the click target is inside the popover, do not dismiss.
62
- if (event.target instanceof Node && el.contains(event.target)) {
62
+ if (event.target instanceof Node && element.contains(event.target)) {
63
63
  return;
64
64
  }
65
65
  onCloseRef.current({
@@ -2,8 +2,8 @@
2
2
  * Sets inline styles on an element and returns a cleanup function that
3
3
  * restores the prior inline values (so we do not stomp consumer styles).
4
4
  */
5
- export declare function setStyle({ el, styles, }: {
6
- el: HTMLElement;
5
+ export declare function setStyle({ element, styles, }: {
6
+ element: HTMLElement;
7
7
  styles: Array<{
8
8
  property: string;
9
9
  value: string;
@@ -2,7 +2,7 @@ import { type ForwardRefExoticComponent, type ReactNode, type RefAttributes } fr
2
2
  /**
3
3
  * Extra DOM/event props are passed through to the cloned child.
4
4
  */
5
- export type SlotProps = {
5
+ export type TSlotProps = {
6
6
  children: ReactNode;
7
7
  } & Record<string, unknown>;
8
8
  /**
@@ -26,4 +26,4 @@ export type SlotProps = {
26
26
  * </Slot>
27
27
  * ```
28
28
  */
29
- export declare const Slot: ForwardRefExoticComponent<SlotProps & RefAttributes<HTMLElement>>;
29
+ export declare const Slot: ForwardRefExoticComponent<TSlotProps & RefAttributes<HTMLElement>>;
@@ -5,7 +5,7 @@ import { type TPlacementOptions } from './resolve-placement';
5
5
  * anchor should be placed.
6
6
  *
7
7
  * Axis-named (`x`/`y`) rather than edge-named (`left`/`top`) so the
8
- * shape is unambiguous in RTL writing modes — there is no ambiguity
8
+ * shape is unambiguous in RTL writing modes - there is no ambiguity
9
9
  * about whether a coordinate is logical (`inline-start`/`block-start`)
10
10
  * or physical (`left`/`top`). Viewport coordinates are always
11
11
  * physical, so we name them with the physical axis labels.
@@ -48,7 +48,7 @@ export declare function useAnchorPositionAtPoint({ popoverRef, placement, getPoi
48
48
  * Called once per activation (every `isEnabled: false → true`
49
49
  * transition); the result is latched and not re-read.
50
50
  *
51
- * Return `null` to signal "no point yet" — the hook stays in a
51
+ * Return `null` to signal "no point yet" - the hook stays in a
52
52
  * no-DOM state so another positioning strategy can own the popover.
53
53
  *
54
54
  * Read from a ref, so it does not need to be memoized.
@@ -29,10 +29,6 @@ import { type TPlacementOptions } from '../internal/resolve-placement';
29
29
  * When not supported, it falls back to JavaScript-based positioning using
30
30
  * `position: fixed` with measured coordinates, re-running on scroll (capture)
31
31
  * and resize events.
32
- *
33
- * `placement` may be a fresh inline object on every render: a structural
34
- * comparison is used internally so re-runs are skipped when the resolved
35
- * placement shape is unchanged.
36
32
  */
37
33
  export declare function useAnchorPosition({ anchorRef, popoverRef, placement, forceFallbackPositioning, isEnabled, isOpen, }: {
38
34
  /**
@@ -30,7 +30,7 @@ import { type TPhase } from './use-animated-visibility';
30
30
  * `<dialog>.close()`. If the consumer reopens before the exit transition
31
31
  * has settled, the phase machine jumps `exiting → entering` without
32
32
  * passing through `closed`, so without this branch the popup would be
33
- * visible again with focus stranded on the trigger — a keyboard usability
33
+ * visible again with focus stranded on the trigger - a keyboard usability
34
34
  * gap for menu/dialog/listbox roles.
35
35
  *
36
36
  * Note: there is a rare programmatic path where a consumer flips `isOpen`
@@ -15,12 +15,10 @@ export type TPopoverCloseReason = 'escape' | 'light-dismiss' | 'programmatic';
15
15
  /**
16
16
  * Flat (non-discriminated) props accepted by the Popover component internally.
17
17
  *
18
- * TypeScript limitation: when PopupContent destructures props from a
19
- * discriminated union (role, label, labelledBy) and re-passes them individually
20
- * to Popover, TypeScript cannot prove the individual fields still satisfy the
21
- * union constraint. This flat type accepts all role/label combinations without
22
- * the union, since ARIA correctness is enforced at the TPopupContentProps
23
- * boundary where consumers interact.
18
+ * Used by wrappers like `PopupContent` that destructure props from a
19
+ * discriminated union and re-pass the individual fields: TypeScript cannot
20
+ * prove the fields still satisfy the union. ARIA correctness is enforced at
21
+ * the `TPopupContentProps` boundary where consumers interact.
24
22
  */
25
23
  export type TPopoverForwardedProps = TPopoverBaseProps & {
26
24
  mode?: 'auto' | 'hint' | 'manual';
@@ -65,7 +63,7 @@ type TPopoverBaseProps = {
65
63
  * animation plays (via `allow-discrete`) before the popover becomes logically closed.
66
64
  * Otherwise hides instantly.
67
65
  *
68
- * The consumer does not conditionally render the `Popover` — visibility is driven
66
+ * The consumer does not conditionally render the `Popover` - visibility is driven
69
67
  * by this prop.
70
68
  *
71
69
  * **Lifecycle observable to consumers:**
@@ -2,7 +2,7 @@
2
2
  * @jsxRuntime classic
3
3
  * @jsx jsx
4
4
  */
5
- import React, { type ReactNode } from 'react';
5
+ import { type ReactNode } from 'react';
6
6
  export type TPopoverSurfaceProps = {
7
7
  children: ReactNode;
8
8
  };
@@ -18,4 +18,4 @@ export type TPopoverSurfaceProps = {
18
18
  * `Popover` instead. `PopoverSurface` is the no-config "give me the default
19
19
  * ADS overlay look" surface, nothing more.
20
20
  */
21
- export declare function PopoverSurface({ children }: TPopoverSurfaceProps): React.ReactElement;
21
+ export declare function PopoverSurface({ children }: TPopoverSurfaceProps): ReactNode;
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/focus.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/focus.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/focus.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/get-aria-for-trigger.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/get-aria-for-trigger.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/get-aria-for-trigger.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/open-layer-observer.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/open-layer-observer.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/open-layer-observer.d.ts"
17
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/top-layer",
3
- "version": "0.17.0",
3
+ "version": "1.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",
@@ -34,11 +34,11 @@
34
34
  }
35
35
  },
36
36
  "dependencies": {
37
- "@atlaskit/browser-apis": "^0.0.2",
38
- "@atlaskit/css": "^0.19.0",
39
- "@atlaskit/ds-lib": "^7.0.0",
40
- "@atlaskit/layering": "^3.8.0",
41
- "@atlaskit/tokens": "^13.4.0",
37
+ "@atlaskit/browser-apis": "^1.0.0",
38
+ "@atlaskit/css": "^1.0.0",
39
+ "@atlaskit/ds-lib": "^8.0.0",
40
+ "@atlaskit/layering": "^4.0.0",
41
+ "@atlaskit/tokens": "^14.0.0",
42
42
  "@babel/runtime": "^7.0.0",
43
43
  "@compiled/react": "^0.20.0",
44
44
  "bind-event-listener": "^3.0.0",
@@ -51,12 +51,12 @@
51
51
  "devDependencies": {
52
52
  "@af/integration-testing": "workspace:^",
53
53
  "@af/visual-regression": "workspace:^",
54
- "@atlaskit/button": "^23.11.0",
55
- "@atlaskit/heading": "^5.4.0",
56
- "@atlaskit/lozenge": "^13.9.0",
57
- "@atlaskit/primitives": "^19.0.0",
54
+ "@atlaskit/button": "^24.0.0",
55
+ "@atlaskit/heading": "^6.0.0",
56
+ "@atlaskit/lozenge": "^14.0.0",
57
+ "@atlaskit/primitives": "^20.0.0",
58
58
  "@atlaskit/ssr": "workspace:^",
59
- "@atlaskit/textfield": "^8.3.0",
59
+ "@atlaskit/textfield": "^9.0.0",
60
60
  "@atlassian/react-compiler-gating": "workspace:^",
61
61
  "@atlassian/ssr-tests": "workspace:^",
62
62
  "@atlassian/testing-library": "^0.6.0",
@@ -96,13 +96,5 @@
96
96
  },
97
97
  "publishConfig": {
98
98
  "registry": "https://registry.npmjs.org/"
99
- },
100
- "typesVersions": {
101
- ">=4.5 <4.9": {
102
- "*": [
103
- "dist/types-ts4.5/*",
104
- "dist/types-ts4.5/index.d.ts"
105
- ]
106
- }
107
99
  }
108
100
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/placement-map.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/placement-map.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/placement-map.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/popover.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/popover.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/popover.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/popover-surface.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/popover-surface.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/popover-surface.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../../dist/types/testing/polyfill.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/testing/polyfill.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../../dist/types/testing/polyfill.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../../dist/types/testing/to-be-visible.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../../dist/types-ts4.5/testing/to-be-visible.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../../dist/types/testing/to-be-visible.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/use-anchor-position.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/use-anchor-position.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/use-anchor-position.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/use-anchor-position-at-point.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/use-anchor-position-at-point.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/use-anchor-position-at-point.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/use-arrow-navigation.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/use-arrow-navigation.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/use-arrow-navigation.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/use-popover-id.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/use-popover-id.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/use-popover-id.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/use-simple-light-dismiss.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/use-simple-light-dismiss.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/use-simple-light-dismiss.d.ts"
17
10
  }
@@ -6,12 +6,5 @@
6
6
  "sideEffects": [
7
7
  "*.compiled.css"
8
8
  ],
9
- "types": "../dist/types/entry-points/use-width-from-anchor.d.ts",
10
- "typesVersions": {
11
- ">=4.5 <5.9": {
12
- "*": [
13
- "../dist/types-ts4.5/entry-points/use-width-from-anchor.d.ts"
14
- ]
15
- }
16
- }
9
+ "types": "../dist/types/entry-points/use-width-from-anchor.d.ts"
17
10
  }