asma-ui-core 3.110.0 → 3.112.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.
@@ -44,7 +44,10 @@ export interface StyledInputFieldProps {
44
44
  expandHelperText?: boolean;
45
45
  /** Character limit; also readable from `slotProps.htmlInput.maxLength`. */
46
46
  maxLength?: number;
47
- /** Shows the count against `maxLength` as the user types, for free text with a limit. */
47
+ /**
48
+ * Count against `maxLength`, on by default whenever the field has a limit (WID-12). Pass `false`
49
+ * for a fixed format such as a postal code, whose length the label or hint already states.
50
+ */
48
51
  counter?: boolean;
49
52
  /** Language of the counter text. */
50
53
  locale?: UiCoreLocale;
@@ -11,6 +11,7 @@ export interface CharacterCounterProps {
11
11
  }
12
12
  /**
13
13
  * The count of a free-text field with a character limit, such as *12 av 100 tegn* (field width
14
- * pattern WID-2, Q12), so typed text is never cut without notice.
14
+ * pattern WID-2, WID-12), so typed text is never cut without notice.
15
+ * @figmaNode wXrXt5uKNNzV2DnQCgyYZH#45907-218317
15
16
  */
16
17
  export declare const CharacterCounter: ({ id, length, limit, locale, className }: CharacterCounterProps) => JSX.Element;
@@ -67,6 +67,17 @@ declare global {
67
67
  * {@link useBackCloses} for the React lifecycle wrapper every consumer actually uses.
68
68
  */
69
69
  export declare function registerOverlayBackCloser(requestClose: OverlayBackRequestClose, owner?: Element | null, parentOwner?: Element | null, ownerRef?: RefObject<Element | null>, parentOwnerRef?: RefObject<Element | null>): () => void;
70
+ /**
71
+ * Declares "overlays rendered below me in the React tree are nested inside me", which is what makes
72
+ * one Back press close the inner one first (BACK-2).
73
+ *
74
+ * Needed because an overlay is usually portalled out of its parent's DOM subtree, so DOM
75
+ * containment cannot carry the relationship — only the React tree still knows it. Wrap your
76
+ * surface's children in `<OverlayBackOwnerContext.Provider value={yourOwnerRef}>`, passing the same
77
+ * ref you gave {@link useBackCloses} as `ownerRef`. Every ui-core overlay already does this; an app
78
+ * wiring up an overlay of its own should too, otherwise a ui-core overlay opened inside it is
79
+ * ordered by registration time alone and Back may close the outer surface first.
80
+ */
70
81
  export declare const OverlayBackOwnerContext: import('react').Context<RefObject<Element | null> | undefined>;
71
82
  /**
72
83
  * Act on the topmost registered overlay, honouring the close contract's latch: a top entry whose
@@ -83,6 +94,16 @@ export declare function requestCloseTopOverlayBack(event?: Event): false | void
83
94
  export declare function getOverlayBackStackSize(): number;
84
95
  /** `true` when a live `asma-core-helpers` history adapter (PAT-002) has published `overlayBack.v === 1`. */
85
96
  export declare function hasOverlayBackAdapter(): boolean;
97
+ /**
98
+ * `true` while the history adapter is holding a route change, waiting for the top overlay to close
99
+ * before it navigates (design-plan rule 1 — `push` is deferred, not cancelled).
100
+ *
101
+ * A surface that is *meant* to outlive navigation — the shell-level docked minimizable panels — tells
102
+ * the adapter so by returning `false` from its closer in this window. The adapter reads that as
103
+ * fail-open: it strips the guard, runs the navigation, and leaves the surface open. Anything that
104
+ * should close on navigation simply ignores this and closes as usual.
105
+ */
106
+ export declare function isOverlayBackNavigationPending(): boolean;
86
107
  /** Native close-watcher events are part of the feature and must respect the host kill switch. */
87
108
  export declare function isOverlayBackEnabled(): boolean;
88
109
  /**
@@ -92,10 +113,34 @@ export declare function isOverlayBackEnabled(): boolean;
92
113
  * `asma-core-helpers`' own listener (CON-002/CON-009) and duplicate work the adapter already owns. The
93
114
  * adapter registration itself (see {@link registerOverlayBackCloser}) is driven purely by the stack's
94
115
  * empty/non-empty transitions, not by this hook.
116
+ *
117
+ * Pass `ownerRef` wherever the surface has a stable root element: it is what places the entry
118
+ * relative to a nested child (`isOwnedBy`) and to an open native modal
119
+ * ({@link isCoveredByOpenModalDialog}).
95
120
  */
96
- export declare function useBackCloses({ active, requestClose, ownerRef, }: {
121
+ export interface UseBackClosesOptions {
122
+ /**
123
+ * Register while `true`, unregister while `false` — normally the surface's own "is showing"
124
+ * state. Keep it off for a state that is visible but not dismissable as an overlay (a minimized
125
+ * panel), so Back reaches whatever is behind it instead.
126
+ */
97
127
  active: boolean;
128
+ /**
129
+ * The surface's existing close path — the same function its ✕ or Escape already calls. Never a
130
+ * synthetic key event. Return nothing for a plain dismissal; return a Promise to latch the
131
+ * surface while an async close runs (Back does nothing until it settles); return `false` to
132
+ * refuse this press, which is also how a surface that must survive navigation opts out of the
133
+ * adapter's deferred route change.
134
+ */
98
135
  requestClose: OverlayBackRequestClose;
136
+ /**
137
+ * The surface's own root element — the one that is actually painted on top. Pass it wherever
138
+ * there is one. It is what lets Back order this surface against an overlay nested inside it and
139
+ * against an open native modal `<dialog>`; without it the entry is ordered by registration
140
+ * time alone. For a surface promoted into the top layer via the Popover API, this must be the
141
+ * element carrying the `popover` attribute, not a wrapper around it.
142
+ */
99
143
  ownerRef?: RefObject<Element | null>;
100
- }): void;
144
+ }
145
+ export declare function useBackCloses({ active, requestClose, ownerRef }: UseBackClosesOptions): void;
101
146
  export {};
@@ -65,6 +65,12 @@ export declare function registerOpenModalDialog(dialog: HTMLDialogElement): () =
65
65
  * modal is open. Stale entries (a dialog torn down without its cleanup running) are skipped rather
66
66
  * than trusted, so a missed unregister can never strand an overlay in a detached subtree.
67
67
  */
68
+ /**
69
+ * The newest connected modal `<dialog>` for which `accept` returns true.
70
+ * `getTopmostOpenModalDialog` is the `dialog.open` case. Back arbitration passes a wider accept,
71
+ * because a forced native close sets `open` to false before React unregisters the dialog.
72
+ */
73
+ export declare function findTopmostConnectedModalDialog(accept: (dialog: HTMLDialogElement) => boolean): HTMLDialogElement | undefined;
68
74
  export declare function getTopmostOpenModalDialog(): HTMLDialogElement | undefined;
69
75
  /**
70
76
  * Reactive {@link getTopmostOpenModalDialog} — re-renders the caller when a modal `<dialog>` opens or
@@ -59,4 +59,5 @@ export * from './components/feedback/minimizable-dialog';
59
59
  export * from './components/custom/pathfinder-card/PathfinderCard';
60
60
  export * from './hooks/usePopupState';
61
61
  export * from './hooks/useRouteHeadingFocus';
62
+ export { useBackCloses, OverlayBackOwnerContext, type OverlayBackRequestClose, type UseBackClosesOptions, } from './hooks/useBackCloses.hook';
62
63
  export { Paper, ClickAwayListener, Avatar, Skeleton, Container, Stack, FormLabel, Fade, Popper, } from './components/mui-compat';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "3.110.0",
6
+ "version": "3.112.0",
7
7
  "type": "module",
8
8
  "sideEffects": [
9
9
  "**/*.css",