@bsm-form/schema 0.39.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/dist/index.cjs +222 -0
- package/dist/index.d.cts +981 -0
- package/dist/index.d.ts +981 -0
- package/dist/index.js +163 -0
- package/package.json +28 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
type ConditionOperator = "equals" | "notEquals" | "greaterThan" | "lessThan" | "exists" | "empty" | "notEmpty";
|
|
2
|
+
/** Operators that do not use a comparison `value`. */
|
|
3
|
+
declare function isValuelessConditionOperator(operator: ConditionOperator): boolean;
|
|
4
|
+
/** Field / state / pending comparison used by visibility, disabledWhen, and computed `if`. */
|
|
5
|
+
type FieldCondition = {
|
|
6
|
+
field: string;
|
|
7
|
+
operator: ConditionOperator;
|
|
8
|
+
value?: unknown;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Host-registered predicate by name (`FormEngineEnvironment.predicates`).
|
|
12
|
+
* Schema stores only the name; function bodies never live in the condition.
|
|
13
|
+
*/
|
|
14
|
+
type InvokeCondition = {
|
|
15
|
+
type: "invoke";
|
|
16
|
+
name: string;
|
|
17
|
+
};
|
|
18
|
+
type Condition = FieldCondition | InvokeCondition;
|
|
19
|
+
declare function isInvokeCondition(condition: Condition): condition is InvokeCondition;
|
|
20
|
+
declare function isFieldCondition(condition: Condition): condition is FieldCondition;
|
|
21
|
+
|
|
22
|
+
type NodeKind = "layout" | "field" | "action" | "display";
|
|
23
|
+
type BaseNode = {
|
|
24
|
+
id: string;
|
|
25
|
+
kind: NodeKind;
|
|
26
|
+
type: string;
|
|
27
|
+
props?: Record<string, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Disable when every condition passes (AND). Combined with
|
|
30
|
+
* `props.disabled === true` (static always wins / ORs in).
|
|
31
|
+
*/
|
|
32
|
+
disabledWhen?: Condition[];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type ActionType = "submit" | "reset" | "custom";
|
|
36
|
+
type StepperActionType = "stepper-next" | "stepper-previous";
|
|
37
|
+
type BaseActionNode = Omit<BaseNode, "kind" | "type"> & {
|
|
38
|
+
kind: "action";
|
|
39
|
+
/** Visibility conditions (AND). Same model as field/display. */
|
|
40
|
+
conditions?: Condition[];
|
|
41
|
+
};
|
|
42
|
+
type SubmitActionNode = BaseActionNode & {
|
|
43
|
+
type: "submit";
|
|
44
|
+
action?: {
|
|
45
|
+
steps: Step[];
|
|
46
|
+
};
|
|
47
|
+
stepperId?: never;
|
|
48
|
+
};
|
|
49
|
+
type ResetActionNode = BaseActionNode & {
|
|
50
|
+
type: "reset";
|
|
51
|
+
action?: never;
|
|
52
|
+
stepperId?: never;
|
|
53
|
+
};
|
|
54
|
+
/** @deprecated Use SubmitActionNode | ResetActionNode */
|
|
55
|
+
type SubmitOrResetActionNode = SubmitActionNode | ResetActionNode;
|
|
56
|
+
type CustomActionNode = BaseActionNode & {
|
|
57
|
+
type: "custom";
|
|
58
|
+
action?: {
|
|
59
|
+
steps: Step[];
|
|
60
|
+
};
|
|
61
|
+
stepperId?: never;
|
|
62
|
+
};
|
|
63
|
+
type StepperActionNode = BaseActionNode & {
|
|
64
|
+
type: StepperActionType;
|
|
65
|
+
stepperId: string;
|
|
66
|
+
action?: never;
|
|
67
|
+
};
|
|
68
|
+
type ActionNode = SubmitActionNode | ResetActionNode | CustomActionNode | StepperActionNode;
|
|
69
|
+
|
|
70
|
+
type ValidationRule = {
|
|
71
|
+
type: "required";
|
|
72
|
+
message?: string;
|
|
73
|
+
} | {
|
|
74
|
+
type: "min";
|
|
75
|
+
value: number;
|
|
76
|
+
message?: string;
|
|
77
|
+
} | {
|
|
78
|
+
type: "max";
|
|
79
|
+
value: number;
|
|
80
|
+
message?: string;
|
|
81
|
+
} | {
|
|
82
|
+
type: "length";
|
|
83
|
+
value: number;
|
|
84
|
+
message?: string;
|
|
85
|
+
} | {
|
|
86
|
+
/**
|
|
87
|
+
* Host-registered validator by name (`FormEngineEnvironment.validators`).
|
|
88
|
+
* Handler returns `true` when valid, or a string error message when invalid.
|
|
89
|
+
*/
|
|
90
|
+
type: "invoke";
|
|
91
|
+
name: string;
|
|
92
|
+
/** Fallback when the handler returns a non-string failure value. */
|
|
93
|
+
message?: string;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
type FieldType = "text" | "number" | "textarea" | "select" | "checkbox" | "switch" | "radio" | "segment-button" | "slider" | "time" | "otp" | "date";
|
|
97
|
+
/**
|
|
98
|
+
* Text-like fields may declare `blur`. Discrete-choice fields may declare
|
|
99
|
+
* `change`. Slider may declare `commit`. The families are mutually exclusive.
|
|
100
|
+
*/
|
|
101
|
+
type FieldEventType = "blur" | "change" | "commit";
|
|
102
|
+
type FieldEventConfig = {
|
|
103
|
+
steps: Step[];
|
|
104
|
+
};
|
|
105
|
+
declare const FIELD_TYPES_WITH_CHANGE_EVENT: readonly ["select", "radio", "segment-button", "checkbox", "switch"];
|
|
106
|
+
declare const FIELD_TYPES_WITH_COMMIT_EVENT: readonly ["slider"];
|
|
107
|
+
type FieldTypeWithChangeEvent = (typeof FIELD_TYPES_WITH_CHANGE_EVENT)[number];
|
|
108
|
+
type FieldTypeWithCommitEvent = (typeof FIELD_TYPES_WITH_COMMIT_EVENT)[number];
|
|
109
|
+
declare function fieldAllowsChangeEvent(type: FieldType): boolean;
|
|
110
|
+
declare function fieldAllowsCommitEvent(type: FieldType): boolean;
|
|
111
|
+
/** Text-like inputs: blur only (not discrete choice or slider). */
|
|
112
|
+
declare function fieldAllowsBlurEvent(type: FieldType): boolean;
|
|
113
|
+
declare function fieldAllowsEvent(type: FieldType, event: string): event is FieldEventType;
|
|
114
|
+
type SliderMode = "single" | "range";
|
|
115
|
+
type SliderRangeValue = [number, number];
|
|
116
|
+
type SliderValue = number | SliderRangeValue;
|
|
117
|
+
type TimeValue = {
|
|
118
|
+
hour: string;
|
|
119
|
+
minute: string;
|
|
120
|
+
};
|
|
121
|
+
type SelectMode = "select" | "multi";
|
|
122
|
+
type SelectOptionValue = string | number;
|
|
123
|
+
type SelectValue = SelectOptionValue | SelectOptionValue[];
|
|
124
|
+
type SegmentButtonSize = "xs" | "sm" | "md" | "lg";
|
|
125
|
+
type SegmentButtonValue = SelectOptionValue;
|
|
126
|
+
type SegmentButtonFieldProps = Record<string, unknown> & {
|
|
127
|
+
value?: SegmentButtonValue;
|
|
128
|
+
label?: string;
|
|
129
|
+
hint?: string;
|
|
130
|
+
helperText?: string;
|
|
131
|
+
size?: SegmentButtonSize;
|
|
132
|
+
disabled?: boolean;
|
|
133
|
+
readOnly?: boolean;
|
|
134
|
+
rounded?: boolean;
|
|
135
|
+
fullWidth?: boolean;
|
|
136
|
+
className?: string;
|
|
137
|
+
ariaLabel?: string;
|
|
138
|
+
};
|
|
139
|
+
type SegmentButtonOptionsConfig = {
|
|
140
|
+
source: string;
|
|
141
|
+
label: string;
|
|
142
|
+
value: string;
|
|
143
|
+
disabled?: string;
|
|
144
|
+
} | {
|
|
145
|
+
items: {
|
|
146
|
+
label: string;
|
|
147
|
+
value: SegmentButtonValue;
|
|
148
|
+
disabled?: boolean;
|
|
149
|
+
}[];
|
|
150
|
+
};
|
|
151
|
+
type ComputedInput = {
|
|
152
|
+
type: "field";
|
|
153
|
+
path: string;
|
|
154
|
+
} | {
|
|
155
|
+
type: "constant";
|
|
156
|
+
value: unknown;
|
|
157
|
+
};
|
|
158
|
+
type ComputedOperator = "concat" | "sum" | "subtract" | "multiply" | "divide" | "coalesce" | "if" | "today" | "invoke";
|
|
159
|
+
type ComputedCondition = Condition;
|
|
160
|
+
type ComputedConfig = {
|
|
161
|
+
operator: "concat" | "sum" | "subtract" | "multiply" | "divide" | "coalesce" | "today";
|
|
162
|
+
inputs: ComputedInput[];
|
|
163
|
+
options?: Record<string, unknown>;
|
|
164
|
+
} | {
|
|
165
|
+
operator: "if";
|
|
166
|
+
condition: ComputedCondition[];
|
|
167
|
+
then: ComputedInput;
|
|
168
|
+
else: ComputedInput;
|
|
169
|
+
} | {
|
|
170
|
+
/**
|
|
171
|
+
* Host-registered computer by name (`FormEngineEnvironment.computers`).
|
|
172
|
+
* Sync return value becomes the field value.
|
|
173
|
+
*/
|
|
174
|
+
operator: "invoke";
|
|
175
|
+
name: string;
|
|
176
|
+
};
|
|
177
|
+
type OptionsConfig = {
|
|
178
|
+
source: string;
|
|
179
|
+
label: string;
|
|
180
|
+
value: string;
|
|
181
|
+
} | {
|
|
182
|
+
items: {
|
|
183
|
+
label: string;
|
|
184
|
+
value: SelectOptionValue;
|
|
185
|
+
}[];
|
|
186
|
+
};
|
|
187
|
+
type FieldNode = BaseNode & {
|
|
188
|
+
kind: "field";
|
|
189
|
+
type: FieldType;
|
|
190
|
+
name: string;
|
|
191
|
+
validation?: ValidationRule[];
|
|
192
|
+
conditions?: Condition[];
|
|
193
|
+
options?: OptionsConfig;
|
|
194
|
+
bind?: {
|
|
195
|
+
value: string;
|
|
196
|
+
};
|
|
197
|
+
computed?: ComputedConfig;
|
|
198
|
+
/**
|
|
199
|
+
* Serializable field interactions. Families are mutually exclusive:
|
|
200
|
+
* text-like → `blur`; select/radio/segment-button/checkbox/switch → `change`;
|
|
201
|
+
* slider → `commit`.
|
|
202
|
+
*/
|
|
203
|
+
events?: Partial<Record<FieldEventType, FieldEventConfig>>;
|
|
204
|
+
};
|
|
205
|
+
type SegmentButtonFieldNode = Omit<FieldNode, "type" | "options" | "props"> & {
|
|
206
|
+
type: "segment-button";
|
|
207
|
+
props?: SegmentButtonFieldProps;
|
|
208
|
+
options: SegmentButtonOptionsConfig;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
type DisplayType = "tag" | "alert" | "chips" | "skeleton" | "table" | "typography" | "slot";
|
|
212
|
+
type AlertDisplayEventType = "close" | "action";
|
|
213
|
+
type ChipsDisplayEventType = "close" | "click";
|
|
214
|
+
type DisplayEventType = AlertDisplayEventType | ChipsDisplayEventType;
|
|
215
|
+
type DisplayEventConfig = {
|
|
216
|
+
steps: Step[];
|
|
217
|
+
};
|
|
218
|
+
type BaseDisplayNode = BaseNode & {
|
|
219
|
+
kind: "display";
|
|
220
|
+
conditions?: Condition[];
|
|
221
|
+
};
|
|
222
|
+
type TableTagVariant = "default" | "secondary" | "error" | "success" | "warning" | "info" | "magenta" | "cyan" | "blue" | "lime" | "purple" | "volcano";
|
|
223
|
+
type TableTagValueMapping = {
|
|
224
|
+
label?: string;
|
|
225
|
+
variant?: TableTagVariant;
|
|
226
|
+
};
|
|
227
|
+
type TagDisplayProps = Record<string, unknown> & {
|
|
228
|
+
variant?: TableTagVariant | string;
|
|
229
|
+
size?: string;
|
|
230
|
+
rounded?: boolean;
|
|
231
|
+
borderLess?: boolean;
|
|
232
|
+
className?: string;
|
|
233
|
+
/**
|
|
234
|
+
* When `from` resolves to a value matching a key, override label/variant
|
|
235
|
+
* (same semantics as table tag columns).
|
|
236
|
+
*/
|
|
237
|
+
map?: Record<string, TableTagValueMapping>;
|
|
238
|
+
} & ({
|
|
239
|
+
label?: string | number;
|
|
240
|
+
from?: never;
|
|
241
|
+
} | {
|
|
242
|
+
from: string;
|
|
243
|
+
label?: never;
|
|
244
|
+
});
|
|
245
|
+
type TagDisplayNode = Omit<BaseDisplayNode, "props"> & {
|
|
246
|
+
type: "tag";
|
|
247
|
+
props?: TagDisplayProps;
|
|
248
|
+
events?: never;
|
|
249
|
+
};
|
|
250
|
+
type AlertDisplayNode = BaseDisplayNode & {
|
|
251
|
+
type: "alert";
|
|
252
|
+
events?: Partial<Record<AlertDisplayEventType, DisplayEventConfig>>;
|
|
253
|
+
};
|
|
254
|
+
type ChipsDisplayNode = BaseDisplayNode & {
|
|
255
|
+
type: "chips";
|
|
256
|
+
events?: Partial<Record<ChipsDisplayEventType, DisplayEventConfig>>;
|
|
257
|
+
};
|
|
258
|
+
type SkeletonDisplayProps = Record<string, unknown> & {
|
|
259
|
+
className?: string;
|
|
260
|
+
ariaLabel?: string;
|
|
261
|
+
};
|
|
262
|
+
type SkeletonDisplayNode = Omit<BaseDisplayNode, "props"> & {
|
|
263
|
+
type: "skeleton";
|
|
264
|
+
props?: SkeletonDisplayProps;
|
|
265
|
+
events?: never;
|
|
266
|
+
};
|
|
267
|
+
type TypographyAs = "p" | "span" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "label" | "strong" | "em";
|
|
268
|
+
type TypographyDisplayProps = Record<string, unknown> & {
|
|
269
|
+
as: TypographyAs;
|
|
270
|
+
className?: string;
|
|
271
|
+
} & ({
|
|
272
|
+
content: string;
|
|
273
|
+
from?: never;
|
|
274
|
+
} | {
|
|
275
|
+
from: string;
|
|
276
|
+
content?: never;
|
|
277
|
+
}
|
|
278
|
+
/** When `computed` is set on the node, props omit both content and from. */
|
|
279
|
+
| {
|
|
280
|
+
content?: never;
|
|
281
|
+
from?: never;
|
|
282
|
+
});
|
|
283
|
+
type TypographyDisplayNode = Omit<BaseDisplayNode, "props"> & {
|
|
284
|
+
type: "typography";
|
|
285
|
+
props: TypographyDisplayProps;
|
|
286
|
+
/**
|
|
287
|
+
* Presentation-only computed text source (XOR with `props.content` / `props.from`).
|
|
288
|
+
* Evaluated on read via `getTypographyText`; never writes form values.
|
|
289
|
+
*/
|
|
290
|
+
computed?: ComputedConfig;
|
|
291
|
+
events?: never;
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Host-filled presentation hole. Schema stores only a registry `name`;
|
|
295
|
+
* the React implementation is injected by the host (`FormRenderer` slots map).
|
|
296
|
+
* Never owns values, validation, or events.
|
|
297
|
+
*/
|
|
298
|
+
type SlotDisplayProps = Record<string, unknown> & {
|
|
299
|
+
/** Host registry key (same family as invoke `name`). */
|
|
300
|
+
name: string;
|
|
301
|
+
className?: string;
|
|
302
|
+
};
|
|
303
|
+
type SlotDisplayNode = Omit<BaseDisplayNode, "props"> & {
|
|
304
|
+
type: "slot";
|
|
305
|
+
props: SlotDisplayProps;
|
|
306
|
+
events?: never;
|
|
307
|
+
};
|
|
308
|
+
type TableTextColumn = {
|
|
309
|
+
id: string;
|
|
310
|
+
header: string;
|
|
311
|
+
kind?: "text";
|
|
312
|
+
path: string;
|
|
313
|
+
};
|
|
314
|
+
type TableTagColumn = {
|
|
315
|
+
id: string;
|
|
316
|
+
header: string;
|
|
317
|
+
kind: "tag";
|
|
318
|
+
path: string;
|
|
319
|
+
/**
|
|
320
|
+
* When the path value equals a key, use that entry for Tag label/variant.
|
|
321
|
+
* Keys are matched against the string form of the cell value.
|
|
322
|
+
*/
|
|
323
|
+
map?: Record<string, TableTagValueMapping>;
|
|
324
|
+
variantPath?: string;
|
|
325
|
+
variant?: TableTagVariant;
|
|
326
|
+
};
|
|
327
|
+
type TableColumnActionColor = "primary" | "secondary" | "success" | "error" | "info" | "warning";
|
|
328
|
+
type TableColumnAction = {
|
|
329
|
+
id: string;
|
|
330
|
+
label: string;
|
|
331
|
+
variant?: "fill" | "outlined" | "ghost" | "text";
|
|
332
|
+
color?: TableColumnActionColor;
|
|
333
|
+
iconOnly?: boolean;
|
|
334
|
+
steps: Step[];
|
|
335
|
+
};
|
|
336
|
+
type TableActionsColumn = {
|
|
337
|
+
id: string;
|
|
338
|
+
header: string;
|
|
339
|
+
kind: "actions";
|
|
340
|
+
actions: TableColumnAction[];
|
|
341
|
+
};
|
|
342
|
+
type TableColumn = TableTextColumn | TableTagColumn | TableActionsColumn;
|
|
343
|
+
type TableStaticData = {
|
|
344
|
+
items: Record<string, unknown>[];
|
|
345
|
+
};
|
|
346
|
+
type TableSourceData = {
|
|
347
|
+
source: string;
|
|
348
|
+
};
|
|
349
|
+
type TableData = TableStaticData | TableSourceData;
|
|
350
|
+
type TableAlign = "left" | "right" | "center";
|
|
351
|
+
type TableDisplayProps = Record<string, unknown> & {
|
|
352
|
+
align?: TableAlign;
|
|
353
|
+
bordered?: boolean;
|
|
354
|
+
separated?: boolean;
|
|
355
|
+
caption?: string;
|
|
356
|
+
className?: string;
|
|
357
|
+
};
|
|
358
|
+
type TableDisplayEventType = "rowClick";
|
|
359
|
+
type TableDisplayNode = Omit<BaseDisplayNode, "props"> & {
|
|
360
|
+
type: "table";
|
|
361
|
+
props?: TableDisplayProps;
|
|
362
|
+
columns: TableColumn[];
|
|
363
|
+
data: TableData;
|
|
364
|
+
events?: Partial<Record<TableDisplayEventType, DisplayEventConfig>>;
|
|
365
|
+
};
|
|
366
|
+
type DisplayNode = TagDisplayNode | AlertDisplayNode | ChipsDisplayNode | SkeletonDisplayNode | TableDisplayNode | TypographyDisplayNode | SlotDisplayNode;
|
|
367
|
+
type TableInteraction = {
|
|
368
|
+
kind: "rowClick";
|
|
369
|
+
rowIndex: number;
|
|
370
|
+
} | {
|
|
371
|
+
kind: "action";
|
|
372
|
+
columnId: string;
|
|
373
|
+
actionId: string;
|
|
374
|
+
rowIndex: number;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
type Node = LayoutNode | FieldNode | ActionNode | DisplayNode;
|
|
378
|
+
|
|
379
|
+
type LayoutType = "section" | "div" | "grid" | "row" | "scroll-area" | "pagination" | "badge" | "tooltip" | "popover" | "popover-trigger" | "popover-content" | "dropdown-menu" | "dropdown-menu-trigger" | "dropdown-menu-content" | "dropdown-menu-group" | "dropdown-menu-label" | "dropdown-menu-item" | "dropdown-menu-separator" | "dropdown-menu-sub" | "dropdown-menu-sub-trigger" | "dropdown-menu-sub-content" | "card" | "card-header" | "card-content" | "card-footer" | "tabs" | "accordion" | "accordion-item" | "stepper" | "step" | "dialog" | "dialog-header" | "dialog-body" | "dialog-footer" | "drawer" | "drawer-header" | "drawer-body" | "drawer-footer" | "repeat" | "form-ref";
|
|
380
|
+
type StepperOrientation = "horizontal" | "vertical";
|
|
381
|
+
type StepperConnector = "solid" | "dashed";
|
|
382
|
+
type ScrollAreaType = "hover" | "scroll" | "auto" | "always";
|
|
383
|
+
type ScrollAreaDirection = "ltr" | "rtl";
|
|
384
|
+
type ScrollAreaLayoutProps = Record<string, unknown> & {
|
|
385
|
+
className?: string;
|
|
386
|
+
viewportClassName?: string;
|
|
387
|
+
type?: ScrollAreaType;
|
|
388
|
+
dir?: ScrollAreaDirection;
|
|
389
|
+
scrollHideDelay?: number;
|
|
390
|
+
ariaLabel?: string;
|
|
391
|
+
};
|
|
392
|
+
type PaginationLayoutProps = Record<string, unknown> & {
|
|
393
|
+
totalItems: number;
|
|
394
|
+
initialPage?: number;
|
|
395
|
+
pageSize?: number;
|
|
396
|
+
pageSizeOptions?: number[];
|
|
397
|
+
siblings?: number;
|
|
398
|
+
showPageSizeSelector?: boolean;
|
|
399
|
+
showPageInfo?: boolean;
|
|
400
|
+
rounded?: boolean;
|
|
401
|
+
className?: string;
|
|
402
|
+
ariaLabel?: string;
|
|
403
|
+
};
|
|
404
|
+
type BadgeType = "default" | "success" | "error" | "warning" | "process" | "proccess";
|
|
405
|
+
type BadgeLayoutProps = Record<string, unknown> & {
|
|
406
|
+
content?: string | number;
|
|
407
|
+
show?: boolean;
|
|
408
|
+
type?: BadgeType;
|
|
409
|
+
offsetX?: number;
|
|
410
|
+
offsetY?: number;
|
|
411
|
+
className?: string;
|
|
412
|
+
ariaLabel?: string;
|
|
413
|
+
};
|
|
414
|
+
type TooltipSide = "top" | "right" | "bottom" | "left";
|
|
415
|
+
type TooltipLayoutProps = Record<string, unknown> & {
|
|
416
|
+
content: string;
|
|
417
|
+
side?: TooltipSide;
|
|
418
|
+
sideOffset?: number;
|
|
419
|
+
delayDuration?: number;
|
|
420
|
+
defaultOpen?: boolean;
|
|
421
|
+
className?: string;
|
|
422
|
+
};
|
|
423
|
+
type PopoverSide = "top" | "right" | "bottom" | "left";
|
|
424
|
+
type PopoverAlign = "start" | "center" | "end";
|
|
425
|
+
type PopoverLayoutProps = Record<string, unknown> & {
|
|
426
|
+
defaultOpen?: boolean;
|
|
427
|
+
modal?: boolean;
|
|
428
|
+
};
|
|
429
|
+
type PopoverTriggerLayoutProps = Record<string, unknown> & {
|
|
430
|
+
className?: string;
|
|
431
|
+
ariaLabel?: string;
|
|
432
|
+
};
|
|
433
|
+
type PopoverContentLayoutProps = Record<string, unknown> & {
|
|
434
|
+
align?: PopoverAlign;
|
|
435
|
+
side?: PopoverSide;
|
|
436
|
+
sideOffset?: number;
|
|
437
|
+
alignOffset?: number;
|
|
438
|
+
className?: string;
|
|
439
|
+
ariaLabel?: string;
|
|
440
|
+
};
|
|
441
|
+
type DropdownMenuSide = "top" | "right" | "bottom" | "left";
|
|
442
|
+
type DropdownMenuAlign = "start" | "center" | "end";
|
|
443
|
+
type DropdownMenuItemVariant = "default" | "destructive";
|
|
444
|
+
type DropdownMenuLayoutProps = Record<string, unknown> & {
|
|
445
|
+
defaultOpen?: boolean;
|
|
446
|
+
modal?: boolean;
|
|
447
|
+
};
|
|
448
|
+
type DropdownMenuTriggerLayoutProps = Record<string, unknown> & {
|
|
449
|
+
disabled?: boolean;
|
|
450
|
+
className?: string;
|
|
451
|
+
ariaLabel?: string;
|
|
452
|
+
};
|
|
453
|
+
type DropdownMenuContentLayoutProps = Record<string, unknown> & {
|
|
454
|
+
side?: DropdownMenuSide;
|
|
455
|
+
sideOffset?: number;
|
|
456
|
+
align?: DropdownMenuAlign;
|
|
457
|
+
alignOffset?: number;
|
|
458
|
+
collisionPadding?: number;
|
|
459
|
+
className?: string;
|
|
460
|
+
ariaLabel?: string;
|
|
461
|
+
};
|
|
462
|
+
type DropdownMenuGroupLayoutProps = Record<string, unknown> & {
|
|
463
|
+
className?: string;
|
|
464
|
+
};
|
|
465
|
+
type DropdownMenuLabelLayoutProps = Record<string, unknown> & {
|
|
466
|
+
label: string;
|
|
467
|
+
inset?: boolean;
|
|
468
|
+
className?: string;
|
|
469
|
+
};
|
|
470
|
+
type DropdownMenuItemLayoutProps = Record<string, unknown> & {
|
|
471
|
+
label: string;
|
|
472
|
+
shortcut?: string;
|
|
473
|
+
disabled?: boolean;
|
|
474
|
+
inset?: boolean;
|
|
475
|
+
variant?: DropdownMenuItemVariant;
|
|
476
|
+
className?: string;
|
|
477
|
+
};
|
|
478
|
+
type DropdownMenuSeparatorLayoutProps = Record<string, unknown> & {
|
|
479
|
+
className?: string;
|
|
480
|
+
};
|
|
481
|
+
type DropdownMenuSubLayoutProps = Record<string, unknown> & {
|
|
482
|
+
defaultOpen?: boolean;
|
|
483
|
+
};
|
|
484
|
+
type DropdownMenuSubTriggerLayoutProps = Record<string, unknown> & {
|
|
485
|
+
label: string;
|
|
486
|
+
disabled?: boolean;
|
|
487
|
+
inset?: boolean;
|
|
488
|
+
className?: string;
|
|
489
|
+
};
|
|
490
|
+
type DropdownMenuSubContentLayoutProps = Record<string, unknown> & {
|
|
491
|
+
sideOffset?: number;
|
|
492
|
+
className?: string;
|
|
493
|
+
ariaLabel?: string;
|
|
494
|
+
};
|
|
495
|
+
type CardLayoutProps = Record<string, unknown> & {
|
|
496
|
+
className?: string;
|
|
497
|
+
ariaLabel?: string;
|
|
498
|
+
};
|
|
499
|
+
type CardHeaderLayoutProps = Record<string, unknown> & {
|
|
500
|
+
className?: string;
|
|
501
|
+
divider?: boolean;
|
|
502
|
+
};
|
|
503
|
+
type CardContentLayoutProps = Record<string, unknown> & {
|
|
504
|
+
className?: string;
|
|
505
|
+
};
|
|
506
|
+
type CardFooterLayoutProps = Record<string, unknown> & {
|
|
507
|
+
className?: string;
|
|
508
|
+
divider?: boolean;
|
|
509
|
+
};
|
|
510
|
+
type StepperLayoutProps = Record<string, unknown> & {
|
|
511
|
+
initialStep?: string;
|
|
512
|
+
orientation?: StepperOrientation;
|
|
513
|
+
clickable?: boolean;
|
|
514
|
+
linear?: boolean;
|
|
515
|
+
dotStyle?: boolean;
|
|
516
|
+
connector?: StepperConnector;
|
|
517
|
+
className?: string;
|
|
518
|
+
contentClassName?: string;
|
|
519
|
+
ariaLabel?: string;
|
|
520
|
+
};
|
|
521
|
+
type StepLayoutProps = Record<string, unknown> & {
|
|
522
|
+
label: string;
|
|
523
|
+
caption?: string;
|
|
524
|
+
disabled?: boolean;
|
|
525
|
+
className?: string;
|
|
526
|
+
/** CSS classes for the step actions row (Previous / Next / Submit / …). */
|
|
527
|
+
actionsClassName?: string;
|
|
528
|
+
};
|
|
529
|
+
type AccordionItemLayoutProps = Record<string, unknown> & {
|
|
530
|
+
className?: string;
|
|
531
|
+
disabled?: boolean;
|
|
532
|
+
} & ({
|
|
533
|
+
title?: string;
|
|
534
|
+
titleFrom?: never;
|
|
535
|
+
} | {
|
|
536
|
+
titleFrom: string;
|
|
537
|
+
title?: never;
|
|
538
|
+
});
|
|
539
|
+
type DialogSize = "sm" | "md" | "lg" | "xl" | "full";
|
|
540
|
+
type DialogOperation = "open" | "close";
|
|
541
|
+
type DialogEventType = DialogOperation;
|
|
542
|
+
type DialogLayoutProps = Record<string, unknown> & {
|
|
543
|
+
initialOpen?: boolean;
|
|
544
|
+
size?: DialogSize;
|
|
545
|
+
disableCloseOutside?: boolean;
|
|
546
|
+
};
|
|
547
|
+
type DialogHeaderLayoutProps = Record<string, unknown> & {
|
|
548
|
+
title: string;
|
|
549
|
+
hideClose?: boolean;
|
|
550
|
+
};
|
|
551
|
+
type DialogSlotLayoutProps = Record<string, unknown> & {
|
|
552
|
+
className?: string;
|
|
553
|
+
};
|
|
554
|
+
type DialogEventConfig = {
|
|
555
|
+
steps: Step[];
|
|
556
|
+
};
|
|
557
|
+
type PaginationEventType = "pageChange";
|
|
558
|
+
type PaginationEventConfig = {
|
|
559
|
+
steps: Step[];
|
|
560
|
+
};
|
|
561
|
+
/** Tabs, accordion, and stepper share a post-navigation `change` event. */
|
|
562
|
+
type NavigationEventType = "change";
|
|
563
|
+
type NavigationEventConfig = {
|
|
564
|
+
steps: Step[];
|
|
565
|
+
};
|
|
566
|
+
type DialogStep = {
|
|
567
|
+
type: "dialog";
|
|
568
|
+
target: string;
|
|
569
|
+
operation: DialogOperation;
|
|
570
|
+
};
|
|
571
|
+
type DrawerSide = "top" | "bottom" | "left" | "right";
|
|
572
|
+
type DrawerOperation = "open" | "close";
|
|
573
|
+
type DrawerEventType = DrawerOperation;
|
|
574
|
+
type DrawerLayoutProps = Record<string, unknown> & {
|
|
575
|
+
initialOpen?: boolean;
|
|
576
|
+
side?: DrawerSide;
|
|
577
|
+
disableCloseOutside?: boolean;
|
|
578
|
+
};
|
|
579
|
+
type DrawerHeaderLayoutProps = Record<string, unknown> & {
|
|
580
|
+
title: string;
|
|
581
|
+
hideClose?: boolean;
|
|
582
|
+
};
|
|
583
|
+
type DrawerSlotLayoutProps = Record<string, unknown> & {
|
|
584
|
+
className?: string;
|
|
585
|
+
};
|
|
586
|
+
type RepeatMode = "count" | "source" | "values";
|
|
587
|
+
/** Max static repeat iterations (design + runtime) to avoid accidental explosion. */
|
|
588
|
+
declare const REPEAT_MAX_COUNT = 50;
|
|
589
|
+
type RepeatLayoutProps = Record<string, unknown> & {
|
|
590
|
+
/**
|
|
591
|
+
* `count` repeats the template N times; `source` maps over a scoped-path
|
|
592
|
+
* array; `values` is a form-owned field array at `path`.
|
|
593
|
+
*/
|
|
594
|
+
mode: RepeatMode;
|
|
595
|
+
/** Used when `mode` is `count`. Integer 0…REPEAT_MAX_COUNT. */
|
|
596
|
+
count?: number;
|
|
597
|
+
/**
|
|
598
|
+
* Used when `mode` is `source`. Scoped path to an array
|
|
599
|
+
* (typically `resources.*`). Non-arrays resolve to an empty list.
|
|
600
|
+
*/
|
|
601
|
+
source?: string;
|
|
602
|
+
/**
|
|
603
|
+
* Used when `mode` is `values`. Dotted path relative to the parent item
|
|
604
|
+
* (or form values for a top-level repeat). Segments are identifiers, never
|
|
605
|
+
* indexes. Runtime field paths are `{path}.{index}.{fieldName}`.
|
|
606
|
+
*/
|
|
607
|
+
path?: string;
|
|
608
|
+
/** Inclusive lower bound for values-mode length. Defaults to 0. */
|
|
609
|
+
minItems?: number;
|
|
610
|
+
/** Inclusive upper bound for values-mode length. Defaults to REPEAT_MAX_COUNT. */
|
|
611
|
+
maxItems?: number;
|
|
612
|
+
className?: string;
|
|
613
|
+
};
|
|
614
|
+
type RepeatEventType = "add" | "remove" | "move";
|
|
615
|
+
type RepeatEventConfig = {
|
|
616
|
+
steps: Step[];
|
|
617
|
+
};
|
|
618
|
+
type RepeatOperation = "add" | "remove" | "move" | "duplicate";
|
|
619
|
+
type RepeatStep = {
|
|
620
|
+
type: "repeat";
|
|
621
|
+
target: string;
|
|
622
|
+
operation: RepeatOperation;
|
|
623
|
+
/** Scoped path whose value seeds `add` (object merge, or scalar into `field`). */
|
|
624
|
+
from?: string;
|
|
625
|
+
/** Template field name when `from` resolves to a scalar. */
|
|
626
|
+
field?: string;
|
|
627
|
+
/** Explicit item index for remove / move / duplicate. */
|
|
628
|
+
index?: number;
|
|
629
|
+
/** Destination index for `move`. */
|
|
630
|
+
to?: number;
|
|
631
|
+
};
|
|
632
|
+
type DrawerEventConfig = {
|
|
633
|
+
steps: Step[];
|
|
634
|
+
};
|
|
635
|
+
type DrawerStep = {
|
|
636
|
+
type: "drawer";
|
|
637
|
+
target: string;
|
|
638
|
+
operation: DrawerOperation;
|
|
639
|
+
};
|
|
640
|
+
type ToastVariant = "default" | "success" | "error" | "info" | "warning";
|
|
641
|
+
type ToastPosition = "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
642
|
+
type ToastPresentation = {
|
|
643
|
+
variant?: ToastVariant;
|
|
644
|
+
position?: ToastPosition;
|
|
645
|
+
/** Display duration in milliseconds. */
|
|
646
|
+
duration?: number;
|
|
647
|
+
};
|
|
648
|
+
type ToastStep = ({
|
|
649
|
+
type: "toast";
|
|
650
|
+
message: string;
|
|
651
|
+
} & ToastPresentation) | ({
|
|
652
|
+
type: "toast";
|
|
653
|
+
from: string;
|
|
654
|
+
} & ToastPresentation);
|
|
655
|
+
type InvokeStep = {
|
|
656
|
+
type: "invoke";
|
|
657
|
+
name: string;
|
|
658
|
+
};
|
|
659
|
+
type WhenStep = {
|
|
660
|
+
type: "when";
|
|
661
|
+
conditions: Condition[];
|
|
662
|
+
then: Step[];
|
|
663
|
+
else?: Step[];
|
|
664
|
+
};
|
|
665
|
+
type Step = {
|
|
666
|
+
type: "log";
|
|
667
|
+
message: string;
|
|
668
|
+
} | {
|
|
669
|
+
type: "log";
|
|
670
|
+
from: string;
|
|
671
|
+
} | ApiStep | {
|
|
672
|
+
type: "setValue";
|
|
673
|
+
field: string;
|
|
674
|
+
value: unknown;
|
|
675
|
+
} | {
|
|
676
|
+
type: "setValue";
|
|
677
|
+
field: string;
|
|
678
|
+
from: string;
|
|
679
|
+
} | {
|
|
680
|
+
type: "navigate";
|
|
681
|
+
to: string;
|
|
682
|
+
} | DialogStep | DrawerStep | ToastStep | InvokeStep | WhenStep | RepeatStep;
|
|
683
|
+
type ApiRequestBody = {
|
|
684
|
+
body?: unknown;
|
|
685
|
+
bodyFrom?: never;
|
|
686
|
+
} | {
|
|
687
|
+
bodyFrom: string;
|
|
688
|
+
body?: never;
|
|
689
|
+
};
|
|
690
|
+
type ApiRequestQuery = {
|
|
691
|
+
query?: Record<string, unknown>;
|
|
692
|
+
queryFrom?: never;
|
|
693
|
+
} | {
|
|
694
|
+
queryFrom: string;
|
|
695
|
+
query?: never;
|
|
696
|
+
};
|
|
697
|
+
type ApiStep = {
|
|
698
|
+
type: "api";
|
|
699
|
+
request: {
|
|
700
|
+
url: string;
|
|
701
|
+
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
702
|
+
headers?: Record<string, string>;
|
|
703
|
+
} & ApiRequestBody & ApiRequestQuery;
|
|
704
|
+
response?: {
|
|
705
|
+
saveAs?: string;
|
|
706
|
+
};
|
|
707
|
+
/** Run after request/mapping failure, then the original error is rethrown. */
|
|
708
|
+
onError?: Step[];
|
|
709
|
+
};
|
|
710
|
+
type BaseLayoutNode = Omit<BaseNode, "kind" | "type"> & {
|
|
711
|
+
kind: "layout";
|
|
712
|
+
children: readonly Node[];
|
|
713
|
+
load?: {
|
|
714
|
+
steps: Step[];
|
|
715
|
+
};
|
|
716
|
+
};
|
|
717
|
+
type StandardLayoutNode = BaseLayoutNode & {
|
|
718
|
+
type: Exclude<LayoutType, "badge" | "tooltip" | "popover" | "popover-trigger" | "popover-content" | "dropdown-menu" | "dropdown-menu-trigger" | "dropdown-menu-content" | "dropdown-menu-group" | "dropdown-menu-label" | "dropdown-menu-item" | "dropdown-menu-separator" | "dropdown-menu-sub" | "dropdown-menu-sub-trigger" | "dropdown-menu-sub-content" | "card" | "card-header" | "card-content" | "card-footer" | "scroll-area" | "pagination" | "tabs" | "accordion" | "stepper" | "step" | "dialog" | "dialog-header" | "dialog-body" | "dialog-footer" | "drawer" | "drawer-header" | "drawer-body" | "drawer-footer" | "repeat" | "form-ref">;
|
|
719
|
+
};
|
|
720
|
+
type BadgeLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
721
|
+
type: "badge";
|
|
722
|
+
props?: BadgeLayoutProps;
|
|
723
|
+
children: readonly [Node];
|
|
724
|
+
};
|
|
725
|
+
type TooltipLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
726
|
+
type: "tooltip";
|
|
727
|
+
props: TooltipLayoutProps;
|
|
728
|
+
children: readonly [] | readonly [Node];
|
|
729
|
+
};
|
|
730
|
+
type PopoverLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
731
|
+
type: "popover";
|
|
732
|
+
props?: PopoverLayoutProps;
|
|
733
|
+
children: readonly [PopoverTriggerLayoutNode, PopoverContentLayoutNode];
|
|
734
|
+
};
|
|
735
|
+
type PopoverTriggerLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
736
|
+
type: "popover-trigger";
|
|
737
|
+
props?: PopoverTriggerLayoutProps;
|
|
738
|
+
children: readonly [Node];
|
|
739
|
+
};
|
|
740
|
+
type PopoverContentLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
741
|
+
type: "popover-content";
|
|
742
|
+
props?: PopoverContentLayoutProps;
|
|
743
|
+
};
|
|
744
|
+
type PopoverSlotLayoutNode = PopoverTriggerLayoutNode | PopoverContentLayoutNode;
|
|
745
|
+
type DropdownMenuLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
746
|
+
type: "dropdown-menu";
|
|
747
|
+
props?: DropdownMenuLayoutProps;
|
|
748
|
+
children: readonly [
|
|
749
|
+
DropdownMenuTriggerLayoutNode,
|
|
750
|
+
DropdownMenuContentLayoutNode
|
|
751
|
+
];
|
|
752
|
+
};
|
|
753
|
+
type DropdownMenuTriggerLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
754
|
+
type: "dropdown-menu-trigger";
|
|
755
|
+
props?: DropdownMenuTriggerLayoutProps;
|
|
756
|
+
children: readonly [Node];
|
|
757
|
+
};
|
|
758
|
+
type DropdownMenuContentLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
759
|
+
type: "dropdown-menu-content";
|
|
760
|
+
props?: DropdownMenuContentLayoutProps;
|
|
761
|
+
children: readonly DropdownMenuEntryLayoutNode[];
|
|
762
|
+
};
|
|
763
|
+
type DropdownMenuGroupLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
764
|
+
type: "dropdown-menu-group";
|
|
765
|
+
props?: DropdownMenuGroupLayoutProps;
|
|
766
|
+
children: readonly DropdownMenuGroupEntryLayoutNode[];
|
|
767
|
+
};
|
|
768
|
+
type DropdownMenuLabelLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
769
|
+
type: "dropdown-menu-label";
|
|
770
|
+
props: DropdownMenuLabelLayoutProps;
|
|
771
|
+
children: readonly [];
|
|
772
|
+
};
|
|
773
|
+
type DropdownMenuItemLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
774
|
+
type: "dropdown-menu-item";
|
|
775
|
+
props: DropdownMenuItemLayoutProps;
|
|
776
|
+
children: readonly [Extract<Node, {
|
|
777
|
+
kind: "action";
|
|
778
|
+
}>];
|
|
779
|
+
};
|
|
780
|
+
type DropdownMenuSeparatorLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
781
|
+
type: "dropdown-menu-separator";
|
|
782
|
+
props?: DropdownMenuSeparatorLayoutProps;
|
|
783
|
+
children: readonly [];
|
|
784
|
+
};
|
|
785
|
+
type DropdownMenuSubLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
786
|
+
type: "dropdown-menu-sub";
|
|
787
|
+
props?: DropdownMenuSubLayoutProps;
|
|
788
|
+
children: readonly [
|
|
789
|
+
DropdownMenuSubTriggerLayoutNode,
|
|
790
|
+
DropdownMenuSubContentLayoutNode
|
|
791
|
+
];
|
|
792
|
+
};
|
|
793
|
+
type DropdownMenuSubTriggerLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
794
|
+
type: "dropdown-menu-sub-trigger";
|
|
795
|
+
props: DropdownMenuSubTriggerLayoutProps;
|
|
796
|
+
children: readonly [];
|
|
797
|
+
};
|
|
798
|
+
type DropdownMenuSubContentLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
799
|
+
type: "dropdown-menu-sub-content";
|
|
800
|
+
props?: DropdownMenuSubContentLayoutProps;
|
|
801
|
+
children: readonly DropdownMenuEntryLayoutNode[];
|
|
802
|
+
};
|
|
803
|
+
type DropdownMenuGroupEntryLayoutNode = DropdownMenuLabelLayoutNode | DropdownMenuItemLayoutNode | DropdownMenuSeparatorLayoutNode | DropdownMenuSubLayoutNode;
|
|
804
|
+
type DropdownMenuEntryLayoutNode = DropdownMenuGroupEntryLayoutNode | DropdownMenuGroupLayoutNode;
|
|
805
|
+
type DropdownMenuSlotLayoutNode = DropdownMenuTriggerLayoutNode | DropdownMenuContentLayoutNode | DropdownMenuEntryLayoutNode | DropdownMenuSubTriggerLayoutNode | DropdownMenuSubContentLayoutNode;
|
|
806
|
+
type ScrollAreaLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
807
|
+
type: "scroll-area";
|
|
808
|
+
props?: ScrollAreaLayoutProps;
|
|
809
|
+
};
|
|
810
|
+
type PaginationLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
811
|
+
type: "pagination";
|
|
812
|
+
props: PaginationLayoutProps;
|
|
813
|
+
children: readonly [];
|
|
814
|
+
events?: Partial<Record<PaginationEventType, PaginationEventConfig>>;
|
|
815
|
+
};
|
|
816
|
+
type TabsLayoutNode = BaseLayoutNode & {
|
|
817
|
+
type: "tabs";
|
|
818
|
+
events?: Partial<Record<NavigationEventType, NavigationEventConfig>>;
|
|
819
|
+
};
|
|
820
|
+
type AccordionLayoutNode = BaseLayoutNode & {
|
|
821
|
+
type: "accordion";
|
|
822
|
+
events?: Partial<Record<NavigationEventType, NavigationEventConfig>>;
|
|
823
|
+
};
|
|
824
|
+
type CardLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
825
|
+
type: "card";
|
|
826
|
+
props?: CardLayoutProps;
|
|
827
|
+
children: readonly CardSlotLayoutNode[];
|
|
828
|
+
};
|
|
829
|
+
type CardHeaderLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
830
|
+
type: "card-header";
|
|
831
|
+
props?: CardHeaderLayoutProps;
|
|
832
|
+
};
|
|
833
|
+
type CardContentLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
834
|
+
type: "card-content";
|
|
835
|
+
props?: CardContentLayoutProps;
|
|
836
|
+
};
|
|
837
|
+
type CardFooterLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
838
|
+
type: "card-footer";
|
|
839
|
+
props?: CardFooterLayoutProps;
|
|
840
|
+
};
|
|
841
|
+
type CardSlotLayoutNode = CardHeaderLayoutNode | CardContentLayoutNode | CardFooterLayoutNode;
|
|
842
|
+
type StepperLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
843
|
+
type: "stepper";
|
|
844
|
+
props?: StepperLayoutProps;
|
|
845
|
+
children: readonly StepLayoutNode[];
|
|
846
|
+
events?: Partial<Record<NavigationEventType, NavigationEventConfig>>;
|
|
847
|
+
};
|
|
848
|
+
type StepLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
849
|
+
type: "step";
|
|
850
|
+
props: StepLayoutProps;
|
|
851
|
+
conditions?: Condition[];
|
|
852
|
+
};
|
|
853
|
+
type DialogLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
854
|
+
type: "dialog";
|
|
855
|
+
/** Authoring label for targeting this dialog from Steps / custom actions. */
|
|
856
|
+
name?: string;
|
|
857
|
+
props?: DialogLayoutProps;
|
|
858
|
+
events?: Partial<Record<DialogEventType, DialogEventConfig>>;
|
|
859
|
+
children: readonly DialogSlotLayoutNode[];
|
|
860
|
+
};
|
|
861
|
+
type DialogHeaderLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
862
|
+
type: "dialog-header";
|
|
863
|
+
props: DialogHeaderLayoutProps;
|
|
864
|
+
};
|
|
865
|
+
type DialogBodyLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
866
|
+
type: "dialog-body";
|
|
867
|
+
props?: DialogSlotLayoutProps;
|
|
868
|
+
};
|
|
869
|
+
type DialogFooterLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
870
|
+
type: "dialog-footer";
|
|
871
|
+
props?: DialogSlotLayoutProps;
|
|
872
|
+
};
|
|
873
|
+
type DialogSlotLayoutNode = DialogHeaderLayoutNode | DialogBodyLayoutNode | DialogFooterLayoutNode;
|
|
874
|
+
type DrawerLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
875
|
+
type: "drawer";
|
|
876
|
+
/** Authoring label for targeting this drawer from Steps / custom actions. */
|
|
877
|
+
name?: string;
|
|
878
|
+
props?: DrawerLayoutProps;
|
|
879
|
+
events?: Partial<Record<DrawerEventType, DrawerEventConfig>>;
|
|
880
|
+
children: readonly DrawerSlotLayoutNode[];
|
|
881
|
+
};
|
|
882
|
+
type DrawerHeaderLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
883
|
+
type: "drawer-header";
|
|
884
|
+
props: DrawerHeaderLayoutProps;
|
|
885
|
+
};
|
|
886
|
+
type DrawerBodyLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
887
|
+
type: "drawer-body";
|
|
888
|
+
props?: DrawerSlotLayoutProps;
|
|
889
|
+
};
|
|
890
|
+
type DrawerFooterLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
891
|
+
type: "drawer-footer";
|
|
892
|
+
props?: DrawerSlotLayoutProps;
|
|
893
|
+
};
|
|
894
|
+
type DrawerSlotLayoutNode = DrawerHeaderLayoutNode | DrawerBodyLayoutNode | DrawerFooterLayoutNode;
|
|
895
|
+
type RepeatLayoutNode = Omit<BaseLayoutNode, "props"> & {
|
|
896
|
+
type: "repeat";
|
|
897
|
+
props: RepeatLayoutProps;
|
|
898
|
+
events?: Partial<Record<RepeatEventType, RepeatEventConfig>>;
|
|
899
|
+
};
|
|
900
|
+
/**
|
|
901
|
+
* Reference to another FormSchema resolved by the host (e.g. from a DB).
|
|
902
|
+
* Renders as an isolated nested engine — never merges field names into the parent.
|
|
903
|
+
*/
|
|
904
|
+
type FormRefLayoutProps = Record<string, unknown> & {
|
|
905
|
+
/** Host / DB schema identifier. */
|
|
906
|
+
schemaId: string;
|
|
907
|
+
/** Namespace key for the parent values bag (e.g. `employee`). */
|
|
908
|
+
instanceKey: string;
|
|
909
|
+
className?: string;
|
|
910
|
+
};
|
|
911
|
+
type FormRefLayoutNode = Omit<BaseLayoutNode, "children" | "props"> & {
|
|
912
|
+
type: "form-ref";
|
|
913
|
+
props: FormRefLayoutProps;
|
|
914
|
+
children: readonly [];
|
|
915
|
+
};
|
|
916
|
+
type LayoutNode = StandardLayoutNode | BadgeLayoutNode | TooltipLayoutNode | PopoverLayoutNode | PopoverSlotLayoutNode | DropdownMenuLayoutNode | DropdownMenuSlotLayoutNode | ScrollAreaLayoutNode | PaginationLayoutNode | TabsLayoutNode | AccordionLayoutNode | CardLayoutNode | CardSlotLayoutNode | StepperLayoutNode | StepLayoutNode | DialogLayoutNode | DialogSlotLayoutNode | DrawerLayoutNode | DrawerSlotLayoutNode | RepeatLayoutNode | FormRefLayoutNode;
|
|
917
|
+
|
|
918
|
+
type FormSchema = LayoutNode & {
|
|
919
|
+
id: string;
|
|
920
|
+
version: number;
|
|
921
|
+
name?: string;
|
|
922
|
+
metadata?: {
|
|
923
|
+
createdAt?: string;
|
|
924
|
+
updatedAt?: string;
|
|
925
|
+
};
|
|
926
|
+
};
|
|
927
|
+
type PropertyDefinition = {
|
|
928
|
+
key: string;
|
|
929
|
+
label: string;
|
|
930
|
+
editor: "text" | "number" | "switch" | "select";
|
|
931
|
+
options?: Record<string, unknown>[];
|
|
932
|
+
};
|
|
933
|
+
type RegistryItem = {
|
|
934
|
+
type: Node["type"];
|
|
935
|
+
kind: Node["kind"];
|
|
936
|
+
displayName: string;
|
|
937
|
+
defaultProps?: Record<string, unknown>;
|
|
938
|
+
propsDefinition?: PropertyDefinition[];
|
|
939
|
+
customEditor?: string;
|
|
940
|
+
};
|
|
941
|
+
type Registry = Map<string, RegistryItem>;
|
|
942
|
+
|
|
943
|
+
/** Virtual condition fields that read FormEngine initialization / validity state. */
|
|
944
|
+
declare const STATE_CONDITION_FIELDS: readonly ["$state.isLoading", "$state.isValid", "$state.initializationStatus"];
|
|
945
|
+
type StateConditionField = (typeof STATE_CONDITION_FIELDS)[number];
|
|
946
|
+
declare const STATE_IS_LOADING_VALUES: readonly [true, false];
|
|
947
|
+
/** Boolean `$state.*` fields (`isLoading`, `isValid`). */
|
|
948
|
+
declare const STATE_BOOLEAN_VALUES: readonly [true, false];
|
|
949
|
+
declare const STATE_INITIALIZATION_STATUS_VALUES: readonly ["idle", "loading", "ready", "failed"];
|
|
950
|
+
type StateInitializationStatusValue = (typeof STATE_INITIALIZATION_STATUS_VALUES)[number];
|
|
951
|
+
/** Values accepted by component `props.loading` (boolean or loading binding). */
|
|
952
|
+
declare const LOADING_PROP_BINDINGS: readonly ["$state.isLoading"];
|
|
953
|
+
type FixedLoadingPropBinding = (typeof LOADING_PROP_BINDINGS)[number];
|
|
954
|
+
type LoadingPropBinding = FixedLoadingPropBinding | `$pending.action.${string}` | `$pending.resource.${string}`;
|
|
955
|
+
type LoadingPropValue = boolean | LoadingPropBinding;
|
|
956
|
+
/** Prefix for per-action pending conditions: `$pending.action.<actionNodeId>`. */
|
|
957
|
+
declare const PENDING_ACTION_CONDITION_PREFIX: "$pending.action.";
|
|
958
|
+
/**
|
|
959
|
+
* Prefix for per-resource in-flight conditions:
|
|
960
|
+
* `$pending.resource.<relativePath>` (e.g. `$pending.resource.data`).
|
|
961
|
+
*/
|
|
962
|
+
declare const PENDING_RESOURCE_CONDITION_PREFIX: "$pending.resource.";
|
|
963
|
+
declare const PENDING_BOOLEAN_VALUES: readonly [true, false];
|
|
964
|
+
declare function isStateConditionField(field: string): field is StateConditionField;
|
|
965
|
+
declare function isBooleanStateConditionField(field: string): field is "$state.isLoading" | "$state.isValid";
|
|
966
|
+
declare function isPendingActionConditionField(field: string): boolean;
|
|
967
|
+
declare function isPendingResourceConditionField(field: string): boolean;
|
|
968
|
+
declare function isPendingConditionField(field: string): boolean;
|
|
969
|
+
/** Reserved virtual condition fields (not form value keys). */
|
|
970
|
+
declare function isReservedConditionField(field: string): boolean;
|
|
971
|
+
declare function pendingActionIdFromField(field: string): string | undefined;
|
|
972
|
+
declare function pendingResourcePathFromField(field: string): string | undefined;
|
|
973
|
+
declare function pendingActionConditionField(actionId: string): string;
|
|
974
|
+
declare function pendingResourceConditionField(relativePath: string): string;
|
|
975
|
+
declare function isLoadingPropBinding(value: unknown): value is LoadingPropBinding;
|
|
976
|
+
declare function defaultStateConditionValue(field: StateConditionField): boolean | "ready";
|
|
977
|
+
declare function defaultPendingConditionValue(): boolean;
|
|
978
|
+
declare function isValidStateConditionValue(field: StateConditionField, value: unknown): boolean;
|
|
979
|
+
declare function isValidPendingConditionValue(value: unknown): value is boolean;
|
|
980
|
+
|
|
981
|
+
export { type AccordionItemLayoutProps, type AccordionLayoutNode, type ActionNode, type ActionType, type AlertDisplayEventType, type AlertDisplayNode, type BadgeLayoutNode, type BadgeLayoutProps, type BadgeType, type BaseNode, type CardContentLayoutNode, type CardContentLayoutProps, type CardFooterLayoutNode, type CardFooterLayoutProps, type CardHeaderLayoutNode, type CardHeaderLayoutProps, type CardLayoutNode, type CardLayoutProps, type CardSlotLayoutNode, type ChipsDisplayEventType, type ChipsDisplayNode, type ComputedCondition, type ComputedConfig, type ComputedInput, type ComputedOperator, type Condition, type ConditionOperator, type CustomActionNode, type DialogBodyLayoutNode, type DialogEventConfig, type DialogEventType, type DialogFooterLayoutNode, type DialogHeaderLayoutNode, type DialogHeaderLayoutProps, type DialogLayoutNode, type DialogLayoutProps, type DialogOperation, type DialogSize, type DialogSlotLayoutNode, type DialogSlotLayoutProps, type DialogStep, type DisplayEventConfig, type DisplayEventType, type DisplayNode, type DisplayType, type DrawerBodyLayoutNode, type DrawerEventConfig, type DrawerEventType, type DrawerFooterLayoutNode, type DrawerHeaderLayoutNode, type DrawerHeaderLayoutProps, type DrawerLayoutNode, type DrawerLayoutProps, type DrawerOperation, type DrawerSide, type DrawerSlotLayoutNode, type DrawerSlotLayoutProps, type DrawerStep, type DropdownMenuAlign, type DropdownMenuContentLayoutNode, type DropdownMenuContentLayoutProps, type DropdownMenuEntryLayoutNode, type DropdownMenuGroupEntryLayoutNode, type DropdownMenuGroupLayoutNode, type DropdownMenuGroupLayoutProps, type DropdownMenuItemLayoutNode, type DropdownMenuItemLayoutProps, type DropdownMenuItemVariant, type DropdownMenuLabelLayoutNode, type DropdownMenuLabelLayoutProps, type DropdownMenuLayoutNode, type DropdownMenuLayoutProps, type DropdownMenuSeparatorLayoutNode, type DropdownMenuSeparatorLayoutProps, type DropdownMenuSide, type DropdownMenuSlotLayoutNode, type DropdownMenuSubContentLayoutNode, type DropdownMenuSubContentLayoutProps, type DropdownMenuSubLayoutNode, type DropdownMenuSubLayoutProps, type DropdownMenuSubTriggerLayoutNode, type DropdownMenuSubTriggerLayoutProps, type DropdownMenuTriggerLayoutNode, type DropdownMenuTriggerLayoutProps, FIELD_TYPES_WITH_CHANGE_EVENT, FIELD_TYPES_WITH_COMMIT_EVENT, type FieldCondition, type FieldEventConfig, type FieldEventType, type FieldNode, type FieldType, type FieldTypeWithChangeEvent, type FieldTypeWithCommitEvent, type FixedLoadingPropBinding, type FormRefLayoutNode, type FormRefLayoutProps, type FormSchema, type InvokeCondition, type InvokeStep, LOADING_PROP_BINDINGS, type LayoutNode, type LayoutType, type LoadingPropBinding, type LoadingPropValue, type NavigationEventConfig, type NavigationEventType, type Node, type NodeKind, type OptionsConfig, PENDING_ACTION_CONDITION_PREFIX, PENDING_BOOLEAN_VALUES, PENDING_RESOURCE_CONDITION_PREFIX, type PaginationEventConfig, type PaginationEventType, type PaginationLayoutNode, type PaginationLayoutProps, type PopoverAlign, type PopoverContentLayoutNode, type PopoverContentLayoutProps, type PopoverLayoutNode, type PopoverLayoutProps, type PopoverSide, type PopoverSlotLayoutNode, type PopoverTriggerLayoutNode, type PopoverTriggerLayoutProps, type PropertyDefinition, REPEAT_MAX_COUNT, type Registry, type RegistryItem, type RepeatEventConfig, type RepeatEventType, type RepeatLayoutNode, type RepeatLayoutProps, type RepeatMode, type RepeatOperation, type RepeatStep, type ResetActionNode, STATE_BOOLEAN_VALUES, STATE_CONDITION_FIELDS, STATE_INITIALIZATION_STATUS_VALUES, STATE_IS_LOADING_VALUES, type ScrollAreaDirection, type ScrollAreaLayoutNode, type ScrollAreaLayoutProps, type ScrollAreaType, type SegmentButtonFieldNode, type SegmentButtonFieldProps, type SegmentButtonOptionsConfig, type SegmentButtonSize, type SegmentButtonValue, type SelectMode, type SelectOptionValue, type SelectValue, type SkeletonDisplayNode, type SkeletonDisplayProps, type SliderMode, type SliderRangeValue, type SliderValue, type SlotDisplayNode, type SlotDisplayProps, type StandardLayoutNode, type StateConditionField, type StateInitializationStatusValue, type Step, type StepLayoutNode, type StepLayoutProps, type StepperActionNode, type StepperActionType, type StepperConnector, type StepperLayoutNode, type StepperLayoutProps, type StepperOrientation, type SubmitActionNode, type SubmitOrResetActionNode, type TableActionsColumn, type TableAlign, type TableColumn, type TableColumnAction, type TableColumnActionColor, type TableData, type TableDisplayEventType, type TableDisplayNode, type TableDisplayProps, type TableInteraction, type TableSourceData, type TableStaticData, type TableTagColumn, type TableTagValueMapping, type TableTagVariant, type TableTextColumn, type TabsLayoutNode, type TagDisplayNode, type TagDisplayProps, type TimeValue, type ToastPosition, type ToastStep, type ToastVariant, type TooltipLayoutNode, type TooltipLayoutProps, type TooltipSide, type TypographyAs, type TypographyDisplayNode, type TypographyDisplayProps, type ValidationRule, type WhenStep, defaultPendingConditionValue, defaultStateConditionValue, fieldAllowsBlurEvent, fieldAllowsChangeEvent, fieldAllowsCommitEvent, fieldAllowsEvent, isBooleanStateConditionField, isFieldCondition, isInvokeCondition, isLoadingPropBinding, isPendingActionConditionField, isPendingConditionField, isPendingResourceConditionField, isReservedConditionField, isStateConditionField, isValidPendingConditionValue, isValidStateConditionValue, isValuelessConditionOperator, pendingActionConditionField, pendingActionIdFromField, pendingResourceConditionField, pendingResourcePathFromField };
|