@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.
@@ -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` without being clipped by an
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
@@ -1282,6 +1282,9 @@
1282
1282
  .overflow-auto {
1283
1283
  overflow: auto;
1284
1284
  }
1285
+ .overflow-clip {
1286
+ overflow: clip;
1287
+ }
1285
1288
  .overflow-hidden {
1286
1289
  overflow: hidden;
1287
1290
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dinofront/design_system",
3
- "version": "1.19.3-alpha.0",
3
+ "version": "1.19.4-alpha.0",
4
4
  "description": "Enterprise React component library and design system built on Tailwind CSS.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -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;