asma-ui-core 3.134.1 → 3.134.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.
Files changed (34) hide show
  1. package/dist/asma-ui-core.css +1 -1
  2. package/dist/components/feedback/dialog/StyledDialog.js +177 -149
  3. package/dist/components/feedback/dialog/StyledDialog.module.js +1 -1
  4. package/dist/components/feedback/dialog/StyledDialogActions.js +4 -3
  5. package/dist/components/feedback/dialog/StyledDialogContent.js +9 -8
  6. package/dist/components/feedback/dialog/StyledDialogTitle.js +23 -21
  7. package/dist/components/feedback/dialog/dialog-footer/StyledDialogFooter.js +1 -0
  8. package/dist/components/feedback/dialog/dialogHeaderStyles.js +7 -0
  9. package/dist/components/feedback/dialog/useDialogHeaderPinning.js +56 -0
  10. package/dist/components/feedback/minimizable-dialog/MinimizableDialog.js +203 -182
  11. package/dist/components/feedback/minimizable-dialog/v2/MinimizableDialogV2.js +148 -133
  12. package/dist/components/inputs/full-screen-picker/FullScreenPicker.js +1 -1
  13. package/dist/components/inputs/full-screen-picker/useReleaseFieldOnKeyboardDismiss.js +13 -12
  14. package/dist/hooks/useElementHeightPx.js +26 -0
  15. package/dist/hooks/useLayoutViewportHeight.js +5 -0
  16. package/dist/hooks/useMediaQuery.hook.js +9 -8
  17. package/dist/hooks/useOnScreenKeyboard.js +24 -0
  18. package/dist/index.js +366 -352
  19. package/dist/src/components/feedback/dialog/StyledDialog.d.ts +4 -3
  20. package/dist/src/components/feedback/dialog/StyledDialogTitle.d.ts +4 -0
  21. package/dist/src/components/feedback/dialog/dialogHeaderStyles.d.ts +28 -0
  22. package/dist/src/components/feedback/dialog/dialogTitleContext.d.ts +5 -0
  23. package/dist/src/components/feedback/dialog/useDialogHeaderPinning.d.ts +33 -0
  24. package/dist/src/hooks/useElementHeightPx.d.ts +16 -0
  25. package/dist/src/hooks/useLayoutViewportHeight.d.ts +6 -0
  26. package/dist/src/hooks/useMediaQuery.hook.d.ts +6 -0
  27. package/dist/src/hooks/useOnScreenKeyboard.d.ts +21 -0
  28. package/dist/src/index.d.ts +6 -0
  29. package/dist/table/components/StyledTableIndex.js +5 -5
  30. package/package.json +1 -1
  31. package/dist/src/table/components/columns/helpers/useElementHeightPx.d.ts +0 -7
  32. package/dist/table/components/columns/helpers/useElementHeightPx.js +0 -26
  33. /package/dist/{components/inputs/full-screen-picker → hooks}/useVisualViewportHeight.js +0 -0
  34. /package/dist/src/{components/inputs/full-screen-picker → hooks}/useVisualViewportHeight.d.ts +0 -0
@@ -11,8 +11,9 @@ interface DialogPaperProps {
11
11
  /**
12
12
  * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#15820-18954
13
13
  * Figma "Dialog": white paper radius 8 with the Dialogue-popup shadow (#22213366, 0 4 40) over a
14
- * bg/modal #626e7eb2 overlay. Header = optional label (Helper, delta-600) + title (Page title 24
15
- * SemiBold, delta-800) + close button. `fullScreen`/mobile drops the radius and fills the viewport.
14
+ * bg/modal #626e7eb2 overlay. Header = actions row (optional label, Helper delta-600, + close button)
15
+ * over the full-width title (ASMA-8737: 18/24 Bold, 20/26 Bold below 744 px, delta-800, never
16
+ * truncated). `fullScreen`/mobile drops the radius and fills the viewport.
16
17
  */
17
18
  export interface IStyledDialogProps {
18
19
  open: boolean;
@@ -63,7 +64,7 @@ export interface IStyledDialogProps {
63
64
  showCloseIcon?: boolean;
64
65
  /** @figmaProp header Label (Helper 14, delta-600) */
65
66
  dialogLabel?: ReactNode;
66
- /** @figmaProp header Title (Page title 24 SemiBold, delta-800) */
67
+ /** @figmaProp header Title (18/24 Bold, 20/26 Bold on mobile, delta-800), on its own full-width row */
67
68
  dialogTitle?: ReactNode;
68
69
  dialogHeaderNode?: ReactNode;
69
70
  /**
@@ -8,6 +8,10 @@ interface DialogTitleProps extends HTMLAttributes<HTMLHeadingElement> {
8
8
  *
9
9
  * Adopts the id its enclosing `StyledDialog` offers, so the dialog is named by this visible title
10
10
  * rather than by its test hook (WCAG 4.1.2). An explicit `id` from the caller always wins.
11
+ *
12
+ * Inside a `StyledDialog` it renders into the header's title row (ASMA-8737): under the header
13
+ * actions, full width, never truncated, pinned or scrolling with the header. Elsewhere it renders in
14
+ * place with the same type.
11
15
  */
12
16
  export declare const StyledDialogTitle: ({ children, className, sx, style, id, classes: _classes, ...rest }: DialogTitleProps) => JSX.Element | null;
13
17
  export {};
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The one dialog header layout (ASMA-8737), shared by `StyledDialog`, `MinimizableDialog` and
3
+ * `MinimizableDialogV2`: the actions row on top, then the title on a row of its own across the full
4
+ * width. Geometry from the ticket: 44 px actions row, 28 px vertical padding (16 + 12), title lines
5
+ * of 26 px below 744 px wide and 24 px from there up.
6
+ */
7
+ export declare const DIALOG_HEADER_CLASSES = "box-border w-full min-w-0 max-w-full shrink-0 bg-white px-4 pb-3 pt-4";
8
+ /**
9
+ * Wraps the consumer content in the dialog body.
10
+ *
11
+ * Pinned: exactly the space under the header, so an `h-full` form or a self-scrolling view is bounded
12
+ * there and scrolls on its own, as before the header moved into the body. Without this box `h-full`
13
+ * resolved against the header too and the body scrolled by H on top of the consumer's scroller.
14
+ * The basis is `0%`, not `0px`: in a paper without a definite height it falls back to the content.
15
+ *
16
+ * Not pinned: content must not stay bounded to the leftover height — a self-scrolling view or an
17
+ * `h-full` form would otherwise scroll only that strip under a tall header. It takes its natural
18
+ * height (percentage heights resolve to `auto`), so the body is the one scroller; a single child
19
+ * still grows to fill a short dialog, keeping a form's footer at the bottom.
20
+ */
21
+ export declare const dialogContentFlowClasses: (pinned: boolean) => string;
22
+ /** Label (if any) on the left, the header actions on the right. Wraps rather than overflowing at 320 px. */
23
+ export declare const DIALOG_HEADER_ACTIONS_ROW_CLASSES = "flex min-h-11 w-full min-w-0 items-center justify-between gap-x-2 max-xs:flex-wrap max-xs:gap-y-1";
24
+ /**
25
+ * Title type: 20/26 Bold below 744 px, 18/24 Bold from 744 px. Never truncated or clamped: it wraps
26
+ * to as many lines as it needs, breaking an over-long word rather than scrolling sideways (WCAG 1.4.10).
27
+ */
28
+ export declare const DIALOG_TITLE_CLASSES = "my-0 block min-w-0 whitespace-normal text-[20px] font-bold leading-[26px] text-delta-800 [overflow-wrap:anywhere] hyphens-auto min-[744px]:text-lg min-[744px]:leading-6";
@@ -11,5 +11,10 @@ export interface StyledDialogTitleContextValue {
11
11
  titleId: string;
12
12
  /** Registers the title's actual id, including an explicit caller-supplied id. */
13
13
  setTitleId: (titleId: string | undefined) => void;
14
+ /**
15
+ * The header's title row (ASMA-8737). The title renders there, so it sits under the header
16
+ * actions at full width and pins, scrolls and hides together with the rest of the header.
17
+ */
18
+ titleSlot?: HTMLElement | null;
14
19
  }
15
20
  export declare const StyledDialogTitleContext: import('react').Context<StyledDialogTitleContextValue | null>;
@@ -0,0 +1,33 @@
1
+ import { RefObject } from 'react';
2
+ /** A pinned header may take at most this share of the layout viewport height (ASMA-8737). */
3
+ export declare const PINNED_HEADER_MAX_VIEWPORT_SHARE = 0.25;
4
+ export interface DialogHeaderPinning {
5
+ /** Attach to the header: its measured height is `H`. */
6
+ headerRef: (element: HTMLElement | null) => void;
7
+ /** Pinned (`position: sticky`) rather than scrolling with the body. */
8
+ pinned: boolean;
9
+ /** Pinned but stepped aside for the on-screen keyboard (PIN-7): `inert`, `aria-hidden`, not rendered. */
10
+ hidden: boolean;
11
+ /** Measured header height reserved as `scroll-padding-top` on the scroller (PIN-8); 0 when not pinned. */
12
+ scrollPaddingTop: number;
13
+ /** Measured sticky-footer height reserved as `scroll-padding-bottom` on the scroller (PIN-8); 0 when absent. */
14
+ scrollPaddingBottom: number;
15
+ }
16
+ /**
17
+ * The shared pinning decision for dialog headers (ASMA-8737, pinned bars PIN-1/2/7/8): pinned only
18
+ * when the screen is taller than `30em` **and** the measured header is at most 25% of
19
+ * `window.innerHeight`; otherwise it scrolls with the body.
20
+ *
21
+ * `H` is measured on the header itself, and pinning changes only its `position`, so the decision
22
+ * cannot feed back into `H`. The visual viewport never enters the decision: the on-screen keyboard
23
+ * only hides a pinned header, it never unpins one. A hidden header keeps its last measured height, so
24
+ * it stays pinned and reserves the same padding the moment the keyboard goes.
25
+ *
26
+ * PIN-7's exception is part of the decision: a header that contains the focused field is the bar the
27
+ * user is typing in, so it stays visible (and in the accessibility tree) while the keyboard is open.
28
+ * A hidden header also leaves the tab order (`inert`).
29
+ *
30
+ * Hiding or showing the header moves the content by `H`; the focused element is brought back into
31
+ * view afterwards, inside the scroll padding.
32
+ */
33
+ export declare const useDialogHeaderPinning: (scrollerRef: RefObject<HTMLElement>) => DialogHeaderPinning;
@@ -0,0 +1,16 @@
1
+ interface ElementHeightPx<T> {
2
+ /** Callback ref: an element that mounts later (a dialog opening) is measured as it appears. */
3
+ ref: (element: T | null) => void;
4
+ /** Height in CSS px, rounded; 0 while nothing is attached. */
5
+ heightPx: number;
6
+ }
7
+ /** Returns the height to report, or `null` to keep the previous one (e.g. while the element is hidden). */
8
+ export type MeasureHeight<T> = (element: T) => number | null;
9
+ /**
10
+ * Tracks an element's rendered height with a `ResizeObserver`, so it follows text wrapping, font
11
+ * size, zoom and content changes as well as viewport resizes. The first measurement is taken
12
+ * synchronously before paint; later ones are rAF-throttled. `measure` defaults to the border-box height;
13
+ * pass a stable function (module-level or memoized).
14
+ */
15
+ export declare function useElementHeightPx<T extends HTMLElement>(measure?: MeasureHeight<T>): ElementHeightPx<T>;
16
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * `window.innerHeight`: the layout viewport, which an on-screen keyboard does not shrink on iOS
3
+ * Safari or Android Chrome. Layout decisions use this one; the visual viewport is only a keyboard
4
+ * signal (see `useOnScreenKeyboardOpen`).
5
+ */
6
+ export declare const useLayoutViewportHeight: () => number;
@@ -4,6 +4,12 @@ export declare const useMobileMediaQuery: () => boolean;
4
4
  export declare const useMaxXsMediaQuery: () => boolean;
5
5
  /** A phone in landscape: too short for a sheet capped at 90vh to leave a usable body. */
6
6
  export declare const useShortViewportMediaQuery: () => boolean;
7
+ /**
8
+ * A short screen for dialogs and pinned bars (pattern PIN-2, ASMA-8737): at most 30em high. Unlike
9
+ * {@link useShortViewportMediaQuery} (`480px`, kept for the Bottom Sheet), `em` in a media query
10
+ * follows the user's default text size, so a larger text setting counts as a shorter screen.
11
+ */
12
+ export declare const useShortScreenMediaQuery: () => boolean;
7
13
  /**
8
14
  * The full-screen picker's one-row header (ASMA-8468 REQ-007): a viewport that is short **and** wide
9
15
  * — a phone in landscape. Short alone is not enough: on an upright phone the on-screen keyboard also
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The visual viewport has shrunk by at least a keyboard's height. iOS Safari and Android Chrome (no
3
+ * `interactive-widget` in the viewport meta) keep `innerHeight` at the full layout height while the
4
+ * visual viewport shrinks above the keyboard. Measured in screen px (`height × scale`), so a pinch
5
+ * zoom does not read as a keyboard.
6
+ */
7
+ export declare const isVisualViewportShrunkByKeyboard: (viewport?: VisualViewport | null | undefined) => boolean;
8
+ /** An element that brings up the on-screen keyboard when focused. */
9
+ export declare const isTextField: (element: Element | null) => element is HTMLElement;
10
+ /**
11
+ * The on-screen keyboard is open: a text field has focus **and** the visual viewport has shrunk by at
12
+ * least a keyboard's height. Both are needed: a hardware keyboard never shrinks the viewport, and a
13
+ * shrunk viewport with no text field focused is a browser toolbar or split screen, not a keyboard.
14
+ */
15
+ export declare const isOnScreenKeyboardOpen: () => boolean;
16
+ /**
17
+ * Shared on-screen keyboard detection (pinned bars PIN-7, ASMA-8737). Use it to step a pinned bar
18
+ * out of the way while the user types; never use the visual viewport to size the layout decision
19
+ * itself, which is made against `window.innerHeight`.
20
+ */
21
+ export declare const useOnScreenKeyboardOpen: () => boolean;
@@ -63,5 +63,11 @@ export * from './components/feedback/minimizable-dialog';
63
63
  export * from './components/custom/pathfinder-card/PathfinderCard';
64
64
  export * from './hooks/usePopupState';
65
65
  export * from './hooks/useRouteHeadingFocus';
66
+ export { useOnScreenKeyboardOpen, isOnScreenKeyboardOpen } from './hooks/useOnScreenKeyboard';
67
+ export { useElementHeightPx } from './hooks/useElementHeightPx';
68
+ export { useVisualViewportHeight } from './hooks/useVisualViewportHeight';
69
+ export { useLayoutViewportHeight } from './hooks/useLayoutViewportHeight';
70
+ export { useShortScreenMediaQuery } from './hooks/useMediaQuery.hook';
71
+ export { useDialogHeaderPinning, PINNED_HEADER_MAX_VIEWPORT_SHARE, type DialogHeaderPinning, } from './components/feedback/dialog/useDialogHeaderPinning';
66
72
  export { useBackCloses, OverlayBackOwnerContext, type OverlayBackRequestClose, type UseBackClosesOptions, } from './hooks/useBackCloses.hook';
67
73
  export { Paper, ClickAwayListener, Avatar, Skeleton, Container, Stack, FormLabel, Fade, Popper, } from './components/mui-compat';
@@ -1,4 +1,5 @@
1
1
  import { cn as p } from "../../helpers/cn.js";
2
+ import { useElementHeightPx as B } from "../../hooks/useElementHeightPx.js";
2
3
  import { RootContextProvider as te } from "../context/RootContext.js";
3
4
  import { mobileView as oe, useWindowWidthSize as re } from "../hooks/useWindowWidthSize.hook.js";
4
5
  import { useStyledTable as ne } from "../hooks/useStyledTable.js";
@@ -7,9 +8,8 @@ import { injectColumns as le } from "../helpers/injectColumns.js";
7
8
  import { TableHeader as se } from "./table-header/TableHeader.js";
8
9
  import { TableBody as ie } from "./TableBody.js";
9
10
  import { Fetching as ae } from "./Fetching.js";
10
- import { TableFooter as B } from "./table-footer/TableFooter.js";
11
+ import { TableFooter as $ } from "./table-footer/TableFooter.js";
11
12
  import { useProxyHorizontalScrollSync as ce } from "./columns/helpers/useProxyHorizontalScrollSync.js";
12
- import { useElementHeightPx as $ } from "./columns/helpers/useElementHeightPx.js";
13
13
  import { useColumnVirtualizer as de } from "../hooks/useColumnVirtualizer.js";
14
14
  import { useLayoutEffect as q, useMemo as O, useRef as L, useState as me } from "react";
15
15
  import { Fragment as X, jsx as t, jsxs as w } from "react/jsx-runtime";
@@ -66,7 +66,7 @@ var Ve = (l) => {
66
66
  H,
67
67
  R
68
68
  ]);
69
- const { ref: Q, heightPx: k } = $(), { ref: U, heightPx: D } = $(), N = o.rowHeight ?? 48, E = a.getRowModel().rows.length, V = o.hideHeader ? 0 : 32, _ = 12, Y = O(() => {
69
+ const { ref: Q, heightPx: k } = B(), { ref: U, heightPx: D } = B(), N = o.rowHeight ?? 48, E = a.getRowModel().rows.length, V = o.hideHeader ? 0 : 32, _ = 12, Y = O(() => {
70
70
  if (N <= 0) return 0;
71
71
  const r = n ? 0 : V + D + _, s = Math.max(0, k - r);
72
72
  return Math.floor(s / N);
@@ -159,7 +159,7 @@ var Ve = (l) => {
159
159
  /* @__PURE__ */ t("div", {
160
160
  ref: U,
161
161
  className: p(e["table-bottom"], T && e["table-bottom--sticky"]),
162
- children: /* @__PURE__ */ t(B, {
162
+ children: /* @__PURE__ */ t($, {
163
163
  table: a,
164
164
  styledTableProps: o,
165
165
  canShowStickyFooter: !1
@@ -168,7 +168,7 @@ var Ve = (l) => {
168
168
  ]
169
169
  }), ee]
170
170
  })
171
- }), n && /* @__PURE__ */ t(B, {
171
+ }), n && /* @__PURE__ */ t($, {
172
172
  table: a,
173
173
  styledTableProps: o,
174
174
  canShowStickyFooter: !0
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.134.1",
6
+ "version": "3.134.2",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",
@@ -1,7 +0,0 @@
1
- import { RefObject } from 'react';
2
- interface ElementHeightPx<T> {
3
- ref: RefObject<T>;
4
- heightPx: number;
5
- }
6
- export declare function useElementHeightPx<T extends HTMLElement>(): ElementHeightPx<T>;
7
- export {};
@@ -1,26 +0,0 @@
1
- import { useLayoutEffect as m, useRef as f, useState as l } from "react";
2
- function g() {
3
- const n = f(null), [s, u] = l(0);
4
- return m(() => {
5
- const e = n.current;
6
- if (!e) return;
7
- let t = 0;
8
- const a = () => {
9
- const c = Math.round(e.getBoundingClientRect().height);
10
- u((i) => i === c ? i : c);
11
- }, r = () => {
12
- cancelAnimationFrame(t), t = requestAnimationFrame(a);
13
- };
14
- r();
15
- const o = new ResizeObserver(r);
16
- return o.observe(e), () => {
17
- cancelAnimationFrame(t), o.disconnect();
18
- };
19
- }, []), {
20
- ref: n,
21
- heightPx: s
22
- };
23
- }
24
- export {
25
- g as useElementHeightPx
26
- };