@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
package/dist/index.d.ts
CHANGED
|
@@ -162,6 +162,26 @@ interface CardColumnProps {
|
|
|
162
162
|
link: string;
|
|
163
163
|
header: string;
|
|
164
164
|
body: string;
|
|
165
|
+
/**
|
|
166
|
+
* Text colour of the card header in its resting state.
|
|
167
|
+
*
|
|
168
|
+
* Defaults to the GOV.UK brand colour via the CSS custom property set by
|
|
169
|
+
* govuk-functional-colour("brand") in the SCSS — so if you've overridden
|
|
170
|
+
* $govuk-functional-colours at the Sass level, this default will follow.
|
|
171
|
+
*
|
|
172
|
+
* Pass an explicit value only when you need a per-instance override that
|
|
173
|
+
* sits outside the govuk-frontend theming system.
|
|
174
|
+
*/
|
|
175
|
+
textColor?: string;
|
|
176
|
+
/**
|
|
177
|
+
* Background colour applied to the card header on hover.
|
|
178
|
+
*
|
|
179
|
+
* Defaults to the GOV.UK header background colour via the CSS custom
|
|
180
|
+
* property set by govuk-functional-colour("header-background") in the SCSS.
|
|
181
|
+
*
|
|
182
|
+
* Pass an explicit value only when you need a per-instance override.
|
|
183
|
+
*/
|
|
184
|
+
hoverColor?: string;
|
|
165
185
|
}
|
|
166
186
|
|
|
167
187
|
declare const CardColumn: React$1.FC<CardColumnProps>;
|
|
@@ -221,11 +241,36 @@ declare const CookieBanner: React$1.FC<CookieBannerProps & HTMLAttributes<HTMLDi
|
|
|
221
241
|
interface DataNavigationProps {
|
|
222
242
|
dataId: number;
|
|
223
243
|
setDataFocus: (id: number) => void;
|
|
224
|
-
previousText
|
|
244
|
+
previousText?: string;
|
|
225
245
|
previousCondition: boolean;
|
|
226
|
-
nextText
|
|
246
|
+
nextText?: string;
|
|
227
247
|
nextCondition: boolean;
|
|
228
248
|
dataDescription?: string;
|
|
249
|
+
/**
|
|
250
|
+
* Background colour of the navigation buttons in their resting state.
|
|
251
|
+
* Defaults to govuk-functional-colour("brand") (#1d70b8).
|
|
252
|
+
*/
|
|
253
|
+
buttonColour?: string;
|
|
254
|
+
/**
|
|
255
|
+
* Text colour of the navigation buttons in their resting state.
|
|
256
|
+
* Defaults to govuk-colour("white") (#ffffff).
|
|
257
|
+
*/
|
|
258
|
+
buttonTextColour?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Shadow colour of the navigation buttons.
|
|
261
|
+
* Defaults to govuk-colour("black") (#0b0c0c).
|
|
262
|
+
*/
|
|
263
|
+
buttonShadowColour?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Background colour of the navigation buttons on hover.
|
|
266
|
+
* Defaults to govuk-functional-colour("focus") (#ffdd00).
|
|
267
|
+
*/
|
|
268
|
+
buttonHoverColour?: string;
|
|
269
|
+
/**
|
|
270
|
+
* Text colour of the navigation buttons on hover.
|
|
271
|
+
* Defaults to govuk-functional-colour("focus-text") (#0b0c0c).
|
|
272
|
+
*/
|
|
273
|
+
buttonHoverTextColour?: string;
|
|
229
274
|
}
|
|
230
275
|
|
|
231
276
|
declare const DataNavigation: React$1.FC<DataNavigationProps>;
|
|
@@ -273,6 +318,31 @@ interface DifferenceNavigationProps {
|
|
|
273
318
|
totalDifferences: number;
|
|
274
319
|
keyword?: string;
|
|
275
320
|
plural?: string;
|
|
321
|
+
/**
|
|
322
|
+
* Background colour of the navigation buttons in their resting state.
|
|
323
|
+
* Defaults to govuk-functional-colour("brand") (#1d70b8).
|
|
324
|
+
*/
|
|
325
|
+
buttonColour?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Text colour of the navigation buttons in their resting state.
|
|
328
|
+
* Defaults to govuk-colour("white") (#ffffff).
|
|
329
|
+
*/
|
|
330
|
+
buttonTextColour?: string;
|
|
331
|
+
/**
|
|
332
|
+
* Shadow colour of the navigation buttons.
|
|
333
|
+
* Defaults to govuk-colour("black") (#0b0c0c).
|
|
334
|
+
*/
|
|
335
|
+
buttonShadowColour?: string;
|
|
336
|
+
/**
|
|
337
|
+
* Background colour of the navigation buttons on hover.
|
|
338
|
+
* Defaults to govuk-functional-colour("focus") (#ffdd00).
|
|
339
|
+
*/
|
|
340
|
+
buttonHoverColour?: string;
|
|
341
|
+
/**
|
|
342
|
+
* Text colour of the navigation buttons on hover.
|
|
343
|
+
* Defaults to govuk-functional-colour("focus-text") (#0b0c0c).
|
|
344
|
+
*/
|
|
345
|
+
buttonHoverTextColour?: string;
|
|
276
346
|
}
|
|
277
347
|
|
|
278
348
|
declare const DifferenceNavigation: React$1.FC<DifferenceNavigationProps>;
|
|
@@ -315,6 +385,27 @@ declare const ErrorSummary: React$1.FC<ErrorSummaryProps>;
|
|
|
315
385
|
|
|
316
386
|
declare function ConfigureOverallErrorSummary($scope?: Document | Element, config?: ErrorSummaryConfig): void;
|
|
317
387
|
|
|
388
|
+
interface ExitThisPageProps extends HTMLAttributes<HTMLDivElement> {
|
|
389
|
+
/** Button label — defaults to "Exit this page". Maps from fixture `text`/`html` via processExampleData → children */
|
|
390
|
+
children?: ReactNode;
|
|
391
|
+
/** Additional CSS classes for the wrapper div. Maps from fixture `classes` → className */
|
|
392
|
+
className?: string;
|
|
393
|
+
/** URL the button links to. Defaults to "https://www.bbc.co.uk/weather" */
|
|
394
|
+
redirectUrl?: string;
|
|
395
|
+
/** i18n: text announced when the page exit is activated */
|
|
396
|
+
activatedText?: string;
|
|
397
|
+
/** i18n: text announced when the keyboard shortcut times out */
|
|
398
|
+
timedOutText?: string;
|
|
399
|
+
/** i18n: text announced when the shortcut still needs two more presses */
|
|
400
|
+
pressTwoMoreTimesText?: string;
|
|
401
|
+
/** i18n: text announced when the shortcut needs one more press */
|
|
402
|
+
pressOneMoreTimeText?: string;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
declare const ExitThisPage: React$1.FC<ExitThisPageProps>;
|
|
406
|
+
|
|
407
|
+
declare function ConfigureOverallExitThisPage($scope?: Document | Element): void;
|
|
408
|
+
|
|
318
409
|
declare const Fieldset: React$1.FC<FieldsetProps>;
|
|
319
410
|
|
|
320
411
|
interface FileUploadProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
@@ -357,11 +448,18 @@ interface Meta {
|
|
|
357
448
|
items?: MetaItem[];
|
|
358
449
|
children?: React.ReactNode;
|
|
359
450
|
}
|
|
451
|
+
interface ContentLicence {
|
|
452
|
+
className?: string;
|
|
453
|
+
children: React.ReactNode;
|
|
454
|
+
reactListKey?: string | number;
|
|
455
|
+
[key: string]: unknown;
|
|
456
|
+
}
|
|
360
457
|
interface FooterProps extends HTMLAttributes<HTMLElement> {
|
|
361
458
|
className?: string;
|
|
362
459
|
containerClassName?: string;
|
|
363
460
|
meta?: Meta;
|
|
364
461
|
navigation?: NavigationItem$2[];
|
|
462
|
+
contentLicence?: ContentLicence;
|
|
365
463
|
}
|
|
366
464
|
|
|
367
465
|
declare const Footer: React$1.FC<FooterProps>;
|
|
@@ -480,21 +578,39 @@ interface NotificationBannerProps {
|
|
|
480
578
|
|
|
481
579
|
declare const NotificationBanner: React$1.FC<NotificationBannerProps>;
|
|
482
580
|
|
|
581
|
+
interface PaginationItemProps {
|
|
582
|
+
/** Page number or label (e.g. 1, "one"). Omit when ellipsis is true. */
|
|
583
|
+
number?: number | string;
|
|
584
|
+
href?: string;
|
|
585
|
+
current?: boolean;
|
|
586
|
+
ellipsis?: boolean;
|
|
587
|
+
}
|
|
588
|
+
interface PaginationNavProps {
|
|
589
|
+
href: string;
|
|
590
|
+
/** Override the default "Previous" / "Next" link text.
|
|
591
|
+
* Populated automatically from fixture `text` by ProcessExampleData (text → children). */
|
|
592
|
+
children?: React.ReactNode;
|
|
593
|
+
/** Secondary label rendered below the link title (block-layout mode). */
|
|
594
|
+
labelText?: string;
|
|
595
|
+
}
|
|
483
596
|
interface PaginationProps {
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
currentPage: number;
|
|
488
|
-
pageSize: number;
|
|
597
|
+
previous?: PaginationNavProps;
|
|
598
|
+
next?: PaginationNavProps;
|
|
599
|
+
items?: PaginationItemProps[];
|
|
489
600
|
className?: string;
|
|
490
|
-
previousName?: string;
|
|
491
|
-
previousChildren?: React.ReactNode;
|
|
492
|
-
nextName?: string;
|
|
493
|
-
nextChildren?: React.ReactNode;
|
|
494
601
|
}
|
|
495
602
|
|
|
496
603
|
declare const Pagination: React$1.FC<PaginationProps>;
|
|
497
604
|
|
|
605
|
+
declare const DOTS = "...";
|
|
606
|
+
interface UsePaginationProps {
|
|
607
|
+
totalCount: number;
|
|
608
|
+
pageSize: number;
|
|
609
|
+
siblingCount?: number;
|
|
610
|
+
currentPage: number;
|
|
611
|
+
}
|
|
612
|
+
declare const UsePagination: ({ totalCount, pageSize, siblingCount, currentPage, }: UsePaginationProps) => (number | string)[] | undefined;
|
|
613
|
+
|
|
498
614
|
interface PanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
499
615
|
headingLevel?: ElementType;
|
|
500
616
|
className?: string;
|
|
@@ -504,6 +620,60 @@ interface PanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
504
620
|
|
|
505
621
|
declare const Panel: React$1.FC<PanelProps>;
|
|
506
622
|
|
|
623
|
+
interface PasswordInputLabelProps {
|
|
624
|
+
children?: React.ReactNode;
|
|
625
|
+
className?: string;
|
|
626
|
+
isPageHeading?: boolean;
|
|
627
|
+
[key: string]: unknown;
|
|
628
|
+
}
|
|
629
|
+
interface PasswordInputProps {
|
|
630
|
+
/** Additional CSS classes for the `<input>` element. Maps from fixture `classes` → className */
|
|
631
|
+
className?: string;
|
|
632
|
+
/** Pre-existing aria-describedby value to prepend */
|
|
633
|
+
"aria-describedby"?: string;
|
|
634
|
+
/** Error message sub-object — `{ children }` after processExampleData transforms `text` */
|
|
635
|
+
errorMessage?: {
|
|
636
|
+
children?: React.ReactNode;
|
|
637
|
+
[key: string]: unknown;
|
|
638
|
+
};
|
|
639
|
+
/** Wrapper div options */
|
|
640
|
+
formGroup?: {
|
|
641
|
+
className?: string;
|
|
642
|
+
[key: string]: unknown;
|
|
643
|
+
};
|
|
644
|
+
/** Hint sub-object — `{ children }` after processExampleData transforms `text` */
|
|
645
|
+
hint?: {
|
|
646
|
+
children?: React.ReactNode;
|
|
647
|
+
[key: string]: unknown;
|
|
648
|
+
};
|
|
649
|
+
/** Label sub-object — `{ children, className, isPageHeading }` */
|
|
650
|
+
label?: PasswordInputLabelProps;
|
|
651
|
+
/** Input name attribute */
|
|
652
|
+
name?: string;
|
|
653
|
+
/** Input id attribute — also used to link label and aria-describedby */
|
|
654
|
+
id?: string;
|
|
655
|
+
/** autocomplete attribute — defaults to "current-password" */
|
|
656
|
+
autoComplete?: string;
|
|
657
|
+
/** i18n: label for the show-password button (default: "Show") */
|
|
658
|
+
showPasswordText?: string;
|
|
659
|
+
/** i18n: label for the hide-password button (default: "Hide") */
|
|
660
|
+
hidePasswordText?: string;
|
|
661
|
+
/** i18n: aria-label for the show-password button */
|
|
662
|
+
showPasswordAriaLabelText?: string;
|
|
663
|
+
/** i18n: aria-label for the hide-password button */
|
|
664
|
+
hidePasswordAriaLabelText?: string;
|
|
665
|
+
/** i18n: text announced when the password becomes visible */
|
|
666
|
+
passwordShownAnnouncementText?: string;
|
|
667
|
+
/** i18n: text announced when the password is hidden */
|
|
668
|
+
passwordHiddenAnnouncementText?: string;
|
|
669
|
+
/** Allow pass-through of any other HTML input attributes */
|
|
670
|
+
[key: string]: unknown;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
declare const PasswordInput: React$1.FC<PasswordInputProps & React$1.InputHTMLAttributes<HTMLInputElement>>;
|
|
674
|
+
|
|
675
|
+
declare function ConfigureOverallPasswordInput($scope?: Document | Element): void;
|
|
676
|
+
|
|
507
677
|
interface PDFJsProps {
|
|
508
678
|
iframeId: string;
|
|
509
679
|
source: string;
|
|
@@ -740,4 +910,5 @@ interface WarningTextProps {
|
|
|
740
910
|
|
|
741
911
|
declare const WarningText: React$1.FC<WarningTextProps & HTMLAttributes<HTMLDivElement>>;
|
|
742
912
|
|
|
743
|
-
export { Accordion, ActionLink, BackLink, Boolean, Breadcrumbs, Button, CardColumn, CardLayout, CharacterCount, Checkboxes as Checkbox, ConfigureOverallAccordion, ConfigureOverallButton, ConfigureOverallCheckboxes, ConfigureOverallErrorSummary, ConfigureOverallHeader, ConfigureOverallRadios, ConfigureOverallSkipLink, ConfigureOverallTabs, CookieBanner, DataNavigation, DateInput, Details, DifferenceNavigation, ErrorBoundary, ErrorMessage, ErrorSummary, ExtractAccordionConfigFromAttributes, Fieldset, FileUpload, Footer, Header, Hint, Input, InsetText, Label, Landing, LinkWithRef, Loading, Main, NotFoundPage, NotificationBanner, PDFViewer, PDFViewerBackend, Pagination, Panel, PhaseBanner, ProblemWithService, Radios, Select, ServiceNavigation, SkipLink, SummaryList, Table, Tabs, Tag, TaskList, Textarea, WarningInfo, WarningText };
|
|
913
|
+
export { Accordion, ActionLink, BackLink, Boolean, Breadcrumbs, Button, CardColumn, CardLayout, CharacterCount, Checkboxes as Checkbox, ConfigureOverallAccordion, ConfigureOverallButton, ConfigureOverallCheckboxes, ConfigureOverallErrorSummary, ConfigureOverallExitThisPage, ConfigureOverallHeader, ConfigureOverallPasswordInput, ConfigureOverallRadios, ConfigureOverallSkipLink, ConfigureOverallTabs, CookieBanner, DOTS, DataNavigation, DateInput, Details, DifferenceNavigation, ErrorBoundary, ErrorMessage, ErrorSummary, ExitThisPage, ExtractAccordionConfigFromAttributes, Fieldset, FileUpload, Footer, Header, Hint, Input, InsetText, Label, Landing, LinkWithRef, Loading, Main, NotFoundPage, NotificationBanner, PDFViewer, PDFViewerBackend, Pagination, Panel, PasswordInput, PhaseBanner, ProblemWithService, Radios, Select, ServiceNavigation, SkipLink, SummaryList, Table, Tabs, Tag, TaskList, Textarea, UsePagination, WarningInfo, WarningText };
|
|
914
|
+
export type { PaginationItemProps, PaginationNavProps, PaginationProps };
|
package/dist/index.esm.css
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
2
9
|
/*!
|
|
3
10
|
* Bootstrap v5.3.8 (https://getbootstrap.com/)
|
|
4
11
|
* Copyright 2011-2025 The Bootstrap Authors
|
|
@@ -11860,26 +11867,26 @@ textarea.form-control-lg {
|
|
|
11860
11867
|
}
|
|
11861
11868
|
}
|
|
11862
11869
|
.card-link {
|
|
11863
|
-
color: #
|
|
11870
|
+
color: var(--card-text-color, var(--govuk-link-colour, #1a65a6));
|
|
11864
11871
|
}
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
border-color: #
|
|
11868
|
-
color: #003078;
|
|
11872
|
+
.card-link:hover {
|
|
11873
|
+
color: var(--card-hover-color, var(--govuk-link-hover-colour, #0f385c));
|
|
11874
|
+
border-color: var(--govuk-focus-colour, #ffdd00);
|
|
11869
11875
|
}
|
|
11870
11876
|
|
|
11871
11877
|
.card-header {
|
|
11872
11878
|
padding-bottom: 65px;
|
|
11873
|
-
color: #
|
|
11879
|
+
color: var(--card-text-color, var(--govuk-brand-colour, #1d70b8));
|
|
11880
|
+
transition-duration: 0.3s;
|
|
11874
11881
|
}
|
|
11875
11882
|
.card-header:hover {
|
|
11876
|
-
|
|
11877
|
-
color: #
|
|
11878
|
-
transition-duration: 0.3s;
|
|
11883
|
+
color: #ffffff;
|
|
11884
|
+
background-color: var(--card-hover-color, #0b0c0c);
|
|
11879
11885
|
}
|
|
11880
11886
|
.card-header:active {
|
|
11881
|
-
|
|
11882
|
-
background-color:
|
|
11887
|
+
color: var(--govuk-focus-text-colour, #0b0c0c);
|
|
11888
|
+
background-color: var(--govuk-focus-colour, #ffdd00);
|
|
11889
|
+
border-bottom: var(--govuk-focus-text-colour, #0b0c0c) groove;
|
|
11883
11890
|
transition: ease-in-out;
|
|
11884
11891
|
}
|
|
11885
11892
|
|
|
@@ -11950,24 +11957,24 @@ textarea.form-control-lg {
|
|
|
11950
11957
|
.loading-wheel-2 {
|
|
11951
11958
|
width: 1em;
|
|
11952
11959
|
height: 1em;
|
|
11953
|
-
border-radius: 50%;
|
|
11954
11960
|
margin: 40px;
|
|
11955
|
-
animation: loading-frames 1.1s infinite ease;
|
|
11956
11961
|
font-size: 8px;
|
|
11957
11962
|
text-indent: -9999em;
|
|
11963
|
+
border-radius: 50%;
|
|
11958
11964
|
transform: translateZ(0);
|
|
11965
|
+
animation: loading-frames 1.1s infinite ease;
|
|
11959
11966
|
}
|
|
11960
11967
|
|
|
11961
11968
|
.loading-wheel {
|
|
11962
11969
|
width: 1em;
|
|
11963
11970
|
height: 1em;
|
|
11964
|
-
border-radius: 50%;
|
|
11965
11971
|
margin: 40px;
|
|
11966
11972
|
margin-left: 25px;
|
|
11967
|
-
animation: loading-frames 1.1s infinite ease;
|
|
11968
11973
|
font-size: 8px;
|
|
11969
11974
|
text-indent: -9999em;
|
|
11975
|
+
border-radius: 50%;
|
|
11970
11976
|
transform: translateZ(0);
|
|
11977
|
+
animation: loading-frames 1.1s infinite ease;
|
|
11971
11978
|
}
|
|
11972
11979
|
|
|
11973
11980
|
.head-space {
|