whitehall-ui 1.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 +108 -0
- package/dist/chunk-2QKZ6DPC.js +27 -0
- package/dist/chunk-3INCIYDO.js +213 -0
- package/dist/chunk-3YIKJK6M.js +181 -0
- package/dist/chunk-4MXR4WNS.js +17 -0
- package/dist/chunk-5AKGRLG2.js +190 -0
- package/dist/chunk-5H55YDJS.js +69 -0
- package/dist/chunk-5PIQJ22R.js +106 -0
- package/dist/chunk-5TI2WXYU.js +64 -0
- package/dist/chunk-5XNKIBMP.js +21 -0
- package/dist/chunk-6VXVJERU.js +38 -0
- package/dist/chunk-72PH2FMG.js +180 -0
- package/dist/chunk-7ZCZQN5N.js +71 -0
- package/dist/chunk-AO6HPG4R.js +50 -0
- package/dist/chunk-CEPBVMFU.js +34 -0
- package/dist/chunk-G6T44BDV.js +75 -0
- package/dist/chunk-GUZIKVAE.js +119 -0
- package/dist/chunk-JESMK3XK.js +105 -0
- package/dist/chunk-JFZN5XP6.js +88 -0
- package/dist/chunk-KD4LPFIZ.js +67 -0
- package/dist/chunk-KWAC6IEK.js +95 -0
- package/dist/chunk-LRNZYPC2.js +107 -0
- package/dist/chunk-M6CLPMRP.js +227 -0
- package/dist/chunk-N67H5OUQ.js +51 -0
- package/dist/chunk-NRXTKHI2.js +169 -0
- package/dist/chunk-OP35ZJ4X.js +46 -0
- package/dist/chunk-P4GCF5FQ.js +62 -0
- package/dist/chunk-PGZHPAT5.js +183 -0
- package/dist/chunk-QTSEOPVX.js +94 -0
- package/dist/chunk-RPV43YDC.js +93 -0
- package/dist/chunk-SK27BMU5.js +140 -0
- package/dist/chunk-TXGBUZB4.js +44 -0
- package/dist/chunk-UWQFFFTB.js +136 -0
- package/dist/chunk-VB6V3PHD.js +67 -0
- package/dist/chunk-VQOCX44T.js +41 -0
- package/dist/chunk-WONVZ7WK.js +29 -0
- package/dist/chunk-WPPWPEFV.js +150 -0
- package/dist/chunk-XQOYWPKV.js +48 -0
- package/dist/chunk-YAKI4SI7.js +205 -0
- package/dist/chunk-YCLGXX3R.js +68 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +39 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +1 -0
- package/dist/ui/accordion.d.ts +27 -0
- package/dist/ui/accordion.js +2 -0
- package/dist/ui/back-link.d.ts +9 -0
- package/dist/ui/back-link.js +2 -0
- package/dist/ui/breadcrumbs.d.ts +22 -0
- package/dist/ui/breadcrumbs.js +2 -0
- package/dist/ui/button.d.ts +17 -0
- package/dist/ui/button.js +2 -0
- package/dist/ui/character-count.d.ts +27 -0
- package/dist/ui/character-count.js +3 -0
- package/dist/ui/checkboxes.d.ts +30 -0
- package/dist/ui/checkboxes.js +2 -0
- package/dist/ui/cookie-banner.d.ts +24 -0
- package/dist/ui/cookie-banner.js +2 -0
- package/dist/ui/date-input.d.ts +21 -0
- package/dist/ui/date-input.js +2 -0
- package/dist/ui/details.d.ts +20 -0
- package/dist/ui/details.js +2 -0
- package/dist/ui/error-message.d.ts +9 -0
- package/dist/ui/error-message.js +2 -0
- package/dist/ui/error-summary.d.ts +15 -0
- package/dist/ui/error-summary.js +2 -0
- package/dist/ui/exit-this-page.d.ts +14 -0
- package/dist/ui/exit-this-page.js +3 -0
- package/dist/ui/fieldset.d.ts +22 -0
- package/dist/ui/fieldset.js +2 -0
- package/dist/ui/file-upload.d.ts +19 -0
- package/dist/ui/file-upload.js +2 -0
- package/dist/ui/footer.d.ts +61 -0
- package/dist/ui/footer.js +2 -0
- package/dist/ui/generic-header.d.ts +22 -0
- package/dist/ui/generic-header.js +2 -0
- package/dist/ui/header.d.ts +39 -0
- package/dist/ui/header.js +2 -0
- package/dist/ui/hint.d.ts +8 -0
- package/dist/ui/hint.js +2 -0
- package/dist/ui/inset-text.d.ts +8 -0
- package/dist/ui/inset-text.js +2 -0
- package/dist/ui/label.d.ts +18 -0
- package/dist/ui/label.js +2 -0
- package/dist/ui/link.d.ts +16 -0
- package/dist/ui/link.js +2 -0
- package/dist/ui/notification-banner.d.ts +29 -0
- package/dist/ui/notification-banner.js +2 -0
- package/dist/ui/pagination.d.ts +45 -0
- package/dist/ui/pagination.js +2 -0
- package/dist/ui/panel.d.ts +16 -0
- package/dist/ui/panel.js +2 -0
- package/dist/ui/password-input.d.ts +16 -0
- package/dist/ui/password-input.js +4 -0
- package/dist/ui/phase-banner.d.ts +20 -0
- package/dist/ui/phase-banner.js +2 -0
- package/dist/ui/radios.d.ts +25 -0
- package/dist/ui/radios.js +2 -0
- package/dist/ui/select.d.ts +36 -0
- package/dist/ui/select.js +2 -0
- package/dist/ui/service-navigation.d.ts +30 -0
- package/dist/ui/service-navigation.js +2 -0
- package/dist/ui/skip-link.d.ts +8 -0
- package/dist/ui/skip-link.js +2 -0
- package/dist/ui/summary-list.d.ts +49 -0
- package/dist/ui/summary-list.js +2 -0
- package/dist/ui/table.d.ts +40 -0
- package/dist/ui/table.js +2 -0
- package/dist/ui/tabs.d.ts +25 -0
- package/dist/ui/tabs.js +2 -0
- package/dist/ui/tag.d.ts +15 -0
- package/dist/ui/tag.js +2 -0
- package/dist/ui/task-list.d.ts +30 -0
- package/dist/ui/task-list.js +2 -0
- package/dist/ui/text-input.d.ts +18 -0
- package/dist/ui/text-input.js +2 -0
- package/dist/ui/textarea.d.ts +14 -0
- package/dist/ui/textarea.js +2 -0
- package/dist/ui/warning-text.d.ts +9 -0
- package/dist/ui/warning-text.js +2 -0
- package/package.json +263 -0
- package/registry/default/theme/govuk-tokens.css +434 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { cn } from './chunk-WONVZ7WK.js';
|
|
2
|
+
import { Accordion as Accordion$1 } from '@base-ui/react/accordion';
|
|
3
|
+
import { useState, useCallback } from 'react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var Accordion = ({
|
|
7
|
+
className,
|
|
8
|
+
ref,
|
|
9
|
+
children,
|
|
10
|
+
showAllSections,
|
|
11
|
+
defaultValue,
|
|
12
|
+
...props
|
|
13
|
+
}) => {
|
|
14
|
+
const [openSections, setOpenSections] = useState(
|
|
15
|
+
defaultValue ?? []
|
|
16
|
+
);
|
|
17
|
+
const allOpen = showAllSections !== void 0 && showAllSections.length > 0 && showAllSections.every((v) => openSections.includes(v));
|
|
18
|
+
const handleToggleAll = useCallback(() => {
|
|
19
|
+
if (allOpen) {
|
|
20
|
+
setOpenSections([]);
|
|
21
|
+
} else {
|
|
22
|
+
setOpenSections(showAllSections ?? []);
|
|
23
|
+
}
|
|
24
|
+
}, [allOpen, showAllSections]);
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
Accordion$1.Root,
|
|
27
|
+
{
|
|
28
|
+
ref,
|
|
29
|
+
multiple: true,
|
|
30
|
+
value: openSections,
|
|
31
|
+
onValueChange: setOpenSections,
|
|
32
|
+
className: cn(
|
|
33
|
+
"mb-govuk-6 font-govuk text-govuk-body text-govuk-black",
|
|
34
|
+
"border-b border-govuk-mid-grey",
|
|
35
|
+
className
|
|
36
|
+
),
|
|
37
|
+
...props,
|
|
38
|
+
children: [
|
|
39
|
+
showAllSections && /* @__PURE__ */ jsx("div", { className: "pb-govuk-1", children: /* @__PURE__ */ jsxs(
|
|
40
|
+
"button",
|
|
41
|
+
{
|
|
42
|
+
type: "button",
|
|
43
|
+
onClick: handleToggleAll,
|
|
44
|
+
"aria-expanded": allOpen,
|
|
45
|
+
className: cn(
|
|
46
|
+
"group inline-flex items-center",
|
|
47
|
+
"py-govuk-1 border-0 bg-transparent cursor-pointer",
|
|
48
|
+
"font-govuk text-govuk-body text-govuk-brand",
|
|
49
|
+
"hover:text-govuk-black hover:bg-govuk-light-grey",
|
|
50
|
+
"focus-visible:govuk-link-focus focus-visible:outline-none"
|
|
51
|
+
),
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsxs(
|
|
54
|
+
"svg",
|
|
55
|
+
{
|
|
56
|
+
className: cn(
|
|
57
|
+
"transition-transform",
|
|
58
|
+
allOpen ? "" : "rotate-180"
|
|
59
|
+
),
|
|
60
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
61
|
+
width: "18",
|
|
62
|
+
height: "18",
|
|
63
|
+
viewBox: "0 0 20 20",
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
focusable: "false",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
"circle",
|
|
69
|
+
{
|
|
70
|
+
className: "fill-none stroke-current group-hover:fill-govuk-black group-hover:stroke-govuk-black",
|
|
71
|
+
cx: "10",
|
|
72
|
+
cy: "10",
|
|
73
|
+
r: "9",
|
|
74
|
+
strokeWidth: "1"
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
"polyline",
|
|
79
|
+
{
|
|
80
|
+
className: "fill-none stroke-current group-hover:stroke-govuk-light-grey",
|
|
81
|
+
points: "6.5 8.5 10 12 13.5 8.5",
|
|
82
|
+
strokeWidth: "2",
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
strokeLinejoin: "round"
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsx("span", { className: "ml-govuk-1", children: allOpen ? "Hide all sections" : "Show all sections" })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
) }),
|
|
94
|
+
children
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
var AccordionSection = ({
|
|
100
|
+
className,
|
|
101
|
+
ref,
|
|
102
|
+
children,
|
|
103
|
+
...props
|
|
104
|
+
}) => /* @__PURE__ */ jsx(Accordion$1.Item, { ref, className: cn(className), ...props, children });
|
|
105
|
+
var AccordionHeading = ({
|
|
106
|
+
className,
|
|
107
|
+
ref,
|
|
108
|
+
children,
|
|
109
|
+
summary,
|
|
110
|
+
...props
|
|
111
|
+
}) => /* @__PURE__ */ jsx(Accordion$1.Header, { render: /* @__PURE__ */ jsx("h2", {}), className: "m-0 p-0", children: /* @__PURE__ */ jsxs(
|
|
112
|
+
Accordion$1.Trigger,
|
|
113
|
+
{
|
|
114
|
+
ref,
|
|
115
|
+
className: cn(
|
|
116
|
+
"group w-full",
|
|
117
|
+
"pt-govuk-2 pb-govuk-2 govuk-accordion-button-border",
|
|
118
|
+
"bg-transparent cursor-pointer text-left",
|
|
119
|
+
"hover:bg-govuk-light-grey",
|
|
120
|
+
"focus-visible:outline-none",
|
|
121
|
+
className
|
|
122
|
+
),
|
|
123
|
+
...props,
|
|
124
|
+
children: [
|
|
125
|
+
/* @__PURE__ */ jsx("span", { className: "block mb-govuk-2", children: /* @__PURE__ */ jsx("span", { className: "text-govuk-heading-m font-bold text-govuk-black group-focus-visible:govuk-link-focus", children }) }),
|
|
126
|
+
summary && /* @__PURE__ */ jsx("span", { className: "block mb-govuk-2", children: /* @__PURE__ */ jsx("span", { className: "text-govuk-body text-govuk-dark-grey group-focus-visible:govuk-link-focus", children: summary }) }),
|
|
127
|
+
/* @__PURE__ */ jsx("span", { className: "block mb-govuk-2", children: /* @__PURE__ */ jsxs("span", { className: "group-focus-visible:govuk-link-focus inline-flex items-center text-govuk-body text-govuk-brand group-hover:text-govuk-black", children: [
|
|
128
|
+
/* @__PURE__ */ jsxs(
|
|
129
|
+
"svg",
|
|
130
|
+
{
|
|
131
|
+
className: "govuk-accordion-chevron transition-transform group-data-panel-open:rotate-180",
|
|
132
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
133
|
+
width: "18",
|
|
134
|
+
height: "18",
|
|
135
|
+
viewBox: "0 0 20 20",
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
focusable: "false",
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ jsx(
|
|
140
|
+
"circle",
|
|
141
|
+
{
|
|
142
|
+
className: "fill-none stroke-current group-hover:fill-govuk-black group-hover:stroke-govuk-black",
|
|
143
|
+
cx: "10",
|
|
144
|
+
cy: "10",
|
|
145
|
+
r: "9",
|
|
146
|
+
strokeWidth: "1"
|
|
147
|
+
}
|
|
148
|
+
),
|
|
149
|
+
/* @__PURE__ */ jsx(
|
|
150
|
+
"polyline",
|
|
151
|
+
{
|
|
152
|
+
className: "fill-none stroke-current group-hover:stroke-govuk-light-grey",
|
|
153
|
+
points: "6.5 8.5 10 12 13.5 8.5",
|
|
154
|
+
strokeWidth: "2",
|
|
155
|
+
strokeLinecap: "round",
|
|
156
|
+
strokeLinejoin: "round"
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ jsx("span", { className: "ml-govuk-1 group-data-panel-open:hidden", children: "Show" }),
|
|
163
|
+
/* @__PURE__ */ jsx("span", { className: "ml-govuk-1 hidden group-data-panel-open:inline", children: "Hide" })
|
|
164
|
+
] }) })
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
) });
|
|
168
|
+
var AccordionContent = ({
|
|
169
|
+
className,
|
|
170
|
+
ref,
|
|
171
|
+
children,
|
|
172
|
+
...props
|
|
173
|
+
}) => /* @__PURE__ */ jsx(
|
|
174
|
+
Accordion$1.Panel,
|
|
175
|
+
{
|
|
176
|
+
ref,
|
|
177
|
+
className: cn("pt-govuk-3 pb-govuk-8 *:last:mb-0", className),
|
|
178
|
+
...props,
|
|
179
|
+
children
|
|
180
|
+
}
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
export { Accordion, AccordionContent, AccordionHeading, AccordionSection };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { cn } from './chunk-WONVZ7WK.js';
|
|
2
|
+
import { Input } from '@base-ui/react/input';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var textInputVariants = cva(
|
|
7
|
+
[
|
|
8
|
+
"box-border w-full",
|
|
9
|
+
"h-10",
|
|
10
|
+
"p-govuk-1",
|
|
11
|
+
"border-2 border-govuk-black",
|
|
12
|
+
"rounded-none",
|
|
13
|
+
"appearance-none",
|
|
14
|
+
"text-govuk-body font-normal font-govuk",
|
|
15
|
+
"focus:outline-3 focus:outline-govuk-yellow focus:outline-offset-0",
|
|
16
|
+
"focus:inset-ring-2 focus:inset-ring-govuk-black",
|
|
17
|
+
"data-[disabled]:opacity-50 data-[disabled]:bg-transparent data-[disabled]:cursor-not-allowed"
|
|
18
|
+
],
|
|
19
|
+
{
|
|
20
|
+
variants: {
|
|
21
|
+
width: {
|
|
22
|
+
full: "",
|
|
23
|
+
30: "max-w-govuk-input-width-30",
|
|
24
|
+
20: "max-w-govuk-input-width-20",
|
|
25
|
+
10: "max-w-govuk-input-width-10",
|
|
26
|
+
5: "max-w-govuk-input-width-5",
|
|
27
|
+
4: "max-w-govuk-input-width-4",
|
|
28
|
+
3: "max-w-govuk-input-width-3",
|
|
29
|
+
2: "max-w-govuk-input-width-2"
|
|
30
|
+
},
|
|
31
|
+
error: {
|
|
32
|
+
true: "border-govuk-error focus:border-govuk-black",
|
|
33
|
+
false: ""
|
|
34
|
+
},
|
|
35
|
+
extraLetterSpacing: {
|
|
36
|
+
true: "tracking-govuk-code tabular-nums",
|
|
37
|
+
false: ""
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
width: "full",
|
|
42
|
+
error: false,
|
|
43
|
+
extraLetterSpacing: false
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
var affixStyles = [
|
|
48
|
+
"box-border flex items-center justify-center",
|
|
49
|
+
"min-w-10 h-10",
|
|
50
|
+
"p-govuk-1",
|
|
51
|
+
"border-2 border-govuk-black",
|
|
52
|
+
"bg-govuk-light-grey",
|
|
53
|
+
"text-govuk-body font-normal font-govuk",
|
|
54
|
+
"text-center whitespace-nowrap",
|
|
55
|
+
"cursor-default flex-none",
|
|
56
|
+
"max-sm:block max-sm:h-auto max-sm:whitespace-normal"
|
|
57
|
+
].join(" ");
|
|
58
|
+
var prefixStyles = cn(affixStyles, "sm:border-r-0", "max-sm:border-b-0");
|
|
59
|
+
var suffixStyles = cn(affixStyles, "sm:border-l-0", "max-sm:border-t-0");
|
|
60
|
+
var TextInput = ({
|
|
61
|
+
className,
|
|
62
|
+
width = "full",
|
|
63
|
+
error = false,
|
|
64
|
+
extraLetterSpacing = false,
|
|
65
|
+
type = "text",
|
|
66
|
+
disabled = false,
|
|
67
|
+
prefix,
|
|
68
|
+
suffix,
|
|
69
|
+
ref,
|
|
70
|
+
...props
|
|
71
|
+
}) => {
|
|
72
|
+
const input = /* @__PURE__ */ jsx(
|
|
73
|
+
Input,
|
|
74
|
+
{
|
|
75
|
+
ref,
|
|
76
|
+
type,
|
|
77
|
+
disabled,
|
|
78
|
+
className: cn(
|
|
79
|
+
textInputVariants({ width, error, extraLetterSpacing }),
|
|
80
|
+
(prefix || suffix) && "flex-auto focus:z-10 max-sm:max-w-full",
|
|
81
|
+
className
|
|
82
|
+
),
|
|
83
|
+
...props
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
if (!prefix && !suffix) return input;
|
|
87
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex max-sm:block", children: [
|
|
88
|
+
prefix && /* @__PURE__ */ jsx("span", { className: prefixStyles, "aria-hidden": "true", children: prefix }),
|
|
89
|
+
input,
|
|
90
|
+
suffix && /* @__PURE__ */ jsx("span", { className: suffixStyles, "aria-hidden": "true", children: suffix })
|
|
91
|
+
] });
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export { TextInput, textInputVariants };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { cn } from './chunk-WONVZ7WK.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var CookieBanner = ({
|
|
5
|
+
className,
|
|
6
|
+
ref,
|
|
7
|
+
children,
|
|
8
|
+
role = "region",
|
|
9
|
+
...props
|
|
10
|
+
}) => /* @__PURE__ */ jsx(
|
|
11
|
+
"div",
|
|
12
|
+
{
|
|
13
|
+
ref,
|
|
14
|
+
role,
|
|
15
|
+
"data-nosnippet": true,
|
|
16
|
+
className: cn(
|
|
17
|
+
"font-govuk text-govuk-body",
|
|
18
|
+
"pt-govuk-4",
|
|
19
|
+
"border-b-govuk-wide border-b-transparent",
|
|
20
|
+
"bg-govuk-light-grey",
|
|
21
|
+
className
|
|
22
|
+
),
|
|
23
|
+
...props,
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
var CookieBannerMessage = ({
|
|
28
|
+
className,
|
|
29
|
+
ref,
|
|
30
|
+
children,
|
|
31
|
+
...props
|
|
32
|
+
}) => /* @__PURE__ */ jsx(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
ref,
|
|
36
|
+
className: cn("max-w-240 mx-auto px-govuk-3", "-mb-govuk-2", className),
|
|
37
|
+
...props,
|
|
38
|
+
children
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
var CookieBannerContent = ({
|
|
42
|
+
className,
|
|
43
|
+
ref,
|
|
44
|
+
children,
|
|
45
|
+
...props
|
|
46
|
+
}) => /* @__PURE__ */ jsx(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
ref,
|
|
50
|
+
className: cn("sm:w-2/3", "mb-govuk-3", "*:last:mb-0", className),
|
|
51
|
+
...props,
|
|
52
|
+
children
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
var CookieBannerHeading = ({
|
|
56
|
+
className,
|
|
57
|
+
ref,
|
|
58
|
+
children,
|
|
59
|
+
...props
|
|
60
|
+
}) => /* @__PURE__ */ jsx(
|
|
61
|
+
"h2",
|
|
62
|
+
{
|
|
63
|
+
ref,
|
|
64
|
+
className: cn(
|
|
65
|
+
"text-govuk-heading-m font-bold text-govuk-black",
|
|
66
|
+
"m-0 mb-govuk-3",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
...props,
|
|
70
|
+
children
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
var CookieBannerActions = ({
|
|
74
|
+
className,
|
|
75
|
+
ref,
|
|
76
|
+
children,
|
|
77
|
+
...props
|
|
78
|
+
}) => /* @__PURE__ */ jsx(
|
|
79
|
+
"div",
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
className: cn(
|
|
83
|
+
"flex flex-col items-start",
|
|
84
|
+
"sm:flex-row sm:flex-wrap sm:items-baseline",
|
|
85
|
+
"gap-govuk-3",
|
|
86
|
+
className
|
|
87
|
+
),
|
|
88
|
+
...props,
|
|
89
|
+
children
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
export { CookieBanner, CookieBannerActions, CookieBannerContent, CookieBannerHeading, CookieBannerMessage };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { cn } from './chunk-WONVZ7WK.js';
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { RadioGroup } from '@base-ui/react/radio-group';
|
|
4
|
+
import { Radio } from '@base-ui/react/radio';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var Radios = ({
|
|
8
|
+
className,
|
|
9
|
+
inline = false,
|
|
10
|
+
children,
|
|
11
|
+
...props
|
|
12
|
+
}) => /* @__PURE__ */ jsx(
|
|
13
|
+
RadioGroup,
|
|
14
|
+
{
|
|
15
|
+
className: cn(
|
|
16
|
+
inline && "sm:flex sm:flex-wrap sm:items-start sm:gap-x-5",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
...props,
|
|
20
|
+
children
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
var RadiosItem = ({
|
|
24
|
+
className,
|
|
25
|
+
children,
|
|
26
|
+
value,
|
|
27
|
+
...props
|
|
28
|
+
}) => {
|
|
29
|
+
const labelId = useId();
|
|
30
|
+
return /* @__PURE__ */ jsxs(
|
|
31
|
+
"label",
|
|
32
|
+
{
|
|
33
|
+
className: cn(
|
|
34
|
+
"flex flex-wrap items-start",
|
|
35
|
+
"relative",
|
|
36
|
+
"mb-2.5 last:mb-0",
|
|
37
|
+
"cursor-pointer",
|
|
38
|
+
className
|
|
39
|
+
),
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsxs(
|
|
42
|
+
Radio.Root,
|
|
43
|
+
{
|
|
44
|
+
value,
|
|
45
|
+
"aria-labelledby": labelId,
|
|
46
|
+
className: cn(
|
|
47
|
+
"group/radio",
|
|
48
|
+
"relative flex-none",
|
|
49
|
+
"w-govuk-radio-touch-target h-govuk-radio-touch-target",
|
|
50
|
+
"cursor-pointer outline-none",
|
|
51
|
+
"data-disabled:cursor-not-allowed data-disabled:opacity-50"
|
|
52
|
+
),
|
|
53
|
+
...props,
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
"span",
|
|
57
|
+
{
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
className: cn(
|
|
60
|
+
"absolute box-border",
|
|
61
|
+
"top-[calc(var(--spacing-govuk-radio-gutter)/2)] left-[calc(var(--spacing-govuk-radio-gutter)/2)]",
|
|
62
|
+
"w-govuk-radio-size h-govuk-radio-size",
|
|
63
|
+
"rounded-full",
|
|
64
|
+
"border-2 border-current bg-transparent",
|
|
65
|
+
"group-focus/radio:border-4",
|
|
66
|
+
"group-focus/radio:shadow-[0_0_0_var(--spacing-govuk-radio-focus-width)_var(--color-govuk-yellow)]",
|
|
67
|
+
"group-focus/radio:outline-govuk-radio-focus-width group-focus/radio:outline-transparent group-focus/radio:outline-offset-1"
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
Radio.Indicator,
|
|
73
|
+
{
|
|
74
|
+
keepMounted: true,
|
|
75
|
+
className: cn(
|
|
76
|
+
"absolute",
|
|
77
|
+
"top-[calc(var(--spacing-govuk-radio-touch-target)/2-var(--spacing-govuk-radio-dot))]",
|
|
78
|
+
"left-[calc(var(--spacing-govuk-radio-touch-target)/2-var(--spacing-govuk-radio-dot))]",
|
|
79
|
+
"w-0 h-0",
|
|
80
|
+
"rounded-full",
|
|
81
|
+
"border-(length:--spacing-govuk-radio-dot) border-current",
|
|
82
|
+
"bg-current",
|
|
83
|
+
"opacity-0 data-checked:opacity-100"
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
"span",
|
|
92
|
+
{
|
|
93
|
+
id: labelId,
|
|
94
|
+
className: cn(
|
|
95
|
+
"self-center",
|
|
96
|
+
"py-govuk-button-pb px-govuk-radio-label-padding-x",
|
|
97
|
+
"text-govuk-tag font-normal font-govuk",
|
|
98
|
+
"cursor-pointer"
|
|
99
|
+
),
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
var RadiosHint = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
108
|
+
"span",
|
|
109
|
+
{
|
|
110
|
+
className: cn(
|
|
111
|
+
"block w-full",
|
|
112
|
+
"-mt-govuk-1",
|
|
113
|
+
"pr-govuk-radio-label-padding-x",
|
|
114
|
+
"pl-[calc(var(--spacing-govuk-radio-label-padding-x)+var(--spacing-govuk-radio-touch-target))]",
|
|
115
|
+
"text-govuk-tag font-normal font-govuk text-govuk-dark-grey",
|
|
116
|
+
className
|
|
117
|
+
),
|
|
118
|
+
...props
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
var RadiosDivider = ({
|
|
122
|
+
className,
|
|
123
|
+
children = "or",
|
|
124
|
+
...props
|
|
125
|
+
}) => /* @__PURE__ */ jsx(
|
|
126
|
+
"div",
|
|
127
|
+
{
|
|
128
|
+
className: cn(
|
|
129
|
+
"w-govuk-radio-size",
|
|
130
|
+
"mb-2.5",
|
|
131
|
+
"text-govuk-tag font-normal font-govuk text-govuk-black",
|
|
132
|
+
"text-center",
|
|
133
|
+
className
|
|
134
|
+
),
|
|
135
|
+
...props,
|
|
136
|
+
children
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
export { Radios, RadiosDivider, RadiosHint, RadiosItem };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { cn } from './chunk-WONVZ7WK.js';
|
|
2
|
+
import { cva } from 'class-variance-authority';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var tagVariants = cva(
|
|
6
|
+
[
|
|
7
|
+
"inline-block",
|
|
8
|
+
"px-govuk-tag-x pt-govuk-tag-pt pb-govuk-tag-pb",
|
|
9
|
+
"mt-govuk-tag-mt mb-govuk-tag-mb",
|
|
10
|
+
"rounded-govuk-tag",
|
|
11
|
+
"text-govuk-tag font-normal font-govuk",
|
|
12
|
+
"no-underline break-words",
|
|
13
|
+
"max-w-govuk-tag-max-width",
|
|
14
|
+
"forced-colors:font-bold"
|
|
15
|
+
],
|
|
16
|
+
{
|
|
17
|
+
variants: {
|
|
18
|
+
colour: {
|
|
19
|
+
blue: "text-govuk-tag-blue bg-govuk-tag-blue-bg",
|
|
20
|
+
green: "text-govuk-tag-green bg-govuk-tag-green-bg",
|
|
21
|
+
teal: "text-govuk-tag-teal bg-govuk-tag-teal-bg",
|
|
22
|
+
purple: "text-govuk-tag-purple bg-govuk-tag-purple-bg",
|
|
23
|
+
magenta: "text-govuk-tag-magenta bg-govuk-tag-magenta-bg",
|
|
24
|
+
red: "text-govuk-tag-red bg-govuk-tag-red-bg",
|
|
25
|
+
orange: "text-govuk-tag-orange bg-govuk-tag-orange-bg",
|
|
26
|
+
yellow: "text-govuk-tag-yellow bg-govuk-tag-yellow-bg",
|
|
27
|
+
grey: "text-govuk-black bg-govuk-grey"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
colour: "blue"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
var Tag = ({ className, colour = "blue", ref, ...props }) => /* @__PURE__ */ jsx(
|
|
36
|
+
"strong",
|
|
37
|
+
{
|
|
38
|
+
ref,
|
|
39
|
+
className: cn(tagVariants({ colour }), className),
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
export { Tag, tagVariants };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { cn } from './chunk-WONVZ7WK.js';
|
|
2
|
+
import { useId } from 'react';
|
|
3
|
+
import { Checkbox } from '@base-ui/react/checkbox';
|
|
4
|
+
import { CheckboxGroup } from '@base-ui/react/checkbox-group';
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var Checkboxes = ({ className, children, ...props }) => /* @__PURE__ */ jsx(CheckboxGroup, { className: cn(className), ...props, children });
|
|
8
|
+
var CheckboxesItem = ({
|
|
9
|
+
className,
|
|
10
|
+
children,
|
|
11
|
+
value,
|
|
12
|
+
small = false,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const labelId = useId();
|
|
16
|
+
return /* @__PURE__ */ jsxs(
|
|
17
|
+
"label",
|
|
18
|
+
{
|
|
19
|
+
className: cn(
|
|
20
|
+
"flex flex-wrap items-start",
|
|
21
|
+
"relative",
|
|
22
|
+
small ? "group/item mb-0" : "mb-2.5 last:mb-0",
|
|
23
|
+
"cursor-pointer touch-action-manipulation",
|
|
24
|
+
className
|
|
25
|
+
),
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxs(
|
|
28
|
+
Checkbox.Root,
|
|
29
|
+
{
|
|
30
|
+
value,
|
|
31
|
+
"aria-labelledby": labelId,
|
|
32
|
+
className: cn(
|
|
33
|
+
"group/checkbox",
|
|
34
|
+
"relative flex-none",
|
|
35
|
+
"w-govuk-checkbox-touch-target h-govuk-checkbox-touch-target",
|
|
36
|
+
"cursor-pointer outline-none"
|
|
37
|
+
),
|
|
38
|
+
...props,
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
"aria-hidden": "true",
|
|
44
|
+
className: cn(
|
|
45
|
+
"absolute box-border",
|
|
46
|
+
small ? "top-govuk-checkbox-small-box-offset left-govuk-checkbox-small-box-offset w-govuk-checkbox-small-size h-govuk-checkbox-small-size" : "top-[calc(var(--spacing-govuk-checkbox-gutter)/2)] left-[calc(var(--spacing-govuk-checkbox-gutter)/2)] w-govuk-checkbox-size h-govuk-checkbox-size",
|
|
47
|
+
"border-2 border-current bg-transparent",
|
|
48
|
+
"govuk-checkbox-composed-shadow",
|
|
49
|
+
"group-focus/checkbox:border-4",
|
|
50
|
+
"group-focus/checkbox:govuk-checkbox-focus-shadow",
|
|
51
|
+
"group-focus/checkbox:outline-3 group-focus/checkbox:outline-transparent group-focus/checkbox:outline-offset-1",
|
|
52
|
+
small && "group-hover/item:govuk-checkbox-small-hover"
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
Checkbox.Indicator,
|
|
58
|
+
{
|
|
59
|
+
keepMounted: true,
|
|
60
|
+
className: cn(
|
|
61
|
+
"absolute box-border",
|
|
62
|
+
small ? "top-govuk-checkbox-small-check-top left-govuk-checkbox-small-check-left w-govuk-checkbox-small-check-width h-govuk-checkbox-small-check-height govuk-checkmark-small" : "top-govuk-checkbox-check-top left-govuk-checkbox-check-left w-govuk-checkbox-check-width h-govuk-checkbox-check-height govuk-checkmark",
|
|
63
|
+
"opacity-0 data-checked:opacity-100"
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
"span",
|
|
72
|
+
{
|
|
73
|
+
id: labelId,
|
|
74
|
+
className: cn(
|
|
75
|
+
"self-center",
|
|
76
|
+
"py-govuk-checkbox-label-padding-y px-govuk-checkbox-label-padding-x",
|
|
77
|
+
"text-govuk-tag font-normal font-govuk",
|
|
78
|
+
"cursor-pointer"
|
|
79
|
+
),
|
|
80
|
+
children
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
var CheckboxesHint = ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
88
|
+
"span",
|
|
89
|
+
{
|
|
90
|
+
className: cn(
|
|
91
|
+
"block w-full",
|
|
92
|
+
"-mt-govuk-1",
|
|
93
|
+
"pr-govuk-checkbox-label-padding-x",
|
|
94
|
+
"pl-[calc(var(--spacing-govuk-checkbox-label-padding-x)+var(--spacing-govuk-checkbox-touch-target))]",
|
|
95
|
+
"text-govuk-tag font-normal font-govuk text-govuk-dark-grey",
|
|
96
|
+
className
|
|
97
|
+
),
|
|
98
|
+
...props
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
var CheckboxesDivider = ({
|
|
102
|
+
className,
|
|
103
|
+
children = "or",
|
|
104
|
+
small = false,
|
|
105
|
+
...props
|
|
106
|
+
}) => /* @__PURE__ */ jsx(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
className: cn(
|
|
110
|
+
small ? "w-govuk-checkbox-small-size mb-govuk-1" : "w-govuk-checkbox-size mb-govuk-2",
|
|
111
|
+
"text-govuk-tag font-normal font-govuk text-govuk-black",
|
|
112
|
+
"text-center",
|
|
113
|
+
className
|
|
114
|
+
),
|
|
115
|
+
...props,
|
|
116
|
+
children
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
var CheckboxesConditional = ({
|
|
120
|
+
className,
|
|
121
|
+
...props
|
|
122
|
+
}) => /* @__PURE__ */ jsx(
|
|
123
|
+
"div",
|
|
124
|
+
{
|
|
125
|
+
className: cn(
|
|
126
|
+
"ml-govuk-checkbox-conditional-ml pl-govuk-checkbox-conditional-pl",
|
|
127
|
+
"mb-5",
|
|
128
|
+
"border-l-2 border-govuk-grey",
|
|
129
|
+
"*:last:mb-0",
|
|
130
|
+
className
|
|
131
|
+
),
|
|
132
|
+
...props
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
export { Checkboxes, CheckboxesConditional, CheckboxesDivider, CheckboxesHint, CheckboxesItem };
|