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.
Files changed (148) hide show
  1. package/README.md +13 -3
  2. package/dist/{chunk-KWAC6IEK.js → chunk-2KB4IAMZ.js} +9 -22
  3. package/dist/chunk-3NOO2YUQ.js +139 -0
  4. package/dist/{chunk-5TI2WXYU.js → chunk-3UX7QPLM.js} +10 -21
  5. package/dist/{chunk-OP35ZJ4X.js → chunk-4TBXH62Z.js} +6 -7
  6. package/dist/{chunk-M6CLPMRP.js → chunk-6WLHJ5MN.js} +34 -76
  7. package/dist/chunk-7IOR7UNU.js +77 -0
  8. package/dist/chunk-7Q2C5RB7.js +167 -0
  9. package/dist/{chunk-5PIQJ22R.js → chunk-ASBIQC77.js} +13 -18
  10. package/dist/{chunk-KD4LPFIZ.js → chunk-C2YQVLZ7.js} +15 -18
  11. package/dist/chunk-CBT6WCJ7.js +52 -0
  12. package/dist/{chunk-3YIKJK6M.js → chunk-CYBPAHLZ.js} +48 -52
  13. package/dist/{chunk-VB6V3PHD.js → chunk-D2T6BUOB.js} +6 -16
  14. package/dist/chunk-DZ3743JO.js +38 -0
  15. package/dist/{chunk-AO6HPG4R.js → chunk-EDOSCND4.js} +5 -20
  16. package/dist/chunk-FJHNUBEM.js +59 -0
  17. package/dist/chunk-FVBDMMNR.js +143 -0
  18. package/dist/chunk-GKHD33N6.js +52 -0
  19. package/dist/{chunk-3INCIYDO.js → chunk-GLDCEDTR.js} +22 -77
  20. package/dist/{chunk-G6T44BDV.js → chunk-HBLVAX45.js} +7 -11
  21. package/dist/chunk-JU7A7KQI.js +152 -0
  22. package/dist/chunk-KXQGZLMK.js +120 -0
  23. package/dist/{chunk-CEPBVMFU.js → chunk-MFI5R2TJ.js} +1 -3
  24. package/dist/{chunk-5XNKIBMP.js → chunk-MYMVHSRJ.js} +3 -4
  25. package/dist/chunk-N5PY3VZH.js +192 -0
  26. package/dist/{chunk-P4GCF5FQ.js → chunk-OQILIT3B.js} +26 -15
  27. package/dist/{chunk-6VXVJERU.js → chunk-QKR7NELW.js} +4 -8
  28. package/dist/chunk-QPN5J5IU.js +177 -0
  29. package/dist/chunk-RGXB6M3G.js +87 -0
  30. package/dist/chunk-TAVSU2XB.js +90 -0
  31. package/dist/chunk-TGNN5ZP3.js +81 -0
  32. package/dist/chunk-TICBCBDN.js +18 -0
  33. package/dist/{chunk-7ZCZQN5N.js → chunk-UK7RLSTJ.js} +15 -22
  34. package/dist/chunk-UXOJELVU.js +37 -0
  35. package/dist/{chunk-QTSEOPVX.js → chunk-VCJE5UO2.js} +23 -25
  36. package/dist/{chunk-N67H5OUQ.js → chunk-VHSAXVCF.js} +7 -5
  37. package/dist/chunk-VMI2XU5D.js +74 -0
  38. package/dist/{chunk-TXGBUZB4.js → chunk-VRGDQ3SF.js} +3 -10
  39. package/dist/chunk-W4CWUYTA.js +44 -0
  40. package/dist/chunk-YMQVN3MH.js +100 -0
  41. package/dist/chunk-ZAKQHDVD.js +40 -0
  42. package/dist/chunk-ZJB7BBTN.js +188 -0
  43. package/dist/index.d.ts +15 -13
  44. package/dist/index.js +41 -39
  45. package/dist/lib/utils.d.ts +2 -1
  46. package/dist/lib/utils.js +1 -1
  47. package/dist/ui/accordion.d.ts +8 -13
  48. package/dist/ui/accordion.js +2 -2
  49. package/dist/ui/back-link.d.ts +4 -4
  50. package/dist/ui/back-link.js +2 -2
  51. package/dist/ui/breadcrumbs.d.ts +10 -16
  52. package/dist/ui/breadcrumbs.js +2 -2
  53. package/dist/ui/button.d.ts +7 -8
  54. package/dist/ui/button.js +2 -2
  55. package/dist/ui/character-count.d.ts +11 -15
  56. package/dist/ui/character-count.js +3 -3
  57. package/dist/ui/checkboxes.d.ts +10 -17
  58. package/dist/ui/checkboxes.js +2 -2
  59. package/dist/ui/cookie-banner.d.ts +12 -21
  60. package/dist/ui/cookie-banner.js +2 -2
  61. package/dist/ui/date-input.d.ts +10 -16
  62. package/dist/ui/date-input.js +2 -2
  63. package/dist/ui/details.d.ts +8 -17
  64. package/dist/ui/details.js +2 -2
  65. package/dist/ui/error-message.d.ts +4 -4
  66. package/dist/ui/error-message.js +2 -2
  67. package/dist/ui/error-summary.d.ts +5 -4
  68. package/dist/ui/error-summary.js +2 -2
  69. package/dist/ui/exit-this-page.d.ts +4 -4
  70. package/dist/ui/exit-this-page.js +3 -3
  71. package/dist/ui/feedback.d.ts +13 -0
  72. package/dist/ui/feedback.js +2 -0
  73. package/dist/ui/fieldset.d.ts +9 -13
  74. package/dist/ui/fieldset.js +2 -2
  75. package/dist/ui/file-upload.d.ts +4 -5
  76. package/dist/ui/file-upload.js +2 -2
  77. package/dist/ui/footer.d.ts +39 -50
  78. package/dist/ui/footer.js +2 -2
  79. package/dist/ui/generic-header.d.ts +10 -15
  80. package/dist/ui/generic-header.js +2 -2
  81. package/dist/ui/header.d.ts +14 -32
  82. package/dist/ui/header.js +2 -2
  83. package/dist/ui/hint.d.ts +4 -5
  84. package/dist/ui/hint.js +2 -2
  85. package/dist/ui/inset-text.d.ts +4 -5
  86. package/dist/ui/inset-text.js +2 -2
  87. package/dist/ui/label.d.ts +7 -9
  88. package/dist/ui/label.js +2 -2
  89. package/dist/ui/language-navigation.d.ts +20 -0
  90. package/dist/ui/language-navigation.js +2 -0
  91. package/dist/ui/link.d.ts +5 -6
  92. package/dist/ui/link.js +2 -2
  93. package/dist/ui/notification-banner.d.ts +15 -24
  94. package/dist/ui/notification-banner.js +2 -2
  95. package/dist/ui/pagination.d.ts +20 -34
  96. package/dist/ui/pagination.js +2 -2
  97. package/dist/ui/panel.d.ts +11 -12
  98. package/dist/ui/panel.js +2 -2
  99. package/dist/ui/password-input.d.ts +7 -6
  100. package/dist/ui/password-input.js +4 -4
  101. package/dist/ui/phase-banner.d.ts +10 -17
  102. package/dist/ui/phase-banner.js +2 -2
  103. package/dist/ui/radios.d.ts +9 -13
  104. package/dist/ui/radios.js +2 -2
  105. package/dist/ui/select.d.ts +6 -30
  106. package/dist/ui/select.js +2 -2
  107. package/dist/ui/service-navigation.d.ts +15 -23
  108. package/dist/ui/service-navigation.js +2 -2
  109. package/dist/ui/skip-link.d.ts +4 -5
  110. package/dist/ui/skip-link.js +2 -2
  111. package/dist/ui/summary-list.d.ts +24 -41
  112. package/dist/ui/summary-list.js +2 -2
  113. package/dist/ui/table.d.ts +21 -26
  114. package/dist/ui/table.js +2 -2
  115. package/dist/ui/tabs.d.ts +7 -9
  116. package/dist/ui/tabs.js +2 -2
  117. package/dist/ui/tag.d.ts +4 -6
  118. package/dist/ui/tag.js +2 -2
  119. package/dist/ui/task-list.d.ts +14 -23
  120. package/dist/ui/task-list.js +2 -2
  121. package/dist/ui/text-input.d.ts +5 -6
  122. package/dist/ui/text-input.js +2 -2
  123. package/dist/ui/textarea.d.ts +4 -6
  124. package/dist/ui/textarea.js +2 -2
  125. package/dist/ui/warning-text.d.ts +4 -4
  126. package/dist/ui/warning-text.js +2 -2
  127. package/package.json +111 -263
  128. package/registry/default/theme/govuk-tokens.css +208 -41
  129. package/dist/chunk-2QKZ6DPC.js +0 -27
  130. package/dist/chunk-4MXR4WNS.js +0 -17
  131. package/dist/chunk-5AKGRLG2.js +0 -190
  132. package/dist/chunk-5H55YDJS.js +0 -69
  133. package/dist/chunk-72PH2FMG.js +0 -180
  134. package/dist/chunk-GUZIKVAE.js +0 -119
  135. package/dist/chunk-JESMK3XK.js +0 -105
  136. package/dist/chunk-JFZN5XP6.js +0 -88
  137. package/dist/chunk-LRNZYPC2.js +0 -107
  138. package/dist/chunk-NRXTKHI2.js +0 -169
  139. package/dist/chunk-PGZHPAT5.js +0 -183
  140. package/dist/chunk-RPV43YDC.js +0 -93
  141. package/dist/chunk-SK27BMU5.js +0 -140
  142. package/dist/chunk-UWQFFFTB.js +0 -136
  143. package/dist/chunk-VQOCX44T.js +0 -41
  144. package/dist/chunk-WONVZ7WK.js +0 -29
  145. package/dist/chunk-WPPWPEFV.js +0 -150
  146. package/dist/chunk-XQOYWPKV.js +0 -48
  147. package/dist/chunk-YAKI4SI7.js +0 -205
  148. package/dist/chunk-YCLGXX3R.js +0 -68
@@ -0,0 +1,152 @@
1
+ import { cn } from './chunk-GKHD33N6.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, Fragment } from 'react/jsx-runtime';
6
+
7
+ var Checkboxes = (props) => /* @__PURE__ */ jsx(CheckboxGroup, { ...props });
8
+ var CheckboxesItem = ({
9
+ className,
10
+ children,
11
+ hint,
12
+ "aria-describedby": ariaDescribedBy,
13
+ small,
14
+ ...props
15
+ }) => {
16
+ const labelId = useId();
17
+ const hintId = useId();
18
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
19
+ /* @__PURE__ */ jsxs(
20
+ "label",
21
+ {
22
+ className: cn(
23
+ "flex flex-wrap items-start",
24
+ "relative",
25
+ small ? "group/item mb-0" : "mb-govuk-2 last:mb-0",
26
+ "cursor-pointer touch-manipulation",
27
+ "has-data-[disabled]:opacity-50 has-data-[disabled]:cursor-not-allowed",
28
+ className
29
+ ),
30
+ children: [
31
+ /* @__PURE__ */ jsxs(
32
+ Checkbox.Root,
33
+ {
34
+ "aria-labelledby": labelId,
35
+ "aria-describedby": `${hint ? hintId : ""} ${ariaDescribedBy ?? ""}`.trim() || void 0,
36
+ className: cn(
37
+ "group/checkbox",
38
+ "relative flex-none",
39
+ "w-govuk-checkbox-touch-target h-govuk-checkbox-touch-target",
40
+ "outline-none",
41
+ small && "-ml-govuk-2"
42
+ ),
43
+ ...props,
44
+ children: [
45
+ /* @__PURE__ */ jsx(
46
+ "span",
47
+ {
48
+ "aria-hidden": "true",
49
+ className: cn(
50
+ "absolute box-border",
51
+ 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",
52
+ "border-2 border-current bg-transparent",
53
+ "govuk-checkbox-composed-shadow",
54
+ "group-focus/checkbox:border-4",
55
+ "group-focus/checkbox:govuk-checkbox-focus-shadow",
56
+ "group-focus/checkbox:outline-3 group-focus/checkbox:outline-transparent group-focus/checkbox:outline-offset-1",
57
+ small && "group-hover/item:govuk-checkbox-small-hover"
58
+ )
59
+ }
60
+ ),
61
+ /* @__PURE__ */ jsx(
62
+ Checkbox.Indicator,
63
+ {
64
+ keepMounted: true,
65
+ className: cn(
66
+ "absolute box-border",
67
+ 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",
68
+ "opacity-0 data-checked:opacity-100"
69
+ )
70
+ }
71
+ )
72
+ ]
73
+ }
74
+ ),
75
+ /* @__PURE__ */ jsx(
76
+ "span",
77
+ {
78
+ id: labelId,
79
+ className: cn(
80
+ "self-center",
81
+ "py-govuk-checkbox-label-padding-y px-govuk-checkbox-label-padding-x",
82
+ "text-govuk-tag font-normal font-govuk",
83
+ small ? "pl-px max-w-[calc(100%-50px)]" : "max-w-[calc(100%-74px)]"
84
+ ),
85
+ children
86
+ }
87
+ )
88
+ ]
89
+ }
90
+ ),
91
+ hint && /* @__PURE__ */ jsx(
92
+ CheckboxesHint,
93
+ {
94
+ id: hintId,
95
+ className: cn(
96
+ small && "pl-[calc(var(--spacing-govuk-checkbox-touch-target)-var(--spacing-govuk-2))]"
97
+ ),
98
+ children: hint
99
+ }
100
+ )
101
+ ] });
102
+ };
103
+ var CheckboxesHint = ({ className, ...props }) => /* @__PURE__ */ jsx(
104
+ "span",
105
+ {
106
+ className: cn(
107
+ "block w-full",
108
+ "-mt-govuk-3 mb-govuk-2 last:mb-0",
109
+ "pr-govuk-checkbox-label-padding-x",
110
+ "pl-[calc(var(--spacing-govuk-checkbox-label-padding-x)+var(--spacing-govuk-checkbox-touch-target))]",
111
+ "text-govuk-tag font-normal font-govuk text-govuk-dark-grey",
112
+ className
113
+ ),
114
+ ...props
115
+ }
116
+ );
117
+ var CheckboxesDivider = ({
118
+ className,
119
+ children = "or",
120
+ small,
121
+ ...props
122
+ }) => /* @__PURE__ */ jsx(
123
+ "div",
124
+ {
125
+ className: cn(
126
+ small ? "w-govuk-checkbox-small-size mb-govuk-1" : "w-govuk-checkbox-size mb-govuk-2",
127
+ "text-govuk-tag font-normal font-govuk text-govuk-black",
128
+ "text-center",
129
+ className
130
+ ),
131
+ ...props,
132
+ children
133
+ }
134
+ );
135
+ var CheckboxesConditional = ({
136
+ className,
137
+ ...props
138
+ }) => /* @__PURE__ */ jsx(
139
+ "div",
140
+ {
141
+ className: cn(
142
+ "ml-govuk-checkbox-conditional-ml pl-govuk-checkbox-conditional-pl",
143
+ "mb-govuk-3 sm:mb-govuk-4",
144
+ "border-l-4 border-govuk-grey",
145
+ "*:last:mb-0",
146
+ className
147
+ ),
148
+ ...props
149
+ }
150
+ );
151
+
152
+ export { Checkboxes, CheckboxesConditional, CheckboxesDivider, CheckboxesHint, CheckboxesItem };
@@ -0,0 +1,120 @@
1
+ import { cn, mergeRefs } from './chunk-GKHD33N6.js';
2
+ import { useRef, useEffect } from 'react';
3
+ import { jsx } from 'react/jsx-runtime';
4
+
5
+ var NotificationBanner = ({
6
+ className,
7
+ variant = "default",
8
+ disableAutoFocus,
9
+ ref,
10
+ ...props
11
+ }) => {
12
+ const innerRef = useRef(null);
13
+ useEffect(() => {
14
+ const node = innerRef.current;
15
+ if (variant !== "success" || disableAutoFocus || !node) return;
16
+ node.setAttribute("tabindex", "-1");
17
+ node.addEventListener("blur", () => node.removeAttribute("tabindex"), {
18
+ once: true
19
+ });
20
+ node.focus();
21
+ }, [variant, disableAutoFocus]);
22
+ return /* @__PURE__ */ jsx(
23
+ "section",
24
+ {
25
+ ref: mergeRefs(innerRef, ref),
26
+ role: variant === "success" ? "alert" : void 0,
27
+ "aria-labelledby": "govuk-notification-banner-title",
28
+ "data-variant": variant,
29
+ className: cn(
30
+ "group/banner font-govuk text-govuk-body",
31
+ "mb-govuk-6 sm:mb-govuk-8",
32
+ variant === "success" ? "border-govuk-notification-banner-success bg-govuk-green" : "border-govuk-notification-banner bg-govuk-brand",
33
+ "focus:outline-3 focus:outline-govuk-yellow",
34
+ className
35
+ ),
36
+ ...props
37
+ }
38
+ );
39
+ };
40
+ var NotificationBannerHeader = ({
41
+ className,
42
+ ...props
43
+ }) => /* @__PURE__ */ jsx(
44
+ "div",
45
+ {
46
+ className: cn(
47
+ "py-govuk-1 px-govuk-3 sm:px-govuk-4",
48
+ "border-b border-b-transparent",
49
+ className
50
+ ),
51
+ ...props
52
+ }
53
+ );
54
+ var NotificationBannerTitle = ({
55
+ className,
56
+ children = "Important",
57
+ ...props
58
+ }) => /* @__PURE__ */ jsx(
59
+ "h2",
60
+ {
61
+ id: "govuk-notification-banner-title",
62
+ className: cn("text-govuk-body font-bold m-0 p-0 text-white", className),
63
+ ...props,
64
+ children
65
+ }
66
+ );
67
+ var NotificationBannerContent = ({
68
+ className,
69
+ ...props
70
+ }) => /* @__PURE__ */ jsx(
71
+ "div",
72
+ {
73
+ className: cn(
74
+ "p-govuk-3 sm:p-govuk-4",
75
+ "text-govuk-black bg-white",
76
+ "*:box-border *:max-w-govuk-notification-content *:last:mb-0",
77
+ className
78
+ ),
79
+ ...props
80
+ }
81
+ );
82
+ var NotificationBannerHeading = ({
83
+ className,
84
+ children,
85
+ ...props
86
+ }) => /* @__PURE__ */ jsx(
87
+ "h3",
88
+ {
89
+ className: cn(
90
+ "text-govuk-heading-m font-bold m-0 mb-govuk-3 p-0",
91
+ className
92
+ ),
93
+ ...props,
94
+ children
95
+ }
96
+ );
97
+ var NotificationBannerLink = ({
98
+ className,
99
+ children,
100
+ ...props
101
+ }) => /* @__PURE__ */ jsx(
102
+ "a",
103
+ {
104
+ className: cn(
105
+ "font-govuk underline govuk-link-underline",
106
+ "hover:govuk-link-underline-hover focus:govuk-link-focus",
107
+ "text-govuk-link visited:text-govuk-link",
108
+ "hover:text-govuk-brand-hover active:text-govuk-black",
109
+ "group-data-[variant=success]/banner:text-govuk-green",
110
+ "group-data-[variant=success]/banner:visited:text-govuk-green",
111
+ "group-data-[variant=success]/banner:hover:text-govuk-success-hover",
112
+ "group-data-[variant=success]/banner:active:text-govuk-green",
113
+ className
114
+ ),
115
+ ...props,
116
+ children
117
+ }
118
+ );
119
+
120
+ export { NotificationBanner, NotificationBannerContent, NotificationBannerHeader, NotificationBannerHeading, NotificationBannerLink, NotificationBannerTitle };
@@ -1,16 +1,14 @@
1
- import { cn } from './chunk-WONVZ7WK.js';
1
+ import { cn } from './chunk-GKHD33N6.js';
2
2
  import { jsxs } from 'react/jsx-runtime';
3
3
 
4
4
  var ErrorMessage = ({
5
5
  className,
6
6
  children,
7
7
  visuallyHiddenText = "Error",
8
- ref,
9
8
  ...props
10
9
  }) => /* @__PURE__ */ jsxs(
11
10
  "p",
12
11
  {
13
- ref,
14
12
  className: cn(
15
13
  "block",
16
14
  "mt-0 mb-govuk-3",
@@ -1,14 +1,13 @@
1
- import { cn } from './chunk-WONVZ7WK.js';
1
+ import { cn } from './chunk-GKHD33N6.js';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
 
4
- var InsetText = ({ className, ref, ...props }) => /* @__PURE__ */ jsx(
4
+ var InsetText = ({ className, ...props }) => /* @__PURE__ */ jsx(
5
5
  "div",
6
6
  {
7
- ref,
8
7
  className: cn(
9
8
  "clear-both",
10
9
  "p-govuk-3",
11
- "my-govuk-4",
10
+ "my-govuk-r6",
12
11
  "border-l-govuk-inset",
13
12
  "text-govuk-tag font-normal font-govuk text-govuk-black",
14
13
  "*:first:mt-0 *:last:mb-0",
@@ -0,0 +1,192 @@
1
+ import { cn } from './chunk-GKHD33N6.js';
2
+ import { createContext, useId, use, useSyncExternalStore } from 'react';
3
+ import { Tabs as Tabs$1 } from '@base-ui/react/tabs';
4
+ import { jsx, jsxs } from 'react/jsx-runtime';
5
+
6
+ var STACKED_QUERY = "(width < 40rem)";
7
+ var stackedQuery;
8
+ var getStackedQuery = () => {
9
+ stackedQuery ??= window.matchMedia(STACKED_QUERY);
10
+ return stackedQuery;
11
+ };
12
+ var subscribeToStacked = (onStoreChange) => {
13
+ const query = getStackedQuery();
14
+ query.addEventListener("change", onStoreChange);
15
+ return () => query.removeEventListener("change", onStoreChange);
16
+ };
17
+ var getStackedSnapshot = () => getStackedQuery().matches;
18
+ var getStackedServerSnapshot = () => false;
19
+ var useIsStacked = () => useSyncExternalStore(
20
+ subscribeToStacked,
21
+ getStackedSnapshot,
22
+ getStackedServerSnapshot
23
+ );
24
+ var TabsContext = createContext({ stacked: false, idPrefix: "" });
25
+ var usePanelId = (value) => {
26
+ const { idPrefix } = use(TabsContext);
27
+ return `${idPrefix}-${String(value)}`;
28
+ };
29
+ var domStyle = (style) => typeof style === "function" ? void 0 : style;
30
+ var rootStyles = "mt-govuk-1 mb-govuk-r6 font-govuk text-govuk-body text-govuk-black";
31
+ var Tabs = ({
32
+ className,
33
+ defaultValue,
34
+ value,
35
+ onValueChange,
36
+ orientation,
37
+ render,
38
+ style,
39
+ ...props
40
+ }) => {
41
+ const stacked = useIsStacked();
42
+ const idPrefix = useId();
43
+ if (stacked) {
44
+ return /* @__PURE__ */ jsx(TabsContext, { value: { stacked: true, idPrefix }, children: /* @__PURE__ */ jsx(
45
+ "div",
46
+ {
47
+ className: cn(rootStyles, className),
48
+ style: domStyle(style),
49
+ ...props
50
+ }
51
+ ) });
52
+ }
53
+ return /* @__PURE__ */ jsx(TabsContext, { value: { stacked: false, idPrefix }, children: /* @__PURE__ */ jsx(
54
+ Tabs$1.Root,
55
+ {
56
+ defaultValue,
57
+ value,
58
+ onValueChange,
59
+ orientation,
60
+ render,
61
+ style,
62
+ className: cn(rootStyles, className),
63
+ ...props
64
+ }
65
+ ) });
66
+ };
67
+ var TabsList = ({
68
+ className,
69
+ children,
70
+ contentsLabel = "Contents",
71
+ activateOnFocus = true,
72
+ loopFocus = false,
73
+ render,
74
+ style,
75
+ ...props
76
+ }) => {
77
+ const { stacked } = use(TabsContext);
78
+ if (stacked) {
79
+ return /* @__PURE__ */ jsxs(
80
+ "div",
81
+ {
82
+ className: cn("mb-govuk-4", className),
83
+ style: domStyle(style),
84
+ ...props,
85
+ children: [
86
+ /* @__PURE__ */ jsx("h2", { className: "mt-0 mb-govuk-2 text-govuk-body font-normal", children: contentsLabel }),
87
+ /* @__PURE__ */ jsx("ul", { className: "m-0 p-0 list-none", children })
88
+ ]
89
+ }
90
+ );
91
+ }
92
+ return /* @__PURE__ */ jsx(
93
+ Tabs$1.List,
94
+ {
95
+ activateOnFocus,
96
+ loopFocus,
97
+ render,
98
+ style,
99
+ className: cn("flex flex-wrap m-0 p-0 border-b border-govuk-mid-grey", className),
100
+ ...props,
101
+ children
102
+ }
103
+ );
104
+ };
105
+ var TabsTab = ({ className, children, value, ...props }) => {
106
+ const { stacked } = use(TabsContext);
107
+ const panelId = usePanelId(value);
108
+ if (stacked) {
109
+ return /* @__PURE__ */ jsx("li", { className: "ml-govuk-5 before:-ml-govuk-5 before:pr-govuk-1 before:content-['\u2014_']", children: /* @__PURE__ */ jsx(
110
+ "a",
111
+ {
112
+ href: `#${panelId}`,
113
+ className: cn(
114
+ "inline-block mb-govuk-2",
115
+ "text-govuk-link underline govuk-link-underline",
116
+ "visited:text-govuk-visited active:text-govuk-black",
117
+ "hover:text-govuk-brand-hover hover:govuk-link-underline-hover",
118
+ "focus:govuk-link-focus",
119
+ className
120
+ ),
121
+ children
122
+ }
123
+ ) });
124
+ }
125
+ return /* @__PURE__ */ jsx(
126
+ Tabs$1.Tab,
127
+ {
128
+ value,
129
+ className: cn(
130
+ "group relative cursor-pointer border-0 outline-none",
131
+ "mr-govuk-1 py-govuk-2 px-govuk-4",
132
+ "bg-govuk-light-grey text-center",
133
+ "govuk-tab",
134
+ className
135
+ ),
136
+ ...props,
137
+ children: /* @__PURE__ */ jsx(
138
+ "span",
139
+ {
140
+ className: cn(
141
+ "text-govuk-black underline govuk-link-underline",
142
+ "group-hover:govuk-link-underline-hover",
143
+ "group-focus-visible:govuk-link-focus group-focus-visible:no-underline",
144
+ "group-data-active:no-underline"
145
+ ),
146
+ children
147
+ }
148
+ )
149
+ }
150
+ );
151
+ };
152
+ var TabsPanel = ({
153
+ className,
154
+ value,
155
+ keepMounted,
156
+ render,
157
+ style,
158
+ ...props
159
+ }) => {
160
+ const { stacked } = use(TabsContext);
161
+ const panelId = usePanelId(value);
162
+ if (stacked) {
163
+ return /* @__PURE__ */ jsx(
164
+ "div",
165
+ {
166
+ id: panelId,
167
+ className: cn("mb-govuk-6 *:last:mb-0", className),
168
+ style: domStyle(style),
169
+ ...props
170
+ }
171
+ );
172
+ }
173
+ return /* @__PURE__ */ jsx(
174
+ Tabs$1.Panel,
175
+ {
176
+ value,
177
+ keepMounted,
178
+ render,
179
+ style,
180
+ tabIndex: -1,
181
+ className: cn(
182
+ "py-govuk-6 px-govuk-4",
183
+ "govuk-tab-panel-border",
184
+ "*:last:mb-0",
185
+ className
186
+ ),
187
+ ...props
188
+ }
189
+ );
190
+ };
191
+
192
+ export { Tabs, TabsList, TabsPanel, TabsTab };
@@ -1,39 +1,49 @@
1
- import { TextInput } from './chunk-QTSEOPVX.js';
2
- import { Button } from './chunk-5PIQJ22R.js';
3
- import { cn } from './chunk-WONVZ7WK.js';
4
- import { useId, useState } from 'react';
1
+ import { TextInput } from './chunk-VCJE5UO2.js';
2
+ import { Button } from './chunk-ASBIQC77.js';
3
+ import { cn } from './chunk-GKHD33N6.js';
4
+ import { useId, useState, useRef, useEffect } from 'react';
5
+ import { flushSync } from 'react-dom';
5
6
  import { jsxs, jsx } from 'react/jsx-runtime';
6
7
 
7
8
  var PasswordInput = ({
8
9
  className,
9
10
  id,
10
- error = false,
11
- disabled = false,
12
- autoComplete = "current-password",
11
+ disabled,
13
12
  showPasswordText = "Show",
14
13
  hidePasswordText = "Hide",
15
14
  showPasswordAriaLabel = "Show password",
16
15
  hidePasswordAriaLabel = "Hide password",
17
- passwordShownAnnouncement = "Your password is shown",
16
+ passwordShownAnnouncement = "Your password is visible",
18
17
  passwordHiddenAnnouncement = "Your password is hidden",
19
- ref,
20
18
  ...props
21
19
  }) => {
22
20
  const generatedId = useId();
23
21
  const inputId = id ?? generatedId;
24
- const [shown, setShown] = useState(false);
22
+ const [shown, setShown] = useState();
23
+ const toggleRef = useRef(null);
24
+ useEffect(() => {
25
+ const form = toggleRef.current?.closest("form");
26
+ const hide = () => flushSync(() => setShown((prev) => prev && false));
27
+ const handlePageShow = (event) => {
28
+ if (event.persisted) hide();
29
+ };
30
+ form?.addEventListener("submit", hide);
31
+ globalThis.addEventListener("pageshow", handlePageShow);
32
+ return () => {
33
+ form?.removeEventListener("submit", hide);
34
+ globalThis.removeEventListener("pageshow", handlePageShow);
35
+ };
36
+ }, []);
25
37
  return /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
26
38
  /* @__PURE__ */ jsx(
27
39
  TextInput,
28
40
  {
29
- ref,
30
41
  id: inputId,
31
42
  type: shown ? "text" : "password",
32
- error,
33
43
  disabled,
34
44
  spellCheck: false,
35
45
  autoCapitalize: "none",
36
- autoComplete,
46
+ autoComplete: "current-password",
37
47
  className: cn("flex-auto", className),
38
48
  ...props
39
49
  }
@@ -41,6 +51,7 @@ var PasswordInput = ({
41
51
  /* @__PURE__ */ jsx(
42
52
  Button,
43
53
  {
54
+ ref: toggleRef,
44
55
  type: "button",
45
56
  variant: "secondary",
46
57
  disabled,
@@ -50,12 +61,12 @@ var PasswordInput = ({
50
61
  className: cn(
51
62
  "mt-0 mb-0 ml-govuk-1",
52
63
  "w-24 sm:w-24 shrink-0 grow-0",
53
- "leading-none whitespace-nowrap"
64
+ "whitespace-nowrap"
54
65
  ),
55
66
  children: shown ? hidePasswordText : showPasswordText
56
67
  }
57
68
  ),
58
- /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "polite", children: shown ? passwordShownAnnouncement : passwordHiddenAnnouncement })
69
+ /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "polite", children: shown !== void 0 && (shown ? passwordShownAnnouncement : passwordHiddenAnnouncement) })
59
70
  ] });
60
71
  };
61
72
 
@@ -1,4 +1,4 @@
1
- import { cn } from './chunk-WONVZ7WK.js';
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
 
@@ -10,15 +10,11 @@ var labelVariants = cva(["block", "font-govuk text-govuk-black"], {
10
10
  m: "text-govuk-heading-m font-bold mb-govuk-3",
11
11
  s: "text-govuk-body font-bold mb-govuk-1"
12
12
  }
13
- },
14
- defaultVariants: {
15
- size: void 0
16
13
  }
17
14
  });
18
- var Label = ({ className, size, htmlFor, ref, ...props }) => /* @__PURE__ */ jsx(
15
+ var Label = ({ className, size, htmlFor, ...props }) => /* @__PURE__ */ jsx(
19
16
  "label",
20
17
  {
21
- ref,
22
18
  htmlFor,
23
19
  className: cn(
24
20
  labelVariants({ size }),
@@ -31,8 +27,8 @@ var Label = ({ className, size, htmlFor, ref, ...props }) => /* @__PURE__ */ jsx
31
27
  var LabelWrapper = ({
32
28
  as: Tag = "h1",
33
29
  className,
34
- ref,
30
+ children,
35
31
  ...props
36
- }) => /* @__PURE__ */ jsx(Tag, { ref, className: cn("m-0", className), ...props });
32
+ }) => /* @__PURE__ */ jsx(Tag, { className: cn("m-0", className), ...props, children });
37
33
 
38
34
  export { Label, LabelWrapper, labelVariants };