@atlaskit/top-layer 0.12.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/animations/presets.js +5 -5
- package/dist/cjs/dialog/create-close-event.js +1 -1
- package/dist/cjs/dialog/dialog-content.js +5 -5
- package/dist/cjs/entry-points/use-arrow-navigation.js +3 -2
- package/dist/cjs/internal/ensure-preset-styles.js +1 -1
- package/dist/cjs/internal/placement-to-position-area.js +43 -0
- package/dist/cjs/internal/placement-to-try-fallbacks.js +82 -0
- package/dist/cjs/internal/reduced-motion.js +1 -1
- package/dist/cjs/internal/resolve-placement.js +2 -2
- package/dist/cjs/internal/role-types.js +1 -1
- package/dist/cjs/internal/slot.js +3 -3
- package/dist/cjs/internal/use-anchor-position.js +33 -161
- package/dist/cjs/internal/use-animated-visibility.js +10 -10
- package/dist/cjs/internal/use-animation-preset.js +1 -1
- package/dist/cjs/internal/use-preset-styles.js +1 -1
- package/dist/cjs/internal/use-width-from-anchor.js +4 -4
- package/dist/cjs/popover/create-close-event.js +1 -1
- package/dist/cjs/popover/popover.js +3 -3
- package/dist/cjs/popup/popup-content.js +6 -6
- package/dist/cjs/popup/popup-context.js +2 -38
- package/dist/cjs/popup/popup-provider.js +15 -0
- package/dist/cjs/popup/popup-trigger-function.js +2 -2
- package/dist/cjs/popup/popup-trigger.js +2 -2
- package/dist/cjs/popup/popup.js +2 -2
- package/dist/cjs/popup/use-maybe-popup-context.js +17 -0
- package/dist/cjs/popup/use-popup-context.js +20 -0
- package/dist/cjs/testing/polyfill.js +8 -8
- package/dist/cjs/testing/to-be-visible.js +5 -5
- package/dist/cjs/use-arrow-navigation/index.js +3 -2
- package/dist/cjs/use-arrow-navigation/is-at-current-menu-level.js +94 -0
- package/dist/cjs/use-arrow-navigation/use-arrow-navigation.js +0 -82
- package/dist/cjs/use-simple-light-dismiss/index.js +3 -3
- package/dist/es2019/animations/presets.js +5 -5
- package/dist/es2019/dialog/create-close-event.js +1 -1
- package/dist/es2019/dialog/dialog-content.js +5 -5
- package/dist/es2019/entry-points/use-arrow-navigation.js +2 -1
- package/dist/es2019/internal/ensure-preset-styles.js +1 -1
- package/dist/es2019/internal/placement-to-position-area.js +40 -0
- package/dist/es2019/internal/placement-to-try-fallbacks.js +77 -0
- package/dist/es2019/internal/reduced-motion.js +1 -1
- package/dist/es2019/internal/resolve-placement.js +2 -2
- package/dist/es2019/internal/role-types.js +1 -1
- package/dist/es2019/internal/slot.js +3 -3
- package/dist/es2019/internal/use-anchor-position.js +15 -132
- package/dist/es2019/internal/use-animated-visibility.js +10 -10
- package/dist/es2019/internal/use-animation-preset.js +1 -1
- package/dist/es2019/internal/use-preset-styles.js +1 -1
- package/dist/es2019/internal/use-width-from-anchor.js +4 -4
- package/dist/es2019/popover/create-close-event.js +1 -1
- package/dist/es2019/popover/popover.js +3 -3
- package/dist/es2019/popup/popup-content.js +6 -5
- package/dist/es2019/popup/popup-context.js +2 -36
- package/dist/es2019/popup/popup-provider.js +10 -0
- package/dist/es2019/popup/popup-trigger-function.js +1 -1
- package/dist/es2019/popup/popup-trigger.js +2 -1
- package/dist/es2019/popup/popup.js +1 -1
- package/dist/es2019/popup/use-maybe-popup-context.js +12 -0
- package/dist/es2019/popup/use-popup-context.js +15 -0
- package/dist/es2019/testing/polyfill.js +8 -8
- package/dist/es2019/testing/to-be-visible.js +5 -5
- package/dist/es2019/use-arrow-navigation/index.js +2 -1
- package/dist/es2019/use-arrow-navigation/is-at-current-menu-level.js +88 -0
- package/dist/es2019/use-arrow-navigation/use-arrow-navigation.js +0 -81
- package/dist/es2019/use-simple-light-dismiss/index.js +3 -3
- package/dist/esm/animations/presets.js +5 -5
- package/dist/esm/dialog/create-close-event.js +1 -1
- package/dist/esm/dialog/dialog-content.js +5 -5
- package/dist/esm/entry-points/use-arrow-navigation.js +2 -1
- package/dist/esm/internal/ensure-preset-styles.js +1 -1
- package/dist/esm/internal/placement-to-position-area.js +38 -0
- package/dist/esm/internal/placement-to-try-fallbacks.js +76 -0
- package/dist/esm/internal/reduced-motion.js +1 -1
- package/dist/esm/internal/resolve-placement.js +2 -2
- package/dist/esm/internal/role-types.js +1 -1
- package/dist/esm/internal/slot.js +3 -3
- package/dist/esm/internal/use-anchor-position.js +31 -157
- package/dist/esm/internal/use-animated-visibility.js +10 -10
- package/dist/esm/internal/use-animation-preset.js +1 -1
- package/dist/esm/internal/use-preset-styles.js +1 -1
- package/dist/esm/internal/use-width-from-anchor.js +4 -4
- package/dist/esm/popover/create-close-event.js +1 -1
- package/dist/esm/popover/popover.js +3 -3
- package/dist/esm/popup/popup-content.js +6 -5
- package/dist/esm/popup/popup-context.js +2 -36
- package/dist/esm/popup/popup-provider.js +10 -0
- package/dist/esm/popup/popup-trigger-function.js +1 -1
- package/dist/esm/popup/popup-trigger.js +2 -1
- package/dist/esm/popup/popup.js +1 -1
- package/dist/esm/popup/use-maybe-popup-context.js +12 -0
- package/dist/esm/popup/use-popup-context.js +15 -0
- package/dist/esm/testing/polyfill.js +8 -8
- package/dist/esm/testing/to-be-visible.js +5 -5
- package/dist/esm/use-arrow-navigation/index.js +2 -1
- package/dist/esm/use-arrow-navigation/is-at-current-menu-level.js +88 -0
- package/dist/esm/use-arrow-navigation/use-arrow-navigation.js +0 -81
- package/dist/esm/use-simple-light-dismiss/index.js +3 -3
- package/dist/types/dialog/create-close-event.d.ts +1 -1
- package/dist/types/dialog/types.d.ts +8 -0
- package/dist/types/entry-points/use-arrow-navigation.d.ts +2 -1
- package/dist/types/internal/placement-to-position-area.d.ts +21 -0
- package/dist/types/internal/placement-to-try-fallbacks.d.ts +36 -0
- package/dist/types/internal/reduced-motion.d.ts +1 -1
- package/dist/types/internal/resolve-placement.d.ts +2 -2
- package/dist/types/internal/slot.d.ts +4 -4
- package/dist/types/internal/use-anchor-position.d.ts +0 -55
- package/dist/types/internal/use-animated-visibility.d.ts +3 -3
- package/dist/types/internal/use-animation-preset.d.ts +1 -1
- package/dist/types/internal/use-preset-styles.d.ts +1 -1
- package/dist/types/internal/use-width-from-anchor.d.ts +2 -2
- package/dist/types/popover/create-close-event.d.ts +1 -1
- package/dist/types/popover/popover.d.ts +1 -1
- package/dist/types/popup/popup-context.d.ts +2 -22
- package/dist/types/popup/popup-provider.d.ts +10 -0
- package/dist/types/popup/use-maybe-popup-context.d.ts +8 -0
- package/dist/types/popup/use-popup-context.d.ts +7 -0
- package/dist/types/testing/to-be-visible.d.ts +3 -3
- package/dist/types/use-arrow-navigation/index.d.ts +2 -1
- package/dist/types/use-arrow-navigation/is-at-current-menu-level.d.ts +48 -0
- package/dist/types/use-arrow-navigation/use-arrow-navigation.d.ts +0 -48
- package/dist/types/use-simple-light-dismiss/index.d.ts +1 -1
- package/dist/types-ts4.5/dialog/create-close-event.d.ts +1 -1
- package/dist/types-ts4.5/dialog/types.d.ts +8 -0
- package/dist/types-ts4.5/entry-points/use-arrow-navigation.d.ts +2 -1
- package/dist/types-ts4.5/internal/placement-to-position-area.d.ts +21 -0
- package/dist/types-ts4.5/internal/placement-to-try-fallbacks.d.ts +36 -0
- package/dist/types-ts4.5/internal/reduced-motion.d.ts +1 -1
- package/dist/types-ts4.5/internal/resolve-placement.d.ts +2 -2
- package/dist/types-ts4.5/internal/slot.d.ts +4 -4
- package/dist/types-ts4.5/internal/use-anchor-position.d.ts +0 -55
- package/dist/types-ts4.5/internal/use-animated-visibility.d.ts +3 -3
- package/dist/types-ts4.5/internal/use-animation-preset.d.ts +1 -1
- package/dist/types-ts4.5/internal/use-preset-styles.d.ts +1 -1
- package/dist/types-ts4.5/internal/use-width-from-anchor.d.ts +2 -2
- package/dist/types-ts4.5/popover/create-close-event.d.ts +1 -1
- package/dist/types-ts4.5/popover/popover.d.ts +1 -1
- package/dist/types-ts4.5/popup/popup-context.d.ts +2 -22
- package/dist/types-ts4.5/popup/popup-provider.d.ts +10 -0
- package/dist/types-ts4.5/popup/use-maybe-popup-context.d.ts +8 -0
- package/dist/types-ts4.5/popup/use-popup-context.d.ts +7 -0
- package/dist/types-ts4.5/testing/to-be-visible.d.ts +3 -3
- package/dist/types-ts4.5/use-arrow-navigation/index.d.ts +2 -1
- package/dist/types-ts4.5/use-arrow-navigation/is-at-current-menu-level.d.ts +48 -0
- package/dist/types-ts4.5/use-arrow-navigation/use-arrow-navigation.d.ts +0 -48
- package/dist/types-ts4.5/use-simple-light-dismiss/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cjs/arrow/index.js +0 -131
- package/dist/cjs/arrow/types.js +0 -5
- package/dist/es2019/arrow/index.js +0 -269
- package/dist/es2019/arrow/types.js +0 -1
- package/dist/esm/arrow/index.js +0 -124
- package/dist/esm/arrow/types.js +0 -1
- package/dist/types/arrow/index.d.ts +0 -24
- package/dist/types/arrow/types.d.ts +0 -29
- package/dist/types-ts4.5/arrow/index.d.ts +0 -24
- package/dist/types-ts4.5/arrow/types.d.ts +0 -29
|
@@ -30,8 +30,8 @@ export type TPlacement = {
|
|
|
30
30
|
* CSS length string (e.g. `token('space.100')`).
|
|
31
31
|
*
|
|
32
32
|
* The two offset axes are named for clarity at the call site:
|
|
33
|
-
* - `gap`
|
|
34
|
-
* - `crossAxisShift`
|
|
33
|
+
* - `gap` - distance away from the trigger along the placement axis
|
|
34
|
+
* - `crossAxisShift` - nudge along the trigger edge (perpendicular to the placement axis)
|
|
35
35
|
*/
|
|
36
36
|
export type TPlacementOptions = {
|
|
37
37
|
axis?: 'block' | 'inline';
|
|
@@ -2,21 +2,21 @@ 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
|
|
5
|
+
export type TSlotProps = {
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
} & Record<string, unknown>;
|
|
8
8
|
/**
|
|
9
9
|
* Merges props (including ref) onto a single React element child.
|
|
10
10
|
*
|
|
11
11
|
* A safer alternative to raw `cloneElement` that:
|
|
12
|
-
* 1. Guards with `isValidElement`
|
|
12
|
+
* 1. Guards with `isValidElement` - non-element children (strings,
|
|
13
13
|
* fragments, null) are returned as-is instead of crashing.
|
|
14
14
|
* 2. Merges refs via `mergeRefs` so both the caller's ref and the
|
|
15
15
|
* child's existing ref are honoured.
|
|
16
16
|
* 3. Spreads any additional props (ARIA attributes, event handlers, etc.)
|
|
17
17
|
* onto the child element.
|
|
18
18
|
*
|
|
19
|
-
* Event handlers (e.g. `onClick`) are **not** auto-merged
|
|
19
|
+
* Event handlers (e.g. `onClick`) are **not** auto-merged - the caller's
|
|
20
20
|
* handler replaces the child's. Compose handlers before passing them in.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
@@ -26,4 +26,4 @@ export type SlotProps = {
|
|
|
26
26
|
* </Slot>
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export declare const Slot: ForwardRefExoticComponent<
|
|
29
|
+
export declare const Slot: ForwardRefExoticComponent<TSlotProps & RefAttributes<HTMLElement>>;
|
|
@@ -14,61 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { type RefObject } from 'react';
|
|
16
16
|
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
17
|
-
/**
|
|
18
|
-
* Resolves placement options to CSS `position-area` syntax.
|
|
19
|
-
*
|
|
20
|
-
* The `align` field represents the *visual* alignment:
|
|
21
|
-
* - `align: 'start'` means "aligned to the trigger's start edge" (left in LTR for block axis)
|
|
22
|
-
* - `align: 'end'` means "aligned to the trigger's end edge"
|
|
23
|
-
* - `align: 'center'` means centered (single-axis position-area)
|
|
24
|
-
*
|
|
25
|
-
* CSS `position-area` uses `span-*` keywords which indicate the *expansion direction*.
|
|
26
|
-
* Visual start-alignment requires `span-{cross-axis}-end` (expand toward end = start-aligned).
|
|
27
|
-
* This function handles the inversion internally.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'center' } }) // → 'block-end'
|
|
31
|
-
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'start' } }) // → 'block-end span-inline-end'
|
|
32
|
-
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'end' } }) // → 'block-end span-inline-start'
|
|
33
|
-
*/
|
|
34
|
-
export declare function placementToPositionArea({ placement }: {
|
|
35
|
-
placement: TPlacementOptions;
|
|
36
|
-
}): string;
|
|
37
|
-
/**
|
|
38
|
-
* Returns `position-try-fallbacks` value based on placement.
|
|
39
|
-
*
|
|
40
|
-
* For centered placements, includes cross-axis aligned position-area
|
|
41
|
-
* values so the browser can shift the popover along the cross-axis
|
|
42
|
-
* when the centered position would overflow the viewport edge.
|
|
43
|
-
*
|
|
44
|
-
* Fallback order for centered placements (e.g. `block-end`):
|
|
45
|
-
* 1. Same edge, start-aligned (shift for near-edge overflow)
|
|
46
|
-
* 2. Same edge, end-aligned (shift for far-edge overflow)
|
|
47
|
-
* 3. Flipped edge, centered
|
|
48
|
-
* 4. Flipped edge, start-aligned
|
|
49
|
-
* 5. Flipped edge, end-aligned
|
|
50
|
-
*
|
|
51
|
-
* For aligned placements (start/end), includes the same-edge centered
|
|
52
|
-
* position as fallbacks so the browser can try centering when the aligned
|
|
53
|
-
* position would overflow, before flipping to the opposite edge.
|
|
54
|
-
*
|
|
55
|
-
* **Why `flip-inline flip-block` (or `flip-block flip-inline`) is included:**
|
|
56
|
-
*
|
|
57
|
-
* When a popup is in a viewport corner (e.g. inline-end align-end at the
|
|
58
|
-
* top-right), flipping only the primary axis (`flip-inline`) moves the popup
|
|
59
|
-
* to the left but keeps the same cross-axis span direction (e.g. upward),
|
|
60
|
-
* which is still off-screen. The combined keyword `flip-inline flip-block`
|
|
61
|
-
* mirrors the popup diagonally. It flips BOTH the position-area AND both
|
|
62
|
-
* inline and block margins simultaneously, placing the popup at the
|
|
63
|
-
* diagonally opposite corner where there is always space.
|
|
64
|
-
*
|
|
65
|
-
* Named `position-area` entries (e.g. `inline-start span-block-end`) in
|
|
66
|
-
* `position-try-fallbacks` do NOT update margins, so only the `flip-*`
|
|
67
|
-
* tactic keywords correctly flip the gap margin along with the position.
|
|
68
|
-
*/
|
|
69
|
-
export declare function placementToTryFallbacks({ placement }: {
|
|
70
|
-
placement: TPlacementOptions;
|
|
71
|
-
}): string;
|
|
72
17
|
/**
|
|
73
18
|
* Hook that positions an element relative to an anchor element using
|
|
74
19
|
* CSS Anchor Positioning (with a JS fallback for older browsers).
|
|
@@ -44,19 +44,19 @@ type TUseAnimatedVisibilityResult = {
|
|
|
44
44
|
*
|
|
45
45
|
* Used by both `Popover` and `Dialog` to share the same animation lifecycle
|
|
46
46
|
* logic. Those components own their own show/hide mechanisms (showPopover /
|
|
47
|
-
* hidePopover vs showModal / close) and event handling
|
|
47
|
+
* hidePopover vs showModal / close) and event handling - this hook only
|
|
48
48
|
* manages the relationship between `isOpen` and when children are rendered.
|
|
49
49
|
*
|
|
50
50
|
* ## Problem
|
|
51
51
|
*
|
|
52
52
|
* We want to delay the unmount of children until a CSS exit transition has
|
|
53
53
|
* finished playing. If we unmount children the moment `isOpen` becomes
|
|
54
|
-
* `false`, the exit animation is never visible
|
|
54
|
+
* `false`, the exit animation is never visible - the content just disappears.
|
|
55
55
|
*
|
|
56
56
|
* ## How it works
|
|
57
57
|
*
|
|
58
58
|
* `showChildren` tracks whether the consumer's children should be in the DOM.
|
|
59
|
-
* It does not mirror `isOpen` exactly
|
|
59
|
+
* It does not mirror `isOpen` exactly - it intentionally lags behind during
|
|
60
60
|
* exit animations:
|
|
61
61
|
*
|
|
62
62
|
* ```
|
|
@@ -5,7 +5,7 @@ type TPresetWithCssAndName = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Normalizes the `animate` prop to a preset (or null) and ensures its CSS
|
|
7
7
|
* is injected once into document.head. Used by PopupContent, Popover, and
|
|
8
|
-
* DialogContent so they
|
|
8
|
+
* DialogContent so they do not duplicate this logic.
|
|
9
9
|
*/
|
|
10
10
|
export declare function useAnimationPreset<T extends TPresetWithCssAndName>(animate: T | false | null | undefined): T | null;
|
|
11
11
|
export {};
|
|
@@ -6,7 +6,7 @@ type TPresetWithCssAndName = {
|
|
|
6
6
|
* Normalizes a preset prop to a value (or null) and ensures its CSS
|
|
7
7
|
* is injected once into `document.head`.
|
|
8
8
|
*
|
|
9
|
-
* Works with any preset that has `{ css, name }`
|
|
9
|
+
* Works with any preset that has `{ css, name }` - animation presets
|
|
10
10
|
* (TAnimationPreset) satisfies this shape.
|
|
11
11
|
*/
|
|
12
12
|
export declare function usePresetStyles<T extends TPresetWithCssAndName>({ preset, }: {
|
|
@@ -3,8 +3,8 @@ import type { TWidthFromAnchorMode } from '../popover/types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Sets the width of a popover element relative to its anchor element.
|
|
5
5
|
*
|
|
6
|
-
* - `'match-anchor'` → `width: anchor-size(width)`
|
|
7
|
-
* - `'min-anchor'` → `min-width: anchor-size(width)`
|
|
6
|
+
* - `'match-anchor'` → `width: anchor-size(width)` - popover matches anchor width exactly.
|
|
7
|
+
* - `'min-anchor'` → `min-width: anchor-size(width)` - popover is at least as wide as anchor,
|
|
8
8
|
* but can grow wider.
|
|
9
9
|
* - `'none'` → no explicit width is set (default behaviour)
|
|
10
10
|
*
|
|
@@ -3,7 +3,7 @@ import type { TPopoverCloseReason } from './types';
|
|
|
3
3
|
* Creates a synthetic DOM event from a `TPopoverCloseReason`.
|
|
4
4
|
*
|
|
5
5
|
* Useful when bridging the Popover primitive's `onClose({ reason })` callback
|
|
6
|
-
* to a legacy API that expects a native DOM event
|
|
6
|
+
* to a legacy API that expects a native DOM event - for example,
|
|
7
7
|
* `@atlaskit/inline-dialog`'s `onClose(event)` contract.
|
|
8
8
|
*
|
|
9
9
|
* - `'escape'` → `KeyboardEvent('keydown', { key: 'Escape' })`
|
|
@@ -8,7 +8,7 @@ import { type TPopoverForwardedProps } from './types';
|
|
|
8
8
|
* Unopinionated top-layer primitive.
|
|
9
9
|
*
|
|
10
10
|
* Manages only visibility (isOpen) and animation (animate). Has no knowledge
|
|
11
|
-
* of positioning
|
|
11
|
+
* of positioning - compose with `useAnchorPosition` for anchor positioning
|
|
12
12
|
* and optionally `useWidthFromAnchor` for setting the width of a popover element
|
|
13
13
|
* relative to its anchor trigger.
|
|
14
14
|
*
|
|
@@ -79,7 +79,7 @@ export type TPopupContextValue = {
|
|
|
79
79
|
*/
|
|
80
80
|
ariaHasPopup: TAriaHasPopupValue;
|
|
81
81
|
/**
|
|
82
|
-
* Updates `ariaHasPopup`
|
|
82
|
+
* Updates `ariaHasPopup` - called by Content on mount/role change.
|
|
83
83
|
*/
|
|
84
84
|
setAriaHasPopup: (value: TAriaHasPopupValue) => void;
|
|
85
85
|
/**
|
|
@@ -93,24 +93,4 @@ export type TPopupContextValue = {
|
|
|
93
93
|
*/
|
|
94
94
|
forceFallbackPositioning?: boolean;
|
|
95
95
|
};
|
|
96
|
-
|
|
97
|
-
* __Popup provider__
|
|
98
|
-
*
|
|
99
|
-
* Provides shared popup state (placement, popoverId, triggerRef,
|
|
100
|
-
* isOpen, onClose) to compound child components such as `Popup.Trigger` and
|
|
101
|
-
* `Popup.Content`.
|
|
102
|
-
*/
|
|
103
|
-
export declare const PopupProvider: React.Provider<TPopupContextValue | null>;
|
|
104
|
-
/**
|
|
105
|
-
* Returns the nearest `Popup` context value.
|
|
106
|
-
*
|
|
107
|
-
* Throws if called outside of a `<Popup>` compound component.
|
|
108
|
-
*/
|
|
109
|
-
export declare function usePopupContext(): TPopupContextValue;
|
|
110
|
-
/**
|
|
111
|
-
* Returns the popup context if available, or `null` when used outside `<Popup>`.
|
|
112
|
-
*
|
|
113
|
-
* Used by `PopupContent` to support standalone usage (e.g. tooltip)
|
|
114
|
-
* where values are passed as props instead of coming from a compound component.
|
|
115
|
-
*/
|
|
116
|
-
export declare function useMaybePopupContext(): TPopupContextValue | null;
|
|
96
|
+
export declare const PopupContext: React.Context<TPopupContextValue | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Provider } from 'react';
|
|
2
|
+
import { type TPopupContextValue } from './popup-context';
|
|
3
|
+
/**
|
|
4
|
+
* __Popup provider__
|
|
5
|
+
*
|
|
6
|
+
* Provides shared popup state (placement, popoverId, triggerRef,
|
|
7
|
+
* isOpen, onClose) to compound child components such as `Popup.Trigger` and
|
|
8
|
+
* `Popup.Content`.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PopupProvider: Provider<TPopupContextValue | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type TPopupContextValue } from './popup-context';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the popup context if available, or `null` when used outside `<Popup>`.
|
|
4
|
+
*
|
|
5
|
+
* Used by `PopupContent` to support standalone usage (e.g. tooltip)
|
|
6
|
+
* where values are passed as props instead of coming from a compound component.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMaybePopupContext(): TPopupContextValue | null;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* jest-dom's `toBeVisible()` does not know about the Popover API. In real
|
|
5
5
|
* browsers the UA stylesheet hides `[popover]` with `display: none`, but
|
|
6
|
-
* jsdom has no such stylesheet
|
|
6
|
+
* jsdom has no such stylesheet - so closed popovers incorrectly appear visible.
|
|
7
7
|
*
|
|
8
8
|
* Raw jest-dom results in jsdom:
|
|
9
9
|
*
|
|
10
|
-
* closed popover / child → true (WRONG
|
|
10
|
+
* closed popover / child → true (WRONG - should be false)
|
|
11
11
|
* open popover / child → true (correct)
|
|
12
|
-
* closed dialog / child → false (correct
|
|
12
|
+
* closed dialog / child → false (correct - jsdom natively hides <dialog>)
|
|
13
13
|
* open dialog / child → true (correct)
|
|
14
14
|
*
|
|
15
15
|
* We correct both false positives and false negatives:
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { useArrowNavigation
|
|
1
|
+
export { useArrowNavigation } from './use-arrow-navigation';
|
|
2
2
|
export type { TUseArrowNavigationArgs } from './use-arrow-navigation';
|
|
3
|
+
export { isAtCurrentMenuLevel } from './is-at-current-menu-level';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the element belongs to the current menu level of the
|
|
3
|
+
* container, i.e. it is NOT inside a nested `role="menu"` sub-container.
|
|
4
|
+
*
|
|
5
|
+
* Uses `element.closest('[role="menu"]')` to determine the nearest menu
|
|
6
|
+
* scope. If the nearest scope is the container's own `role="menu"` element,
|
|
7
|
+
* the element belongs to this level. If it is a different (nested) menu,
|
|
8
|
+
* the element belongs to a child level and should be excluded.
|
|
9
|
+
*
|
|
10
|
+
* Supports two container patterns:
|
|
11
|
+
*
|
|
12
|
+
* **1. Container has `role="menu"` directly** (preferred, used by avatar-group):
|
|
13
|
+
* ```
|
|
14
|
+
* <div ref={containerRef} role="menu">
|
|
15
|
+
* <button role="menuitem" /> ← isAtCurrentMenuLevel → true
|
|
16
|
+
* <div role="menu"> ← nested sub-menu
|
|
17
|
+
* <button role="menuitem" /> ← isAtCurrentMenuLevel → false
|
|
18
|
+
* </div>
|
|
19
|
+
* </div>
|
|
20
|
+
* ```
|
|
21
|
+
* Uses the simple check: `element.closest('[role="menu"]') === container`
|
|
22
|
+
*
|
|
23
|
+
* **2. Container is a wrapper without `role="menu"`** (used by dropdown-menu,
|
|
24
|
+
* where `MenuGroup` owns `role="menu"` but does not accept a ref):
|
|
25
|
+
* ```
|
|
26
|
+
* <div ref={containerRef}> ← wrapper (no role="menu")
|
|
27
|
+
* <MenuGroup role="menu">
|
|
28
|
+
* <button role="menuitem" /> ← isAtCurrentMenuLevel → true
|
|
29
|
+
* <div role="menu"> ← nested sub-menu
|
|
30
|
+
* <button role="menuitem" /> ← isAtCurrentMenuLevel → false
|
|
31
|
+
* </div>
|
|
32
|
+
* </MenuGroup>
|
|
33
|
+
* </div>
|
|
34
|
+
* ```
|
|
35
|
+
* Falls back to walking the DOM to check that the element's closest
|
|
36
|
+
* `role="menu"` is the container's own menu (not doubly nested).
|
|
37
|
+
*
|
|
38
|
+
* Ideally all consumers should use pattern 1 (place the ref directly on the
|
|
39
|
+
* `role="menu"` element). Pattern 2 exists because `@atlaskit/menu`'s
|
|
40
|
+
* `MenuGroup` does not currently accept a ref. If `MenuGroup` gains ref
|
|
41
|
+
* support in the future, dropdown-menu should switch to pattern 1 and the
|
|
42
|
+
* fallback path can be removed.
|
|
43
|
+
*
|
|
44
|
+
* Used both as a `TFocusableFilter` (to scope getNextFocusable etc.) and as
|
|
45
|
+
* a guard to prevent parent menu handlers from acting on events that
|
|
46
|
+
* belong to a nested menu.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isAtCurrentMenuLevel(element: Element, container: HTMLElement): boolean;
|
|
@@ -1,53 +1,5 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
2
|
import { type TFocusableFilter } from '../focus';
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if the element belongs to the current menu level of the
|
|
5
|
-
* container, i.e. it is NOT inside a nested `role="menu"` sub-container.
|
|
6
|
-
*
|
|
7
|
-
* Uses `element.closest('[role="menu"]')` to determine the nearest menu
|
|
8
|
-
* scope. If the nearest scope is the container's own `role="menu"` element,
|
|
9
|
-
* the element belongs to this level. If it is a different (nested) menu,
|
|
10
|
-
* the element belongs to a child level and should be excluded.
|
|
11
|
-
*
|
|
12
|
-
* Supports two container patterns:
|
|
13
|
-
*
|
|
14
|
-
* **1. Container has `role="menu"` directly** (preferred, used by avatar-group):
|
|
15
|
-
* ```
|
|
16
|
-
* <div ref={containerRef} role="menu">
|
|
17
|
-
* <button role="menuitem" /> ← isAtCurrentMenuLevel → true
|
|
18
|
-
* <div role="menu"> ← nested sub-menu
|
|
19
|
-
* <button role="menuitem" /> ← isAtCurrentMenuLevel → false
|
|
20
|
-
* </div>
|
|
21
|
-
* </div>
|
|
22
|
-
* ```
|
|
23
|
-
* Uses the simple check: `element.closest('[role="menu"]') === container`
|
|
24
|
-
*
|
|
25
|
-
* **2. Container is a wrapper without `role="menu"`** (used by dropdown-menu,
|
|
26
|
-
* where `MenuGroup` owns `role="menu"` but does not accept a ref):
|
|
27
|
-
* ```
|
|
28
|
-
* <div ref={containerRef}> ← wrapper (no role="menu")
|
|
29
|
-
* <MenuGroup role="menu">
|
|
30
|
-
* <button role="menuitem" /> ← isAtCurrentMenuLevel → true
|
|
31
|
-
* <div role="menu"> ← nested sub-menu
|
|
32
|
-
* <button role="menuitem" /> ← isAtCurrentMenuLevel → false
|
|
33
|
-
* </div>
|
|
34
|
-
* </MenuGroup>
|
|
35
|
-
* </div>
|
|
36
|
-
* ```
|
|
37
|
-
* Falls back to walking the DOM to check that the element's closest
|
|
38
|
-
* `role="menu"` is the container's own menu (not doubly nested).
|
|
39
|
-
*
|
|
40
|
-
* Ideally all consumers should use pattern 1 (place the ref directly on the
|
|
41
|
-
* `role="menu"` element). Pattern 2 exists because `@atlaskit/menu`'s
|
|
42
|
-
* `MenuGroup` does not currently accept a ref. If `MenuGroup` gains ref
|
|
43
|
-
* support in the future, dropdown-menu should switch to pattern 1 and the
|
|
44
|
-
* fallback path can be removed.
|
|
45
|
-
*
|
|
46
|
-
* Used both as a `TFocusableFilter` (to scope getNextFocusable etc.) and as
|
|
47
|
-
* a guard to prevent parent menu handlers from acting on events that
|
|
48
|
-
* belong to a nested menu.
|
|
49
|
-
*/
|
|
50
|
-
export declare function isAtCurrentMenuLevel(element: Element, container: HTMLElement): boolean;
|
|
51
3
|
/**
|
|
52
4
|
* Args for `useArrowNavigation`.
|
|
53
5
|
*
|
|
@@ -34,7 +34,7 @@ type TUseSimpleLightDismissOptions = {
|
|
|
34
34
|
* **No stacking awareness:** This hook does not track a popover stack.
|
|
35
35
|
* If multiple manual popovers are open and all use this hook, a single
|
|
36
36
|
* Escape press or outside click will dismiss **all of them simultaneously**.
|
|
37
|
-
* This is by design
|
|
37
|
+
* This is by design - the hook is intentionally simple for cases where
|
|
38
38
|
* only one manual popover is open at a time.
|
|
39
39
|
*
|
|
40
40
|
* For stacked/nested popovers that should dismiss one-at-a-time, use
|
|
@@ -3,7 +3,7 @@ import type { TDialogCloseReason } from './types';
|
|
|
3
3
|
* Creates a synthetic DOM event from a `TDialogCloseReason`.
|
|
4
4
|
*
|
|
5
5
|
* Useful when bridging the Dialog primitive's `onClose({ reason })` callback
|
|
6
|
-
* to a legacy API that expects a `KeyboardEvent` or `MouseEvent`
|
|
6
|
+
* to a legacy API that expects a `KeyboardEvent` or `MouseEvent` - for example,
|
|
7
7
|
* `@atlaskit/modal-dialog`'s `onClose(event, analyticsEvent)` contract.
|
|
8
8
|
*
|
|
9
9
|
* - `'escape'` → `KeyboardEvent('keydown', { key: 'Escape' })`
|
|
@@ -49,6 +49,14 @@ type TDialogBaseProps = {
|
|
|
49
49
|
* Additional inline styles applied to the `<dialog>` element.
|
|
50
50
|
*
|
|
51
51
|
* Use for custom width, height, transform, or other overrides.
|
|
52
|
+
*
|
|
53
|
+
* Rule deviation: the house rules ban unbounded `style` props on
|
|
54
|
+
* components. `Dialog` is a low-level primitive that intentionally has
|
|
55
|
+
* no visual opinions of its own; consumers such as `@atlaskit/modal-dialog`
|
|
56
|
+
* must be able to set width, height, and transforms on the native
|
|
57
|
+
* `<dialog>` element. Removing this prop would be a breaking change
|
|
58
|
+
* and is tracked separately. Keep until an xcss-based replacement
|
|
59
|
+
* exists on the primitive.
|
|
52
60
|
*/
|
|
53
61
|
style?: CSSProperties;
|
|
54
62
|
/**
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { useArrowNavigation
|
|
1
|
+
export { useArrowNavigation } from '../use-arrow-navigation';
|
|
2
2
|
export type { TUseArrowNavigationArgs } from '../use-arrow-navigation';
|
|
3
|
+
export { isAtCurrentMenuLevel } from '../use-arrow-navigation/is-at-current-menu-level';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves placement options to CSS `position-area` syntax.
|
|
4
|
+
*
|
|
5
|
+
* The `align` field represents the *visual* alignment:
|
|
6
|
+
* - `align: 'start'` means "aligned to the trigger's start edge" (left in LTR for block axis)
|
|
7
|
+
* - `align: 'end'` means "aligned to the trigger's end edge"
|
|
8
|
+
* - `align: 'center'` means centered (single-axis position-area)
|
|
9
|
+
*
|
|
10
|
+
* CSS `position-area` uses `span-*` keywords which indicate the *expansion direction*.
|
|
11
|
+
* Visual start-alignment requires `span-{cross-axis}-end` (expand toward end = start-aligned).
|
|
12
|
+
* This function handles the inversion internally.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'center' } }) // → 'block-end'
|
|
16
|
+
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'start' } }) // → 'block-end span-inline-end'
|
|
17
|
+
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'end' } }) // → 'block-end span-inline-start'
|
|
18
|
+
*/
|
|
19
|
+
export declare function placementToPositionArea({ placement }: {
|
|
20
|
+
placement: TPlacementOptions;
|
|
21
|
+
}): string;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
2
|
+
/**
|
|
3
|
+
* Returns `position-try-fallbacks` value based on placement.
|
|
4
|
+
*
|
|
5
|
+
* For centered placements, includes cross-axis aligned position-area
|
|
6
|
+
* values so the browser can shift the popover along the cross-axis
|
|
7
|
+
* when the centered position would overflow the viewport edge.
|
|
8
|
+
*
|
|
9
|
+
* Fallback order for centered placements (e.g. `block-end`):
|
|
10
|
+
* 1. Same edge, start-aligned (shift for near-edge overflow)
|
|
11
|
+
* 2. Same edge, end-aligned (shift for far-edge overflow)
|
|
12
|
+
* 3. Flipped edge, centered
|
|
13
|
+
* 4. Flipped edge, start-aligned
|
|
14
|
+
* 5. Flipped edge, end-aligned
|
|
15
|
+
*
|
|
16
|
+
* For aligned placements (start/end), includes the same-edge centered
|
|
17
|
+
* position as fallbacks so the browser can try centering when the aligned
|
|
18
|
+
* position would overflow, before flipping to the opposite edge.
|
|
19
|
+
*
|
|
20
|
+
* **Why `flip-inline flip-block` (or `flip-block flip-inline`) is included:**
|
|
21
|
+
*
|
|
22
|
+
* When a popup is in a viewport corner (e.g. inline-end align-end at the
|
|
23
|
+
* top-right), flipping only the primary axis (`flip-inline`) moves the popup
|
|
24
|
+
* to the left but keeps the same cross-axis span direction (e.g. upward),
|
|
25
|
+
* which is still off-screen. The combined keyword `flip-inline flip-block`
|
|
26
|
+
* mirrors the popup diagonally. It flips BOTH the position-area AND both
|
|
27
|
+
* inline and block margins simultaneously, placing the popup at the
|
|
28
|
+
* diagonally opposite corner where there is always space.
|
|
29
|
+
*
|
|
30
|
+
* Named `position-area` entries (e.g. `inline-start span-block-end`) in
|
|
31
|
+
* `position-try-fallbacks` do NOT update margins, so only the `flip-*`
|
|
32
|
+
* tactic keywords correctly flip the gap margin along with the position.
|
|
33
|
+
*/
|
|
34
|
+
export declare function placementToTryFallbacks({ placement }: {
|
|
35
|
+
placement: TPlacementOptions;
|
|
36
|
+
}): string;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* The result is cached after the first call via `once`. This avoids
|
|
7
7
|
* calling `matchMedia` on every render. The trade-off is that if a user
|
|
8
|
-
* toggles the OS reduced-motion setting mid-session, the change
|
|
8
|
+
* toggles the OS reduced-motion setting mid-session, the change will not
|
|
9
9
|
* take effect until the next page load. This is acceptable because
|
|
10
10
|
* toggling this system-level preference mid-session is extremely rare,
|
|
11
11
|
* and a page refresh is a reasonable expectation for system accessibility
|
|
@@ -30,8 +30,8 @@ export type TPlacement = {
|
|
|
30
30
|
* CSS length string (e.g. `token('space.100')`).
|
|
31
31
|
*
|
|
32
32
|
* The two offset axes are named for clarity at the call site:
|
|
33
|
-
* - `gap`
|
|
34
|
-
* - `crossAxisShift`
|
|
33
|
+
* - `gap` - distance away from the trigger along the placement axis
|
|
34
|
+
* - `crossAxisShift` - nudge along the trigger edge (perpendicular to the placement axis)
|
|
35
35
|
*/
|
|
36
36
|
export type TPlacementOptions = {
|
|
37
37
|
axis?: 'block' | 'inline';
|
|
@@ -2,21 +2,21 @@ 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
|
|
5
|
+
export type TSlotProps = {
|
|
6
6
|
children: ReactNode;
|
|
7
7
|
} & Record<string, unknown>;
|
|
8
8
|
/**
|
|
9
9
|
* Merges props (including ref) onto a single React element child.
|
|
10
10
|
*
|
|
11
11
|
* A safer alternative to raw `cloneElement` that:
|
|
12
|
-
* 1. Guards with `isValidElement`
|
|
12
|
+
* 1. Guards with `isValidElement` - non-element children (strings,
|
|
13
13
|
* fragments, null) are returned as-is instead of crashing.
|
|
14
14
|
* 2. Merges refs via `mergeRefs` so both the caller's ref and the
|
|
15
15
|
* child's existing ref are honoured.
|
|
16
16
|
* 3. Spreads any additional props (ARIA attributes, event handlers, etc.)
|
|
17
17
|
* onto the child element.
|
|
18
18
|
*
|
|
19
|
-
* Event handlers (e.g. `onClick`) are **not** auto-merged
|
|
19
|
+
* Event handlers (e.g. `onClick`) are **not** auto-merged - the caller's
|
|
20
20
|
* handler replaces the child's. Compose handlers before passing them in.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
@@ -26,4 +26,4 @@ export type SlotProps = {
|
|
|
26
26
|
* </Slot>
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export declare const Slot: ForwardRefExoticComponent<
|
|
29
|
+
export declare const Slot: ForwardRefExoticComponent<TSlotProps & RefAttributes<HTMLElement>>;
|
|
@@ -14,61 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { type RefObject } from 'react';
|
|
16
16
|
import { type TPlacementOptions } from '../internal/resolve-placement';
|
|
17
|
-
/**
|
|
18
|
-
* Resolves placement options to CSS `position-area` syntax.
|
|
19
|
-
*
|
|
20
|
-
* The `align` field represents the *visual* alignment:
|
|
21
|
-
* - `align: 'start'` means "aligned to the trigger's start edge" (left in LTR for block axis)
|
|
22
|
-
* - `align: 'end'` means "aligned to the trigger's end edge"
|
|
23
|
-
* - `align: 'center'` means centered (single-axis position-area)
|
|
24
|
-
*
|
|
25
|
-
* CSS `position-area` uses `span-*` keywords which indicate the *expansion direction*.
|
|
26
|
-
* Visual start-alignment requires `span-{cross-axis}-end` (expand toward end = start-aligned).
|
|
27
|
-
* This function handles the inversion internally.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'center' } }) // → 'block-end'
|
|
31
|
-
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'start' } }) // → 'block-end span-inline-end'
|
|
32
|
-
* placementToPositionArea({ placement: { axis: 'block', edge: 'end', align: 'end' } }) // → 'block-end span-inline-start'
|
|
33
|
-
*/
|
|
34
|
-
export declare function placementToPositionArea({ placement }: {
|
|
35
|
-
placement: TPlacementOptions;
|
|
36
|
-
}): string;
|
|
37
|
-
/**
|
|
38
|
-
* Returns `position-try-fallbacks` value based on placement.
|
|
39
|
-
*
|
|
40
|
-
* For centered placements, includes cross-axis aligned position-area
|
|
41
|
-
* values so the browser can shift the popover along the cross-axis
|
|
42
|
-
* when the centered position would overflow the viewport edge.
|
|
43
|
-
*
|
|
44
|
-
* Fallback order for centered placements (e.g. `block-end`):
|
|
45
|
-
* 1. Same edge, start-aligned (shift for near-edge overflow)
|
|
46
|
-
* 2. Same edge, end-aligned (shift for far-edge overflow)
|
|
47
|
-
* 3. Flipped edge, centered
|
|
48
|
-
* 4. Flipped edge, start-aligned
|
|
49
|
-
* 5. Flipped edge, end-aligned
|
|
50
|
-
*
|
|
51
|
-
* For aligned placements (start/end), includes the same-edge centered
|
|
52
|
-
* position as fallbacks so the browser can try centering when the aligned
|
|
53
|
-
* position would overflow, before flipping to the opposite edge.
|
|
54
|
-
*
|
|
55
|
-
* **Why `flip-inline flip-block` (or `flip-block flip-inline`) is included:**
|
|
56
|
-
*
|
|
57
|
-
* When a popup is in a viewport corner (e.g. inline-end align-end at the
|
|
58
|
-
* top-right), flipping only the primary axis (`flip-inline`) moves the popup
|
|
59
|
-
* to the left but keeps the same cross-axis span direction (e.g. upward),
|
|
60
|
-
* which is still off-screen. The combined keyword `flip-inline flip-block`
|
|
61
|
-
* mirrors the popup diagonally. It flips BOTH the position-area AND both
|
|
62
|
-
* inline and block margins simultaneously, placing the popup at the
|
|
63
|
-
* diagonally opposite corner where there is always space.
|
|
64
|
-
*
|
|
65
|
-
* Named `position-area` entries (e.g. `inline-start span-block-end`) in
|
|
66
|
-
* `position-try-fallbacks` do NOT update margins, so only the `flip-*`
|
|
67
|
-
* tactic keywords correctly flip the gap margin along with the position.
|
|
68
|
-
*/
|
|
69
|
-
export declare function placementToTryFallbacks({ placement }: {
|
|
70
|
-
placement: TPlacementOptions;
|
|
71
|
-
}): string;
|
|
72
17
|
/**
|
|
73
18
|
* Hook that positions an element relative to an anchor element using
|
|
74
19
|
* CSS Anchor Positioning (with a JS fallback for older browsers).
|
|
@@ -44,19 +44,19 @@ type TUseAnimatedVisibilityResult = {
|
|
|
44
44
|
*
|
|
45
45
|
* Used by both `Popover` and `Dialog` to share the same animation lifecycle
|
|
46
46
|
* logic. Those components own their own show/hide mechanisms (showPopover /
|
|
47
|
-
* hidePopover vs showModal / close) and event handling
|
|
47
|
+
* hidePopover vs showModal / close) and event handling - this hook only
|
|
48
48
|
* manages the relationship between `isOpen` and when children are rendered.
|
|
49
49
|
*
|
|
50
50
|
* ## Problem
|
|
51
51
|
*
|
|
52
52
|
* We want to delay the unmount of children until a CSS exit transition has
|
|
53
53
|
* finished playing. If we unmount children the moment `isOpen` becomes
|
|
54
|
-
* `false`, the exit animation is never visible
|
|
54
|
+
* `false`, the exit animation is never visible - the content just disappears.
|
|
55
55
|
*
|
|
56
56
|
* ## How it works
|
|
57
57
|
*
|
|
58
58
|
* `showChildren` tracks whether the consumer's children should be in the DOM.
|
|
59
|
-
* It does not mirror `isOpen` exactly
|
|
59
|
+
* It does not mirror `isOpen` exactly - it intentionally lags behind during
|
|
60
60
|
* exit animations:
|
|
61
61
|
*
|
|
62
62
|
* ```
|
|
@@ -5,7 +5,7 @@ type TPresetWithCssAndName = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Normalizes the `animate` prop to a preset (or null) and ensures its CSS
|
|
7
7
|
* is injected once into document.head. Used by PopupContent, Popover, and
|
|
8
|
-
* DialogContent so they
|
|
8
|
+
* DialogContent so they do not duplicate this logic.
|
|
9
9
|
*/
|
|
10
10
|
export declare function useAnimationPreset<T extends TPresetWithCssAndName>(animate: T | false | null | undefined): T | null;
|
|
11
11
|
export {};
|
|
@@ -6,7 +6,7 @@ type TPresetWithCssAndName = {
|
|
|
6
6
|
* Normalizes a preset prop to a value (or null) and ensures its CSS
|
|
7
7
|
* is injected once into `document.head`.
|
|
8
8
|
*
|
|
9
|
-
* Works with any preset that has `{ css, name }`
|
|
9
|
+
* Works with any preset that has `{ css, name }` - animation presets
|
|
10
10
|
* (TAnimationPreset) satisfies this shape.
|
|
11
11
|
*/
|
|
12
12
|
export declare function usePresetStyles<T extends TPresetWithCssAndName>({ preset, }: {
|