@formbox/htmx 0.4.3 → 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.
@@ -4,7 +4,7 @@ Template: AnswerList
4
4
  Inputs:
5
5
  - children: rendered repeated answer rows.
6
6
  - hasCount/countName/count: hidden occurrence count state.
7
- - actionName/addAction/addLabel: add-answer submit action.
7
+ - actionName/addAction/addId/addLabel: add-answer submit action.
8
8
  - linkId: current question link id for data attributes.
9
9
  - path: renderer node path, when present.
10
10
  --}}
@@ -13,5 +13,5 @@ Inputs:
13
13
  {{/if}}
14
14
  {{{children}}}
15
15
  {{#if addAction}}
16
- <button type="submit"{{{attr "data-fb-link-id" linkId}}} data-fb-field="add-action"{{{attr "name" actionName}}}{{{attr "value" addAction}}}>{{addLabel}}</button>
16
+ <button type="submit"{{{attr "id" addId}}}{{{attr "data-fb-link-id" linkId}}} data-fb-field="add-action"{{{attr "name" actionName}}}{{{attr "value" addAction}}}>{{addLabel}}</button>
17
17
  {{/if}}
@@ -5,7 +5,7 @@ Inputs:
5
5
  - control: rendered answer control.
6
6
  - errors: rendered answer errors.
7
7
  - children: rendered answer child items.
8
- - actionName/removeAction/removeLabel: remove-answer submit action.
8
+ - actionName/removeAction/removeId/removeLabel: remove-answer submit action.
9
9
  - linkId: current question link id for data attributes.
10
10
  - path/canRemove: repeat answer state used to derive removeAction.
11
11
  --}}
@@ -14,6 +14,6 @@ Inputs:
14
14
  {{{errors}}}
15
15
  {{{children}}}
16
16
  {{#if removeAction}}
17
- <button type="submit"{{{attr "data-fb-link-id" linkId}}} data-fb-field="remove-action"{{{attr "name" actionName}}}{{{attr "value" removeAction}}}>{{removeLabel}}</button>
17
+ <button type="submit"{{{attr "id" removeId}}}{{{attr "data-fb-link-id" linkId}}} data-fb-field="remove-action"{{{attr "name" actionName}}}{{{attr "value" removeAction}}}>{{removeLabel}}</button>
18
18
  {{/if}}
19
19
  </div>
@@ -3,7 +3,7 @@ Template: CheckboxList
3
3
 
4
4
  Inputs:
5
5
  - id: fieldset id.
6
- - options: items with token, label, selected, disabled, and hiddenInput.
6
+ - options: items with id, token, label, selected, disabled, and hiddenInput.
7
7
  - selectedOptions/selectedName: selected option state and hidden selected-token field name.
8
8
  - hiddenInputs/trailingHiddenInputs: hidden values that preserve disabled or off-list selections.
9
9
  - specifyOtherOption/customOptionForm: custom option entry controls.
@@ -20,7 +20,7 @@ Inputs:
20
20
  {{#if hiddenInput}}
21
21
  <input type="hidden"{{{attr "name" hiddenInput.name}}}{{{attr "value" hiddenInput.value}}}>
22
22
  {{/if}}
23
- <label><input{{{fieldAttributes ..}}} type="checkbox"{{{attr "value" token}}}{{{attr "checked" selected}}}{{{attr "disabled" disabled}}}{{{attr "aria-describedby" ../ariaDescribedBy}}}>{{{label}}}</label>
23
+ <label><input{{{fieldAttributes ..}}}{{{attr "id" id}}} type="checkbox"{{{attr "value" token}}}{{{attr "checked" selected}}}{{{attr "disabled" disabled}}}{{{attr "aria-describedby" ../ariaDescribedBy}}}>{{{label}}}</label>
24
24
  {{/each}}
25
25
  {{#each trailingHiddenInputs}}
26
26
  <input type="hidden"{{{attr "name" name}}}{{{attr "value" value}}}>
@@ -5,12 +5,14 @@ Inputs:
5
5
  - content: rendered custom option fields.
6
6
  - errors: rendered validation errors.
7
7
  - actionName: submit action field name.
8
- - submitLabel/cancelLabel: button labels.
8
+ - id: fieldset id.
9
+ - submitId/submitLabel: submit button id and label.
10
+ - cancelId/cancelLabel: cancel button id and label.
9
11
  - canSubmit: source theme state, if supplied.
10
12
  --}}
11
- <fieldset>
13
+ <fieldset{{{attr "id" id}}}>
12
14
  {{{content}}}
13
15
  {{{errors}}}
14
- <button type="submit"{{{attr "name" actionName}}} value="submit-custom">{{submitLabel}}</button>
15
- <button type="submit"{{{attr "name" actionName}}} value="cancel-custom">{{cancelLabel}}</button>
16
+ <button type="submit"{{{attr "id" submitId}}}{{{attr "name" actionName}}} value="submit-custom">{{submitLabel}}</button>
17
+ <button type="submit"{{{attr "id" cancelId}}}{{{attr "name" actionName}}} value="cancel-custom">{{cancelLabel}}</button>
16
18
  </fieldset>
@@ -4,7 +4,7 @@ Template: FileInput
4
4
  Inputs:
5
5
  - id: control id.
6
6
  - value/hiddenValue: current attachment and hidden JSON mirror.
7
- - clearAction/clearLabel: clear-file submit control state.
7
+ - clearAction/clearId/clearLabel: clear-file submit control state.
8
8
  - dataLinkId/hxInclude: clear button HTMX attributes.
9
9
  - disabled/accept: native file input state.
10
10
  - ariaLabelledBy/ariaDescribedBy: accessibility references.
@@ -16,5 +16,5 @@ Inputs:
16
16
  {{/if}}
17
17
  <input{{{fieldAttributes}}}{{{attr "id" id}}} type="file"{{{attr "disabled" disabled}}}{{{attr "accept" accept}}}{{{attr "aria-labelledby" ariaLabelledBy}}}{{{attr "aria-describedby" ariaDescribedBy}}}>
18
18
  {{#if clearAction}}
19
- <button type="submit"{{{attr "data-fb-link-id" dataLinkId}}} data-fb-field="value"{{{attr "name" name}}} value=""{{{attr "hx-include" hxInclude}}}>{{clearLabel}}</button>
19
+ <button type="submit"{{{attr "id" clearId}}}{{{attr "data-fb-link-id" dataLinkId}}} data-fb-field="value"{{{attr "name" name}}} value=""{{{attr "hx-include" hxInclude}}}>{{clearLabel}}</button>
20
20
  {{/if}}
@@ -4,9 +4,9 @@ Template: Flyover
4
4
  Inputs:
5
5
  - id: tooltip id.
6
6
  - children: rendered flyover content.
7
- - ariaLabel: button accessible label.
7
+ - buttonId/ariaLabel: button id and accessible label.
8
8
  --}}
9
9
  <span>
10
- <button type="button"{{{attr "aria-describedby" id}}}{{{attr "aria-label" ariaLabel}}}>i</button>
10
+ <button type="button"{{{attr "id" buttonId}}}{{{attr "aria-describedby" id}}}{{{attr "aria-label" ariaLabel}}}>i</button>
11
11
  <span{{{attr "id" id}}} role="tooltip">{{{children}}}</span>
12
12
  </span>
@@ -5,7 +5,7 @@ Inputs:
5
5
  - linkId: repeated group link id.
6
6
  - header/errors/children: rendered group list sections.
7
7
  - hasCount/countName/count: hidden occurrence count state.
8
- - actionName/addAction/addLabel: add-group submit action.
8
+ - actionName/addAction/addId/addLabel: add-group submit action.
9
9
  - path/canAdd: repeat group state used to derive addAction.
10
10
  - customExtensions: source extension values, if supplied.
11
11
  --}}
@@ -17,6 +17,6 @@ Inputs:
17
17
  {{{errors}}}
18
18
  {{{children}}}
19
19
  {{#if addAction}}
20
- <button type="submit"{{{attr "data-fb-link-id" linkId}}} data-fb-field="add-action"{{{attr "name" actionName}}}{{{attr "value" addAction}}}>{{addLabel}}</button>
20
+ <button type="submit"{{{attr "id" addId}}}{{{attr "data-fb-link-id" linkId}}} data-fb-field="add-action"{{{attr "name" actionName}}}{{{attr "value" addAction}}}>{{addLabel}}</button>
21
21
  {{/if}}
22
22
  </section>
@@ -5,8 +5,8 @@ Inputs:
5
5
  - linkId: group link id.
6
6
  - header/children/expandedChildren/errors/signature: rendered group sections.
7
7
  - isExpandable/isExpanded/expandedName/expandedValue: collapsible group state.
8
- - summaryLabel/collapseLabel/expandLabel/toggleAction: collapsible submit control state.
9
- - actionName/removeAction/removeLabel: remove-group submit action.
8
+ - summaryLabel/collapseLabel/expandLabel/toggleAction/toggleId: collapsible submit control state.
9
+ - actionName/removeAction/removeId/removeLabel: remove-group submit action.
10
10
  - path/canRemove: repeat group state used to derive removeAction.
11
11
  - customExtensions: source extension values, if supplied.
12
12
  --}}
@@ -17,20 +17,20 @@ Inputs:
17
17
  <input type="hidden"{{{attr "name" expandedName}}}{{{attr "value" expandedValue}}}>
18
18
  {{/if}}
19
19
  <details{{{attr "data-fb-collapsible" linkId}}}{{{attr "open" isExpanded}}}>
20
- <summary>{{#if toggleAction}}<button type="submit"{{{attr "name" actionName}}}{{{attr "value" toggleAction}}}>{{summaryLabel}}</button>{{else}}{{summaryLabel}}{{/if}}</summary>
20
+ <summary>{{#if toggleAction}}<button type="submit"{{{attr "id" toggleId}}}{{{attr "name" actionName}}}{{{attr "value" toggleAction}}}>{{summaryLabel}}</button>{{else}}{{summaryLabel}}{{/if}}</summary>
21
21
  {{{expandedChildren}}}
22
22
  </details>
23
23
  {{{errors}}}
24
24
  {{{signature}}}
25
25
  {{#if removeAction}}
26
- <button type="submit"{{{attr "data-fb-link-id" linkId}}} data-fb-field="remove-action"{{{attr "name" actionName}}}{{{attr "value" removeAction}}}>{{removeLabel}}</button>
26
+ <button type="submit"{{{attr "id" removeId}}}{{{attr "data-fb-link-id" linkId}}} data-fb-field="remove-action"{{{attr "name" actionName}}}{{{attr "value" removeAction}}}>{{removeLabel}}</button>
27
27
  {{/if}}
28
28
  {{else}}
29
29
  {{{errors}}}
30
30
  {{{children}}}
31
31
  {{{signature}}}
32
32
  {{#if removeAction}}
33
- <button type="submit"{{{attr "data-fb-link-id" linkId}}} data-fb-field="remove-action"{{{attr "name" actionName}}}{{{attr "value" removeAction}}}>{{removeLabel}}</button>
33
+ <button type="submit"{{{attr "id" removeId}}}{{{attr "data-fb-link-id" linkId}}} data-fb-field="remove-action"{{{attr "name" actionName}}}{{{attr "value" removeAction}}}>{{removeLabel}}</button>
34
34
  {{/if}}
35
35
  {{/if}}
36
36
  </fieldset>
@@ -4,9 +4,9 @@ Template: Help
4
4
  Inputs:
5
5
  - id: tooltip id.
6
6
  - children: rendered help content.
7
- - ariaLabel: button accessible label.
7
+ - buttonId/ariaLabel: button id and accessible label.
8
8
  --}}
9
9
  <span>
10
- <button type="button"{{{attr "aria-describedby" id}}}{{{attr "aria-label" ariaLabel}}}>?</button>
10
+ <button type="button"{{{attr "id" buttonId}}}{{{attr "aria-describedby" id}}}{{{attr "aria-label" ariaLabel}}}>?</button>
11
11
  <span{{{attr "id" id}}} role="tooltip">{{{children}}}</span>
12
12
  </span>
@@ -6,18 +6,18 @@ Inputs:
6
6
  - as/isLegend/isText: rendered label element kind.
7
7
  - content: rendered label text, prefix, required marker, and help/legal/flyover html.
8
8
  - children/prefix/required/shortText: source label text state.
9
- - supportHyperlinks: links with href and labelHtml.
9
+ - supportHyperlinks: links with id, href, and labelHtml.
10
10
  - media: rendered attachment media html.
11
11
  - help/legal/flyover: rendered extension slots.
12
12
  - isExpanded: source expansion state, if supplied.
13
13
  - attachmentLabel: accessible text used while rendering media.
14
14
  --}}
15
15
  {{#if isLegend}}
16
- <legend{{{attr "id" id}}}{{{attr "data-short-text" shortText}}}>{{{content}}}{{#if supportHyperlinks.length}}<div>{{#each supportHyperlinks}}<a{{{attr "href" href}}} target="_blank" rel="noreferrer">{{{labelHtml}}}</a>{{/each}}</div>{{/if}}{{{media}}}</legend>
16
+ <legend{{{attr "id" id}}}{{{attr "data-short-text" shortText}}}>{{{content}}}{{#if supportHyperlinks.length}}<div>{{#each supportHyperlinks}}<a{{{attr "id" id}}}{{{attr "href" href}}} target="_blank" rel="noreferrer">{{{labelHtml}}}</a>{{/each}}</div>{{/if}}{{{media}}}</legend>
17
17
  {{else}}
18
18
  {{#if isText}}
19
- <span{{{attr "id" id}}}{{{attr "data-short-text" shortText}}}>{{{content}}}{{#if supportHyperlinks.length}}<div>{{#each supportHyperlinks}}<a{{{attr "href" href}}} target="_blank" rel="noreferrer">{{{labelHtml}}}</a>{{/each}}</div>{{/if}}{{{media}}}</span>
19
+ <span{{{attr "id" id}}}{{{attr "data-short-text" shortText}}}>{{{content}}}{{#if supportHyperlinks.length}}<div>{{#each supportHyperlinks}}<a{{{attr "id" id}}}{{{attr "href" href}}} target="_blank" rel="noreferrer">{{{labelHtml}}}</a>{{/each}}</div>{{/if}}{{{media}}}</span>
20
20
  {{else}}
21
- <label{{{attr "id" id}}}{{{attr "for" htmlFor}}}{{{attr "data-short-text" shortText}}}>{{{content}}}{{#if supportHyperlinks.length}}<div>{{#each supportHyperlinks}}<a{{{attr "href" href}}} target="_blank" rel="noreferrer">{{{labelHtml}}}</a>{{/each}}</div>{{/if}}{{{media}}}</label>
21
+ <label{{{attr "id" id}}}{{{attr "for" htmlFor}}}{{{attr "data-short-text" shortText}}}>{{{content}}}{{#if supportHyperlinks.length}}<div>{{#each supportHyperlinks}}<a{{{attr "id" id}}}{{{attr "href" href}}} target="_blank" rel="noreferrer">{{{labelHtml}}}</a>{{/each}}</div>{{/if}}{{{media}}}</label>
22
22
  {{/if}}
23
23
  {{/if}}
@@ -2,11 +2,12 @@
2
2
  Template: LanguageSelector
3
3
 
4
4
  Inputs:
5
+ - id: select id.
5
6
  - name: generated language field name.
6
7
  - value: current language code.
7
8
  - options: language options with value, label, and selected.
8
9
  --}}
9
- <select{{{attr "name" name}}}>
10
+ <select{{{attr "id" id}}}{{{attr "name" name}}}>
10
11
  {{#each options}}
11
12
  <option{{{attr "value" value}}}{{{attr "selected" selected}}}>{{label}}</option>
12
13
  {{/each}}
@@ -4,9 +4,9 @@ Template: Legal
4
4
  Inputs:
5
5
  - id: dialog id.
6
6
  - children: rendered legal content.
7
- - ariaLabel: button accessible label.
7
+ - buttonId/ariaLabel: button id and accessible label.
8
8
  --}}
9
9
  <span>
10
- <button type="button"{{{attr "aria-describedby" id}}}{{{attr "aria-label" ariaLabel}}}>!</button>
10
+ <button type="button"{{{attr "id" buttonId}}}{{{attr "aria-describedby" id}}}{{{attr "aria-label" ariaLabel}}}>!</button>
11
11
  <span{{{attr "id" id}}} role="dialog">{{{children}}}</span>
12
12
  </span>
@@ -2,8 +2,9 @@
2
2
  Template: Link
3
3
 
4
4
  Inputs:
5
+ - id: link id.
5
6
  - href: link target.
6
7
  - target/rel: link browsing attributes.
7
8
  - children: rendered link content.
8
9
  --}}
9
- <a{{{attr "href" href}}}{{{attr "target" target}}}{{{attr "rel" rel}}}>{{{children}}}</a>
10
+ <a{{{attr "id" id}}}{{{attr "href" href}}}{{{attr "target" target}}}{{{attr "rel" rel}}}>{{{children}}}</a>
@@ -3,7 +3,7 @@ Template: MultiSelectInput
3
3
 
4
4
  Inputs:
5
5
  - id: fieldset id.
6
- - options: items with token, label, selected, disabled, and hiddenInput.
6
+ - options: items with id, token, label, selected, disabled, and hiddenInput.
7
7
  - selectedOptions/selectedName: selected option state and hidden selected-token field name.
8
8
  - hiddenInputs/trailingHiddenInputs: hidden values that preserve disabled or off-list selections.
9
9
  - searchQuery/searchName/searchLabel: server-side option search state.
@@ -21,7 +21,7 @@ Inputs:
21
21
  {{#if hiddenInput}}
22
22
  <input type="hidden"{{{attr "name" hiddenInput.name}}}{{{attr "value" hiddenInput.value}}}>
23
23
  {{/if}}
24
- <label><input{{{fieldAttributes ..}}} type="checkbox"{{{attr "value" token}}}{{{attr "checked" selected}}}{{{attr "disabled" disabled}}}{{{attr "aria-describedby" ../ariaDescribedBy}}}>{{{label}}}</label>
24
+ <label><input{{{fieldAttributes ..}}}{{{attr "id" id}}} type="checkbox"{{{attr "value" token}}}{{{attr "checked" selected}}}{{{attr "disabled" disabled}}}{{{attr "aria-describedby" ../ariaDescribedBy}}}>{{{label}}}</label>
25
25
  {{/each}}
26
26
  {{#each trailingHiddenInputs}}
27
27
  <input type="hidden"{{{attr "name" name}}}{{{attr "value" value}}}>
@@ -5,7 +5,7 @@ Inputs:
5
5
  - linkId: question link id.
6
6
  - header/children/expandedChildren/errors/signature: rendered question sections.
7
7
  - isExpandable/isExpanded/expandedName/expandedValue: collapsible question state.
8
- - summaryLabel/collapseLabel/expandLabel/toggleAction: collapsible submit control state.
8
+ - summaryLabel/collapseLabel/expandLabel/toggleAction/toggleId: collapsible submit control state.
9
9
  - actionName: submit action field name.
10
10
  - path: renderer node path, when present.
11
11
  - customExtensions: source extension values, if supplied.
@@ -17,7 +17,7 @@ Inputs:
17
17
  <input type="hidden"{{{attr "name" expandedName}}}{{{attr "value" expandedValue}}}>
18
18
  {{/if}}
19
19
  <details{{{attr "data-fb-collapsible" linkId}}}{{{attr "open" isExpanded}}}>
20
- <summary>{{#if toggleAction}}<button type="submit"{{{attr "name" actionName}}}{{{attr "value" toggleAction}}}>{{summaryLabel}}</button>{{else}}{{summaryLabel}}{{/if}}</summary>
20
+ <summary>{{#if toggleAction}}<button type="submit"{{{attr "id" toggleId}}}{{{attr "name" actionName}}}{{{attr "value" toggleAction}}}>{{summaryLabel}}</button>{{else}}{{summaryLabel}}{{/if}}</summary>
21
21
  {{{expandedChildren}}}
22
22
  </details>
23
23
  {{{errors}}}
@@ -3,7 +3,7 @@ Template: RadioButtonList
3
3
 
4
4
  Inputs:
5
5
  - id: fieldset id.
6
- - options: items with token, label, checked, and disabled.
6
+ - options: items with id, token, label, checked, and disabled.
7
7
  - selectedOption: current selected option state.
8
8
  - hiddenValue: hidden mirror value for disabled or preserved selections.
9
9
  - baselineName/baselineValue: hidden original value for protected selection state.
@@ -21,7 +21,7 @@ Inputs:
21
21
  <input type="hidden"{{{attr "name" baselineName}}}{{{attr "value" baselineValue}}}>
22
22
  {{/if}}
23
23
  {{#each options}}
24
- <label><input{{{fieldAttributes ..}}} type="radio"{{{attr "value" token}}}{{{attr "checked" checked}}}{{{attr "disabled" disabled}}}{{{attr "aria-describedby" ../ariaDescribedBy}}}>{{{label}}}</label>
24
+ <label><input{{{fieldAttributes ..}}}{{{attr "id" id}}} type="radio"{{{attr "value" token}}}{{{attr "checked" checked}}}{{{attr "disabled" disabled}}}{{{attr "aria-describedby" ../ariaDescribedBy}}}>{{{label}}}</label>
25
25
  {{/each}}
26
26
  {{{customOptionForm}}}
27
27
  </fieldset>
@@ -4,7 +4,7 @@ Template: Table
4
4
  Inputs:
5
5
  - hasRowHeader: true when rows need a header column.
6
6
  - columns: column items with token, content, errors, width, widthStyle, and isLoading.
7
- - rows: row items with token, content, errors, cells, remove action fields, and isLoading.
7
+ - rows: row items with token, content, errors, cells, remove action fields, removeId, and isLoading.
8
8
  - rows[].cells: cell items with token and content.
9
9
  --}}
10
10
  <table>
@@ -26,7 +26,7 @@ Inputs:
26
26
  {{{content}}}
27
27
  {{{errors}}}
28
28
  {{#if removeAction}}
29
- <button type="submit"{{{attr "data-fb-link-id" linkId}}} data-fb-field="remove-action"{{{attr "name" actionName}}}{{{attr "value" removeAction}}}>{{{removeLabelHtml}}}</button>
29
+ <button type="submit"{{{attr "id" removeId}}}{{{attr "data-fb-link-id" linkId}}} data-fb-field="remove-action"{{{attr "name" actionName}}}{{{attr "value" removeAction}}}>{{{removeLabelHtml}}}</button>
30
30
  {{/if}}
31
31
  </th>
32
32
  {{/if}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formbox/htmx",
3
- "version": "0.4.3",
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
- "react": "^19.2.3",
32
- "react-dom": "^19.2.3",
33
- "@formbox/fhir": "0.4.0",
34
- "@formbox/renderer": "0.4.0",
35
- "@formbox/theme": "0.4.0",
36
- "@formbox/strings": "0.4.0"
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",