@dataverse-kit/form-runtime 0.1.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/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/businessRules-U1_MBgyG.d.cts +372 -0
- package/dist/businessRules-U1_MBgyG.d.ts +372 -0
- package/dist/context.cjs +151 -0
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +132 -0
- package/dist/context.d.ts +132 -0
- package/dist/context.mjs +113 -0
- package/dist/context.mjs.map +1 -0
- package/dist/control-DFOg_pc_.d.cts +1027 -0
- package/dist/control-DaXBm-52.d.ts +1027 -0
- package/dist/gridCustomizer-C0V9FAE_.d.ts +569 -0
- package/dist/gridCustomizer-mJO-kmQ4.d.cts +569 -0
- package/dist/hooks.cjs +85 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +24 -0
- package/dist/hooks.d.ts +24 -0
- package/dist/hooks.mjs +60 -0
- package/dist/hooks.mjs.map +1 -0
- package/dist/icons.cjs +202 -0
- package/dist/icons.cjs.map +1 -0
- package/dist/icons.d.cts +130 -0
- package/dist/icons.d.ts +130 -0
- package/dist/icons.mjs +165 -0
- package/dist/icons.mjs.map +1 -0
- package/dist/index.cjs +6509 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +410 -0
- package/dist/index.d.ts +410 -0
- package/dist/index.mjs +6490 -0
- package/dist/index.mjs.map +1 -0
- package/dist/runtime-capabilities-BdGDdu0d.d.cts +119 -0
- package/dist/runtime-capabilities-Brfc7loJ.d.ts +119 -0
- package/dist/theme-BfeZIxmZ.d.cts +74 -0
- package/dist/theme-BfeZIxmZ.d.ts +74 -0
- package/dist/theme.cjs +215 -0
- package/dist/theme.cjs.map +1 -0
- package/dist/theme.d.cts +32 -0
- package/dist/theme.d.ts +32 -0
- package/dist/theme.mjs +186 -0
- package/dist/theme.mjs.map +1 -0
- package/dist/types.cjs +976 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +813 -0
- package/dist/types.d.ts +813 -0
- package/dist/types.mjs +902 -0
- package/dist/types.mjs.map +1 -0
- package/dist/utils.cjs +250 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +99 -0
- package/dist/utils.d.ts +99 -0
- package/dist/utils.mjs +220 -0
- package/dist/utils.mjs.map +1 -0
- package/dist/v8.cjs +4622 -0
- package/dist/v8.cjs.map +1 -0
- package/dist/v8.d.cts +730 -0
- package/dist/v8.d.ts +730 -0
- package/dist/v8.mjs +4622 -0
- package/dist/v8.mjs.map +1 -0
- package/dist/v9.cjs +19 -0
- package/dist/v9.cjs.map +1 -0
- package/dist/v9.d.cts +2 -0
- package/dist/v9.d.ts +2 -0
- package/dist/v9.mjs +1 -0
- package/dist/v9.mjs.map +1 -0
- package/package.json +113 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import { ControlPartProps } from './v8.cjs';
|
|
2
|
+
export { ButtonControl, ChartBranch, ChartBranchProps, ChartRenderer, ChartRendererEntry, ChartRendererProps, CheckboxControl, ChoiceGroupBranch, ChoiceGroupControl, ChoiceGroupControlProps, ComboBoxControl, DateControl, DropdownControl, EmojiRating, EmojiRatingProps, FocusedCardData, FocusedCardRow, FocusedViewMasterDetailPreview, FocusedViewMasterDetailPreviewProps, FormLinkControl, GridMockDataGenerator, LabelControl, LookupBranch, LookupControl, LookupControlProps, LookupSearchCapability, NestedRecordsCallout, NestedRecordsCalloutProps, NestedRecordsSidePanel, NestedRecordsSidePanelProps, NestedRecordsTrigger, NestedRecordsTriggerProps, NumberControl, PersonaControl, RatingControl, SliderControl, SpacerControl, SpinButtonControl, SubgridBranch, SubgridBranchProps, TextControl, TextFieldWithFormat, TextFieldWithFormatProps, TextareaControl, TimelineControl, ToggleControl, UnknownControl, WebResourceBranch, WebResourceRenderer, WebResourceRendererProps, isChartControlType, isDisabled, isEmbeddedEntityBrowser, lookupEntityHelpers, renderGridCell } from './v8.cjs';
|
|
3
|
+
import { O as FormDefinition, q as CommandBarItem, F as DialogActionButton, x as ControlDefinition, U as FormSection, h as CalloutDefinition, i as CalloutDirectionalHint, l as CalloutTrigger } from './control-DFOg_pc_.cjs';
|
|
4
|
+
import { F as FieldState, S as SectionState, T as TabState } from './businessRules-U1_MBgyG.cjs';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
export { CalloutsProvider, CalloutsProviderProps, FormRuntimeProvider, FormRuntimeProviderProps, RuleStatesContextValue, RuleStatesProvider, RuleStatesProviderProps, TabContentSlots, TabContentSlotsProvider, TabContentSlotsProviderProps, useCallout, useFieldState, useFormRuntimeContext, useOptionalFormRuntimeContext, useRuleStates, useSectionState, useTabContentSlots, useTabState } from './context.cjs';
|
|
7
|
+
export { UseLiveDataResult, useLiveData } from './hooks.cjs';
|
|
8
|
+
import { DirectionalHint } from '@fluentui/react';
|
|
9
|
+
import './gridCustomizer-mJO-kmQ4.cjs';
|
|
10
|
+
import './runtime-capabilities-BdGDdu0d.cjs';
|
|
11
|
+
import './theme-BfeZIxmZ.cjs';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Designer-mode instrumentation helpers.
|
|
15
|
+
*
|
|
16
|
+
* When `<FormRuntime instrumentation="designer">` is mounted, every
|
|
17
|
+
* structural element (tab, section, row, cell, control, header,
|
|
18
|
+
* command-bar item, grid item) gets `data-element-id`,
|
|
19
|
+
* `data-element-type`, and `data-element-path` attributes so the
|
|
20
|
+
* designer overlay (Phase 2) can locate, measure, and decorate them
|
|
21
|
+
* with selection chrome, drop zones, badges, etc.
|
|
22
|
+
*
|
|
23
|
+
* The helpers return plain attribute objects rather than React props
|
|
24
|
+
* so they're trivial to spread onto host elements without importing
|
|
25
|
+
* `@types/react` into the surface (matches the same pattern used by
|
|
26
|
+
* `gridLayoutUtils.GridPositionStyle`).
|
|
27
|
+
*/
|
|
28
|
+
type InstrumentationMode = 'designer' | 'off';
|
|
29
|
+
type ElementType = 'header' | 'commandBarItem' | 'tab' | 'column' | 'section' | 'row' | 'cell' | 'control' | 'gridItem' | 'bpf';
|
|
30
|
+
interface InstrumentationAttrs {
|
|
31
|
+
'data-element-id'?: string;
|
|
32
|
+
'data-element-type'?: ElementType;
|
|
33
|
+
'data-element-path'?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Emit instrumentation attributes for a structural element. When the
|
|
37
|
+
* runtime isn't in designer mode, returns an empty object so the
|
|
38
|
+
* spread is a no-op and no extra DOM attributes are emitted in
|
|
39
|
+
* deployed runtimes.
|
|
40
|
+
*/
|
|
41
|
+
declare function instrumentAttrs(mode: InstrumentationMode, id: string, type: ElementType, path?: string): InstrumentationAttrs;
|
|
42
|
+
/** Path helpers — string composition so paths read top-down. */
|
|
43
|
+
declare const paths: {
|
|
44
|
+
header(): string;
|
|
45
|
+
commandBarItem(itemId: string): string;
|
|
46
|
+
tab(tabId: string): string;
|
|
47
|
+
column(tabPath: string, colIdx: number): string;
|
|
48
|
+
section(parentPath: string, sectionId: string): string;
|
|
49
|
+
row(sectionPath: string, rowId: string): string;
|
|
50
|
+
cell(rowPath: string, cellId: string): string;
|
|
51
|
+
control(cellPath: string, controlName: string): string;
|
|
52
|
+
gridItem(sectionId: string): string;
|
|
53
|
+
callout(parentPath: string, calloutId: string): string;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
interface FormRuntimeProps {
|
|
57
|
+
/** The form definition to render (tabs, sections, controls, etc.). */
|
|
58
|
+
form: FormDefinition;
|
|
59
|
+
/**
|
|
60
|
+
* Initial record values. Keyed by `dataBinding.attributeLogicalName`
|
|
61
|
+
* (and the `…@OData.Community.Display.V1.FormattedValue` annotations
|
|
62
|
+
* Dataverse returns). The dispatcher reads from this when a control
|
|
63
|
+
* has a binding and no controlled override.
|
|
64
|
+
*/
|
|
65
|
+
recordData?: Record<string, unknown> | null;
|
|
66
|
+
/**
|
|
67
|
+
* `false` disables every input control + reveals the legacy
|
|
68
|
+
* "designer affordances" inside per-type files (e.g. spacer/label
|
|
69
|
+
* placeholder outlines). Default `true`.
|
|
70
|
+
*/
|
|
71
|
+
interactive?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* `'designer'` emits `data-element-id` / `data-element-type` /
|
|
74
|
+
* `data-element-path` attributes on every structural element so the
|
|
75
|
+
* Phase 2 designer overlay can locate them. Default `'off'`.
|
|
76
|
+
*/
|
|
77
|
+
instrumentation?: InstrumentationMode;
|
|
78
|
+
/**
|
|
79
|
+
* Optional click handler for command-bar items. The runtime stays
|
|
80
|
+
* neutral on what an item does — the host decides.
|
|
81
|
+
*/
|
|
82
|
+
onCommandClick?: (item: CommandBarItem) => void;
|
|
83
|
+
/** Optional button-click handler propagated into `DispatchedControl`. */
|
|
84
|
+
onButtonClick?: (action: unknown) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Optional value-change handler. When omitted, edits are tracked
|
|
87
|
+
* internally via the runtime's local `useFormState` so the user can
|
|
88
|
+
* still interact with controls. Hosts that own form state pass
|
|
89
|
+
* `onChange` to take over.
|
|
90
|
+
*/
|
|
91
|
+
onChange?: (controlName: string, next: unknown) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Optional dialog/panel footer action-button click handler. Phase 3
|
|
94
|
+
* m3 — the runtime emits the buttons but stays neutral on actions;
|
|
95
|
+
* the host (preview wrapper or generated app) decides what 'close'
|
|
96
|
+
* / 'save' / 'cancel' etc. do.
|
|
97
|
+
*/
|
|
98
|
+
onActionButtonClick?: (button: DialogActionButton) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Optional business-rule evaluation outputs. The runtime consumes
|
|
101
|
+
* these to gate field / section / tab visibility and merge
|
|
102
|
+
* readOnly + required overrides into individual controls. Phase 3
|
|
103
|
+
* m4. The runtime does NOT own the rule engine — pass the maps
|
|
104
|
+
* from the host's rule-execution store (form-builder uses
|
|
105
|
+
* useRuleExecutionStore; generated apps pass equivalent maps).
|
|
106
|
+
*/
|
|
107
|
+
ruleStates?: {
|
|
108
|
+
fieldStates?: Record<string, FieldState>;
|
|
109
|
+
sectionStates?: Record<string, SectionState>;
|
|
110
|
+
tabStates?: Record<string, TabState>;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
declare const FormRuntime: React.FC<FormRuntimeProps>;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Control dispatcher — maps a `ControlDefinition.type` to the
|
|
117
|
+
* per-type renderer extracted in Phase 6.5f (Task 17). The dispatcher
|
|
118
|
+
* is the single place that knows the full control taxonomy; the
|
|
119
|
+
* surrounding `<FormRuntime>` shell pulls value/effectiveValue
|
|
120
|
+
* computation up here so per-type files stay focused on UI.
|
|
121
|
+
*
|
|
122
|
+
* Routes legacy + chart types:
|
|
123
|
+
* - `phone` / `email` / `url` → `UnknownControl` (legacy fallback
|
|
124
|
+
* handles them via the `LEGACY_FORMAT_MAP`)
|
|
125
|
+
* - 12 chart types → `ChartBranch`
|
|
126
|
+
* - other type literals → the matching per-type file
|
|
127
|
+
* - anything else → `UnknownControl`
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
type ControlComponent = React.FC<ControlPartProps>;
|
|
131
|
+
/**
|
|
132
|
+
* Resolve which per-type component should render `controlType`. Returns
|
|
133
|
+
* `UnknownControl` for any type not in the registry (covers the legacy
|
|
134
|
+
* phone/email/url path inside UnknownControl plus genuinely unknown
|
|
135
|
+
* future types). Chart types route to `ChartBranch`.
|
|
136
|
+
*/
|
|
137
|
+
declare function resolveControlComponent(controlType: string): ControlComponent;
|
|
138
|
+
/**
|
|
139
|
+
* Inputs the dispatcher needs from the surrounding shell to compute
|
|
140
|
+
* `ControlPartProps` for the resolved component.
|
|
141
|
+
*/
|
|
142
|
+
interface DispatchControlInputs {
|
|
143
|
+
control: ControlDefinition;
|
|
144
|
+
/** Controlled value override (takes precedence over record-bound value). */
|
|
145
|
+
controlledValue?: unknown;
|
|
146
|
+
/** Bound record (live or mock). When supplied, looked up by attribute name. */
|
|
147
|
+
recordData?: Record<string, unknown> | null;
|
|
148
|
+
/** When false, controls disable and the legacy designMode affordances show. */
|
|
149
|
+
interactive: boolean;
|
|
150
|
+
/** Bubbles up edits — same shape every per-type file expects. */
|
|
151
|
+
onChange?: (next: unknown) => void;
|
|
152
|
+
/** Bubbles up button-click actions (used by ButtonControl + FormLinkControl). */
|
|
153
|
+
onButtonClick?: (action: unknown) => void;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Build the `ControlPartProps` the resolved per-type file expects.
|
|
157
|
+
* The shell calls this once per cell so per-type files don't each
|
|
158
|
+
* repeat the value-precedence rule.
|
|
159
|
+
*/
|
|
160
|
+
declare function buildControlPartProps(inputs: DispatchControlInputs): ControlPartProps;
|
|
161
|
+
/**
|
|
162
|
+
* Stateless dispatch component. Resolves the per-type renderer for
|
|
163
|
+
* `control.type` and forwards the computed `ControlPartProps`.
|
|
164
|
+
* Wrap with `<FormRuntime>` to get value resolution + instrumentation;
|
|
165
|
+
* tests can use this directly with hand-rolled props.
|
|
166
|
+
*/
|
|
167
|
+
declare const DispatchedControl: React.FC<DispatchControlInputs>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* HeaderShell — main-form top banner (title, subtitle, 0–4 cell slots).
|
|
171
|
+
*
|
|
172
|
+
* Two rendering modes governed by `form.settings.headerDisplayMode`:
|
|
173
|
+
*
|
|
174
|
+
* - `'inline'` (or absent — the runtime's current default): cells
|
|
175
|
+
* render in a CSS grid alongside the title. Each cell dispatches
|
|
176
|
+
* through the runtime's normal control dispatcher.
|
|
177
|
+
*
|
|
178
|
+
* - `'flyout'` (Phase 3 m5): cells render as compact label/value
|
|
179
|
+
* summary tiles separated by vertical bars, with a chevron toggle
|
|
180
|
+
* on the right. Clicking the chevron opens a Callout containing
|
|
181
|
+
* the same cells as editable controls — matches the legacy
|
|
182
|
+
* `HeaderFieldSummaryPreview` + flyout in
|
|
183
|
+
* apps/form-builder/.../form-preview/FormPreview.tsx.
|
|
184
|
+
*
|
|
185
|
+
* The legacy preview also fetched lookup entity images and presence
|
|
186
|
+
* for systemuser lookups via direct Dataverse calls. That belongs in
|
|
187
|
+
* a FormRuntimeCapabilities enhancement, not the shell itself — for
|
|
188
|
+
* now the persona renders with initials only (the universal baseline).
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
interface HeaderShellProps {
|
|
192
|
+
form: FormDefinition;
|
|
193
|
+
recordData?: Record<string, unknown> | null;
|
|
194
|
+
interactive: boolean;
|
|
195
|
+
instrumentation: InstrumentationMode;
|
|
196
|
+
/**
|
|
197
|
+
* Pass-through so the dispatcher's button-click handler can route
|
|
198
|
+
* up to the host (open record, run action, etc.).
|
|
199
|
+
*/
|
|
200
|
+
onButtonClick?: DispatchControlInputs['onButtonClick'];
|
|
201
|
+
}
|
|
202
|
+
declare const HeaderShell: React.FC<HeaderShellProps>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* CommandBarShell — top command bar for main forms.
|
|
206
|
+
*
|
|
207
|
+
* Renders the configured `FormDefinition.commandBar` items as Fluent UI
|
|
208
|
+
* v8 CommandBar buttons. Overflow / far positions are honored via
|
|
209
|
+
* Fluent's `overflowItems` and `farItems`. Click handlers route up
|
|
210
|
+
* through `onCommandClick` so the host decides what to do (save,
|
|
211
|
+
* navigate, run action).
|
|
212
|
+
*/
|
|
213
|
+
|
|
214
|
+
interface CommandBarShellProps {
|
|
215
|
+
form: FormDefinition;
|
|
216
|
+
interactive: boolean;
|
|
217
|
+
instrumentation: InstrumentationMode;
|
|
218
|
+
onCommandClick?: (item: CommandBarItem) => void;
|
|
219
|
+
}
|
|
220
|
+
declare const CommandBarShell: React.FC<CommandBarShellProps>;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* BpfShell — Business Process Flow progress indicator.
|
|
224
|
+
*
|
|
225
|
+
* Scaffolded for Phase 1. The BPF designer + progress indicators live
|
|
226
|
+
* in the form-builder app today; this shell renders a minimal stage
|
|
227
|
+
* strip so the runtime tree has somewhere to drop the BPF in
|
|
228
|
+
* `<FormRuntime>`. The full pivot through stages / steps + the chevron
|
|
229
|
+
* / circle / minimal variants land in a follow-up.
|
|
230
|
+
*
|
|
231
|
+
* When the form has no `bpfId`, the shell renders nothing.
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
interface BpfShellProps {
|
|
235
|
+
form: FormDefinition;
|
|
236
|
+
instrumentation: InstrumentationMode;
|
|
237
|
+
}
|
|
238
|
+
declare const BpfShell: React.FC<BpfShellProps>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* TabsShell — tabbed-form layout. Renders the tab strip plus the
|
|
242
|
+
* sections of the active main tab. Related / audit tabs render a
|
|
243
|
+
* placeholder until those surfaces fully migrate to runtime (Phase 1+
|
|
244
|
+
* follow-up).
|
|
245
|
+
*/
|
|
246
|
+
|
|
247
|
+
interface TabsShellProps {
|
|
248
|
+
form: FormDefinition;
|
|
249
|
+
recordData?: Record<string, unknown> | null;
|
|
250
|
+
interactive: boolean;
|
|
251
|
+
instrumentation: InstrumentationMode;
|
|
252
|
+
onCellValueChange?: (controlName: string, next: unknown) => void;
|
|
253
|
+
onButtonClick?: DispatchControlInputs['onButtonClick'];
|
|
254
|
+
}
|
|
255
|
+
declare const TabsShell: React.FC<TabsShellProps>;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* GridShell — dashboard-layout form. Picks the grid-mode host
|
|
259
|
+
* (first main tab's sections, or flat `form.sections`) and places
|
|
260
|
+
* each section onto a CSS Grid using `gridLayoutUtils.gridPositionStyle`.
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
interface GridShellProps {
|
|
264
|
+
form: FormDefinition;
|
|
265
|
+
recordData?: Record<string, unknown> | null;
|
|
266
|
+
interactive: boolean;
|
|
267
|
+
instrumentation: InstrumentationMode;
|
|
268
|
+
onCellValueChange?: (controlName: string, next: unknown) => void;
|
|
269
|
+
onButtonClick?: DispatchControlInputs['onButtonClick'];
|
|
270
|
+
}
|
|
271
|
+
declare const GridShell: React.FC<GridShellProps>;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* SectionShell — renders a single FormSection's rows + cells + controls.
|
|
275
|
+
*
|
|
276
|
+
* Phase 3 m1 grew this file to honor the FormSection fields that the
|
|
277
|
+
* legacy `SectionPreview` (apps/form-builder/.../FormPreview.tsx) was
|
|
278
|
+
* already rendering and the runtime canvas had been ignoring:
|
|
279
|
+
* - `variant: 'placeholder'` → render an empty spacer
|
|
280
|
+
* - `minHeight` / `widthPercent` → section dimensions
|
|
281
|
+
* - `background` (color / image / gradient) → per-section override
|
|
282
|
+
* - `collapsible` → header click toggles expanded state
|
|
283
|
+
* - `collapseHidden` → skip rows where every cell's control is hidden
|
|
284
|
+
* - `labelPosition` / `labelWidth` / `wrapLabel` → section-level
|
|
285
|
+
* defaults that cascade into controls without explicit values
|
|
286
|
+
* - control-level `hidden` → cell becomes visibility-hidden
|
|
287
|
+
*
|
|
288
|
+
* These were preview-only features in the legacy code. Lifting them
|
|
289
|
+
* into the runtime makes both the editor canvas AND the preview
|
|
290
|
+
* surface render identically — the goal of the WYSIWYG-canvas refactor.
|
|
291
|
+
*/
|
|
292
|
+
|
|
293
|
+
interface SectionShellProps {
|
|
294
|
+
section: FormSection;
|
|
295
|
+
parentPath: string;
|
|
296
|
+
recordData?: Record<string, unknown> | null;
|
|
297
|
+
interactive: boolean;
|
|
298
|
+
instrumentation: InstrumentationMode;
|
|
299
|
+
onCellValueChange?: (controlName: string, next: unknown) => void;
|
|
300
|
+
onButtonClick?: DispatchControlInputs['onButtonClick'];
|
|
301
|
+
}
|
|
302
|
+
declare const SectionShell: React.FC<SectionShellProps>;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* FooterShell — dialog/panel footer with action buttons.
|
|
306
|
+
*
|
|
307
|
+
* Phase 3 m3. Replaces the legacy DialogButtonsBlock /
|
|
308
|
+
* PanelButtonsBlock and the `renderDialogButton` helpers from
|
|
309
|
+
* apps/form-builder/.../form-preview/FormPreview.tsx.
|
|
310
|
+
*
|
|
311
|
+
* Reads buttons from `form.settings.dialogButtons` (form.type=dialog)
|
|
312
|
+
* or `form.settings.panelButtons` (form.type=panel). When neither is
|
|
313
|
+
* configured, falls back to a single Close button — same default as
|
|
314
|
+
* the legacy `createDefaultDialogButtons()`.
|
|
315
|
+
*
|
|
316
|
+
* Buttons split into a left group and a right group; alignment of
|
|
317
|
+
* the whole footer is controlled by `dialogButtonAlignment` /
|
|
318
|
+
* `panelButtonAlignment` ('left' | 'center' | 'right'; default 'right').
|
|
319
|
+
*
|
|
320
|
+
* Click actions are not dispatched here. The legacy `renderDialogButton`
|
|
321
|
+
* also doesn't wire onClick — actions get processed by the host. The
|
|
322
|
+
* runtime exposes `onActionButtonClick` so callers (preview, host)
|
|
323
|
+
* can opt in. Business-rules-driven button state lands in m4.
|
|
324
|
+
*/
|
|
325
|
+
|
|
326
|
+
interface FooterShellProps {
|
|
327
|
+
form: FormDefinition;
|
|
328
|
+
/** Optional click callback. When unset, buttons render as no-ops. */
|
|
329
|
+
onActionButtonClick?: (button: DialogActionButton) => void;
|
|
330
|
+
}
|
|
331
|
+
declare const FooterShell: React.FC<FooterShellProps>;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* CalloutShell — renders a Fluent UI Callout anchored at `target`,
|
|
335
|
+
* populated by the runtime's SectionShell so its content honors all
|
|
336
|
+
* the same FormSection rendering rules as the rest of the form.
|
|
337
|
+
*
|
|
338
|
+
* Phase 3 milestone 2. Replaces the legacy `CalloutPreview` /
|
|
339
|
+
* `CalloutControlWrapper` pair in
|
|
340
|
+
* `apps/form-builder/src/components/form-preview/CalloutPreview.tsx`.
|
|
341
|
+
*
|
|
342
|
+
* Trigger handling, open/close state, and the activation surface live
|
|
343
|
+
* in {@link CalloutAnchor}; this file only paints the open callout.
|
|
344
|
+
*/
|
|
345
|
+
|
|
346
|
+
/** Map our string-based hint enum into Fluent's runtime enum. */
|
|
347
|
+
declare function mapCalloutDirectionalHint(hint?: CalloutDirectionalHint): DirectionalHint;
|
|
348
|
+
interface CalloutShellProps {
|
|
349
|
+
callout: CalloutDefinition;
|
|
350
|
+
target: HTMLElement;
|
|
351
|
+
onDismiss: () => void;
|
|
352
|
+
/** Called when the cursor enters the callout content — used by the
|
|
353
|
+
* hover trigger in {@link CalloutAnchor} to cancel a pending dismiss
|
|
354
|
+
* so the user can move from the anchor onto the callout without it
|
|
355
|
+
* disappearing under them. */
|
|
356
|
+
onContentMouseEnter?: () => void;
|
|
357
|
+
/** Called when the cursor leaves the callout content. */
|
|
358
|
+
onContentMouseLeave?: () => void;
|
|
359
|
+
/** Parent path used to nest callout sections under their host control
|
|
360
|
+
* for instrumentation. The legacy preview was uninstrumented; the
|
|
361
|
+
* runtime path keeps the same surface but with element-ids so the
|
|
362
|
+
* designer overlay can target callout sections too. */
|
|
363
|
+
parentPath: string;
|
|
364
|
+
recordData?: Record<string, unknown> | null;
|
|
365
|
+
interactive: boolean;
|
|
366
|
+
instrumentation: InstrumentationMode;
|
|
367
|
+
onCellValueChange?: (controlName: string, next: unknown) => void;
|
|
368
|
+
onButtonClick?: DispatchControlInputs['onButtonClick'];
|
|
369
|
+
}
|
|
370
|
+
declare const CalloutShell: React.FC<CalloutShellProps>;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* CalloutAnchor — wraps a control with click / hover / icon-click
|
|
374
|
+
* trigger handlers that open a {@link CalloutShell} anchored to the
|
|
375
|
+
* control's DOM node.
|
|
376
|
+
*
|
|
377
|
+
* Phase 3 milestone 2 — replaces `CalloutControlWrapper` +
|
|
378
|
+
* `CalloutIndicator` from
|
|
379
|
+
* `apps/form-builder/src/components/form-preview/CalloutPreview.tsx`.
|
|
380
|
+
*
|
|
381
|
+
* State is local to each anchor (each control with a callout owns its
|
|
382
|
+
* own open/close state). The legacy preview centralized state in
|
|
383
|
+
* FormPreview, but FluentCallout's dismiss-on-click-outside makes
|
|
384
|
+
* "only one open at a time" the natural behavior anyway — and the
|
|
385
|
+
* local model avoids prop-drilling activation handlers through the
|
|
386
|
+
* shell hierarchy.
|
|
387
|
+
*
|
|
388
|
+
* Hover bridging: when the trigger is `hover`, a 300ms timer governs
|
|
389
|
+
* dismissal so the user can move from the anchor onto the callout
|
|
390
|
+
* content without losing it. CalloutShell calls back into this
|
|
391
|
+
* component via onContentMouse* to cancel / restart the timer.
|
|
392
|
+
*/
|
|
393
|
+
|
|
394
|
+
interface CalloutAnchorProps {
|
|
395
|
+
callout: CalloutDefinition;
|
|
396
|
+
/** Optional per-attachment override of the callout's default trigger. */
|
|
397
|
+
triggerOverride?: CalloutTrigger;
|
|
398
|
+
children: React.ReactNode;
|
|
399
|
+
/** Parent path threaded through to {@link CalloutShell} for nested
|
|
400
|
+
* section instrumentation. */
|
|
401
|
+
parentPath: string;
|
|
402
|
+
recordData?: Record<string, unknown> | null;
|
|
403
|
+
interactive: boolean;
|
|
404
|
+
instrumentation: InstrumentationMode;
|
|
405
|
+
onCellValueChange?: (controlName: string, next: unknown) => void;
|
|
406
|
+
onButtonClick?: DispatchControlInputs['onButtonClick'];
|
|
407
|
+
}
|
|
408
|
+
declare const CalloutAnchor: React.FC<CalloutAnchorProps>;
|
|
409
|
+
|
|
410
|
+
export { BpfShell, type BpfShellProps, CalloutAnchor, type CalloutAnchorProps, CalloutShell, type CalloutShellProps, CommandBarShell, type CommandBarShellProps, ControlPartProps, type DispatchControlInputs, DispatchedControl, type ElementType, FooterShell, type FooterShellProps, FormRuntime, type FormRuntimeProps, GridShell, type GridShellProps, HeaderShell, type HeaderShellProps, type InstrumentationAttrs, type InstrumentationMode, SectionShell, type SectionShellProps, TabsShell, type TabsShellProps, buildControlPartProps, instrumentAttrs, paths as instrumentationPaths, mapCalloutDirectionalHint, resolveControlComponent };
|