@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.
- package/dist/index.d.ts +720 -52
- package/dist/index.js +140 -59
- package/dist/templates/AnswerList.html.hbs +3 -0
- package/dist/templates/AnswerScaffold.html.hbs +3 -0
- package/dist/templates/Checkbox.html.hbs +3 -0
- package/dist/templates/CheckboxList.html.hbs +3 -0
- package/dist/templates/CustomOptionForm.html.hbs +3 -0
- package/dist/templates/DateInput.html.hbs +3 -0
- package/dist/templates/DateTimeInput.html.hbs +3 -0
- package/dist/templates/DisplayRenderer.html.hbs +3 -0
- package/dist/templates/Errors.html.hbs +3 -0
- package/dist/templates/FileInput.html.hbs +3 -0
- package/dist/templates/Flyover.html.hbs +3 -0
- package/dist/templates/Footer.html.hbs +3 -0
- package/dist/templates/Form.html.hbs +22 -4
- package/dist/templates/FormDescription.html.hbs +10 -0
- package/dist/templates/FormTitle.html.hbs +10 -0
- package/dist/templates/GroupList.html.hbs +3 -0
- package/dist/templates/GroupScaffold.html.hbs +3 -0
- package/dist/templates/Header.html.hbs +3 -0
- package/dist/templates/Help.html.hbs +3 -0
- package/dist/templates/InputGroup.html.hbs +3 -0
- package/dist/templates/Label.html.hbs +3 -0
- package/dist/templates/LabelContent.html.hbs +15 -0
- package/dist/templates/LanguageSelector.html.hbs +3 -0
- package/dist/templates/Legal.html.hbs +3 -0
- package/dist/templates/Link.html.hbs +3 -0
- package/dist/templates/Media.html.hbs +29 -0
- package/dist/templates/MultiSelectInput.html.hbs +3 -0
- package/dist/templates/NumberInput.html.hbs +3 -0
- package/dist/templates/OptionDisplay.html.hbs +3 -0
- package/dist/templates/OptionsLoading.html.hbs +3 -0
- package/dist/templates/Pagination.html.hbs +24 -0
- package/dist/templates/QuestionScaffold.html.hbs +3 -0
- package/dist/templates/RadioButton.html.hbs +3 -0
- package/dist/templates/RadioButtonList.html.hbs +3 -0
- package/dist/templates/SelectInput.html.hbs +3 -0
- package/dist/templates/ShortTextStyle.html.hbs +10 -0
- package/dist/templates/SignatureInput.html.hbs +3 -0
- package/dist/templates/SliderInput.html.hbs +3 -0
- package/dist/templates/SpinnerInput.html.hbs +3 -0
- package/dist/templates/Stack.html.hbs +3 -0
- package/dist/templates/SubmitButton.html.hbs +13 -0
- package/dist/templates/TabContainer.html.hbs +3 -0
- package/dist/templates/Table.html.hbs +3 -0
- package/dist/templates/TextArea.html.hbs +3 -0
- package/dist/templates/TextInput.html.hbs +3 -0
- package/dist/templates/TimeInput.html.hbs +3 -0
- package/package.json +10 -12
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{{!--
|
|
2
|
+
Template: Media
|
|
3
|
+
|
|
4
|
+
Purpose:
|
|
5
|
+
- Renders item or answer-option attachment media and fallback links.
|
|
6
|
+
|
|
7
|
+
Inputs:
|
|
8
|
+
- attachment: source attachment object.
|
|
9
|
+
- id: stable media id when available.
|
|
10
|
+
- label: accessible fallback label.
|
|
11
|
+
- source: resolved URL or data URL, if available.
|
|
12
|
+
- contentType: lower-cased attachment content type, if available.
|
|
13
|
+
- kind/isFallback/isImage/isAudio/isVideo/isLink: selected media rendering branch.
|
|
14
|
+
--}}
|
|
15
|
+
{{#if isFallback}}
|
|
16
|
+
<span>{{label}}</span>
|
|
17
|
+
{{/if}}
|
|
18
|
+
{{#if isImage}}
|
|
19
|
+
<img{{{attr "src" source}}}{{{attr "alt" label}}}>
|
|
20
|
+
{{/if}}
|
|
21
|
+
{{#if isAudio}}
|
|
22
|
+
<audio controls{{{attr "id" id}}}{{{attr "src" source}}}></audio>
|
|
23
|
+
{{/if}}
|
|
24
|
+
{{#if isVideo}}
|
|
25
|
+
<video controls{{{attr "id" id}}}{{{attr "src" source}}}></video>
|
|
26
|
+
{{/if}}
|
|
27
|
+
{{#if isLink}}
|
|
28
|
+
<a{{{attr "id" id}}}{{{attr "href" source}}} target="_blank" rel="noreferrer">{{label}}</a>
|
|
29
|
+
{{/if}}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{{!--
|
|
2
|
+
Template: Pagination
|
|
3
|
+
|
|
4
|
+
Purpose:
|
|
5
|
+
- Renders page navigation controls for paginated questionnaires.
|
|
6
|
+
|
|
7
|
+
Inputs:
|
|
8
|
+
- current/total: current page number and total page count.
|
|
9
|
+
- disabledPrev/disabledNext: whether each navigation action is unavailable.
|
|
10
|
+
- actionName: form action field name.
|
|
11
|
+
- previousAction/nextAction: submitted action values for page navigation.
|
|
12
|
+
- previousId/nextId: stable button ids.
|
|
13
|
+
- previousLabel/nextLabel: visible button labels.
|
|
14
|
+
- navigationLabel/currentLabel/previousTargetLabel/nextTargetLabel: accessible pagination labels.
|
|
15
|
+
--}}
|
|
16
|
+
<nav>
|
|
17
|
+
{{#unless disabledPrev}}
|
|
18
|
+
<button type="submit"{{{attr "id" previousId}}}{{{attr "name" actionName}}}{{{attr "value" previousAction}}}>{{previousLabel}}</button>
|
|
19
|
+
{{/unless}}
|
|
20
|
+
<span>{{current}} / {{total}}</span>
|
|
21
|
+
{{#unless disabledNext}}
|
|
22
|
+
<button type="submit"{{{attr "id" nextId}}}{{{attr "name" actionName}}}{{{attr "value" nextAction}}}>{{nextLabel}}</button>
|
|
23
|
+
{{/unless}}
|
|
24
|
+
</nav>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{{!--
|
|
2
|
+
Template: ShortTextStyle
|
|
3
|
+
|
|
4
|
+
Purpose:
|
|
5
|
+
- Renders responsive CSS that swaps long labels for short labels on narrow screens.
|
|
6
|
+
|
|
7
|
+
Inputs:
|
|
8
|
+
- no inputs.
|
|
9
|
+
--}}
|
|
10
|
+
<style>[data-fb-label-short]{display:none}@media (max-width:40rem){[data-fb-label-full]{display:none}[data-fb-label-short]{display:inline}}</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{{!--
|
|
2
|
+
Template: SubmitButton
|
|
3
|
+
|
|
4
|
+
Purpose:
|
|
5
|
+
- Renders the main form submit action.
|
|
6
|
+
|
|
7
|
+
Inputs:
|
|
8
|
+
- id: stable submit button id.
|
|
9
|
+
- actionName: form action field name.
|
|
10
|
+
- value: submitted action value.
|
|
11
|
+
- label: visible submit label.
|
|
12
|
+
--}}
|
|
13
|
+
<button type="submit"{{{attr "id" id}}}{{{attr "name" actionName}}}{{{attr "value" value}}}>{{label}}</button>
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{{!--
|
|
2
2
|
Template: Table
|
|
3
3
|
|
|
4
|
+
Purpose:
|
|
5
|
+
- Renders matrix-style controls from prepared columns, rows, and cells.
|
|
6
|
+
|
|
4
7
|
Inputs:
|
|
5
8
|
- hasRowHeader: true when rows need a header column.
|
|
6
9
|
- columns: column items with token, content, errors, width, widthStyle, and isLoading.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formbox/htmx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Server-rendered HTMX HTML renderer for Formbox FHIR Questionnaires",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -26,29 +26,27 @@
|
|
|
26
26
|
"fhirpath": "^4.6.0",
|
|
27
27
|
"handlebars": "^4.7.9",
|
|
28
28
|
"mobx": "^6.15.0",
|
|
29
|
-
"mobx-react-lite": "^4.1.1",
|
|
30
29
|
"mobx-utils": "^6.1.1",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"@formbox/
|
|
34
|
-
"@formbox/strings": "0.4.1"
|
|
35
|
-
"@formbox/theme": "0.4.1",
|
|
36
|
-
"@formbox/fhir": "0.4.1"
|
|
30
|
+
"preact": "^10.29.2",
|
|
31
|
+
"preact-render-to-string": "^6.7.0",
|
|
32
|
+
"@formbox/fhir": "0.4.1",
|
|
33
|
+
"@formbox/strings": "0.4.1"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|
|
39
36
|
"@playwright/test": "^1.60.0",
|
|
40
37
|
"@types/react": "^19.2.8",
|
|
41
|
-
"@types/react-dom": "^19.2.3",
|
|
42
38
|
"htmx.org": "^2.0.10",
|
|
43
39
|
"typescript": "~5.9.3",
|
|
44
40
|
"vite": "^7.3.1",
|
|
45
41
|
"vite-plugin-dts": "^4.5.4",
|
|
46
|
-
"vitest": "^4.0.17"
|
|
42
|
+
"vitest": "^4.0.17",
|
|
43
|
+
"@formbox/theme": "0.4.1",
|
|
44
|
+
"@formbox/renderer": "0.4.1"
|
|
47
45
|
},
|
|
48
46
|
"scripts": {
|
|
49
47
|
"build": "tsc -b ./tsconfig.lib.json && vite build",
|
|
50
|
-
"demo": "bun run ./demo/server.ts",
|
|
51
|
-
"dev": "bun run ./demo/server.ts",
|
|
48
|
+
"demo": "bun run build && bun ./demo/server.ts",
|
|
49
|
+
"dev": "bun run build && bun ./demo/server.ts",
|
|
52
50
|
"lint": "eslint .",
|
|
53
51
|
"test:e2e": "pnpm run build && playwright test e2e",
|
|
54
52
|
"typecheck": "tsc --noEmit -p tsconfig.lib.json",
|