@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
@@ -1,110 +0,0 @@
1
- import { type TAnimationPreset } from './types';
2
- export declare function popupMotion(): TAnimationPreset;
3
- type TSlideAndFadeOptions = {
4
- /**
5
- * Slide distance in pixels. Defaults to `4`.
6
- */
7
- distance?: number;
8
- };
9
- /**
10
- * Directional slide + opacity animation.
11
- *
12
- * The popover slides in from the direction opposite its placement edge
13
- * (e.g. a `block-end` popover slides down from above).
14
- *
15
- * @param options.distance - Slide distance in pixels. Defaults to `4`.
16
- *
17
- * @example
18
- * ```tsx
19
- * import { slideAndFade } from '@atlaskit/top-layer/animations';
20
- *
21
- * // Default 4px slide (tooltip)
22
- * <Popover animate={slideAndFade()} />
23
- *
24
- * // Custom 8px slide (popup / dropdown)
25
- * <Popover animate={slideAndFade({ distance: 8 })} />
26
- * ```
27
- */
28
- export declare function slideAndFade(options?: TSlideAndFadeOptions): TAnimationPreset;
29
- /**
30
- * Simple opacity transition, no transform.
31
- *
32
- * Suitable for popup dialogs or content that does not need directional motion.
33
- *
34
- * @example
35
- * ```tsx
36
- * import { fade } from '@atlaskit/top-layer/animations';
37
- *
38
- * <Popover animate={fade()} />
39
- * ```
40
- */
41
- export declare function fade(): TAnimationPreset;
42
- /**
43
- * Scale from 0.95 + opacity transition.
44
- *
45
- * Suitable for menus, dropdowns, and select options.
46
- *
47
- * @example
48
- * ```tsx
49
- * import { scaleAndFade } from '@atlaskit/top-layer/animations';
50
- *
51
- * <Popover animate={scaleAndFade()} />
52
- * ```
53
- */
54
- export declare function scaleAndFade(): TAnimationPreset;
55
- /**
56
- * Dialog motion animation.
57
- *
58
- * Includes backdrop fade animation.
59
- *
60
- * @example
61
- * ```tsx
62
- * import { dialogMotion } from '@atlaskit/top-layer/animations';
63
- *
64
- * <Dialog animate={dialogMotion()} isOpen={isOpen} onClose={handleClose} label="...">
65
- * ...
66
- * </Dialog>
67
- * ```
68
- */
69
- export declare function dialogMotion(): TAnimationPreset;
70
- type TDialogSlideUpAndFadeOptions = {
71
- /**
72
- * Slide distance in pixels. Defaults to `12`.
73
- */
74
- distance?: number;
75
- };
76
- /**
77
- * Slide up + opacity animation for dialogs.
78
- *
79
- * Entry slides up from below; exit slides up and out (asymmetric).
80
- * Includes backdrop fade animation.
81
- *
82
- * @param options.distance - Slide distance in pixels. Defaults to `12`.
83
- *
84
- * @example
85
- * ```tsx
86
- * import { dialogSlideUpAndFade } from '@atlaskit/top-layer/animations';
87
- *
88
- * const animation = dialogSlideUpAndFade();
89
- * <Dialog animate={animation} isOpen={isOpen} onClose={handleClose} label="...">
90
- * ...
91
- * </Dialog>
92
- * ```
93
- */
94
- export declare function dialogSlideUpAndFade(options?: TDialogSlideUpAndFadeOptions): TAnimationPreset;
95
- /**
96
- * Simple opacity transition for dialogs, no transform.
97
- *
98
- * Includes backdrop fade animation.
99
- *
100
- * @example
101
- * ```tsx
102
- * import { dialogFade } from '@atlaskit/top-layer/animations';
103
- *
104
- * <Dialog animate={dialogFade()} isOpen={isOpen} onClose={handleClose} label="...">
105
- * ...
106
- * </Dialog>
107
- * ```
108
- */
109
- export declare function dialogFade(): TAnimationPreset;
110
- export {};
@@ -1,38 +0,0 @@
1
- import type { TPlacementOptions } from '../internal/resolve-placement';
2
- /**
3
- * A self-contained animation preset for top-layer elements (popovers and dialogs).
4
- *
5
- * Contains the CSS rules (injected once into `<head>`), a data-attribute name
6
- * for CSS targeting, optional per-placement custom properties, and the exit
7
- * duration used for a `transitionend` fallback timeout.
8
- *
9
- * Entry animation uses `@starting-style`.
10
- * Exit animation uses `allow-discrete` on `display`/`overlay` to keep the
11
- * element visible in the top layer while CSS transitions play.
12
- */
13
- export type TAnimationPreset = {
14
- /**
15
- * CSS to inject once into `document.head`, scoped via a data attribute
16
- * (e.g. `[data-ds-popover-{name}]` or `[data-ds-dialog-{name}]`).
17
- */
18
- css: string;
19
- /**
20
- * Data attribute suffix for CSS targeting (e.g. `'slide-and-fade'`).
21
- */
22
- name: string;
23
- /**
24
- * Per-placement CSS custom properties (e.g. directional offset for
25
- * `slideAndFade`). Only used by popover presets that vary by placement.
26
- */
27
- getProperties?: (args: {
28
- placement: TPlacementOptions;
29
- }) => Record<string, string>;
30
- /**
31
- * Entry duration in ms (for `transitionend` fallback timeout on open).
32
- */
33
- enterDurationMs: number;
34
- /**
35
- * Exit duration in ms (for `transitionend` fallback timeout on close).
36
- */
37
- exitDurationMs: number;
38
- };
@@ -1,23 +0,0 @@
1
- import type { TDialogCloseReason } from './types';
2
- /**
3
- * Creates a synthetic DOM event from a `TDialogCloseReason`.
4
- *
5
- * Useful when bridging the Dialog primitive's `onClose({ reason })` callback
6
- * to a legacy API that expects a `KeyboardEvent` or `MouseEvent` - for example,
7
- * `@atlaskit/modal-dialog`'s `onClose(event, analyticsEvent)` contract.
8
- *
9
- * - `'escape'` → `KeyboardEvent('keydown', { key: 'Escape' })`
10
- * - `'overlay-click'` → `MouseEvent('click')`
11
- *
12
- * @example
13
- * ```tsx
14
- * import { createCloseEvent, type TDialogCloseReason } from '@atlaskit/top-layer/dialog';
15
- *
16
- * function onDialogClose({ reason }: { reason: TDialogCloseReason }) {
17
- * legacyOnClose(createCloseEvent({ reason }));
18
- * }
19
- * ```
20
- */
21
- export declare function createCloseEvent({ reason, }: {
22
- reason: TDialogCloseReason;
23
- }): KeyboardEvent | MouseEvent;
@@ -1,24 +0,0 @@
1
- /**
2
- * @jsxRuntime classic
3
- * @jsx jsx
4
- */
5
- import React from 'react';
6
- import { type TDialogProps } from './types';
7
- /**
8
- * Low-level `<dialog>` primitive. No visual opinions - no width, height,
9
- * background, border-radius, or layout. Consumers provide their own styling.
10
- *
11
- * Visibility is controlled declaratively via `isOpen`:
12
- * - `isOpen={true}` calls `.showModal()` (entry animation via `@starting-style`)
13
- * - `isOpen={false}` calls `.close()` (exit animation via `allow-discrete`)
14
- *
15
- * Handles native `cancel` event (Escape) and backdrop click detection.
16
- *
17
- * Close flow: we never call `dialog.close()` from event handlers. We always call
18
- * `onClose`; the consumer decides whether to set `isOpen={false}`.
19
- *
20
- * Accessibility: render at least one focusable element (typically a close
21
- * button) when `isOpen` becomes `true`. Tab is always trapped inside the
22
- * dialog, so keyboard users need somewhere to land.
23
- */
24
- export declare const Dialog: React.ForwardRefExoticComponent<TDialogProps & React.RefAttributes<HTMLDialogElement>>;
@@ -1,3 +0,0 @@
1
- export { createCloseEvent } from './create-close-event';
2
- export { Dialog } from './dialog-content';
3
- export type { TDialogCloseReason, TDialogProps } from './types';
@@ -1,126 +0,0 @@
1
- import { type CSSProperties, type ReactNode } from 'react';
2
- import { type TAnimationPreset } from '../animations/types';
3
- /**
4
- * Close reasons produced by the Dialog primitive.
5
- *
6
- * - `'escape'`: user pressed Escape (native `cancel` event on `<dialog>`).
7
- * - `'overlay-click'`: user clicked the backdrop / overlay area.
8
- *
9
- * Consumer-initiated ("programmatic") close is not a reason the primitive
10
- * produces. The consumer simply sets `isOpen={false}`.
11
- */
12
- export type TDialogCloseReason = 'escape' | 'overlay-click';
13
- /**
14
- * Props shared across `TDialogProps` variants.
15
- *
16
- * The accessible-name requirement (one of `label` or `labelledBy`) is encoded
17
- * in the discriminated union below - WCAG 4.1.2 violations are caught at
18
- * compile time instead of in production audit reports.
19
- */
20
- type TDialogBaseProps = {
21
- children: ReactNode;
22
- /**
23
- * Whether the dialog is open.
24
- *
25
- * - `true`: calls `showModal()`, entry animation plays via `@starting-style`.
26
- * - `false`: calls `close()`. When an `animate` preset is provided, the exit
27
- * animation plays (via `allow-discrete`) before the dialog becomes logically closed.
28
- *
29
- * **Lifecycle observable to consumers:**
30
- *
31
- * - The `<dialog>` host element is in the DOM only while open or its exit
32
- * animation is playing. After exit completes the element is unmounted so
33
- * it does not leave an empty `role="dialog"` element in the accessibility
34
- * tree. The exact unmount timing is private and may change.
35
- * - The `id` (supplied or generated) is stable across opens.
36
- * - The `ref` is populated only while the host element is rendered. Consumers
37
- * that read from the ref should gate the read on `isOpen` being `true`.
38
- */
39
- isOpen: boolean;
40
- /**
41
- * Called when the user triggers close via Escape or backdrop click.
42
- *
43
- * The dialog does **not** close itself. The consumer decides whether to
44
- * set `isOpen={false}` (e.g. gate by reason).
45
- */
46
- onClose: (args: {
47
- reason: TDialogCloseReason;
48
- }) => void;
49
- /**
50
- * Animation preset for entry/exit transitions.
51
- *
52
- * Pass an `TAnimationPreset` (e.g. `dialogSlideUpAndFade()`) to enable
53
- * CSS-based entry and exit animation. Pass `false` (or omit) to disable.
54
- */
55
- animate?: TAnimationPreset | false;
56
- /**
57
- * Additional inline styles applied to the `<dialog>` element.
58
- *
59
- * Use for custom width, height, transform, or other overrides.
60
- */
61
- style?: CSSProperties;
62
- /**
63
- * Test ID applied to the `<dialog>` element.
64
- */
65
- testId?: string;
66
- /**
67
- * HTML `id` attribute for the `<dialog>` element.
68
- */
69
- id?: string;
70
- /**
71
- * When true, the `::backdrop` pseudo-element is rendered transparent.
72
- *
73
- * Useful for stacked dialogs where only the foreground dialog should
74
- * show a visible backdrop, or when the consumer wants no overlay.
75
- */
76
- shouldHideBackdrop?: boolean;
77
- /**
78
- * Called after the exit animation completes (or immediately on close when
79
- * there is no animation or reduced motion is active).
80
- *
81
- * Use this for external lifecycle coordination, e.g. firing an
82
- * `onCloseComplete` callback or notifying ExitingPersistence.
83
- */
84
- onExitFinish?: () => void;
85
- };
86
- /**
87
- * Props for the `Dialog` primitive.
88
- *
89
- * Low-level wrapper around the native `<dialog>` element.
90
- * Manages visibility (`showModal()` / `close()`), animation, Escape handling,
91
- * and backdrop-click detection. Has no visual opinions - no width, height,
92
- * background, border-radius, or layout. Consumers (e.g. `@atlaskit/modal-dialog`)
93
- * provide their own visual styling.
94
- *
95
- * Discriminated on the accessible-name source: at least one of `label`
96
- * (aria-label) or `labelledBy` (aria-labelledby) must be provided. This
97
- * enforces WCAG 4.1.2 at the type level - an unlabelled dialog landmark
98
- * is not constructible. Mirrors the pattern used by `TPopupContentProps`.
99
- */
100
- export type TDialogProps = TDialogBaseProps & ({
101
- /**
102
- * Accessible label (`aria-label`).
103
- *
104
- * When provided, `aria-labelledby` is not set.
105
- * Use when there is no visible title element to reference.
106
- */
107
- label: string;
108
- /**
109
- * ID of the element that labels the dialog (`aria-labelledby`).
110
- *
111
- * Ignored when `label` is provided.
112
- */
113
- labelledBy?: string;
114
- } | {
115
- /**
116
- * Accessible label (`aria-label`).
117
- *
118
- * Optional when `labelledBy` is provided.
119
- */
120
- label?: string;
121
- /**
122
- * ID of the element that labels the dialog (`aria-labelledby`).
123
- */
124
- labelledBy: string;
125
- });
126
- export {};
@@ -1,40 +0,0 @@
1
- type TDialogScrollLockProps = {
2
- /**
3
- * Whether the parent dialog is open. The scroll lock is applied while
4
- * `true` and released the moment this flips to `false`, regardless of
5
- * when (or whether) React unmounts this component. Pass the same
6
- * `isOpen` value you pass to the parent `Dialog`.
7
- */
8
- isOpen: boolean;
9
- };
10
- /**
11
- * __DialogScrollLock__
12
- *
13
- * Prevents background page scrolling while a dialog is open. Designed to be
14
- * rendered inside a `Dialog` and given the same `isOpen` value.
15
- *
16
- * Native `<dialog>.showModal()` makes background content _inert_ (not
17
- * focusable/clickable), but does **not** prevent scroll events from reaching
18
- * the document body. This component fills that gap by setting
19
- * `overflow: hidden` on `document.body` while `isOpen` is `true`.
20
- *
21
- * The lock is driven by `isOpen` rather than by mount/unmount so that release
22
- * happens synchronously in the same commit that flips `isOpen` to `false`.
23
- * Relying on unmount alone was racy: `Dialog` defers the unmount of its
24
- * children until the host element's close/toggle event fires, which can be
25
- * after a consumer or test observes the dialog as hidden, leading to a
26
- * stale `overflow: hidden` window.
27
- *
28
- * @example
29
- * ```tsx
30
- * import { Dialog } from '@atlaskit/top-layer/dialog';
31
- * import { DialogScrollLock } from '@atlaskit/top-layer/dialog-scroll-lock';
32
- *
33
- * <Dialog isOpen={isOpen} onClose={onClose}>
34
- * <DialogScrollLock isOpen={isOpen} />
35
- * {children}
36
- * </Dialog>
37
- * ```
38
- */
39
- export declare function DialogScrollLock({ isOpen }: TDialogScrollLockProps): null;
40
- export {};
@@ -1,2 +0,0 @@
1
- export { dialogMotion, popupMotion, slideAndFade, fade, scaleAndFade, dialogSlideUpAndFade, dialogFade, } from '../animations/presets';
2
- export type { TAnimationPreset } from '../animations/types';
@@ -1 +0,0 @@
1
- export { DialogScrollLock } from '../dialog-scroll-lock';
@@ -1,2 +0,0 @@
1
- export { createCloseEvent, Dialog } from '../dialog';
2
- export type { TDialogCloseReason, TDialogProps } from '../dialog';
@@ -1,4 +0,0 @@
1
- export type { TFocusableFilter } from '../focus/types';
2
- export { getFirstFocusable } from '../focus/get-first-focusable';
3
- export { getLastFocusable } from '../focus/get-last-focusable';
4
- export { getNextFocusable } from '../focus/get-next-focusable';
@@ -1 +0,0 @@
1
- export { getAriaForTrigger } from '../internal/get-aria-for-trigger';
@@ -1,5 +0,0 @@
1
- export { OpenLayerObserver } from '@atlaskit/layering/experimental/open-layer-observer/open-layer-observer';
2
- export { useNotifyOpenLayerObserver } from '@atlaskit/layering/experimental/use-notify-open-layer-observer';
3
- export { useOpenLayerObserver } from '@atlaskit/layering/experimental/use-open-layer-observer';
4
- export { OpenLayerObserverNamespaceProvider } from '@atlaskit/layering/experimental/open-layer-observer-namespace-provider';
5
- export type { LayerType } from '@atlaskit/layering/experimental/types';
@@ -1,3 +0,0 @@
1
- export { fromLegacyPlacement } from '../placement-map';
2
- export { LEGACY_PLACEMENTS } from '../placement-map/legacy-placements';
3
- export type { TLegacyPlacement, TPlacementOptions } from '../placement-map';
@@ -1,2 +0,0 @@
1
- export { PopoverSurface } from '../popover-surface';
2
- export type { TPopoverSurfaceProps } from '../popover-surface';
@@ -1,2 +0,0 @@
1
- export { createPopoverCloseEvent, Popover } from '../popover';
2
- export type { TPopoverProps, TPopoverCloseReason, TPlacementOptions } from '../popover';
@@ -1 +0,0 @@
1
- export { useAnchorPositionAtPoint, type TAnchorPoint, } from '../internal/use-anchor-position-at-point';
@@ -1 +0,0 @@
1
- export { useAnchorPosition } from '../internal/use-anchor-position';
@@ -1,3 +0,0 @@
1
- export { useArrowNavigation } from '../use-arrow-navigation';
2
- export type { TUseArrowNavigationArgs } from '../use-arrow-navigation';
3
- export { isAtCurrentMenuLevel } from '../use-arrow-navigation/is-at-current-menu-level';
@@ -1,11 +0,0 @@
1
- /**
2
- * Returns a stable HTML `id` used to wire a trigger element to its popover
3
- * via ARIA (`aria-controls`) and the Popover API (`popovertarget`).
4
- *
5
- * The returned value is intended for the `id` attribute on the popover and
6
- * for the matching `aria-controls` / `popovertarget` references on the
7
- * trigger. It is NOT a CSS `anchor-name` value: CSS anchor positioning is
8
- * handled internally by `useAnchorPosition`, which mints and applies its
9
- * own `anchor-name` on the trigger element.
10
- */
11
- export declare function usePopoverId(): string;
@@ -1,2 +0,0 @@
1
- export { useSimpleLightDismiss } from '../use-simple-light-dismiss';
2
- export type { TUseSimpleLightDismissOptions } from '../use-simple-light-dismiss';
@@ -1 +0,0 @@
1
- export { useWidthFromAnchor } from '../internal/use-width-from-anchor';
@@ -1,8 +0,0 @@
1
- import type { TFocusableFilter } from './types';
2
- /**
3
- * Returns the first focusable element within the container.
4
- */
5
- export declare function getFirstFocusable({ container, filter, }: {
6
- container: HTMLElement;
7
- filter?: TFocusableFilter;
8
- }): HTMLElement | null;
@@ -1,13 +0,0 @@
1
- import type { TFocusableFilter } from './types';
2
- /**
3
- * Returns all focusable HTMLElements within the container, optionally filtered.
4
- *
5
- * Focusables that belong to a nested top-layer scope (a `[popover]` or
6
- * `<dialog>` descendant of the container) are excluded - those elements
7
- * are owned by the inner layer's focus management. The container itself
8
- * is allowed to be a popover/dialog; only nested ones are filtered.
9
- */
10
- export declare function getFocusables({ container, filter, }: {
11
- container: HTMLElement;
12
- filter?: TFocusableFilter;
13
- }): HTMLElement[];
@@ -1,8 +0,0 @@
1
- import type { TFocusableFilter } from './types';
2
- /**
3
- * Returns the last focusable element within the container.
4
- */
5
- export declare function getLastFocusable({ container, filter, }: {
6
- container: HTMLElement;
7
- filter?: TFocusableFilter;
8
- }): HTMLElement | null;
@@ -1,13 +0,0 @@
1
- /**
2
- * Returns the next focusable element in the given direction relative to the
3
- * currently focused element within the container. Wraps around at both ends.
4
- *
5
- * Returns `null` if there is no focused element within the container or if
6
- * the focused element is not in the list of focusable elements.
7
- */
8
- import type { TFocusableFilter } from './types';
9
- export declare function getNextFocusable({ container, direction, filter, }: {
10
- container: HTMLElement;
11
- direction: 'forwards' | 'backwards';
12
- filter?: TFocusableFilter;
13
- }): HTMLElement | null;
@@ -1,8 +0,0 @@
1
- /**
2
- * Returns true when `element` and `container` resolve to the same nearest
3
- * top-layer host (or both resolve to `null`, meaning the document layer).
4
- */
5
- export declare function isInSameLayer({ element, container, }: {
6
- element: HTMLElement;
7
- container: HTMLElement;
8
- }): boolean;
@@ -1,8 +0,0 @@
1
- /**
2
- * Returns `true` when `document.activeElement` is inside a nested top-layer
3
- * descendant of `container` (a `[popover]`, `<dialog>`, `[role="dialog"]` or
4
- * `[role="alertdialog"]` that is itself a descendant of `container`).
5
- */
6
- export declare function isNestedLayerFocused({ container }: {
7
- container: HTMLElement;
8
- }): boolean;
@@ -1,4 +0,0 @@
1
- export declare const selectors: {
2
- focusable: string;
3
- focused: string;
4
- };
@@ -1,5 +0,0 @@
1
- /**
2
- * An optional callback to restrict which focusable elements are included.
3
- * Return `true` to include the element, `false` to skip it.
4
- */
5
- export type TFocusableFilter = (element: HTMLElement, container: HTMLElement) => boolean;
File without changes
@@ -1,26 +0,0 @@
1
- import { type TPlacement } from './resolve-placement';
2
- /**
3
- * Computes popover position from trigger rect and viewport, flipping to
4
- * the side with more space when needed. Re-runs on scroll/resize.
5
- *
6
- * `gap` and `crossAxisShift` are pre-resolved to pixels by the
7
- * caller (see `resolveCssLengthToPixels`), so this function stays purely
8
- * numeric.
9
- */
10
- export declare function computeFallbackPosition({ triggerRect, popoverEl, placement, viewport, gap, crossAxisShift, }: {
11
- triggerRect: DOMRect;
12
- popoverEl: HTMLElement;
13
- placement: TPlacement;
14
- viewport: {
15
- width: number;
16
- height: number;
17
- };
18
- gap: number;
19
- crossAxisShift: {
20
- value: number;
21
- direction: 'forwards' | 'backwards';
22
- };
23
- }): {
24
- top: number;
25
- left: number;
26
- };
@@ -1,14 +0,0 @@
1
- /**
2
- * Combine multiple cleanup functions into a single cleanup function.
3
- *
4
- * @example
5
- * ```ts
6
- * useEffect(() => {
7
- * return combine(
8
- * bind(window, { type: 'resize', listener: onResize }),
9
- * bind(window, { type: 'scroll', listener: onScroll, options: { capture: true } }),
10
- * );
11
- * }, []);
12
- * ```
13
- */
14
- export declare function combine(...cleanupFns: ((() => void) | undefined)[]): () => void;
@@ -1,6 +0,0 @@
1
- export declare function ensurePresetStyles({ preset }: {
2
- preset: {
3
- css: string;
4
- name: string;
5
- };
6
- }): void;