Skip to content

Commit 8164bc3

Browse files
committed
Merge branch 'main' of github.com:NHSDigital/nhsuk-react-components into feature/deprecatePanelAndPromo
2 parents 3f2ccea + d2ca132 commit 8164bc3

File tree

77 files changed

+8126
-5648
lines changed

Some content is hidden

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

77 files changed

+8126
-5648
lines changed

.storybook/config.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

.storybook/main.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
module.exports = {
2-
addons: ['@storybook/addon-storysource'],
2+
stories: ['../stories/*.stories.@(ts|tsx)', '../stories/**/*.stories.@(ts|tsx)'],
3+
addons: ['@storybook/addon-links', '@storybook/addon-essentials', '@storybook/preset-scss'],
4+
5+
typescript: {
6+
check: true,
7+
checkOptions: {},
8+
reactDocgen: 'react-docgen-typescript',
9+
},
310
};

.storybook/manager.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { addons } from "@storybook/addons";
2+
import nhsTheme from "./theme";
3+
4+
addons.setConfig({
5+
theme: nhsTheme
6+
});

.storybook/preview.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import "./storybook.scss";
2+
3+
export const parameters = {
4+
actions: { argTypesRegex: "^on[A-Z].*" },
5+
}
6+

.storybook/storybook.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,14 @@
11
@import '../node_modules/nhsuk-frontend/dist/nhsuk.css';
2+
3+
.tag-wrapper {
4+
display: flex;
5+
flex-direction: column;
6+
7+
& > .nhsuk-tag {
8+
margin-bottom: 10px;
9+
10+
&:last-of-type {
11+
margin-bottom: 0;
12+
}
13+
}
14+
}

.storybook/theme.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
1-
import { create } from '@storybook/theming';
1+
import { create } from "@storybook/theming/create";
2+
const version = require("../package.json").version;
23

34
export default create({
4-
base: 'light',
5-
background: 'white',
6-
colorPrimary: '#005eb8',
7-
colorSecondary: '#425563',
5+
base: 'light',
6+
background: 'white',
7+
colorPrimary: '#005eb8',
8+
colorSecondary: '#425563',
89

9-
// UI
10-
appBg: 'white',
11-
appContentBg: 'white',
12-
appBorderColor: 'grey',
13-
appBorderRadius: 4,
10+
// UI
11+
appBg: 'white',
12+
appContentBg: 'white',
13+
appBorderColor: 'grey',
14+
appBorderRadius: 4,
1415

15-
// Typography
16-
fontBase: '"Frutiger W01", Arial, sans-serif',
17-
fontCode: 'monospace',
16+
// Typography
17+
fontCode: 'monospace',
1818

19-
// Text colors
20-
textColor: '#212b32',
21-
textInverseColor: 'white',
19+
// Text colors
20+
textColor: '#212b32',
21+
textInverseColor: 'white',
2222

23-
// Toolbar default and active colors
24-
barTextColor: 'rgba(255,255,255,0.8)',
25-
barSelectedColor: 'rgba(255,255,255,1)',
26-
barBg: '#005eb8',
23+
// Toolbar default and active colors
24+
barTextColor: 'rgba(255,255,255,0.8)',
25+
barSelectedColor: 'rgba(255,255,255,1)',
26+
barBg: '#005eb8',
2727

28-
// Form colors
29-
inputBg: 'white',
30-
inputBorder: '#425563',
31-
inputTextColor: '#212b32',
32-
inputBorderRadius: 4,
28+
// Form colors
29+
inputBg: 'white',
30+
inputBorder: '#425563',
31+
inputTextColor: '#212b32',
32+
inputBorderRadius: 4,
3333

34-
brandTitle: 'NHS.UK React Components',
35-
brandUrl: 'https://beta.nhs.uk/service-manual/',
36-
brandImage: 'https://assets.nhs.uk/images/nhs-logo.png',
34+
brandTitle: `NHS.UK React Components (v${version})`,
35+
brandUrl: 'https://github.com/NHSDigital/nhsuk-react-components'
3736
});

.storybook/webpack.config.js

Lines changed: 0 additions & 27 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Unreleased Changes
2+
## New Card Component
3+
4+
The new Card component from `nhsuk-frontend` 4 has been added. Check out the storybook for usage examples!
5+
6+
## WarningCallout
7+
8+
### Removal of WarningCallout "label" prop
9+
10+
The WarningCallout `label` prop has been removed, and replaced with `WarningCallout.Label`.
11+
12+
Existing usages of the WarningCallout will need to be replaced with the new syntax, or will no longer render properly.
13+
14+
```jsx
15+
// Old Syntax
16+
<WarningCallout label="School, nursery or work">
17+
<p>
18+
Stay away from school, nursery or work until all the spots have crusted over.
19+
This is usually 5 days after the spots first appeared.
20+
</p>
21+
</WarningCallout>
22+
23+
// New Syntax
24+
<WarningCallout>
25+
<WarningCallout.Label>School, nursery or work</WarningCallout.Label>
26+
<p>
27+
Stay away from school, nursery or work until all the spots have crusted over.
28+
This is usually 5 days after the spots first appeared.
29+
</p>
30+
</WarningCallout>
31+
```
32+
33+
### Addition of hidden text on the WarningCallout.Label
34+
35+
The `WarningCallout.Label` now has the hidden text `Important: ` before the label content. If this causes an issue in your application, and you would like to change or disable this hidden text you are able to do via the `visuallyHiddenText` prop.
36+
37+
```jsx
38+
// Custom Visually Hidden Text
39+
<WarningCallout.Label visuallyHiddenText="This is very, very important: ">
40+
Something Quite Important
41+
</WarningCallout.Label>
42+
43+
// Disabled Visually Hidden Text
44+
<WarningCallout.Label visuallyHiddenText={false}>
45+
Something Much Less Important
46+
</WarningCallout.Label>
47+
```
48+
49+
## Hint component renders as div
50+
51+
The `Hint` component now renders as a `div` element rather than a `span`.

babel.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module.exports = {
2-
presets: ['@babel/env', '@babel/typescript', '@babel/preset-react'],
2+
presets: ['@babel/preset-env', '@babel/typescript', '@babel/preset-react'],
33
plugins: [
44
'@babel/plugin-proposal-numeric-separator',
5-
'@babel/proposal-class-properties',
5+
['@babel/proposal-class-properties', { loose: true }],
66
'@babel/proposal-object-rest-spread',
77
],
88
};

package.json

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,29 @@
88
},
99
"license": "MIT",
1010
"devDependencies": {
11-
"@babel/cli": "^7.10.1",
12-
"@babel/core": "^7.10.1",
13-
"@babel/plugin-proposal-numeric-separator": "^7.10.1",
14-
"@babel/preset-react": "^7.10.1",
15-
"@babel/preset-typescript": "^7.10.1",
16-
"@storybook/addon-centered": "^5.3.19",
17-
"@storybook/addon-info": "^5.3.19",
18-
"@storybook/addon-storysource": "^5.3.19",
19-
"@storybook/react": "^5.3.19",
20-
"@storybook/storybook-deployer": "^2.8.6",
11+
"@babel/cli": "^7.12.17",
12+
"@babel/core": "^7.12.17",
13+
"@babel/preset-react": "^7.12.13",
14+
"@babel/preset-typescript": "^7.12.17",
15+
"@storybook/addon-actions": "^6.1.18",
16+
"@storybook/addon-essentials": "^6.1.18",
17+
"@storybook/addon-links": "^6.1.18",
18+
"@storybook/addon-storysource": "^6.1.18",
19+
"@storybook/preset-scss": "^1.0.3",
20+
"@storybook/react": "^6.1.18",
21+
"@storybook/storybook-deployer": "^2.8.7",
2122
"@types/classnames": "^2.2.9",
2223
"@types/enzyme": "^3.10.3",
2324
"@types/enzyme-adapter-react-16": "^1.0.5",
2425
"@types/jest": "^24.0.23",
2526
"@types/jest-axe": "^3.2.2",
26-
"@types/node": "^12.12.12",
2727
"@types/react": "^16.9.3",
2828
"@types/react-dom": "^16.9.3",
2929
"@typescript-eslint/eslint-plugin": "^2.3.1",
3030
"@typescript-eslint/parser": "^2.3.1",
3131
"awesome-typescript-loader": "^5.2.1",
32-
"babel-loader": "^8.0.6",
32+
"babel-loader": "^8.2.2",
33+
"css-loader": "^5.0.0",
3334
"enzyme": "^3.10.3",
3435
"enzyme-adapter-react-16": "^1.15.1",
3536
"enzyme-to-json": "^3.4.3",
@@ -43,34 +44,37 @@
4344
"eslint-plugin-prettier": "^3.1.1",
4445
"eslint-plugin-react": "^7.14.3",
4546
"eslint-plugin-react-hooks": "^1.7.0",
46-
"jest": "^24.9.0",
47+
"jest": "^26.6.1",
4748
"jest-axe": "^3.4.0",
48-
"nhsuk-frontend": "^3.1.0",
49+
"nhsuk-frontend": "^4.1.0",
4950
"node-sass": "^4.14.1",
5051
"prettier": "^1.18.2",
5152
"react": "^16.9.3",
5253
"react-docgen-typescript-loader": "^3.2.1",
5354
"react-dom": "^16.9.3",
55+
"react-is": "^17.0.1",
5456
"rollup": "^1.21.4",
5557
"rollup-plugin-sass": "^1.2.2",
5658
"rollup-plugin-scss": "^1.0.2",
5759
"rollup-plugin-typescript2": "^0.24.2",
58-
"sass-loader": "^8.0.2",
59-
"ts-jest": "^24.2.0",
60+
"sass-loader": "^10.0.4",
61+
"style-loader": "^2.0.0",
62+
"ts-jest": "^26.4.3",
6063
"ts-node": "^8.4.1",
6164
"tslib": "^2.0.0",
6265
"typescript": "^3.9.5"
6366
},
6467
"peerDependencies": {
65-
"nhsuk-frontend": "^3.0.0",
68+
"nhsuk-frontend": ">=4.0.0",
6669
"react": "^16.9.0",
6770
"react-dom": "^16.9.0"
6871
},
6972
"dependencies": {
73+
"@babel/plugin-proposal-class-properties": "7.10.1",
7074
"classnames": "^2.2.6"
7175
},
7276
"scripts": {
73-
"storybook": "start-storybook",
77+
"storybook": "start-storybook -p 6006",
7478
"cleanup": "bash scripts/cleanup.sh",
7579
"build": "yarn cleanup && yarn build:dist && yarn build:lib",
7680
"build:dist": "rollup -c",
@@ -80,6 +84,7 @@
8084
"test:watch": "jest --watch",
8185
"lint": "eslint --fix -c .eslintrc.js --ext .ts --ext .tsx src/*.ts src/components/**/*.ts src/util/*.ts",
8286
"prebuild": "yarn lint && yarn test --coverage",
87+
"build-storybook": "build-storybook",
8388
"prepare": "yarn build"
8489
},
8590
"files": [

0 commit comments

Comments
 (0)