Extract visibility and validation helpers in elements index
This commit is contained in:
@@ -3555,3 +3555,33 @@ Validation:
|
||||
Follow-ups:
|
||||
|
||||
- Continue Phase 2 with bounded renderer/module extractions from `components/elements/index.js` (one cohesive bundle per commit).
|
||||
|
||||
---
|
||||
|
||||
### CL-100: 22500 `components/elements/index.js` helper normalization (validation messages + visibility checks)
|
||||
|
||||
date: 2026-04-07
|
||||
author: Cline
|
||||
scope: `components/elements/index.js`
|
||||
type: change
|
||||
rationale: Apply the requested next bounded refactor slice by consolidating repeated validation message setup and parent-field visibility logic into shared local helpers.
|
||||
impact: No intended behavior change; EN/CY and accessibility behavior preserved while reducing repeated logic and future drift risk.
|
||||
status: completed
|
||||
|
||||
Summary:
|
||||
|
||||
- Added `getValidationMessages(t)` helper for repeated `required/emoji/postcode` message retrieval.
|
||||
- Added visibility helpers:
|
||||
- `hasParentFieldValue(...)`
|
||||
- `isVisibleByEquality(...)`
|
||||
- `isVisibleByInclusion(...)`
|
||||
- Replaced repeated inline visibility and validation-message setup across field wrappers with helper usage (Textfield, MultiLinefield, RichMultiLinefield, DateFieldPicker, YesNofield, Radiofield, NumericField, DecimalField).
|
||||
- Kept existing field render paths, conditions, and validation calls intact.
|
||||
|
||||
Validation:
|
||||
|
||||
- `npx eslint components/elements/index.js` -> pass
|
||||
|
||||
Follow-ups:
|
||||
|
||||
- Continue bounded no-behavior-change slices by removing dead locals/comments and extracting one additional low-risk field wrapper at a time.
|
||||
|
||||
Reference in New Issue
Block a user