whitehall-ui 1.0.0 → 2.1.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 +13 -3
- package/dist/{chunk-KWAC6IEK.js → chunk-2KB4IAMZ.js} +9 -22
- package/dist/chunk-3NOO2YUQ.js +139 -0
- package/dist/{chunk-5TI2WXYU.js → chunk-3UX7QPLM.js} +10 -21
- 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-JU7A7KQI.js +152 -0
- 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-YMQVN3MH.js +100 -0
- 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 +10 -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 +9 -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 +208 -41
- 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-LRNZYPC2.js +0 -107
- package/dist/chunk-NRXTKHI2.js +0 -169
- package/dist/chunk-PGZHPAT5.js +0 -183
- package/dist/chunk-RPV43YDC.js +0 -93
- package/dist/chunk-SK27BMU5.js +0 -140
- package/dist/chunk-UWQFFFTB.js +0 -136
- 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,177 @@
|
|
|
1
|
+
import { buttonVariants } from './chunk-ASBIQC77.js';
|
|
2
|
+
import { cn } from './chunk-GKHD33N6.js';
|
|
3
|
+
import { useState, useRef, useEffectEvent, useEffect } from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var REQUIRED_PRESSES = 3;
|
|
8
|
+
var TIMEOUT_MS = 5e3;
|
|
9
|
+
var HIDE_CONTENT_CLASS = "govuk-exit-this-page-hide-content";
|
|
10
|
+
var ExitThisPage = ({
|
|
11
|
+
className,
|
|
12
|
+
redirectUrl = "https://www.bbc.co.uk/weather",
|
|
13
|
+
text = "Exit this page",
|
|
14
|
+
activatedText = "Loading.",
|
|
15
|
+
timedOutText = "Exit this page expired.",
|
|
16
|
+
pressTwoMoreTimesText = "Shift, press 2 more times to exit.",
|
|
17
|
+
pressOneMoreTimeText = "Shift, press 1 more time to exit.",
|
|
18
|
+
...props
|
|
19
|
+
}) => {
|
|
20
|
+
const [keypressCount, setKeypressCount] = useState(0);
|
|
21
|
+
const [announcement, setAnnouncement] = useState("");
|
|
22
|
+
const [activated, setActivated] = useState(false);
|
|
23
|
+
const countRef = useRef(0);
|
|
24
|
+
const lastKeyModifiedRef = useRef(false);
|
|
25
|
+
const keypressTimeoutRef = useRef(void 0);
|
|
26
|
+
const messageTimeoutRef = useRef(void 0);
|
|
27
|
+
const exitPage = () => {
|
|
28
|
+
setAnnouncement("");
|
|
29
|
+
setActivated(true);
|
|
30
|
+
document.body.classList.add(HIDE_CONTENT_CLASS);
|
|
31
|
+
globalThis.location.assign(redirectUrl);
|
|
32
|
+
};
|
|
33
|
+
const clearKeypressTimer = () => {
|
|
34
|
+
globalThis.clearTimeout(keypressTimeoutRef.current);
|
|
35
|
+
keypressTimeoutRef.current = void 0;
|
|
36
|
+
};
|
|
37
|
+
const resetKeypressTimer = () => {
|
|
38
|
+
clearKeypressTimer();
|
|
39
|
+
countRef.current = 0;
|
|
40
|
+
setKeypressCount(0);
|
|
41
|
+
setAnnouncement(timedOutText);
|
|
42
|
+
globalThis.clearTimeout(messageTimeoutRef.current);
|
|
43
|
+
messageTimeoutRef.current = globalThis.setTimeout(() => {
|
|
44
|
+
setAnnouncement("");
|
|
45
|
+
}, TIMEOUT_MS);
|
|
46
|
+
};
|
|
47
|
+
const onKeyup = useEffectEvent((event) => {
|
|
48
|
+
if (event.key === "Shift" && !lastKeyModifiedRef.current) {
|
|
49
|
+
countRef.current += 1;
|
|
50
|
+
setKeypressCount(countRef.current);
|
|
51
|
+
globalThis.clearTimeout(messageTimeoutRef.current);
|
|
52
|
+
if (countRef.current >= REQUIRED_PRESSES) {
|
|
53
|
+
countRef.current = 0;
|
|
54
|
+
clearKeypressTimer();
|
|
55
|
+
exitPage();
|
|
56
|
+
} else {
|
|
57
|
+
setAnnouncement(
|
|
58
|
+
countRef.current === 1 ? pressTwoMoreTimesText : pressOneMoreTimeText
|
|
59
|
+
);
|
|
60
|
+
clearKeypressTimer();
|
|
61
|
+
keypressTimeoutRef.current = globalThis.setTimeout(
|
|
62
|
+
resetKeypressTimer,
|
|
63
|
+
TIMEOUT_MS
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
} else if (keypressTimeoutRef.current !== void 0) {
|
|
67
|
+
resetKeypressTimer();
|
|
68
|
+
}
|
|
69
|
+
lastKeyModifiedRef.current = event.shiftKey;
|
|
70
|
+
});
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const keypressTimeout = keypressTimeoutRef;
|
|
73
|
+
const messageTimeout = messageTimeoutRef;
|
|
74
|
+
const handleKeyup = (event) => onKeyup(event);
|
|
75
|
+
const handlePageShow = (event) => {
|
|
76
|
+
if (!event.persisted) return;
|
|
77
|
+
document.body.classList.remove(HIDE_CONTENT_CLASS);
|
|
78
|
+
globalThis.clearTimeout(keypressTimeout.current);
|
|
79
|
+
globalThis.clearTimeout(messageTimeout.current);
|
|
80
|
+
keypressTimeout.current = void 0;
|
|
81
|
+
countRef.current = 0;
|
|
82
|
+
setKeypressCount(0);
|
|
83
|
+
setAnnouncement("");
|
|
84
|
+
setActivated(false);
|
|
85
|
+
};
|
|
86
|
+
document.addEventListener("keyup", handleKeyup, true);
|
|
87
|
+
globalThis.addEventListener("pageshow", handlePageShow);
|
|
88
|
+
return () => {
|
|
89
|
+
document.removeEventListener("keyup", handleKeyup, true);
|
|
90
|
+
globalThis.removeEventListener("pageshow", handlePageShow);
|
|
91
|
+
globalThis.clearTimeout(keypressTimeout.current);
|
|
92
|
+
globalThis.clearTimeout(messageTimeout.current);
|
|
93
|
+
};
|
|
94
|
+
}, []);
|
|
95
|
+
return /* @__PURE__ */ jsxs(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
"data-exit-this-page": true,
|
|
99
|
+
className: cn(
|
|
100
|
+
"block sm:inline-block",
|
|
101
|
+
"sticky top-0 left-0 z-govuk-exit-page w-full",
|
|
102
|
+
"mb-govuk-6 sm:mb-govuk-8",
|
|
103
|
+
"sm:right-0 sm:left-auto sm:w-auto sm:float-right",
|
|
104
|
+
"print:hidden",
|
|
105
|
+
className
|
|
106
|
+
),
|
|
107
|
+
...props,
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsxs(
|
|
110
|
+
"a",
|
|
111
|
+
{
|
|
112
|
+
href: redirectUrl,
|
|
113
|
+
role: "button",
|
|
114
|
+
draggable: false,
|
|
115
|
+
rel: "nofollow noreferrer",
|
|
116
|
+
onClick: (event) => {
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
exitPage();
|
|
119
|
+
},
|
|
120
|
+
onKeyDown: (event) => {
|
|
121
|
+
if (event.key !== " ") return;
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
event.currentTarget.click();
|
|
124
|
+
},
|
|
125
|
+
className: cn(
|
|
126
|
+
buttonVariants({ variant: "warning" }),
|
|
127
|
+
"mb-0 max-sm:w-full"
|
|
128
|
+
),
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Emergency" }),
|
|
131
|
+
" ",
|
|
132
|
+
text,
|
|
133
|
+
/* @__PURE__ */ jsx(
|
|
134
|
+
"span",
|
|
135
|
+
{
|
|
136
|
+
"aria-hidden": "true",
|
|
137
|
+
className: cn(
|
|
138
|
+
"p-govuk-2 pb-0 leading-0 pointer-events-none text-center",
|
|
139
|
+
keypressCount > 0 ? "block" : "hidden"
|
|
140
|
+
),
|
|
141
|
+
children: [0, 1, 2].map((index) => /* @__PURE__ */ jsx(
|
|
142
|
+
"span",
|
|
143
|
+
{
|
|
144
|
+
className: cn(
|
|
145
|
+
"inline-block box-border rounded-full",
|
|
146
|
+
"w-govuk-exit-page-dot h-govuk-exit-page-dot",
|
|
147
|
+
"mx-govuk-exit-page-dot-gap",
|
|
148
|
+
"border-2 border-solid border-current",
|
|
149
|
+
index < keypressCount && "border-govuk-exit-page-dot"
|
|
150
|
+
)
|
|
151
|
+
},
|
|
152
|
+
index
|
|
153
|
+
))
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ jsx("output", { className: "sr-only", children: announcement }),
|
|
160
|
+
activated && createPortal(
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
162
|
+
"div",
|
|
163
|
+
{
|
|
164
|
+
role: "alert",
|
|
165
|
+
"data-exit-overlay": true,
|
|
166
|
+
className: "fixed inset-0 z-govuk-exit-page-overlay bg-govuk-canvas text-govuk-canvas-text",
|
|
167
|
+
children: activatedText
|
|
168
|
+
}
|
|
169
|
+
),
|
|
170
|
+
document.body
|
|
171
|
+
)
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export { ExitThisPage };
|
|
@@ -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 })
|