@i-dot-ai-npm/component-library-react 0.0.1 → 0.0.3
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/package.json +17 -6
- package/src/accordion/Accordion.tsx +3 -3
- package/src/accordion/AccordionSection.tsx +2 -2
- package/src/accordion/AccordionSectionContent.tsx +2 -2
- package/src/accordion/AccordionSectionHeader.tsx +2 -2
- package/src/accordion/AccordionSectionHeading.tsx +2 -2
- package/src/accordion/AccordionSectionSummary.tsx +2 -2
- package/src/back-link/BackLink.tsx +2 -2
- package/src/breadcrumbs/BreadcrumbItem.tsx +2 -2
- package/src/breadcrumbs/Breadcrumbs.tsx +2 -2
- package/src/button/Button.tsx +30 -9
- package/src/button-group/ButtonGroup.tsx +2 -2
- package/src/card/Card.tsx +2 -2
- package/src/card/CardContent.tsx +2 -2
- package/src/card/CardGroup.tsx +2 -2
- package/src/card/CardHeading.tsx +2 -2
- package/src/card/CardIcon.tsx +2 -2
- package/src/card/CardLink.tsx +2 -2
- package/src/character-count/CharacterCount.tsx +0 -2
- package/src/character-count/CharacterCountMessage.tsx +2 -2
- package/src/checkboxes/CheckboxConditional.tsx +24 -0
- package/src/checkboxes/CheckboxDivider.tsx +2 -2
- package/src/checkboxes/CheckboxInput.tsx +0 -2
- package/src/checkboxes/CheckboxItem.tsx +2 -2
- package/src/checkboxes/CheckboxLabel.tsx +2 -2
- package/src/checkboxes/Checkboxes.tsx +2 -2
- package/src/cookie-banner/CookieBanner.tsx +2 -2
- package/src/cookie-banner/CookieBannerActions.tsx +2 -2
- package/src/cookie-banner/CookieBannerContent.tsx +2 -2
- package/src/cookie-banner/CookieBannerHeading.tsx +2 -2
- package/src/cookie-banner/CookieBannerMessage.tsx +2 -2
- package/src/date-input/DateInput.tsx +2 -2
- package/src/date-input/DateInputField.tsx +1 -3
- package/src/date-input/DateInputItem.tsx +2 -2
- package/src/details/Details.tsx +2 -2
- package/src/details/DetailsSummary.tsx +2 -2
- package/src/details/DetailsText.tsx +2 -2
- package/src/error-message/ErrorMessage.tsx +7 -6
- package/src/error-summary/ErrorSummary.tsx +2 -2
- package/src/error-summary/ErrorSummaryBody.tsx +2 -2
- package/src/error-summary/ErrorSummaryItem.tsx +2 -2
- package/src/error-summary/ErrorSummaryList.tsx +2 -2
- package/src/error-summary/ErrorSummaryTitle.tsx +2 -2
- package/src/fieldset/Fieldset.tsx +2 -2
- package/src/fieldset/FieldsetLegend.tsx +2 -2
- package/src/file-upload/FileUpload.tsx +0 -2
- package/src/form-group/FormGroup.tsx +2 -2
- package/src/govuk-frontend.d.ts +13 -0
- package/src/header/Header.tsx +2 -2
- package/src/hint/Hint.tsx +2 -2
- package/src/index.ts +3 -1
- package/src/input/Input.tsx +0 -2
- package/src/input-label/InputLabel.tsx +2 -2
- package/src/inset-text/InsetText.tsx +2 -2
- package/src/link/Link.tsx +2 -2
- package/src/list/List.tsx +8 -8
- package/src/list/ListItem.tsx +2 -2
- package/src/notification-banner/NotificationBanner.tsx +8 -8
- package/src/notification-banner/NotificationBannerContent.tsx +2 -2
- package/src/notification-banner/NotificationBannerHeader.tsx +2 -2
- package/src/notification-banner/NotificationBannerHeading.tsx +2 -2
- package/src/notification-banner/NotificationBannerTitle.tsx +2 -2
- package/src/pagination/Pagination.tsx +2 -2
- package/src/pagination/PaginationItem.tsx +10 -10
- package/src/pagination/PaginationList.tsx +2 -2
- package/src/pagination/PaginationNext.tsx +2 -2
- package/src/pagination/PaginationPrev.tsx +2 -2
- package/src/password-input/PasswordInput.tsx +4 -4
- package/src/phase-banner/PhaseBanner.tsx +2 -2
- package/src/radios/RadioConditional.tsx +24 -0
- package/src/radios/RadioDivider.tsx +2 -2
- package/src/radios/RadioInput.tsx +0 -2
- package/src/radios/RadioItem.tsx +2 -2
- package/src/radios/RadioLabel.tsx +17 -0
- package/src/radios/Radios.tsx +2 -2
- package/src/select/Select.tsx +2 -2
- package/src/select/SelectOption.tsx +2 -2
- package/src/service-navigation/ServiceNavigation.tsx +2 -2
- package/src/service-navigation/ServiceNavigationItem.tsx +2 -2
- package/src/side-nav/SideNav.tsx +2 -2
- package/src/side-nav/SideNavItem.tsx +2 -2
- package/src/side-nav/SideNavList.tsx +2 -2
- package/src/side-nav/SideNavSubnavHeading.tsx +2 -2
- package/src/side-nav/SideNavSubnavList.tsx +2 -2
- package/src/side-nav/SideNavTitle.tsx +2 -2
- package/src/skip-link/SkipLink.tsx +2 -2
- package/src/summary-list/SummaryList.tsx +2 -2
- package/src/summary-list/SummaryListActions.tsx +2 -2
- package/src/summary-list/SummaryListKey.tsx +2 -2
- package/src/summary-list/SummaryListRow.tsx +2 -2
- package/src/summary-list/SummaryListValue.tsx +2 -2
- package/src/table/Table.tsx +6 -3
- package/src/table/TableBody.tsx +4 -2
- package/src/table/TableCaption.tsx +4 -2
- package/src/table/TableCell.tsx +11 -3
- package/src/table/TableHead.tsx +4 -2
- package/src/table/TableHeader.tsx +4 -2
- package/src/table/TableRow.tsx +4 -2
- package/src/tabs/Tab.tsx +2 -2
- package/src/tabs/TabPanel.tsx +2 -2
- package/src/tabs/Tabs.tsx +3 -3
- package/src/tabs/TabsList.tsx +2 -2
- package/src/tabs/TabsTitle.tsx +2 -2
- package/src/tag/Tag.tsx +4 -4
- package/src/task-list/TaskList.tsx +2 -2
- package/src/task-list/TaskListHint.tsx +2 -2
- package/src/task-list/TaskListItem.tsx +2 -2
- package/src/task-list/TaskListLink.tsx +2 -2
- package/src/task-list/TaskListNameAndHint.tsx +2 -2
- package/src/task-list/TaskListStatus.tsx +2 -2
- package/src/textarea/Textarea.tsx +3 -4
- package/src/toggle/Toggle.tsx +0 -2
- package/src/toggle/ToggleItem.tsx +2 -2
- package/src/toggle/ToggleLabel.tsx +2 -2
- package/src/warning-text/WarningText.tsx +2 -2
package/package.json
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i-dot-ai-npm/component-library-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "React components for i.AI GOV.UK (auto-generated from HTML specs).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
|
-
".":
|
|
8
|
-
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.ts",
|
|
9
|
+
"default": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"./*": {
|
|
12
|
+
"types": "./src/*",
|
|
13
|
+
"default": "./src/*"
|
|
14
|
+
}
|
|
9
15
|
},
|
|
16
|
+
"types": "./src/index.ts",
|
|
10
17
|
"files": [
|
|
11
18
|
"src"
|
|
12
19
|
],
|
|
13
20
|
"peerDependencies": {
|
|
21
|
+
"govuk-frontend": ">=6",
|
|
14
22
|
"react": ">=18",
|
|
15
|
-
"
|
|
23
|
+
"react-dom": ">=18"
|
|
16
24
|
},
|
|
17
25
|
"repository": {
|
|
18
26
|
"type": "git",
|
|
@@ -23,5 +31,8 @@
|
|
|
23
31
|
"access": "public",
|
|
24
32
|
"registry": "https://registry.npmjs.org"
|
|
25
33
|
},
|
|
26
|
-
"license": "MIT"
|
|
27
|
-
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"govuk-frontend": "^6.5.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
|
|
4
4
|
type AccordionProps = {
|
|
5
5
|
class?: string;
|
|
6
|
-
children?:
|
|
6
|
+
children?: ReactNode;
|
|
7
7
|
[key: string]: unknown;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export default function Accordion({ class: className, children, ...rest }: AccordionProps) {
|
|
11
|
-
const ref = useRef<
|
|
11
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
12
12
|
const classes = ["govuk-accordion", className ?? ""].filter(Boolean).join(" ");
|
|
13
13
|
useEffect(() => {
|
|
14
14
|
const el = ref.current;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type BreadcrumbsProps = {
|
|
4
4
|
inverse?: boolean;
|
|
5
5
|
collapseOnMobile?: boolean;
|
|
6
6
|
class?: string;
|
|
7
|
-
children?:
|
|
7
|
+
children?: ReactNode;
|
|
8
8
|
[key: string]: unknown;
|
|
9
9
|
};
|
|
10
10
|
|
package/src/button/Button.tsx
CHANGED
|
@@ -1,26 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type ButtonProps = {
|
|
4
4
|
secondary?: boolean;
|
|
5
|
+
tertiary?: boolean;
|
|
5
6
|
warning?: boolean;
|
|
6
7
|
inverse?: boolean;
|
|
8
|
+
small?: boolean;
|
|
9
|
+
startButton?: boolean;
|
|
7
10
|
href?: string;
|
|
11
|
+
type?: "button" | "reset" | "submit";
|
|
8
12
|
class?: string;
|
|
9
|
-
children?:
|
|
13
|
+
children?: ReactNode;
|
|
10
14
|
[key: string]: unknown;
|
|
11
15
|
};
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
const StartIcon = () => (
|
|
18
|
+
<svg
|
|
19
|
+
className="govuk-button__start-icon"
|
|
20
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
21
|
+
width="17.5"
|
|
22
|
+
height="19"
|
|
23
|
+
viewBox="0 0 33 40"
|
|
24
|
+
aria-hidden="true"
|
|
25
|
+
focusable="false"
|
|
26
|
+
>
|
|
27
|
+
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z" />
|
|
28
|
+
</svg>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export default function Button({ secondary, tertiary, warning, inverse, small, startButton, href, type, class: className, children, ...rest }: ButtonProps) {
|
|
32
|
+
const classes = ["govuk-button", secondary ? "govuk-button--secondary" : "", warning ? "govuk-button--warning" : "", inverse ? "govuk-button--inverse" : "", tertiary ? "govuk-button--tertiary" : "", small ? "govuk-button--small" : "", startButton ? "govuk-button--start" : "", className ?? ""].filter(Boolean).join(" ");
|
|
14
33
|
|
|
15
34
|
return (
|
|
16
35
|
href ? (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
36
|
+
<a href={href} role="button" draggable="false" className={classes} data-module="govuk-button" {...rest}>
|
|
37
|
+
{children ?? ""}
|
|
38
|
+
{startButton ? <StartIcon /> : null}
|
|
39
|
+
</a>
|
|
20
40
|
) : (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
41
|
+
<button type={type ?? "submit"} className={classes} data-module="govuk-button" {...rest}>
|
|
42
|
+
{children ?? ""}
|
|
43
|
+
{startButton ? <StartIcon /> : null}
|
|
44
|
+
</button>
|
|
24
45
|
)
|
|
25
46
|
);
|
|
26
47
|
}
|
package/src/card/Card.tsx
CHANGED
package/src/card/CardContent.tsx
CHANGED
package/src/card/CardGroup.tsx
CHANGED
package/src/card/CardHeading.tsx
CHANGED
package/src/card/CardIcon.tsx
CHANGED
package/src/card/CardLink.tsx
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type CheckboxConditionalProps = {
|
|
4
|
+
hidden?: boolean;
|
|
5
|
+
class?: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default function CheckboxConditional({ hidden = true, class: className, children, ...rest }: CheckboxConditionalProps) {
|
|
11
|
+
const classes = [
|
|
12
|
+
"govuk-checkboxes__conditional",
|
|
13
|
+
hidden ? "govuk-checkboxes__conditional--hidden" : "",
|
|
14
|
+
className ?? "",
|
|
15
|
+
]
|
|
16
|
+
.filter(Boolean)
|
|
17
|
+
.join(" ");
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className={classes} {...rest}>
|
|
21
|
+
{children ?? ""}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type CheckboxesProps = {
|
|
4
4
|
small?: boolean;
|
|
5
5
|
subtle?: boolean;
|
|
6
6
|
class?: string;
|
|
7
|
-
children?:
|
|
7
|
+
children?: ReactNode;
|
|
8
8
|
[key: string]: unknown;
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// AUTO-GENERATED from HTML spec. Do not edit by hand.
|
|
2
|
-
|
|
3
1
|
type DateInputFieldProps = {
|
|
4
2
|
width?: "2" | "3" | "4";
|
|
5
3
|
class?: string;
|
|
@@ -16,6 +14,6 @@ export default function DateInputField({ width = "2", class: className, ...rest
|
|
|
16
14
|
.join(" ");
|
|
17
15
|
|
|
18
16
|
return (
|
|
19
|
-
<input className={classes} type="text"
|
|
17
|
+
<input className={classes} type="text" inputMode="numeric" {...rest} />
|
|
20
18
|
);
|
|
21
19
|
}
|
package/src/details/Details.tsx
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
type ErrorMessageProps = {
|
|
4
|
+
visuallyHiddenText?: string;
|
|
4
5
|
class?: string;
|
|
5
|
-
children?:
|
|
6
|
+
children?: ReactNode;
|
|
6
7
|
[key: string]: unknown;
|
|
7
8
|
};
|
|
8
9
|
|
|
9
|
-
export default function ErrorMessage({ class: className, children, ...rest }: ErrorMessageProps) {
|
|
10
|
+
export default function ErrorMessage({ visuallyHiddenText = "Error", class: className, children, ...rest }: ErrorMessageProps) {
|
|
10
11
|
const classes = ["govuk-error-message", className ?? ""].filter(Boolean).join(" ");
|
|
11
12
|
|
|
12
13
|
return (
|
|
13
14
|
<p className={classes} {...rest}>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
{visuallyHiddenText ? (
|
|
16
|
+
<span className="govuk-visually-hidden">{visuallyHiddenText}:</span>
|
|
17
|
+
) : null}{" "}
|
|
17
18
|
{children ?? ""}
|
|
18
19
|
</p>
|
|
19
20
|
);
|