@declarion/react 0.36.1 → 0.36.3

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.
@@ -1,6 +1,6 @@
1
1
  import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
2
2
  import { En as n, F as r, Hn as i, I as a, Ln as o, Qt as s, Un as c, V as l, Wn as u, an as d, cn as f, f as p, h as m, in as h, jn as g, kt as _, ln as v, m as y, mn as b, nt as x, p as S, pn as C, pt as w, rn as T, rt as E, sn as D, tt as O, un as k, vn as A } from "./ActionRunner-BrXXs8ga.js";
3
- import { E as j, J as M, K as ee, St as N, T as P, Y as F, d as I, et as L, k as R, o as z, pt as B, q as V, r as te, t as ne, tt as re, u as ie, xt as ae } from "./registry-Bnc6QkvA.js";
3
+ import { E as j, J as M, K as ee, St as N, T as P, Y as F, d as I, et as L, k as R, o as z, pt as B, q as V, r as te, t as ne, tt as re, u as ie, xt as ae } from "./registry-D_zbJrLC.js";
4
4
  import { n as oe, r as se, t as ce } from "./dataTableStyles-vwD1mVOP.js";
5
5
  import { Suspense as le, createContext as ue, lazy as H, useCallback as U, useContext as de, useEffect as W, useId as fe, useLayoutEffect as pe, useMemo as G, useRef as K, useState as q } from "react";
6
6
  import { useInfiniteQuery as me, useMutation as he, useQueryClient as ge } from "@tanstack/react-query";
@@ -1,9 +1,9 @@
1
1
  import { s as e, t } from "./DynamicIcon-BWO6QtNF.js";
2
2
  import { F as n, H as r, Hn as i, Jt as a, L as o, Ln as s, P as c, R as l, Un as u, Wn as d, Y as f, Z as p, an as m, b as h, cn as g, ct as _, et as v, fn as y, g as b, ht as x, in as S, it as C, jn as w, m as T, mt as ee, n as E, on as D, p as te, rn as ne, sn as re, st as O, un as ie, v as ae, vn as k } from "./ActionRunner-BrXXs8ga.js";
3
3
  import { I as oe, N as se, P as ce, S as le, f as A, h as j, i as ue, l as de, o as fe, t as M, u as N, v as pe, w as me } from "./RefreshControl-CX_D6PcA.js";
4
- import { $ as he, D as ge, G as _e, H as ve, K as ye, L as P, M as be, O as xe, Q as Se, St as Ce, U as we, W as Te, X as Ee, Z as De, _ as Oe, a as ke, dt as Ae, et as je, ft as Me, i as Ne, nt as Pe, q as Fe, s as Ie, tt as Le, vt as Re, w as ze, z as Be } from "./registry-Bnc6QkvA.js";
4
+ import { $ as he, D as ge, G as _e, H as ve, K as ye, L as P, M as be, O as xe, Q as Se, St as Ce, U as we, W as Te, X as Ee, Z as De, _ as Oe, a as ke, dt as Ae, et as je, ft as Me, i as Ne, nt as Pe, q as Fe, s as Ie, tt as Le, vt as Re, w as ze, z as Be } from "./registry-D_zbJrLC.js";
5
5
  import { n as Ve, r as He, t as Ue } from "./dataTableStyles-vwD1mVOP.js";
6
- import { n as We, t as Ge } from "./LayoutRenderer-BUIoUmFl.js";
6
+ import { n as We, t as Ge } from "./LayoutRenderer-0UKE3pp6.js";
7
7
  import { Fragment as Ke, useCallback as F, useEffect as I, useMemo as L, useRef as qe, useState as R } from "react";
8
8
  import { useLocation as Je, useParams as Ye, useSearchParams as Xe } from "react-router-dom";
9
9
  import { useQuery as Ze, useQueryClient as Qe } from "@tanstack/react-query";
@@ -769,7 +769,7 @@ function G({ icon: t, avatarName: n, title: r, recordId: a, description: o, high
769
769
  display: "flex",
770
770
  alignItems: "center",
771
771
  gap: 6,
772
- flex: _ ? "1 1 100%" : "0 0 auto",
772
+ flex: _ ? "1 1 100%" : "1 1 auto",
773
773
  flexWrap: "wrap",
774
774
  justifyContent: _ ? "flex-start" : "flex-end",
775
775
  minWidth: 0
@@ -1692,8 +1692,7 @@ function Ct({ title: n, recordId: i, editing: a, isNew: o, isRecordDeleted: s, d
1692
1692
  entityActions: m?.actions,
1693
1693
  globalActions: _,
1694
1694
  reservedRightWidth: 0,
1695
- widgetContext: ve,
1696
- fillContainer: !1
1695
+ widgetContext: ve
1697
1696
  }) : null, Se = !o && x ? /* @__PURE__ */ z(M, {
1698
1697
  liveObject: k,
1699
1698
  realtime: oe
@@ -1741,12 +1740,7 @@ function Ct({ title: n, recordId: i, editing: a, isNew: o, isRecordDeleted: s, d
1741
1740
  title: u ? "Fix errors in child rows" : f ? "Fix the highlighted fields" : void 0,
1742
1741
  children: l ? "Saving…" : "Save"
1743
1742
  })] }) : !o && x ? P ? /* @__PURE__ */ B("span", {
1744
- style: {
1745
- display: "inline-flex",
1746
- alignItems: "center",
1747
- gap: 8,
1748
- flexWrap: "nowrap"
1749
- },
1743
+ style: { display: "contents" },
1750
1744
  children: [
1751
1745
  we,
1752
1746
  Se,
@@ -1,8 +1,8 @@
1
1
  import { s as e } from "./DynamicIcon-BWO6QtNF.js";
2
2
  import { A as t, En as n, Ln as r, N as i, Un as a, V as o, Wn as s, _n as c, an as l, cn as u, g as d, jn as f, kn as ee, mt as p, on as m, p as h, rn as g, v as _, vn as te } from "./ActionRunner-BrXXs8ga.js";
3
- import { $ as v, G as ne, Q as re, X as y, Z as b, _ as ie, a as x, c as S, et as C, nt as w, s as T, w as ae } from "./registry-Bnc6QkvA.js";
4
- import { b as E, d as D, f as O, g as k, m as oe, n as A, p as se, r as j, s as M } from "./useProperties-Bqr2yTii.js";
5
- import { t as N } from "./LayoutRenderer-BUIoUmFl.js";
3
+ import { $ as v, G as ne, Q as re, X as y, Z as b, _ as ie, a as x, c as S, et as C, nt as w, s as T, w as ae } from "./registry-D_zbJrLC.js";
4
+ import { b as E, d as D, f as O, g as k, m as oe, n as A, p as se, r as j, s as M } from "./useProperties-C_1KM72K.js";
5
+ import { t as N } from "./LayoutRenderer-0UKE3pp6.js";
6
6
  import { useCallback as P, useEffect as F, useMemo as I, useRef as L, useState as ce } from "react";
7
7
  import { useSearchParams as le } from "react-router-dom";
8
8
  import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
@@ -1,8 +1,16 @@
1
1
  import { type ReactNode } from "react";
2
2
  interface PageHeaderProps {
3
- title: string;
3
+ /** Overrides the screen's declared name. Omit it: `<PageHeader />` renders the
4
+ * screen's own `display.name` from the schema, already localized, so a rename or a
5
+ * translation in YAML reaches the page instead of only the sidebar. Pass a string
6
+ * only for a title the schema cannot know (a record's name, a wizard step). */
7
+ title?: string;
8
+ /** Overrides the screen's declared `display.description`. When either is present the
9
+ * header shows the same small info affordance a list and a record already show;
10
+ * when neither is, the header renders exactly as before. */
11
+ description?: string;
4
12
  backTo?: string;
5
13
  actions?: ReactNode;
6
14
  }
7
- export declare function PageHeader({ title, backTo, actions }: PageHeaderProps): import("react").JSX.Element | null;
15
+ export declare function PageHeader({ title, description, backTo, actions }: PageHeaderProps): import("react").JSX.Element | null;
8
16
  export {};
@@ -118,13 +118,23 @@ export interface ResponsiveActionBarProps {
118
118
  /** Rendering density / measurement strategy. */
119
119
  kind?: "detail" | "toolbar" | "row";
120
120
  /**
121
- * When true (default) a kind="detail" bar stretches to `width: 100%` so it
122
- * can measure the available width and overflow into a "More" menu. Set false
123
- * when the bar shares a single flex row with other controls (e.g. the detail
124
- * header's Refresh/Live pill): a 100%-width bar would wrap onto its own line.
125
- * Content-sized is safe for the header slot, which carries few actions.
121
+ * Which edge the buttons sit on. The bar always takes the row's FREE space (that is
122
+ * what makes its width a granted number rather than one it produced itself), so this
123
+ * says where the buttons sit inside it. Trailing by default: every surface in the
124
+ * product puts its actions on the trailing edge.
126
125
  */
127
- fillContainer?: boolean;
126
+ align?: "leading" | "trailing";
127
+ /**
128
+ * Whether the container constrains the bar at all. Default true.
129
+ *
130
+ * Set false ONLY when the container is sized by the bar's own content and no row
131
+ * grants it a width - today that is the floating bulk-selection pill. Measuring such
132
+ * a container compares the bar with itself: the fit test has zero headroom, one
133
+ * sub-pixel disagreement collapses a button into the menu, and the container then
134
+ * shrink-wraps around the menu so the button can never come back. An unconstrained
135
+ * bar renders every action inline and lets its container wrap.
136
+ */
137
+ constrain?: boolean;
128
138
  /**
129
139
  * Test seam: when provided, overrides the measurement decision for each
130
140
  * node. Return true = node fits inline; false = overflows to More.
@@ -195,7 +205,7 @@ interface LayoutDecision {
195
205
  /** Pinned trailing-anchor group; never overflows. Plan §3 partition. */
196
206
  destructiveInline: ResolvedActionLeaf[];
197
207
  }
198
- export declare function computeLayout(nodes: ResolvedActionLayoutNode[], containerWidth: number, reservedRightWidth: number, measuredWidths: Map<string, number>, entityActions: Record<string, Action> | undefined, globalActions: Record<string, Action> | undefined, measurementOverride?: (node: ResolvedActionLayoutNode) => boolean, prevInline?: ReadonlySet<string>): LayoutDecision;
208
+ export declare function computeLayout(nodes: ResolvedActionLayoutNode[], containerWidth: number, reservedRightWidth: number, measuredWidths: Map<string, number>, entityActions: Record<string, Action> | undefined, globalActions: Record<string, Action> | undefined, measurementOverride?: (node: ResolvedActionLayoutNode) => boolean): LayoutDecision;
199
209
  /**
200
210
  * ResponsiveActionBar renders a resolved action layout tree.
201
211
  *
@@ -203,5 +213,5 @@ export declare function computeLayout(nodes: ResolvedActionLayoutNode[], contain
203
213
  * kind="row": single kebab "⋮" with all actions in dropdown.
204
214
  * kind default: "toolbar".
205
215
  */
206
- export declare function ResponsiveActionBar({ layout, row, rowSelection, onRun, reservedRightWidth, kind, fillContainer, measurementOverride, entityActions, globalActions, ariaLabel, trailingNormalItems, trailingDestructiveItems, widgetContext, onActionClick, }: ResponsiveActionBarProps): import("react").JSX.Element | null;
216
+ export declare function ResponsiveActionBar({ layout, row, rowSelection, onRun, reservedRightWidth, kind, align, constrain, measurementOverride, entityActions, globalActions, ariaLabel, trailingNormalItems, trailingDestructiveItems, widgetContext, onActionClick, }: ResponsiveActionBarProps): import("react").JSX.Element | null;
207
217
  export {};
@@ -0,0 +1,34 @@
1
+ import { type ReactNode } from "react";
2
+ import type { Screen } from "../types/schema";
3
+ /**
4
+ * The screen a component is currently rendering inside.
5
+ *
6
+ * Standard pages have always been told which screen they are (`SmartListPage`,
7
+ * `SmartDetailPage` and `SmartRecordListPage` all take `screenCode`). A CUSTOM screen
8
+ * was told nothing - it was mounted as a bare `<Component />` - so it could not read
9
+ * its own declaration and had no choice but to hardcode what the schema already said.
10
+ * That is why a screen renamed or translated in YAML kept an English literal in its
11
+ * header while the sidebar followed the schema.
12
+ *
13
+ * This context closes that gap: every routed screen, custom included, is rendered
14
+ * inside it, so any component in the tree can ask what it is looking at without prop
15
+ * drilling. `PageHeader` uses it to default its title and description - which is what
16
+ * makes `<PageHeader />` with no props the correct, complete header for a custom screen.
17
+ */
18
+ export interface CurrentScreen {
19
+ /** The screen's code in the schema (e.g. `events_compare`). */
20
+ code: string;
21
+ /** Its full declaration, or undefined if the schema has not loaded yet. */
22
+ screen: Screen | undefined;
23
+ }
24
+ export declare function CurrentScreenProvider({ code, children, }: {
25
+ code: string;
26
+ children: ReactNode;
27
+ }): import("react").JSX.Element;
28
+ /**
29
+ * The screen this component is rendering inside, or undefined outside a routed screen.
30
+ *
31
+ * Use it to read anything the schema already declares - the localized name, the
32
+ * description, the entity, the route - instead of restating it in the component.
33
+ */
34
+ export declare function useCurrentScreen(): CurrentScreen | undefined;
@@ -15,6 +15,8 @@ export type { BatchOp, BatchOpResult, BatchResponse } from "./api/batch";
15
15
  export { useSchema } from "./hooks/useSchema";
16
16
  export { useEntity } from "./hooks/useEntity";
17
17
  export { useScreen } from "./hooks/useScreen";
18
+ export { useCurrentScreen } from "./hooks/useCurrentScreen";
19
+ export type { CurrentScreen } from "./hooks/useCurrentScreen";
18
20
  export { useAuth } from "./hooks/useAuth";
19
21
  export { useEntityData, useEntityCount, entityDataQueryKey } from "./hooks/useEntityData";
20
22
  export { useCursorEntityData, cursorEntityDataQueryKey, cursorEntityStableKey, } from "./hooks/useCursorEntityData";
@@ -37,6 +39,7 @@ export { useColumns } from "./hooks/useColumns";
37
39
  export { useViews } from "./hooks/useViews";
38
40
  export { useParams, useNavigate, useLocation, useSearchParams } from "react-router-dom";
39
41
  export { registerScreen } from "./stores/screen-registry";
42
+ export type { CustomScreenProps } from "./stores/screen-registry";
40
43
  export { setIconRegistry, getIcon } from "./stores/icon-registry";
41
44
  export type { IconDef } from "./stores/icon-registry";
42
45
  export { registerLayoutWidget, getLayoutWidget, hasLayoutWidget, type LayoutWidget, type LayoutWidgetProps, } from "./components/detail-layout/widgets/registry";