@i-dot-ai-npm/component-library-react 0.0.9 → 0.0.11
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 +2 -2
- package/src/footer/Footer.tsx +3 -3
- package/src/index.ts +1 -0
- package/src/modal/Modal.tsx +4 -8
- package/src/table/TableSearchAndFilter.tsx +18 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i-dot-ai-npm/component-library-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "React components for i.AI GOV.UK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "git+https://github.com/i-dot-ai/
|
|
31
|
+
"url": "git+https://github.com/i-dot-ai/design-kit.git",
|
|
32
32
|
"directory": "packages/react"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
package/src/footer/Footer.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
|
2
2
|
|
|
3
3
|
type FooterLink = { href?: string; text?: string; attributes?: Record<string, string> };
|
|
4
4
|
|
|
5
|
-
type FooterProps = ComponentPropsWithoutRef<'
|
|
5
|
+
type FooterProps = ComponentPropsWithoutRef<'footer'> & {
|
|
6
6
|
/** Support links shown in the inline list (e.g. Accessibility statement, Cookies, Privacy). */
|
|
7
7
|
links?: FooterLink[];
|
|
8
8
|
/** Visually-hidden heading above the support links. */
|
|
@@ -26,7 +26,7 @@ export default function Footer({
|
|
|
26
26
|
.join(' ');
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
|
-
<
|
|
29
|
+
<footer className={classes} {...rest}>
|
|
30
30
|
<div className={containerClass}>
|
|
31
31
|
<div className="govuk-footer__meta">
|
|
32
32
|
<div className="govuk-footer__meta-item govuk-footer__meta-item--grow">
|
|
@@ -58,6 +58,6 @@ export default function Footer({
|
|
|
58
58
|
<div className="govuk-footer__meta-item">{children}</div>
|
|
59
59
|
</div>
|
|
60
60
|
</div>
|
|
61
|
-
</
|
|
61
|
+
</footer>
|
|
62
62
|
);
|
|
63
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -119,6 +119,7 @@ export { default as TableCell } from "./table/TableCell";
|
|
|
119
119
|
export { default as TableHead } from "./table/TableHead";
|
|
120
120
|
export { default as TableHeader } from "./table/TableHeader";
|
|
121
121
|
export { default as TableRow } from "./table/TableRow";
|
|
122
|
+
export { default as TableSearchAndFilter } from "./table/TableSearchAndFilter";
|
|
122
123
|
export { default as Table } from "./table/Table";
|
|
123
124
|
export { default as TabPanel } from "./tabs/TabPanel";
|
|
124
125
|
export { default as Tab } from "./tabs/Tab";
|
package/src/modal/Modal.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useRef } from "react";
|
|
2
2
|
import type { ComponentPropsWithoutRef, ReactNode } from "react";
|
|
3
|
+
import { initModal, openModal, closeModal } from "@i-dot-ai-npm/component-library-frontend";
|
|
3
4
|
|
|
4
5
|
type ModalProps = Omit<ComponentPropsWithoutRef<"dialog">, "onClose"> & {
|
|
5
6
|
class?: string;
|
|
@@ -27,14 +28,9 @@ export default function Modal({
|
|
|
27
28
|
useEffect(() => {
|
|
28
29
|
const dialog = ref.current;
|
|
29
30
|
if (!dialog) return;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
initModal(dialog);
|
|
34
|
-
if (open) openModal(dialog);
|
|
35
|
-
else closeModal(dialog);
|
|
36
|
-
},
|
|
37
|
-
);
|
|
31
|
+
initModal(dialog);
|
|
32
|
+
if (open) openModal(dialog);
|
|
33
|
+
else closeModal(dialog);
|
|
38
34
|
}, [open]);
|
|
39
35
|
|
|
40
36
|
useEffect(() => {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @jsxImportSource react */
|
|
2
|
+
|
|
3
|
+
import type { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
type TableSearchAndFilterProps = ComponentPropsWithoutRef<'div'> & {
|
|
6
|
+
class?: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default function TableSearchAndFilter({ class: className, children, ...rest }: TableSearchAndFilterProps) {
|
|
11
|
+
const classes = ["govuk-table__search-and-filter-wrapper", className ?? ""].filter(Boolean).join(" ");
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<div className={classes} {...rest}>
|
|
15
|
+
{children ?? ""}
|
|
16
|
+
</div>
|
|
17
|
+
);
|
|
18
|
+
}
|