Skip to content

Commit

Permalink
Update govuk-frontend to v5.4.1 (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
kbayliss committed Jul 29, 2024
1 parent 2913fbd commit 8bb97a2
Show file tree
Hide file tree
Showing 177 changed files with 4,287 additions and 1,363 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
dist
tests
.mypy_cache
govuk
34 changes: 34 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,40 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

## Unreleased

## [3.0.0](https://github.com/torchbox/tbxforms/releases/tag/v3.0.0)

### Developer

- Guidance on how to update `govuk-frontend` [#80]

### Pinned packages updated

- `govuk-frontend` from 3.13.0 (possibly) to 5.4.1 [#80]

### Removed

Several CSS classes/mixins have been removed/renamed in this release, some of
which are vendor changes in `govuk-frontend`.

Unfortunately, the initial release of tbxforms customised the styles from
`govuk-frontend` without documentation - including which version was used as a
base. As a result, it's hard to distinguish between variables/mixins we
added which have now been removed and those which GDS have removed over time.

However, variables which have now been removed from our \_variables.scss are:

- `$tbxforms-border-colour-conditional` (no longer configurable; now using GDS' `$tbxforms-border-colour`) [#80]
- `$tbxforms-border-width-conditional` (no longer configurable; now using GDS' `$tbxforms-border-width`) [#80]
- `$tbxforms-weight--bold` (use `$tbxforms-font-weight-bold` instead) [#80]
- `$tbxforms-weight--normal` (use `$tbxforms-font-weight-regular` instead) [#80]
- `$tbxforms-grid` (no longer configurable; now using GDS' default spacing) [#80]
- `$tbxforms-spacer` (no longer configurable; now using GDS' default spacing) [#80]
- `$tbxforms-in-field-spacer` (no longer configurable; now using GDS' default spacing) [#80]
- `$tbxforms-form-group-spacer` (no longer configurable; now using GDS' default spacing) [#80]
- `$tbxforms-base-font-size` (use `$tbxforms-typography-scale` instead) [#80]
- `$tbxforms-base-line-height` (use `$tbxforms-typography-scale` instead) [#80]
- `$tbxforms-font-sizes` (use `$tbxforms-typography-scale` instead) [#80]

## [2.1.0](https://github.com/torchbox/tbxforms/releases/tag/v2.1.0)

### Changed
Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,19 @@ If your changes cause the snapshot tests to fail:
9. `npm publish` - publish package to npmjs.com
10. `poetry publish` - publish package to pypi.org
11. Create a [release](https://github.com/torchbox/tbxforms/releases) with relevant changelog entries and upgrade considerations

## Common tasks

### Updating govuk-frontend

Everything within the `/static/sass/govuk/` directory is mostly unmodified,
except that:

1. all instances of "govuk-" have been replaced with "tbxforms-"
2. unused .scss files and all other file types (.js, .md, .njk) have been deleted
3. imports to unused .scss files have been commented-out (not removed, to make tracing changes easier)
4. added `calc()` to equations to avoid Dart Sass 2.0.0 deprecation warning

There's also some overrides in `/static/sass/govuk-overrides/` to be aware of.

This list also acts as a checklist for updating [govuk-frontend](https://github.com/alphagov/govuk-frontend) in the future.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,26 @@ variables can be customised.
## Requirements

- python `>=3.8.1,<4.0`
- Django `>=2.2`
- django-crispy-forms `>=1.13.0,<2.0`
- Django `>=3.2`
- django-crispy-forms `>=2.1,<3.0`
- wagtail `>=2.15` if using `WagtailBaseForm`
- sass `>=1.33.0` if building the sass yourself

> [!NOTE] > **[govuk-frontend](https://github.com/alphagov/govuk-frontend) will
> not, and does not need to, be installed to use this package.**
>
> All form-related styles from `govuk-frontend==5.4.1` have been
> copied into this project with the prepended "govuk-" replaced with
> "tbxforms-", e.g. `.govuk-button` to `.tbxforms-button` and
> `@mixin govuk-clearfix` to `@mixin tbxforms-clearfix`.
For non-government projects, installing the complete GOV.UK Frontend package
unnecessarily increases the bundle size as we only need form-related styles.

For government projects, this increases the bundle size as both `tbxforms` and
`govuk-frontend` must be installed. However, these projects are less common, so
they are not prioritised.

## Installation

You must install both the Python package and the NPM package.
Expand Down Expand Up @@ -82,14 +97,11 @@ Import the styles into your project...

```scss
@use 'node_modules/tbxforms/tbxforms.scss' with (
$tbxforms-error-colour: #f00,
$tbxforms-text-colour: #000,
$tbxforms-error-colour: #f00,
);
```

Alternatively, variables can be defined in a centralised variables SCSS
such as [tbxforms/static/sass/abstracts/\_variables.scss](https://github.com/torchbox/tbxforms/blob/main/tbxforms/static/sass/abstracts/_variables.scss).

#### Add button styles

`tbxforms` provides out-of-the-box GOV.UK Design System styles for everything
Expand Down
4 changes: 2 additions & 2 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
@@ -1,6 +1,6 @@
{
"name": "tbxforms",
"version": "2.1.0",
"version": "3.0.0",
"main": "./dist/tbxforms.umd.js",
"module": "./dist/tbxforms.es.js",
"files": [
Expand All @@ -9,7 +9,7 @@
"dist/**/*.scss"
],
"description": "A Torchbox-flavoured template pack for django-crispy-forms, adapted from crispy-forms-gds",
"author": "Kyle Bayliss",
"author": "Kyle Bayliss <kyle.bayliss@torchbox.com>",
"private": false,
"license": "BSD-2-Clause",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tbxforms"
version = "2.1.0"
version = "3.0.0"
description = "A Torchbox-flavoured template pack for django-crispy-forms, adapted from crispy-forms-gds"
authors = [
"Kyle Bayliss <kyle.bayliss@torchbox.com>"
Expand Down
8 changes: 8 additions & 0 deletions tbxforms/static/sass/_conditional.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/*
Additional styles for our conditionally-required fields.
*/

.tbxforms-conditional {
border-left: $tbxforms-border-width solid $tbxforms-border-colour;
padding-left: $tbxforms-gutter-half;
}
25 changes: 0 additions & 25 deletions tbxforms/static/sass/abstracts/_mixins.scss

This file was deleted.

64 changes: 0 additions & 64 deletions tbxforms/static/sass/abstracts/_variables.scss

This file was deleted.

Loading

0 comments on commit 8bb97a2

Please sign in to comment.