Skip to content

Commit 12c81fa

Browse files
authored
Merge pull request #156 from formio/monorepo-sync/v4.0.2
release: @formio/bootstrap@4.0.2
2 parents f97b53d + 1c94b23 commit 12c81fa

106 files changed

Lines changed: 718 additions & 513 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ about: Create a report to help us improve
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
@@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser [e.g. chrome, safari]
29-
- Version [e.g. 22]
27+
28+
- OS: [e.g. iOS]
29+
- Browser [e.g. chrome, safari]
30+
- Version [e.g. 22]
3031

3132
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
33+
34+
- Device: [e.g. iPhone6]
35+
- OS: [e.g. iOS8.1]
36+
- Browser [e.g. stock browser, safari]
37+
- Version [e.g. 22]
3638

3739
**Additional context**
3840
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Suggest an idea for this project
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
98

109
**Is your feature request related to a problem? Please describe.**

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# @formio/bootstrap
22

3+
## 4.0.2
4+
5+
### Patch Changes
6+
7+
- 799bfe5: preserve apostrophes in html5 option values
8+
- c40ad3e: FIO-7954: refactored and fixed translations
9+
- 6063d69: Prevent announcing clickable input labels when in read-only mode
10+
11+
## 4.0.2-api99.0
12+
13+
### Patch Changes
14+
15+
- 799bfe5: preserve apostrophes in html5 option values
16+
- c40ad3e: FIO-7954: refactored and fixed translations
17+
- 6063d69: Prevent announcing clickable input labels when in read-only mode
18+
319
## 4.0.1
420

521
### Patch Changes

CLAUDE.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# @formio/bootstrap
2+
3+
## Identity
4+
5+
- **Path:** `packages/bootstrap`. **Published as:** `@formio/bootstrap` on npm (MIT).
6+
- **OSS sync:** YES — `ossRepo: github.com/formio/bootstrap`, `srcPath: "."`. Everything in `src/` ships publicly on release.
7+
- **Module system:** TypeScript, dual CJS + ESM build (`tsconfig.cjs.json` / `tsconfig.mjs.json`), UMD bundles in `dist/`. **Lint:** TSLint (deprecated), not ESLint.
8+
- **Era:** mature, near-static template pack. `.ts` files are thin barrels; the substance is ~220 precompiled `.ejs` markup files.
9+
- **Purpose:** the **template pack** (markup only) that `@formio/js` uses to render forms under Bootstrap 3 / 4 / 5. It supplies HTML; the renderer owns all behavior.
10+
11+
## Floor — immutable musts
12+
13+
- **A `.ejs` change is almost never done in one tree.** `src/templates/{bootstrap3,bootstrap4,bootstrap5}/` are three hand-maintained copies. Mirror the edit across all three — swapping `sr-only` (BS3/BS4) ↔ `visually-hidden` (BS5), and noting BS3 lacks some anchors and is partially frozen. See [`bootstrap/subframework-parity-01`](../../docs/gotchas/bootstrap.md#subframework-parity-01--bootstrap345-are-three-hand-maintained-copies-the-intra-package-axis).
14+
- **Don't delete a hidden announcement span or rename a `ref="..."`.** The renderer writes screen-reader announcements into those spans by `ref` name, with optional chaining — so a deletion or rename silently no-ops. The `ref`-name contract itself is seam invariant 1 ([template-markup-contract](../../docs/cross-cutting/template-markup-contract.md)); the bootstrap anchors are [`bootstrap/announce-anchors-01`](../../docs/gotchas/bootstrap.md#announce-anchors-01--the-hidden-announcement-spans-are-renderer-driven-dont-delete-or-rename-them) (marker `G-BS01`).
15+
- **Use lodash-template delimiters, never stock EJS.** `{{ }}` interpolate, `{% %}` evaluate, `{{{ }}}` raw HTML, context var `ctx`. `<% %>` produces literal text. See [`bootstrap/ejs-precompile-delimiters-01`](../../docs/gotchas/bootstrap.md#ejs-precompile-delimiters-01--templates-use-lodash-template-delimiters-not-stock-ejs).
16+
- **A new template is invisible until imported in `templates/<fw>/index.ts`** — registration is by explicit import, not filesystem scan. And the renderer may look it up by a string-constructed name (e.g. `wizardHeader<Setting>`). See [`bootstrap/template-name-and-registration-01`](../../docs/gotchas/bootstrap.md#template-name-and-registration-01--the-directory-name-is-the-renderers-lookup-key-and-the-barrel-must-import-it).
17+
- **No secrets / internal-only / license-gated markup in `src/`** — it ships publicly. `GOTCHA(G-NNN)` markers in templates stay numeric (no topic phrases); in `.ejs` use `{% /* GOTCHA(G-NNN) */ %}`.
18+
19+
## Ceiling — emerging patterns
20+
21+
- **Pattern: a component is a directory of `form.ejs` (+ optional `html.ejs`) plus a 3-line `index.ts` barrel that default-exports `{ form, html }`. Example:** [`src/templates/bootstrap5/input/index.ts`](./src/templates/bootstrap5/input/index.ts).
22+
- **Pattern: a screen-reader announcement anchor is a hidden span with a `ref` + `aria-live`, written into by the renderer. Example:** [`src/templates/bootstrap5/input/form.ejs:68`](./src/templates/bootstrap5/input/form.ejs) (`ref="announceMessage"`, carries marker `G-BS01`).
23+
24+
## Blast radius
25+
26+
**5 dependents, tier: medium** (headline consumer `@formio/js`, which also deep-imports `@formio/bootstrap/components`). See [`/docs/dependencies/bootstrap.md`](../../docs/dependencies/bootstrap.md).
27+
28+
## Test & build
29+
30+
```sh
31+
pnpm -F @formio/bootstrap build # rm -rf lib; tsc cjs+mjs; gulp templates (precompile .ejs); webpack; libpackage.js
32+
pnpm -F @formio/bootstrap lint # tslint -p .
33+
pnpm -F @formio/bootstrap check-types # tsc --noEmit
34+
```
35+
36+
**There is no test suite here**`src/test.spec.ts` is a placeholder and there is no `test` script. "Green" locally = `build` + `lint` + `check-types`. Behavioral verification of a markup change happens **downstream in `@formio/js`** (renderer integration tests):
37+
38+
```sh
39+
pnpm -F @formio/js test # exercises this package's markup
40+
```
41+
42+
See [`bootstrap/no-test-suite-01`](../../docs/gotchas/bootstrap.md#no-test-suite-01--there-is-no-test-suite-verify-in-formiojs).
43+
44+
## Hot paths & gotchas
45+
46+
See [`/docs/gotchas/bootstrap.md`](../../docs/gotchas/bootstrap.md). Entries: `bootstrap/subframework-parity-01`, `bootstrap/announce-anchors-01` (G-BS01), `bootstrap/template-name-and-registration-01`, `bootstrap/wizard-header-variants-01` (G-BS02), `bootstrap/ejs-precompile-delimiters-01`, `bootstrap/no-test-suite-01`.
47+
48+
## Cross-cutting triggers
49+
50+
- **Editing any `*.ejs` (markup, `ref` names, element ids, `aria-*` wiring, shared id formats like the fieldset legend `l-<id>-legend`)** → read [`/docs/cross-cutting/template-markup-contract.md`](../../docs/cross-cutting/template-markup-contract.md) first. The same markup is reimplemented in `@formio/uswds` and `@formio/standard-template`, and read back by `@formio/js`; a one-sided change is a silent a11y/behavior regression (FIO-11126, FIO-10942).
51+
- **Editing a `wizardHeader*` / `wizardNav` template** → check what `wizard/form.ejs` already renders around it before adding a landmark, `id`, or progressbar. See [`bootstrap/wizard-header-variants-01`](../../docs/gotchas/bootstrap.md#wizard-header-variants-01--header-plus-nav-both-render-duplicate-landmarks-are-the-recurring-bug) (FIO-11049, FIO-11511).
52+
- **Adding/renaming an `exports` sub-path (`./components`, `./bootstrap5`, …)**`@formio/js` deep-imports `@formio/bootstrap/components`; a rename breaks it at import resolution. See [dependencies](../../docs/dependencies/bootstrap.md#deep-coupling-inventory).
53+
- **Any publishable change** → add a changeset (`@formio/bootstrap`, plus any sibling template pack you also touched — one entry per published package). **`major` bump** → coordinate the OSS release.
54+
55+
## References
56+
57+
- Repo-wide: [`/CLAUDE.md`](../../CLAUDE.md), [`/STANDARDS.md`](../../STANDARDS.md)
58+
- Architecture: [`/docs/architecture/bootstrap.md`](../../docs/architecture/bootstrap.md)
59+
- Dependencies: [`/docs/dependencies/bootstrap.md`](../../docs/dependencies/bootstrap.md)
60+
- Gotchas: [`/docs/gotchas/bootstrap.md`](../../docs/gotchas/bootstrap.md)
61+
- Seam: [`/docs/cross-cutting/template-markup-contract.md`](../../docs/cross-cutting/template-markup-contract.md)
62+
- Downstream consumer: [`packages/formio.js/CLAUDE.md`](../formio.js/CLAUDE.md)

Readme.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Form.io Bootstrap Templates
2+
23
This repository will change the rendering of forms in formio.js so that it uses html and classes compatible with [Bootstrap 3](https://getbootstrap.com/docs/3.4/), [Bootstrap 4](https://getbootstrap.com/docs/4.6/getting-started/introduction/), and [Bootstrap 5](https://getbootstrap.com/docs/5.3/getting-started/introduction/) frameworks.
34

4-
Official Documentation
5-
--------------------------
5+
## Official Documentation
6+
67
For the latest documentation, release information, and guides, always refer to the official Form.io Help Documentation available here:
78

89
**[https://help.form.io](https://help.form.io/dev/css-frameworks)**
@@ -14,6 +15,7 @@ import bootstrap3 from '@formio/bootstrap/bootstrap3';
1415
import { Formio } from 'formiojs';
1516
Formio.use(bootstrap3);
1617
```
18+
1719
### Using Bootstrap 4
1820

1921
```javascript
@@ -32,10 +34,10 @@ Formio.use(bootstrap5);
3234

3335
## Script
3436

35-
3637
```javascript
37-
Formio.Templates.framework = "bootstrap3"
38+
Formio.Templates.framework = 'bootstrap3';
3839
```
40+
3941
If icon is not show
4042

4143
```javascript

libpackage.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
const fs = require('fs');
22
const path = require('path');
3-
fs.writeFileSync(path.join(__dirname, 'lib', 'cjs', 'package.json'), `{
3+
fs.writeFileSync(
4+
path.join(__dirname, 'lib', 'cjs', 'package.json'),
5+
`{
46
"type": "commonjs"
5-
}`);
6-
fs.writeFileSync(path.join(__dirname, 'lib', 'mjs', 'package.json'), `{
7+
}`,
8+
);
9+
fs.writeFileSync(
10+
path.join(__dirname, 'lib', 'mjs', 'package.json'),
11+
`{
712
"type": "module"
8-
}`);
13+
}`,
14+
);

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@formio/bootstrap",
3-
"version": "4.0.1",
3+
"version": "4.0.2",
44
"description": "Bootstrap templates for Form.io forms",
55
"main": "lib/cjs/bootstrap5.js",
66
"module": "lib/mjs/bootstrap5.js",
@@ -42,7 +42,9 @@
4242
"scripts": {
4343
"watch": "tsc -w",
4444
"build": "rm -rf ./lib && tsc --project tsconfig.cjs.json && tsc --project tsconfig.mjs.json && gulp templates && webpack && node ./libpackage.js",
45-
"lint": "tslint -p ."
45+
"lint": "tslint -p .",
46+
"check-types": "tsc --noEmit",
47+
"lint:fix": "tslint -p . --fix"
4648
},
4749
"pre-commit": [
4850
"lint",

src/bootstrap3.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import bootstrap3 from './templates/bootstrap3';
2+
import translations from './translations';
3+
24
export default {
35
framework: 'bootstrap3',
46
templates: {
5-
bootstrap3
7+
bootstrap3,
68
},
9+
translations
710
};

src/bootstrap4.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import bootstrap4 from './templates/bootstrap4';
2+
import translations from './translations';
3+
24
export default {
35
framework: 'bootstrap4',
46
templates: {
5-
bootstrap4
7+
bootstrap4,
68
},
7-
};
9+
translations
10+
};

src/bootstrap5.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import bootstrap5 from './templates/bootstrap5';
2+
import translations from './translations';
3+
24
export default {
35
framework: 'bootstrap5',
46
templates: {
5-
bootstrap5
7+
bootstrap5,
68
},
7-
};
9+
translations
10+
};

0 commit comments

Comments
 (0)