@hmlr/govuk-react-components-library 1.0.3 → 1.2.0
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.
- package/.stylelintrc.json +1 -1
- package/README.md +216 -2
- package/assets/uml-diagram.svg +782 -578
- package/bundle-analysis-main.html +1 -1
- package/bundle-analysis-pdfvc.html +1 -1
- package/dist/PDFViewerCanvas.cjs.css +4 -4
- package/dist/PDFViewerCanvas.cjs.js +24 -4
- package/dist/PDFViewerCanvas.cjs.js.map +1 -1
- package/dist/PDFViewerCanvas.d.ts +30 -0
- package/dist/PDFViewerCanvas.esm.css +4 -4
- package/dist/PDFViewerCanvas.esm.js +24 -4
- package/dist/PDFViewerCanvas.esm.js.map +1 -1
- package/dist/index.cjs.css +22 -15
- package/dist/index.cjs.js +207 -111
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +183 -12
- package/dist/index.esm.css +22 -15
- package/dist/index.esm.js +206 -116
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/CardColumn/CardColumn.types.d.ts +20 -0
- package/dist/types/components/DataNavigation/DataNavigation.types.d.ts +27 -2
- package/dist/types/components/DifferenceNavigation/DifferenceNavigation.types.d.ts +25 -0
- package/dist/types/components/ExitThisPage/ExitThisPage.config.d.ts +1 -0
- package/dist/types/components/ExitThisPage/ExitThisPage.d.ts +4 -0
- package/dist/types/components/ExitThisPage/ExitThisPage.types.d.ts +17 -0
- package/dist/types/components/ExitThisPage/index.d.ts +2 -0
- package/dist/types/components/Footer/Footer.types.d.ts +7 -0
- package/dist/types/components/PDFViewerCanvas/PDFViewerCanvas.types.d.ts +30 -0
- package/dist/types/components/Pagination/Pagination.types.d.ts +23 -13
- package/dist/types/components/Pagination/index.d.ts +2 -0
- package/dist/types/components/PasswordInput/PasswordInput.config.d.ts +1 -0
- package/dist/types/components/PasswordInput/PasswordInput.d.ts +4 -0
- package/dist/types/components/PasswordInput/PasswordInput.types.d.ts +49 -0
- package/dist/types/components/PasswordInput/index.d.ts +2 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/dynamics/types.d.ts +1 -1
- package/dist/types/utils/WithReference.types.d.ts +7 -2
- package/package.json +63 -61
- package/scripts/generateStories.mjs +433 -0
- package/dist/types/JestSetup.d.ts +0 -1
|
@@ -25,9 +25,16 @@ export interface Meta {
|
|
|
25
25
|
items?: MetaItem[];
|
|
26
26
|
children?: React.ReactNode;
|
|
27
27
|
}
|
|
28
|
+
export interface ContentLicence {
|
|
29
|
+
className?: string;
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
reactListKey?: string | number;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
28
34
|
export interface FooterProps extends HTMLAttributes<HTMLElement> {
|
|
29
35
|
className?: string;
|
|
30
36
|
containerClassName?: string;
|
|
31
37
|
meta?: Meta;
|
|
32
38
|
navigation?: NavigationItem[];
|
|
39
|
+
contentLicence?: ContentLicence;
|
|
33
40
|
}
|
|
@@ -4,5 +4,35 @@ export interface PDFViewerCanvasProps {
|
|
|
4
4
|
documentName?: string;
|
|
5
5
|
pageNumber?: number;
|
|
6
6
|
showNavigation?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Background colour of the navigation buttons in their resting state.
|
|
9
|
+
* Passed directly to DifferenceNavigation.
|
|
10
|
+
* Defaults to govuk-functional-colour("brand") (#1d70b8).
|
|
11
|
+
*/
|
|
12
|
+
buttonColour?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Text colour of the navigation buttons in their resting state.
|
|
15
|
+
* Passed directly to DifferenceNavigation.
|
|
16
|
+
* Defaults to govuk-colour("white") (#ffffff).
|
|
17
|
+
*/
|
|
18
|
+
buttonTextColour?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Shadow colour of the navigation buttons.
|
|
21
|
+
* Passed directly to DifferenceNavigation.
|
|
22
|
+
* Defaults to govuk-colour("black") (#0b0c0c).
|
|
23
|
+
*/
|
|
24
|
+
buttonShadowColour?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Background colour of the navigation buttons on hover.
|
|
27
|
+
* Passed directly to DifferenceNavigation.
|
|
28
|
+
* Defaults to govuk-functional-colour("focus") (#ffdd00).
|
|
29
|
+
*/
|
|
30
|
+
buttonHoverColour?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Text colour of the navigation buttons on hover.
|
|
33
|
+
* Passed directly to DifferenceNavigation.
|
|
34
|
+
* Defaults to govuk-functional-colour("focus-text") (#0b0c0c).
|
|
35
|
+
*/
|
|
36
|
+
buttonHoverTextColour?: string;
|
|
7
37
|
[key: string]: unknown;
|
|
8
38
|
}
|
|
@@ -1,22 +1,32 @@
|
|
|
1
|
+
export interface PaginationItemProps {
|
|
2
|
+
/** Page number or label (e.g. 1, "one"). Omit when ellipsis is true. */
|
|
3
|
+
number?: number | string;
|
|
4
|
+
href?: string;
|
|
5
|
+
current?: boolean;
|
|
6
|
+
ellipsis?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface PaginationNavProps {
|
|
9
|
+
href: string;
|
|
10
|
+
/** Override the default "Previous" / "Next" link text.
|
|
11
|
+
* Populated automatically from fixture `text` by ProcessExampleData (text → children). */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/** Secondary label rendered below the link title (block-layout mode). */
|
|
14
|
+
labelText?: string;
|
|
15
|
+
}
|
|
1
16
|
export interface PaginationProps {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
currentPage: number;
|
|
6
|
-
pageSize: number;
|
|
17
|
+
previous?: PaginationNavProps;
|
|
18
|
+
next?: PaginationNavProps;
|
|
19
|
+
items?: PaginationItemProps[];
|
|
7
20
|
className?: string;
|
|
8
|
-
previousName?: string;
|
|
9
|
-
previousChildren?: React.ReactNode;
|
|
10
|
-
nextName?: string;
|
|
11
|
-
nextChildren?: React.ReactNode;
|
|
12
21
|
}
|
|
13
22
|
export interface SvgIconProps {
|
|
14
23
|
type: string;
|
|
15
24
|
}
|
|
16
25
|
export interface NavigationButtonProps {
|
|
17
|
-
|
|
18
|
-
onClick: () => void;
|
|
19
|
-
children?: React.ReactNode;
|
|
20
|
-
name: string;
|
|
26
|
+
href: string;
|
|
21
27
|
type: "next" | "previous";
|
|
28
|
+
/** Overrides the default "Previous" / "Next" label (from fixture `text` → `children`). */
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
/** Optional secondary label shown beneath the link title. */
|
|
31
|
+
labelText?: string;
|
|
22
32
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ConfigureOverallPasswordInput($scope?: Document | Element): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface PasswordInputLabelProps {
|
|
2
|
+
children?: React.ReactNode;
|
|
3
|
+
className?: string;
|
|
4
|
+
isPageHeading?: boolean;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface PasswordInputProps {
|
|
8
|
+
/** Additional CSS classes for the `<input>` element. Maps from fixture `classes` → className */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Pre-existing aria-describedby value to prepend */
|
|
11
|
+
"aria-describedby"?: string;
|
|
12
|
+
/** Error message sub-object — `{ children }` after processExampleData transforms `text` */
|
|
13
|
+
errorMessage?: {
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
/** Wrapper div options */
|
|
18
|
+
formGroup?: {
|
|
19
|
+
className?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
};
|
|
22
|
+
/** Hint sub-object — `{ children }` after processExampleData transforms `text` */
|
|
23
|
+
hint?: {
|
|
24
|
+
children?: React.ReactNode;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
};
|
|
27
|
+
/** Label sub-object — `{ children, className, isPageHeading }` */
|
|
28
|
+
label?: PasswordInputLabelProps;
|
|
29
|
+
/** Input name attribute */
|
|
30
|
+
name?: string;
|
|
31
|
+
/** Input id attribute — also used to link label and aria-describedby */
|
|
32
|
+
id?: string;
|
|
33
|
+
/** autocomplete attribute — defaults to "current-password" */
|
|
34
|
+
autoComplete?: string;
|
|
35
|
+
/** i18n: label for the show-password button (default: "Show") */
|
|
36
|
+
showPasswordText?: string;
|
|
37
|
+
/** i18n: label for the hide-password button (default: "Hide") */
|
|
38
|
+
hidePasswordText?: string;
|
|
39
|
+
/** i18n: aria-label for the show-password button */
|
|
40
|
+
showPasswordAriaLabelText?: string;
|
|
41
|
+
/** i18n: aria-label for the hide-password button */
|
|
42
|
+
hidePasswordAriaLabelText?: string;
|
|
43
|
+
/** i18n: text announced when the password becomes visible */
|
|
44
|
+
passwordShownAnnouncementText?: string;
|
|
45
|
+
/** i18n: text announced when the password is hidden */
|
|
46
|
+
passwordHiddenAnnouncementText?: string;
|
|
47
|
+
/** Allow pass-through of any other HTML input attributes */
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
}
|
|
@@ -16,6 +16,7 @@ export * from "./DifferenceNavigation";
|
|
|
16
16
|
export * from "./ErrorBoundary";
|
|
17
17
|
export * from "./ErrorMessage";
|
|
18
18
|
export * from "./ErrorSummary";
|
|
19
|
+
export * from "./ExitThisPage";
|
|
19
20
|
export * from "./Fieldset";
|
|
20
21
|
export * from "./FileUpload";
|
|
21
22
|
export * from "./Footer";
|
|
@@ -32,6 +33,7 @@ export * from "./NotFoundPage";
|
|
|
32
33
|
export * from "./NotificationBanner";
|
|
33
34
|
export * from "./Pagination";
|
|
34
35
|
export * from "./Panel";
|
|
36
|
+
export * from "./PasswordInput";
|
|
35
37
|
export * from "./PDFViewer";
|
|
36
38
|
export * from "./PhaseBanner";
|
|
37
39
|
export * from "./ProblemWithService";
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
type RefAcceptingComponent = React.ComponentType<Record<string, unknown> & {
|
|
3
|
+
ref?: React.Ref<HTMLElement>;
|
|
4
|
+
}>;
|
|
2
5
|
export interface WithRefProps {
|
|
3
|
-
Component:
|
|
6
|
+
Component: RefAcceptingComponent;
|
|
7
|
+
items?: unknown[];
|
|
4
8
|
[key: string]: unknown;
|
|
5
9
|
}
|
|
6
10
|
export interface InfoSectionProps {
|
|
7
11
|
refName: string;
|
|
8
|
-
Component:
|
|
12
|
+
Component: RefAcceptingComponent;
|
|
9
13
|
restProps: Record<string, unknown>;
|
|
10
14
|
}
|
|
15
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hmlr/govuk-react-components-library",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "These are common component use for React applications based on GDS and govuk-frontend",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -24,13 +24,17 @@
|
|
|
24
24
|
"storybook": "storybook dev -p 6006 --debug-webpack",
|
|
25
25
|
"build-storybook": "storybook build --debug-webpack",
|
|
26
26
|
"test-storybook": "test-storybook",
|
|
27
|
-
"
|
|
28
|
-
"lint
|
|
27
|
+
"format:check": "prettier --ignore-path .gitignore --check '**/*.+(js|mjs|ts|tsx|json|css|scss|html|md)'",
|
|
28
|
+
"lint": "eslint 'src/**/*.ts*' && npm run format:check && stylelint 'src/**/*.{css,scss,less}'",
|
|
29
29
|
"format": "prettier --ignore-path .gitignore --write '**/*.+(js|mjs|ts|tsx|json|css|scss|html|md)'",
|
|
30
|
+
"lint-fix": "eslint --fix 'src/**/*.ts*' && npm run format && stylelint --fix 'src/**/*.{css,scss,less}' ",
|
|
30
31
|
"prepare": "husky",
|
|
31
32
|
"release": "standard-version",
|
|
32
33
|
"uml": "tsuml2 --glob './src/**/\\!(*.spec|*.test|TestUtilities|JestSetup).[t]s?(x)' -o './assets/uml-diagram.svg'",
|
|
33
|
-
"chromatic": "npx chromatic --exit-zero-on-changes"
|
|
34
|
+
"chromatic": "npx chromatic --exit-zero-on-changes",
|
|
35
|
+
"generate-stories": "node scripts/generateStories.mjs",
|
|
36
|
+
"prestorybook": "npm run generate-stories",
|
|
37
|
+
"prebuild-storybook": "npm run generate-stories"
|
|
34
38
|
},
|
|
35
39
|
"repository": {
|
|
36
40
|
"type": "git",
|
|
@@ -51,89 +55,87 @@
|
|
|
51
55
|
"author": "Cyril Adelekan",
|
|
52
56
|
"license": "MIT",
|
|
53
57
|
"devDependencies": {
|
|
54
|
-
"@babel/core": "^7.
|
|
55
|
-
"@babel/preset-env": "^7.
|
|
56
|
-
"@babel/preset-react": "^7.
|
|
57
|
-
"@babel/preset-typescript": "^7.
|
|
58
|
-
"@chromatic-com/storybook": "^
|
|
59
|
-
"@commitlint/cli": "^20.
|
|
60
|
-
"@commitlint/config-conventional": "^20.
|
|
58
|
+
"@babel/core": "^7.29.0",
|
|
59
|
+
"@babel/preset-env": "^7.29.2",
|
|
60
|
+
"@babel/preset-react": "^7.28.5",
|
|
61
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
62
|
+
"@chromatic-com/storybook": "^5.0.2",
|
|
63
|
+
"@commitlint/cli": "^20.5.0",
|
|
64
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
61
65
|
"@eslint/js": "^9.37.0",
|
|
62
|
-
"@jest/globals": "^30.
|
|
63
|
-
"@rollup/plugin-commonjs": "^
|
|
66
|
+
"@jest/globals": "^30.3.0",
|
|
67
|
+
"@rollup/plugin-commonjs": "^29.0.2",
|
|
64
68
|
"@rollup/plugin-json": "^6.1.0",
|
|
65
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
66
|
-
"@rollup/plugin-terser": "^0.
|
|
67
|
-
"@rollup/plugin-typescript": "^12.
|
|
68
|
-
"@storybook/addon-a11y": "^
|
|
69
|
-
"@storybook/addon-links": "^
|
|
70
|
-
"@storybook/addon-styling-webpack": "^
|
|
71
|
-
"@storybook/addon-webpack5-compiler-swc": "^4.0.
|
|
72
|
-
"@storybook/react-vite": "^
|
|
73
|
-
"@storybook/react-webpack5": "^
|
|
74
|
-
"@storybook/test-runner": "^0.
|
|
69
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
70
|
+
"@rollup/plugin-terser": "^1.0.0",
|
|
71
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
72
|
+
"@storybook/addon-a11y": "^10.3.0",
|
|
73
|
+
"@storybook/addon-links": "^10.3.0",
|
|
74
|
+
"@storybook/addon-styling-webpack": "^3.0.0",
|
|
75
|
+
"@storybook/addon-webpack5-compiler-swc": "^4.0.2",
|
|
76
|
+
"@storybook/react-vite": "^10.3.0",
|
|
77
|
+
"@storybook/react-webpack5": "^10.3.0",
|
|
78
|
+
"@storybook/test-runner": "^0.24.3",
|
|
75
79
|
"@testing-library/jest-dom": "^6.9.1",
|
|
76
|
-
"@testing-library/react": "^16.3.
|
|
80
|
+
"@testing-library/react": "^16.3.2",
|
|
77
81
|
"@types/govuk-frontend": "^5.11.0",
|
|
78
82
|
"@types/jest": "^30.0.0",
|
|
79
|
-
"@types/react": "^19.2.
|
|
80
|
-
"@types/react-dom": "^19.2.
|
|
81
|
-
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
82
|
-
"@typescript-eslint/parser": "^8.36.0",
|
|
83
|
+
"@types/react": "^19.2.14",
|
|
84
|
+
"@types/react-dom": "^19.2.3",
|
|
83
85
|
"assert": "^2.1.0",
|
|
84
|
-
"autoprefixer": "^10.4.
|
|
85
|
-
"babel-jest": "^30.
|
|
86
|
+
"autoprefixer": "^10.4.27",
|
|
87
|
+
"babel-jest": "^30.3.0",
|
|
86
88
|
"bootstrap": "^5.3.8",
|
|
87
|
-
"chromatic": "^
|
|
88
|
-
"css-loader": "^7.1.
|
|
89
|
+
"chromatic": "^15.3.0",
|
|
90
|
+
"css-loader": "^7.1.4",
|
|
89
91
|
"deep-iterator": "^1.1.0",
|
|
90
92
|
"eslint": "^9.37.0",
|
|
91
93
|
"eslint-plugin-react": "^7.37.5",
|
|
92
|
-
"eslint-plugin-storybook": "^
|
|
93
|
-
"globals": "^
|
|
94
|
-
"govuk-frontend": "^
|
|
95
|
-
"html-react-parser": "^5.2.
|
|
94
|
+
"eslint-plugin-storybook": "^10.3.0",
|
|
95
|
+
"globals": "^17.4.0",
|
|
96
|
+
"govuk-frontend": "^6.1.0",
|
|
97
|
+
"html-react-parser": "^5.2.17",
|
|
96
98
|
"husky": "^9.1.7",
|
|
97
99
|
"identity-obj-proxy": "^3.0.0",
|
|
98
|
-
"jest": "^30.
|
|
99
|
-
"jest-environment-jsdom": "^30.
|
|
100
|
-
"magicast": "^0.
|
|
100
|
+
"jest": "^30.3.0",
|
|
101
|
+
"jest-environment-jsdom": "^30.3.0",
|
|
102
|
+
"magicast": "^0.5.2",
|
|
101
103
|
"pdfjs-dist": "^4.10.38",
|
|
102
|
-
"postcss": "^8.5.
|
|
103
|
-
"prettier": "^3.
|
|
104
|
-
"react": "^19.2.
|
|
104
|
+
"postcss": "^8.5.8",
|
|
105
|
+
"prettier": "^3.8.1",
|
|
106
|
+
"react": "^19.2.4",
|
|
105
107
|
"react-bootstrap": "^2.10.10",
|
|
106
|
-
"react-dom": "^19.2.
|
|
108
|
+
"react-dom": "^19.2.4",
|
|
107
109
|
"react-element-to-jsx-string": "^17.0.1",
|
|
108
|
-
"react-router": "^7.
|
|
109
|
-
"react-router-dom": "^7.
|
|
110
|
-
"rimraf": "^6.
|
|
111
|
-
"rollup": "^4.
|
|
110
|
+
"react-router": "^7.13.1",
|
|
111
|
+
"react-router-dom": "^7.13.1",
|
|
112
|
+
"rimraf": "^6.1.3",
|
|
113
|
+
"rollup": "^4.59.0",
|
|
112
114
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
113
|
-
"rollup-plugin-dts": "^6.
|
|
115
|
+
"rollup-plugin-dts": "^6.4.0",
|
|
114
116
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
115
117
|
"rollup-plugin-postcss": "^4.0.2",
|
|
116
118
|
"rollup-plugin-visualizer": "^6.0.4",
|
|
117
|
-
"sass": "^1.
|
|
118
|
-
"sass-loader": "^16.0.
|
|
119
|
+
"sass": "^1.98.0",
|
|
120
|
+
"sass-loader": "^16.0.7",
|
|
119
121
|
"standard-version": "^9.5.0",
|
|
120
|
-
"storybook": "^
|
|
122
|
+
"storybook": "^10.3.0",
|
|
121
123
|
"style-loader": "^4.0.0",
|
|
122
|
-
"stylelint": "^
|
|
123
|
-
"stylelint-config-
|
|
124
|
-
"stylelint-config-standard": "^
|
|
125
|
-
"stylelint-config-standard-scss": "^
|
|
126
|
-
"stylelint-order": "^7.0.
|
|
124
|
+
"stylelint": "^17.4.0",
|
|
125
|
+
"stylelint-config-recess-order": "^7.6.1",
|
|
126
|
+
"stylelint-config-standard": "^40.0.0",
|
|
127
|
+
"stylelint-config-standard-scss": "^17.0.0",
|
|
128
|
+
"stylelint-order": "^7.0.1",
|
|
127
129
|
"tslib": "^2.8.1",
|
|
128
130
|
"tsuml2": "^0.17.1",
|
|
129
131
|
"typescript": "^5.9.3",
|
|
130
|
-
"typescript-eslint": "^8.
|
|
131
|
-
"unplugin": "^
|
|
132
|
-
"webpack": "^5.
|
|
133
|
-
"@storybook/addon-docs": "^
|
|
132
|
+
"typescript-eslint": "^8.57.1",
|
|
133
|
+
"unplugin": "^3.0.0",
|
|
134
|
+
"webpack": "^5.105.4",
|
|
135
|
+
"@storybook/addon-docs": "^10.3.0"
|
|
134
136
|
},
|
|
135
137
|
"peerDependencies": {
|
|
136
|
-
"govuk-frontend": ">=5.
|
|
138
|
+
"govuk-frontend": ">=5.14.0",
|
|
137
139
|
"react": ">=18.2.0",
|
|
138
140
|
"react-dom": ">=18.2.0",
|
|
139
141
|
"react-router-dom": ">=6.30.0"
|