@dinofront/design_system 1.19.3-alpha.0 → 1.19.4-alpha.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.
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +4 -4
- package/dist/components/Popover/Popover.types.d.ts +1 -1
- package/dist/index.js +524 -563
- package/dist/index.js.map +1 -1
- package/dist/lib/PortalContext.d.ts +10 -0
- package/dist/lib/useFloatingPosition.d.ts +7 -2
- package/dist/styles.css +3 -0
- package/package.json +1 -1
- package/dist/lib/useAnchoredPosition.d.ts +0 -31
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The element floating UI (menus, popovers, select options, date pickers) should
|
|
3
|
+
* portal into. A modal `<dialog>` (Drawer, Modal) lives in the browser top layer,
|
|
4
|
+
* which paints above everything portaled to `<body>` regardless of z-index — so
|
|
5
|
+
* those components provide their own dialog here, and every overlay reads it via
|
|
6
|
+
* `usePortalContainer()` instead of hard-coding `document.body`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PortalContext: import('react').Context<HTMLElement | null>;
|
|
9
|
+
/** Portal target for floating content: the nearest enclosing dialog, else `document.body`. */
|
|
10
|
+
export declare function usePortalContainer(): HTMLElement | null;
|
|
@@ -13,6 +13,10 @@ export interface UseFloatingPositionOptions {
|
|
|
13
13
|
flip?: boolean;
|
|
14
14
|
/** Clamps the cross-axis position so the panel stays inside the viewport. */
|
|
15
15
|
shift?: boolean;
|
|
16
|
+
/** Sets the panel's `min-width` to the anchor's width (e.g. a select-style menu). */
|
|
17
|
+
matchAnchorWidth?: boolean;
|
|
18
|
+
/** Changing this re-measures the panel — for content whose size changes while open. */
|
|
19
|
+
recomputeKey?: unknown;
|
|
16
20
|
}
|
|
17
21
|
export interface FloatingPosition {
|
|
18
22
|
style: CSSProperties;
|
|
@@ -23,7 +27,8 @@ export interface FloatingPosition {
|
|
|
23
27
|
}
|
|
24
28
|
/** Computes `position: fixed` coordinates (+ a matching arrow offset) for a
|
|
25
29
|
* panel anchored to a trigger element on any of 4 sides x 3 alignments,
|
|
26
|
-
* so the panel can portal to `document.body`
|
|
30
|
+
* so the panel can portal out of its parent (to `document.body` or an enclosing
|
|
31
|
+
* dialog) without being clipped by an
|
|
27
32
|
* `overflow: hidden` ancestor. Recomputes on open, resize, and any
|
|
28
33
|
* ancestor scroll. */
|
|
29
|
-
export declare function useFloatingPosition({ anchor, panel, open, side, align, offset, flip, shift, }: UseFloatingPositionOptions): FloatingPosition;
|
|
34
|
+
export declare function useFloatingPosition({ anchor, panel, open, side, align, offset, flip, shift, matchAnchorWidth, recomputeKey, }: UseFloatingPositionOptions): FloatingPosition;
|
package/dist/styles.css
CHANGED
package/package.json
CHANGED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { CSSProperties, RefObject } from 'react';
|
|
2
|
-
export type AnchoredSide = 'bottom' | 'top';
|
|
3
|
-
export type AnchoredAlign = 'start' | 'end';
|
|
4
|
-
export interface UseAnchoredPositionOptions {
|
|
5
|
-
/** A ref pointing at the anchor element, read fresh on every recompute —
|
|
6
|
-
* never dereferenced by the caller, so the caller never has to read
|
|
7
|
-
* `.current` during render or copy it into its own state. */
|
|
8
|
-
anchor: RefObject<HTMLElement | null> | null | undefined;
|
|
9
|
-
panel: HTMLElement | null;
|
|
10
|
-
open: boolean;
|
|
11
|
-
/** Preferred side. Flips to the opposite side when there isn't room, unless `flip` is false. */
|
|
12
|
-
side?: AnchoredSide;
|
|
13
|
-
align?: AnchoredAlign;
|
|
14
|
-
offset?: number;
|
|
15
|
-
flip?: boolean;
|
|
16
|
-
/** Clamp the panel horizontally so it stays inside the viewport. */
|
|
17
|
-
shift?: boolean;
|
|
18
|
-
matchAnchorWidth?: boolean;
|
|
19
|
-
}
|
|
20
|
-
export interface AnchoredPosition {
|
|
21
|
-
style: CSSProperties;
|
|
22
|
-
/** The side actually used, after flipping — for `data-side` and animation origin. */
|
|
23
|
-
resolvedSide: AnchoredSide;
|
|
24
|
-
}
|
|
25
|
-
/** Computes `position: fixed` coordinates for a panel anchored to a trigger
|
|
26
|
-
* element, so the panel can portal to `document.body` without being
|
|
27
|
-
* clipped by an `overflow: hidden` ancestor. Recomputes on open, resize,
|
|
28
|
-
* and any ancestor scroll (capture-phase, since `position: fixed`
|
|
29
|
-
* coordinates are viewport-relative and unaffected by scroll offset
|
|
30
|
-
* themselves — but the anchor's rect moves when something scrolls). */
|
|
31
|
-
export declare function useAnchoredPosition({ anchor, panel, open, side, align, offset, flip, shift, matchAnchorWidth, }: UseAnchoredPositionOptions): AnchoredPosition;
|