@formbox/htmx 0.4.4 → 0.5.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.d.ts +648 -49
- package/dist/index.js +30 -5
- package/package.json +8 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,56 +1,8 @@
|
|
|
1
|
-
import { AnswerListProperties } from '@formbox/theme';
|
|
2
|
-
import { AnswerScaffoldProperties } from '@formbox/theme';
|
|
3
|
-
import { Attachment } from '@formbox/theme';
|
|
4
|
-
import { CheckboxListProperties } from '@formbox/theme';
|
|
5
|
-
import { CheckboxProperties } from '@formbox/theme';
|
|
6
|
-
import { CustomExtensionDefinitions } from '@formbox/theme';
|
|
7
|
-
import { CustomOptionFormProperties } from '@formbox/theme';
|
|
8
|
-
import { DateInputProperties } from '@formbox/theme';
|
|
9
|
-
import { DateTimeInputProperties } from '@formbox/theme';
|
|
10
|
-
import { DisplayRendererProperties } from '@formbox/theme';
|
|
11
|
-
import { ErrorsProperties } from '@formbox/theme';
|
|
12
1
|
import { FhirVersion } from '@formbox/fhir';
|
|
13
|
-
import {
|
|
14
|
-
import { FlyoverProperties } from '@formbox/theme';
|
|
15
|
-
import { FooterProperties } from '@formbox/theme';
|
|
16
|
-
import { FormPagination } from '@formbox/theme';
|
|
17
|
-
import { FormProperties } from '@formbox/theme';
|
|
18
|
-
import { GroupListProperties } from '@formbox/theme';
|
|
19
|
-
import { GroupScaffoldProperties } from '@formbox/theme';
|
|
20
|
-
import { HeaderProperties } from '@formbox/theme';
|
|
21
|
-
import { HelpProperties } from '@formbox/theme';
|
|
22
|
-
import { InputGroupProperties } from '@formbox/theme';
|
|
23
|
-
import { LabelProperties } from '@formbox/theme';
|
|
24
|
-
import { LanguageSelectorProperties } from '@formbox/theme';
|
|
25
|
-
import { LegalProperties } from '@formbox/theme';
|
|
26
|
-
import { LinkProperties } from '@formbox/theme';
|
|
27
|
-
import { MultiSelectInputProperties } from '@formbox/theme';
|
|
28
|
-
import { NodePath } from '@formbox/theme';
|
|
29
|
-
import { NumberInputProperties } from '@formbox/theme';
|
|
30
|
-
import { OptionDisplayProperties } from '@formbox/theme';
|
|
31
|
-
import { OptionItem } from '@formbox/theme';
|
|
32
|
-
import { OptionsLoadingProperties } from '@formbox/theme';
|
|
2
|
+
import { HTMLAttributes } from 'react';
|
|
33
3
|
import { QuestionnaireOf } from '@formbox/fhir';
|
|
34
4
|
import { QuestionnaireResponseOf } from '@formbox/fhir';
|
|
35
|
-
import { QuestionScaffoldProperties } from '@formbox/theme';
|
|
36
|
-
import { RadioButtonListProperties } from '@formbox/theme';
|
|
37
|
-
import { RadioButtonProperties } from '@formbox/theme';
|
|
38
5
|
import { ReactNode } from 'react';
|
|
39
|
-
import { SelectedOptionItem } from '@formbox/theme';
|
|
40
|
-
import { SelectInputProperties } from '@formbox/theme';
|
|
41
|
-
import { SignatureInputProperties } from '@formbox/theme';
|
|
42
|
-
import { SliderInputProperties } from '@formbox/theme';
|
|
43
|
-
import { SpinnerInputProperties } from '@formbox/theme';
|
|
44
|
-
import { StackProperties } from '@formbox/theme';
|
|
45
|
-
import { Strings } from '@formbox/theme';
|
|
46
|
-
import { TabContainerProperties } from '@formbox/theme';
|
|
47
|
-
import { TableCell } from '@formbox/theme';
|
|
48
|
-
import { TableColumn } from '@formbox/theme';
|
|
49
|
-
import { TableProperties } from '@formbox/theme';
|
|
50
|
-
import { TableRow } from '@formbox/theme';
|
|
51
|
-
import { TextAreaProperties } from '@formbox/theme';
|
|
52
|
-
import { TextInputProperties } from '@formbox/theme';
|
|
53
|
-
import { TimeInputProperties } from '@formbox/theme';
|
|
54
6
|
|
|
55
7
|
export declare const ACTION_FIELD = "fb[action]";
|
|
56
8
|
|
|
@@ -70,23 +22,67 @@ export declare type AddActionProperties = {
|
|
|
70
22
|
|
|
71
23
|
export declare type AnswerField = "value" | "system" | "code" | "display" | "unit" | "baseline" | "signature";
|
|
72
24
|
|
|
25
|
+
declare type AnswerListProperties = {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
onAdd?: (() => void) | undefined;
|
|
28
|
+
canAdd?: boolean | undefined;
|
|
29
|
+
path?: NodePath | undefined;
|
|
30
|
+
};
|
|
31
|
+
|
|
73
32
|
export declare type AnswerListTemplateProperties = Omit<TemplateBase<AnswerListProperties>, "children"> & {
|
|
74
33
|
readonly children: string;
|
|
75
34
|
readonly hasCount: boolean;
|
|
76
35
|
} & AddActionProperties;
|
|
77
36
|
|
|
37
|
+
declare type AnswerScaffoldProperties = {
|
|
38
|
+
control: ReactNode;
|
|
39
|
+
onRemove?: (() => void) | undefined;
|
|
40
|
+
canRemove?: boolean | undefined;
|
|
41
|
+
errors?: ReactNode;
|
|
42
|
+
children?: ReactNode;
|
|
43
|
+
path?: NodePath | undefined;
|
|
44
|
+
};
|
|
45
|
+
|
|
78
46
|
export declare type AnswerScaffoldTemplateProperties = Omit<TemplateBase<AnswerScaffoldProperties>, "children" | "control" | "errors"> & {
|
|
79
47
|
readonly control: string;
|
|
80
48
|
readonly errors?: string | undefined;
|
|
81
49
|
readonly children?: string | undefined;
|
|
82
50
|
} & RemoveActionProperties;
|
|
83
51
|
|
|
52
|
+
declare type Attachment = {
|
|
53
|
+
title?: string | undefined;
|
|
54
|
+
url?: string | undefined;
|
|
55
|
+
size?: number | undefined;
|
|
56
|
+
contentType?: string | undefined;
|
|
57
|
+
data?: string | undefined;
|
|
58
|
+
};
|
|
59
|
+
|
|
84
60
|
export declare function attribute(name: string, value: unknown): string;
|
|
85
61
|
|
|
62
|
+
declare type BivariantExtract<TContext, TValue> = {
|
|
63
|
+
bivarianceHack(context: TContext): TValue;
|
|
64
|
+
}["bivarianceHack"];
|
|
65
|
+
|
|
86
66
|
export declare function calculatedName(path: NodePath): string;
|
|
87
67
|
|
|
88
68
|
export declare function checkboxHiddenValue(properties: CheckboxProperties, checkedValue: string): string | undefined;
|
|
89
69
|
|
|
70
|
+
declare type CheckboxListProperties = {
|
|
71
|
+
options: readonly OptionItem[];
|
|
72
|
+
selectedOptions: readonly SelectedOptionItem[];
|
|
73
|
+
orientation?: ChoiceOrientation | undefined;
|
|
74
|
+
onSelect: (token: string) => void;
|
|
75
|
+
onDeselect: (token: string) => void;
|
|
76
|
+
specifyOtherOption?: OptionItem | undefined;
|
|
77
|
+
customOptionForm?: ReactNode;
|
|
78
|
+
id: string;
|
|
79
|
+
path?: NodePath | undefined;
|
|
80
|
+
ariaLabelledBy: string;
|
|
81
|
+
ariaDescribedBy?: string | undefined;
|
|
82
|
+
disabled?: boolean | undefined;
|
|
83
|
+
isLoading?: boolean | undefined;
|
|
84
|
+
};
|
|
85
|
+
|
|
90
86
|
export declare type CheckboxListTemplateProperties = Omit<FieldTemplateProperties<CheckboxListProperties>, "customOptionForm" | "options" | "selectedOptions" | "specifyOtherOption"> & {
|
|
91
87
|
readonly baselineName?: string | undefined;
|
|
92
88
|
readonly hiddenInputs: readonly HiddenTemplateInput[];
|
|
@@ -105,11 +101,26 @@ export declare type CheckboxOptionTemplateItem = TemplateOptionItem & {
|
|
|
105
101
|
readonly hiddenInput?: HiddenTemplateInput | undefined;
|
|
106
102
|
};
|
|
107
103
|
|
|
104
|
+
declare type CheckboxProperties = {
|
|
105
|
+
id: string;
|
|
106
|
+
path?: NodePath | undefined;
|
|
107
|
+
checkedValue?: string | undefined;
|
|
108
|
+
uncheckedValue?: string | undefined;
|
|
109
|
+
checked: boolean;
|
|
110
|
+
onChange: () => void;
|
|
111
|
+
ariaLabelledBy: string;
|
|
112
|
+
ariaDescribedBy?: string | undefined;
|
|
113
|
+
disabled?: boolean;
|
|
114
|
+
label?: ReactNode;
|
|
115
|
+
};
|
|
116
|
+
|
|
108
117
|
export declare type CheckboxTemplateProperties = Omit<FieldTemplateProperties<CheckboxProperties>, "label"> & {
|
|
109
118
|
readonly hiddenValue?: string | undefined;
|
|
110
119
|
readonly label?: string | undefined;
|
|
111
120
|
};
|
|
112
121
|
|
|
122
|
+
declare type ChoiceOrientation = "horizontal" | "vertical";
|
|
123
|
+
|
|
113
124
|
export declare type CollapsibleActionProperties = {
|
|
114
125
|
readonly actionName?: string | undefined;
|
|
115
126
|
readonly collapseLabel?: string | undefined;
|
|
@@ -125,6 +136,28 @@ export declare function compileTemplates(sources: TemplateSources): Templates;
|
|
|
125
136
|
|
|
126
137
|
export declare function countName(path: NodePath): string;
|
|
127
138
|
|
|
139
|
+
declare type CustomExtensionDefinition<TContext = unknown, TValue = unknown, TRepeats extends boolean = boolean> = {
|
|
140
|
+
readonly target: CustomExtensionTarget;
|
|
141
|
+
readonly url: string;
|
|
142
|
+
readonly repeats: TRepeats;
|
|
143
|
+
readonly extract: BivariantExtract<TContext, TValue>;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
declare type CustomExtensionDefinitions<TContext = unknown> = Readonly<Record<string, CustomExtensionDefinition<TContext, unknown, boolean>>>;
|
|
147
|
+
|
|
148
|
+
declare type CustomExtensionTarget = "questionnaire" | "item";
|
|
149
|
+
|
|
150
|
+
declare type CustomExtensionValues = Readonly<Record<string, unknown>>;
|
|
151
|
+
|
|
152
|
+
declare type CustomOptionFormProperties = {
|
|
153
|
+
id?: string | undefined;
|
|
154
|
+
content: ReactNode;
|
|
155
|
+
errors?: ReactNode | undefined;
|
|
156
|
+
onCancel: () => void;
|
|
157
|
+
onSubmit: () => void;
|
|
158
|
+
canSubmit?: boolean | undefined;
|
|
159
|
+
};
|
|
160
|
+
|
|
128
161
|
export declare type CustomOptionFormTemplateProperties = Omit<TemplateBase<CustomOptionFormProperties>, "content" | "errors"> & {
|
|
129
162
|
readonly actionName: string;
|
|
130
163
|
readonly cancelLabel: string;
|
|
@@ -137,6 +170,19 @@ export declare type CustomOptionFormTemplateProperties = Omit<TemplateBase<Custo
|
|
|
137
170
|
|
|
138
171
|
export declare function customUnitFormName(path: NodePath): string;
|
|
139
172
|
|
|
173
|
+
declare type DateInputProperties = {
|
|
174
|
+
id: string;
|
|
175
|
+
path?: NodePath | undefined;
|
|
176
|
+
value: string;
|
|
177
|
+
onChange: (v: string) => void;
|
|
178
|
+
disabled?: boolean | undefined;
|
|
179
|
+
placeholder?: string | undefined;
|
|
180
|
+
ariaLabelledBy: string;
|
|
181
|
+
ariaDescribedBy?: string | undefined;
|
|
182
|
+
min?: string | undefined;
|
|
183
|
+
max?: string | undefined;
|
|
184
|
+
};
|
|
185
|
+
|
|
140
186
|
export declare type DateInputTemplateProperties = FieldTemplateProperties<DateInputProperties> & {
|
|
141
187
|
readonly inputType: "date" | "text";
|
|
142
188
|
readonly step: undefined;
|
|
@@ -144,6 +190,19 @@ export declare type DateInputTemplateProperties = FieldTemplateProperties<DateIn
|
|
|
144
190
|
|
|
145
191
|
export declare function dateTimeConstraint(value: string | undefined): string | undefined;
|
|
146
192
|
|
|
193
|
+
declare type DateTimeInputProperties = {
|
|
194
|
+
id: string;
|
|
195
|
+
path?: NodePath | undefined;
|
|
196
|
+
value: string;
|
|
197
|
+
onChange: (v: string) => void;
|
|
198
|
+
disabled?: boolean | undefined;
|
|
199
|
+
placeholder?: string | undefined;
|
|
200
|
+
ariaLabelledBy: string;
|
|
201
|
+
ariaDescribedBy?: string | undefined;
|
|
202
|
+
min?: string | undefined;
|
|
203
|
+
max?: string | undefined;
|
|
204
|
+
};
|
|
205
|
+
|
|
147
206
|
export declare type DateTimeInputTemplateProperties = FieldTemplateProperties<DateTimeInputProperties> & {
|
|
148
207
|
readonly baselineName?: string | undefined;
|
|
149
208
|
readonly baselineValue?: string | undefined;
|
|
@@ -156,10 +215,21 @@ export declare type DateTimeInputTemplateProperties = FieldTemplateProperties<Da
|
|
|
156
215
|
|
|
157
216
|
export declare function defaultAttributes(action: string | undefined): HtmlAttributes;
|
|
158
217
|
|
|
218
|
+
declare type DisplayRendererProperties = {
|
|
219
|
+
linkId: string;
|
|
220
|
+
children: ReactNode;
|
|
221
|
+
customExtensions?: CustomExtensionValues | undefined;
|
|
222
|
+
};
|
|
223
|
+
|
|
159
224
|
export declare type DisplayRendererTemplateProperties = Omit<TemplateBase<DisplayRendererProperties>, "children"> & {
|
|
160
225
|
readonly children: string;
|
|
161
226
|
};
|
|
162
227
|
|
|
228
|
+
declare type ErrorsProperties = {
|
|
229
|
+
id: string;
|
|
230
|
+
messages: string[];
|
|
231
|
+
};
|
|
232
|
+
|
|
163
233
|
export declare type ErrorsTemplateProperties = Omit<TemplateBase<ErrorsProperties>, "messages"> & {
|
|
164
234
|
readonly hasMessages: boolean;
|
|
165
235
|
readonly messages: readonly {
|
|
@@ -175,6 +245,17 @@ export declare function fieldAttributes(path: NodePath | undefined, field: Answe
|
|
|
175
245
|
|
|
176
246
|
declare type FieldTemplateProperties<TProperties> = TemplateBase<TProperties> & TemplateFieldAttributes;
|
|
177
247
|
|
|
248
|
+
declare type FileInputProperties = {
|
|
249
|
+
value: Attachment | undefined;
|
|
250
|
+
id: string;
|
|
251
|
+
path?: NodePath | undefined;
|
|
252
|
+
ariaLabelledBy: string;
|
|
253
|
+
ariaDescribedBy?: string | undefined;
|
|
254
|
+
disabled?: boolean | undefined;
|
|
255
|
+
accept?: string | undefined;
|
|
256
|
+
onChange?: ((file?: File) => void) | undefined;
|
|
257
|
+
};
|
|
258
|
+
|
|
178
259
|
export declare type FileInputTemplateProperties = FieldTemplateProperties<FileInputProperties> & {
|
|
179
260
|
readonly clearId?: string | undefined;
|
|
180
261
|
readonly clearLabel: string;
|
|
@@ -184,12 +265,22 @@ export declare type FileInputTemplateProperties = FieldTemplateProperties<FileIn
|
|
|
184
265
|
readonly hxInclude: "closest form";
|
|
185
266
|
};
|
|
186
267
|
|
|
268
|
+
declare type FlyoverProperties = {
|
|
269
|
+
id: string;
|
|
270
|
+
children: ReactNode;
|
|
271
|
+
};
|
|
272
|
+
|
|
187
273
|
export declare type FlyoverTemplateProperties = Omit<TemplateBase<FlyoverProperties>, "children"> & {
|
|
188
274
|
readonly ariaLabel: string;
|
|
189
275
|
readonly buttonId?: string | undefined;
|
|
190
276
|
readonly children: string;
|
|
191
277
|
};
|
|
192
278
|
|
|
279
|
+
declare type FooterProperties = {
|
|
280
|
+
linkId: string;
|
|
281
|
+
children: ReactNode;
|
|
282
|
+
};
|
|
283
|
+
|
|
193
284
|
export declare type FooterTemplateProperties = Omit<TemplateBase<FooterProperties>, "children"> & {
|
|
194
285
|
readonly children: string;
|
|
195
286
|
};
|
|
@@ -198,6 +289,31 @@ declare type FormFieldsProperties = Omit<FormTemplateProperties, "attributes" |
|
|
|
198
289
|
|
|
199
290
|
export declare function formFieldsTemplate(properties: FormFieldsProperties): string;
|
|
200
291
|
|
|
292
|
+
declare type FormPagination = {
|
|
293
|
+
current: number;
|
|
294
|
+
total: number;
|
|
295
|
+
onPrev: () => void;
|
|
296
|
+
onNext: () => void;
|
|
297
|
+
disabledPrev: boolean;
|
|
298
|
+
disabledNext: boolean;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
declare type FormProperties = {
|
|
302
|
+
id?: string | undefined;
|
|
303
|
+
onSubmit?: (() => void) | undefined;
|
|
304
|
+
onCancel?: (() => void) | undefined;
|
|
305
|
+
children: ReactNode;
|
|
306
|
+
pagination?: FormPagination | undefined;
|
|
307
|
+
title?: string | undefined;
|
|
308
|
+
description?: string | undefined;
|
|
309
|
+
languageSelector?: ReactNode;
|
|
310
|
+
errors?: ReactNode;
|
|
311
|
+
before?: ReactNode;
|
|
312
|
+
after?: ReactNode;
|
|
313
|
+
signature?: ReactNode;
|
|
314
|
+
customExtensions?: CustomExtensionValues | undefined;
|
|
315
|
+
};
|
|
316
|
+
|
|
201
317
|
export declare type FormTemplateProperties = Omit<TemplateBase<FormProperties>, "after" | "before" | "children" | "errors" | "languageSelector" | "pagination" | "signature"> & {
|
|
202
318
|
readonly after?: string | undefined;
|
|
203
319
|
readonly before?: string | undefined;
|
|
@@ -211,6 +327,18 @@ export declare type FormTemplateProperties = Omit<TemplateBase<FormProperties>,
|
|
|
211
327
|
readonly submitLabel: string;
|
|
212
328
|
};
|
|
213
329
|
|
|
330
|
+
declare type GroupListProperties = {
|
|
331
|
+
linkId: string;
|
|
332
|
+
header?: ReactNode;
|
|
333
|
+
errors?: ReactNode;
|
|
334
|
+
children: ReactNode;
|
|
335
|
+
onAdd?: (() => void) | undefined;
|
|
336
|
+
canAdd?: boolean | undefined;
|
|
337
|
+
path?: NodePath | undefined;
|
|
338
|
+
count?: number | undefined;
|
|
339
|
+
customExtensions?: CustomExtensionValues | undefined;
|
|
340
|
+
};
|
|
341
|
+
|
|
214
342
|
export declare type GroupListTemplateProperties = Omit<TemplateBase<GroupListProperties>, "children" | "errors" | "header"> & {
|
|
215
343
|
readonly header?: string | undefined;
|
|
216
344
|
readonly errors?: string | undefined;
|
|
@@ -218,6 +346,20 @@ export declare type GroupListTemplateProperties = Omit<TemplateBase<GroupListPro
|
|
|
218
346
|
readonly hasCount: boolean;
|
|
219
347
|
} & AddActionProperties;
|
|
220
348
|
|
|
349
|
+
declare type GroupScaffoldProperties = {
|
|
350
|
+
linkId?: string | undefined;
|
|
351
|
+
path?: NodePath | undefined;
|
|
352
|
+
header?: ReactNode;
|
|
353
|
+
children?: ReactNode;
|
|
354
|
+
errors?: ReactNode;
|
|
355
|
+
signature?: ReactNode;
|
|
356
|
+
isExpandable?: boolean | undefined;
|
|
357
|
+
isExpanded: boolean;
|
|
358
|
+
onRemove?: (() => void) | undefined;
|
|
359
|
+
canRemove?: boolean | undefined;
|
|
360
|
+
customExtensions?: CustomExtensionValues | undefined;
|
|
361
|
+
};
|
|
362
|
+
|
|
221
363
|
export declare type GroupScaffoldTemplateProperties = Omit<TemplateBase<GroupScaffoldProperties>, "children" | "errors" | "header" | "signature"> & {
|
|
222
364
|
readonly header?: string | undefined;
|
|
223
365
|
readonly children?: string | undefined;
|
|
@@ -228,10 +370,20 @@ export declare type GroupScaffoldTemplateProperties = Omit<TemplateBase<GroupSca
|
|
|
228
370
|
readonly signature?: string | undefined;
|
|
229
371
|
} & RemoveActionProperties & CollapsibleActionProperties;
|
|
230
372
|
|
|
373
|
+
declare type HeaderProperties = {
|
|
374
|
+
linkId: string;
|
|
375
|
+
children: ReactNode;
|
|
376
|
+
};
|
|
377
|
+
|
|
231
378
|
export declare type HeaderTemplateProperties = Omit<TemplateBase<HeaderProperties>, "children"> & {
|
|
232
379
|
readonly children: string;
|
|
233
380
|
};
|
|
234
381
|
|
|
382
|
+
declare type HelpProperties = {
|
|
383
|
+
id: string;
|
|
384
|
+
children: ReactNode;
|
|
385
|
+
};
|
|
386
|
+
|
|
235
387
|
export declare type HelpTemplateProperties = Omit<TemplateBase<HelpProperties>, "children"> & {
|
|
236
388
|
readonly ariaLabel: string;
|
|
237
389
|
readonly buttonId?: string | undefined;
|
|
@@ -251,8 +403,18 @@ export declare function htmlAttributes(values: HtmlAttributes): string;
|
|
|
251
403
|
|
|
252
404
|
export declare type HtmlAttributeValue = string | number | boolean | null | undefined;
|
|
253
405
|
|
|
406
|
+
declare type Hyperlink = {
|
|
407
|
+
href: string;
|
|
408
|
+
label: string | undefined;
|
|
409
|
+
};
|
|
410
|
+
|
|
254
411
|
export declare function inferTextField(id: string, group: InputGroupState | undefined): AnswerField;
|
|
255
412
|
|
|
413
|
+
declare type InputGroupProperties = {
|
|
414
|
+
children: ReactNode;
|
|
415
|
+
spans: number[];
|
|
416
|
+
};
|
|
417
|
+
|
|
256
418
|
export declare type InputGroupState = {
|
|
257
419
|
readonly size: number;
|
|
258
420
|
readonly index: number;
|
|
@@ -268,6 +430,25 @@ export declare function isDefined<T>(value: T | undefined): value is T;
|
|
|
268
430
|
|
|
269
431
|
export declare function isPreservedOptionToken(token: string): boolean;
|
|
270
432
|
|
|
433
|
+
declare type LabelAs = "legend" | "label" | "text";
|
|
434
|
+
|
|
435
|
+
declare type LabelProperties = {
|
|
436
|
+
prefix?: ReactNode;
|
|
437
|
+
shortText?: string | undefined;
|
|
438
|
+
supportHyperlinks?: ReadonlyArray<Hyperlink> | undefined;
|
|
439
|
+
media?: Attachment | undefined;
|
|
440
|
+
isExpanded: boolean;
|
|
441
|
+
onToggleExpanded?: (() => void) | undefined;
|
|
442
|
+
children: ReactNode;
|
|
443
|
+
id: string;
|
|
444
|
+
htmlFor?: string | undefined;
|
|
445
|
+
required?: boolean | undefined;
|
|
446
|
+
help?: ReactNode;
|
|
447
|
+
legal?: ReactNode;
|
|
448
|
+
flyover?: ReactNode;
|
|
449
|
+
as?: LabelAs | undefined;
|
|
450
|
+
};
|
|
451
|
+
|
|
271
452
|
export declare type LabelTemplateProperties = Omit<TemplateBase<LabelProperties>, "children" | "flyover" | "help" | "legal" | "prefix"> & {
|
|
272
453
|
readonly attachmentLabel: string;
|
|
273
454
|
readonly prefix?: string | undefined;
|
|
@@ -287,6 +468,18 @@ export declare type LabelTemplateProperties = Omit<TemplateBase<LabelProperties>
|
|
|
287
468
|
|
|
288
469
|
export declare const LANGUAGE_FIELD = "fb[language]";
|
|
289
470
|
|
|
471
|
+
declare type LanguageOption = {
|
|
472
|
+
value: string;
|
|
473
|
+
label: string;
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
declare type LanguageSelectorProperties = {
|
|
477
|
+
id?: string | undefined;
|
|
478
|
+
options: readonly LanguageOption[];
|
|
479
|
+
value: string;
|
|
480
|
+
onChange: (value: string) => void;
|
|
481
|
+
};
|
|
482
|
+
|
|
290
483
|
export declare type LanguageSelectorTemplateProperties = Omit<TemplateBase<LanguageSelectorProperties>, "options"> & {
|
|
291
484
|
readonly id?: string | undefined;
|
|
292
485
|
readonly name: string;
|
|
@@ -299,12 +492,25 @@ export declare function lastLinkId(path: NodePath): string;
|
|
|
299
492
|
|
|
300
493
|
export declare type LaunchContext = Record<string, unknown>;
|
|
301
494
|
|
|
495
|
+
declare type LegalProperties = {
|
|
496
|
+
id: string;
|
|
497
|
+
children: ReactNode;
|
|
498
|
+
};
|
|
499
|
+
|
|
302
500
|
export declare type LegalTemplateProperties = Omit<TemplateBase<LegalProperties>, "children"> & {
|
|
303
501
|
readonly ariaLabel: string;
|
|
304
502
|
readonly buttonId?: string | undefined;
|
|
305
503
|
readonly children: string;
|
|
306
504
|
};
|
|
307
505
|
|
|
506
|
+
declare type LinkProperties = {
|
|
507
|
+
id?: string | undefined;
|
|
508
|
+
href: string;
|
|
509
|
+
children: ReactNode;
|
|
510
|
+
target?: string | undefined;
|
|
511
|
+
rel?: string | undefined;
|
|
512
|
+
};
|
|
513
|
+
|
|
308
514
|
export declare type LinkTemplateProperties = Omit<TemplateBase<LinkProperties>, "children"> & {
|
|
309
515
|
readonly children: string;
|
|
310
516
|
};
|
|
@@ -315,6 +521,24 @@ export declare function loadTemplates(directory: string | URL): Promise<Template
|
|
|
315
521
|
|
|
316
522
|
export declare function mediaHtml(attachment: Attachment | undefined, fallbackLabel: string, id?: string | undefined): string;
|
|
317
523
|
|
|
524
|
+
declare type MultiSelectInputProperties = {
|
|
525
|
+
options: readonly OptionItem[];
|
|
526
|
+
selectedOptions: readonly SelectedOptionItem[];
|
|
527
|
+
searchQuery: string;
|
|
528
|
+
onSelect: (token: string) => void;
|
|
529
|
+
onDeselect: (token: string) => void;
|
|
530
|
+
onSearch?: (query: string) => void;
|
|
531
|
+
specifyOtherOption?: OptionItem | undefined;
|
|
532
|
+
customOptionForm?: ReactNode;
|
|
533
|
+
id: string;
|
|
534
|
+
path?: NodePath | undefined;
|
|
535
|
+
ariaLabelledBy: string;
|
|
536
|
+
ariaDescribedBy?: string | undefined;
|
|
537
|
+
disabled?: boolean | undefined;
|
|
538
|
+
isLoading?: boolean | undefined;
|
|
539
|
+
placeholder?: string | undefined;
|
|
540
|
+
};
|
|
541
|
+
|
|
318
542
|
export declare type MultiSelectInputTemplateProperties = Omit<FieldTemplateProperties<MultiSelectInputProperties>, "customOptionForm" | "options" | "selectedOptions" | "specifyOtherOption"> & {
|
|
319
543
|
readonly baselineName?: string | undefined;
|
|
320
544
|
readonly searchLabel: string;
|
|
@@ -328,6 +552,28 @@ export declare type MultiSelectInputTemplateProperties = Omit<FieldTemplatePrope
|
|
|
328
552
|
readonly customOptionForm?: string | undefined;
|
|
329
553
|
};
|
|
330
554
|
|
|
555
|
+
declare type NodePath = readonly NodePathSegment[];
|
|
556
|
+
|
|
557
|
+
declare interface NodePathSegment {
|
|
558
|
+
readonly linkId: string;
|
|
559
|
+
readonly index?: number | undefined;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
declare type NumberInputProperties = {
|
|
563
|
+
id: string;
|
|
564
|
+
path?: NodePath | undefined;
|
|
565
|
+
value: number | undefined;
|
|
566
|
+
onChange: (v?: number) => void;
|
|
567
|
+
disabled?: boolean | undefined;
|
|
568
|
+
placeholder?: string | undefined;
|
|
569
|
+
step?: number | "any";
|
|
570
|
+
min?: number | undefined;
|
|
571
|
+
max?: number | undefined;
|
|
572
|
+
ariaLabelledBy: string;
|
|
573
|
+
ariaDescribedBy?: string | undefined;
|
|
574
|
+
unitLabel?: string | undefined;
|
|
575
|
+
};
|
|
576
|
+
|
|
331
577
|
export declare type NumberInputTemplateProperties = FieldTemplateProperties<NumberInputProperties> & NumberInputViewProperties;
|
|
332
578
|
|
|
333
579
|
declare type NumberInputViewProperties = {
|
|
@@ -342,12 +588,29 @@ export declare function numberTemplateProperties(properties: SliderInputProperti
|
|
|
342
588
|
|
|
343
589
|
export declare function numberTemplateProperties(properties: SpinnerInputProperties): SpinnerInputTemplateProperties;
|
|
344
590
|
|
|
591
|
+
declare type OptionDisplayProperties = {
|
|
592
|
+
children: ReactNode;
|
|
593
|
+
prefix?: string | undefined;
|
|
594
|
+
media?: Attachment | undefined;
|
|
595
|
+
};
|
|
596
|
+
|
|
345
597
|
export declare type OptionDisplayTemplateProperties = Omit<TemplateBase<OptionDisplayProperties>, "children" | "media"> & {
|
|
346
598
|
readonly attachmentLabel: string;
|
|
347
599
|
readonly children: string;
|
|
348
600
|
readonly media: string;
|
|
349
601
|
};
|
|
350
602
|
|
|
603
|
+
declare type OptionItem = {
|
|
604
|
+
token: string;
|
|
605
|
+
label: ReactNode;
|
|
606
|
+
disabled: boolean;
|
|
607
|
+
exclusive: boolean;
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
declare type OptionsLoadingProperties = {
|
|
611
|
+
isLoading: boolean;
|
|
612
|
+
};
|
|
613
|
+
|
|
351
614
|
export declare type OptionsLoadingTemplateProperties = TemplateBase<OptionsLoadingProperties> & {
|
|
352
615
|
readonly loadingLabel: string;
|
|
353
616
|
};
|
|
@@ -358,6 +621,8 @@ export declare const PAGE_FIELD = "fb[page]";
|
|
|
358
621
|
|
|
359
622
|
export declare function pathControlId(token: string, path: NodePath | undefined, ...parts: Array<string | number | undefined>): string | undefined;
|
|
360
623
|
|
|
624
|
+
declare type PlaceholderString<Key extends string> = `${string}{${Key}}${string}`;
|
|
625
|
+
|
|
361
626
|
export declare type ProcessResult = {
|
|
362
627
|
readonly submitted: false;
|
|
363
628
|
} | {
|
|
@@ -392,6 +657,18 @@ export declare interface QuestionnaireRendererOptions<V extends FhirVersion = Fh
|
|
|
392
657
|
action?: string | undefined;
|
|
393
658
|
}
|
|
394
659
|
|
|
660
|
+
declare type QuestionScaffoldProperties = {
|
|
661
|
+
linkId: string;
|
|
662
|
+
path?: NodePath | undefined;
|
|
663
|
+
header?: ReactNode;
|
|
664
|
+
children: ReactNode;
|
|
665
|
+
errors?: ReactNode;
|
|
666
|
+
signature?: ReactNode;
|
|
667
|
+
isExpandable?: boolean | undefined;
|
|
668
|
+
isExpanded: boolean;
|
|
669
|
+
customExtensions?: CustomExtensionValues | undefined;
|
|
670
|
+
};
|
|
671
|
+
|
|
395
672
|
export declare type QuestionScaffoldTemplateProperties = Omit<TemplateBase<QuestionScaffoldProperties>, "children" | "errors" | "header" | "signature"> & {
|
|
396
673
|
readonly header?: string | undefined;
|
|
397
674
|
readonly children: string;
|
|
@@ -402,6 +679,21 @@ export declare type QuestionScaffoldTemplateProperties = Omit<TemplateBase<Quest
|
|
|
402
679
|
readonly signature?: string | undefined;
|
|
403
680
|
} & CollapsibleActionProperties;
|
|
404
681
|
|
|
682
|
+
declare type RadioButtonListProperties = {
|
|
683
|
+
options: readonly OptionItem[];
|
|
684
|
+
selectedOption: SelectedOptionItem | undefined;
|
|
685
|
+
orientation?: ChoiceOrientation | undefined;
|
|
686
|
+
onChange: (token?: string) => void;
|
|
687
|
+
specifyOtherOption?: OptionItem | undefined;
|
|
688
|
+
customOptionForm?: ReactNode;
|
|
689
|
+
id: string;
|
|
690
|
+
path?: NodePath | undefined;
|
|
691
|
+
ariaLabelledBy: string;
|
|
692
|
+
ariaDescribedBy?: string | undefined;
|
|
693
|
+
disabled?: boolean | undefined;
|
|
694
|
+
isLoading?: boolean | undefined;
|
|
695
|
+
};
|
|
696
|
+
|
|
405
697
|
export declare type RadioButtonListTemplateProperties = Omit<FieldTemplateProperties<RadioButtonListProperties>, "customOptionForm" | "options" | "selectedOption" | "specifyOtherOption"> & {
|
|
406
698
|
readonly baselineName?: string | undefined;
|
|
407
699
|
readonly baselineValue?: string | undefined;
|
|
@@ -412,6 +704,19 @@ export declare type RadioButtonListTemplateProperties = Omit<FieldTemplateProper
|
|
|
412
704
|
readonly customOptionForm?: string | undefined;
|
|
413
705
|
};
|
|
414
706
|
|
|
707
|
+
declare type RadioButtonProperties = {
|
|
708
|
+
id: string;
|
|
709
|
+
path?: NodePath | undefined;
|
|
710
|
+
groupName: string;
|
|
711
|
+
value: string;
|
|
712
|
+
checked: boolean;
|
|
713
|
+
onChange: () => void;
|
|
714
|
+
ariaLabelledBy: string;
|
|
715
|
+
ariaDescribedBy?: string | undefined;
|
|
716
|
+
disabled?: boolean;
|
|
717
|
+
label?: ReactNode;
|
|
718
|
+
};
|
|
719
|
+
|
|
415
720
|
export declare type RadioButtonTemplateProperties = Omit<FieldTemplateProperties<RadioButtonProperties>, "label"> & {
|
|
416
721
|
readonly hiddenValue?: string | undefined;
|
|
417
722
|
readonly label?: string | undefined;
|
|
@@ -455,6 +760,28 @@ export declare function searchName(path: NodePath): string;
|
|
|
455
760
|
|
|
456
761
|
export declare function selectedName(path: NodePath): string;
|
|
457
762
|
|
|
763
|
+
declare type SelectedOptionItem = OptionItem & {
|
|
764
|
+
ariaDescribedBy?: string | undefined;
|
|
765
|
+
errors?: ReactNode;
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
declare type SelectInputProperties = {
|
|
769
|
+
options: readonly OptionItem[];
|
|
770
|
+
selectedOption: SelectedOptionItem | undefined;
|
|
771
|
+
searchQuery: string;
|
|
772
|
+
onChange: (token?: string) => void;
|
|
773
|
+
onSearch?: (query: string) => void;
|
|
774
|
+
specifyOtherOption?: OptionItem | undefined;
|
|
775
|
+
customOptionForm?: ReactNode;
|
|
776
|
+
id: string;
|
|
777
|
+
path?: NodePath | undefined;
|
|
778
|
+
ariaLabelledBy: string;
|
|
779
|
+
ariaDescribedBy?: string | undefined;
|
|
780
|
+
disabled?: boolean | undefined;
|
|
781
|
+
isLoading?: boolean | undefined;
|
|
782
|
+
placeholder?: string | undefined;
|
|
783
|
+
};
|
|
784
|
+
|
|
458
785
|
export declare type SelectInputTemplateProperties = Omit<FieldTemplateProperties<SelectInputProperties>, "customOptionForm" | "options" | "selectedOption" | "specifyOtherOption"> & {
|
|
459
786
|
readonly baselineName?: string | undefined;
|
|
460
787
|
readonly baselineValue?: string | undefined;
|
|
@@ -473,24 +800,217 @@ export declare type SelectOptionTemplateItem = TemplateOptionItem & {
|
|
|
473
800
|
readonly selected: boolean;
|
|
474
801
|
};
|
|
475
802
|
|
|
803
|
+
declare type SignatureInputProperties = {
|
|
804
|
+
value: string | undefined;
|
|
805
|
+
id: string;
|
|
806
|
+
path?: NodePath | undefined;
|
|
807
|
+
ariaLabelledBy?: string | undefined;
|
|
808
|
+
ariaDescribedBy?: string | undefined;
|
|
809
|
+
disabled?: boolean | undefined;
|
|
810
|
+
onChange?: ((value?: string) => void) | undefined;
|
|
811
|
+
};
|
|
812
|
+
|
|
476
813
|
export declare type SignatureInputTemplateProperties = FieldTemplateProperties<SignatureInputProperties> & {
|
|
477
814
|
readonly inputValue: string;
|
|
478
815
|
};
|
|
479
816
|
|
|
480
817
|
export declare function signatureName(path: NodePath): string;
|
|
481
818
|
|
|
819
|
+
declare type SliderInputProperties = {
|
|
820
|
+
id: string;
|
|
821
|
+
path?: NodePath | undefined;
|
|
822
|
+
value: number | undefined;
|
|
823
|
+
onChange: (v?: number) => void;
|
|
824
|
+
disabled?: boolean | undefined;
|
|
825
|
+
min?: number | undefined;
|
|
826
|
+
max?: number | undefined;
|
|
827
|
+
step?: number | undefined;
|
|
828
|
+
ariaLabelledBy: string;
|
|
829
|
+
ariaDescribedBy?: string | undefined;
|
|
830
|
+
lowerLabel?: string | undefined;
|
|
831
|
+
upperLabel?: string | undefined;
|
|
832
|
+
unitLabel?: string | undefined;
|
|
833
|
+
};
|
|
834
|
+
|
|
482
835
|
export declare type SliderInputTemplateProperties = FieldTemplateProperties<SliderInputProperties> & NumberInputViewProperties;
|
|
483
836
|
|
|
837
|
+
declare type SpinnerInputProperties = {
|
|
838
|
+
id: string;
|
|
839
|
+
path?: NodePath | undefined;
|
|
840
|
+
value: number | undefined;
|
|
841
|
+
onChange: (v?: number) => void;
|
|
842
|
+
disabled?: boolean | undefined;
|
|
843
|
+
min?: number | undefined;
|
|
844
|
+
max?: number | undefined;
|
|
845
|
+
step?: number | undefined;
|
|
846
|
+
ariaLabelledBy: string;
|
|
847
|
+
ariaDescribedBy?: string | undefined;
|
|
848
|
+
placeholder?: string | undefined;
|
|
849
|
+
unitLabel?: string | undefined;
|
|
850
|
+
};
|
|
851
|
+
|
|
484
852
|
export declare type SpinnerInputTemplateProperties = FieldTemplateProperties<SpinnerInputProperties> & NumberInputViewProperties;
|
|
485
853
|
|
|
486
854
|
export declare function stableId(base: string | undefined, ...parts: Array<string | number | undefined>): string | undefined;
|
|
487
855
|
|
|
856
|
+
declare type StackProperties = {
|
|
857
|
+
children: ReactNode;
|
|
858
|
+
};
|
|
859
|
+
|
|
488
860
|
export declare type StackTemplateProperties = Omit<TemplateBase<StackProperties>, "children"> & {
|
|
489
861
|
readonly children: string;
|
|
490
862
|
};
|
|
491
863
|
|
|
864
|
+
declare type Strings = {
|
|
865
|
+
readonly aria: {
|
|
866
|
+
readonly help: string;
|
|
867
|
+
readonly legal: string;
|
|
868
|
+
readonly flyover: string;
|
|
869
|
+
};
|
|
870
|
+
readonly value: {
|
|
871
|
+
readonly yes: string;
|
|
872
|
+
readonly no: string;
|
|
873
|
+
readonly unanswered: string;
|
|
874
|
+
};
|
|
875
|
+
readonly dialog: {
|
|
876
|
+
readonly cancel: string;
|
|
877
|
+
readonly submit: string;
|
|
878
|
+
};
|
|
879
|
+
readonly form: {
|
|
880
|
+
readonly submit: string;
|
|
881
|
+
readonly cancel: string;
|
|
882
|
+
};
|
|
883
|
+
readonly errors: {
|
|
884
|
+
readonly unknownMessage: string;
|
|
885
|
+
readonly issuesTitle: string;
|
|
886
|
+
readonly issueMessage: PlaceholderString<"message">;
|
|
887
|
+
};
|
|
888
|
+
readonly file: {
|
|
889
|
+
readonly sizeLabel: PlaceholderString<"sizeKb">;
|
|
890
|
+
readonly chooseAction: string;
|
|
891
|
+
readonly changeAction: string;
|
|
892
|
+
readonly replaceAction: string;
|
|
893
|
+
readonly clearAction: string;
|
|
894
|
+
readonly noFileChosen: string;
|
|
895
|
+
};
|
|
896
|
+
readonly group: {
|
|
897
|
+
readonly addSection: string;
|
|
898
|
+
readonly removeSection: string;
|
|
899
|
+
readonly noNodesYet: string;
|
|
900
|
+
};
|
|
901
|
+
readonly gridTable: {
|
|
902
|
+
readonly headerActions: string;
|
|
903
|
+
};
|
|
904
|
+
readonly inputs: {
|
|
905
|
+
readonly referencePlaceholder: string;
|
|
906
|
+
readonly referenceDisplayPlaceholder: string;
|
|
907
|
+
readonly codingSystemPlaceholder: string;
|
|
908
|
+
readonly codingCodePlaceholder: string;
|
|
909
|
+
readonly codingDisplayPlaceholder: string;
|
|
910
|
+
readonly quantityValuePlaceholder: string;
|
|
911
|
+
readonly quantityUnitPlaceholder: string;
|
|
912
|
+
readonly attachmentSelected: string;
|
|
913
|
+
readonly attachmentLabel: string;
|
|
914
|
+
};
|
|
915
|
+
readonly selection: {
|
|
916
|
+
readonly specifyOther: string;
|
|
917
|
+
readonly addAnother: string;
|
|
918
|
+
readonly selectPlaceholder: string;
|
|
919
|
+
readonly removeSelection: string;
|
|
920
|
+
readonly removeCustomValue: string;
|
|
921
|
+
readonly searchPlaceholder: string;
|
|
922
|
+
readonly noOptions: string;
|
|
923
|
+
readonly loadingOptions: string;
|
|
924
|
+
readonly dividerOr: string;
|
|
925
|
+
};
|
|
926
|
+
readonly pagination: {
|
|
927
|
+
readonly navigation: string;
|
|
928
|
+
readonly previous: string;
|
|
929
|
+
readonly next: string;
|
|
930
|
+
readonly pageLabel: PlaceholderString<"page">;
|
|
931
|
+
readonly previousTargetPage: PlaceholderString<"page">;
|
|
932
|
+
readonly nextTargetPage: PlaceholderString<"page">;
|
|
933
|
+
};
|
|
934
|
+
readonly language: {
|
|
935
|
+
readonly label: string;
|
|
936
|
+
readonly placeholder: string;
|
|
937
|
+
};
|
|
938
|
+
readonly table: {
|
|
939
|
+
readonly empty: string;
|
|
940
|
+
readonly noChoiceQuestionsHorizontal: string;
|
|
941
|
+
readonly noChoiceQuestions: string;
|
|
942
|
+
readonly noAnswerOptionsHorizontal: string;
|
|
943
|
+
readonly noAnswerOptions: string;
|
|
944
|
+
};
|
|
945
|
+
readonly collapsible: {
|
|
946
|
+
readonly expand: string;
|
|
947
|
+
readonly collapse: string;
|
|
948
|
+
};
|
|
949
|
+
readonly tab: {
|
|
950
|
+
readonly empty: string;
|
|
951
|
+
readonly scrollLeft: string;
|
|
952
|
+
readonly scrollRight: string;
|
|
953
|
+
};
|
|
954
|
+
readonly signature: {
|
|
955
|
+
readonly sign: string;
|
|
956
|
+
readonly signed: string;
|
|
957
|
+
readonly clearAction: string;
|
|
958
|
+
};
|
|
959
|
+
readonly spinner: {
|
|
960
|
+
readonly decrease: string;
|
|
961
|
+
readonly increase: string;
|
|
962
|
+
};
|
|
963
|
+
readonly unsupported: {
|
|
964
|
+
readonly itemType: PlaceholderString<"type">;
|
|
965
|
+
};
|
|
966
|
+
readonly validation: {
|
|
967
|
+
readonly group: {
|
|
968
|
+
readonly atLeastOneAnswer: string;
|
|
969
|
+
};
|
|
970
|
+
readonly groupList: {
|
|
971
|
+
readonly minOccurs: PlaceholderString<"minOccurs">;
|
|
972
|
+
readonly maxOccurs: PlaceholderString<"maxOccurs">;
|
|
973
|
+
};
|
|
974
|
+
readonly question: {
|
|
975
|
+
readonly minOccursSingle: string;
|
|
976
|
+
readonly minOccursMultiple: PlaceholderString<"minOccurs">;
|
|
977
|
+
readonly maxOccurs: PlaceholderString<"maxOccurs">;
|
|
978
|
+
};
|
|
979
|
+
readonly signature: {
|
|
980
|
+
readonly required: string;
|
|
981
|
+
};
|
|
982
|
+
readonly answer: {
|
|
983
|
+
readonly minLength: PlaceholderString<"minLength">;
|
|
984
|
+
readonly maxLength: PlaceholderString<"maxLength">;
|
|
985
|
+
readonly minPrecision: PlaceholderString<"minLength">;
|
|
986
|
+
readonly maxPrecision: PlaceholderString<"maxLength">;
|
|
987
|
+
readonly blank: string;
|
|
988
|
+
readonly valueNotEarlier: PlaceholderString<"formatted">;
|
|
989
|
+
readonly valueNotLater: PlaceholderString<"formatted">;
|
|
990
|
+
readonly valueMin: PlaceholderString<"formatted">;
|
|
991
|
+
readonly valueMax: PlaceholderString<"formatted">;
|
|
992
|
+
readonly valueDecimalPlaces: PlaceholderString<"maxPlaces">;
|
|
993
|
+
readonly quantityMin: PlaceholderString<"formatted">;
|
|
994
|
+
readonly quantityMax: PlaceholderString<"formatted">;
|
|
995
|
+
readonly attachmentTypeMissing: PlaceholderString<"allowed">;
|
|
996
|
+
readonly attachmentTypeNotAllowed: PlaceholderString<"allowed">;
|
|
997
|
+
readonly attachmentSizeMax: PlaceholderString<"maxSize">;
|
|
998
|
+
};
|
|
999
|
+
};
|
|
1000
|
+
};
|
|
1001
|
+
|
|
492
1002
|
export declare const SUBMIT_ATTEMPTED_FIELD = "fb[submitAttempted]";
|
|
493
1003
|
|
|
1004
|
+
declare type TabContainerProperties = {
|
|
1005
|
+
path?: NodePath | undefined;
|
|
1006
|
+
header?: ReactNode;
|
|
1007
|
+
items: TabItem[];
|
|
1008
|
+
value: number;
|
|
1009
|
+
onChange: (index: number) => void;
|
|
1010
|
+
errors?: ReactNode;
|
|
1011
|
+
linkId: string;
|
|
1012
|
+
};
|
|
1013
|
+
|
|
494
1014
|
export declare type TabContainerTemplateProperties = Omit<TemplateBase<TabContainerProperties>, "errors" | "header" | "items"> & {
|
|
495
1015
|
readonly header?: string | undefined;
|
|
496
1016
|
readonly errors?: string | undefined;
|
|
@@ -500,8 +1020,45 @@ export declare type TabContainerTemplateProperties = Omit<TemplateBase<TabContai
|
|
|
500
1020
|
readonly tabName?: string | undefined;
|
|
501
1021
|
};
|
|
502
1022
|
|
|
1023
|
+
declare type TabItem = {
|
|
1024
|
+
token: string;
|
|
1025
|
+
label: ReactNode;
|
|
1026
|
+
buttonId: string;
|
|
1027
|
+
panelId: string;
|
|
1028
|
+
content: ReactNode;
|
|
1029
|
+
};
|
|
1030
|
+
|
|
1031
|
+
declare type TableCell = {
|
|
1032
|
+
token: string;
|
|
1033
|
+
content?: ReactNode;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
declare type TableColumn = {
|
|
1037
|
+
token: string;
|
|
1038
|
+
content: ReactNode;
|
|
1039
|
+
width?: string | undefined;
|
|
1040
|
+
errors?: ReactNode | undefined;
|
|
1041
|
+
isLoading?: boolean | undefined;
|
|
1042
|
+
};
|
|
1043
|
+
|
|
503
1044
|
export declare function tableColumn(column: TableColumn, renderHtml: RenderHtml): TemplateTableColumn;
|
|
504
1045
|
|
|
1046
|
+
declare type TableProperties = {
|
|
1047
|
+
columns: TableColumn[];
|
|
1048
|
+
rows: TableRow[];
|
|
1049
|
+
};
|
|
1050
|
+
|
|
1051
|
+
declare type TableRow = {
|
|
1052
|
+
token: string;
|
|
1053
|
+
path?: NodePath | undefined;
|
|
1054
|
+
content?: ReactNode | undefined;
|
|
1055
|
+
errors?: ReactNode | undefined;
|
|
1056
|
+
isLoading?: boolean | undefined;
|
|
1057
|
+
cells: TableCell[];
|
|
1058
|
+
onRemove?: (() => void) | undefined;
|
|
1059
|
+
canRemove?: boolean | undefined;
|
|
1060
|
+
};
|
|
1061
|
+
|
|
505
1062
|
export declare function tableRow(row: TableRow, renderHtml: RenderHtml, strings: Strings, token: string): TemplateTableRow;
|
|
506
1063
|
|
|
507
1064
|
export declare type TableTemplateProperties = Omit<TemplateBase<TableProperties>, "columns" | "rows"> & {
|
|
@@ -619,12 +1176,54 @@ export declare type TemplateTableRow = Omit<TableRow, "cells" | "content" | "err
|
|
|
619
1176
|
readonly removeLabelHtml: string;
|
|
620
1177
|
} & RemoveActionProperties;
|
|
621
1178
|
|
|
1179
|
+
declare type TextAreaProperties = {
|
|
1180
|
+
id: string;
|
|
1181
|
+
path?: NodePath | undefined;
|
|
1182
|
+
value: string;
|
|
1183
|
+
onChange: (v: string) => void;
|
|
1184
|
+
disabled?: boolean | undefined;
|
|
1185
|
+
placeholder?: string | undefined;
|
|
1186
|
+
ariaLabelledBy: string;
|
|
1187
|
+
ariaDescribedBy?: string | undefined;
|
|
1188
|
+
inputMode?: HTMLAttributes<Element>["inputMode"] | undefined;
|
|
1189
|
+
minLength?: number | undefined;
|
|
1190
|
+
maxLength?: number | undefined;
|
|
1191
|
+
};
|
|
1192
|
+
|
|
622
1193
|
export declare type TextAreaTemplateProperties = FieldTemplateProperties<TextAreaProperties>;
|
|
623
1194
|
|
|
1195
|
+
declare type TextInputProperties = {
|
|
1196
|
+
id: string;
|
|
1197
|
+
path?: NodePath | undefined;
|
|
1198
|
+
type?: string | undefined;
|
|
1199
|
+
value: string;
|
|
1200
|
+
onChange: (v: string) => void;
|
|
1201
|
+
disabled?: boolean | undefined;
|
|
1202
|
+
placeholder?: string | undefined;
|
|
1203
|
+
ariaLabelledBy: string;
|
|
1204
|
+
ariaDescribedBy?: string | undefined;
|
|
1205
|
+
inputMode?: HTMLAttributes<Element>["inputMode"] | undefined;
|
|
1206
|
+
minLength?: number | undefined;
|
|
1207
|
+
maxLength?: number | undefined;
|
|
1208
|
+
};
|
|
1209
|
+
|
|
624
1210
|
export declare type TextInputTemplateProperties = FieldTemplateProperties<TextInputProperties> & {
|
|
625
1211
|
readonly inputType: string;
|
|
626
1212
|
};
|
|
627
1213
|
|
|
1214
|
+
declare type TimeInputProperties = {
|
|
1215
|
+
id: string;
|
|
1216
|
+
path?: NodePath | undefined;
|
|
1217
|
+
value: string;
|
|
1218
|
+
onChange: (v: string) => void;
|
|
1219
|
+
disabled?: boolean | undefined;
|
|
1220
|
+
placeholder?: string | undefined;
|
|
1221
|
+
ariaLabelledBy: string;
|
|
1222
|
+
ariaDescribedBy?: string | undefined;
|
|
1223
|
+
min?: string | undefined;
|
|
1224
|
+
max?: string | undefined;
|
|
1225
|
+
};
|
|
1226
|
+
|
|
628
1227
|
export declare type TimeInputTemplateProperties = FieldTemplateProperties<TimeInputProperties>;
|
|
629
1228
|
|
|
630
1229
|
export declare function unitValueName(path: NodePath, token: string): string;
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { jsx, jsxs, Fragment } from "
|
|
5
|
-
import { createContext, useContext, useMemo, useCallback, useState, createElement, Children } from "
|
|
4
|
+
import { jsx, jsxs, Fragment } from "preact/jsx-runtime";
|
|
5
|
+
import { createContext, useContext, useMemo, useCallback, useState, createElement, Children } from "preact/compat";
|
|
6
6
|
import bundledStrings from "@formbox/strings";
|
|
7
7
|
import { computed, action, makeObservable, observable, runInAction, override, reaction, comparer, when } from "mobx";
|
|
8
|
-
import { CustomItemExtensionsProvider, useStrings, CustomQuestionnaireExtensionsProvider, StringsContext } from "@formbox/theme";
|
|
9
|
-
import { observer } from "mobx-react-lite";
|
|
10
8
|
import { fromPromise } from "mobx-utils";
|
|
11
9
|
import { R4AttachmentAdapter, R4QuestionnaireItemAdapter, R4QuestionnaireResponseAdapter, R5AttachmentAdapter, R5QuestionnaireItemAdapter, R5QuestionnaireResponseAdapter } from "@formbox/fhir";
|
|
12
10
|
import { readdir, readFile } from "node:fs/promises";
|
|
13
11
|
import path from "node:path";
|
|
14
12
|
import Handlebars from "handlebars";
|
|
15
|
-
import { renderToStaticMarkup } from "
|
|
13
|
+
import { renderToStaticMarkup } from "preact-render-to-string";
|
|
14
|
+
const StringsContext = createContext(
|
|
15
|
+
void 0
|
|
16
|
+
);
|
|
17
|
+
function useStrings() {
|
|
18
|
+
const strings2 = useContext(StringsContext);
|
|
19
|
+
if (strings2 == void 0) {
|
|
20
|
+
throw new Error("StringsContext.Provider is required");
|
|
21
|
+
}
|
|
22
|
+
return strings2;
|
|
23
|
+
}
|
|
24
|
+
const CustomQuestionnaireExtensionsContext = createContext(void 0);
|
|
25
|
+
const CustomItemExtensionsContext = createContext(void 0);
|
|
26
|
+
function CustomQuestionnaireExtensionsProvider({
|
|
27
|
+
value,
|
|
28
|
+
children
|
|
29
|
+
}) {
|
|
30
|
+
return /* @__PURE__ */ jsx(CustomQuestionnaireExtensionsContext.Provider, { value, children });
|
|
31
|
+
}
|
|
32
|
+
function CustomItemExtensionsProvider({
|
|
33
|
+
value,
|
|
34
|
+
children
|
|
35
|
+
}) {
|
|
36
|
+
return /* @__PURE__ */ jsx(CustomItemExtensionsContext.Provider, { value, children });
|
|
37
|
+
}
|
|
38
|
+
function observer(component) {
|
|
39
|
+
return component;
|
|
40
|
+
}
|
|
16
41
|
const ITEM_CONTROLS = [
|
|
17
42
|
// display
|
|
18
43
|
"inline",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formbox/htmx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Server-rendered HTMX HTML renderer for Formbox FHIR Questionnaires",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -26,24 +26,22 @@
|
|
|
26
26
|
"fhirpath": "^4.6.0",
|
|
27
27
|
"handlebars": "^4.7.9",
|
|
28
28
|
"mobx": "^6.15.0",
|
|
29
|
-
"mobx-react-lite": "^4.1.1",
|
|
30
29
|
"mobx-utils": "^6.1.1",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"@formbox/
|
|
34
|
-
"@formbox/strings": "0.4.1"
|
|
35
|
-
"@formbox/theme": "0.4.1",
|
|
36
|
-
"@formbox/fhir": "0.4.1"
|
|
30
|
+
"preact": "^10.29.2",
|
|
31
|
+
"preact-render-to-string": "^6.7.0",
|
|
32
|
+
"@formbox/fhir": "0.4.1",
|
|
33
|
+
"@formbox/strings": "0.4.1"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|
|
39
36
|
"@playwright/test": "^1.60.0",
|
|
40
37
|
"@types/react": "^19.2.8",
|
|
41
|
-
"@types/react-dom": "^19.2.3",
|
|
42
38
|
"htmx.org": "^2.0.10",
|
|
43
39
|
"typescript": "~5.9.3",
|
|
44
40
|
"vite": "^7.3.1",
|
|
45
41
|
"vite-plugin-dts": "^4.5.4",
|
|
46
|
-
"vitest": "^4.0.17"
|
|
42
|
+
"vitest": "^4.0.17",
|
|
43
|
+
"@formbox/renderer": "0.4.1",
|
|
44
|
+
"@formbox/theme": "0.4.1"
|
|
47
45
|
},
|
|
48
46
|
"scripts": {
|
|
49
47
|
"build": "tsc -b ./tsconfig.lib.json && vite build",
|