govuk-react 1.0.0-alpha.0 → 1.0.0-alpha.1

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 (479) hide show
  1. package/dist/components/accordion/index.d.ts +68 -0
  2. package/dist/components/accordion/index.js +104 -0
  3. package/dist/components/accordion/index.js.map +1 -0
  4. package/dist/components/back-link/index.d.ts +1 -0
  5. package/dist/components/back-link/index.js +2 -0
  6. package/dist/components/back-link/index.js.map +1 -0
  7. package/dist/components/body/index.d.ts +1 -0
  8. package/dist/components/body/index.js +2 -0
  9. package/dist/components/body/index.js.map +1 -0
  10. package/dist/components/breadcrumbs/index.js +2 -0
  11. package/dist/components/breadcrumbs/index.js.map +1 -0
  12. package/dist/components/button/index.d.ts +24 -0
  13. package/dist/components/button/index.js +17 -0
  14. package/dist/components/button/index.js.map +1 -0
  15. package/dist/components/caption/index.d.ts +1 -0
  16. package/dist/components/caption/index.js +2 -0
  17. package/dist/components/caption/index.js.map +1 -0
  18. package/dist/components/character-count/index.d.ts +36 -0
  19. package/dist/components/character-count/index.js +82 -0
  20. package/dist/components/character-count/index.js.map +1 -0
  21. package/dist/components/checkboxes/index.d.ts +49 -0
  22. package/dist/components/checkboxes/index.js +73 -0
  23. package/dist/components/checkboxes/index.js.map +1 -0
  24. package/dist/components/cookie-banner/index.js +2 -0
  25. package/dist/components/cookie-banner/index.js.map +1 -0
  26. package/dist/components/date-input/index.js +2 -0
  27. package/dist/components/date-input/index.js.map +1 -0
  28. package/dist/components/details/index.js +2 -0
  29. package/dist/components/details/index.js.map +1 -0
  30. package/dist/components/document-footer-metadata/index.d.ts +35 -0
  31. package/dist/components/document-footer-metadata/index.js +36 -0
  32. package/dist/components/document-footer-metadata/index.js.map +1 -0
  33. package/dist/components/error-message/index.d.ts +1 -0
  34. package/dist/components/error-message/index.js +2 -0
  35. package/dist/components/error-message/index.js.map +1 -0
  36. package/dist/components/error-summary/index.d.ts +22 -0
  37. package/dist/components/error-summary/index.js +49 -0
  38. package/dist/components/error-summary/index.js.map +1 -0
  39. package/dist/components/exit-this-page/index.d.ts +33 -0
  40. package/dist/components/exit-this-page/index.js +66 -0
  41. package/dist/components/exit-this-page/index.js.map +1 -0
  42. package/dist/components/feedback/index.js +2 -0
  43. package/dist/components/feedback/index.js.map +1 -0
  44. package/dist/components/fieldset/index.js +2 -0
  45. package/dist/components/fieldset/index.js.map +1 -0
  46. package/dist/components/file-upload/control.d.ts +6 -0
  47. package/dist/components/file-upload/control.js +9 -0
  48. package/dist/components/file-upload/control.js.map +1 -0
  49. package/dist/components/file-upload/enhanced.d.ts +45 -0
  50. package/dist/components/file-upload/enhanced.js +84 -0
  51. package/dist/components/file-upload/enhanced.js.map +1 -0
  52. package/dist/components/file-upload/index.d.ts +12 -0
  53. package/dist/components/file-upload/index.js +18 -0
  54. package/dist/components/file-upload/index.js.map +1 -0
  55. package/dist/components/footer/index.js +2 -0
  56. package/dist/components/footer/index.js.map +1 -0
  57. package/dist/components/form-group/index.d.ts +1 -0
  58. package/dist/components/form-group/index.js +2 -0
  59. package/dist/components/form-group/index.js.map +1 -0
  60. package/dist/components/generic-header/index.js +2 -0
  61. package/dist/components/generic-header/index.js.map +1 -0
  62. package/dist/components/grid-column/index.d.ts +1 -0
  63. package/dist/components/grid-column/index.js +2 -0
  64. package/dist/components/grid-column/index.js.map +1 -0
  65. package/dist/components/grid-row/index.d.ts +1 -0
  66. package/dist/components/grid-row/index.js +2 -0
  67. package/dist/components/grid-row/index.js.map +1 -0
  68. package/dist/components/header/index.js +2 -0
  69. package/dist/components/header/index.js.map +1 -0
  70. package/dist/components/heading/index.d.ts +1 -0
  71. package/dist/components/heading/index.js +2 -0
  72. package/dist/components/heading/index.js.map +1 -0
  73. package/dist/components/hint/index.d.ts +1 -0
  74. package/dist/components/hint/index.js +2 -0
  75. package/dist/components/hint/index.js.map +1 -0
  76. package/dist/components/input/index.js +2 -0
  77. package/dist/components/input/index.js.map +1 -0
  78. package/dist/components/inset-text/index.d.ts +1 -0
  79. package/dist/components/inset-text/index.js +2 -0
  80. package/dist/components/inset-text/index.js.map +1 -0
  81. package/dist/components/label/index.d.ts +1 -0
  82. package/dist/components/label/index.js +2 -0
  83. package/dist/components/label/index.js.map +1 -0
  84. package/dist/components/language-navigation/index.js +2 -0
  85. package/dist/components/language-navigation/index.js.map +1 -0
  86. package/dist/components/link/index.d.ts +1 -0
  87. package/dist/components/link/index.js +2 -0
  88. package/dist/components/link/index.js.map +1 -0
  89. package/dist/components/list/index.d.ts +1 -0
  90. package/dist/components/list/index.js +2 -0
  91. package/dist/components/list/index.js.map +1 -0
  92. package/dist/components/loading-box/index.d.ts +35 -0
  93. package/dist/components/loading-box/index.js +45 -0
  94. package/dist/components/loading-box/index.js.map +1 -0
  95. package/dist/components/main-wrapper/index.d.ts +1 -0
  96. package/dist/components/main-wrapper/index.js +2 -0
  97. package/dist/components/main-wrapper/index.js.map +1 -0
  98. package/dist/components/modal/index.d.ts +33 -0
  99. package/dist/components/modal/index.js +55 -0
  100. package/dist/components/modal/index.js.map +1 -0
  101. package/dist/components/notification-banner/index.d.ts +17 -0
  102. package/dist/components/notification-banner/index.js +44 -0
  103. package/dist/components/notification-banner/index.js.map +1 -0
  104. package/dist/{page.d.ts → components/page/index.d.ts} +2 -6
  105. package/dist/components/page/index.js +22 -0
  106. package/dist/components/page/index.js.map +1 -0
  107. package/dist/components/pagination/index.js +2 -0
  108. package/dist/components/pagination/index.js.map +1 -0
  109. package/dist/components/panel/index.js +2 -0
  110. package/dist/components/panel/index.js.map +1 -0
  111. package/dist/components/password-input/index.d.ts +26 -0
  112. package/dist/components/password-input/index.js +60 -0
  113. package/dist/components/password-input/index.js.map +1 -0
  114. package/dist/components/phase-banner/index.js +2 -0
  115. package/dist/components/phase-banner/index.js.map +1 -0
  116. package/dist/components/radios/index.d.ts +33 -0
  117. package/dist/components/radios/index.js +70 -0
  118. package/dist/components/radios/index.js.map +1 -0
  119. package/dist/components/related-items/index.d.ts +33 -0
  120. package/dist/components/related-items/index.js +45 -0
  121. package/dist/components/related-items/index.js.map +1 -0
  122. package/dist/components/search-box/index.d.ts +89 -0
  123. package/dist/components/search-box/index.js +136 -0
  124. package/dist/components/search-box/index.js.map +1 -0
  125. package/dist/components/section-break/index.d.ts +1 -0
  126. package/dist/components/section-break/index.js +2 -0
  127. package/dist/components/section-break/index.js.map +1 -0
  128. package/dist/components/select/index.js +2 -0
  129. package/dist/components/select/index.js.map +1 -0
  130. package/dist/components/service-navigation/index.d.ts +64 -0
  131. package/dist/components/service-navigation/index.js +131 -0
  132. package/dist/components/service-navigation/index.js.map +1 -0
  133. package/dist/{skip-link.d.ts → components/skip-link/index.d.ts} +2 -6
  134. package/dist/components/skip-link/index.js +16 -0
  135. package/dist/components/skip-link/index.js.map +1 -0
  136. package/dist/components/summary-list/index.js +2 -0
  137. package/dist/components/summary-list/index.js.map +1 -0
  138. package/dist/components/table/index.js +2 -0
  139. package/dist/components/table/index.js.map +1 -0
  140. package/dist/components/tabs/index.d.ts +98 -0
  141. package/dist/components/tabs/index.js +105 -0
  142. package/dist/components/tabs/index.js.map +1 -0
  143. package/dist/components/tag/index.d.ts +1 -0
  144. package/dist/components/tag/index.js +2 -0
  145. package/dist/components/tag/index.js.map +1 -0
  146. package/dist/components/task-list/index.js +2 -0
  147. package/dist/components/task-list/index.js.map +1 -0
  148. package/dist/components/textarea/index.js +2 -0
  149. package/dist/components/textarea/index.js.map +1 -0
  150. package/dist/components/visually-hidden/index.d.ts +1 -0
  151. package/dist/components/visually-hidden/index.js +2 -0
  152. package/dist/components/visually-hidden/index.js.map +1 -0
  153. package/dist/components/warning-text/index.js +2 -0
  154. package/dist/components/warning-text/index.js.map +1 -0
  155. package/dist/components/width-container/index.d.ts +1 -0
  156. package/dist/components/width-container/index.js +2 -0
  157. package/dist/components/width-container/index.js.map +1 -0
  158. package/dist/index.d.ts +58 -94
  159. package/dist/index.js +59 -59
  160. package/dist/index.js.map +1 -1
  161. package/dist/utils/join-ids.d.ts +2 -0
  162. package/dist/utils/join-ids.js +6 -0
  163. package/dist/utils/join-ids.js.map +1 -0
  164. package/package.json +6 -6
  165. package/dist/accordion.d.ts +0 -4
  166. package/dist/accordion.js +0 -4
  167. package/dist/accordion.js.map +0 -1
  168. package/dist/back-link.d.ts +0 -21
  169. package/dist/back-link.js +0 -4
  170. package/dist/back-link.js.map +0 -1
  171. package/dist/body.d.ts +0 -1
  172. package/dist/body.js +0 -4
  173. package/dist/body.js.map +0 -1
  174. package/dist/breadcrumbs.js +0 -3
  175. package/dist/breadcrumbs.js.map +0 -1
  176. package/dist/button.d.ts +0 -26
  177. package/dist/button.js +0 -4
  178. package/dist/button.js.map +0 -1
  179. package/dist/caption.d.ts +0 -1
  180. package/dist/caption.js +0 -4
  181. package/dist/caption.js.map +0 -1
  182. package/dist/character-count.d.ts +0 -4
  183. package/dist/character-count.js +0 -4
  184. package/dist/character-count.js.map +0 -1
  185. package/dist/checkboxes.d.ts +0 -3
  186. package/dist/checkboxes.js +0 -4
  187. package/dist/checkboxes.js.map +0 -1
  188. package/dist/chunk-2KPHO7N2.js +0 -3
  189. package/dist/chunk-2KPHO7N2.js.map +0 -1
  190. package/dist/chunk-2W35PR6E.js +0 -3
  191. package/dist/chunk-2W35PR6E.js.map +0 -1
  192. package/dist/chunk-57K6B6V2.js +0 -38
  193. package/dist/chunk-57K6B6V2.js.map +0 -1
  194. package/dist/chunk-5RYJUAI3.js +0 -3
  195. package/dist/chunk-5RYJUAI3.js.map +0 -1
  196. package/dist/chunk-5YT2PQAF.js +0 -3
  197. package/dist/chunk-5YT2PQAF.js.map +0 -1
  198. package/dist/chunk-B33BQUXM.js +0 -8
  199. package/dist/chunk-B33BQUXM.js.map +0 -1
  200. package/dist/chunk-BAXFWXMR.js +0 -41
  201. package/dist/chunk-BAXFWXMR.js.map +0 -1
  202. package/dist/chunk-BDIDAVNV.js +0 -22
  203. package/dist/chunk-BDIDAVNV.js.map +0 -1
  204. package/dist/chunk-D6TMELAY.js +0 -3
  205. package/dist/chunk-D6TMELAY.js.map +0 -1
  206. package/dist/chunk-DHTWPFZO.js +0 -8
  207. package/dist/chunk-DHTWPFZO.js.map +0 -1
  208. package/dist/chunk-DK2FZF7U.js +0 -3
  209. package/dist/chunk-DK2FZF7U.js.map +0 -1
  210. package/dist/chunk-EMM6RZT7.js +0 -3
  211. package/dist/chunk-EMM6RZT7.js.map +0 -1
  212. package/dist/chunk-EMNBPB3L.js +0 -8
  213. package/dist/chunk-EMNBPB3L.js.map +0 -1
  214. package/dist/chunk-FE2OFAA5.js +0 -8
  215. package/dist/chunk-FE2OFAA5.js.map +0 -1
  216. package/dist/chunk-FNDQEOKW.js +0 -20
  217. package/dist/chunk-FNDQEOKW.js.map +0 -1
  218. package/dist/chunk-HHH5BEO6.js +0 -3
  219. package/dist/chunk-HHH5BEO6.js.map +0 -1
  220. package/dist/chunk-HRURRTAU.js +0 -83
  221. package/dist/chunk-HRURRTAU.js.map +0 -1
  222. package/dist/chunk-IFETUZ4S.js +0 -3
  223. package/dist/chunk-IFETUZ4S.js.map +0 -1
  224. package/dist/chunk-JLNRFYFI.js +0 -3
  225. package/dist/chunk-JLNRFYFI.js.map +0 -1
  226. package/dist/chunk-K7VSNNQD.js +0 -8
  227. package/dist/chunk-K7VSNNQD.js.map +0 -1
  228. package/dist/chunk-KFWTQTVJ.js +0 -3
  229. package/dist/chunk-KFWTQTVJ.js.map +0 -1
  230. package/dist/chunk-L4GCVMBX.js +0 -3
  231. package/dist/chunk-L4GCVMBX.js.map +0 -1
  232. package/dist/chunk-L4O7OXGY.js +0 -151
  233. package/dist/chunk-L4O7OXGY.js.map +0 -1
  234. package/dist/chunk-LG7D7X4T.js +0 -8
  235. package/dist/chunk-LG7D7X4T.js.map +0 -1
  236. package/dist/chunk-M5BQAPSC.js +0 -8
  237. package/dist/chunk-M5BQAPSC.js.map +0 -1
  238. package/dist/chunk-NN44HUS7.js +0 -64
  239. package/dist/chunk-NN44HUS7.js.map +0 -1
  240. package/dist/chunk-NV2BSK6G.js +0 -3
  241. package/dist/chunk-NV2BSK6G.js.map +0 -1
  242. package/dist/chunk-OCGJIH5X.js +0 -159
  243. package/dist/chunk-OCGJIH5X.js.map +0 -1
  244. package/dist/chunk-OQVOKH2T.js +0 -8
  245. package/dist/chunk-OQVOKH2T.js.map +0 -1
  246. package/dist/chunk-OWBD4KZC.js +0 -115
  247. package/dist/chunk-OWBD4KZC.js.map +0 -1
  248. package/dist/chunk-PM2AAFY4.js +0 -35
  249. package/dist/chunk-PM2AAFY4.js.map +0 -1
  250. package/dist/chunk-PNMADTQQ.js +0 -3
  251. package/dist/chunk-PNMADTQQ.js.map +0 -1
  252. package/dist/chunk-PZ5AY32C.js +0 -9
  253. package/dist/chunk-PZ5AY32C.js.map +0 -1
  254. package/dist/chunk-QOWZLJK4.js +0 -3
  255. package/dist/chunk-QOWZLJK4.js.map +0 -1
  256. package/dist/chunk-QV7AS734.js +0 -98
  257. package/dist/chunk-QV7AS734.js.map +0 -1
  258. package/dist/chunk-RC24GP47.js +0 -8
  259. package/dist/chunk-RC24GP47.js.map +0 -1
  260. package/dist/chunk-RIB3ADHK.js +0 -8
  261. package/dist/chunk-RIB3ADHK.js.map +0 -1
  262. package/dist/chunk-RODK5NYM.js +0 -3
  263. package/dist/chunk-RODK5NYM.js.map +0 -1
  264. package/dist/chunk-SKQVJZMM.js +0 -79
  265. package/dist/chunk-SKQVJZMM.js.map +0 -1
  266. package/dist/chunk-SMUQZFJ7.js +0 -179
  267. package/dist/chunk-SMUQZFJ7.js.map +0 -1
  268. package/dist/chunk-SVIOO5V5.js +0 -109
  269. package/dist/chunk-SVIOO5V5.js.map +0 -1
  270. package/dist/chunk-SYW45KJ5.js +0 -3
  271. package/dist/chunk-SYW45KJ5.js.map +0 -1
  272. package/dist/chunk-T56AQZA4.js +0 -3
  273. package/dist/chunk-T56AQZA4.js.map +0 -1
  274. package/dist/chunk-TK6FAARU.js +0 -12
  275. package/dist/chunk-TK6FAARU.js.map +0 -1
  276. package/dist/chunk-TQOVKJLU.js +0 -78
  277. package/dist/chunk-TQOVKJLU.js.map +0 -1
  278. package/dist/chunk-U2FEV65D.js +0 -8
  279. package/dist/chunk-U2FEV65D.js.map +0 -1
  280. package/dist/chunk-UHX5TMH6.js +0 -49
  281. package/dist/chunk-UHX5TMH6.js.map +0 -1
  282. package/dist/chunk-VB3GA2KO.js +0 -3
  283. package/dist/chunk-VB3GA2KO.js.map +0 -1
  284. package/dist/chunk-VGZUAGCQ.js +0 -8
  285. package/dist/chunk-VGZUAGCQ.js.map +0 -1
  286. package/dist/chunk-VKUBJY23.js +0 -8
  287. package/dist/chunk-VKUBJY23.js.map +0 -1
  288. package/dist/chunk-VQ4FRNV3.js +0 -8
  289. package/dist/chunk-VQ4FRNV3.js.map +0 -1
  290. package/dist/chunk-W7RN6ITL.js +0 -8
  291. package/dist/chunk-W7RN6ITL.js.map +0 -1
  292. package/dist/chunk-WFHQPUFE.js +0 -3
  293. package/dist/chunk-WFHQPUFE.js.map +0 -1
  294. package/dist/chunk-XO7OW5TM.js +0 -3
  295. package/dist/chunk-XO7OW5TM.js.map +0 -1
  296. package/dist/chunk-YOBXV2EG.js +0 -101
  297. package/dist/chunk-YOBXV2EG.js.map +0 -1
  298. package/dist/chunk-YYDYVLVS.js +0 -47
  299. package/dist/chunk-YYDYVLVS.js.map +0 -1
  300. package/dist/chunk-Z4J4DQCF.js +0 -8
  301. package/dist/chunk-Z4J4DQCF.js.map +0 -1
  302. package/dist/chunk-ZHHORZMC.js +0 -3
  303. package/dist/chunk-ZHHORZMC.js.map +0 -1
  304. package/dist/cookie-banner.js +0 -3
  305. package/dist/cookie-banner.js.map +0 -1
  306. package/dist/date-input.js +0 -3
  307. package/dist/date-input.js.map +0 -1
  308. package/dist/details.js +0 -3
  309. package/dist/details.js.map +0 -1
  310. package/dist/document-footer-metadata.d.ts +0 -2
  311. package/dist/document-footer-metadata.js +0 -4
  312. package/dist/document-footer-metadata.js.map +0 -1
  313. package/dist/error-message.d.ts +0 -1
  314. package/dist/error-message.js +0 -4
  315. package/dist/error-message.js.map +0 -1
  316. package/dist/error-summary.d.ts +0 -3
  317. package/dist/error-summary.js +0 -4
  318. package/dist/error-summary.js.map +0 -1
  319. package/dist/exit-this-page.d.ts +0 -4
  320. package/dist/exit-this-page.js +0 -4
  321. package/dist/exit-this-page.js.map +0 -1
  322. package/dist/feedback.js +0 -3
  323. package/dist/feedback.js.map +0 -1
  324. package/dist/fieldset.js +0 -3
  325. package/dist/fieldset.js.map +0 -1
  326. package/dist/file-upload.d.ts +0 -90
  327. package/dist/file-upload.js +0 -4
  328. package/dist/file-upload.js.map +0 -1
  329. package/dist/footer.js +0 -3
  330. package/dist/footer.js.map +0 -1
  331. package/dist/form-group.d.ts +0 -1
  332. package/dist/form-group.js +0 -4
  333. package/dist/form-group.js.map +0 -1
  334. package/dist/generic-header.js +0 -3
  335. package/dist/generic-header.js.map +0 -1
  336. package/dist/grid-column.d.ts +0 -1
  337. package/dist/grid-column.js +0 -4
  338. package/dist/grid-column.js.map +0 -1
  339. package/dist/grid-row.d.ts +0 -1
  340. package/dist/grid-row.js +0 -4
  341. package/dist/grid-row.js.map +0 -1
  342. package/dist/header.js +0 -3
  343. package/dist/header.js.map +0 -1
  344. package/dist/heading.d.ts +0 -1
  345. package/dist/heading.js +0 -4
  346. package/dist/heading.js.map +0 -1
  347. package/dist/hint.d.ts +0 -1
  348. package/dist/hint.js +0 -4
  349. package/dist/hint.js.map +0 -1
  350. package/dist/index-7cuUiEo3.d.ts +0 -98
  351. package/dist/index-B8fw-F9t.d.ts +0 -22
  352. package/dist/index-BBckYYWt.d.ts +0 -131
  353. package/dist/index-BOPiKua4.d.ts +0 -61
  354. package/dist/index-BOfUYry5.d.ts +0 -22
  355. package/dist/index-BP18qbj1.d.ts +0 -22
  356. package/dist/index-BQaNJq4d.d.ts +0 -22
  357. package/dist/index-BnYaP7AC.d.ts +0 -57
  358. package/dist/index-C-c5LroN.d.ts +0 -22
  359. package/dist/index-CAxOsfPr.d.ts +0 -22
  360. package/dist/index-CHKQTetM.d.ts +0 -52
  361. package/dist/index-CWRQhs3p.d.ts +0 -55
  362. package/dist/index-CidkuScr.d.ts +0 -22
  363. package/dist/index-D-5h70y_.d.ts +0 -22
  364. package/dist/index-DDvVZ8mX.d.ts +0 -22
  365. package/dist/index-DQaFKwpy.d.ts +0 -106
  366. package/dist/index-DWibEGiF.d.ts +0 -22
  367. package/dist/index-D_wOwhn9.d.ts +0 -127
  368. package/dist/index-DhPVSZNZ.d.ts +0 -40
  369. package/dist/index-DhjWVeDK.d.ts +0 -22
  370. package/dist/index-DnvlWvry.d.ts +0 -54
  371. package/dist/index-Dr0S9iUZ.d.ts +0 -22
  372. package/dist/index-Dw9RbQVO.d.ts +0 -22
  373. package/dist/index-MxQB65RM.d.ts +0 -48
  374. package/dist/index-RZtIJBvk.d.ts +0 -22
  375. package/dist/index-TgEbRgDh.d.ts +0 -22
  376. package/dist/index-a8sYZpTj.d.ts +0 -77
  377. package/dist/index-rQaOtoWF.d.ts +0 -59
  378. package/dist/index-trAlT6HP.d.ts +0 -22
  379. package/dist/index-vBukON0x.d.ts +0 -50
  380. package/dist/input.js +0 -3
  381. package/dist/input.js.map +0 -1
  382. package/dist/inset-text.d.ts +0 -1
  383. package/dist/inset-text.js +0 -4
  384. package/dist/inset-text.js.map +0 -1
  385. package/dist/label.d.ts +0 -1
  386. package/dist/label.js +0 -4
  387. package/dist/label.js.map +0 -1
  388. package/dist/language-navigation.js +0 -3
  389. package/dist/language-navigation.js.map +0 -1
  390. package/dist/link.d.ts +0 -1
  391. package/dist/link.js +0 -4
  392. package/dist/link.js.map +0 -1
  393. package/dist/list.d.ts +0 -1
  394. package/dist/list.js +0 -4
  395. package/dist/list.js.map +0 -1
  396. package/dist/loading-box.d.ts +0 -39
  397. package/dist/loading-box.js +0 -4
  398. package/dist/loading-box.js.map +0 -1
  399. package/dist/main-wrapper.d.ts +0 -1
  400. package/dist/main-wrapper.js +0 -4
  401. package/dist/main-wrapper.js.map +0 -1
  402. package/dist/modal.d.ts +0 -4
  403. package/dist/modal.js +0 -4
  404. package/dist/modal.js.map +0 -1
  405. package/dist/notification-banner.d.ts +0 -3
  406. package/dist/notification-banner.js +0 -4
  407. package/dist/notification-banner.js.map +0 -1
  408. package/dist/page.js +0 -7
  409. package/dist/page.js.map +0 -1
  410. package/dist/pagination.js +0 -3
  411. package/dist/pagination.js.map +0 -1
  412. package/dist/panel.js +0 -3
  413. package/dist/panel.js.map +0 -1
  414. package/dist/password-input.d.ts +0 -4
  415. package/dist/password-input.js +0 -4
  416. package/dist/password-input.js.map +0 -1
  417. package/dist/phase-banner.js +0 -3
  418. package/dist/phase-banner.js.map +0 -1
  419. package/dist/radios.d.ts +0 -3
  420. package/dist/radios.js +0 -4
  421. package/dist/radios.js.map +0 -1
  422. package/dist/related-items.d.ts +0 -2
  423. package/dist/related-items.js +0 -4
  424. package/dist/related-items.js.map +0 -1
  425. package/dist/search-box.d.ts +0 -3
  426. package/dist/search-box.js +0 -4
  427. package/dist/search-box.js.map +0 -1
  428. package/dist/section-break.d.ts +0 -1
  429. package/dist/section-break.js +0 -4
  430. package/dist/section-break.js.map +0 -1
  431. package/dist/select.js +0 -3
  432. package/dist/select.js.map +0 -1
  433. package/dist/service-navigation.d.ts +0 -4
  434. package/dist/service-navigation.js +0 -4
  435. package/dist/service-navigation.js.map +0 -1
  436. package/dist/skip-link.js +0 -4
  437. package/dist/skip-link.js.map +0 -1
  438. package/dist/summary-list.js +0 -3
  439. package/dist/summary-list.js.map +0 -1
  440. package/dist/table.js +0 -3
  441. package/dist/table.js.map +0 -1
  442. package/dist/tabs.d.ts +0 -3
  443. package/dist/tabs.js +0 -4
  444. package/dist/tabs.js.map +0 -1
  445. package/dist/tag.d.ts +0 -1
  446. package/dist/tag.js +0 -4
  447. package/dist/tag.js.map +0 -1
  448. package/dist/task-list.js +0 -3
  449. package/dist/task-list.js.map +0 -1
  450. package/dist/textarea.js +0 -3
  451. package/dist/textarea.js.map +0 -1
  452. package/dist/visually-hidden.d.ts +0 -1
  453. package/dist/visually-hidden.js +0 -4
  454. package/dist/visually-hidden.js.map +0 -1
  455. package/dist/warning-text.js +0 -3
  456. package/dist/warning-text.js.map +0 -1
  457. package/dist/width-container.d.ts +0 -1
  458. package/dist/width-container.js +0 -4
  459. package/dist/width-container.js.map +0 -1
  460. /package/dist/{breadcrumbs.d.ts → components/breadcrumbs/index.d.ts} +0 -0
  461. /package/dist/{cookie-banner.d.ts → components/cookie-banner/index.d.ts} +0 -0
  462. /package/dist/{date-input.d.ts → components/date-input/index.d.ts} +0 -0
  463. /package/dist/{details.d.ts → components/details/index.d.ts} +0 -0
  464. /package/dist/{feedback.d.ts → components/feedback/index.d.ts} +0 -0
  465. /package/dist/{fieldset.d.ts → components/fieldset/index.d.ts} +0 -0
  466. /package/dist/{footer.d.ts → components/footer/index.d.ts} +0 -0
  467. /package/dist/{generic-header.d.ts → components/generic-header/index.d.ts} +0 -0
  468. /package/dist/{header.d.ts → components/header/index.d.ts} +0 -0
  469. /package/dist/{input.d.ts → components/input/index.d.ts} +0 -0
  470. /package/dist/{language-navigation.d.ts → components/language-navigation/index.d.ts} +0 -0
  471. /package/dist/{pagination.d.ts → components/pagination/index.d.ts} +0 -0
  472. /package/dist/{panel.d.ts → components/panel/index.d.ts} +0 -0
  473. /package/dist/{phase-banner.d.ts → components/phase-banner/index.d.ts} +0 -0
  474. /package/dist/{select.d.ts → components/select/index.d.ts} +0 -0
  475. /package/dist/{summary-list.d.ts → components/summary-list/index.d.ts} +0 -0
  476. /package/dist/{table.d.ts → components/table/index.d.ts} +0 -0
  477. /package/dist/{task-list.d.ts → components/task-list/index.d.ts} +0 -0
  478. /package/dist/{textarea.d.ts → components/textarea/index.d.ts} +0 -0
  479. /package/dist/{warning-text.d.ts → components/warning-text/index.d.ts} +0 -0
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import * as Markup from 'govuk-frontend-react/radios';
3
+ export { Item, Label, Hint, Divider, type ItemProps, type LabelProps, type HintProps, type DividerProps, } from 'govuk-frontend-react/radios';
4
+ /** Shows a reveal only while its radio is checked, before or without JavaScript. */
5
+ export declare const radiosCss: string;
6
+ export type RootProps = Markup.RootProps;
7
+ /**
8
+ * Let users select a single option from a list using the radios component.
9
+ *
10
+ * Children are `Item`s, each with an `Input`, followed by a `Conditional` where it reveals one.
11
+ *
12
+ * @see https://design-system.service.gov.uk/components/radios/
13
+ */
14
+ export declare function Root(props: RootProps): React.JSX.Element;
15
+ export type InputProps = Markup.InputProps & {
16
+ /** The id of the `Conditional` this radio reveals. */
17
+ controls?: string;
18
+ };
19
+ export declare function Input({ controls, ...props }: InputProps): React.JSX.Element;
20
+ export type ConditionalProps = Markup.ConditionalProps;
21
+ /** Content revealed while its radio is checked, straight after its `Item`. Pass the radio's `checked` or `defaultChecked` as `checked`. */
22
+ export declare function Conditional(props: ConditionalProps): React.JSX.Element;
23
+ export type ItemCompositeProps = Markup.ItemCompositeProps;
24
+ export declare function ItemComposite({ id, label, hint, conditional, 'aria-describedby': describedBy, ...props }: ItemCompositeProps): React.JSX.Element;
25
+ export type FieldProps = Markup.FieldProps;
26
+ /**
27
+ * Let users select a single option from a list using the radios component.
28
+ *
29
+ * Children are `ItemComposite`s and `Divider`s.
30
+ *
31
+ * @see https://design-system.service.gov.uk/components/radios/
32
+ */
33
+ export declare function Field({ items, children, ...props }: FieldProps): React.JSX.Element;
@@ -0,0 +1,70 @@
1
+ import * as React from 'react';
2
+ import { Children } from 'react';
3
+ import * as Primitives from '@govuk-react/primitives/choices';
4
+ import * as Markup from 'govuk-frontend-react/radios';
5
+ import { joinIds } from '../../utils/join-ids.js';
6
+ /*
7
+ * govuk-frontend-react's Radios markup, with conditional reveals from @govuk-react/primitives.
8
+ * Without JavaScript, a reveal shows only while its radio is checked, where the browser supports
9
+ * `:has()`, and always where it doesn't, as in govuk-frontend.
10
+ */
11
+ export { Item, Label, Hint, Divider, } from 'govuk-frontend-react/radios';
12
+ /** Shows a reveal only while its radio is checked, before or without JavaScript. */
13
+ export const radiosCss = [
14
+ // Hides a reveal whose radio isn't checked.
15
+ '.govuk-radios__item:has(>.govuk-radios__input:not(:checked))+.govuk-radios__conditional{display:none}',
16
+ // Shows one whose radio is, over govuk-frontend's hidden class, until the element upgrades.
17
+ '.govuk-radios__item:has(>.govuk-radios__input:checked)+.govuk-radios__conditional{display:block}',
18
+ ].join('');
19
+ /** The element and styles around the radios, for `Root` and `Field`. */
20
+ function Behaviour({ children }) {
21
+ return (React.createElement(Primitives.Root, { upgradedClass: "govuk-frontend-supported", hiddenConditionalClass: "govuk-radios__conditional--hidden" },
22
+ React.createElement("style", { href: "govuk-react-radios", precedence: "default" }, radiosCss),
23
+ children));
24
+ }
25
+ /**
26
+ * Let users select a single option from a list using the radios component.
27
+ *
28
+ * Children are `Item`s, each with an `Input`, followed by a `Conditional` where it reveals one.
29
+ *
30
+ * @see https://design-system.service.gov.uk/components/radios/
31
+ */
32
+ export function Root(props) {
33
+ return (React.createElement(Behaviour, null,
34
+ React.createElement(Markup.Root, { ...props })));
35
+ }
36
+ export function Input({ controls, ...props }) {
37
+ return (React.createElement(Primitives.Input, { asChild: true, controls: controls },
38
+ React.createElement(Markup.Input, { ...props })));
39
+ }
40
+ /** Content revealed while its radio is checked, straight after its `Item`. Pass the radio's `checked` or `defaultChecked` as `checked`. */
41
+ export function Conditional(props) {
42
+ return (React.createElement(Primitives.Conditional, { asChild: true },
43
+ React.createElement(Markup.Conditional, { ...props })));
44
+ }
45
+ const isSet = (node) => node !== undefined && node !== null && node !== false && node !== '';
46
+ export function ItemComposite({ id, label, hint, conditional, 'aria-describedby': describedBy, ...props }) {
47
+ var _a;
48
+ const hintId = isSet(hint) ? `${id}-item-hint` : undefined;
49
+ const conditionalId = isSet(conditional) ? `conditional-${id}` : undefined;
50
+ return (React.createElement(React.Fragment, null,
51
+ React.createElement(Markup.Item, null,
52
+ React.createElement(Input, { id: id, controls: conditionalId, "aria-describedby": joinIds(describedBy, hintId), ...props }),
53
+ React.createElement(Markup.Label, { htmlFor: id }, label),
54
+ hintId && React.createElement(Markup.Hint, { id: hintId }, hint)),
55
+ conditionalId && (React.createElement(Conditional, { id: conditionalId, checked: Boolean((_a = props.checked) !== null && _a !== void 0 ? _a : props.defaultChecked) }, conditional))));
56
+ }
57
+ /**
58
+ * Let users select a single option from a list using the radios component.
59
+ *
60
+ * Children are `ItemComposite`s and `Divider`s.
61
+ *
62
+ * @see https://design-system.service.gov.uk/components/radios/
63
+ */
64
+ export function Field({ items, children, ...props }) {
65
+ return (React.createElement(Behaviour, null,
66
+ React.createElement(Markup.Field, { ...props }, items
67
+ ? items.map((item, index) => 'divider' in item ? (React.createElement(Markup.Divider, { key: index }, item.divider)) : (React.createElement(ItemComposite, { key: index, ...item })))
68
+ : Children.toArray(children))));
69
+ }
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/radios/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,KAAK,UAAU,MAAM,iCAAiC,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;;;GAIG;AAEH,OAAO,EACL,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,OAAO,GAKR,MAAM,6BAA6B,CAAC;AAErC,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,4CAA4C;IAC5C,uGAAuG;IACvG,4FAA4F;IAC5F,kGAAkG;CACnG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAEX,wEAAwE;AACxE,SAAS,SAAS,CAAC,EAAE,QAAQ,EAAiC;IAC5D,OAAO,CACL,oBAAC,UAAU,CAAC,IAAI,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AAC,CAAC,SAAS,CAAC;IAC3E,OAAO,CACL;QACE,oBAAC,MAAM,CAAC,IAAI;YACV,oBAAC,KAAK,IAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,aAAa,sBAAoB,OAAO,CAAC,WAAW,EAAE,MAAM,CAAC,KAAM,KAAK,GAAI;YACrG,oBAAC,MAAM,CAAC,KAAK,IAAC,OAAO,EAAE,EAAE,IAAG,KAAK,CAAgB;YAChD,MAAM,IAAI,oBAAC,MAAM,CAAC,IAAI,IAAC,EAAE,EAAE,MAAM,IAAG,IAAI,CAAe,CAC5C;QACb,aAAa,IAAI,CAChB,oBAAC,WAAW,IAAC,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,CAAC,MAAA,KAAK,CAAC,OAAO,mCAAI,KAAK,CAAC,cAAc,CAAC,IACpF,WAAW,CACA,CACf,CACA,CACJ,CAAC;AACJ,CAAC;AAID;;;;;;GAMG;AACH,MAAM,UAAU,KAAK,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAc;IAC7D,OAAO,CACL,oBAAC,SAAS;QACR,oBAAC,MAAM,CAAC,KAAK,OAAK,KAAK,IACpB,KAAK;YACJ,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CACxB,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,CAClB,oBAAC,MAAM,CAAC,OAAO,IAAC,GAAG,EAAE,KAAK,IAAG,IAAI,CAAC,OAAO,CAAkB,CAC5D,CAAC,CAAC,CAAC,CACF,oBAAC,aAAa,IAAC,GAAG,EAAE,KAAK,KAAM,IAAI,GAAI,CACxC,CACF;YACH,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CACjB,CACL,CACb,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport { Children } from 'react';\nimport * as Primitives from '@govuk-react/primitives/choices';\nimport * as Markup from 'govuk-frontend-react/radios';\nimport { joinIds } from '../../utils/join-ids.js';\n\n/*\n * govuk-frontend-react's Radios markup, with conditional reveals from @govuk-react/primitives.\n * Without JavaScript, a reveal shows only while its radio is checked, where the browser supports\n * `:has()`, and always where it doesn't, as in govuk-frontend.\n */\n\nexport {\n Item,\n Label,\n Hint,\n Divider,\n type ItemProps,\n type LabelProps,\n type HintProps,\n type DividerProps,\n} from 'govuk-frontend-react/radios';\n\n/** Shows a reveal only while its radio is checked, before or without JavaScript. */\nexport const radiosCss = [\n // Hides a reveal whose radio isn't checked.\n '.govuk-radios__item:has(>.govuk-radios__input:not(:checked))+.govuk-radios__conditional{display:none}',\n // Shows one whose radio is, over govuk-frontend's hidden class, until the element upgrades.\n '.govuk-radios__item:has(>.govuk-radios__input:checked)+.govuk-radios__conditional{display:block}',\n].join('');\n\n/** The element and styles around the radios, for `Root` and `Field`. */\nfunction Behaviour({ children }: { children: React.ReactNode }) {\n return (\n <Primitives.Root\n upgradedClass=\"govuk-frontend-supported\"\n hiddenConditionalClass=\"govuk-radios__conditional--hidden\"\n >\n <style href=\"govuk-react-radios\" precedence=\"default\">\n {radiosCss}\n </style>\n {children}\n </Primitives.Root>\n );\n}\n\nexport type RootProps = Markup.RootProps;\n\n/**\n * Let users select a single option from a list using the radios component.\n *\n * Children are `Item`s, each with an `Input`, followed by a `Conditional` where it reveals one.\n *\n * @see https://design-system.service.gov.uk/components/radios/\n */\nexport function Root(props: RootProps) {\n return (\n <Behaviour>\n <Markup.Root {...props} />\n </Behaviour>\n );\n}\n\nexport type InputProps = Markup.InputProps & {\n /** The id of the `Conditional` this radio reveals. */\n controls?: string;\n};\n\nexport function Input({ controls, ...props }: InputProps) {\n return (\n <Primitives.Input asChild controls={controls}>\n <Markup.Input {...props} />\n </Primitives.Input>\n );\n}\n\nexport type ConditionalProps = Markup.ConditionalProps;\n\n/** Content revealed while its radio is checked, straight after its `Item`. Pass the radio's `checked` or `defaultChecked` as `checked`. */\nexport function Conditional(props: ConditionalProps) {\n return (\n <Primitives.Conditional asChild>\n <Markup.Conditional {...props} />\n </Primitives.Conditional>\n );\n}\n\nexport type ItemCompositeProps = Markup.ItemCompositeProps;\n\nconst isSet = (node: React.ReactNode) => node !== undefined && node !== null && node !== false && node !== '';\n\nexport function ItemComposite({\n id,\n label,\n hint,\n conditional,\n 'aria-describedby': describedBy,\n ...props\n}: ItemCompositeProps) {\n const hintId = isSet(hint) ? `${id}-item-hint` : undefined;\n const conditionalId = isSet(conditional) ? `conditional-${id}` : undefined;\n return (\n <>\n <Markup.Item>\n <Input id={id} controls={conditionalId} aria-describedby={joinIds(describedBy, hintId)} {...props} />\n <Markup.Label htmlFor={id}>{label}</Markup.Label>\n {hintId && <Markup.Hint id={hintId}>{hint}</Markup.Hint>}\n </Markup.Item>\n {conditionalId && (\n <Conditional id={conditionalId} checked={Boolean(props.checked ?? props.defaultChecked)}>\n {conditional}\n </Conditional>\n )}\n </>\n );\n}\n\nexport type FieldProps = Markup.FieldProps;\n\n/**\n * Let users select a single option from a list using the radios component.\n *\n * Children are `ItemComposite`s and `Divider`s.\n *\n * @see https://design-system.service.gov.uk/components/radios/\n */\nexport function Field({ items, children, ...props }: FieldProps) {\n return (\n <Behaviour>\n <Markup.Field {...props}>\n {items\n ? items.map((item, index) =>\n 'divider' in item ? (\n <Markup.Divider key={index}>{item.divider}</Markup.Divider>\n ) : (\n <ItemComposite key={index} {...item} />\n )\n )\n : Children.toArray(children)}\n </Markup.Field>\n </Behaviour>\n );\n}\n"]}
@@ -0,0 +1,33 @@
1
+ import * as React from 'react';
2
+ import type { ComponentProps, ReactNode } from 'react';
3
+ /** Styles govuk-frontend has no class for, hoisted and deduplicated by React. */
4
+ export declare const relatedItemsCss = ".govuk-react-related-items{border-top:2px solid var(--govuk-brand-colour,#1d70b8);padding-top:10px}";
5
+ export type RootProps = ComponentProps<'div'>;
6
+ /** Related content, such as topics, guidance and collections. */
7
+ export declare function Root({ className, children, ...props }: RootProps): React.JSX.Element;
8
+ export type HeadingProps = ComponentProps<'h2'>;
9
+ export declare function Heading({ className, children, ...props }: HeadingProps): React.JSX.Element;
10
+ export type SectionProps = ComponentProps<'nav'>;
11
+ export declare function Section(props: SectionProps): React.JSX.Element;
12
+ export type SectionHeadingProps = ComponentProps<'h3'>;
13
+ export declare function SectionHeading({ className, children, ...props }: SectionHeadingProps): React.JSX.Element;
14
+ export type ListProps = ComponentProps<'ul'>;
15
+ export declare function List({ className, ...props }: ListProps): React.JSX.Element;
16
+ export type ItemProps = ComponentProps<'li'>;
17
+ export declare function Item(props: ItemProps): React.JSX.Element;
18
+ export type SectionCompositeProps = Omit<SectionProps, 'title'> & {
19
+ /** The section heading, such as “Travel abroad”. Also labels the navigation landmark. */
20
+ title: ReactNode;
21
+ };
22
+ /** A labelled navigation section with a heading and a list. Children are `Item`s. */
23
+ export declare function SectionComposite({ title, children, ...props }: SectionCompositeProps): React.JSX.Element;
24
+ export type CompositeProps = Omit<RootProps, 'title'> & {
25
+ /** The main heading. */
26
+ title?: ReactNode;
27
+ };
28
+ /**
29
+ * Related content, including topics, guidance and collections. Children are `SectionComposite`s.
30
+ *
31
+ * @see https://components.publishing.service.gov.uk/component-guide/related_navigation
32
+ */
33
+ export declare function Composite({ title, children, ...props }: CompositeProps): React.JSX.Element;
@@ -0,0 +1,45 @@
1
+ import * as React from 'react';
2
+ import { useId } from 'react';
3
+ import { clsx } from 'clsx';
4
+ const name = 'govuk-react-related-items';
5
+ /** Styles govuk-frontend has no class for, hoisted and deduplicated by React. */
6
+ export const relatedItemsCss = `.${name}{border-top:2px solid var(--govuk-brand-colour,#1d70b8);padding-top:10px}`;
7
+ /** Related content, such as topics, guidance and collections. */
8
+ export function Root({ className, children, ...props }) {
9
+ return (React.createElement("div", { className: clsx(name, className), ...props },
10
+ React.createElement("style", { href: name, precedence: "default" }, relatedItemsCss),
11
+ children));
12
+ }
13
+ export function Heading({ className, children, ...props }) {
14
+ return (React.createElement("h2", { className: clsx('govuk-heading-s', className), ...props }, children));
15
+ }
16
+ export function Section(props) {
17
+ return React.createElement("nav", { ...props });
18
+ }
19
+ export function SectionHeading({ className, children, ...props }) {
20
+ return (React.createElement("h3", { className: clsx('govuk-body-s', 'govuk-!-font-weight-bold', 'govuk-!-margin-bottom-2', className), ...props }, children));
21
+ }
22
+ export function List({ className, ...props }) {
23
+ return React.createElement("ul", { className: clsx('govuk-list', 'govuk-body-s', className), ...props });
24
+ }
25
+ export function Item(props) {
26
+ return React.createElement("li", { ...props });
27
+ }
28
+ /** A labelled navigation section with a heading and a list. Children are `Item`s. */
29
+ export function SectionComposite({ title, children, ...props }) {
30
+ const headingId = useId();
31
+ return (React.createElement(Section, { "aria-labelledby": headingId, ...props },
32
+ React.createElement(SectionHeading, { id: headingId }, title),
33
+ React.createElement(List, null, children)));
34
+ }
35
+ /**
36
+ * Related content, including topics, guidance and collections. Children are `SectionComposite`s.
37
+ *
38
+ * @see https://components.publishing.service.gov.uk/component-guide/related_navigation
39
+ */
40
+ export function Composite({ title = 'Related content', children, ...props }) {
41
+ return (React.createElement(Root, { ...props },
42
+ React.createElement(Heading, null, title),
43
+ children));
44
+ }
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/related-items/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,IAAI,GAAG,2BAA2B,CAAC;AAEzC,iFAAiF;AACjF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,IAAI,2EAA2E,CAAC;AAInH,iEAAiE;AACjE,MAAM,UAAU,IAAI,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAa;IAC/D,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,KAA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C;AACJ,CAAC;AAOD;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,EAAE,KAAK,GAAG,iBAAiB,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAkB;IACzF,OAAO,CACL,oBAAC,IAAI,OAAK,KAAK;QACb,oBAAC,OAAO,QAAE,KAAK,CAAW;QACzB,QAAQ,CACJ,CACR,CAAC;AACJ,CAAC","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { useId } from 'react';\nimport { clsx } from 'clsx';\n\nconst name = 'govuk-react-related-items';\n\n/** Styles govuk-frontend has no class for, hoisted and deduplicated by React. */\nexport const relatedItemsCss = `.${name}{border-top:2px solid var(--govuk-brand-colour,#1d70b8);padding-top:10px}`;\n\nexport type RootProps = ComponentProps<'div'>;\n\n/** Related content, such as topics, guidance and collections. */\nexport function Root({ className, children, ...props }: RootProps) {\n return (\n <div className={clsx(name, className)} {...props}>\n <style href={name} precedence=\"default\">\n {relatedItemsCss}\n </style>\n {children}\n </div>\n );\n}\n\nexport type HeadingProps = ComponentProps<'h2'>;\n\nexport function Heading({ className, children, ...props }: HeadingProps) {\n return (\n <h2 className={clsx('govuk-heading-s', className)} {...props}>\n {children}\n </h2>\n );\n}\n\nexport type SectionProps = ComponentProps<'nav'>;\n\nexport function Section(props: SectionProps) {\n return <nav {...props} />;\n}\n\nexport type SectionHeadingProps = ComponentProps<'h3'>;\n\nexport function SectionHeading({ className, children, ...props }: SectionHeadingProps) {\n return (\n <h3 className={clsx('govuk-body-s', 'govuk-!-font-weight-bold', 'govuk-!-margin-bottom-2', className)} {...props}>\n {children}\n </h3>\n );\n}\n\nexport type ListProps = ComponentProps<'ul'>;\n\nexport function List({ className, ...props }: ListProps) {\n return <ul className={clsx('govuk-list', 'govuk-body-s', className)} {...props} />;\n}\n\nexport type ItemProps = ComponentProps<'li'>;\n\nexport function Item(props: ItemProps) {\n return <li {...props} />;\n}\n\nexport type SectionCompositeProps = Omit<SectionProps, 'title'> & {\n /** The section heading, such as “Travel abroad”. Also labels the navigation landmark. */\n title: ReactNode;\n};\n\n/** A labelled navigation section with a heading and a list. Children are `Item`s. */\nexport function SectionComposite({ title, children, ...props }: SectionCompositeProps) {\n const headingId = useId();\n return (\n <Section aria-labelledby={headingId} {...props}>\n <SectionHeading id={headingId}>{title}</SectionHeading>\n <List>{children}</List>\n </Section>\n );\n}\n\nexport type CompositeProps = Omit<RootProps, 'title'> & {\n /** The main heading. */\n title?: ReactNode;\n};\n\n/**\n * Related content, including topics, guidance and collections. Children are `SectionComposite`s.\n *\n * @see https://components.publishing.service.gov.uk/component-guide/related_navigation\n */\nexport function Composite({ title = 'Related content', children, ...props }: CompositeProps) {\n return (\n <Root {...props}>\n <Heading>{title}</Heading>\n {children}\n </Root>\n );\n}\n"]}
@@ -0,0 +1,89 @@
1
+ import * as React from 'react';
2
+ import type { ComponentProps, ReactNode } from 'react';
3
+ import * as Primitives from '@govuk-react/primitives/autocomplete';
4
+ /** Styles govuk-frontend has no class for, hoisted and deduplicated by React. Based on GOV.UK’s search component. */
5
+ export declare const searchBoxCss = "\n.govuk-react-search-box__wrapper{display:flex;background-color:#fff}\n.govuk-react-search-box__input{margin:0;-webkit-appearance:none;appearance:none}\n.govuk-react-search-box__input:focus{z-index:1}\n.govuk-react-search-box__button{position:relative;flex:0 0 auto;width:2.5rem;height:2.5rem;margin:0;padding:0;border:0;border-radius:0;outline:2px solid transparent;outline-offset:0;cursor:pointer;background-color:var(--govuk-brand-colour,#1d70b8);color:#fff}\n.govuk-react-search-box__button:hover{background-color:color-mix(in srgb,var(--govuk-brand-colour,#1d70b8) 75%,#000)}\n.govuk-react-search-box__button:focus{z-index:1;outline:3px solid var(--govuk-focus-colour,#fd0);box-shadow:inset 0 0 0 4px #0b0c0c}\n.govuk-react-search-box__icon{position:absolute;inset:0;width:100%;height:100%;transform:scale(.5);pointer-events:none}\n.govuk-react-search-box:not(.govuk-react-search-box--inverse) .govuk-react-search-box__input{border-right-width:0}\n.govuk-react-search-box:not(.govuk-react-search-box--inverse) .govuk-react-search-box__input:focus{border-right-width:2px}\n.govuk-react-search-box--inverse .govuk-react-search-box__label{color:#fff}\n.govuk-react-search-box--inverse .govuk-react-search-box__input{border-width:0}\n.govuk-react-search-box--inverse .govuk-react-search-box__button{background-color:color-mix(in srgb,var(--govuk-brand-colour,#1d70b8) 20%,#fff);color:var(--govuk-brand-colour,#1d70b8)}\n.govuk-react-search-box--inverse .govuk-react-search-box__button:hover{background-color:color-mix(in srgb,var(--govuk-brand-colour,#1d70b8) 5%,#fff)}\n.govuk-react-search-box--large .govuk-react-search-box__input{height:3.125rem}\n.govuk-react-search-box--large .govuk-react-search-box__button{width:3.125rem;height:3.125rem}\n.govuk-react-search-box--large .govuk-react-search-box__icon{transform:scale(.4)}\n.govuk-react-search-box__autocomplete{display:block;position:relative}\n.govuk-react-search-box__menu{position:absolute;z-index:100;top:100%;left:0;right:0;margin:0;padding:0;list-style:none;overflow-x:hidden;background-color:#fff;border:1px solid #b1b4b6;border-top:0}\n.govuk-react-search-box--inverse .govuk-react-search-box__menu{border-top:1px solid #b1b4b6}\n.govuk-react-search-box__option{cursor:pointer;font-family:\"GDS Transport\",arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:1rem;line-height:1.25;color:#0b0c0c}\n@media (min-width:40.0625em){.govuk-react-search-box__option{font-size:1.1875rem;line-height:1.3157894737}}\n.govuk-react-search-box__option>*{pointer-events:none}\n.govuk-react-search-box__option[data-focused],.govuk-react-search-box__option:hover,.govuk-react-search-box__option:focus-visible{background-color:#f3f3f3;outline:none;text-decoration:underline;text-decoration-thickness:max(3px,.1875rem,.12em);text-underline-offset:.1578em}\n.govuk-react-search-box__option:focus-visible .govuk-react-search-box__suggestion-text{background-color:var(--govuk-focus-colour,#fd0)}\n.govuk-react-search-box__option[hidden]{display:none}\n.govuk-react-search-box__option-wrapper{display:flex;align-items:center;margin:0 15px;padding:5px 0}\n.govuk-react-search-box__option:not([hidden])~.govuk-react-search-box__option:not([hidden]) .govuk-react-search-box__option-wrapper{border-top:1px solid #b1b4b6}\n.govuk-react-search-box__suggestion-icon{flex:none;width:20px;height:2.5rem;margin-right:10px;background-color:#505a5f;-webkit-mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 27'%3E%3Ccircle cx='12' cy='11' r='8.5' fill='none' stroke='%23000' stroke-width='3'/%3E%3Cpath d='m17.9 17.4 8.5 8.5' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E\") center/contain no-repeat;mask:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 27'%3E%3Ccircle cx='12' cy='11' r='8.5' fill='none' stroke='%23000' stroke-width='3'/%3E%3Cpath d='m17.9 17.4 8.5 8.5' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E\") center/contain no-repeat}\n.govuk-react-search-box__option[data-focused] .govuk-react-search-box__suggestion-icon,.govuk-react-search-box__option:hover .govuk-react-search-box__suggestion-icon,.govuk-react-search-box__option:focus-visible .govuk-react-search-box__suggestion-icon{background-color:#0b0c0c}\n.govuk-react-search-box__suggestion-text{font-weight:700}\n.govuk-react-search-box__suggestion-highlight{font-weight:400;background:none;color:inherit}\n.govuk-react-search-box--large .govuk-react-search-box__option{min-height:3.125rem}\n@media (forced-colors:active){.govuk-react-search-box__menu{border-color:FieldText}.govuk-react-search-box__option[data-focused],.govuk-react-search-box__option:hover{forced-color-adjust:none;background-color:Highlight;color:HighlightText}.govuk-react-search-box__suggestion-icon{background-color:currentcolor}}\n";
6
+ export type RootProps = ComponentProps<'div'> & {
7
+ /** For use on dark backgrounds, such as a GOV.UK blue homepage banner. */
8
+ inverse?: boolean;
9
+ /** A larger input and button. */
10
+ large?: boolean;
11
+ };
12
+ /** Wraps the search label, input and submit button. */
13
+ export declare function Root({ inverse, large, className, children, ...props }: RootProps): React.JSX.Element;
14
+ export type LabelProps = ComponentProps<'label'> & {
15
+ /** The label size, from govuk-frontend’s label sizes. */
16
+ size?: 's' | 'm' | 'l' | 'xl';
17
+ /** Hide the label visually. It’s still read by screen readers. */
18
+ visuallyHidden?: boolean;
19
+ };
20
+ export declare function Label({ size, visuallyHidden, className, children, ...props }: LabelProps): React.JSX.Element;
21
+ export type WrapperProps = ComponentProps<'div'>;
22
+ /** Lays out the input and submit button side by side. */
23
+ export declare function Wrapper({ className, ...props }: WrapperProps): React.JSX.Element;
24
+ export type InputProps = ComponentProps<'input'>;
25
+ export declare function Input({ className, type, ...props }: InputProps): React.JSX.Element;
26
+ export type ButtonProps = ComponentProps<'button'>;
27
+ /** The submit button, with a search icon. Children are its accessible name, “Search” by default. */
28
+ export declare function Button({ className, children, ...props }: ButtonProps): React.JSX.Element;
29
+ export type CompositeProps = Omit<InputProps, 'id'> & Pick<RootProps, 'inverse' | 'large'> & {
30
+ /** The input’s id, which the label points to. */
31
+ id: string;
32
+ /** The label text. */
33
+ label?: ReactNode;
34
+ /** The label size, from govuk-frontend’s label sizes. */
35
+ labelSize?: LabelProps['size'];
36
+ /** Hide the label visually. It’s still read by screen readers. */
37
+ labelVisuallyHidden?: boolean;
38
+ /** The submit button’s visually hidden text. */
39
+ buttonText?: ReactNode;
40
+ };
41
+ /**
42
+ * A search input with a label and an attached submit button, based on GOV.UK’s search component. Put it in your own `form`. Other props go on the input.
43
+ *
44
+ * @see https://components.publishing.service.gov.uk/component-guide/search
45
+ */
46
+ export declare function Composite({ id, label, labelSize, labelVisuallyHidden, buttonText, inverse, large, ...props }: CompositeProps): React.JSX.Element;
47
+ export type AutocompleteProps = Primitives.RootProps;
48
+ /**
49
+ * Suggests searches as the user types, around `Wrapper`, `Listbox`, `Status` and `AssistiveHint`.
50
+ * Without JavaScript the search box works as usual. Based on GOV.UK’s search with autocomplete,
51
+ * with behaviour from accessible-autocomplete.
52
+ */
53
+ export declare function Autocomplete({ className, ...props }: AutocompleteProps): React.JSX.Element;
54
+ export type AutocompleteInputProps = InputProps;
55
+ /** `Input`, as the autocomplete’s combobox. */
56
+ export declare function AutocompleteInput(props: AutocompleteInputProps): React.JSX.Element;
57
+ export type ListboxProps = Primitives.ListboxProps;
58
+ /** The menu of suggestions, under the search box. Hidden until there are suggestions to show. */
59
+ export declare function Listbox({ className, ...props }: ListboxProps): React.JSX.Element;
60
+ export type OptionProps = Primitives.OptionProps;
61
+ /** A suggestion, in `Listbox`. Children are its text, which can hold `Match`. */
62
+ export declare function Option({ className, children, ...props }: OptionProps): React.JSX.Element;
63
+ export type MatchProps = ComponentProps<'mark'>;
64
+ /** The part of a suggestion that matches the query, in `Option`. */
65
+ export declare function Match({ className, ...props }: MatchProps): React.JSX.Element;
66
+ export type StatusProps = Primitives.StatusProps;
67
+ /** What screen readers hear about the suggestions. Visually hidden. */
68
+ export declare function Status(props: StatusProps): React.JSX.Element;
69
+ export type AssistiveHintProps = Primitives.AssistiveHintProps;
70
+ /** How to use the suggestions, for screen readers. Never shown. */
71
+ export declare function AssistiveHint({ children, ...props }: AssistiveHintProps): React.JSX.Element;
72
+ export type AutocompleteCompositeProps = CompositeProps & Pick<AutocompleteProps, 'minLength' | 'filter' | 'onQueryChange' | 'onConfirm'> & {
73
+ /**
74
+ * The suggestions for the query, such as from `onQueryChange`. Only those containing the query
75
+ * show, unless `filter` is "none", such as for suggestions a server has already matched.
76
+ * Children are an alternative.
77
+ */
78
+ suggestions?: string[];
79
+ /** `Option`s, rather than `suggestions`, such as to highlight the query with `Match`. */
80
+ children?: ReactNode;
81
+ };
82
+ /**
83
+ * A search box that suggests searches as the user types, based on GOV.UK’s search with
84
+ * autocomplete. Choosing a suggestion submits the form. Put it in your own `form`. Other props go
85
+ * on the input. Without JavaScript it’s `Composite`.
86
+ *
87
+ * @see https://components.publishing.service.gov.uk/component-guide/search_with_autocomplete
88
+ */
89
+ export declare function AutocompleteComposite({ id, label, labelSize, labelVisuallyHidden, buttonText, inverse, large, minLength, filter, onQueryChange, onConfirm, suggestions, children, ...props }: AutocompleteCompositeProps): React.JSX.Element;
@@ -0,0 +1,136 @@
1
+ import * as React from 'react';
2
+ import { clsx } from 'clsx';
3
+ import * as Primitives from '@govuk-react/primitives/autocomplete';
4
+ const name = 'govuk-react-search-box';
5
+ const brand = 'var(--govuk-brand-colour,#1d70b8)';
6
+ const suggestionIcon = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 27'%3E%3Ccircle cx='12' cy='11' r='8.5' fill='none' stroke='%23000' stroke-width='3'/%3E%3Cpath d='m17.9 17.4 8.5 8.5' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E";
7
+ /** Styles govuk-frontend has no class for, hoisted and deduplicated by React. Based on GOV.UK’s search component. */
8
+ export const searchBoxCss = `
9
+ .${name}__wrapper{display:flex;background-color:#fff}
10
+ .${name}__input{margin:0;-webkit-appearance:none;appearance:none}
11
+ .${name}__input:focus{z-index:1}
12
+ .${name}__button{position:relative;flex:0 0 auto;width:2.5rem;height:2.5rem;margin:0;padding:0;border:0;border-radius:0;outline:2px solid transparent;outline-offset:0;cursor:pointer;background-color:${brand};color:#fff}
13
+ .${name}__button:hover{background-color:color-mix(in srgb,${brand} 75%,#000)}
14
+ .${name}__button:focus{z-index:1;outline:3px solid var(--govuk-focus-colour,#fd0);box-shadow:inset 0 0 0 4px #0b0c0c}
15
+ .${name}__icon{position:absolute;inset:0;width:100%;height:100%;transform:scale(.5);pointer-events:none}
16
+ .${name}:not(.${name}--inverse) .${name}__input{border-right-width:0}
17
+ .${name}:not(.${name}--inverse) .${name}__input:focus{border-right-width:2px}
18
+ .${name}--inverse .${name}__label{color:#fff}
19
+ .${name}--inverse .${name}__input{border-width:0}
20
+ .${name}--inverse .${name}__button{background-color:color-mix(in srgb,${brand} 20%,#fff);color:${brand}}
21
+ .${name}--inverse .${name}__button:hover{background-color:color-mix(in srgb,${brand} 5%,#fff)}
22
+ .${name}--large .${name}__input{height:3.125rem}
23
+ .${name}--large .${name}__button{width:3.125rem;height:3.125rem}
24
+ .${name}--large .${name}__icon{transform:scale(.4)}
25
+ .${name}__autocomplete{display:block;position:relative}
26
+ .${name}__menu{position:absolute;z-index:100;top:100%;left:0;right:0;margin:0;padding:0;list-style:none;overflow-x:hidden;background-color:#fff;border:1px solid #b1b4b6;border-top:0}
27
+ .${name}--inverse .${name}__menu{border-top:1px solid #b1b4b6}
28
+ .${name}__option{cursor:pointer;font-family:"GDS Transport",arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:1rem;line-height:1.25;color:#0b0c0c}
29
+ @media (min-width:40.0625em){.${name}__option{font-size:1.1875rem;line-height:1.3157894737}}
30
+ .${name}__option>*{pointer-events:none}
31
+ .${name}__option[data-focused],.${name}__option:hover,.${name}__option:focus-visible{background-color:#f3f3f3;outline:none;text-decoration:underline;text-decoration-thickness:max(3px,.1875rem,.12em);text-underline-offset:.1578em}
32
+ .${name}__option:focus-visible .${name}__suggestion-text{background-color:var(--govuk-focus-colour,#fd0)}
33
+ .${name}__option[hidden]{display:none}
34
+ .${name}__option-wrapper{display:flex;align-items:center;margin:0 15px;padding:5px 0}
35
+ .${name}__option:not([hidden])~.${name}__option:not([hidden]) .${name}__option-wrapper{border-top:1px solid #b1b4b6}
36
+ .${name}__suggestion-icon{flex:none;width:20px;height:2.5rem;margin-right:10px;background-color:#505a5f;-webkit-mask:url("${suggestionIcon}") center/contain no-repeat;mask:url("${suggestionIcon}") center/contain no-repeat}
37
+ .${name}__option[data-focused] .${name}__suggestion-icon,.${name}__option:hover .${name}__suggestion-icon,.${name}__option:focus-visible .${name}__suggestion-icon{background-color:#0b0c0c}
38
+ .${name}__suggestion-text{font-weight:700}
39
+ .${name}__suggestion-highlight{font-weight:400;background:none;color:inherit}
40
+ .${name}--large .${name}__option{min-height:3.125rem}
41
+ @media (forced-colors:active){.${name}__menu{border-color:FieldText}.${name}__option[data-focused],.${name}__option:hover{forced-color-adjust:none;background-color:Highlight;color:HighlightText}.${name}__suggestion-icon{background-color:currentcolor}}
42
+ `;
43
+ /** Wraps the search label, input and submit button. */
44
+ export function Root({ inverse, large, className, children, ...props }) {
45
+ return (React.createElement("div", { className: clsx(name, inverse && `${name}--inverse`, large && `${name}--large`, className), ...props },
46
+ React.createElement("style", { href: name, precedence: "default" }, searchBoxCss),
47
+ children));
48
+ }
49
+ export function Label({ size, visuallyHidden, className, children, ...props }) {
50
+ return (React.createElement("label", { className: clsx(visuallyHidden ? 'govuk-visually-hidden' : ['govuk-label', size && `govuk-label--${size}`], `${name}__label`, className), ...props }, children));
51
+ }
52
+ /** Lays out the input and submit button side by side. */
53
+ export function Wrapper({ className, ...props }) {
54
+ return React.createElement("div", { className: clsx(`${name}__wrapper`, className), ...props });
55
+ }
56
+ export function Input({ className, type = 'search', ...props }) {
57
+ return (React.createElement("input", { type: type, enterKeyHint: "search", className: clsx('govuk-input', `${name}__input`, className), ...props }));
58
+ }
59
+ /** The submit button, with a search icon. Children are its accessible name, “Search” by default. */
60
+ export function Button({ className, children = 'Search', ...props }) {
61
+ return (React.createElement("button", { type: "submit", className: clsx(`${name}__button`, className), ...props },
62
+ React.createElement("svg", { className: `${name}__icon`, width: "27", height: "27", viewBox: "0 0 27 27", fill: "none", "aria-hidden": "true", focusable: "false" },
63
+ React.createElement("circle", { cx: "12.0161", cy: "11.0161", r: "8.51613", stroke: "currentColor", strokeWidth: "3" }),
64
+ React.createElement("line", { x1: "17.8668", y1: "17.3587", x2: "26.4475", y2: "25.9393", stroke: "currentColor", strokeWidth: "3" })),
65
+ React.createElement("span", { className: "govuk-visually-hidden" }, children)));
66
+ }
67
+ /**
68
+ * A search input with a label and an attached submit button, based on GOV.UK’s search component. Put it in your own `form`. Other props go on the input.
69
+ *
70
+ * @see https://components.publishing.service.gov.uk/component-guide/search
71
+ */
72
+ export function Composite({ id, label = 'Search on GOV.UK', labelSize, labelVisuallyHidden, buttonText, inverse, large, ...props }) {
73
+ return (React.createElement(Root, { inverse: inverse, large: large },
74
+ React.createElement(Label, { htmlFor: id, size: labelSize, visuallyHidden: labelVisuallyHidden }, label),
75
+ React.createElement(Wrapper, null,
76
+ React.createElement(Input, { id: id, ...props }),
77
+ React.createElement(Button, null, buttonText))));
78
+ }
79
+ /**
80
+ * Suggests searches as the user types, around `Wrapper`, `Listbox`, `Status` and `AssistiveHint`.
81
+ * Without JavaScript the search box works as usual. Based on GOV.UK’s search with autocomplete,
82
+ * with behaviour from accessible-autocomplete.
83
+ */
84
+ export function Autocomplete({ className, ...props }) {
85
+ return React.createElement(Primitives.Root, { className: clsx(`${name}__autocomplete`, className), ...props });
86
+ }
87
+ /** `Input`, as the autocomplete’s combobox. */
88
+ export function AutocompleteInput(props) {
89
+ return (React.createElement(Primitives.Input, { asChild: true },
90
+ React.createElement(Input, { ...props })));
91
+ }
92
+ /** The menu of suggestions, under the search box. Hidden until there are suggestions to show. */
93
+ export function Listbox({ className, ...props }) {
94
+ return React.createElement(Primitives.Listbox, { className: clsx(`${name}__menu`, className), ...props });
95
+ }
96
+ /** A suggestion, in `Listbox`. Children are its text, which can hold `Match`. */
97
+ export function Option({ className, children, ...props }) {
98
+ return (React.createElement(Primitives.Option, { className: clsx(`${name}__option`, className), ...props },
99
+ React.createElement("span", { className: `${name}__option-wrapper` },
100
+ React.createElement("span", { className: `${name}__suggestion-icon`, "aria-hidden": "true" }),
101
+ React.createElement("span", { className: `${name}__suggestion-text` }, children))));
102
+ }
103
+ /** The part of a suggestion that matches the query, in `Option`. */
104
+ export function Match({ className, ...props }) {
105
+ return React.createElement("mark", { className: clsx(`${name}__suggestion-highlight`, className), ...props });
106
+ }
107
+ /** What screen readers hear about the suggestions. Visually hidden. */
108
+ export function Status(props) {
109
+ return React.createElement(Primitives.Status, { ...props });
110
+ }
111
+ /** How to use the suggestions, for screen readers. Never shown. */
112
+ export function AssistiveHint({ children = 'When search suggestions are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.', ...props }) {
113
+ return React.createElement(Primitives.AssistiveHint, { ...props }, children);
114
+ }
115
+ /**
116
+ * A search box that suggests searches as the user types, based on GOV.UK’s search with
117
+ * autocomplete. Choosing a suggestion submits the form. Put it in your own `form`. Other props go
118
+ * on the input. Without JavaScript it’s `Composite`.
119
+ *
120
+ * @see https://components.publishing.service.gov.uk/component-guide/search_with_autocomplete
121
+ */
122
+ export function AutocompleteComposite({ id, label = 'Search on GOV.UK', labelSize, labelVisuallyHidden, buttonText, inverse, large, minLength = 3, filter, onQueryChange, onConfirm, suggestions, children, ...props }) {
123
+ return (React.createElement(Root, { inverse: inverse, large: large },
124
+ React.createElement(Label, { htmlFor: id, size: labelSize, visuallyHidden: labelVisuallyHidden }, label),
125
+ React.createElement(Autocomplete, { minLength: minLength, filter: filter, onQueryChange: onQueryChange, onConfirm: onConfirm, confirmOnBlur: false, submitOnConfirm: true, statusNoResults: "No search suggestions found", statusQueryTooShort: "Type in %{count} or more characters for search suggestions", statusResults: {
126
+ one: '%{count} search suggestion is available.',
127
+ other: '%{count} search suggestions are available.',
128
+ } },
129
+ React.createElement(Wrapper, null,
130
+ React.createElement(AutocompleteInput, { id: id, ...props }),
131
+ React.createElement(Button, null, buttonText)),
132
+ React.createElement(Listbox, null, children !== null && children !== void 0 ? children : suggestions === null || suggestions === void 0 ? void 0 : suggestions.map((suggestion) => (React.createElement(Option, { key: suggestion, value: suggestion }, suggestion)))),
133
+ React.createElement(Status, null),
134
+ React.createElement(AssistiveHint, null))));
135
+ }
136
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/search-box/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,UAAU,MAAM,sCAAsC,CAAC;AAEnE,MAAM,IAAI,GAAG,wBAAwB,CAAC;AACtC,MAAM,KAAK,GAAG,mCAAmC,CAAC;AAClD,MAAM,cAAc,GAClB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esContent":["import * as React from 'react';\nimport type { ComponentProps, ReactNode } from 'react';\nimport { clsx } from 'clsx';\nimport * as Primitives from '@govuk-react/primitives/autocomplete';\n\nconst name = 'govuk-react-search-box';\nconst brand = 'var(--govuk-brand-colour,#1d70b8)';\nconst suggestionIcon =\n \"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 27 27'%3E%3Ccircle cx='12' cy='11' r='8.5' fill='none' stroke='%23000' stroke-width='3'/%3E%3Cpath d='m17.9 17.4 8.5 8.5' stroke='%23000' stroke-width='3'/%3E%3C/svg%3E\";\n\n/** Styles govuk-frontend has no class for, hoisted and deduplicated by React. Based on GOV.UK’s search component. */\nexport const searchBoxCss = `\n.${name}__wrapper{display:flex;background-color:#fff}\n.${name}__input{margin:0;-webkit-appearance:none;appearance:none}\n.${name}__input:focus{z-index:1}\n.${name}__button{position:relative;flex:0 0 auto;width:2.5rem;height:2.5rem;margin:0;padding:0;border:0;border-radius:0;outline:2px solid transparent;outline-offset:0;cursor:pointer;background-color:${brand};color:#fff}\n.${name}__button:hover{background-color:color-mix(in srgb,${brand} 75%,#000)}\n.${name}__button:focus{z-index:1;outline:3px solid var(--govuk-focus-colour,#fd0);box-shadow:inset 0 0 0 4px #0b0c0c}\n.${name}__icon{position:absolute;inset:0;width:100%;height:100%;transform:scale(.5);pointer-events:none}\n.${name}:not(.${name}--inverse) .${name}__input{border-right-width:0}\n.${name}:not(.${name}--inverse) .${name}__input:focus{border-right-width:2px}\n.${name}--inverse .${name}__label{color:#fff}\n.${name}--inverse .${name}__input{border-width:0}\n.${name}--inverse .${name}__button{background-color:color-mix(in srgb,${brand} 20%,#fff);color:${brand}}\n.${name}--inverse .${name}__button:hover{background-color:color-mix(in srgb,${brand} 5%,#fff)}\n.${name}--large .${name}__input{height:3.125rem}\n.${name}--large .${name}__button{width:3.125rem;height:3.125rem}\n.${name}--large .${name}__icon{transform:scale(.4)}\n.${name}__autocomplete{display:block;position:relative}\n.${name}__menu{position:absolute;z-index:100;top:100%;left:0;right:0;margin:0;padding:0;list-style:none;overflow-x:hidden;background-color:#fff;border:1px solid #b1b4b6;border-top:0}\n.${name}--inverse .${name}__menu{border-top:1px solid #b1b4b6}\n.${name}__option{cursor:pointer;font-family:\"GDS Transport\",arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-size:1rem;line-height:1.25;color:#0b0c0c}\n@media (min-width:40.0625em){.${name}__option{font-size:1.1875rem;line-height:1.3157894737}}\n.${name}__option>*{pointer-events:none}\n.${name}__option[data-focused],.${name}__option:hover,.${name}__option:focus-visible{background-color:#f3f3f3;outline:none;text-decoration:underline;text-decoration-thickness:max(3px,.1875rem,.12em);text-underline-offset:.1578em}\n.${name}__option:focus-visible .${name}__suggestion-text{background-color:var(--govuk-focus-colour,#fd0)}\n.${name}__option[hidden]{display:none}\n.${name}__option-wrapper{display:flex;align-items:center;margin:0 15px;padding:5px 0}\n.${name}__option:not([hidden])~.${name}__option:not([hidden]) .${name}__option-wrapper{border-top:1px solid #b1b4b6}\n.${name}__suggestion-icon{flex:none;width:20px;height:2.5rem;margin-right:10px;background-color:#505a5f;-webkit-mask:url(\"${suggestionIcon}\") center/contain no-repeat;mask:url(\"${suggestionIcon}\") center/contain no-repeat}\n.${name}__option[data-focused] .${name}__suggestion-icon,.${name}__option:hover .${name}__suggestion-icon,.${name}__option:focus-visible .${name}__suggestion-icon{background-color:#0b0c0c}\n.${name}__suggestion-text{font-weight:700}\n.${name}__suggestion-highlight{font-weight:400;background:none;color:inherit}\n.${name}--large .${name}__option{min-height:3.125rem}\n@media (forced-colors:active){.${name}__menu{border-color:FieldText}.${name}__option[data-focused],.${name}__option:hover{forced-color-adjust:none;background-color:Highlight;color:HighlightText}.${name}__suggestion-icon{background-color:currentcolor}}\n`;\n\nexport type RootProps = ComponentProps<'div'> & {\n /** For use on dark backgrounds, such as a GOV.UK blue homepage banner. */\n inverse?: boolean;\n /** A larger input and button. */\n large?: boolean;\n};\n\n/** Wraps the search label, input and submit button. */\nexport function Root({ inverse, large, className, children, ...props }: RootProps) {\n return (\n <div className={clsx(name, inverse && `${name}--inverse`, large && `${name}--large`, className)} {...props}>\n <style href={name} precedence=\"default\">\n {searchBoxCss}\n </style>\n {children}\n </div>\n );\n}\n\nexport type LabelProps = ComponentProps<'label'> & {\n /** The label size, from govuk-frontend’s label sizes. */\n size?: 's' | 'm' | 'l' | 'xl';\n /** Hide the label visually. It’s still read by screen readers. */\n visuallyHidden?: boolean;\n};\n\nexport function Label({ size, visuallyHidden, className, children, ...props }: LabelProps) {\n return (\n <label\n className={clsx(\n visuallyHidden ? 'govuk-visually-hidden' : ['govuk-label', size && `govuk-label--${size}`],\n `${name}__label`,\n className\n )}\n {...props}\n >\n {children}\n </label>\n );\n}\n\nexport type WrapperProps = ComponentProps<'div'>;\n\n/** Lays out the input and submit button side by side. */\nexport function Wrapper({ className, ...props }: WrapperProps) {\n return <div className={clsx(`${name}__wrapper`, className)} {...props} />;\n}\n\nexport type InputProps = ComponentProps<'input'>;\n\nexport function Input({ className, type = 'search', ...props }: InputProps) {\n return (\n <input type={type} enterKeyHint=\"search\" className={clsx('govuk-input', `${name}__input`, className)} {...props} />\n );\n}\n\nexport type ButtonProps = ComponentProps<'button'>;\n\n/** The submit button, with a search icon. Children are its accessible name, “Search” by default. */\nexport function Button({ className, children = 'Search', ...props }: ButtonProps) {\n return (\n <button type=\"submit\" className={clsx(`${name}__button`, className)} {...props}>\n <svg\n className={`${name}__icon`}\n width=\"27\"\n height=\"27\"\n viewBox=\"0 0 27 27\"\n fill=\"none\"\n aria-hidden=\"true\"\n focusable=\"false\"\n >\n <circle cx=\"12.0161\" cy=\"11.0161\" r=\"8.51613\" stroke=\"currentColor\" strokeWidth=\"3\" />\n <line x1=\"17.8668\" y1=\"17.3587\" x2=\"26.4475\" y2=\"25.9393\" stroke=\"currentColor\" strokeWidth=\"3\" />\n </svg>\n <span className=\"govuk-visually-hidden\">{children}</span>\n </button>\n );\n}\n\nexport type CompositeProps = Omit<InputProps, 'id'> &\n Pick<RootProps, 'inverse' | 'large'> & {\n /** The input’s id, which the label points to. */\n id: string;\n /** The label text. */\n label?: ReactNode;\n /** The label size, from govuk-frontend’s label sizes. */\n labelSize?: LabelProps['size'];\n /** Hide the label visually. It’s still read by screen readers. */\n labelVisuallyHidden?: boolean;\n /** The submit button’s visually hidden text. */\n buttonText?: ReactNode;\n };\n\n/**\n * A search input with a label and an attached submit button, based on GOV.UK’s search component. Put it in your own `form`. Other props go on the input.\n *\n * @see https://components.publishing.service.gov.uk/component-guide/search\n */\nexport function Composite({\n id,\n label = 'Search on GOV.UK',\n labelSize,\n labelVisuallyHidden,\n buttonText,\n inverse,\n large,\n ...props\n}: CompositeProps) {\n return (\n <Root inverse={inverse} large={large}>\n <Label htmlFor={id} size={labelSize} visuallyHidden={labelVisuallyHidden}>\n {label}\n </Label>\n <Wrapper>\n <Input id={id} {...props} />\n <Button>{buttonText}</Button>\n </Wrapper>\n </Root>\n );\n}\n\nexport type AutocompleteProps = Primitives.RootProps;\n\n/**\n * Suggests searches as the user types, around `Wrapper`, `Listbox`, `Status` and `AssistiveHint`.\n * Without JavaScript the search box works as usual. Based on GOV.UK’s search with autocomplete,\n * with behaviour from accessible-autocomplete.\n */\nexport function Autocomplete({ className, ...props }: AutocompleteProps) {\n return <Primitives.Root className={clsx(`${name}__autocomplete`, className)} {...props} />;\n}\n\nexport type AutocompleteInputProps = InputProps;\n\n/** `Input`, as the autocomplete’s combobox. */\nexport function AutocompleteInput(props: AutocompleteInputProps) {\n return (\n <Primitives.Input asChild>\n <Input {...props} />\n </Primitives.Input>\n );\n}\n\nexport type ListboxProps = Primitives.ListboxProps;\n\n/** The menu of suggestions, under the search box. Hidden until there are suggestions to show. */\nexport function Listbox({ className, ...props }: ListboxProps) {\n return <Primitives.Listbox className={clsx(`${name}__menu`, className)} {...props} />;\n}\n\nexport type OptionProps = Primitives.OptionProps;\n\n/** A suggestion, in `Listbox`. Children are its text, which can hold `Match`. */\nexport function Option({ className, children, ...props }: OptionProps) {\n return (\n <Primitives.Option className={clsx(`${name}__option`, className)} {...props}>\n <span className={`${name}__option-wrapper`}>\n <span className={`${name}__suggestion-icon`} aria-hidden=\"true\" />\n <span className={`${name}__suggestion-text`}>{children}</span>\n </span>\n </Primitives.Option>\n );\n}\n\nexport type MatchProps = ComponentProps<'mark'>;\n\n/** The part of a suggestion that matches the query, in `Option`. */\nexport function Match({ className, ...props }: MatchProps) {\n return <mark className={clsx(`${name}__suggestion-highlight`, className)} {...props} />;\n}\n\nexport type StatusProps = Primitives.StatusProps;\n\n/** What screen readers hear about the suggestions. Visually hidden. */\nexport function Status(props: StatusProps) {\n return <Primitives.Status {...props} />;\n}\n\nexport type AssistiveHintProps = Primitives.AssistiveHintProps;\n\n/** How to use the suggestions, for screen readers. Never shown. */\nexport function AssistiveHint({\n children = 'When search suggestions are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.',\n ...props\n}: AssistiveHintProps) {\n return <Primitives.AssistiveHint {...props}>{children}</Primitives.AssistiveHint>;\n}\n\nexport type AutocompleteCompositeProps = CompositeProps &\n Pick<AutocompleteProps, 'minLength' | 'filter' | 'onQueryChange' | 'onConfirm'> & {\n /**\n * The suggestions for the query, such as from `onQueryChange`. Only those containing the query\n * show, unless `filter` is \"none\", such as for suggestions a server has already matched.\n * Children are an alternative.\n */\n suggestions?: string[];\n /** `Option`s, rather than `suggestions`, such as to highlight the query with `Match`. */\n children?: ReactNode;\n };\n\n/**\n * A search box that suggests searches as the user types, based on GOV.UK’s search with\n * autocomplete. Choosing a suggestion submits the form. Put it in your own `form`. Other props go\n * on the input. Without JavaScript it’s `Composite`.\n *\n * @see https://components.publishing.service.gov.uk/component-guide/search_with_autocomplete\n */\nexport function AutocompleteComposite({\n id,\n label = 'Search on GOV.UK',\n labelSize,\n labelVisuallyHidden,\n buttonText,\n inverse,\n large,\n minLength = 3,\n filter,\n onQueryChange,\n onConfirm,\n suggestions,\n children,\n ...props\n}: AutocompleteCompositeProps) {\n return (\n <Root inverse={inverse} large={large}>\n <Label htmlFor={id} size={labelSize} visuallyHidden={labelVisuallyHidden}>\n {label}\n </Label>\n <Autocomplete\n minLength={minLength}\n filter={filter}\n onQueryChange={onQueryChange}\n onConfirm={onConfirm}\n confirmOnBlur={false}\n submitOnConfirm\n statusNoResults=\"No search suggestions found\"\n statusQueryTooShort=\"Type in %{count} or more characters for search suggestions\"\n statusResults={{\n one: '%{count} search suggestion is available.',\n other: '%{count} search suggestions are available.',\n }}\n >\n <Wrapper>\n <AutocompleteInput id={id} {...props} />\n <Button>{buttonText}</Button>\n </Wrapper>\n <Listbox>\n {children ??\n suggestions?.map((suggestion) => (\n <Option key={suggestion} value={suggestion}>\n {suggestion}\n </Option>\n ))}\n </Listbox>\n <Status />\n <AssistiveHint />\n </Autocomplete>\n </Root>\n );\n}\n"]}
@@ -0,0 +1 @@
1
+ export { SectionBreak, type SectionBreakProps } from 'govuk-frontend-react/section-break';
@@ -0,0 +1,2 @@
1
+ export { SectionBreak } from 'govuk-frontend-react/section-break';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/section-break/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0B,MAAM,oCAAoC,CAAC","sourcesContent":["export { SectionBreak, type SectionBreakProps } from 'govuk-frontend-react/section-break';\n"]}
@@ -0,0 +1,2 @@
1
+ export * from 'govuk-frontend-react/select';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/select/index.tsx"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC","sourcesContent":["export * from 'govuk-frontend-react/select';\n"]}
@@ -0,0 +1,64 @@
1
+ import * as React from 'react';
2
+ import type { ComponentProps } from 'react';
3
+ import * as Primitives from '@govuk-react/primitives/disclosure';
4
+ import * as Markup from 'govuk-frontend-react/service-navigation';
5
+ export { Root, WidthContainer, Container, ServiceName, Link, Text, Item, ActiveFallback, ItemComposite, type RootProps, type WidthContainerProps, type ContainerProps, type ServiceNameProps, type LinkProps, type TextProps, type ItemProps, type ActiveFallbackProps, type ItemCompositeProps, } from 'govuk-frontend-react/service-navigation';
6
+ export { Wrapper, type WrapperProps } from 'govuk-frontend-react/service-navigation';
7
+ type MenuState = {
8
+ /** Whether the menu is open below tablet width, to control it once hydrated, such as to close it after navigating. */
9
+ open?: boolean;
10
+ /** Called when the user opens or closes the menu. */
11
+ onOpenChange?: (open: boolean) => void;
12
+ };
13
+ export type MenuProps = Omit<Primitives.RootProps, 'media' | 'defaultOpen'> & MenuState;
14
+ /**
15
+ * govuk-frontend's menu: inside `Wrapper`, around `Toggle` and `List`. Below tablet width the
16
+ * button shows and hides the list once JavaScript runs. Without JavaScript the list is always
17
+ * shown and the button hidden.
18
+ */
19
+ export declare function Menu({ style, ...props }: MenuProps): React.JSX.Element;
20
+ export type ToggleProps = Markup.ToggleProps;
21
+ /** The menu button, inside `Menu`. Hidden from tablet width up, and without JavaScript. */
22
+ export declare function Toggle(props: ToggleProps): React.JSX.Element;
23
+ /** Styles govuk-frontend has no class for, hoisted and deduplicated by React. */
24
+ export declare const detailsCss = "\n.govuk-react-service-navigation__details>summary{list-style:none}\n.govuk-react-service-navigation__details>summary::-webkit-details-marker{display:none}\n.govuk-react-service-navigation__details[open]>summary::after{transform:rotate(180deg)}\n@supports selector(::details-content){@media (min-width: 40.0625em){.govuk-react-service-navigation__details>summary{display:none}.govuk-react-service-navigation__details::details-content{content-visibility:visible;display:contents}}}\n";
25
+ export type DetailsMenuProps = Omit<ComponentProps<'details'>, 'open'> & MenuState;
26
+ /**
27
+ * A menu that works without JavaScript: a native `details`, inside `Wrapper`, around `Summary`
28
+ * and `List`. Below tablet width the summary shows and hides the list. From tablet width the list
29
+ * shows where the browser supports `::details-content` (Chrome and Edge 131, Safari 18.4,
30
+ * Firefox 143), and stays behind the menu where it doesn't.
31
+ *
32
+ * Check it with your users' assistive technology before choosing it over `Menu`. GOV.UK's audits
33
+ * of the Details component found VoiceOver doesn't convey a `summary`'s state on iOS before 17,
34
+ * and Dragon voice control can have trouble opening one.
35
+ *
36
+ * @see https://github.com/alphagov/govuk-design-system/issues/4030
37
+ * @see https://github.com/alphagov/govuk-frontend/issues/5310
38
+ */
39
+ export declare function DetailsMenu({ open, onOpenChange, onToggle, className, children, ...props }: DetailsMenuProps): React.JSX.Element;
40
+ export type SummaryProps = ComponentProps<'summary'>;
41
+ /** The menu button of `DetailsMenu`. Hidden from tablet width up, where the browser can show the list. */
42
+ export declare function Summary({ className, children, ...props }: SummaryProps): React.JSX.Element;
43
+ export type ListProps = Markup.ListProps;
44
+ /** The navigation list, inside `Menu` or `DetailsMenu`, or straight inside `Wrapper` with no menu. */
45
+ export declare function List(props: ListProps): React.JSX.Element;
46
+ export type CompositeProps = Markup.CompositeProps & MenuState;
47
+ /**
48
+ * Service navigation helps users understand that they’re using your service and lets them navigate around your service.
49
+ *
50
+ * Children are `ItemComposite`s. The menu is govuk-frontend's: without JavaScript the
51
+ * navigation is always shown.
52
+ *
53
+ * @see https://design-system.service.gov.uk/components/service-navigation/
54
+ */
55
+ export declare function Composite(props: CompositeProps): React.JSX.Element;
56
+ /**
57
+ * Service navigation helps users understand that they’re using your service and lets them navigate around your service.
58
+ *
59
+ * Children are `ItemComposite`s. The menu is a `DetailsMenu`, which works without JavaScript but
60
+ * has screen reader and voice control caveats: see `DetailsMenu`.
61
+ *
62
+ * @see https://design-system.service.gov.uk/components/service-navigation/
63
+ */
64
+ export declare function DetailsComposite(props: CompositeProps): React.JSX.Element;