hof 22.1.1 → 22.2.0-time-mixin-beta

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 (30) hide show
  1. package/.nyc_output/34671fe1-441d-41ed-b012-ece4e3964dbb.json +1 -0
  2. package/.nyc_output/processinfo/34671fe1-441d-41ed-b012-ece4e3964dbb.json +1 -0
  3. package/.nyc_output/processinfo/index.json +1 -0
  4. package/components/index.js +1 -0
  5. package/components/time/fields.js +12 -0
  6. package/components/time/index.js +168 -0
  7. package/components/time/templates/time.html +20 -0
  8. package/controller/controller.js +5 -0
  9. package/controller/validation/validators.js +13 -0
  10. package/frontend/govuk-template/govuk_template_generated.html +102 -0
  11. package/frontend/template-mixins/mixins/template-mixins.js +45 -1
  12. package/frontend/template-mixins/partials/forms/input-text-time.html +37 -0
  13. package/frontend/themes/gov-uk/styles/_time-input.scss +5 -0
  14. package/frontend/themes/gov-uk/styles/govuk.scss +1 -0
  15. package/frontend/toolkit/assets/javascript/form-focus.js +4 -0
  16. package/package.json +1 -1
  17. package/sandbox/.env +3 -0
  18. package/sandbox/apps/sandbox/fields.js +9 -0
  19. package/sandbox/apps/sandbox/index.js +4 -0
  20. package/sandbox/apps/sandbox/sections/summary-data-sections.js +7 -0
  21. package/sandbox/apps/sandbox/translations/en/default.json +249 -0
  22. package/sandbox/apps/sandbox/translations/src/en/fields.json +4 -0
  23. package/sandbox/apps/sandbox/translations/src/en/pages.json +3 -0
  24. package/sandbox/apps/sandbox/translations/src/en/validation.json +3 -0
  25. package/sandbox/public/css/app.css +9558 -0
  26. package/sandbox/public/images/icons/icon-caret-left.png +0 -0
  27. package/sandbox/public/images/icons/icon-complete.png +0 -0
  28. package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
  29. package/sandbox/public/js/bundle.js +47607 -0
  30. package/utilities/autofill/inputs.js +6 -1
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":21200,"argv":["/Users/user/.nvm/versions/node/v20.17.0/bin/node","/Users/user/Documents/HO/HOF/hof/node_modules/.bin/_mocha","test/**/*.spec.js","sandbox/test/**/*.spec.js"],"execArgv":[],"cwd":"/Users/user/Documents/HO/HOF/hof","time":1738933012389,"ppid":21195,"coverageFilename":"/Users/user/Documents/HO/HOF/hof/.nyc_output/34671fe1-441d-41ed-b012-ece4e3964dbb.json","externalId":"","uuid":"34671fe1-441d-41ed-b012-ece4e3964dbb","files":["/Users/user/Documents/HO/HOF/hof/model/index.js","/Users/user/Documents/HO/HOF/hof/model/apis/axios-settings.js","/Users/user/Documents/HO/HOF/hof/components/index.js","/Users/user/Documents/HO/HOF/hof/components/address-lookup/index.js","/Users/user/Documents/HO/HOF/hof/components/address-lookup/default-model.js","/Users/user/Documents/HO/HOF/hof/components/address-lookup/defaults.js","/Users/user/Documents/HO/HOF/hof/components/clear-session/index.js","/Users/user/Documents/HO/HOF/hof/components/combine-and-loop-fields/index.js","/Users/user/Documents/HO/HOF/hof/components/date/index.js","/Users/user/Documents/HO/HOF/hof/components/date/fields.js","/Users/user/Documents/HO/HOF/hof/components/time/index.js","/Users/user/Documents/HO/HOF/hof/components/time/fields.js","/Users/user/Documents/HO/HOF/hof/components/emailer/index.js","/Users/user/Documents/HO/HOF/hof/components/emailer/email-service.js","/Users/user/Documents/HO/HOF/hof/components/emailer/emailer.js","/Users/user/Documents/HO/HOF/hof/components/emailer/transports/index.js","/Users/user/Documents/HO/HOF/hof/components/emailer/transports/smtp.js","/Users/user/Documents/HO/HOF/hof/components/emailer/transports/ses.js","/Users/user/Documents/HO/HOF/hof/components/emailer/transports/stub.js","/Users/user/Documents/HO/HOF/hof/components/emailer/transports/debug.js","/Users/user/Documents/HO/HOF/hof/components/homeoffice-countries/index.js","/Users/user/Documents/HO/HOF/hof/config/component-defaults.js","/Users/user/Documents/HO/HOF/hof/components/notify/index.js","/Users/user/Documents/HO/HOF/hof/components/notify/notify.js","/Users/user/Documents/HO/HOF/hof/components/summary/index.js","/Users/user/Documents/HO/HOF/hof/config/rate-limits.js","/Users/user/Documents/HO/HOF/hof/middleware/rate-limiter.js","/Users/user/Documents/HO/HOF/hof/config/hof-defaults.js","/Users/user/Documents/HO/HOF/hof/components/session-timeout-warning/index.js","/Users/user/Documents/HO/HOF/hof/lib/logger.js","/Users/user/Documents/HO/HOF/hof/controller/base-controller.js","/Users/user/Documents/HO/HOF/hof/controller/formatting/index.js","/Users/user/Documents/HO/HOF/hof/controller/validation/index.js","/Users/user/Documents/HO/HOF/hof/controller/validation/validators.js","/Users/user/Documents/HO/HOF/hof/controller/validation/email.js","/Users/user/Documents/HO/HOF/hof/controller/validation-error.js","/Users/user/Documents/HO/HOF/hof/utilities/index.js","/Users/user/Documents/HO/HOF/hof/utilities/autofill/index.js","/Users/user/Documents/HO/HOF/hof/utilities/autofill/inputs.js","/Users/user/Documents/HO/HOF/hof/utilities/test-data/index.js","/Users/user/Documents/HO/HOF/hof/utilities/countries.js","/Users/user/Documents/HO/HOF/hof/utilities/helpers/index.js","/Users/user/Documents/HO/HOF/hof/utilities/reqres/index.js","/Users/user/Documents/HO/HOF/hof/config/sanitisation-rules.js","/Users/user/Documents/HO/HOF/hof/controller/formatting/formatters.js","/Users/user/Documents/HO/HOF/hof/controller/index.js","/Users/user/Documents/HO/HOF/hof/controller/behaviour-session.js","/Users/user/Documents/HO/HOF/hof/controller/behaviour-hooks.js","/Users/user/Documents/HO/HOF/hof/controller/controller.js","/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/behaviours/country-select.js","/Users/user/Documents/HO/HOF/hof/frontend/template-mixins/mixins/index.js","/Users/user/Documents/HO/HOF/hof/frontend/template-mixins/mixins/template-mixins.js","/Users/user/Documents/HO/HOF/hof/frontend/template-mixins/mixins/render.js","/Users/user/Documents/HO/HOF/hof/frontend/template-mixins/mixins/helpers.js","/Users/user/Documents/HO/HOF/hof/index.js","/Users/user/Documents/HO/HOF/hof/frontend/index.js","/Users/user/Documents/HO/HOF/hof/frontend/govuk-template/index.js","/Users/user/Documents/HO/HOF/hof/frontend/govuk-template/build/index.js","/Users/user/Documents/HO/HOF/hof/frontend/govuk-template/build/config.js","/Users/user/Documents/HO/HOF/hof/frontend/template-partials/index.js","/Users/user/Documents/HO/HOF/hof/frontend/template-partials/translations/index.js","/Users/user/Documents/HO/HOF/hof/frontend/themes/index.js","/Users/user/Documents/HO/HOF/hof/frontend/themes/gov-uk/index.js","/Users/user/Documents/HO/HOF/hof/frontend/toolkit/index.js","/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/helpers.js","/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/form-focus.js","/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/progressive-reveal.js","/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/validation.js","/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/character-count.js","/Users/user/Documents/HO/HOF/hof/middleware/index.js","/Users/user/Documents/HO/HOF/hof/middleware/cookies.js","/Users/user/Documents/HO/HOF/hof/middleware/errors.js","/Users/user/Documents/HO/HOF/hof/middleware/not-found.js","/Users/user/Documents/HO/HOF/hof/middleware/deep-translate.js","/Users/user/Documents/HO/HOF/hof/lib/markdown.js","/Users/user/Documents/HO/HOF/hof/lib/router.js","/Users/user/Documents/HO/HOF/hof/wizard/index.js","/Users/user/Documents/HO/HOF/hof/wizard/behaviours/index.js","/Users/user/Documents/HO/HOF/hof/wizard/behaviours/complete.js","/Users/user/Documents/HO/HOF/hof/wizard/util/constants.js","/Users/user/Documents/HO/HOF/hof/lib/helpers.js","/Users/user/Documents/HO/HOF/hof/lib/health.js","/Users/user/Documents/HO/HOF/hof/lib/serve-static.js","/Users/user/Documents/HO/HOF/hof/lib/ga-tag.js","/Users/user/Documents/HO/HOF/hof/lib/deindex.js","/Users/user/Documents/HO/HOF/hof/lib/sessions.js","/Users/user/Documents/HO/HOF/hof/lib/settings.js","/Users/user/Documents/HO/HOF/hof/build/index.js","/Users/user/Documents/HO/HOF/hof/config/builder-defaults.js","/Users/user/Documents/HO/HOF/hof/transpiler/index.js","/Users/user/Documents/HO/HOF/hof/transpiler/lib/compile.js","/Users/user/Documents/HO/HOF/hof/transpiler/lib/build.js","/Users/user/Documents/HO/HOF/hof/transpiler/lib/expand-dirs.js","/Users/user/Documents/HO/HOF/hof/transpiler/lib/aggregate.js","/Users/user/Documents/HO/HOF/hof/transpiler/lib/write-files.js","/Users/user/Documents/HO/HOF/hof/model/apis/index.js","/Users/user/Documents/HO/HOF/hof/model/apis/html-to-pdf-converter.js","/Users/user/Documents/HO/HOF/hof/wizard/model.js","/Users/user/Documents/HO/HOF/hof/wizard/middleware/back-links.js","/Users/user/Documents/HO/HOF/hof/wizard/util/helpers.js","/Users/user/Documents/HO/HOF/hof/wizard/middleware/check-complete.js","/Users/user/Documents/HO/HOF/hof/wizard/middleware/check-progress.js","/Users/user/Documents/HO/HOF/hof/wizard/middleware/check-session.js","/Users/user/Documents/HO/HOF/hof/wizard/middleware/csrf.js","/Users/user/Documents/HO/HOF/hof/sandbox/test/_unit/example_app/sections/summary-data-sections.spec.js","/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/sections/summary-data-sections.js","/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/lib/staticAppealStages.js","/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/fields.js","/Users/user/Documents/HO/HOF/hof/sandbox/test/helpers/utilities.js","/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/behaviours/international-number.js","/Users/user/Documents/HO/HOF/hof/lib/encryption.js","/Users/user/Documents/HO/HOF/hof/wizard/middleware/session.js","/Users/user/Documents/HO/HOF/hof/wizard/middleware/session-model.js"]}
@@ -0,0 +1 @@
1
+ {"processes":{"34671fe1-441d-41ed-b012-ece4e3964dbb":{"parent":null,"children":[]}},"files":{"/Users/user/Documents/HO/HOF/hof/model/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/model/apis/axios-settings.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/address-lookup/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/address-lookup/default-model.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/address-lookup/defaults.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/clear-session/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/combine-and-loop-fields/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/date/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/date/fields.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/time/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/time/fields.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/emailer/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/emailer/email-service.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/emailer/emailer.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/emailer/transports/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/emailer/transports/smtp.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/emailer/transports/ses.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/emailer/transports/stub.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/emailer/transports/debug.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/homeoffice-countries/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/config/component-defaults.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/notify/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/notify/notify.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/summary/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/config/rate-limits.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/middleware/rate-limiter.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/config/hof-defaults.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/components/session-timeout-warning/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/logger.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/base-controller.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/formatting/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/validation/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/validation/validators.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/validation/email.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/validation-error.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/utilities/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/utilities/autofill/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/utilities/autofill/inputs.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/utilities/test-data/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/utilities/countries.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/utilities/helpers/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/utilities/reqres/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/config/sanitisation-rules.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/formatting/formatters.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/behaviour-session.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/behaviour-hooks.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/controller/controller.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/behaviours/country-select.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/template-mixins/mixins/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/template-mixins/mixins/template-mixins.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/template-mixins/mixins/render.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/template-mixins/mixins/helpers.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/govuk-template/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/govuk-template/build/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/govuk-template/build/config.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/template-partials/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/template-partials/translations/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/themes/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/themes/gov-uk/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/toolkit/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/helpers.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/form-focus.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/progressive-reveal.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/validation.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/frontend/toolkit/assets/javascript/character-count.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/middleware/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/middleware/cookies.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/middleware/errors.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/middleware/not-found.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/middleware/deep-translate.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/markdown.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/router.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/behaviours/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/behaviours/complete.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/util/constants.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/helpers.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/health.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/serve-static.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/ga-tag.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/deindex.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/sessions.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/settings.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/build/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/config/builder-defaults.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/transpiler/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/transpiler/lib/compile.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/transpiler/lib/build.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/transpiler/lib/expand-dirs.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/transpiler/lib/aggregate.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/transpiler/lib/write-files.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/model/apis/index.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/model/apis/html-to-pdf-converter.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/model.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/middleware/back-links.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/util/helpers.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/middleware/check-complete.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/middleware/check-progress.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/middleware/check-session.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/middleware/csrf.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/sandbox/test/_unit/example_app/sections/summary-data-sections.spec.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/sections/summary-data-sections.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/lib/staticAppealStages.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/fields.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/sandbox/test/helpers/utilities.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/sandbox/apps/sandbox/behaviours/international-number.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/lib/encryption.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/middleware/session.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"],"/Users/user/Documents/HO/HOF/hof/wizard/middleware/session-model.js":["34671fe1-441d-41ed-b012-ece4e3964dbb"]},"externalIds":{}}
@@ -5,6 +5,7 @@ module.exports = {
5
5
  clearSession: require('./clear-session'),
6
6
  combineAndLoopFields: require('./combine-and-loop-fields'),
7
7
  date: require('./date'),
8
+ time: require('./time'),
8
9
  emailer: require('./emailer'),
9
10
  homeOfficeCountries: require('./homeoffice-countries'),
10
11
  notify: require('./notify'),
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ module.exports = key => ({
4
+ [`${key}-hour`]: {
5
+ label: 'Hour',
6
+ autocomplete: 'time-hour'
7
+ },
8
+ [`${key}-minute`]: {
9
+ label: 'Minute',
10
+ autocomplete: 'time-minute'
11
+ }
12
+ });
@@ -0,0 +1,168 @@
1
+ 'use strict';
2
+
3
+ const _ = require('lodash');
4
+ const path = require('path');
5
+ const getFields = require('./fields');
6
+
7
+ const TEMPLATE = path.resolve(__dirname, './templates/time.html');
8
+
9
+ // utility function taking the req.body, fields and key,
10
+ // returns a map of values in the format:
11
+ // {
12
+ // hour: '12',
13
+ // minute: '01',
14
+ // }
15
+
16
+ const getParts = (body, fields, key) =>
17
+ _.mapKeys(_.pick(body, Object.keys(fields)), (value, fieldKey) =>
18
+ fieldKey.replace(`${key}-`, '')
19
+ );
20
+
21
+ // accepts a time value in the format kk-mm and fields config,
22
+ // returns a map of key: value pairs for the intermedate fields
23
+ const getPartsFromTime = (time, fields) =>
24
+ time.split(':')
25
+ .slice()
26
+ .reduce((obj, value, index) => Object.assign({}, obj, {
27
+ [fields[index]]: value
28
+ }), {});
29
+
30
+ // preprend '0' if number is only a single digit
31
+ const pad = num => num !== '' && num.length < 2 ? `0${num}` : num;
32
+
33
+ const conditionalTranslate = (key, translate) => {
34
+ let result = translate(key);
35
+ if (result === key) {
36
+ result = null;
37
+ }
38
+ return result;
39
+ };
40
+
41
+ const getLegendClassName = field => field && field.legend && field.legend.className || '';
42
+ const getIsPageHeading = field => field && field.isPageHeading || '';
43
+
44
+ module.exports = (key, opts) => {
45
+ if (!key) {
46
+ throw new Error('Key must be passed to time component');
47
+ }
48
+ const options = opts || {};
49
+ const template = options.template ?
50
+ path.resolve(__dirname, options.template) :
51
+ TEMPLATE;
52
+ const fields = getFields(key);
53
+
54
+ options.validate = _.uniq(options.validate ? ['time'].concat(options.validate) : ['time']);
55
+
56
+ let hourOptional = !!options.hourOptional;
57
+ const minuteOptional = !!options.minuteOptional;
58
+
59
+ if (minuteOptional) {
60
+ hourOptional = true;
61
+ }
62
+
63
+ // take the 2 time parts, padding or defaulting
64
+ // if applicable, then create a time value in the
65
+ // format kk:mm. Save to req.body for processing
66
+ const preProcess = (req, res, next) => {
67
+ const parts = getParts(req.body, fields, key);
68
+ if (_.some(parts, part => part !== '')) {
69
+ if (hourOptional && parts.hour === '') {
70
+ parts.hour = '01';
71
+ } else {
72
+ parts.hour = pad(parts.hour);
73
+ }
74
+ if (minuteOptional && parts.minute === '') {
75
+ parts.minute = '00';
76
+ } else {
77
+ parts.minute = pad(parts.minute);
78
+ }
79
+ req.body[key] = `${parts.hour}:${parts.minute}`;
80
+ }
81
+ next();
82
+ };
83
+
84
+ const postProcess = (req, res, next) => {
85
+ const value = req.form.values[key];
86
+ if (value) {
87
+ req.form.values[key] = req.body[key];
88
+ }
89
+ next();
90
+ };
91
+ // if time field is included in errorValues, extend
92
+ // errorValues with the individual components
93
+ const preGetErrors = (req, res, next) => {
94
+ const errorValues = req.sessionModel.get('errorValues');
95
+ if (errorValues && errorValues[key]) {
96
+ req.sessionModel.set('errorValues',
97
+ Object.assign({}, errorValues, getPartsFromTime(errorValues[key], Object.keys(fields)))
98
+ );
99
+ }
100
+ next();
101
+ };
102
+
103
+ // if time field has any validation error, also add errors
104
+ // for the two child components. null type as we don't want to show
105
+ // duplicate messages
106
+ const postGetErrors = (req, res, next) => {
107
+ const errors = req.sessionModel.get('errors');
108
+ if (errors && errors[key]) {
109
+ Object.assign(req.form.errors, Object.keys(fields).reduce((obj, field) =>
110
+ Object.assign({}, obj, { [field]: { type: null } })
111
+ , {}));
112
+ }
113
+ next();
114
+ };
115
+
116
+ // if time value is set, split its parts and assign to req.form.values.
117
+ // This is extended with errorValues if they are present
118
+ const postGetValues = (req, res, next) => {
119
+ const time = req.form.values[key];
120
+ if (time) {
121
+ Object.assign(
122
+ req.form.values,
123
+ getPartsFromTime(time, Object.keys(fields)),
124
+ req.sessionModel.get('errorValues') || {}
125
+ );
126
+ }
127
+ next();
128
+ };
129
+
130
+ // render the template to a string, assign the html output
131
+ // to the time field in res.locals.fields
132
+ const preRender = (req, res, next) => {
133
+ Object.assign(req.form.options.fields, _.mapValues(fields, (v, k) => {
134
+ const rawKey = k.replace(`${key}-`, '');
135
+ const labelKey = `fields.${key}.parts.${rawKey}`;
136
+ const label = req.translate(labelKey);
137
+ return Object.assign({}, v, {
138
+ label: label === labelKey ? v.label : label
139
+ });
140
+ }));
141
+ const legend = conditionalTranslate(`fields.${key}.legend`, req.translate);
142
+ const hint = conditionalTranslate(`fields.${key}.hint`, req.translate);
143
+ const legendClassName = getLegendClassName(options);
144
+ const isPageHeading = getIsPageHeading(options);
145
+ const error = req.form.errors && req.form.errors[key];
146
+ res.render(template, { key, legend, legendClassName, isPageHeading, hint, error }, (err, html) => {
147
+ if (err) {
148
+ next(err);
149
+ } else {
150
+ const field = res.locals.fields.find(f => f.key === key);
151
+ Object.assign(field, { html });
152
+ next();
153
+ }
154
+ });
155
+ };
156
+
157
+ // return config extended with hooks
158
+ return Object.assign({}, options, {
159
+ hooks: {
160
+ 'pre-process': preProcess,
161
+ 'post-process': postProcess,
162
+ 'pre-getErrors': preGetErrors,
163
+ 'post-getErrors': postGetErrors,
164
+ 'post-getValues': postGetValues,
165
+ 'pre-render': preRender
166
+ }
167
+ });
168
+ };
@@ -0,0 +1,20 @@
1
+ <div class="govuk-form-group {{#error}}govuk-form-group--error{{/error}}">
2
+ <fieldset id="{{key}}-group" class="govuk-fieldset{{#className}} {{className}}{{/className}}" role="group">
3
+ <legend class="govuk-fieldset__legend {{#isPageHeading}}govuk-fieldset__legend--l{{/isPageHeading}}{{#legendClassName}} {{legendClassName}}{{/legendClassName}}">
4
+ {{#isPageHeading}}<h1 class="govuk-fieldset__heading">{{/isPageHeading}}
5
+ {{legend}}
6
+ {{#isPageHeading}}</h1>{{/isPageHeading}}
7
+ </legend>
8
+ {{#hint}}
9
+ <span id="{{key}}-hint" class="govuk-hint">{{hint}}</span>
10
+ {{/hint}}
11
+ {{#error}}
12
+ <p id="{{key}}-error" class="govuk-error-message">
13
+ <span class="govuk-visually-hidden">Error:</span> {{error.message}}
14
+ </p>
15
+ {{/error}}
16
+ <div>
17
+ {{#input-time}}{{key}}{{/input-time}}
18
+ </div>
19
+ </fieldset>
20
+ </div>
@@ -192,6 +192,11 @@ module.exports = class Controller extends BaseController {
192
192
  }
193
193
  // eslint-disable-next-line brace-style
194
194
  }
195
+ // get first field for time input control
196
+ else if (field && field.mixin === 'input-time') {
197
+ req.form.errors[key].errorLinkId = key + '-hour';
198
+ // eslint-disable-next-line brace-style
199
+ }
195
200
  // get first field for date input control
196
201
  else if (field && field.mixin === 'input-date') {
197
202
  req.form.errors[key].errorLinkId = key + '-day';
@@ -9,6 +9,7 @@ const emailValidator = require('./email');
9
9
  // validator methods should return false (or falsy value) for *invalid* input
10
10
  // and true (or truthy value) for *valid* input.
11
11
  const dateFormat = 'YYYY-MM-DD';
12
+ const timeFormat = 'kk:mm';
12
13
  let Validators;
13
14
 
14
15
  module.exports = Validators = {
@@ -128,6 +129,18 @@ module.exports = Validators = {
128
129
  return Validators.regex(value, /^\d{2}$/) && parseInt(value, 10) > 0 && parseInt(value, 10) < 32;
129
130
  },
130
131
 
132
+ time(value) {
133
+ return value === '' || Validators.regex(value, /\d{2}\:\d{2}/) && moment(value, timeFormat).isValid();
134
+ },
135
+
136
+ 'time-hour'(value) {
137
+ return Validators.regex(value, /^\d{2}$/) && parseInt(value, 10) >= 0 && parseInt(value, 10) < 24;
138
+ },
139
+
140
+ 'time-minute'(value) {
141
+ return Validators.regex(value, /^\d{2}$/) && parseInt(value, 10) >= 0 && parseInt(value, 10) < 59;
142
+ },
143
+
131
144
  // eslint-disable-next-line no-inline-comments, spaced-comment
132
145
  before(value, date) {
133
146
  // validator can also do before(value, [diff, unit][, diff, unit])
@@ -0,0 +1,102 @@
1
+
2
+ <!DOCTYPE html>
3
+ <!--[if lt IE 9]><html class="lte-ie8" lang="{{htmlLang}}"><![endif]-->
4
+ <!--[if gt IE 8]><!--><html lang="{{htmlLang}}" class="govuk-template"><!--<![endif]-->
5
+ <head>
6
+ <meta charset="utf-8" />
7
+ <title>{{$pageTitle}}{{/pageTitle}}</title>
8
+ {{$head}}{{/head}}
9
+
10
+ <link rel="shortcut icon" sizes="16x16 32x32 48x48" href="{{govukAssetPath}}images/favicon.ico" type="image/x-icon">
11
+ <link rel="mask-icon" href="{{govukAssetPath}}images/govuk-mask-icon.svg" color="#0b0c0c">
12
+ <link rel="apple-touch-icon" sizes="180x180" href="{{govukAssetPath}}images/govuk-apple-touch-icon-180x180.png">
13
+ <link rel="apple-touch-icon" sizes="167x167" href="{{govukAssetPath}}images/govuk-apple-touch-icon-167x167.png">
14
+ <link rel="apple-touch-icon" sizes="152x152" href="{{govukAssetPath}}images/govuk-apple-touch-icon-152x152.png">
15
+ <link rel="apple-touch-icon" href="{{govukAssetPath}}images/govuk-apple-touch-icon.png">
16
+
17
+
18
+ <meta name="theme-color" content="#0b0c0c" />
19
+
20
+ <meta name="viewport" content="width=device-width, initial-scale=1">
21
+
22
+
23
+ <meta property="og:image" content="{{govukAssetPath}}images/opengraph-image.png">
24
+ </head>
25
+
26
+ <body class="{{$bodyClasses}}{{/bodyClasses}} govuk-template__body js-enabled" >
27
+ <script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
28
+
29
+
30
+
31
+ <div id="global-cookie-message" class="gem-c-cookie-banner govuk-clearfix" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet="">
32
+ {{$cookieMessage}}{{/cookieMessage}}
33
+ </div>
34
+
35
+ {{$bodyStart}}{{/bodyStart}}
36
+
37
+ <header role="banner" id="govuk-header" class="{{$headerClass}}{{/headerClass}}">
38
+ <div class="govuk-header__container govuk-width-container">
39
+
40
+ <div class="govuk-header__logo">
41
+ <a href="{{$homepageUrl}}https://www.gov.uk{{/homepageUrl}}" title="{{$logoLinkTitle}}Go to the GOV.UK homepage{{/logoLinkTitle}}" id="logo" class="govuk-header__link govuk-header__link--homepage" target="_blank" data-module="track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
42
+ <span class="govuk-header__logotype">
43
+ <!--[if gt IE 8]><!-->
44
+ <svg aria-hidden="true" focusable="false" class="govuk-header__logotype-crown" xmlns="http://www.w3.org/2000/svg\" viewBox="0 0 32 30" height="30" width="32">
45
+ <path fill="currentColor" fill-rule="evenodd" d="M22.6 10.4c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m-5.9 6.7c-.9.4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4m10.8-3.7c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s0 2-1 2.4m3.3 4.8c-1 .4-2-.1-2.4-1-.4-.9.1-2 1-2.4.9-.4 2 .1 2.4 1s-.1 2-1 2.4M17 4.7l2.3 1.2V2.5l-2.3.7-.2-.2.9-3h-3.4l.9 3-.2.2c-.1.1-2.3-.7-2.3-.7v3.4L15 4.7c.1.1.1.2.2.2l-1.3 4c-.1.2-.1.4-.1.6 0 1.1.8 2 1.9 2.2h.7c1-.2 1.9-1.1 1.9-2.1 0-.2 0-.4-.1-.6l-1.3-4c-.1-.2 0-.2.1-.3m-7.6 5.7c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m-5 3c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s.1 2 1 2.4m-3.2 4.8c.9.4 2-.1 2.4-1 .4-.9-.1-2-1-2.4-.9-.4-2 .1-2.4 1s0 2 1 2.4m14.8 11c4.4 0 8.6.3 12.3.8 1.1-4.5 2.4-7 3.7-8.8l-2.5-.9c.2 1.3.3 1.9 0 2.7-.4-.4-.8-1.1-1.1-2.3l-1.2 4c.7-.5 1.3-.8 2-.9-1.1 2.5-2.6 3.1-3.5 3-1.1-.2-1.7-1.2-1.5-2.1.3-1.2 1.5-1.5 2.1-.1 1.1-2.3-.8-3-2-2.3 1.9-1.9 2.1-3.5.6-5.6-2.1 1.6-2.1 3.2-1.2 5.5-1.2-1.4-3.2-.6-2.5 1.6.9-1.4 2.1-.5 1.9.8-.2 1.1-1.7 2.1-3.5 1.9-2.7-.2-2.9-2.1-2.9-3.6.7-.1 1.9.5 2.9 1.9l.4-4.3c-1.1 1.1-2.1 1.4-3.2 1.4.4-1.2 2.1-3 2.1-3h-5.4s1.7 1.9 2.1 3c-1.1 0-2.1-.2-3.2-1.4l.4 4.3c1-1.4 2.2-2 2.9-1.9-.1 1.5-.2 3.4-2.9 3.6-1.9.2-3.4-.8-3.5-1.9-.2-1.3 1-2.2 1.9-.8.7-2.3-1.2-3-2.5-1.6.9-2.2.9-3.9-1.2-5.5-1.5 2-1.3 3.7.6 5.6-1.2-.7-3.1 0-2 2.3.6-1.4 1.8-1.1 2.1.1.2.9-.3 1.9-1.5 2.1-.9.2-2.4-.5-3.5-3 .6 0 1.2.3 2 .9l-1.2-4c-.3 1.1-.7 1.9-1.1 2.3-.3-.8-.2-1.4 0-2.7l-2.9.9C1.3 23 2.6 25.5 3.7 30c3.7-.5 7.9-.8 12.3-.8\"></path>
46
+ </svg>
47
+ <!--<![endif]-->
48
+ <!--[if IE 8]>
49
+ <img src="{{govukAssetPath}}images/govuk-logotype-tudor-crown.png" class="govuk-header__logotype-crown-fallback-image" width="32" height="30" alt="">
50
+ <![endif]-->
51
+ </span>
52
+ <span class="govuk-header__logotype-text">
53
+ {{$globalHeaderText}}GOV.UK{{/globalHeaderText}}
54
+ </span>
55
+ </a>
56
+ </div>
57
+ {{$insideHeader}}{{/insideHeader}}
58
+
59
+ {{$propositionHeader}}{{/propositionHeader}}
60
+ </div>
61
+ </header>
62
+
63
+
64
+ {{$afterHeader}}{{/afterHeader}}
65
+
66
+
67
+ {{$main}}{{/main}}
68
+
69
+ <footer class="govuk-footer" id="footer" role="contentinfo">
70
+
71
+ <div class="govuk-width-container">
72
+ {{$footerTop}}{{/footerTop}}
73
+
74
+ <div class="govuk-footer__meta">
75
+ <div class="govuk-footer__meta-item govuk-footer__meta-item--grow">
76
+ <h2 class="govuk-visually-hidden">Support links</h2>
77
+ {{$footerSupportLinks}}{{/footerSupportLinks}}
78
+
79
+ <svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
80
+ <path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path>
81
+ </svg>
82
+
83
+ <span class="govuk-footer__licence-description">{{$licenceMessage}}All content is available under the <a href="https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" id="open-government-licence" class="govuk-footer__link" target="_blank" rel="license">Open Government Licence v3.0</a>, except where otherwise stated{{/licenceMessage}}</span>
84
+ </div>
85
+
86
+ <div class="govuk-footer__meta-item">
87
+ <a class="govuk-footer__link govuk-footer__copyright-logo" id="copyright-logo" target="_blank" href="https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/">{{$crownCopyrightMessage}}© Crown copyright{{/crownCopyrightMessage}}</a>
88
+ </div>
89
+ </div>
90
+ </div>
91
+ </footer>
92
+
93
+ <div id="global-app-error" class="app-error hidden"></div>
94
+
95
+
96
+ {{$bodyEnd}}{{/bodyEnd}}
97
+
98
+
99
+ <script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>if (typeof window.GOVUK === 'undefined') document.body.className = document.body.className.replace('js-enabled', '');</script>
100
+
101
+ </body>
102
+ </html>
@@ -13,6 +13,7 @@ const PANELMIXIN = 'partials/mixins/panel';
13
13
  const PARTIALS = [
14
14
  'partials/forms/input-text-group',
15
15
  'partials/forms/input-text-date',
16
+ 'partials/forms/input-text-time',
16
17
  'partials/forms/input-submit',
17
18
  'partials/forms/select',
18
19
  'partials/forms/checkbox',
@@ -213,6 +214,7 @@ module.exports = function (options) {
213
214
  label: t(lKey),
214
215
  labelClassName: labelClassName ? `govuk-label ${labelClassName}` : 'govuk-label',
215
216
  formGroupClassName: classNames(field, 'formGroupClassName') || extension.formGroupClassName || 'govuk-form-group',
217
+ timeInputItemClassName: 'time-input__item',
216
218
  hint: hint,
217
219
  hintId: extension.hintId || (hint ? key + '-hint' : null),
218
220
  error: this.errors && this.errors[key],
@@ -221,11 +223,12 @@ module.exports = function (options) {
221
223
  required: required,
222
224
  pattern: extension.pattern,
223
225
  date: extension.date,
226
+ time: extension.time,
224
227
  autocomplete: autocomplete,
225
228
  child: field.child,
226
229
  isPageHeading: field.isPageHeading,
227
230
  attributes: field.attributes,
228
- isPrefixOrSuffix: _.map(field.attributes, item => {if (item.prefix || item.suffix !== undefined) return true;}),
231
+ isPrefixOrSuffix: _.map(field.attributes, item => { if (item.prefix || item.suffix !== undefined) return true; }),
229
232
  isMaxlengthOrMaxword: maxlength(field) || extension.maxlength || maxword(field) || extension.maxword,
230
233
  renderChild: renderChild.bind(this)
231
234
  });
@@ -468,6 +471,47 @@ module.exports = function (options) {
468
471
  return parts.concat(monthPart, yearPart).join('\n');
469
472
  };
470
473
  }
474
+ },
475
+ 'input-time': {
476
+ handler: function () {
477
+ /**
478
+ * props: '[value] [id]'
479
+ */
480
+ return function (key) {
481
+ const field = Object.assign({}, this.options.fields[key] || options.fields[key]);
482
+ key = hoganRender(key, this);
483
+ // Exact unless there is a inexact property against the fields key.
484
+ const isExact = field.inexact !== true;
485
+
486
+ let autocomplete = field.autocomplete || {};
487
+ if (autocomplete === 'off') {
488
+ autocomplete = {
489
+ hour: 'off',
490
+ minute: 'off'
491
+ };
492
+ } else if (typeof autocomplete === 'string') {
493
+ autocomplete = {
494
+ hour: autocomplete + '-hour',
495
+ minute: autocomplete + '-minute'
496
+ };
497
+ }
498
+ const isThisRequired = field.validate ? field.validate.indexOf('required') > -1 : false;
499
+ const formGroupClassName = (field.formGroup && field.formGroup.className) ? field.formGroup.className : '';
500
+ const classNameHour = (field.controlsClass && field.controlsClass.hour) ? field.controlsClass.hour : 'govuk-input--width-2';
501
+ const classNameMinute = (field.controlsClass && field.controlsClass.minute) ? field.controlsClass.minute : 'govuk-input--width-2';
502
+
503
+ const parts = [];
504
+
505
+ if (isExact) {
506
+ const hourPart = compiled['partials/forms/input-text-time'].render(inputText.call(this, key + '-hour', { pattern: '[0-9]*', min: 1, max: 24, maxlength: 2, hintId: key + '-hint', time: true, autocomplete: autocomplete.hour, formGroupClassName, className: classNameHour, isThisRequired }));
507
+ parts.push(hourPart);
508
+ }
509
+
510
+ const minutePart = compiled['partials/forms/input-text-time'].render(inputText.call(this, key + '-minute', { pattern: '[0-9]*', min: 0, max: 59, maxlength: 2, hintId: key + '-hint', time: true, autocomplete: autocomplete.minute, formGroupClassName, className: classNameMinute, isThisRequired }));
511
+
512
+ return parts.concat(minutePart).join('\n');
513
+ };
514
+ }
471
515
  }
472
516
  };
473
517
 
@@ -0,0 +1,37 @@
1
+ <div class="{{timeInputItemClassName}}">
2
+ <div id="{{id}}-group" class="{{#formGroupClassName}} {{formGroupClassName}}{{/formGroupClassName}}">
3
+ <label for="{{id}}" class="{{labelClassName}}">
4
+ <span class="label-text">{{{label}}}</span>
5
+ </label>
6
+ {{#hint}}<span {{$hintId}}id="{{hintId}}" {{/hintId}}class="govuk-hint">{{hint}}</span>{{/hint}}
7
+ {{#renderChild}}{{/renderChild}}
8
+ {{#attributes}}
9
+ {{#prefix}}
10
+ <div class="govuk-input__prefix" aria-hidden="true">{{prefix}}</div>
11
+ {{/prefix}}
12
+ {{/attributes}}
13
+ <input
14
+ type="{{type}}"
15
+ name="{{id}}"
16
+ id="{{id}}"
17
+ class="govuk-input{{#className}} {{className}}{{/className}}{{#error}} govuk-input--error{{/error}}"
18
+ aria-required="{{required}}"
19
+ {{#value}} value="{{value}}"{{/value}}
20
+ {{#min}} min="{{min}}"{{/min}}
21
+ {{#max}} max="{{max}}"{{/max}}
22
+ {{#maxlength}} maxlength="{{maxlength}}"{{/maxlength}}
23
+ {{#pattern}} pattern="{{pattern}}"{{/pattern}}
24
+ {{#hintId}} aria-describedby="{{hintId}}"{{/hintId}}
25
+ {{#error}} aria-invalid="true"{{/error}}
26
+ {{#autocomplete}} autocomplete="{{autocomplete}}"{{/autocomplete}}
27
+ {{#attributes}}
28
+ {{attribute}}="{{value}}"
29
+ {{/attributes}}
30
+ >
31
+ {{#attributes}}
32
+ {{#suffix}}
33
+ <div class="govuk-input__prefix" aria-hidden="true">{{suffix}}</div>
34
+ {{/suffix}}
35
+ {{/attributes}}
36
+ </div>
37
+ </div>
@@ -0,0 +1,5 @@
1
+ .time-input__item {
2
+ display: inline-block;
3
+ margin-right: 20px;
4
+ margin-bottom: 0;
5
+ }
@@ -27,6 +27,7 @@ $path: "/public/images/" !default;
27
27
  @import "check_your_answers";
28
28
  @import "pdf";
29
29
  @import "session-timeout-dialog";
30
+ @import "time-input";
30
31
 
31
32
  // Modules
32
33
  @import "modules/validation";
@@ -85,6 +85,10 @@ function formFocus() {
85
85
  document.getElementById(getElementFromSummaryLink + '-day').focus();
86
86
  }
87
87
 
88
+ if (document.getElementById(getElementFromSummaryLink + '-hour') && forms.length === 1 && editMode) {
89
+ document.getElementById(getElementFromSummaryLink + '-hour').focus();
90
+ }
91
+
88
92
  if (forms.length > 0) {
89
93
  labels = document.getElementsByTagName('label');
90
94
  if (labels) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "22.1.1",
4
+ "version": "22.2.0-time-mixin-beta",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
package/sandbox/.env ADDED
@@ -0,0 +1,3 @@
1
+ # SESSION_TTL=10
2
+ # SESSION_TIMEOUT_WARNING=5
3
+ NODE_ENV = 'local
@@ -3,6 +3,7 @@
3
3
 
4
4
  const dateComponent = require('../../../').components.date;
5
5
  const staticAppealStages = require('./lib/staticAppealStages');
6
+ const timeComponent = require('../../../').components.time;
6
7
 
7
8
  module.exports = {
8
9
  'landing-page-radio': {
@@ -26,6 +27,14 @@ module.exports = {
26
27
  { type: 'after', arguments: ['1900'] }
27
28
  ]
28
29
  }),
30
+ time: timeComponent('time', {
31
+ mixin: 'input-time',
32
+ isPageHeading: 'true',
33
+ validate: [
34
+ 'required',
35
+ 'time'
36
+ ]
37
+ }),
29
38
  building: {
30
39
  validate: ['required', 'notUrl', { type: 'maxlength', arguments: 100 }]
31
40
  },
@@ -31,6 +31,10 @@ module.exports = {
31
31
  '/dob': {
32
32
  fields: ['dateOfBirth'],
33
33
  locals: { showSaveAndExit: true },
34
+ next: '/time'
35
+ },
36
+ '/time': {
37
+ fields: ['time'],
34
38
  next: '/address'
35
39
  },
36
40
  '/address': {
@@ -1,5 +1,6 @@
1
1
  const moment = require('moment');
2
2
  const PRETTY_DATE_FORMAT = 'Do MMMM YYYY';
3
+ const PRETTY_TIME_FORMAT = 'k:mma';
3
4
  const APPEAL_STAGES = require('../lib/staticAppealStages').getstaticAppealStages();
4
5
  const _ = require('lodash');
5
6
 
@@ -11,6 +12,12 @@ module.exports = {
11
12
  parse: d => d && moment(d).format(PRETTY_DATE_FORMAT)
12
13
  }
13
14
  ],
15
+ time: [
16
+ {
17
+ field: 'time',
18
+ parse: t => t && moment(t, 'kk:mm').format(PRETTY_TIME_FORMAT)
19
+ }
20
+ ],
14
21
  address: [
15
22
  'building',
16
23
  'street',