@formbox/htmx 0.4.4 → 0.6.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.
Files changed (49) hide show
  1. package/dist/index.d.ts +720 -52
  2. package/dist/index.js +140 -59
  3. package/dist/templates/AnswerList.html.hbs +3 -0
  4. package/dist/templates/AnswerScaffold.html.hbs +3 -0
  5. package/dist/templates/Checkbox.html.hbs +3 -0
  6. package/dist/templates/CheckboxList.html.hbs +3 -0
  7. package/dist/templates/CustomOptionForm.html.hbs +3 -0
  8. package/dist/templates/DateInput.html.hbs +3 -0
  9. package/dist/templates/DateTimeInput.html.hbs +3 -0
  10. package/dist/templates/DisplayRenderer.html.hbs +3 -0
  11. package/dist/templates/Errors.html.hbs +3 -0
  12. package/dist/templates/FileInput.html.hbs +3 -0
  13. package/dist/templates/Flyover.html.hbs +3 -0
  14. package/dist/templates/Footer.html.hbs +3 -0
  15. package/dist/templates/Form.html.hbs +22 -4
  16. package/dist/templates/FormDescription.html.hbs +10 -0
  17. package/dist/templates/FormTitle.html.hbs +10 -0
  18. package/dist/templates/GroupList.html.hbs +3 -0
  19. package/dist/templates/GroupScaffold.html.hbs +3 -0
  20. package/dist/templates/Header.html.hbs +3 -0
  21. package/dist/templates/Help.html.hbs +3 -0
  22. package/dist/templates/InputGroup.html.hbs +3 -0
  23. package/dist/templates/Label.html.hbs +3 -0
  24. package/dist/templates/LabelContent.html.hbs +15 -0
  25. package/dist/templates/LanguageSelector.html.hbs +3 -0
  26. package/dist/templates/Legal.html.hbs +3 -0
  27. package/dist/templates/Link.html.hbs +3 -0
  28. package/dist/templates/Media.html.hbs +29 -0
  29. package/dist/templates/MultiSelectInput.html.hbs +3 -0
  30. package/dist/templates/NumberInput.html.hbs +3 -0
  31. package/dist/templates/OptionDisplay.html.hbs +3 -0
  32. package/dist/templates/OptionsLoading.html.hbs +3 -0
  33. package/dist/templates/Pagination.html.hbs +24 -0
  34. package/dist/templates/QuestionScaffold.html.hbs +3 -0
  35. package/dist/templates/RadioButton.html.hbs +3 -0
  36. package/dist/templates/RadioButtonList.html.hbs +3 -0
  37. package/dist/templates/SelectInput.html.hbs +3 -0
  38. package/dist/templates/ShortTextStyle.html.hbs +10 -0
  39. package/dist/templates/SignatureInput.html.hbs +3 -0
  40. package/dist/templates/SliderInput.html.hbs +3 -0
  41. package/dist/templates/SpinnerInput.html.hbs +3 -0
  42. package/dist/templates/Stack.html.hbs +3 -0
  43. package/dist/templates/SubmitButton.html.hbs +13 -0
  44. package/dist/templates/TabContainer.html.hbs +3 -0
  45. package/dist/templates/Table.html.hbs +3 -0
  46. package/dist/templates/TextArea.html.hbs +3 -0
  47. package/dist/templates/TextInput.html.hbs +3 -0
  48. package/dist/templates/TimeInput.html.hbs +3 -0
  49. package/package.json +10 -12
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 "react/jsx-runtime";
5
- import { createContext, useContext, useMemo, useCallback, useState, createElement, Children } from "react";
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 "react-dom/server.node";
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",
@@ -59539,8 +59564,10 @@ const templateNames = [
59539
59564
  "CheckboxList",
59540
59565
  "MultiSelectInput",
59541
59566
  "CustomOptionForm",
59567
+ "Media",
59542
59568
  "Errors",
59543
59569
  "Label",
59570
+ "LabelContent",
59544
59571
  "QuestionScaffold",
59545
59572
  "OptionsLoading",
59546
59573
  "Help",
@@ -59548,6 +59575,11 @@ const templateNames = [
59548
59575
  "Flyover",
59549
59576
  "Header",
59550
59577
  "Footer",
59578
+ "FormTitle",
59579
+ "FormDescription",
59580
+ "Pagination",
59581
+ "SubmitButton",
59582
+ "ShortTextStyle",
59551
59583
  "Form",
59552
59584
  "Stack",
59553
59585
  "AnswerList",
@@ -59661,44 +59693,47 @@ function isDefined(value) {
59661
59693
  function isPreservedOptionToken$1(token) {
59662
59694
  return token.includes("__custom__") || token.includes("__legacy__");
59663
59695
  }
59664
- function mediaHtml(attachment, fallbackLabel, id2) {
59696
+ function mediaHtml(templates, attachment, fallbackLabel, id2) {
59665
59697
  if (attachment === void 0) {
59666
59698
  return "";
59667
59699
  }
59668
59700
  const label = attachment.title ?? attachment.url ?? fallbackLabel;
59669
59701
  const source = attachment.url ?? attachmentSource(attachment);
59670
59702
  const contentType = attachment.contentType?.toLowerCase();
59671
- if (source === void 0) {
59672
- return `<span>${escapeHtml$1(label)}</span>`;
59673
- }
59674
- if (contentType?.startsWith("image/")) {
59675
- return `<img${attribute("src", source)}${attribute("alt", label)}>`;
59676
- }
59677
- if (contentType?.startsWith("audio/")) {
59678
- return `<audio controls${attribute("id", id2)}${attribute("src", source)}></audio>`;
59679
- }
59680
- if (contentType?.startsWith("video/")) {
59681
- return `<video controls${attribute("id", id2)}${attribute("src", source)}></video>`;
59682
- }
59683
- return `<a${attribute("id", id2)}${attribute("href", source)} target="_blank" rel="noreferrer">${escapeHtml$1(label)}</a>`;
59703
+ const kind = source === void 0 ? "fallback" : contentType?.startsWith("image/") ? "image" : contentType?.startsWith("audio/") ? "audio" : contentType?.startsWith("video/") ? "video" : "link";
59704
+ return templates.Media({
59705
+ attachment,
59706
+ id: id2,
59707
+ label,
59708
+ source,
59709
+ contentType,
59710
+ kind,
59711
+ isFallback: kind === "fallback",
59712
+ isImage: kind === "image",
59713
+ isAudio: kind === "audio",
59714
+ isVideo: kind === "video",
59715
+ isLink: kind === "link"
59716
+ });
59684
59717
  }
59685
59718
  function formFieldsTemplate(properties) {
59686
- const shortTextStyle = properties.children.includes("data-fb-label-short") ? "<style>[data-fb-label-short]{display:none}@media (max-width:40rem){[data-fb-label-full]{display:none}[data-fb-label-short]{display:inline}}</style>" : void 0;
59687
59719
  return [
59688
- shortTextStyle ?? "",
59689
- `<input type="hidden" name="${PAGE_FIELD}" value="${String(properties.pagination?.current ?? 1)}">`,
59690
- properties.title ? `<h1>${escapeHtml$1(properties.title)}</h1>` : "",
59691
- properties.description ? `<p>${escapeHtml$1(properties.description)}</p>` : "",
59720
+ properties.hiddenFields,
59721
+ properties.shortTextStyle,
59722
+ properties.titleHtml ?? "",
59723
+ properties.descriptionHtml ?? "",
59692
59724
  properties.languageSelector ?? "",
59693
59725
  properties.errors ?? "",
59694
59726
  properties.before ?? "",
59695
59727
  properties.children,
59696
59728
  properties.after ?? "",
59697
59729
  properties.signature ?? "",
59698
- renderPagination(properties),
59699
- `<button type="submit"${attribute("id", stableId(properties.id, "submit"))} name="${ACTION_FIELD}" value="submit">${escapeHtml$1(properties.submitLabel)}</button>`
59730
+ properties.paginationHtml ?? "",
59731
+ properties.submitButton
59700
59732
  ].join("");
59701
59733
  }
59734
+ function pageHiddenField(currentPage) {
59735
+ return `<input type="hidden" name="${PAGE_FIELD}" value="${String(currentPage ?? 1)}">`;
59736
+ }
59702
59737
  function fieldAttributes$1(path2, field) {
59703
59738
  if (field === "signature") {
59704
59739
  const signaturePath = path2 ?? [];
@@ -59836,19 +59871,6 @@ function defaultAttributes(action2) {
59836
59871
  "hx-include": "closest form"
59837
59872
  };
59838
59873
  }
59839
- function renderPagination(properties) {
59840
- const pagination = properties.pagination;
59841
- if (!pagination) {
59842
- return "";
59843
- }
59844
- return [
59845
- "<nav>",
59846
- pagination.disabledPrev ? "" : `<button type="submit"${attribute("id", pagination.previousId)} name="${ACTION_FIELD}" value="page-prev">${escapeHtml$1(pagination.previousLabel)}</button>`,
59847
- `<span>${String(pagination.current)} / ${String(pagination.total)}</span>`,
59848
- pagination.disabledNext ? "" : `<button type="submit"${attribute("id", pagination.nextId)} name="${ACTION_FIELD}" value="page-next">${escapeHtml$1(pagination.nextLabel)}</button>`,
59849
- "</nav>"
59850
- ].join("");
59851
- }
59852
59874
  function tableCell(cell, renderHtml) {
59853
59875
  return {
59854
59876
  token: cell.token,
@@ -61535,6 +61557,8 @@ function Form(properties) {
61535
61557
  const renderHtml = useHtml();
61536
61558
  const strings2 = useStrings();
61537
61559
  const id2 = properties.id ?? token;
61560
+ const submitLabel = strings2.form.submit;
61561
+ const children = renderHtml(properties.children);
61538
61562
  const pagination = properties.pagination ? {
61539
61563
  current: properties.pagination.current,
61540
61564
  total: properties.pagination.total,
@@ -61545,27 +61569,70 @@ function Form(properties) {
61545
61569
  previousId: stableId(id2, "pagination", "previous"),
61546
61570
  previousLabel: strings2.pagination.previous
61547
61571
  } : void 0;
61572
+ const titleHtml = properties.title ? templates.FormTitle({ title: properties.title }) : void 0;
61573
+ const descriptionHtml = properties.description ? templates.FormDescription({
61574
+ description: properties.description
61575
+ }) : void 0;
61576
+ const paginationHtml = pagination ? templates.Pagination({
61577
+ ...pagination,
61578
+ actionName: ACTION_FIELD,
61579
+ previousAction: "page-prev",
61580
+ nextAction: "page-next",
61581
+ navigationLabel: strings2.pagination.navigation,
61582
+ currentLabel: formatPageString(
61583
+ strings2.pagination.pageLabel,
61584
+ pagination.current
61585
+ ),
61586
+ previousTargetLabel: formatPageString(
61587
+ strings2.pagination.previousTargetPage,
61588
+ Math.max(pagination.current - 1, 1)
61589
+ ),
61590
+ nextTargetLabel: formatPageString(
61591
+ strings2.pagination.nextTargetPage,
61592
+ Math.min(pagination.current + 1, pagination.total)
61593
+ )
61594
+ }) : void 0;
61595
+ const submitButton = templates.SubmitButton({
61596
+ id: stableId(id2, "submit"),
61597
+ actionName: ACTION_FIELD,
61598
+ value: "submit",
61599
+ label: submitLabel
61600
+ });
61601
+ const rendererHiddenFields = [
61602
+ hiddenFields,
61603
+ pageHiddenField(pagination?.current)
61604
+ ].filter(Boolean).join("");
61605
+ const shortTextStyle = children.includes("data-fb-label-short") ? templates.ShortTextStyle({}) : "";
61548
61606
  const formProperties = {
61549
61607
  id: id2,
61550
61608
  title: properties.title,
61551
61609
  description: properties.description,
61552
61610
  customExtensions: properties.customExtensions,
61611
+ hiddenFields: rendererHiddenFields,
61612
+ titleHtml,
61613
+ descriptionHtml,
61553
61614
  after: renderHtml(properties.after),
61554
61615
  before: renderHtml(properties.before),
61555
- children: renderHtml(properties.children),
61616
+ children,
61556
61617
  errors: renderHtml(properties.errors),
61557
61618
  languageSelector: renderHtml(properties.languageSelector),
61558
61619
  pagination,
61620
+ paginationHtml,
61621
+ shortTextStyle,
61559
61622
  signature: renderHtml(properties.signature),
61560
- submitLabel: strings2.form.submit
61623
+ submitLabel,
61624
+ submitButton
61561
61625
  };
61562
- const fields = [hiddenFields, formFieldsTemplate(formProperties)].join("");
61626
+ const fields = formFieldsTemplate(formProperties);
61563
61627
  return renderTemplate(templates.Form, {
61564
61628
  ...formProperties,
61565
61629
  attributes: { id: id2, ...defaultAttributes(action2) },
61566
61630
  fields
61567
61631
  });
61568
61632
  }
61633
+ function formatPageString(template, page) {
61634
+ return template.replaceAll("{page}", String(page));
61635
+ }
61569
61636
  function GroupList(properties) {
61570
61637
  const { templates, token } = useHtmxTheme();
61571
61638
  const renderHtml = useHtml();
@@ -61664,14 +61731,19 @@ function Label(properties) {
61664
61731
  const strings2 = useStrings();
61665
61732
  const children = renderHtml(properties.children);
61666
61733
  const prefix2 = properties.prefix === void 0 ? void 0 : renderHtml(properties.prefix);
61667
- const content = [
61668
- prefix2 === void 0 ? "" : `<span>${prefix2} </span>`,
61669
- properties.shortText === void 0 ? children : `<span data-fb-label-full>${children}</span><span data-fb-label-short>${escapeHtml$1(properties.shortText)}</span>`,
61670
- properties.required ? '<span aria-hidden="true"> *</span>' : "",
61671
- renderHtml(properties.help),
61672
- renderHtml(properties.legal),
61673
- renderHtml(properties.flyover)
61674
- ].join("");
61734
+ const help = renderHtml(properties.help);
61735
+ const legal = renderHtml(properties.legal);
61736
+ const flyover = renderHtml(properties.flyover);
61737
+ const content = templates.LabelContent({
61738
+ children,
61739
+ prefix: prefix2,
61740
+ shortText: properties.shortText,
61741
+ required: properties.required,
61742
+ help,
61743
+ legal,
61744
+ flyover,
61745
+ hasShortText: properties.shortText !== void 0
61746
+ });
61675
61747
  return renderTemplate(templates.Label, {
61676
61748
  shortText: properties.shortText,
61677
61749
  isExpanded: properties.isExpanded,
@@ -61685,10 +61757,11 @@ function Label(properties) {
61685
61757
  content,
61686
61758
  isLegend: properties.as === "legend",
61687
61759
  isText: properties.as === "text",
61688
- help: renderHtml(properties.help),
61689
- legal: renderHtml(properties.legal),
61690
- flyover: renderHtml(properties.flyover),
61760
+ help,
61761
+ legal,
61762
+ flyover,
61691
61763
  media: mediaHtml(
61764
+ templates,
61692
61765
  properties.media,
61693
61766
  strings2.inputs.attachmentLabel,
61694
61767
  stableId(properties.id, "media")
@@ -61822,7 +61895,11 @@ function OptionDisplay(properties) {
61822
61895
  const strings2 = useStrings();
61823
61896
  return renderTemplate(templates.OptionDisplay, {
61824
61897
  prefix: properties.prefix === void 0 ? void 0 : escapeHtml$1(properties.prefix),
61825
- media: mediaHtml(properties.media, strings2.inputs.attachmentLabel),
61898
+ media: mediaHtml(
61899
+ templates,
61900
+ properties.media,
61901
+ strings2.inputs.attachmentLabel
61902
+ ),
61826
61903
  attachmentLabel: strings2.inputs.attachmentLabel,
61827
61904
  children: renderHtml(properties.children)
61828
61905
  });
@@ -62152,7 +62229,7 @@ function renderStoreFields(store, templates, action2) {
62152
62229
  const htmxTheme = {
62153
62230
  templates,
62154
62231
  token: store.token,
62155
- hiddenFields: renderHiddenFieldsForStore(store),
62232
+ hiddenFields: renderHiddenFieldsForStore(store, templates),
62156
62233
  activeTabValue: activeTab,
62157
62234
  action: action2
62158
62235
  };
@@ -62196,7 +62273,7 @@ function ensureServerRenderableRepeatQuestions(store) {
62196
62273
  }
62197
62274
  });
62198
62275
  }
62199
- function renderHiddenFieldsForStore(store) {
62276
+ function renderHiddenFieldsForStore(store, templates) {
62200
62277
  const renderedNodes = /* @__PURE__ */ new Set([
62201
62278
  ...store.headerNodes,
62202
62279
  ...store.contentNodes,
@@ -62207,10 +62284,10 @@ function renderHiddenFieldsForStore(store) {
62207
62284
  store.nodes.map(
62208
62285
  (node) => renderHiddenFieldsForNode(node, [], renderedNodes.has(node))
62209
62286
  ).join(""),
62210
- renderHiddenNodeIssues(store)
62287
+ renderHiddenNodeIssues(store, templates)
62211
62288
  ].join("");
62212
62289
  }
62213
- function renderHiddenNodeIssues(store) {
62290
+ function renderHiddenNodeIssues(store, templates) {
62214
62291
  const messages = [];
62215
62292
  store.walkNodes({
62216
62293
  node(node) {
@@ -62220,7 +62297,11 @@ function renderHiddenNodeIssues(store) {
62220
62297
  hiddenNodeIssues(node).map((issue) => getIssueMessage(issue)).filter((message) => message !== void 0).forEach((message) => messages.push(message));
62221
62298
  }
62222
62299
  });
62223
- return messages.length === 0 ? "" : `<ul class="fb-errors">${messages.map((message) => `<li>${escapeHtml(message)}</li>`).join("")}</ul>`;
62300
+ return templates.Errors({
62301
+ id: `${store.token}__hidden-node-issues`,
62302
+ hasMessages: messages.length > 0,
62303
+ messages: messages.map((message) => ({ html: escapeHtml(message) }))
62304
+ });
62224
62305
  }
62225
62306
  function hiddenNodeIssues(node) {
62226
62307
  if (node.issues.length > 0) {
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: AnswerList
3
3
 
4
+ Purpose:
5
+ - Renders a repeated answer collection and its add-answer action.
6
+
4
7
  Inputs:
5
8
  - children: rendered repeated answer rows.
6
9
  - hasCount/countName/count: hidden occurrence count state.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: AnswerScaffold
3
3
 
4
+ Purpose:
5
+ - Renders one answer instance, including its controls, errors, and remove action.
6
+
4
7
  Inputs:
5
8
  - control: rendered answer control.
6
9
  - errors: rendered answer errors.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Checkbox
3
3
 
4
+ Purpose:
5
+ - Renders one checkbox answer option input and its visible label.
6
+
4
7
  Inputs:
5
8
  - id: control id.
6
9
  - checkedValue/uncheckedValue: submitted values for checked and unchecked states.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: CheckboxList
3
3
 
4
+ Purpose:
5
+ - Renders a repeating choice question as a checkbox option list.
6
+
4
7
  Inputs:
5
8
  - id: fieldset id.
6
9
  - options: items with id, token, label, selected, disabled, and hiddenInput.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: CustomOptionForm
3
3
 
4
+ Purpose:
5
+ - Renders the inline custom/open-choice value editor and its actions.
6
+
4
7
  Inputs:
5
8
  - content: rendered custom option fields.
6
9
  - errors: rendered validation errors.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: DateInput
3
3
 
4
+ Purpose:
5
+ - Renders a date answer control and its native field constraints.
6
+
4
7
  Inputs:
5
8
  - id: control id.
6
9
  - inputType: date or text fallback input type.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: DateTimeInput
3
3
 
4
+ Purpose:
5
+ - Renders a date-time answer control and its preserved baseline value.
6
+
4
7
  Inputs:
5
8
  - id: control id.
6
9
  - inputType: datetime-local or text fallback input type.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: DisplayRenderer
3
3
 
4
+ Purpose:
5
+ - Renders display-only item content.
6
+
4
7
  Inputs:
5
8
  - linkId: display item link id.
6
9
  - children: rendered display html.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Errors
3
3
 
4
+ Purpose:
5
+ - Renders visible validation or rendering issue messages for a field or form surface.
6
+
4
7
  Inputs:
5
8
  - id: error container id.
6
9
  - messages: escaped validation messages as html entries.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: FileInput
3
3
 
4
+ Purpose:
5
+ - Renders an attachment file control, preserved value, and clear action.
6
+
4
7
  Inputs:
5
8
  - id: control id.
6
9
  - value/hiddenValue: current attachment and hidden JSON mirror.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Flyover
3
3
 
4
+ Purpose:
5
+ - Renders flyover guidance as an accessible disclosure control.
6
+
4
7
  Inputs:
5
8
  - id: tooltip id.
6
9
  - children: rendered flyover content.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Footer
3
3
 
4
+ Purpose:
5
+ - Renders footer display content.
6
+
4
7
  Inputs:
5
8
  - linkId: item link id.
6
9
  - children: rendered footer content.
@@ -1,13 +1,31 @@
1
1
  {{!--
2
2
  Template: Form
3
3
 
4
+ Purpose:
5
+ - Renders the outer form element and the top-level form sections.
6
+
4
7
  Inputs:
5
8
  - attributes: native form attributes generated by the renderer.
6
- - fields: full rendered field html.
9
+ - hiddenFields: renderer-owned hidden protocol field html.
10
+ - fields: legacy full rendered field html.
7
11
  - customExtensions: source extension values, if supplied.
8
- - title/description/languageSelector/errors/before/children/after/signature: source sections already included in fields.
9
- - pagination/submitLabel: source action state already included in fields.
12
+ - shortTextStyle: responsive short-label CSS markup when short labels are present.
13
+ - titleHtml/descriptionHtml/languageSelector/errors/before/children/after/signature: rendered form sections.
14
+ - paginationHtml: rendered pagination controls, if available.
15
+ - submitButton: rendered submit control.
16
+ - title/description/pagination/submitLabel: source values for custom form templates.
10
17
  --}}
11
18
  <form{{{attrs attributes}}}>
12
- {{{fields}}}
19
+ {{{hiddenFields}}}
20
+ {{{shortTextStyle}}}
21
+ {{{titleHtml}}}
22
+ {{{descriptionHtml}}}
23
+ {{{languageSelector}}}
24
+ {{{errors}}}
25
+ {{{before}}}
26
+ {{{children}}}
27
+ {{{after}}}
28
+ {{{signature}}}
29
+ {{{paginationHtml}}}
30
+ {{{submitButton}}}
13
31
  </form>
@@ -0,0 +1,10 @@
1
+ {{!--
2
+ Template: FormDescription
3
+
4
+ Purpose:
5
+ - Renders the questionnaire description slot.
6
+
7
+ Inputs:
8
+ - description: localized questionnaire description text.
9
+ --}}
10
+ <p>{{description}}</p>
@@ -0,0 +1,10 @@
1
+ {{!--
2
+ Template: FormTitle
3
+
4
+ Purpose:
5
+ - Renders the questionnaire title slot.
6
+
7
+ Inputs:
8
+ - title: localized questionnaire title text.
9
+ --}}
10
+ <h1>{{title}}</h1>
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: GroupList
3
3
 
4
+ Purpose:
5
+ - Renders a repeated group collection and its add-group action.
6
+
4
7
  Inputs:
5
8
  - linkId: repeated group link id.
6
9
  - header/errors/children: rendered group list sections.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: GroupScaffold
3
3
 
4
+ Purpose:
5
+ - Renders one group instance, including header, errors, children, and remove action.
6
+
4
7
  Inputs:
5
8
  - linkId: group link id.
6
9
  - header/children/expandedChildren/errors/signature: rendered group sections.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Header
3
3
 
4
+ Purpose:
5
+ - Renders header display content.
6
+
4
7
  Inputs:
5
8
  - linkId: item link id.
6
9
  - children: rendered header content.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Help
3
3
 
4
+ Purpose:
5
+ - Renders help text as an accessible disclosure control.
6
+
4
7
  Inputs:
5
8
  - id: tooltip id.
6
9
  - children: rendered help content.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: InputGroup
3
3
 
4
+ Purpose:
5
+ - Renders grouped input fragments that belong to one answer control.
6
+
4
7
  Inputs:
5
8
  - children: rendered grouped input controls.
6
9
  - spans: source layout spans, if supplied.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Label
3
3
 
4
+ Purpose:
5
+ - Renders the label, legend, or text wrapper around item label content.
6
+
4
7
  Inputs:
5
8
  - id/htmlFor: label id and target control id.
6
9
  - as/isLegend/isText: rendered label element kind.
@@ -0,0 +1,15 @@
1
+ {{!--
2
+ Template: LabelContent
3
+
4
+ Purpose:
5
+ - Renders the inner label text, prefix, required marker, and support controls.
6
+
7
+ Inputs:
8
+ - children: rendered label text html.
9
+ - prefix: rendered prefix html, if supplied.
10
+ - shortText: responsive short label text, if supplied.
11
+ - required: true when required marker should render.
12
+ - help/legal/flyover: rendered extension control html.
13
+ - hasShortText: true when shortText is available.
14
+ --}}
15
+ {{#if prefix}}<span>{{{prefix}}} </span>{{/if}}{{#if hasShortText}}<span data-fb-label-full>{{{children}}}</span><span data-fb-label-short>{{shortText}}</span>{{else}}{{{children}}}{{/if}}{{#if required}}<span aria-hidden="true"> *</span>{{/if}}{{{help}}}{{{legal}}}{{{flyover}}}
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: LanguageSelector
3
3
 
4
+ Purpose:
5
+ - Renders the form language selection control.
6
+
4
7
  Inputs:
5
8
  - id: select id.
6
9
  - name: generated language field name.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Legal
3
3
 
4
+ Purpose:
5
+ - Renders legal text as an accessible disclosure control.
6
+
4
7
  Inputs:
5
8
  - id: dialog id.
6
9
  - children: rendered legal content.
@@ -1,6 +1,9 @@
1
1
  {{!--
2
2
  Template: Link
3
3
 
4
+ Purpose:
5
+ - Renders hyperlink display content.
6
+
4
7
  Inputs:
5
8
  - id: link id.
6
9
  - href: link target.