@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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +323 -0
  3. package/dist/index.d.ts +615 -0
  4. package/dist/index.js +62387 -0
  5. package/dist/templates/AnswerList.html.hbs +17 -0
  6. package/dist/templates/AnswerScaffold.html.hbs +19 -0
  7. package/dist/templates/Checkbox.html.hbs +14 -0
  8. package/dist/templates/CheckboxList.html.hbs +29 -0
  9. package/dist/templates/CustomOptionForm.html.hbs +16 -0
  10. package/dist/templates/DateInput.html.hbs +14 -0
  11. package/dist/templates/DateTimeInput.html.hbs +18 -0
  12. package/dist/templates/DisplayRenderer.html.hbs +9 -0
  13. package/dist/templates/Errors.html.hbs +15 -0
  14. package/dist/templates/FileInput.html.hbs +20 -0
  15. package/dist/templates/Flyover.html.hbs +12 -0
  16. package/dist/templates/Footer.html.hbs +8 -0
  17. package/dist/templates/Form.html.hbs +13 -0
  18. package/dist/templates/GroupList.html.hbs +22 -0
  19. package/dist/templates/GroupScaffold.html.hbs +36 -0
  20. package/dist/templates/Header.html.hbs +8 -0
  21. package/dist/templates/Help.html.hbs +12 -0
  22. package/dist/templates/InputGroup.html.hbs +10 -0
  23. package/dist/templates/Label.html.hbs +23 -0
  24. package/dist/templates/LanguageSelector.html.hbs +13 -0
  25. package/dist/templates/Legal.html.hbs +12 -0
  26. package/dist/templates/Link.html.hbs +9 -0
  27. package/dist/templates/MultiSelectInput.html.hbs +30 -0
  28. package/dist/templates/NumberInput.html.hbs +16 -0
  29. package/dist/templates/OptionDisplay.html.hbs +10 -0
  30. package/dist/templates/OptionsLoading.html.hbs +10 -0
  31. package/dist/templates/QuestionScaffold.html.hbs +30 -0
  32. package/dist/templates/RadioButton.html.hbs +14 -0
  33. package/dist/templates/RadioButtonList.html.hbs +27 -0
  34. package/dist/templates/SelectInput.html.hbs +32 -0
  35. package/dist/templates/SignatureInput.html.hbs +12 -0
  36. package/dist/templates/SliderInput.html.hbs +23 -0
  37. package/dist/templates/SpinnerInput.html.hbs +16 -0
  38. package/dist/templates/Stack.html.hbs +7 -0
  39. package/dist/templates/TabContainer.html.hbs +27 -0
  40. package/dist/templates/Table.html.hbs +39 -0
  41. package/dist/templates/TextArea.html.hbs +13 -0
  42. package/dist/templates/TextInput.html.hbs +14 -0
  43. package/dist/templates/TimeInput.html.hbs +12 -0
  44. package/package.json +57 -0
@@ -0,0 +1,27 @@
1
+ {{!--
2
+ Template: TabContainer
3
+
4
+ Inputs:
5
+ - linkId: tab group link id.
6
+ - header/errors: rendered tab group sections.
7
+ - items: tab items with token, label, content, buttonId, panelId, selected, ariaSelected, and tabAction.
8
+ - active: currently selected item.
9
+ - value: active item index.
10
+ - actionName/tabName: submit fields for tab selection.
11
+ - path: renderer node path, when present.
12
+ --}}
13
+ <section{{{attr "data-fb-link-id" linkId}}}>
14
+ {{#if tabName}}
15
+ <input type="hidden"{{{attr "name" tabName}}}{{{attr "value" value}}}>
16
+ {{/if}}
17
+ {{{header}}}
18
+ {{{errors}}}
19
+ <div role="tablist">
20
+ {{#each items}}
21
+ <button type="submit" role="tab"{{{attr "id" buttonId}}}{{{attr "aria-controls" panelId}}}{{{attr "aria-selected" ariaSelected}}}{{{attr "data-fb-link-id" ../linkId}}} data-fb-field="tab-action"{{{attr "name" ../actionName}}}{{{attr "value" tabAction}}}>{{{label}}}</button>
22
+ {{/each}}
23
+ </div>
24
+ {{#if active}}
25
+ <section role="tabpanel"{{{attr "id" active.panelId}}}{{{attr "aria-labelledby" active.buttonId}}}>{{{active.content}}}</section>
26
+ {{/if}}
27
+ </section>
@@ -0,0 +1,39 @@
1
+ {{!--
2
+ Template: Table
3
+
4
+ Inputs:
5
+ - hasRowHeader: true when rows need a header column.
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.
8
+ - rows[].cells: cell items with token and content.
9
+ --}}
10
+ <table>
11
+ <thead>
12
+ <tr>
13
+ {{#if hasRowHeader}}
14
+ <th></th>
15
+ {{/if}}
16
+ {{#each columns}}
17
+ <th{{{attr "style" widthStyle}}}>{{{content}}}{{{errors}}}</th>
18
+ {{/each}}
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ {{#each rows}}
23
+ <tr>
24
+ {{#if ../hasRowHeader}}
25
+ <th>
26
+ {{{content}}}
27
+ {{{errors}}}
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>
30
+ {{/if}}
31
+ </th>
32
+ {{/if}}
33
+ {{#each cells}}
34
+ <td>{{{content}}}</td>
35
+ {{/each}}
36
+ </tr>
37
+ {{/each}}
38
+ </tbody>
39
+ </table>
@@ -0,0 +1,13 @@
1
+ {{!--
2
+ Template: TextArea
3
+
4
+ Inputs:
5
+ - id: control id.
6
+ - value: submitted text value.
7
+ - disabled/placeholder: native textarea state.
8
+ - ariaLabelledBy/ariaDescribedBy: accessibility references.
9
+ - inputMode/minLength/maxLength: native text constraints.
10
+ - field/name/data-fb-link-id/data-fb-field/hx-include: generated form field attributes.
11
+ - path: renderer node path, when present.
12
+ --}}
13
+ <textarea{{{fieldAttributes}}}{{{attr "id" id}}}{{{attr "readonly" disabled}}}{{{attr "placeholder" placeholder}}}{{{attr "aria-labelledby" ariaLabelledBy}}}{{{attr "aria-describedby" ariaDescribedBy}}}{{{attr "inputmode" inputMode}}}{{{attr "minlength" minLength}}}{{{attr "maxlength" maxLength}}}>{{value}}</textarea>
@@ -0,0 +1,14 @@
1
+ {{!--
2
+ Template: TextInput
3
+
4
+ Inputs:
5
+ - id: control id.
6
+ - type/inputType: requested and rendered native input type.
7
+ - value: submitted text value.
8
+ - disabled/placeholder: native input state.
9
+ - ariaLabelledBy/ariaDescribedBy: accessibility references.
10
+ - inputMode/minLength/maxLength: native text constraints.
11
+ - field/name/data-fb-link-id/data-fb-field/hx-include: generated form field attributes.
12
+ - path: renderer node path, when present.
13
+ --}}
14
+ <input{{{fieldAttributes}}}{{{attr "id" id}}}{{{attr "type" inputType}}}{{{attr "value" value}}}{{{attr "readonly" disabled}}}{{{attr "placeholder" placeholder}}}{{{attr "aria-labelledby" ariaLabelledBy}}}{{{attr "aria-describedby" ariaDescribedBy}}}{{{attr "inputmode" inputMode}}}{{{attr "minlength" minLength}}}{{{attr "maxlength" maxLength}}}>
@@ -0,0 +1,12 @@
1
+ {{!--
2
+ Template: TimeInput
3
+
4
+ Inputs:
5
+ - id: control id.
6
+ - value: submitted time string.
7
+ - disabled/placeholder/min/max: native input state and constraints.
8
+ - ariaLabelledBy/ariaDescribedBy: accessibility references.
9
+ - field/name/data-fb-link-id/data-fb-field/hx-include: generated form field attributes.
10
+ - path: renderer node path, when present.
11
+ --}}
12
+ <input{{{fieldAttributes}}}{{{attr "id" id}}} type="time" step="any"{{{attr "value" value}}}{{{attr "readonly" disabled}}}{{{attr "placeholder" placeholder}}}{{{attr "aria-labelledby" ariaLabelledBy}}}{{{attr "aria-describedby" ariaDescribedBy}}}{{{attr "min" min}}}{{{attr "max" max}}}>
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@formbox/htmx",
3
+ "version": "0.3.0",
4
+ "description": "Server-rendered HTMX HTML renderer for Formbox FHIR Questionnaires",
5
+ "private": false,
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/HealthSamurai/formbox-renderer"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "module": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/index.js",
18
+ "types": "./dist/index.d.ts"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "dependencies": {
25
+ "@lhncbc/ucum-lhc": "7.1.3",
26
+ "fhirpath": "^4.6.0",
27
+ "handlebars": "^4.7.9",
28
+ "mobx": "^6.15.0",
29
+ "mobx-react-lite": "^4.1.1",
30
+ "mobx-utils": "^6.1.1",
31
+ "react": "^19.2.3",
32
+ "react-dom": "^19.2.3",
33
+ "@formbox/renderer": "0.3.0",
34
+ "@formbox/strings": "0.3.0",
35
+ "@formbox/fhir": "0.3.0",
36
+ "@formbox/theme": "0.3.0"
37
+ },
38
+ "devDependencies": {
39
+ "@playwright/test": "^1.60.0",
40
+ "@types/react": "^19.2.8",
41
+ "@types/react-dom": "^19.2.3",
42
+ "htmx.org": "^2.0.10",
43
+ "typescript": "~5.9.3",
44
+ "vite": "^7.3.1",
45
+ "vite-plugin-dts": "^4.5.4",
46
+ "vitest": "^4.0.17"
47
+ },
48
+ "scripts": {
49
+ "build": "tsc -b ./tsconfig.lib.json && vite build",
50
+ "demo": "bun run ./demo/server.ts",
51
+ "dev": "bun run ./demo/server.ts",
52
+ "lint": "eslint .",
53
+ "test:e2e": "pnpm run build && playwright test e2e",
54
+ "typecheck": "tsc --noEmit -p tsconfig.lib.json",
55
+ "test": "vitest --run"
56
+ }
57
+ }