@i-dot-ai-npm/component-library-react 0.0.1

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.
Files changed (111) hide show
  1. package/package.json +27 -0
  2. package/src/accordion/Accordion.tsx +31 -0
  3. package/src/accordion/AccordionSection.tsx +17 -0
  4. package/src/accordion/AccordionSectionContent.tsx +17 -0
  5. package/src/accordion/AccordionSectionHeader.tsx +17 -0
  6. package/src/accordion/AccordionSectionHeading.tsx +19 -0
  7. package/src/accordion/AccordionSectionSummary.tsx +17 -0
  8. package/src/back-link/BackLink.tsx +24 -0
  9. package/src/breadcrumbs/BreadcrumbItem.tsx +20 -0
  10. package/src/breadcrumbs/Breadcrumbs.tsx +28 -0
  11. package/src/button/Button.tsx +26 -0
  12. package/src/button-group/ButtonGroup.tsx +17 -0
  13. package/src/card/Card.tsx +24 -0
  14. package/src/card/CardContent.tsx +17 -0
  15. package/src/card/CardGroup.tsx +17 -0
  16. package/src/card/CardHeading.tsx +17 -0
  17. package/src/card/CardIcon.tsx +17 -0
  18. package/src/card/CardLink.tsx +17 -0
  19. package/src/character-count/CharacterCount.tsx +14 -0
  20. package/src/character-count/CharacterCountMessage.tsx +17 -0
  21. package/src/checkboxes/CheckboxDivider.tsx +17 -0
  22. package/src/checkboxes/CheckboxInput.tsx +14 -0
  23. package/src/checkboxes/CheckboxItem.tsx +17 -0
  24. package/src/checkboxes/CheckboxLabel.tsx +17 -0
  25. package/src/checkboxes/Checkboxes.tsx +26 -0
  26. package/src/cookie-banner/CookieBanner.tsx +17 -0
  27. package/src/cookie-banner/CookieBannerActions.tsx +17 -0
  28. package/src/cookie-banner/CookieBannerContent.tsx +17 -0
  29. package/src/cookie-banner/CookieBannerHeading.tsx +17 -0
  30. package/src/cookie-banner/CookieBannerMessage.tsx +17 -0
  31. package/src/date-input/DateInput.tsx +17 -0
  32. package/src/date-input/DateInputField.tsx +21 -0
  33. package/src/date-input/DateInputItem.tsx +17 -0
  34. package/src/details/Details.tsx +17 -0
  35. package/src/details/DetailsSummary.tsx +19 -0
  36. package/src/details/DetailsText.tsx +17 -0
  37. package/src/error-message/ErrorMessage.tsx +20 -0
  38. package/src/error-summary/ErrorSummary.tsx +19 -0
  39. package/src/error-summary/ErrorSummaryBody.tsx +17 -0
  40. package/src/error-summary/ErrorSummaryItem.tsx +19 -0
  41. package/src/error-summary/ErrorSummaryList.tsx +17 -0
  42. package/src/error-summary/ErrorSummaryTitle.tsx +17 -0
  43. package/src/fieldset/Fieldset.tsx +17 -0
  44. package/src/fieldset/FieldsetLegend.tsx +24 -0
  45. package/src/file-upload/FileUpload.tsx +14 -0
  46. package/src/form-group/FormGroup.tsx +24 -0
  47. package/src/header/Header.tsx +24 -0
  48. package/src/hint/Hint.tsx +17 -0
  49. package/src/index.ts +110 -0
  50. package/src/input/Input.tsx +27 -0
  51. package/src/input-label/InputLabel.tsx +24 -0
  52. package/src/inset-text/InsetText.tsx +17 -0
  53. package/src/link/Link.tsx +28 -0
  54. package/src/list/List.tsx +24 -0
  55. package/src/list/ListItem.tsx +17 -0
  56. package/src/notification-banner/NotificationBanner.tsx +23 -0
  57. package/src/notification-banner/NotificationBannerContent.tsx +17 -0
  58. package/src/notification-banner/NotificationBannerHeader.tsx +17 -0
  59. package/src/notification-banner/NotificationBannerHeading.tsx +17 -0
  60. package/src/notification-banner/NotificationBannerTitle.tsx +17 -0
  61. package/src/pagination/Pagination.tsx +24 -0
  62. package/src/pagination/PaginationItem.tsx +26 -0
  63. package/src/pagination/PaginationList.tsx +17 -0
  64. package/src/pagination/PaginationNext.tsx +27 -0
  65. package/src/pagination/PaginationPrev.tsx +27 -0
  66. package/src/password-input/PasswordInput.tsx +20 -0
  67. package/src/phase-banner/PhaseBanner.tsx +19 -0
  68. package/src/radios/RadioDivider.tsx +17 -0
  69. package/src/radios/RadioInput.tsx +14 -0
  70. package/src/radios/RadioItem.tsx +17 -0
  71. package/src/radios/Radios.tsx +26 -0
  72. package/src/select/Select.tsx +26 -0
  73. package/src/select/SelectOption.tsx +17 -0
  74. package/src/service-navigation/ServiceNavigation.tsx +34 -0
  75. package/src/service-navigation/ServiceNavigationItem.tsx +20 -0
  76. package/src/side-nav/SideNav.tsx +17 -0
  77. package/src/side-nav/SideNavItem.tsx +20 -0
  78. package/src/side-nav/SideNavList.tsx +17 -0
  79. package/src/side-nav/SideNavSubnavHeading.tsx +17 -0
  80. package/src/side-nav/SideNavSubnavList.tsx +17 -0
  81. package/src/side-nav/SideNavTitle.tsx +17 -0
  82. package/src/skip-link/SkipLink.tsx +17 -0
  83. package/src/summary-list/SummaryList.tsx +24 -0
  84. package/src/summary-list/SummaryListActions.tsx +17 -0
  85. package/src/summary-list/SummaryListKey.tsx +17 -0
  86. package/src/summary-list/SummaryListRow.tsx +24 -0
  87. package/src/summary-list/SummaryListValue.tsx +17 -0
  88. package/src/table/Table.tsx +26 -0
  89. package/src/table/TableBody.tsx +17 -0
  90. package/src/table/TableCaption.tsx +24 -0
  91. package/src/table/TableCell.tsx +24 -0
  92. package/src/table/TableHead.tsx +17 -0
  93. package/src/table/TableHeader.tsx +24 -0
  94. package/src/table/TableRow.tsx +17 -0
  95. package/src/tabs/Tab.tsx +20 -0
  96. package/src/tabs/TabPanel.tsx +24 -0
  97. package/src/tabs/Tabs.tsx +31 -0
  98. package/src/tabs/TabsList.tsx +17 -0
  99. package/src/tabs/TabsTitle.tsx +17 -0
  100. package/src/tag/Tag.tsx +24 -0
  101. package/src/task-list/TaskList.tsx +17 -0
  102. package/src/task-list/TaskListHint.tsx +17 -0
  103. package/src/task-list/TaskListItem.tsx +24 -0
  104. package/src/task-list/TaskListLink.tsx +17 -0
  105. package/src/task-list/TaskListNameAndHint.tsx +17 -0
  106. package/src/task-list/TaskListStatus.tsx +17 -0
  107. package/src/textarea/Textarea.tsx +23 -0
  108. package/src/toggle/Toggle.tsx +16 -0
  109. package/src/toggle/ToggleItem.tsx +17 -0
  110. package/src/toggle/ToggleLabel.tsx +17 -0
  111. package/src/warning-text/WarningText.tsx +25 -0
@@ -0,0 +1,24 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TableCaptionProps = {
4
+ size?: "small" | "medium" | "large" | "xl";
5
+ class?: string;
6
+ children?: React.ReactNode;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function TableCaption({ size, class: className, children, ...rest }: TableCaptionProps) {
11
+ const classes = [
12
+ "govuk-table__caption",
13
+ ({ "small": "govuk-table__caption--s", "medium": "govuk-table__caption--m", "large": "govuk-table__caption--l", "xl": "govuk-table__caption--xl" }[size] ?? ""),
14
+ className ?? "",
15
+ ]
16
+ .filter(Boolean)
17
+ .join(" ");
18
+
19
+ return (
20
+ <caption className={classes} {...rest}>
21
+ {children ?? ""}
22
+ </caption>
23
+ );
24
+ }
@@ -0,0 +1,24 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TableCellProps = {
4
+ numeric?: boolean;
5
+ class?: string;
6
+ children?: React.ReactNode;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function TableCell({ numeric, class: className, children, ...rest }: TableCellProps) {
11
+ const classes = [
12
+ "govuk-table__cell",
13
+ numeric ? "govuk-table__cell--numeric" : "",
14
+ className ?? "",
15
+ ]
16
+ .filter(Boolean)
17
+ .join(" ");
18
+
19
+ return (
20
+ <td className={classes} {...rest}>
21
+ {children ?? ""}
22
+ </td>
23
+ );
24
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TableHeadProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TableHead({ class: className, children, ...rest }: TableHeadProps) {
10
+ const classes = ["govuk-table__head", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <thead className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </thead>
16
+ );
17
+ }
@@ -0,0 +1,24 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TableHeaderProps = {
4
+ numeric?: boolean;
5
+ class?: string;
6
+ children?: React.ReactNode;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function TableHeader({ numeric, class: className, children, ...rest }: TableHeaderProps) {
11
+ const classes = [
12
+ "govuk-table__header",
13
+ numeric ? "govuk-table__header--numeric" : "",
14
+ className ?? "",
15
+ ]
16
+ .filter(Boolean)
17
+ .join(" ");
18
+
19
+ return (
20
+ <th className={classes} scope="col" {...rest}>
21
+ {children ?? ""}
22
+ </th>
23
+ );
24
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TableRowProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TableRow({ class: className, children, ...rest }: TableRowProps) {
10
+ const classes = ["govuk-table__row", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <tr className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </tr>
16
+ );
17
+ }
@@ -0,0 +1,20 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TabProps = {
4
+ selected?: boolean;
5
+ class?: string;
6
+ children?: React.ReactNode;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function Tab({ selected, class: className, children, ...rest }: TabProps) {
11
+ const classes = ["govuk-tabs__tab", className ?? ""].filter(Boolean).join(" ");
12
+
13
+ return (
14
+ <li className={["govuk-tabs__list-item", selected ? "govuk-tabs__list-item--selected" : ""].filter(Boolean).join(" ")}>
15
+ <a className={classes} {...rest}>
16
+ {children ?? ""}
17
+ </a>
18
+ </li>
19
+ );
20
+ }
@@ -0,0 +1,24 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TabPanelProps = {
4
+ hidden?: boolean;
5
+ class?: string;
6
+ children?: React.ReactNode;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function TabPanel({ hidden, class: className, children, ...rest }: TabPanelProps) {
11
+ const classes = [
12
+ "govuk-tabs__panel",
13
+ hidden ? "govuk-tabs__panel--hidden" : "",
14
+ className ?? "",
15
+ ]
16
+ .filter(Boolean)
17
+ .join(" ");
18
+
19
+ return (
20
+ <div className={classes} {...rest}>
21
+ {children ?? ""}
22
+ </div>
23
+ );
24
+ }
@@ -0,0 +1,31 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+ import { useEffect, useRef } from "react";
3
+
4
+ type TabsProps = {
5
+ class?: string;
6
+ children?: React.ReactNode;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function Tabs({ class: className, children, ...rest }: TabsProps) {
11
+ const ref = useRef<HTMLElement>(null);
12
+ const classes = ["govuk-tabs", className ?? ""].filter(Boolean).join(" ");
13
+ useEffect(() => {
14
+ const el = ref.current;
15
+ if (!el) return;
16
+ // Dynamic import keeps govuk-frontend out of SSR (it touches
17
+ // HTMLElement at module load, which is undefined in Node).
18
+ void import("govuk-frontend").then(({ Tabs }) => {
19
+ if (!ref.current) return;
20
+ // Guard double-init (govuk stamps data-<module>-init).
21
+ if (ref.current.hasAttribute(`data-${Tabs.moduleName}-init`)) return;
22
+ new Tabs(ref.current);
23
+ });
24
+ }, []);
25
+
26
+ return (
27
+ <div className={classes} data-module="govuk-tabs" ref={ref} {...rest}>
28
+ {children ?? ""}
29
+ </div>
30
+ );
31
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TabsListProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TabsList({ class: className, children, ...rest }: TabsListProps) {
10
+ const classes = ["govuk-tabs__list", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <ul className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </ul>
16
+ );
17
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TabsTitleProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TabsTitle({ class: className, children, ...rest }: TabsTitleProps) {
10
+ const classes = ["govuk-tabs__title", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <h2 className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </h2>
16
+ );
17
+ }
@@ -0,0 +1,24 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TagProps = {
4
+ colour?: "grey" | "green" | "turquoise" | "blue" | "light-blue" | "purple" | "pink" | "red" | "orange" | "yellow";
5
+ class?: string;
6
+ children?: React.ReactNode;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function Tag({ colour, class: className, children, ...rest }: TagProps) {
11
+ const classes = [
12
+ "govuk-tag",
13
+ ({ "grey": "govuk-tag--grey", "green": "govuk-tag--green", "turquoise": "govuk-tag--turquoise", "blue": "govuk-tag--blue", "light-blue": "govuk-tag--light-blue", "purple": "govuk-tag--purple", "pink": "govuk-tag--pink", "red": "govuk-tag--red", "orange": "govuk-tag--orange", "yellow": "govuk-tag--yellow" }[colour] ?? ""),
14
+ className ?? "",
15
+ ]
16
+ .filter(Boolean)
17
+ .join(" ");
18
+
19
+ return (
20
+ <strong className={classes} {...rest}>
21
+ {children ?? ""}
22
+ </strong>
23
+ );
24
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TaskListProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TaskList({ class: className, children, ...rest }: TaskListProps) {
10
+ const classes = ["govuk-task-list", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <ul className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </ul>
16
+ );
17
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TaskListHintProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TaskListHint({ class: className, children, ...rest }: TaskListHintProps) {
10
+ const classes = ["govuk-task-list__hint", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <div className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,24 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TaskListItemProps = {
4
+ withLink?: boolean;
5
+ class?: string;
6
+ children?: React.ReactNode;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function TaskListItem({ withLink, class: className, children, ...rest }: TaskListItemProps) {
11
+ const classes = [
12
+ "govuk-task-list__item",
13
+ withLink ? "govuk-task-list__item--with-link" : "",
14
+ className ?? "",
15
+ ]
16
+ .filter(Boolean)
17
+ .join(" ");
18
+
19
+ return (
20
+ <li className={classes} {...rest}>
21
+ {children ?? ""}
22
+ </li>
23
+ );
24
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TaskListLinkProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TaskListLink({ class: className, children, ...rest }: TaskListLinkProps) {
10
+ const classes = ["govuk-link govuk-task-list__link", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <a className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </a>
16
+ );
17
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TaskListNameAndHintProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TaskListNameAndHint({ class: className, children, ...rest }: TaskListNameAndHintProps) {
10
+ const classes = ["govuk-task-list__name-and-hint", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <div className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TaskListStatusProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function TaskListStatus({ class: className, children, ...rest }: TaskListStatusProps) {
10
+ const classes = ["govuk-task-list__status", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <div className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,23 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type TextareaProps = {
4
+ error?: boolean;
5
+ subtle?: boolean;
6
+ class?: string;
7
+ [key: string]: unknown;
8
+ };
9
+
10
+ export default function Textarea({ error, subtle, class: className, ...rest }: TextareaProps) {
11
+ const classes = [
12
+ "govuk-textarea",
13
+ error ? "govuk-textarea--error" : "",
14
+ subtle ? "govuk-textarea--subtle" : "",
15
+ className ?? "",
16
+ ]
17
+ .filter(Boolean)
18
+ .join(" ");
19
+
20
+ return (
21
+ <textarea className={classes} {...rest}></textarea>
22
+ );
23
+ }
@@ -0,0 +1,16 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type ToggleProps = {
4
+ class?: string;
5
+ [key: string]: unknown;
6
+ };
7
+
8
+ export default function Toggle({ class: className, ...rest }: ToggleProps) {
9
+ const classes = ["iai-toggle__input", className ?? ""].filter(Boolean).join(" ");
10
+
11
+ return (
12
+ <div className="iai-toggle">
13
+ <input className={classes} type="checkbox" {...rest} />
14
+ </div>
15
+ );
16
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type ToggleItemProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function ToggleItem({ class: className, children, ...rest }: ToggleItemProps) {
10
+ const classes = ["iai-toggle__item", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <div className={classes} data-module="govuk-toggle" {...rest}>
14
+ {children ?? ""}
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,17 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type ToggleLabelProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function ToggleLabel({ class: className, children, ...rest }: ToggleLabelProps) {
10
+ const classes = ["govuk-label iai-toggle__label", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <label className={classes} {...rest}>
14
+ {children ?? ""}
15
+ </label>
16
+ );
17
+ }
@@ -0,0 +1,25 @@
1
+ // AUTO-GENERATED from HTML spec. Do not edit by hand.
2
+
3
+ type WarningTextProps = {
4
+ class?: string;
5
+ children?: React.ReactNode;
6
+ [key: string]: unknown;
7
+ };
8
+
9
+ export default function WarningText({ class: className, children, ...rest }: WarningTextProps) {
10
+ const classes = ["govuk-warning-text", className ?? ""].filter(Boolean).join(" ");
11
+
12
+ return (
13
+ <div className={classes} {...rest}>
14
+ <span className="govuk-warning-text__icon" aria-hidden="true">
15
+ !
16
+ </span>
17
+ <strong className="govuk-warning-text__text">
18
+ <span className="govuk-visually-hidden">
19
+ Warning
20
+ </span>
21
+ {children ?? ""}
22
+ </strong>
23
+ </div>
24
+ );
25
+ }