@formbox/htmx 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +323 -0
- package/dist/index.d.ts +615 -0
- package/dist/index.js +62387 -0
- package/dist/templates/AnswerList.html.hbs +17 -0
- package/dist/templates/AnswerScaffold.html.hbs +19 -0
- package/dist/templates/Checkbox.html.hbs +14 -0
- package/dist/templates/CheckboxList.html.hbs +29 -0
- package/dist/templates/CustomOptionForm.html.hbs +16 -0
- package/dist/templates/DateInput.html.hbs +14 -0
- package/dist/templates/DateTimeInput.html.hbs +18 -0
- package/dist/templates/DisplayRenderer.html.hbs +9 -0
- package/dist/templates/Errors.html.hbs +15 -0
- package/dist/templates/FileInput.html.hbs +20 -0
- package/dist/templates/Flyover.html.hbs +12 -0
- package/dist/templates/Footer.html.hbs +8 -0
- package/dist/templates/Form.html.hbs +13 -0
- package/dist/templates/GroupList.html.hbs +22 -0
- package/dist/templates/GroupScaffold.html.hbs +36 -0
- package/dist/templates/Header.html.hbs +8 -0
- package/dist/templates/Help.html.hbs +12 -0
- package/dist/templates/InputGroup.html.hbs +10 -0
- package/dist/templates/Label.html.hbs +23 -0
- package/dist/templates/LanguageSelector.html.hbs +13 -0
- package/dist/templates/Legal.html.hbs +12 -0
- package/dist/templates/Link.html.hbs +9 -0
- package/dist/templates/MultiSelectInput.html.hbs +30 -0
- package/dist/templates/NumberInput.html.hbs +16 -0
- package/dist/templates/OptionDisplay.html.hbs +10 -0
- package/dist/templates/OptionsLoading.html.hbs +10 -0
- package/dist/templates/QuestionScaffold.html.hbs +30 -0
- package/dist/templates/RadioButton.html.hbs +14 -0
- package/dist/templates/RadioButtonList.html.hbs +27 -0
- package/dist/templates/SelectInput.html.hbs +32 -0
- package/dist/templates/SignatureInput.html.hbs +12 -0
- package/dist/templates/SliderInput.html.hbs +23 -0
- package/dist/templates/SpinnerInput.html.hbs +16 -0
- package/dist/templates/Stack.html.hbs +7 -0
- package/dist/templates/TabContainer.html.hbs +27 -0
- package/dist/templates/Table.html.hbs +39 -0
- package/dist/templates/TextArea.html.hbs +13 -0
- package/dist/templates/TextInput.html.hbs +14 -0
- package/dist/templates/TimeInput.html.hbs +12 -0
- package/package.json +57 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,615 @@
|
|
|
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
|
+
import { FhirVersion } from '@formbox/fhir';
|
|
13
|
+
import { FileInputProperties } from '@formbox/theme';
|
|
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';
|
|
33
|
+
import { QuestionnaireOf } from '@formbox/fhir';
|
|
34
|
+
import { QuestionnaireResponseOf } from '@formbox/fhir';
|
|
35
|
+
import { QuestionScaffoldProperties } from '@formbox/theme';
|
|
36
|
+
import { RadioButtonListProperties } from '@formbox/theme';
|
|
37
|
+
import { RadioButtonProperties } from '@formbox/theme';
|
|
38
|
+
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
|
+
|
|
55
|
+
export declare const ACTION_FIELD = "fb[action]";
|
|
56
|
+
|
|
57
|
+
export declare type ActionKind = "add-group" | "remove-group" | "add-answer" | "remove-answer" | "toggle-expanded" | "select-tab";
|
|
58
|
+
|
|
59
|
+
export declare function actionValue(kind: ActionKind, path: NodePath): string;
|
|
60
|
+
|
|
61
|
+
export declare type AddActionProperties = {
|
|
62
|
+
readonly actionName: string;
|
|
63
|
+
readonly addAction?: string | undefined;
|
|
64
|
+
readonly addLabel: string;
|
|
65
|
+
readonly count?: number | undefined;
|
|
66
|
+
readonly countName?: string | undefined;
|
|
67
|
+
readonly linkId?: string | undefined;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export declare type AnswerField = "value" | "system" | "code" | "display" | "unit" | "baseline" | "signature";
|
|
71
|
+
|
|
72
|
+
export declare type AnswerListTemplateProperties = Omit<TemplateBase<AnswerListProperties>, "children"> & {
|
|
73
|
+
readonly children: string;
|
|
74
|
+
readonly hasCount: boolean;
|
|
75
|
+
} & AddActionProperties;
|
|
76
|
+
|
|
77
|
+
export declare type AnswerScaffoldTemplateProperties = Omit<TemplateBase<AnswerScaffoldProperties>, "children" | "control" | "errors"> & {
|
|
78
|
+
readonly control: string;
|
|
79
|
+
readonly errors?: string | undefined;
|
|
80
|
+
readonly children?: string | undefined;
|
|
81
|
+
} & RemoveActionProperties;
|
|
82
|
+
|
|
83
|
+
export declare function attribute(name: string, value: unknown): string;
|
|
84
|
+
|
|
85
|
+
export declare function calculatedName(path: NodePath): string;
|
|
86
|
+
|
|
87
|
+
export declare function checkboxHiddenValue(properties: CheckboxProperties, checkedValue: string): string | undefined;
|
|
88
|
+
|
|
89
|
+
export declare type CheckboxListTemplateProperties = Omit<FieldTemplateProperties<CheckboxListProperties>, "customOptionForm" | "options" | "selectedOptions" | "specifyOtherOption"> & {
|
|
90
|
+
readonly baselineName?: string | undefined;
|
|
91
|
+
readonly hiddenInputs: readonly HiddenTemplateInput[];
|
|
92
|
+
readonly trailingHiddenInputs: readonly HiddenTemplateInput[];
|
|
93
|
+
readonly options: readonly CheckboxOptionTemplateItem[];
|
|
94
|
+
readonly selectedOptions: readonly TemplateSelectedOptionItem[];
|
|
95
|
+
readonly selectedName?: string | undefined;
|
|
96
|
+
readonly specifyOtherOption?: TemplateOptionItem | undefined;
|
|
97
|
+
readonly customOptionForm?: string | undefined;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export declare type CheckboxOptionTemplateItem = TemplateOptionItem & {
|
|
101
|
+
readonly selected: boolean;
|
|
102
|
+
readonly disabled?: boolean | undefined;
|
|
103
|
+
readonly hiddenInput?: HiddenTemplateInput | undefined;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export declare type CheckboxTemplateProperties = Omit<FieldTemplateProperties<CheckboxProperties>, "label"> & {
|
|
107
|
+
readonly hiddenValue?: string | undefined;
|
|
108
|
+
readonly label?: string | undefined;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export declare type CollapsibleActionProperties = {
|
|
112
|
+
readonly actionName?: string | undefined;
|
|
113
|
+
readonly collapseLabel?: string | undefined;
|
|
114
|
+
readonly expandedName?: string | undefined;
|
|
115
|
+
readonly expandLabel?: string | undefined;
|
|
116
|
+
readonly toggleAction?: string | undefined;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export declare function compileTemplate<TProperties extends TemplateProperties>(source: TemplateSource<TProperties>): Template<TProperties>;
|
|
120
|
+
|
|
121
|
+
export declare function compileTemplates(sources: TemplateSources): Templates;
|
|
122
|
+
|
|
123
|
+
export declare function countName(path: NodePath): string;
|
|
124
|
+
|
|
125
|
+
export declare type CustomOptionFormTemplateProperties = Omit<TemplateBase<CustomOptionFormProperties>, "content" | "errors"> & {
|
|
126
|
+
readonly actionName: string;
|
|
127
|
+
readonly cancelLabel: string;
|
|
128
|
+
readonly content: string;
|
|
129
|
+
readonly errors?: string | undefined;
|
|
130
|
+
readonly submitLabel: string;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export declare function customUnitFormName(path: NodePath): string;
|
|
134
|
+
|
|
135
|
+
export declare type DateInputTemplateProperties = FieldTemplateProperties<DateInputProperties> & {
|
|
136
|
+
readonly inputType: "date" | "text";
|
|
137
|
+
readonly step: undefined;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export declare function dateTimeConstraint(value: string | undefined): string | undefined;
|
|
141
|
+
|
|
142
|
+
export declare type DateTimeInputTemplateProperties = FieldTemplateProperties<DateTimeInputProperties> & {
|
|
143
|
+
readonly baselineName?: string | undefined;
|
|
144
|
+
readonly baselineValue?: string | undefined;
|
|
145
|
+
readonly inputType: "datetime-local" | "text";
|
|
146
|
+
readonly step?: "any" | undefined;
|
|
147
|
+
readonly inputValue: string;
|
|
148
|
+
readonly inputMin?: string | undefined;
|
|
149
|
+
readonly inputMax?: string | undefined;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export declare function defaultAttributes(action: string | undefined): HtmlAttributes;
|
|
153
|
+
|
|
154
|
+
export declare type DisplayRendererTemplateProperties = Omit<TemplateBase<DisplayRendererProperties>, "children"> & {
|
|
155
|
+
readonly children: string;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
export declare type ErrorsTemplateProperties = Omit<TemplateBase<ErrorsProperties>, "messages"> & {
|
|
159
|
+
readonly hasMessages: boolean;
|
|
160
|
+
readonly messages: readonly {
|
|
161
|
+
readonly html: string;
|
|
162
|
+
}[];
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export declare function escapeHtml(value: string): string;
|
|
166
|
+
|
|
167
|
+
export declare function expandedName(path: NodePath): string;
|
|
168
|
+
|
|
169
|
+
export declare function fieldAttributes(path: NodePath | undefined, field: AnswerField): TemplateFieldAttributes;
|
|
170
|
+
|
|
171
|
+
declare type FieldTemplateProperties<TProperties> = TemplateBase<TProperties> & TemplateFieldAttributes;
|
|
172
|
+
|
|
173
|
+
export declare type FileInputTemplateProperties = FieldTemplateProperties<FileInputProperties> & {
|
|
174
|
+
readonly clearLabel: string;
|
|
175
|
+
readonly hiddenValue?: string | undefined;
|
|
176
|
+
readonly clearAction: boolean;
|
|
177
|
+
readonly dataLinkId?: string | undefined;
|
|
178
|
+
readonly hxInclude: "closest form";
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export declare type FlyoverTemplateProperties = Omit<TemplateBase<FlyoverProperties>, "children"> & {
|
|
182
|
+
readonly ariaLabel: string;
|
|
183
|
+
readonly children: string;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
export declare type FooterTemplateProperties = Omit<TemplateBase<FooterProperties>, "children"> & {
|
|
187
|
+
readonly children: string;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
declare type FormFieldsProperties = Omit<FormTemplateProperties, "attributes" | "fields">;
|
|
191
|
+
|
|
192
|
+
export declare function formFieldsTemplate(properties: FormFieldsProperties): string;
|
|
193
|
+
|
|
194
|
+
export declare type FormTemplateProperties = Omit<TemplateBase<FormProperties>, "after" | "before" | "children" | "errors" | "languageSelector" | "pagination" | "signature"> & {
|
|
195
|
+
readonly after?: string | undefined;
|
|
196
|
+
readonly before?: string | undefined;
|
|
197
|
+
readonly children: string;
|
|
198
|
+
readonly errors?: string | undefined;
|
|
199
|
+
readonly fields: string;
|
|
200
|
+
readonly attributes: HtmlAttributes;
|
|
201
|
+
readonly languageSelector?: string | undefined;
|
|
202
|
+
readonly pagination?: TemplateFormPagination | undefined;
|
|
203
|
+
readonly signature?: string | undefined;
|
|
204
|
+
readonly submitLabel: string;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
export declare type GroupListTemplateProperties = Omit<TemplateBase<GroupListProperties>, "children" | "errors" | "header"> & {
|
|
208
|
+
readonly header?: string | undefined;
|
|
209
|
+
readonly errors?: string | undefined;
|
|
210
|
+
readonly children: string;
|
|
211
|
+
readonly hasCount: boolean;
|
|
212
|
+
} & AddActionProperties;
|
|
213
|
+
|
|
214
|
+
export declare type GroupScaffoldTemplateProperties = Omit<TemplateBase<GroupScaffoldProperties>, "children" | "errors" | "header" | "signature"> & {
|
|
215
|
+
readonly header?: string | undefined;
|
|
216
|
+
readonly children?: string | undefined;
|
|
217
|
+
readonly expandedChildren: string;
|
|
218
|
+
readonly expandedValue?: string | undefined;
|
|
219
|
+
readonly errors?: string | undefined;
|
|
220
|
+
readonly summaryLabel?: string | undefined;
|
|
221
|
+
readonly signature?: string | undefined;
|
|
222
|
+
} & RemoveActionProperties & CollapsibleActionProperties;
|
|
223
|
+
|
|
224
|
+
export declare type HeaderTemplateProperties = Omit<TemplateBase<HeaderProperties>, "children"> & {
|
|
225
|
+
readonly children: string;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export declare type HelpTemplateProperties = Omit<TemplateBase<HelpProperties>, "children"> & {
|
|
229
|
+
readonly ariaLabel: string;
|
|
230
|
+
readonly children: string;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export declare function hiddenInputs(name: string | undefined, options: readonly TemplateOptionItem[]): HiddenTemplateInput[];
|
|
234
|
+
|
|
235
|
+
export declare type HiddenTemplateInput = {
|
|
236
|
+
readonly name: string;
|
|
237
|
+
readonly value: string;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export declare type HtmlAttributes = Readonly<Record<string, HtmlAttributeValue>>;
|
|
241
|
+
|
|
242
|
+
export declare function htmlAttributes(values: HtmlAttributes): string;
|
|
243
|
+
|
|
244
|
+
export declare type HtmlAttributeValue = string | number | boolean | null | undefined;
|
|
245
|
+
|
|
246
|
+
export declare function inferTextField(id: string, group: InputGroupState | undefined): AnswerField;
|
|
247
|
+
|
|
248
|
+
export declare type InputGroupState = {
|
|
249
|
+
readonly size: number;
|
|
250
|
+
readonly index: number;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
export declare type InputGroupTemplateProperties = Omit<TemplateBase<InputGroupProperties>, "children"> & {
|
|
254
|
+
readonly children: string;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
export declare function inputValue(value: unknown): string;
|
|
258
|
+
|
|
259
|
+
export declare function isDefined<T>(value: T | undefined): value is T;
|
|
260
|
+
|
|
261
|
+
export declare function isPreservedOptionToken(token: string): boolean;
|
|
262
|
+
|
|
263
|
+
export declare type LabelTemplateProperties = Omit<TemplateBase<LabelProperties>, "children" | "flyover" | "help" | "legal" | "prefix"> & {
|
|
264
|
+
readonly attachmentLabel: string;
|
|
265
|
+
readonly prefix?: string | undefined;
|
|
266
|
+
readonly children: string;
|
|
267
|
+
readonly content: string;
|
|
268
|
+
readonly isLegend: boolean;
|
|
269
|
+
readonly isText: boolean;
|
|
270
|
+
readonly help?: string | undefined;
|
|
271
|
+
readonly legal?: string | undefined;
|
|
272
|
+
readonly flyover?: string | undefined;
|
|
273
|
+
readonly media: string;
|
|
274
|
+
readonly supportHyperlinks?: ReadonlyArray<NonNullable<LabelProperties["supportHyperlinks"]>[number] & {
|
|
275
|
+
readonly labelHtml: string;
|
|
276
|
+
}>;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
export declare const LANGUAGE_FIELD = "fb[language]";
|
|
280
|
+
|
|
281
|
+
export declare type LanguageSelectorTemplateProperties = Omit<TemplateBase<LanguageSelectorProperties>, "options"> & {
|
|
282
|
+
readonly name: string;
|
|
283
|
+
readonly options: ReadonlyArray<LanguageSelectorProperties["options"][number] & {
|
|
284
|
+
readonly selected: boolean;
|
|
285
|
+
}>;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export declare function lastLinkId(path: NodePath): string;
|
|
289
|
+
|
|
290
|
+
export declare type LaunchContext = Record<string, unknown>;
|
|
291
|
+
|
|
292
|
+
export declare type LegalTemplateProperties = Omit<TemplateBase<LegalProperties>, "children"> & {
|
|
293
|
+
readonly ariaLabel: string;
|
|
294
|
+
readonly children: string;
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
export declare type LinkTemplateProperties = Omit<TemplateBase<LinkProperties>, "children"> & {
|
|
298
|
+
readonly children: string;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
export declare function loadNativeTemplates(): Promise<RequiredTemplates>;
|
|
302
|
+
|
|
303
|
+
export declare function loadTemplates(directory: string | URL): Promise<Templates>;
|
|
304
|
+
|
|
305
|
+
export declare function mediaHtml(attachment: Attachment | undefined, fallbackLabel: string): string;
|
|
306
|
+
|
|
307
|
+
export declare type MultiSelectInputTemplateProperties = Omit<FieldTemplateProperties<MultiSelectInputProperties>, "customOptionForm" | "options" | "selectedOptions" | "specifyOtherOption"> & {
|
|
308
|
+
readonly baselineName?: string | undefined;
|
|
309
|
+
readonly searchLabel: string;
|
|
310
|
+
readonly searchName?: string | undefined;
|
|
311
|
+
readonly hiddenInputs: readonly HiddenTemplateInput[];
|
|
312
|
+
readonly trailingHiddenInputs: readonly HiddenTemplateInput[];
|
|
313
|
+
readonly options: readonly CheckboxOptionTemplateItem[];
|
|
314
|
+
readonly selectedOptions: readonly TemplateSelectedOptionItem[];
|
|
315
|
+
readonly selectedName?: string | undefined;
|
|
316
|
+
readonly specifyOtherOption?: TemplateOptionItem | undefined;
|
|
317
|
+
readonly customOptionForm?: string | undefined;
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export declare type NumberInputTemplateProperties = FieldTemplateProperties<NumberInputProperties> & NumberInputViewProperties;
|
|
321
|
+
|
|
322
|
+
declare type NumberInputViewProperties = {
|
|
323
|
+
readonly inputValue: number | "";
|
|
324
|
+
readonly unitId?: string | undefined;
|
|
325
|
+
readonly describedBy?: string | undefined;
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export declare function numberTemplateProperties(properties: NumberInputProperties): NumberInputTemplateProperties;
|
|
329
|
+
|
|
330
|
+
export declare function numberTemplateProperties(properties: SliderInputProperties): SliderInputTemplateProperties;
|
|
331
|
+
|
|
332
|
+
export declare function numberTemplateProperties(properties: SpinnerInputProperties): SpinnerInputTemplateProperties;
|
|
333
|
+
|
|
334
|
+
export declare type OptionDisplayTemplateProperties = Omit<TemplateBase<OptionDisplayProperties>, "children" | "media"> & {
|
|
335
|
+
readonly attachmentLabel: string;
|
|
336
|
+
readonly children: string;
|
|
337
|
+
readonly media: string;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export declare type OptionsLoadingTemplateProperties = TemplateBase<OptionsLoadingProperties> & {
|
|
341
|
+
readonly loadingLabel: string;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
export declare function optionValueName(path: NodePath, token: string): string;
|
|
345
|
+
|
|
346
|
+
export declare const PAGE_FIELD = "fb[page]";
|
|
347
|
+
|
|
348
|
+
export declare type ProcessResult = {
|
|
349
|
+
readonly submitted: false;
|
|
350
|
+
} | {
|
|
351
|
+
readonly submitted: true;
|
|
352
|
+
readonly valid: boolean;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
export declare class QuestionnaireRenderer<V extends FhirVersion = FhirVersion> {
|
|
356
|
+
private readonly store;
|
|
357
|
+
private readonly templates;
|
|
358
|
+
private readonly strings;
|
|
359
|
+
private readonly action;
|
|
360
|
+
constructor(options: QuestionnaireRendererOptions<V>);
|
|
361
|
+
process(formData: FormData): Promise<ProcessResult>;
|
|
362
|
+
render(): Promise<string>;
|
|
363
|
+
getQuestionnaireResponse(): QuestionnaireResponseOf<V>;
|
|
364
|
+
dispose(): void;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export declare interface QuestionnaireRendererOptions<V extends FhirVersion = FhirVersion> {
|
|
368
|
+
token: string;
|
|
369
|
+
questionnaire: QuestionnaireOf<V>;
|
|
370
|
+
questionnaireResponse?: QuestionnaireResponseOf<V> | undefined;
|
|
371
|
+
fhirVersion: V;
|
|
372
|
+
language?: string | undefined;
|
|
373
|
+
strings?: Strings | undefined;
|
|
374
|
+
terminologyServerUrl?: string | undefined;
|
|
375
|
+
launchContext?: LaunchContext | undefined;
|
|
376
|
+
mode?: RenderMode | undefined;
|
|
377
|
+
customExtensions?: CustomExtensionDefinitions | undefined;
|
|
378
|
+
templates: RequiredTemplates;
|
|
379
|
+
action?: string | undefined;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export declare type QuestionScaffoldTemplateProperties = Omit<TemplateBase<QuestionScaffoldProperties>, "children" | "errors" | "header" | "signature"> & {
|
|
383
|
+
readonly header?: string | undefined;
|
|
384
|
+
readonly children: string;
|
|
385
|
+
readonly expandedChildren: string;
|
|
386
|
+
readonly expandedValue?: string | undefined;
|
|
387
|
+
readonly errors?: string | undefined;
|
|
388
|
+
readonly summaryLabel?: string | undefined;
|
|
389
|
+
readonly signature?: string | undefined;
|
|
390
|
+
} & CollapsibleActionProperties;
|
|
391
|
+
|
|
392
|
+
export declare type RadioButtonListTemplateProperties = Omit<FieldTemplateProperties<RadioButtonListProperties>, "customOptionForm" | "options" | "selectedOption" | "specifyOtherOption"> & {
|
|
393
|
+
readonly baselineName?: string | undefined;
|
|
394
|
+
readonly baselineValue?: string | undefined;
|
|
395
|
+
readonly hiddenValue?: string | undefined;
|
|
396
|
+
readonly options: readonly RadioOptionTemplateItem[];
|
|
397
|
+
readonly selectedOption: TemplateSelectedOptionItem | undefined;
|
|
398
|
+
readonly specifyOtherOption?: TemplateOptionItem | undefined;
|
|
399
|
+
readonly customOptionForm?: string | undefined;
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
export declare type RadioButtonTemplateProperties = Omit<FieldTemplateProperties<RadioButtonProperties>, "label"> & {
|
|
403
|
+
readonly hiddenValue?: string | undefined;
|
|
404
|
+
readonly label?: string | undefined;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
export declare type RadioOptionTemplateItem = TemplateOptionItem & {
|
|
408
|
+
readonly checked: boolean;
|
|
409
|
+
readonly disabled?: boolean | undefined;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
export declare function readOnlyName(path: NodePath): string;
|
|
413
|
+
|
|
414
|
+
export declare type RemoveActionProperties = {
|
|
415
|
+
readonly actionName: string;
|
|
416
|
+
readonly linkId?: string | undefined;
|
|
417
|
+
readonly removeAction?: string | undefined;
|
|
418
|
+
readonly removeLabel: string;
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
export declare type RenderHtml = (node: ReactNode) => string;
|
|
422
|
+
|
|
423
|
+
export declare type RenderMode = "capture" | "display";
|
|
424
|
+
|
|
425
|
+
export declare function renderOption(option: OptionItem | undefined, renderHtml: RenderHtml): TemplateOptionItem | undefined;
|
|
426
|
+
|
|
427
|
+
export declare function renderSelectedOption(option: SelectedOptionItem, renderHtml: RenderHtml): TemplateSelectedOptionItem;
|
|
428
|
+
|
|
429
|
+
export declare function renderSelectedOption(option: undefined, renderHtml: RenderHtml): undefined;
|
|
430
|
+
|
|
431
|
+
export declare function renderSelectedOption(option: SelectedOptionItem | undefined, renderHtml: RenderHtml): TemplateSelectedOptionItem | undefined;
|
|
432
|
+
|
|
433
|
+
export declare type RequiredTemplates = {
|
|
434
|
+
readonly [K in keyof Templates]-?: NonNullable<Templates[K]>;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
declare type RuntimeProperties = "onAdd" | "onCancel" | "onChange" | "onDeselect" | "onNext" | "onPrev" | "onRemove" | "onSearch" | "onSelect" | "onSubmit" | "onToggleExpanded";
|
|
438
|
+
|
|
439
|
+
export declare function searchName(path: NodePath): string;
|
|
440
|
+
|
|
441
|
+
export declare function selectedName(path: NodePath): string;
|
|
442
|
+
|
|
443
|
+
export declare type SelectInputTemplateProperties = Omit<FieldTemplateProperties<SelectInputProperties>, "customOptionForm" | "options" | "selectedOption" | "specifyOtherOption"> & {
|
|
444
|
+
readonly baselineName?: string | undefined;
|
|
445
|
+
readonly baselineValue?: string | undefined;
|
|
446
|
+
readonly hiddenValue: boolean;
|
|
447
|
+
readonly isBusy?: "true" | undefined;
|
|
448
|
+
readonly searchLabel: string;
|
|
449
|
+
readonly searchName?: string | undefined;
|
|
450
|
+
readonly value: string;
|
|
451
|
+
readonly options: readonly SelectOptionTemplateItem[];
|
|
452
|
+
readonly selectedOption: TemplateSelectedOptionItem | undefined;
|
|
453
|
+
readonly specifyOtherOption?: TemplateOptionItem | undefined;
|
|
454
|
+
readonly customOptionForm?: string | undefined;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
export declare type SelectOptionTemplateItem = TemplateOptionItem & {
|
|
458
|
+
readonly selected: boolean;
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
export declare type SignatureInputTemplateProperties = FieldTemplateProperties<SignatureInputProperties> & {
|
|
462
|
+
readonly inputValue: string;
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
export declare function signatureName(path: NodePath): string;
|
|
466
|
+
|
|
467
|
+
export declare type SliderInputTemplateProperties = FieldTemplateProperties<SliderInputProperties> & NumberInputViewProperties;
|
|
468
|
+
|
|
469
|
+
export declare type SpinnerInputTemplateProperties = FieldTemplateProperties<SpinnerInputProperties> & NumberInputViewProperties;
|
|
470
|
+
|
|
471
|
+
export declare type StackTemplateProperties = Omit<TemplateBase<StackProperties>, "children"> & {
|
|
472
|
+
readonly children: string;
|
|
473
|
+
};
|
|
474
|
+
|
|
475
|
+
export declare type TabContainerTemplateProperties = Omit<TemplateBase<TabContainerProperties>, "errors" | "header" | "items"> & {
|
|
476
|
+
readonly header?: string | undefined;
|
|
477
|
+
readonly errors?: string | undefined;
|
|
478
|
+
readonly items: readonly TemplateTabItem[];
|
|
479
|
+
readonly active?: TemplateTabItem | undefined;
|
|
480
|
+
readonly actionName?: string | undefined;
|
|
481
|
+
readonly tabName?: string | undefined;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
export declare function tableColumn(column: TableColumn, renderHtml: RenderHtml): TemplateTableColumn;
|
|
485
|
+
|
|
486
|
+
export declare function tableRow(row: TableRow, renderHtml: RenderHtml, strings: Strings): TemplateTableRow;
|
|
487
|
+
|
|
488
|
+
export declare type TableTemplateProperties = Omit<TemplateBase<TableProperties>, "columns" | "rows"> & {
|
|
489
|
+
readonly hasRowHeader: boolean;
|
|
490
|
+
readonly columns: readonly TemplateTableColumn[];
|
|
491
|
+
readonly rows: readonly TemplateTableRow[];
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
export declare function tabName(path: NodePath): string;
|
|
495
|
+
|
|
496
|
+
export declare type Template<TProperties extends TemplateProperties = TemplateProperties> = (properties: TProperties) => string;
|
|
497
|
+
|
|
498
|
+
declare type TemplateBase<TProperties> = Readonly<Omit<TProperties, RuntimeProperties>>;
|
|
499
|
+
|
|
500
|
+
export declare interface TemplateFieldAttributes {
|
|
501
|
+
readonly field: AnswerField;
|
|
502
|
+
readonly name?: string | undefined;
|
|
503
|
+
readonly "data-fb-link-id"?: string | undefined;
|
|
504
|
+
readonly "data-fb-field"?: AnswerField | undefined;
|
|
505
|
+
readonly "hx-include": "closest form";
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
export declare type TemplateFormPagination = Omit<FormPagination, "onNext" | "onPrev"> & {
|
|
509
|
+
readonly nextLabel: string;
|
|
510
|
+
readonly previousLabel: string;
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
export declare type TemplateName = keyof Templates;
|
|
514
|
+
|
|
515
|
+
export declare const templateNames: readonly ["TextInput", "TextArea", "NumberInput", "DateInput", "DateTimeInput", "TimeInput", "SliderInput", "SpinnerInput", "OptionDisplay", "SelectInput", "RadioButton", "RadioButtonList", "Checkbox", "CheckboxList", "MultiSelectInput", "CustomOptionForm", "Errors", "Label", "QuestionScaffold", "OptionsLoading", "Help", "Legal", "Flyover", "Header", "Footer", "Form", "Stack", "AnswerList", "AnswerScaffold", "GroupList", "GroupScaffold", "Table", "InputGroup", "FileInput", "SignatureInput", "DisplayRenderer", "TabContainer", "Link", "LanguageSelector"];
|
|
516
|
+
|
|
517
|
+
export declare type TemplateOptionItem = Omit<OptionItem, "label"> & {
|
|
518
|
+
readonly label: string;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
export declare type TemplateProperties = TextInputTemplateProperties | TextAreaTemplateProperties | NumberInputTemplateProperties | DateInputTemplateProperties | DateTimeInputTemplateProperties | TimeInputTemplateProperties | SliderInputTemplateProperties | SpinnerInputTemplateProperties | OptionDisplayTemplateProperties | SelectInputTemplateProperties | RadioButtonTemplateProperties | RadioButtonListTemplateProperties | CheckboxTemplateProperties | CheckboxListTemplateProperties | MultiSelectInputTemplateProperties | CustomOptionFormTemplateProperties | ErrorsTemplateProperties | LabelTemplateProperties | QuestionScaffoldTemplateProperties | OptionsLoadingTemplateProperties | HelpTemplateProperties | LegalTemplateProperties | FlyoverTemplateProperties | HeaderTemplateProperties | FooterTemplateProperties | FormTemplateProperties | StackTemplateProperties | AnswerListTemplateProperties | AnswerScaffoldTemplateProperties | GroupListTemplateProperties | GroupScaffoldTemplateProperties | TableTemplateProperties | InputGroupTemplateProperties | FileInputTemplateProperties | SignatureInputTemplateProperties | DisplayRendererTemplateProperties | TabContainerTemplateProperties | LinkTemplateProperties | LanguageSelectorTemplateProperties;
|
|
522
|
+
|
|
523
|
+
export declare interface Templates {
|
|
524
|
+
readonly TextInput?: Template<TextInputTemplateProperties> | undefined;
|
|
525
|
+
readonly TextArea?: Template<TextAreaTemplateProperties> | undefined;
|
|
526
|
+
readonly NumberInput?: Template<NumberInputTemplateProperties> | undefined;
|
|
527
|
+
readonly DateInput?: Template<DateInputTemplateProperties> | undefined;
|
|
528
|
+
readonly DateTimeInput?: Template<DateTimeInputTemplateProperties> | undefined;
|
|
529
|
+
readonly TimeInput?: Template<TimeInputTemplateProperties> | undefined;
|
|
530
|
+
readonly SliderInput?: Template<SliderInputTemplateProperties> | undefined;
|
|
531
|
+
readonly SpinnerInput?: Template<SpinnerInputTemplateProperties> | undefined;
|
|
532
|
+
readonly OptionDisplay?: Template<OptionDisplayTemplateProperties> | undefined;
|
|
533
|
+
readonly SelectInput?: Template<SelectInputTemplateProperties> | undefined;
|
|
534
|
+
readonly RadioButton?: Template<RadioButtonTemplateProperties> | undefined;
|
|
535
|
+
readonly RadioButtonList?: Template<RadioButtonListTemplateProperties> | undefined;
|
|
536
|
+
readonly Checkbox?: Template<CheckboxTemplateProperties> | undefined;
|
|
537
|
+
readonly CheckboxList?: Template<CheckboxListTemplateProperties> | undefined;
|
|
538
|
+
readonly MultiSelectInput?: Template<MultiSelectInputTemplateProperties> | undefined;
|
|
539
|
+
readonly CustomOptionForm?: Template<CustomOptionFormTemplateProperties> | undefined;
|
|
540
|
+
readonly Errors?: Template<ErrorsTemplateProperties> | undefined;
|
|
541
|
+
readonly Label?: Template<LabelTemplateProperties> | undefined;
|
|
542
|
+
readonly QuestionScaffold?: Template<QuestionScaffoldTemplateProperties> | undefined;
|
|
543
|
+
readonly OptionsLoading?: Template<OptionsLoadingTemplateProperties> | undefined;
|
|
544
|
+
readonly Help?: Template<HelpTemplateProperties> | undefined;
|
|
545
|
+
readonly Legal?: Template<LegalTemplateProperties> | undefined;
|
|
546
|
+
readonly Flyover?: Template<FlyoverTemplateProperties> | undefined;
|
|
547
|
+
readonly Header?: Template<HeaderTemplateProperties> | undefined;
|
|
548
|
+
readonly Footer?: Template<FooterTemplateProperties> | undefined;
|
|
549
|
+
readonly Form?: Template<FormTemplateProperties> | undefined;
|
|
550
|
+
readonly Stack?: Template<StackTemplateProperties> | undefined;
|
|
551
|
+
readonly AnswerList?: Template<AnswerListTemplateProperties> | undefined;
|
|
552
|
+
readonly AnswerScaffold?: Template<AnswerScaffoldTemplateProperties> | undefined;
|
|
553
|
+
readonly GroupList?: Template<GroupListTemplateProperties> | undefined;
|
|
554
|
+
readonly GroupScaffold?: Template<GroupScaffoldTemplateProperties> | undefined;
|
|
555
|
+
readonly Table?: Template<TableTemplateProperties> | undefined;
|
|
556
|
+
readonly InputGroup?: Template<InputGroupTemplateProperties> | undefined;
|
|
557
|
+
readonly FileInput?: Template<FileInputTemplateProperties> | undefined;
|
|
558
|
+
readonly SignatureInput?: Template<SignatureInputTemplateProperties> | undefined;
|
|
559
|
+
readonly DisplayRenderer?: Template<DisplayRendererTemplateProperties> | undefined;
|
|
560
|
+
readonly TabContainer?: Template<TabContainerTemplateProperties> | undefined;
|
|
561
|
+
readonly Link?: Template<LinkTemplateProperties> | undefined;
|
|
562
|
+
readonly LanguageSelector?: Template<LanguageSelectorTemplateProperties> | undefined;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
export declare type TemplateSelectedOptionItem = TemplateOptionItem & {
|
|
566
|
+
readonly ariaDescribedBy?: string | undefined;
|
|
567
|
+
readonly errors?: string | undefined;
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
export declare type TemplateSource<TProperties extends TemplateProperties> = Template<TProperties> | string;
|
|
571
|
+
|
|
572
|
+
export declare type TemplateSources = {
|
|
573
|
+
readonly [K in keyof Templates]?: NonNullable<Templates[K]> | string;
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
export declare type TemplateTabItem = Omit<TabContainerProperties["items"][number], "content" | "label"> & {
|
|
577
|
+
readonly label: string;
|
|
578
|
+
readonly content: string;
|
|
579
|
+
readonly selected?: boolean | undefined;
|
|
580
|
+
readonly ariaSelected: "true" | "false";
|
|
581
|
+
readonly tabAction?: string | undefined;
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
export declare type TemplateTableCell = Omit<TableCell, "content"> & {
|
|
585
|
+
readonly content?: string | undefined;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
export declare type TemplateTableColumn = Omit<TableColumn, "content" | "errors"> & {
|
|
589
|
+
readonly content: string;
|
|
590
|
+
readonly errors?: string | undefined;
|
|
591
|
+
readonly widthStyle?: string | undefined;
|
|
592
|
+
};
|
|
593
|
+
|
|
594
|
+
export declare type TemplateTableRow = Omit<TableRow, "cells" | "content" | "errors" | "onRemove"> & {
|
|
595
|
+
readonly content?: string | undefined;
|
|
596
|
+
readonly errors?: string | undefined;
|
|
597
|
+
readonly cells: readonly TemplateTableCell[];
|
|
598
|
+
readonly removeLabelHtml: string;
|
|
599
|
+
} & RemoveActionProperties;
|
|
600
|
+
|
|
601
|
+
export declare type TextAreaTemplateProperties = FieldTemplateProperties<TextAreaProperties>;
|
|
602
|
+
|
|
603
|
+
export declare type TextInputTemplateProperties = FieldTemplateProperties<TextInputProperties> & {
|
|
604
|
+
readonly inputType: string;
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
export declare type TimeInputTemplateProperties = FieldTemplateProperties<TimeInputProperties>;
|
|
608
|
+
|
|
609
|
+
export declare function unitValueName(path: NodePath, token: string): string;
|
|
610
|
+
|
|
611
|
+
export declare function unitValueNamePrefix(path: NodePath): string;
|
|
612
|
+
|
|
613
|
+
export declare function valueName(path: NodePath, field: AnswerField): string;
|
|
614
|
+
|
|
615
|
+
export { }
|