Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e6d0c98
feat: location components
mokhld Oct 21, 2025
28e8ddd
fix: update latitude and longitude regex patterns for improved valida…
mokhld Oct 22, 2025
bab339d
fix: refine latitude and longitude regex for better validation accuracy
mokhld Oct 22, 2025
55c438e
refactor: introduce LocationFieldBase to reduce code duplication in l…
mokhld Oct 23, 2025
e7a6177
fix: update regex patterns for Sonar
mokhld Oct 23, 2025
4160ca7
refactor: enhance location components by extending FormComponent and …
mokhld Oct 24, 2025
a725c74
refactor: consolidate location field logic into LocationFieldHelpers
mokhld Oct 24, 2025
50af26d
feat: add hint support to LocationFieldBase
mokhld Oct 24, 2025
4896edf
test: add comprehensive tests for location field components including…
mokhld Oct 27, 2025
c0235af
feat: add suffix and prefix support to LatLongField and update relate…
mokhld Oct 27, 2025
f6f092c
feat: updated formatting and tests
mokhld Oct 28, 2025
9ad5bf1
chore: update package-lock.json
mokhld Oct 28, 2025
184fb26
fix: add missing newline at end of HTML files for location field comp…
mokhld Oct 28, 2025
37680dd
feat: add support for SummaryWithConfirmationEmail in page controller…
mokhld Oct 28, 2025
25bdd22
chore: PR review refactors
mokhld Oct 28, 2025
2c62399
refactor: simplify OS grid reference validation regex
mokhld Oct 28, 2025
827a475
Add new location components to the unicorn form
davidjamesstone Oct 29, 2025
0f47ca0
refactor: PR comments
mokhld Oct 29, 2025
baece71
fix: update precision validation for latitude and longitude fields to…
mokhld Oct 29, 2025
afae6fc
style: adjust margin for location input items and add responsive beha…
mokhld Oct 30, 2025
81836ed
refactor: replace instructionText with options.instructionText and in…
mokhld Oct 30, 2025
68bcc49
Merge branch 'main' into feat/df-527-location
mokhld Oct 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 36 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"./components": "./.server/server/plugins/engine/components/index.js",
"./services/*": "./.server/server/plugins/engine/services/*",
"./engine/*": "./.server/server/plugins/engine/*",
"./helpers.js": "./.server/server/plugins/engine/components/helpers.js",
"./helpers.js": "./.server/server/plugins/engine/components/helpers/index.js",
"./schema.js": "./.server/server/schemas/index.js",
"./templates/*": "./.server/server/plugins/engine/views/*",
"./cache-service.js": "./.server/server/services/cacheService.js",
Expand Down Expand Up @@ -70,7 +70,7 @@
},
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@defra/forms-model": "^3.0.560",
"@defra/forms-model": "^3.0.569",
"@defra/hapi-tracing": "^1.26.0",
"@elastic/ecs-pino-format": "^1.5.0",
"@hapi/boom": "^10.0.1",
Expand Down
60 changes: 60 additions & 0 deletions src/client/stylesheets/_location-input.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@use "govuk-frontend" as *;

.app-location-input {
@include govuk-clearfix;
font-size: 0; // removes whitespace caused by inline-block
margin-bottom: govuk-spacing(6);

&:has(.govuk-input--error) {
border-left: $govuk-border-width-form-group-error solid $govuk-error-colour;
padding-left: govuk-spacing(3);
margin-top: 0;
}
}

.govuk-hint:has(+ .app-location-input .govuk-input--error) {
border-left: $govuk-border-width-form-group-error solid $govuk-error-colour;
padding-left: govuk-spacing(3);
margin-bottom: 0;
}

.govuk-fieldset:has(.app-location-input .govuk-input--error) {
.govuk-fieldset__legend {
border-left: $govuk-border-width-form-group-error solid $govuk-error-colour;
padding-left: govuk-spacing(3);
margin-bottom: 0;
}

.govuk-fieldset__legend + .govuk-hint {
margin-top: 0;
}
}

.app-location-input__item {
display: inline-block;
margin-right: govuk-spacing(4);
margin-bottom: govuk-spacing(4);

&:last-child {
margin-right: 0;
}

@include govuk-media-query($from: tablet) {
margin-bottom: 0;
}

.govuk-form-group {
margin-bottom: 0;
display: inline-block;
width: auto;
}

.govuk-label {
display: block;
}

.govuk-input {
margin-bottom: 0;
width: auto;
}
}
1 change: 1 addition & 0 deletions src/client/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@use "shared";
@use "code";
@use "tag-env";
@use "location-input";

// An example of some user-supplied styling
// Not great practice but it illustrates the point
Expand Down
1 change: 1 addition & 0 deletions src/client/stylesheets/shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@use "pkg:accessible-autocomplete";
@use "prose";
@use "summary-list";
@use "location-input";

// Use default GDS Transport font for autocomplete
.autocomplete__hint,
Expand Down
28 changes: 28 additions & 0 deletions src/server/forms/register-as-a-unicorn-breeder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,34 @@ pages:
next:
- path: '/how-many-members-of-staff-will-look-after-the-unicorns'
components:
- name: dfGYuk
options: {}
schema: {}
type: EastingNorthingField
title: Easting and northing
hint:
This is an Easting and Northing component
- name: seTThb
options: {}
schema: {}
type: LatLongField
title: Latitute and longitude
hint:
This is an Latitute and Longitude component
- name: bhjloS
options: {}
schema: {}
type: NationalGridFieldNumberField
title: National grid field number
hint:
This is an National Grid Field Number component
- name: dfQQws
options: {}
schema: {}
type: OsGridRefField
title: Ordnance survey grid reference
hint:
This is an Ordnance survey Grid Reference component
- name: bClCvo
options: {}
schema: {}
Expand Down
2 changes: 1 addition & 1 deletion src/server/plugins/engine/components/ComponentBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ComponentBase {
type: ComponentDef['type']
name: ComponentDef['name']
title: ComponentDef['title']
schema?: Extract<ComponentDef, { schema: object }>['schema']
schema?: Extract<ComponentDef, { schema?: object }>['schema']
options?: Extract<ComponentDef, { options: object }>['options']

isFormComponent = false
Expand Down
Loading
Loading