whitehall-ui 1.0.0 → 2.0.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/README.md +4 -1
- package/dist/{chunk-KWAC6IEK.js → chunk-2KB4IAMZ.js} +9 -22
- package/dist/{chunk-5TI2WXYU.js → chunk-3UX7QPLM.js} +10 -21
- package/dist/{chunk-SK27BMU5.js → chunk-4GQRYMDK.js} +11 -23
- package/dist/{chunk-OP35ZJ4X.js → chunk-4TBXH62Z.js} +6 -7
- package/dist/{chunk-M6CLPMRP.js → chunk-6WLHJ5MN.js} +34 -76
- package/dist/chunk-7IOR7UNU.js +77 -0
- package/dist/chunk-7Q2C5RB7.js +167 -0
- package/dist/{chunk-5PIQJ22R.js → chunk-ASBIQC77.js} +13 -18
- package/dist/{chunk-KD4LPFIZ.js → chunk-C2YQVLZ7.js} +15 -18
- package/dist/chunk-CBT6WCJ7.js +52 -0
- package/dist/{chunk-3YIKJK6M.js → chunk-CYBPAHLZ.js} +48 -52
- package/dist/{chunk-VB6V3PHD.js → chunk-D2T6BUOB.js} +6 -16
- package/dist/chunk-DZ3743JO.js +38 -0
- package/dist/{chunk-AO6HPG4R.js → chunk-EDOSCND4.js} +5 -20
- package/dist/chunk-FJHNUBEM.js +59 -0
- package/dist/chunk-FVBDMMNR.js +143 -0
- package/dist/chunk-GKHD33N6.js +52 -0
- package/dist/{chunk-3INCIYDO.js → chunk-GLDCEDTR.js} +22 -77
- package/dist/{chunk-G6T44BDV.js → chunk-HBLVAX45.js} +7 -11
- package/dist/{chunk-UWQFFFTB.js → chunk-JCERRZV6.js} +13 -13
- package/dist/chunk-KXQGZLMK.js +120 -0
- package/dist/{chunk-CEPBVMFU.js → chunk-MFI5R2TJ.js} +1 -3
- package/dist/{chunk-5XNKIBMP.js → chunk-MYMVHSRJ.js} +3 -4
- package/dist/chunk-N5PY3VZH.js +192 -0
- package/dist/{chunk-P4GCF5FQ.js → chunk-OQILIT3B.js} +26 -15
- package/dist/{chunk-6VXVJERU.js → chunk-QKR7NELW.js} +4 -8
- package/dist/chunk-QPN5J5IU.js +177 -0
- package/dist/chunk-RGXB6M3G.js +87 -0
- package/dist/chunk-TAVSU2XB.js +90 -0
- package/dist/chunk-TGNN5ZP3.js +81 -0
- package/dist/chunk-TICBCBDN.js +18 -0
- package/dist/{chunk-7ZCZQN5N.js → chunk-UK7RLSTJ.js} +15 -22
- package/dist/chunk-UXOJELVU.js +37 -0
- package/dist/{chunk-QTSEOPVX.js → chunk-VCJE5UO2.js} +23 -25
- package/dist/{chunk-N67H5OUQ.js → chunk-VHSAXVCF.js} +7 -5
- package/dist/chunk-VMI2XU5D.js +74 -0
- package/dist/{chunk-TXGBUZB4.js → chunk-VRGDQ3SF.js} +3 -10
- package/dist/chunk-W4CWUYTA.js +44 -0
- package/dist/{chunk-LRNZYPC2.js → chunk-YF6EZ57H.js} +14 -44
- package/dist/chunk-ZAKQHDVD.js +40 -0
- package/dist/chunk-ZJB7BBTN.js +188 -0
- package/dist/index.d.ts +15 -13
- package/dist/index.js +41 -39
- package/dist/lib/utils.d.ts +2 -1
- package/dist/lib/utils.js +1 -1
- package/dist/ui/accordion.d.ts +8 -13
- package/dist/ui/accordion.js +2 -2
- package/dist/ui/back-link.d.ts +4 -4
- package/dist/ui/back-link.js +2 -2
- package/dist/ui/breadcrumbs.d.ts +10 -16
- package/dist/ui/breadcrumbs.js +2 -2
- package/dist/ui/button.d.ts +7 -8
- package/dist/ui/button.js +2 -2
- package/dist/ui/character-count.d.ts +11 -15
- package/dist/ui/character-count.js +3 -3
- package/dist/ui/checkboxes.d.ts +9 -17
- package/dist/ui/checkboxes.js +2 -2
- package/dist/ui/cookie-banner.d.ts +12 -21
- package/dist/ui/cookie-banner.js +2 -2
- package/dist/ui/date-input.d.ts +10 -16
- package/dist/ui/date-input.js +2 -2
- package/dist/ui/details.d.ts +8 -17
- package/dist/ui/details.js +2 -2
- package/dist/ui/error-message.d.ts +4 -4
- package/dist/ui/error-message.js +2 -2
- package/dist/ui/error-summary.d.ts +5 -4
- package/dist/ui/error-summary.js +2 -2
- package/dist/ui/exit-this-page.d.ts +4 -4
- package/dist/ui/exit-this-page.js +3 -3
- package/dist/ui/feedback.d.ts +13 -0
- package/dist/ui/feedback.js +2 -0
- package/dist/ui/fieldset.d.ts +9 -13
- package/dist/ui/fieldset.js +2 -2
- package/dist/ui/file-upload.d.ts +4 -5
- package/dist/ui/file-upload.js +2 -2
- package/dist/ui/footer.d.ts +39 -50
- package/dist/ui/footer.js +2 -2
- package/dist/ui/generic-header.d.ts +10 -15
- package/dist/ui/generic-header.js +2 -2
- package/dist/ui/header.d.ts +14 -32
- package/dist/ui/header.js +2 -2
- package/dist/ui/hint.d.ts +4 -5
- package/dist/ui/hint.js +2 -2
- package/dist/ui/inset-text.d.ts +4 -5
- package/dist/ui/inset-text.js +2 -2
- package/dist/ui/label.d.ts +7 -9
- package/dist/ui/label.js +2 -2
- package/dist/ui/language-navigation.d.ts +20 -0
- package/dist/ui/language-navigation.js +2 -0
- package/dist/ui/link.d.ts +5 -6
- package/dist/ui/link.js +2 -2
- package/dist/ui/notification-banner.d.ts +15 -24
- package/dist/ui/notification-banner.js +2 -2
- package/dist/ui/pagination.d.ts +20 -34
- package/dist/ui/pagination.js +2 -2
- package/dist/ui/panel.d.ts +11 -12
- package/dist/ui/panel.js +2 -2
- package/dist/ui/password-input.d.ts +7 -6
- package/dist/ui/password-input.js +4 -4
- package/dist/ui/phase-banner.d.ts +10 -17
- package/dist/ui/phase-banner.js +2 -2
- package/dist/ui/radios.d.ts +8 -13
- package/dist/ui/radios.js +2 -2
- package/dist/ui/select.d.ts +6 -30
- package/dist/ui/select.js +2 -2
- package/dist/ui/service-navigation.d.ts +15 -23
- package/dist/ui/service-navigation.js +2 -2
- package/dist/ui/skip-link.d.ts +4 -5
- package/dist/ui/skip-link.js +2 -2
- package/dist/ui/summary-list.d.ts +24 -41
- package/dist/ui/summary-list.js +2 -2
- package/dist/ui/table.d.ts +21 -26
- package/dist/ui/table.js +2 -2
- package/dist/ui/tabs.d.ts +7 -9
- package/dist/ui/tabs.js +2 -2
- package/dist/ui/tag.d.ts +4 -6
- package/dist/ui/tag.js +2 -2
- package/dist/ui/task-list.d.ts +14 -23
- package/dist/ui/task-list.js +2 -2
- package/dist/ui/text-input.d.ts +5 -6
- package/dist/ui/text-input.js +2 -2
- package/dist/ui/textarea.d.ts +4 -6
- package/dist/ui/textarea.js +2 -2
- package/dist/ui/warning-text.d.ts +4 -4
- package/dist/ui/warning-text.js +2 -2
- package/package.json +111 -263
- package/registry/default/theme/govuk-tokens.css +207 -40
- package/dist/chunk-2QKZ6DPC.js +0 -27
- package/dist/chunk-4MXR4WNS.js +0 -17
- package/dist/chunk-5AKGRLG2.js +0 -190
- package/dist/chunk-5H55YDJS.js +0 -69
- package/dist/chunk-72PH2FMG.js +0 -180
- package/dist/chunk-GUZIKVAE.js +0 -119
- package/dist/chunk-JESMK3XK.js +0 -105
- package/dist/chunk-JFZN5XP6.js +0 -88
- package/dist/chunk-NRXTKHI2.js +0 -169
- package/dist/chunk-PGZHPAT5.js +0 -183
- package/dist/chunk-RPV43YDC.js +0 -93
- package/dist/chunk-VQOCX44T.js +0 -41
- package/dist/chunk-WONVZ7WK.js +0 -29
- package/dist/chunk-WPPWPEFV.js +0 -150
- package/dist/chunk-XQOYWPKV.js +0 -48
- package/dist/chunk-YAKI4SI7.js +0 -205
- package/dist/chunk-YCLGXX3R.js +0 -68
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var Header = ({ className, children, fullWidth, ...props }) => /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: cn(
|
|
8
|
+
"font-govuk text-govuk-header",
|
|
9
|
+
"border-b border-b-transparent",
|
|
10
|
+
"text-white bg-govuk-brand",
|
|
11
|
+
className
|
|
12
|
+
),
|
|
13
|
+
...props,
|
|
14
|
+
children: children ?? /* @__PURE__ */ jsx(HeaderContainer, { fullWidth, children: /* @__PURE__ */ jsx(HeaderLogo, { children: /* @__PURE__ */ jsx(HeaderLink, { href: "https://www.gov.uk/", children: /* @__PURE__ */ jsx(HeaderLogotype, {}) }) }) })
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
var HeaderContainer = ({
|
|
18
|
+
className,
|
|
19
|
+
fullWidth,
|
|
20
|
+
...props
|
|
21
|
+
}) => /* @__PURE__ */ jsx(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
className: cn(
|
|
25
|
+
"flex items-center flex-wrap",
|
|
26
|
+
fullWidth ? "px-govuk-3" : "govuk-width-container",
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
...props
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
var HeaderLogo = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
className: cn(
|
|
36
|
+
"box-border pt-govuk-header-pt pb-govuk-header-pb",
|
|
37
|
+
className
|
|
38
|
+
),
|
|
39
|
+
...props
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
var HeaderLink = ({ className, children, ...props }) => /* @__PURE__ */ jsx(
|
|
43
|
+
"a",
|
|
44
|
+
{
|
|
45
|
+
className: cn(
|
|
46
|
+
"inline-block text-govuk-header-link",
|
|
47
|
+
"govuk-header-link focus:govuk-link-focus",
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
var HeaderLogotype = ({ className, ...props }) => /* @__PURE__ */ jsxs(
|
|
55
|
+
"svg",
|
|
56
|
+
{
|
|
57
|
+
focusable: "false",
|
|
58
|
+
role: "img",
|
|
59
|
+
"aria-label": "GOV.UK",
|
|
60
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
61
|
+
viewBox: "0 0 324 60",
|
|
62
|
+
height: "30",
|
|
63
|
+
width: "162",
|
|
64
|
+
fill: "currentcolor",
|
|
65
|
+
className: cn("govuk-logo", className),
|
|
66
|
+
...props,
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsx("title", { children: "GOV.UK" }),
|
|
69
|
+
/* @__PURE__ */ jsxs("g", { children: [
|
|
70
|
+
/* @__PURE__ */ jsx("circle", { cx: "20", cy: "17.6", r: "3.7" }),
|
|
71
|
+
/* @__PURE__ */ jsx("circle", { cx: "10.2", cy: "23.5", r: "3.7" }),
|
|
72
|
+
/* @__PURE__ */ jsx("circle", { cx: "3.7", cy: "33.2", r: "3.7" }),
|
|
73
|
+
/* @__PURE__ */ jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }),
|
|
74
|
+
/* @__PURE__ */ jsx("circle", { cx: "43.3", cy: "17.6", r: "3.7" }),
|
|
75
|
+
/* @__PURE__ */ jsx("circle", { cx: "53.2", cy: "23.5", r: "3.7" }),
|
|
76
|
+
/* @__PURE__ */ jsx("circle", { cx: "59.7", cy: "33.2", r: "3.7" }),
|
|
77
|
+
/* @__PURE__ */ jsx("circle", { cx: "31.7", cy: "30.6", r: "3.7" }),
|
|
78
|
+
/* @__PURE__ */ jsx("path", { d: "M33.1,9.8c.2-.1.3-.3.5-.5l4.6,2.4v-6.8l-4.6,1.5c-.1-.2-.3-.3-.5-.5l1.9-5.9h-6.7l1.9,5.9c-.2.1-.3.3-.5.5l-4.6-1.5v6.8l4.6-2.4c.1.2.3.3.5.5l-2.6,8c-.9,2.8,1.2,5.7,4.1,5.7h0c3,0,5.1-2.9,4.1-5.7l-2.6-8ZM37,37.9s-3.4,3.8-4.1,6.1c2.2,0,4.2-.5,6.4-2.8l-.7,8.5c-2-2.8-4.4-4.1-5.7-3.8.1,3.1.5,6.7,5.8,7.2,3.7.3,6.7-1.5,7-3.8.4-2.6-2-4.3-3.7-1.6-1.4-4.5,2.4-6.1,4.9-3.2-1.9-4.5-1.8-7.7,2.4-10.9,3,4,2.6,7.3-1.2,11.1,2.4-1.3,6.2,0,4,4.6-1.2-2.8-3.7-2.2-4.2.2-.3,1.7.7,3.7,3,4.2,1.9.3,4.7-.9,7-5.9-1.3,0-2.4.7-3.9,1.7l2.4-8c.6,2.3,1.4,3.7,2.2,4.5.6-1.6.5-2.8,0-5.3l5,1.8c-2.6,3.6-5.2,8.7-7.3,17.5-7.4-1.1-15.7-1.7-24.5-1.7h0c-8.8,0-17.1.6-24.5,1.7-2.1-8.9-4.7-13.9-7.3-17.5l5-1.8c-.5,2.5-.6,3.7,0,5.3.8-.8,1.6-2.3,2.2-4.5l2.4,8c-1.5-1-2.6-1.7-3.9-1.7,2.3,5,5.2,6.2,7,5.9,2.3-.4,3.3-2.4,3-4.2-.5-2.4-3-3.1-4.2-.2-2.2-4.6,1.6-6,4-4.6-3.7-3.7-4.2-7.1-1.2-11.1,4.2,3.2,4.3,6.4,2.4,10.9,2.5-2.8,6.3-1.3,4.9,3.2-1.8-2.7-4.1-1-3.7,1.6.3,2.3,3.3,4.1,7,3.8,5.4-.5,5.7-4.2,5.8-7.2-1.3-.2-3.7,1-5.7,3.8l-.7-8.5c2.2,2.3,4.2,2.7,6.4,2.8-.7-2.3-4.1-6.1-4.1-6.1h10.6,0Z" })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ jsx("circle", { className: "govuk-logo-dot", cx: "226", cy: "36", r: "7.3" }),
|
|
81
|
+
/* @__PURE__ */ jsx("path", { d: "M93.94 41.25c.4 1.81 1.2 3.21 2.21 4.62 1 1.4 2.21 2.41 3.61 3.21s3.21 1.2 5.22 1.2 3.61-.4 4.82-1c1.4-.6 2.41-1.4 3.21-2.41.8-1 1.4-2.01 1.61-3.01s.4-2.01.4-3.01v.14h-10.86v-7.02h20.07v24.08h-8.03v-5.56c-.6.8-1.38 1.61-2.19 2.41-.8.8-1.81 1.2-2.81 1.81-1 .4-2.21.8-3.41 1.2s-2.41.4-3.81.4a18.56 18.56 0 0 1-14.65-6.63c-1.6-2.01-3.01-4.41-3.81-7.02s-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83a20.45 20.45 0 0 1 19.46-13.65c3.21 0 4.01.2 5.82.8 1.81.4 3.61 1.2 5.02 2.01 1.61.8 2.81 2.01 4.01 3.21s2.21 2.61 2.81 4.21l-7.63 4.41c-.4-1-1-1.81-1.61-2.61-.6-.8-1.4-1.4-2.21-2.01-.8-.6-1.81-1-2.81-1.4-1-.4-2.21-.4-3.61-.4-2.01 0-3.81.4-5.22 1.2-1.4.8-2.61 1.81-3.61 3.21s-1.61 2.81-2.21 4.62c-.4 1.81-.6 3.71-.6 5.42s.8 5.22.8 5.22Zm57.8-27.9c3.21 0 6.22.6 8.63 1.81 2.41 1.2 4.82 2.81 6.62 4.82S170.2 24.39 171 27s1.4 5.62 1.4 8.83-.4 6.02-1.4 8.83-2.41 5.02-4.01 7.02-4.01 3.61-6.62 4.82-5.42 1.81-8.63 1.81-6.22-.6-8.63-1.81-4.82-2.81-6.42-4.82-3.21-4.41-4.01-7.02-1.4-5.62-1.4-8.83.4-6.02 1.4-8.83 2.41-5.02 4.01-7.02 4.01-3.61 6.42-4.82 5.42-1.81 8.63-1.81Zm0 36.73c1.81 0 3.61-.4 5.02-1s2.61-1.81 3.61-3.01 1.81-2.81 2.21-4.41c.4-1.81.8-3.61.8-5.62 0-2.21-.2-4.21-.8-6.02s-1.2-3.21-2.21-4.62c-1-1.2-2.21-2.21-3.61-3.01s-3.21-1-5.02-1-3.61.4-5.02 1c-1.4.8-2.61 1.81-3.61 3.01s-1.81 2.81-2.21 4.62c-.4 1.81-.8 3.61-.8 5.62 0 2.41.2 4.21.8 6.02.4 1.81 1.2 3.21 2.21 4.41s2.21 2.21 3.61 3.01c1.4.8 3.21 1 5.02 1Zm36.32 7.96-12.24-44.15h9.83l8.43 32.77h.4l8.23-32.77h9.83L200.3 58.04h-12.24Zm74.14-7.96c2.18 0 3.51-.6 3.51-.6 1.2-.6 2.01-1 2.81-1.81s1.4-1.81 1.81-2.81a13 13 0 0 0 .8-4.01V13.9h8.63v28.15c0 2.41-.4 4.62-1.4 6.62-.8 2.01-2.21 3.61-3.61 5.02s-3.41 2.41-5.62 3.21-4.62 1.2-7.02 1.2-5.02-.4-7.02-1.2c-2.21-.8-4.01-1.81-5.62-3.21s-2.81-3.01-3.61-5.02-1.4-4.21-1.4-6.62V13.9h8.63v26.95c0 1.61.2 3.01.8 4.01.4 1.2 1.2 2.21 2.01 2.81.8.8 1.81 1.4 2.81 1.81 0 0 1.34.6 3.51.6Zm34.22-36.18v18.92l15.65-18.92h10.82l-15.03 17.32 16.03 26.83h-10.21l-11.44-20.21-5.62 6.22v13.99h-8.83V13.9" })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
var HeaderProductName = ({ className, ...props }) => /* @__PURE__ */ jsx("span", { className: cn("govuk-header-product-name", className), ...props });
|
|
86
|
+
|
|
87
|
+
export { Header, HeaderContainer, HeaderLink, HeaderLogo, HeaderLogotype, HeaderProductName };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Textarea } from './chunk-EDOSCND4.js';
|
|
2
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var countText = (text, mode) => Array.from(
|
|
7
|
+
new Intl.Segmenter(void 0, {
|
|
8
|
+
granularity: mode === "words" ? "word" : "grapheme"
|
|
9
|
+
}).segment(text)
|
|
10
|
+
).filter((segment) => mode === "characters" || segment.isWordLike).length;
|
|
11
|
+
var defaultFormatMessage = (remaining, mode) => {
|
|
12
|
+
const count = Math.abs(remaining);
|
|
13
|
+
const noun = mode === "words" ? "word" : "character";
|
|
14
|
+
const unit = count === 1 ? noun : `${noun}s`;
|
|
15
|
+
return remaining < 0 ? `You have ${count} ${unit} too many` : `You have ${count} ${unit} remaining`;
|
|
16
|
+
};
|
|
17
|
+
var CharacterCount = ({
|
|
18
|
+
id,
|
|
19
|
+
maxCount,
|
|
20
|
+
mode = "characters",
|
|
21
|
+
threshold = 0,
|
|
22
|
+
defaultValue = "",
|
|
23
|
+
value,
|
|
24
|
+
error,
|
|
25
|
+
className,
|
|
26
|
+
textareaClassName,
|
|
27
|
+
descriptionText = `You can enter up to ${maxCount} ${mode}`,
|
|
28
|
+
onChange,
|
|
29
|
+
formatMessage = defaultFormatMessage,
|
|
30
|
+
"aria-describedby": ariaDescribedBy,
|
|
31
|
+
...props
|
|
32
|
+
}) => {
|
|
33
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
34
|
+
const [announcement, setAnnouncement] = useState("");
|
|
35
|
+
const currentValue = value ?? internalValue;
|
|
36
|
+
const remaining = maxCount - countText(currentValue, mode);
|
|
37
|
+
const isOverLimit = remaining < 0;
|
|
38
|
+
const showMessage = maxCount - remaining >= Math.ceil(maxCount * threshold / 100);
|
|
39
|
+
const message = formatMessage(remaining, mode);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
const timeout = setTimeout(() => setAnnouncement(message), 1e3);
|
|
42
|
+
return () => clearTimeout(timeout);
|
|
43
|
+
}, [message]);
|
|
44
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("font-govuk mb-govuk-r6", className), children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
Textarea,
|
|
47
|
+
{
|
|
48
|
+
id,
|
|
49
|
+
value: currentValue,
|
|
50
|
+
onChange: (event) => {
|
|
51
|
+
if (value === void 0) setInternalValue(event.target.value);
|
|
52
|
+
onChange?.(event);
|
|
53
|
+
},
|
|
54
|
+
error: error || isOverLimit,
|
|
55
|
+
"aria-describedby": `${ariaDescribedBy ?? ""} ${id}-info`.trim(),
|
|
56
|
+
className: cn("mb-govuk-1", textareaClassName),
|
|
57
|
+
...props
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx("div", { id: `${id}-info`, className: "sr-only", children: descriptionText }),
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
CharacterCountMessage,
|
|
63
|
+
{
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
className: cn(
|
|
66
|
+
isOverLimit && "text-govuk-error font-bold",
|
|
67
|
+
!showMessage && "invisible"
|
|
68
|
+
),
|
|
69
|
+
children: message
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ jsx("div", { className: "sr-only", "aria-live": "polite", "aria-hidden": !showMessage, children: announcement })
|
|
73
|
+
] });
|
|
74
|
+
};
|
|
75
|
+
var CharacterCountMessage = ({
|
|
76
|
+
className,
|
|
77
|
+
...props
|
|
78
|
+
}) => /* @__PURE__ */ jsx(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
className: cn(
|
|
82
|
+
"font-govuk text-govuk-body text-govuk-dark-grey",
|
|
83
|
+
"mt-0 mb-0 tabular-nums",
|
|
84
|
+
className
|
|
85
|
+
),
|
|
86
|
+
...props
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
export { CharacterCount, CharacterCountMessage };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { cn, mergeRefs } from './chunk-GKHD33N6.js';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var ErrorSummary = ({
|
|
6
|
+
className,
|
|
7
|
+
titleText = "There is a problem",
|
|
8
|
+
descriptionText,
|
|
9
|
+
errorList,
|
|
10
|
+
disableAutoFocus,
|
|
11
|
+
ref,
|
|
12
|
+
...props
|
|
13
|
+
}) => {
|
|
14
|
+
const innerRef = useRef(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
const node = innerRef.current;
|
|
17
|
+
if (disableAutoFocus || !node) return;
|
|
18
|
+
node.setAttribute("tabindex", "-1");
|
|
19
|
+
node.addEventListener("blur", () => node.removeAttribute("tabindex"), {
|
|
20
|
+
once: true
|
|
21
|
+
});
|
|
22
|
+
node.focus();
|
|
23
|
+
}, [disableAutoFocus]);
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
ref: mergeRefs(innerRef, ref),
|
|
28
|
+
className: cn(
|
|
29
|
+
"font-govuk text-govuk-body text-govuk-black",
|
|
30
|
+
"p-govuk-3 sm:p-govuk-4",
|
|
31
|
+
"mb-govuk-6 sm:mb-govuk-8",
|
|
32
|
+
"border-govuk-error-summary",
|
|
33
|
+
"focus:outline-3 focus:outline-govuk-yellow",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props,
|
|
37
|
+
children: /* @__PURE__ */ jsxs("div", { role: "alert", children: [
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
"h2",
|
|
40
|
+
{
|
|
41
|
+
className: cn(
|
|
42
|
+
"text-govuk-heading-m font-bold",
|
|
43
|
+
"mt-0 mb-govuk-3 sm:mb-govuk-4"
|
|
44
|
+
),
|
|
45
|
+
children: titleText
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ jsxs(
|
|
49
|
+
"div",
|
|
50
|
+
{
|
|
51
|
+
className: cn(
|
|
52
|
+
"[&>p]:mb-0",
|
|
53
|
+
"[&>*+*]:mt-govuk-3 sm:[&>*+*]:mt-govuk-4",
|
|
54
|
+
"*:last:mb-govuk-1"
|
|
55
|
+
),
|
|
56
|
+
children: [
|
|
57
|
+
descriptionText && /* @__PURE__ */ jsx("p", { children: descriptionText }),
|
|
58
|
+
/* @__PURE__ */ jsx("ul", { className: "list-none p-0 m-0 [&>li]:mb-govuk-1 [&>li:last-child]:mb-0", children: errorList.map((item) => /* @__PURE__ */ jsx("li", { children: item.href ? /* @__PURE__ */ jsx(
|
|
59
|
+
"a",
|
|
60
|
+
{
|
|
61
|
+
href: item.href,
|
|
62
|
+
className: cn(
|
|
63
|
+
"font-bold",
|
|
64
|
+
"text-govuk-error visited:text-govuk-error",
|
|
65
|
+
"hover:text-govuk-error-hover",
|
|
66
|
+
"underline govuk-link-underline",
|
|
67
|
+
"hover:govuk-link-underline-hover",
|
|
68
|
+
"focus:govuk-link-focus"
|
|
69
|
+
),
|
|
70
|
+
children: item.text
|
|
71
|
+
}
|
|
72
|
+
) : item.text }, item.href ?? item.text)) })
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] })
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { ErrorSummary };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var Hint = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
5
|
+
"div",
|
|
6
|
+
{
|
|
7
|
+
className: cn(
|
|
8
|
+
"font-govuk text-govuk-body text-govuk-dark-grey",
|
|
9
|
+
"mb-govuk-3",
|
|
10
|
+
"[legend+&]:-mt-govuk-1",
|
|
11
|
+
"[label:not([class*=heading])+&]:mb-govuk-2 [legend:not([class*=heading])+&]:mb-govuk-2",
|
|
12
|
+
className
|
|
13
|
+
),
|
|
14
|
+
...props
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
export { Hint };
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import { cn } from './chunk-
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
var GenericHeader = ({
|
|
5
5
|
className,
|
|
6
6
|
fullWidth,
|
|
7
|
-
ref,
|
|
8
7
|
children,
|
|
9
8
|
...props
|
|
10
9
|
}) => /* @__PURE__ */ jsx(
|
|
11
|
-
"
|
|
10
|
+
"div",
|
|
12
11
|
{
|
|
13
|
-
ref,
|
|
14
12
|
className: cn(
|
|
15
13
|
"font-govuk text-govuk-header",
|
|
16
14
|
"border-b border-b-transparent",
|
|
@@ -24,43 +22,38 @@ var GenericHeader = ({
|
|
|
24
22
|
var GenericHeaderContainer = ({
|
|
25
23
|
className,
|
|
26
24
|
fullWidth,
|
|
27
|
-
ref,
|
|
28
|
-
children,
|
|
29
25
|
...props
|
|
30
26
|
}) => /* @__PURE__ */ jsx(
|
|
31
27
|
"div",
|
|
32
28
|
{
|
|
33
|
-
ref,
|
|
34
29
|
className: cn(
|
|
35
|
-
fullWidth ? "px-govuk-3" : "
|
|
30
|
+
fullWidth ? "px-govuk-3" : "govuk-width-container",
|
|
36
31
|
className
|
|
37
32
|
),
|
|
38
|
-
...props
|
|
39
|
-
|
|
33
|
+
...props
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
var GenericHeaderLogo = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
38
|
+
{
|
|
39
|
+
className: cn(
|
|
40
|
+
"flex pt-govuk-header-pt pb-govuk-header-pb",
|
|
41
|
+
className
|
|
42
|
+
),
|
|
43
|
+
...props
|
|
40
44
|
}
|
|
41
45
|
);
|
|
42
|
-
var GenericHeaderLogo = ({
|
|
43
|
-
className,
|
|
44
|
-
ref,
|
|
45
|
-
children,
|
|
46
|
-
...props
|
|
47
|
-
}) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex py-govuk-3", className), ...props, children });
|
|
48
46
|
var GenericHeaderLink = ({
|
|
49
47
|
className,
|
|
50
|
-
ref,
|
|
51
48
|
children,
|
|
52
49
|
...props
|
|
53
50
|
}) => /* @__PURE__ */ jsx(
|
|
54
51
|
"a",
|
|
55
52
|
{
|
|
56
|
-
ref,
|
|
57
53
|
className: cn(
|
|
58
54
|
"inline-flex items-center gap-govuk-1",
|
|
59
55
|
"text-govuk-header-link",
|
|
60
|
-
"
|
|
61
|
-
"visited:text-white active:text-white",
|
|
62
|
-
"hover:underline hover:govuk-link-underline hover:govuk-link-underline-hover",
|
|
63
|
-
"focus:govuk-link-focus",
|
|
56
|
+
"govuk-header-link focus:govuk-link-focus",
|
|
64
57
|
className
|
|
65
58
|
),
|
|
66
59
|
...props,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var selectVariants = cva(
|
|
6
|
+
[
|
|
7
|
+
"box-border",
|
|
8
|
+
"min-w-govuk-input-width-10 max-w-full",
|
|
9
|
+
"h-10",
|
|
10
|
+
"p-govuk-1",
|
|
11
|
+
"border-2 border-govuk-black",
|
|
12
|
+
"rounded-none",
|
|
13
|
+
"text-govuk-body leading-tight font-normal font-govuk text-govuk-black",
|
|
14
|
+
"bg-white",
|
|
15
|
+
"cursor-pointer",
|
|
16
|
+
"focus:outline-3 focus:outline-govuk-yellow focus:outline-offset-0",
|
|
17
|
+
"focus:inset-ring-2 focus:inset-ring-govuk-black",
|
|
18
|
+
"disabled:opacity-50 disabled:cursor-not-allowed"
|
|
19
|
+
],
|
|
20
|
+
{
|
|
21
|
+
variants: {
|
|
22
|
+
error: {
|
|
23
|
+
true: "border-govuk-error focus:border-govuk-black"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
var Select = ({ className, error, ...props }) => /* @__PURE__ */ jsx(
|
|
29
|
+
"select",
|
|
30
|
+
{
|
|
31
|
+
"aria-invalid": error || void 0,
|
|
32
|
+
className: cn(selectVariants({ error }), className),
|
|
33
|
+
...props
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export { Select, selectVariants };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { cn } from './chunk-
|
|
2
|
-
import { Input } from '@base-ui/react/input';
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
3
2
|
import { cva } from 'class-variance-authority';
|
|
4
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
4
|
|
|
@@ -14,7 +13,7 @@ var textInputVariants = cva(
|
|
|
14
13
|
"text-govuk-body font-normal font-govuk",
|
|
15
14
|
"focus:outline-3 focus:outline-govuk-yellow focus:outline-offset-0",
|
|
16
15
|
"focus:inset-ring-2 focus:inset-ring-govuk-black",
|
|
17
|
-
"
|
|
16
|
+
"disabled:opacity-50 disabled:bg-transparent disabled:cursor-not-allowed"
|
|
18
17
|
],
|
|
19
18
|
{
|
|
20
19
|
variants: {
|
|
@@ -29,18 +28,14 @@ var textInputVariants = cva(
|
|
|
29
28
|
2: "max-w-govuk-input-width-2"
|
|
30
29
|
},
|
|
31
30
|
error: {
|
|
32
|
-
true: "border-govuk-error focus:border-govuk-black"
|
|
33
|
-
false: ""
|
|
31
|
+
true: "border-govuk-error focus:border-govuk-black"
|
|
34
32
|
},
|
|
35
33
|
extraLetterSpacing: {
|
|
36
|
-
true: "tracking-govuk-code tabular-nums"
|
|
37
|
-
false: ""
|
|
34
|
+
true: "tracking-govuk-code tabular-nums"
|
|
38
35
|
}
|
|
39
36
|
},
|
|
40
37
|
defaultVariants: {
|
|
41
|
-
width: "full"
|
|
42
|
-
error: false,
|
|
43
|
-
extraLetterSpacing: false
|
|
38
|
+
width: "full"
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
41
|
);
|
|
@@ -49,42 +44,45 @@ var affixStyles = [
|
|
|
49
44
|
"min-w-10 h-10",
|
|
50
45
|
"p-govuk-1",
|
|
51
46
|
"border-2 border-govuk-black",
|
|
52
|
-
"bg-govuk-light-grey",
|
|
47
|
+
"bg-govuk-light-grey text-govuk-black",
|
|
53
48
|
"text-govuk-body font-normal font-govuk",
|
|
54
49
|
"text-center whitespace-nowrap",
|
|
55
50
|
"cursor-default flex-none",
|
|
56
|
-
"max-
|
|
51
|
+
"max-[20em]:block max-[20em]:h-auto max-[20em]:whitespace-normal"
|
|
57
52
|
].join(" ");
|
|
58
|
-
var prefixStyles = cn(
|
|
59
|
-
|
|
53
|
+
var prefixStyles = cn(
|
|
54
|
+
affixStyles,
|
|
55
|
+
"min-[20em]:border-r-0",
|
|
56
|
+
"max-[20em]:border-b-0"
|
|
57
|
+
);
|
|
58
|
+
var suffixStyles = cn(
|
|
59
|
+
affixStyles,
|
|
60
|
+
"min-[20em]:border-l-0",
|
|
61
|
+
"max-[20em]:border-t-0"
|
|
62
|
+
);
|
|
60
63
|
var TextInput = ({
|
|
61
64
|
className,
|
|
62
65
|
width = "full",
|
|
63
|
-
error
|
|
64
|
-
extraLetterSpacing
|
|
65
|
-
type = "text",
|
|
66
|
-
disabled = false,
|
|
66
|
+
error,
|
|
67
|
+
extraLetterSpacing,
|
|
67
68
|
prefix,
|
|
68
69
|
suffix,
|
|
69
|
-
ref,
|
|
70
70
|
...props
|
|
71
71
|
}) => {
|
|
72
72
|
const input = /* @__PURE__ */ jsx(
|
|
73
|
-
|
|
73
|
+
"input",
|
|
74
74
|
{
|
|
75
|
-
|
|
76
|
-
type,
|
|
77
|
-
disabled,
|
|
75
|
+
"aria-invalid": error || void 0,
|
|
78
76
|
className: cn(
|
|
79
77
|
textInputVariants({ width, error, extraLetterSpacing }),
|
|
80
|
-
(prefix || suffix) && "flex-auto focus:z-10 max-
|
|
78
|
+
(prefix || suffix) && "flex-auto focus:z-10 max-[20em]:max-w-full",
|
|
81
79
|
className
|
|
82
80
|
),
|
|
83
81
|
...props
|
|
84
82
|
}
|
|
85
83
|
);
|
|
86
84
|
if (!prefix && !suffix) return input;
|
|
87
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex max-
|
|
85
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex max-[20em]:block", children: [
|
|
88
86
|
prefix && /* @__PURE__ */ jsx("span", { className: prefixStyles, "aria-hidden": "true", children: prefix }),
|
|
89
87
|
input,
|
|
90
88
|
suffix && /* @__PURE__ */ jsx("span", { className: suffixStyles, "aria-hidden": "true", children: suffix })
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { cn } from './chunk-
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
var BackLink = ({
|
|
5
5
|
className,
|
|
6
6
|
inverse,
|
|
7
|
-
ref,
|
|
8
7
|
children = "Back",
|
|
9
8
|
...props
|
|
10
9
|
}) => /* @__PURE__ */ jsxs(
|
|
11
10
|
"a",
|
|
12
11
|
{
|
|
13
|
-
ref,
|
|
14
12
|
className: cn(
|
|
15
|
-
"font-govuk text-govuk-header leading-tight",
|
|
13
|
+
"relative font-govuk text-govuk-header leading-tight",
|
|
16
14
|
"inline-flex items-center gap-govuk-1",
|
|
17
15
|
"my-govuk-3",
|
|
18
16
|
"underline govuk-link-underline",
|
|
19
17
|
"hover:govuk-link-underline-hover",
|
|
20
18
|
"focus:govuk-link-focus",
|
|
19
|
+
"after:absolute after:inset-x-0 after:-top-govuk-3 after:-bottom-govuk-3",
|
|
21
20
|
inverse ? [
|
|
22
21
|
"text-white visited:text-white",
|
|
23
22
|
"hover:text-white active:text-white"
|
|
@@ -32,7 +31,10 @@ var BackLink = ({
|
|
|
32
31
|
/* @__PURE__ */ jsx(
|
|
33
32
|
"svg",
|
|
34
33
|
{
|
|
35
|
-
className:
|
|
34
|
+
className: cn(
|
|
35
|
+
"shrink-0",
|
|
36
|
+
inverse ? "text-current" : "text-govuk-dark-grey [a:focus_&]:text-govuk-black"
|
|
37
|
+
),
|
|
36
38
|
xmlns: "http://www.w3.org/2000/svg",
|
|
37
39
|
width: "7",
|
|
38
40
|
height: "11",
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var LanguageNavigation = ({
|
|
5
|
+
className,
|
|
6
|
+
inverse,
|
|
7
|
+
children,
|
|
8
|
+
...props
|
|
9
|
+
}) => /* @__PURE__ */ jsx(
|
|
10
|
+
"nav",
|
|
11
|
+
{
|
|
12
|
+
"aria-label": "Language",
|
|
13
|
+
"data-inverse": inverse || void 0,
|
|
14
|
+
className: cn(
|
|
15
|
+
"group/language font-govuk text-govuk-body mb-govuk-r6",
|
|
16
|
+
inverse ? "text-white" : "text-govuk-black",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props,
|
|
20
|
+
children: /* @__PURE__ */ jsx("ul", { className: "inline-flex flex-wrap gap-y-govuk-2 m-0 p-0 list-none", children })
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
var LanguageNavigationItem = ({
|
|
24
|
+
className,
|
|
25
|
+
...props
|
|
26
|
+
}) => /* @__PURE__ */ jsx(
|
|
27
|
+
"li",
|
|
28
|
+
{
|
|
29
|
+
className: cn(
|
|
30
|
+
"flex items-center",
|
|
31
|
+
"not-last:after:block not-last:after:h-[1em] not-last:after:mx-govuk-2",
|
|
32
|
+
"not-last:after:border-r not-last:after:border-govuk-mid-grey",
|
|
33
|
+
"group-data-[inverse]/language:not-last:after:border-current",
|
|
34
|
+
className
|
|
35
|
+
),
|
|
36
|
+
...props
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
var LanguageNavigationLink = ({
|
|
40
|
+
className,
|
|
41
|
+
lang,
|
|
42
|
+
hrefLang = lang,
|
|
43
|
+
description,
|
|
44
|
+
children,
|
|
45
|
+
...props
|
|
46
|
+
}) => /* @__PURE__ */ jsxs(
|
|
47
|
+
"a",
|
|
48
|
+
{
|
|
49
|
+
rel: "alternate",
|
|
50
|
+
lang,
|
|
51
|
+
hrefLang,
|
|
52
|
+
className: cn(
|
|
53
|
+
"underline govuk-link-underline",
|
|
54
|
+
"hover:govuk-link-underline-hover focus:govuk-link-focus",
|
|
55
|
+
"text-govuk-link visited:text-govuk-visited",
|
|
56
|
+
"hover:text-govuk-brand-hover active:text-govuk-black",
|
|
57
|
+
"group-data-[inverse]/language:text-white",
|
|
58
|
+
"group-data-[inverse]/language:visited:text-white",
|
|
59
|
+
"group-data-[inverse]/language:hover:text-white",
|
|
60
|
+
className
|
|
61
|
+
),
|
|
62
|
+
...props,
|
|
63
|
+
children: [
|
|
64
|
+
children,
|
|
65
|
+
description && /* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
66
|
+
" ",
|
|
67
|
+
description
|
|
68
|
+
] })
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
var LanguageNavigationCurrent = (props) => /* @__PURE__ */ jsx("span", { "aria-current": "true", ...props });
|
|
73
|
+
|
|
74
|
+
export { LanguageNavigation, LanguageNavigationCurrent, LanguageNavigationItem, LanguageNavigationLink };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn } from './chunk-
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
2
2
|
import { cva } from 'class-variance-authority';
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -9,7 +9,7 @@ var tagVariants = cva(
|
|
|
9
9
|
"mt-govuk-tag-mt mb-govuk-tag-mb",
|
|
10
10
|
"rounded-govuk-tag",
|
|
11
11
|
"text-govuk-tag font-normal font-govuk",
|
|
12
|
-
"no-underline break-
|
|
12
|
+
"no-underline wrap-break-word",
|
|
13
13
|
"max-w-govuk-tag-max-width",
|
|
14
14
|
"forced-colors:font-bold"
|
|
15
15
|
],
|
|
@@ -32,13 +32,6 @@ var tagVariants = cva(
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
);
|
|
35
|
-
var Tag = ({ className, colour = "blue",
|
|
36
|
-
"strong",
|
|
37
|
-
{
|
|
38
|
-
ref,
|
|
39
|
-
className: cn(tagVariants({ colour }), className),
|
|
40
|
-
...props
|
|
41
|
-
}
|
|
42
|
-
);
|
|
35
|
+
var Tag = ({ className, colour = "blue", ...props }) => /* @__PURE__ */ jsx("strong", { className: cn(tagVariants({ colour }), className), ...props });
|
|
43
36
|
|
|
44
37
|
export { Tag, tagVariants };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var SkipLink = ({
|
|
5
|
+
className,
|
|
6
|
+
children = "Skip to main content",
|
|
7
|
+
onClick,
|
|
8
|
+
...props
|
|
9
|
+
}) => /* @__PURE__ */ jsx(
|
|
10
|
+
"a",
|
|
11
|
+
{
|
|
12
|
+
href: "#main-content",
|
|
13
|
+
className: cn(
|
|
14
|
+
"govuk-skip-link",
|
|
15
|
+
"font-govuk text-govuk-header leading-tight",
|
|
16
|
+
"block py-govuk-2 px-govuk-3",
|
|
17
|
+
"text-govuk-black underline govuk-link-underline",
|
|
18
|
+
className
|
|
19
|
+
),
|
|
20
|
+
onClick: (event) => {
|
|
21
|
+
onClick?.(event);
|
|
22
|
+
const { hash, pathname } = event.currentTarget;
|
|
23
|
+
const target = hash && pathname === globalThis.location.pathname ? document.getElementById(decodeURIComponent(hash.slice(1))) : null;
|
|
24
|
+
if (!target) return;
|
|
25
|
+
if (!target.hasAttribute("tabindex")) {
|
|
26
|
+
target.setAttribute("tabindex", "-1");
|
|
27
|
+
target.style.outline = "none";
|
|
28
|
+
target.addEventListener(
|
|
29
|
+
"blur",
|
|
30
|
+
() => {
|
|
31
|
+
target.removeAttribute("tabindex");
|
|
32
|
+
target.style.removeProperty("outline");
|
|
33
|
+
},
|
|
34
|
+
{ once: true }
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
target.focus();
|
|
38
|
+
},
|
|
39
|
+
...props,
|
|
40
|
+
children
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export { SkipLink };
|