@tpzdsp/next-toolkit 2.5.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (355) hide show
  1. package/package.json +22 -13
  2. package/src/assets/styles/globals.css +75 -95
  3. package/src/assets/styles/ol.css +57 -16
  4. package/src/assets/styles/utils.css +80 -0
  5. package/src/components/Accordion/Accordion.css +85 -0
  6. package/src/components/Accordion/Accordion.stories.tsx +264 -0
  7. package/src/components/Accordion/Accordion.tsx +98 -0
  8. package/src/components/Alert/Alert.css +129 -0
  9. package/src/components/Alert/Alert.stories.tsx +291 -0
  10. package/src/components/Alert/Alert.tsx +76 -0
  11. package/src/components/BackLink/BackLink.css +12 -0
  12. package/src/components/BackLink/BackLink.stories.tsx +52 -0
  13. package/src/components/BackLink/BackLink.tsx +44 -0
  14. package/src/components/BackToTop/BackToTop.css +23 -0
  15. package/src/components/BackToTop/BackToTop.stories.tsx +41 -0
  16. package/src/components/BackToTop/BackToTop.tsx +48 -0
  17. package/src/components/Breadcrumb/Breadcrumb.css +42 -0
  18. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +94 -0
  19. package/src/components/Breadcrumb/Breadcrumb.tsx +135 -0
  20. package/src/components/Button/Button.css +229 -0
  21. package/src/components/Button/Button.stories.tsx +140 -20
  22. package/src/components/Button/Button.tsx +53 -28
  23. package/src/components/Button/ButtonSkeleton.stories.tsx +50 -0
  24. package/src/components/Button/ButtonSkeleton.tsx +14 -0
  25. package/src/components/ButtonGroup/ButtonGroup.css +52 -0
  26. package/src/components/ButtonGroup/ButtonGroup.stories.tsx +156 -0
  27. package/src/components/ButtonGroup/ButtonGroup.tsx +50 -0
  28. package/src/components/ButtonLink/ButtonLink.css +114 -0
  29. package/src/components/ButtonLink/ButtonLink.stories.tsx +38 -51
  30. package/src/components/ButtonLink/ButtonLink.tsx +54 -23
  31. package/src/components/Card/Card.css +13 -0
  32. package/src/components/Card/Card.stories.tsx +98 -57
  33. package/src/components/Card/Card.tsx +4 -13
  34. package/src/components/CardGroup/CardGroup.css +10 -0
  35. package/src/components/CardGroup/CardGroup.stories.tsx +81 -0
  36. package/src/components/CardGroup/CardGroup.tsx +9 -0
  37. package/src/components/Checkbox/Checkbox.css +49 -0
  38. package/src/components/Checkbox/Checkbox.stories.tsx +86 -0
  39. package/src/components/Checkbox/Checkbox.tsx +32 -0
  40. package/src/components/Chip/Chip.css +54 -0
  41. package/src/components/Chip/Chip.stories.tsx +94 -0
  42. package/src/components/Chip/Chip.tsx +34 -0
  43. package/src/components/CookieBanner/CookieBanner.css +19 -0
  44. package/src/components/CookieBanner/CookieBanner.stories.tsx +52 -0
  45. package/src/components/CookieBanner/CookieBanner.tsx +55 -0
  46. package/src/components/CopyButton/CopyButton.stories.tsx +28 -0
  47. package/src/components/CopyButton/CopyButton.tsx +65 -0
  48. package/src/components/DateInput/DateInput.css +13 -0
  49. package/src/components/DateInput/DateInput.stories.tsx +131 -0
  50. package/src/components/DateInput/DateInput.test.tsx +21 -0
  51. package/src/components/DateInput/DateInput.tsx +98 -0
  52. package/src/components/Details/Details.css +28 -0
  53. package/src/components/Details/Details.stories.tsx +48 -0
  54. package/src/components/Details/Details.tsx +41 -0
  55. package/src/components/Dropdown/Dropdown.css +81 -0
  56. package/src/components/Dropdown/Dropdown.stories.tsx +131 -0
  57. package/src/components/Dropdown/Dropdown.tsx +69 -0
  58. package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +4 -39
  59. package/src/components/ErrorBoundary/ErrorBoundary.tsx +7 -4
  60. package/src/components/ErrorBoundary/ErrorFallback.tsx +32 -66
  61. package/src/components/ErrorModal/ErrorModal.css +32 -0
  62. package/src/components/ErrorModal/ErrorModal.stories.tsx +101 -0
  63. package/src/components/ErrorModal/ErrorModal.tsx +120 -0
  64. package/src/components/ErrorText/ErrorText.css +22 -0
  65. package/src/components/ErrorText/ErrorText.stories.tsx +42 -27
  66. package/src/components/ErrorText/ErrorText.tsx +10 -8
  67. package/src/components/ExternalLink/ExternalLink.css +12 -0
  68. package/src/components/ExternalLink/ExternalLink.stories.tsx +43 -0
  69. package/src/components/ExternalLink/ExternalLink.tsx +43 -0
  70. package/src/components/Fieldset/Fieldset.css +103 -0
  71. package/src/components/Fieldset/Fieldset.stories.tsx +304 -0
  72. package/src/components/Fieldset/Fieldset.tsx +38 -0
  73. package/src/components/FileUpload/FileUpload.css +85 -0
  74. package/src/components/FileUpload/FileUpload.stories.tsx +106 -0
  75. package/src/components/FileUpload/FileUpload.tsx +99 -0
  76. package/src/components/{layout/footer → Footer}/Copyright.tsx +4 -2
  77. package/src/components/Footer/Footer.stories.tsx +24 -0
  78. package/src/components/Footer/Footer.tsx +41 -0
  79. package/src/components/Footer/Licence.tsx +18 -0
  80. package/src/components/{layout/footer → Footer}/MetaLinks.tsx +8 -3
  81. package/src/components/Footer/Small/SmallFooter.tsx +43 -42
  82. package/src/components/Form/FormGroup.css +18 -0
  83. package/src/components/Form/FormGroup.stories.tsx +87 -0
  84. package/src/components/Form/FormGroup.tsx +16 -0
  85. package/src/components/{layout/header → Header}/Header.stories.tsx +26 -12
  86. package/src/components/Header/Header.test.tsx +87 -0
  87. package/src/components/Header/Header.tsx +303 -0
  88. package/src/components/Header/HeaderAppContent.tsx +120 -0
  89. package/src/components/Heading/Heading.css +40 -0
  90. package/src/components/Heading/Heading.stories.tsx +15 -5
  91. package/src/components/Heading/Heading.tsx +21 -44
  92. package/src/components/Heading/HeadingSkeleton.stories.tsx +30 -0
  93. package/src/components/Heading/HeadingSkeleton.tsx +14 -0
  94. package/src/components/Hero/Hero.css +19 -0
  95. package/src/components/Hero/Hero.stories.tsx +41 -0
  96. package/src/components/Hero/Hero.tsx +14 -0
  97. package/src/components/HintText/HintText.css +5 -0
  98. package/src/components/HintText/HintText.stories.tsx +29 -0
  99. package/src/components/HintText/HintText.tsx +13 -0
  100. package/src/components/InfoBox/InfoBox.css +38 -0
  101. package/src/components/InfoBox/InfoBox.stories.tsx +51 -403
  102. package/src/components/InfoBox/InfoBox.tsx +31 -158
  103. package/src/components/Input/Input.css +77 -0
  104. package/src/components/Input/Input.stories.tsx +123 -0
  105. package/src/components/Input/Input.tsx +74 -0
  106. package/src/components/InputGroup/InputGroup.css +140 -0
  107. package/src/components/InputGroup/InputGroup.stories.tsx +125 -0
  108. package/src/components/InputGroup/InputGroup.tsx +47 -0
  109. package/src/components/InsetText/InsetText.css +5 -0
  110. package/src/components/InsetText/InsetText.stories.tsx +30 -0
  111. package/src/components/InsetText/InsetText.tsx +9 -0
  112. package/src/components/Keyboard/Keyboard.css +9 -0
  113. package/src/components/Keyboard/Keyboard.stories.tsx +63 -0
  114. package/src/components/Keyboard/Keyboard.tsx +30 -0
  115. package/src/components/Label/Label.css +27 -0
  116. package/src/components/Label/Label.stories.tsx +40 -0
  117. package/src/components/Label/Label.tsx +17 -0
  118. package/src/components/LayerSwitcher/LayerSwitcher.css +59 -0
  119. package/src/components/LayerSwitcher/LayerSwitcher.stories.tsx +112 -0
  120. package/src/components/LayerSwitcher/LayerSwitcher.tsx +61 -0
  121. package/src/components/Layout/401/401.stories.tsx +23 -0
  122. package/src/components/Layout/401/401.tsx +1 -0
  123. package/src/components/Layout/403/403.stories.tsx +23 -0
  124. package/src/components/Layout/403/403.tsx +21 -0
  125. package/src/components/Layout/404/404.stories.tsx +23 -0
  126. package/src/components/Layout/404/404.tsx +28 -0
  127. package/src/components/Layout/500/500.stories.tsx +56 -0
  128. package/src/components/Layout/500/500.tsx +63 -0
  129. package/src/components/Layout/ButtonGroup/ButtonGroup.css +52 -0
  130. package/src/components/Layout/ButtonGroup/ButtonGroup.stories.tsx +156 -0
  131. package/src/components/Layout/ButtonGroup/ButtonGroup.tsx +50 -0
  132. package/src/components/Layout/HeadingGroup/HeadingGroup.css +21 -0
  133. package/src/components/Layout/HeadingGroup/HeadingGroup.stories.tsx +84 -0
  134. package/src/components/Layout/HeadingGroup/HeadingGroup.tsx +9 -0
  135. package/src/components/Layout/MainWrapper/MainWrapper.css +12 -0
  136. package/src/components/Layout/MainWrapper/MainWrapper.stories.tsx +36 -0
  137. package/src/components/Layout/MainWrapper/MainWrapper.tsx +14 -0
  138. package/src/components/Layout/PageShell/PageShell.css +42 -0
  139. package/src/components/Layout/PageShell/PageShell.stories.tsx +108 -0
  140. package/src/components/Layout/PageShell/PageShell.tsx +31 -0
  141. package/src/components/Layout/ParagraphGroup/ParagraphGroup.css +5 -0
  142. package/src/components/Layout/ParagraphGroup/ParagraphGroup.stories.tsx +34 -0
  143. package/src/components/Layout/ParagraphGroup/ParagraphGroup.tsx +9 -0
  144. package/src/components/Layout/Stack/Stack.css +29 -0
  145. package/src/components/Layout/Stack/Stack.stories.tsx +83 -0
  146. package/src/components/Layout/Stack/Stack.tsx +19 -0
  147. package/src/components/Layout/WidthContainer/WidthContainer.css +17 -0
  148. package/src/components/Layout/WidthContainer/WidthContainer.stories.tsx +59 -0
  149. package/src/components/Layout/WidthContainer/WidthContainer.tsx +13 -0
  150. package/src/components/Legend/Legend.css +95 -0
  151. package/src/components/Legend/Legend.stories.tsx +81 -0
  152. package/src/components/Legend/Legend.tsx +32 -0
  153. package/src/components/Legend/LegendDot.tsx +15 -0
  154. package/src/components/Legend/LegendPanel.stories.tsx +101 -0
  155. package/src/components/Legend/LegendPanel.tsx +68 -0
  156. package/src/components/Legend/LegendSkeleton.stories.tsx +87 -0
  157. package/src/components/Legend/LegendSkeleton.tsx +73 -0
  158. package/src/components/LegendSelect/LegendSelect.css +8 -0
  159. package/src/components/LegendSelect/LegendSelect.stories.tsx +80 -0
  160. package/src/components/LegendSelect/LegendSelect.tsx +26 -0
  161. package/src/components/Link/Link.css +98 -0
  162. package/src/components/Link/Link.stories.tsx +70 -0
  163. package/src/components/Link/Link.tsx +52 -0
  164. package/src/components/LinkButton/LinkButton.css +67 -0
  165. package/src/components/LinkButton/LinkButton.stories.tsx +90 -42
  166. package/src/components/LinkButton/LinkButton.tsx +50 -63
  167. package/src/components/LinkList/LinkList.css +28 -0
  168. package/src/components/LinkList/LinkList.stories.tsx +46 -0
  169. package/src/components/LinkList/LinkList.tsx +23 -0
  170. package/src/components/List/Li.tsx +9 -0
  171. package/src/components/List/List.css +9 -0
  172. package/src/components/List/OrderedList.stories.tsx +36 -0
  173. package/src/components/List/OrderedList.tsx +9 -0
  174. package/src/components/List/UnorderedList.stories.tsx +36 -0
  175. package/src/components/List/UnorderedList.tsx +9 -0
  176. package/src/components/LoadingBox/LoadingBox.css +27 -0
  177. package/src/components/LoadingBox/LoadingBox.stories.tsx +66 -0
  178. package/src/components/LoadingBox/LoadingBox.tsx +40 -0
  179. package/src/components/Modal/Modal.css +114 -0
  180. package/src/components/Modal/Modal.stories.tsx +41 -160
  181. package/src/components/Modal/Modal.tsx +132 -75
  182. package/src/components/NoScriptBanner/NoScriptBanner.css +17 -0
  183. package/src/components/NoScriptBanner/NoScriptBanner.stories.tsx +46 -0
  184. package/src/components/NoScriptBanner/NoScriptBanner.tsx +26 -0
  185. package/src/components/Paragraph/Paragraph.css +22 -0
  186. package/src/components/Paragraph/Paragraph.stories.tsx +1 -42
  187. package/src/components/Paragraph/Paragraph.tsx +4 -3
  188. package/src/components/Paragraph/ParagraphSkeleton.stories.tsx +44 -0
  189. package/src/components/Paragraph/ParagraphSkeleton.tsx +33 -0
  190. package/src/components/PasswordInput/PasswordInput.css +3 -0
  191. package/src/components/PasswordInput/PasswordInput.stories.tsx +47 -0
  192. package/src/components/PasswordInput/PasswordInput.tsx +45 -0
  193. package/src/components/PhaseBanner/PhaseBanner.css +12 -0
  194. package/src/components/PhaseBanner/PhaseBanner.stories.tsx +61 -0
  195. package/src/components/PhaseBanner/PhaseBanner.tsx +17 -0
  196. package/src/components/Popover/Popover.css +43 -0
  197. package/src/components/Popover/Popover.stories.tsx +102 -0
  198. package/src/components/Popover/Popover.tsx +40 -0
  199. package/src/components/Radio/Radio.css +69 -0
  200. package/src/components/Radio/Radio.stories.tsx +169 -0
  201. package/src/components/Radio/Radio.tsx +56 -0
  202. package/src/components/Resizable/Resizable.css +86 -0
  203. package/src/components/Resizable/Resizable.stories.tsx +123 -0
  204. package/src/components/Resizable/Resizable.tsx +86 -0
  205. package/src/components/ScrollArea/ScrollArea.css +9 -0
  206. package/src/components/ScrollArea/ScrollArea.stories.tsx +42 -0
  207. package/src/components/ScrollArea/ScrollArea.tsx +11 -0
  208. package/src/components/SearchBox/SearchBox.stories.tsx +88 -0
  209. package/src/components/SearchBox/SearchBox.tsx +36 -0
  210. package/src/components/Select/AsyncSelect.stories.tsx +84 -0
  211. package/src/components/Select/AsyncSelect.tsx +41 -0
  212. package/src/components/Select/Select.css +194 -0
  213. package/src/components/Select/Select.stories.tsx +162 -0
  214. package/src/components/Select/Select.test.tsx +36 -0
  215. package/src/components/Select/Select.tsx +291 -0
  216. package/src/components/Select/SelectSkeleton.stories.tsx +51 -0
  217. package/src/components/Select/SelectSkeleton.tsx +23 -0
  218. package/src/components/Separator/Separator.css +41 -0
  219. package/src/components/Separator/Separator.stories.tsx +63 -0
  220. package/src/components/Separator/Separator.tsx +42 -0
  221. package/src/components/Sidebar/ResizableSidebar.tsx +118 -0
  222. package/src/components/Sidebar/Sidebar.css +203 -0
  223. package/src/components/Sidebar/Sidebar.stories.tsx +438 -0
  224. package/src/components/Sidebar/Sidebar.tsx +225 -0
  225. package/src/components/Skeleton/Skeleton.css +16 -0
  226. package/src/components/Skeleton/Skeleton.stories.tsx +39 -0
  227. package/src/components/Skeleton/Skeleton.tsx +12 -0
  228. package/src/components/SkipLink/SkipLink.css +16 -0
  229. package/src/components/SkipLink/SkipLink.stories.tsx +40 -0
  230. package/src/components/SkipLink/SkipLink.tsx +15 -0
  231. package/src/components/Spinner/Spinner.css +30 -0
  232. package/src/components/Spinner/Spinner.stories.tsx +36 -0
  233. package/src/components/Spinner/Spinner.tsx +45 -0
  234. package/src/components/StartButton/StartButton.css +13 -0
  235. package/src/components/StartButton/StartButton.stories.tsx +68 -0
  236. package/src/components/StartButton/StartButton.tsx +50 -0
  237. package/src/components/SubmitButton/SubmitButton.stories.tsx +31 -0
  238. package/src/components/SubmitButton/SubmitButton.tsx +14 -0
  239. package/src/components/SummaryList/SummaryList.css +71 -0
  240. package/src/components/SummaryList/SummaryList.stories.tsx +211 -0
  241. package/src/components/SummaryList/SummaryList.tsx +41 -0
  242. package/src/components/SummaryList/SummaryListSkeleton.stories.tsx +67 -0
  243. package/src/components/SummaryList/SummaryListSkeleton.tsx +40 -0
  244. package/src/components/Tabs/Tabs.css +84 -0
  245. package/src/components/Tabs/Tabs.stories.tsx +133 -0
  246. package/src/components/Tabs/Tabs.tsx +66 -0
  247. package/src/components/Tag/Tag.css +8 -0
  248. package/src/components/Tag/Tag.stories.tsx +96 -0
  249. package/src/components/Tag/Tag.tsx +34 -0
  250. package/src/components/Textarea/Textarea.css +38 -0
  251. package/src/components/Textarea/Textarea.stories.tsx +131 -0
  252. package/src/components/Textarea/Textarea.tsx +50 -0
  253. package/src/components/TextareaCount/TextareaCount.css +17 -0
  254. package/src/components/TextareaCount/TextareaCount.stories.tsx +131 -0
  255. package/src/components/TextareaCount/TextareaCount.tsx +108 -0
  256. package/src/components/Tooltip/Tooltip.css +43 -0
  257. package/src/components/Tooltip/Tooltip.stories.tsx +110 -0
  258. package/src/components/Tooltip/Tooltip.tsx +53 -0
  259. package/src/components/WarningText/WarningText.css +20 -0
  260. package/src/components/WarningText/WarningText.stories.tsx +29 -0
  261. package/src/components/WarningText/WarningText.tsx +17 -0
  262. package/src/components/index.ts +342 -61
  263. package/src/errors/errorDisplay.ts +70 -0
  264. package/src/errors/index.ts +1 -0
  265. package/src/http/constants.ts +1 -0
  266. package/src/http/fetch.ts +7 -3
  267. package/src/map/LayerSwitcherPanel.tsx +2 -173
  268. package/src/map/LegendShim.tsx +2 -0
  269. package/src/map/MapComponent.tsx +7 -17
  270. package/src/map/MapControlsOverlay.tsx +68 -175
  271. package/src/map/Popup.tsx +71 -24
  272. package/src/map/geocoder/Geocoder.test.tsx +46 -3
  273. package/src/map/geocoder/Geocoder.tsx +155 -278
  274. package/src/map/index.ts +1 -1
  275. package/src/types/utils.ts +0 -10
  276. package/src/utils/components.ts +96 -0
  277. package/src/utils/index.ts +1 -0
  278. package/src/utils/utils.ts +0 -12
  279. package/src/assets/images/defra-logo.svg +0 -51
  280. package/src/assets/images/ea-logo.svg +0 -58
  281. package/src/assets/images/ogl.svg +0 -1
  282. package/src/components/Button/Button.test.tsx +0 -53
  283. package/src/components/ButtonLink/ButtonLink.test.tsx +0 -154
  284. package/src/components/Card/Card.test.tsx +0 -51
  285. package/src/components/ErrorBoundary/ErrorBoundary.test.tsx +0 -75
  286. package/src/components/ErrorBoundary/ErrorFallback.test.tsx +0 -107
  287. package/src/components/ErrorText/ErrorText.test.tsx +0 -33
  288. package/src/components/Heading/Heading.test.tsx +0 -22
  289. package/src/components/Hint/Hint.stories.tsx +0 -58
  290. package/src/components/Hint/Hint.test.tsx +0 -33
  291. package/src/components/Hint/Hint.tsx +0 -12
  292. package/src/components/InfoBox/InfoBox.test.tsx +0 -330
  293. package/src/components/InfoBox/types.ts +0 -6
  294. package/src/components/LinkButton/LinkButton.test.tsx +0 -177
  295. package/src/components/Modal/Modal.test.tsx +0 -246
  296. package/src/components/NotificationBanner/NotificationBanner.stories.tsx +0 -45
  297. package/src/components/NotificationBanner/NotificationBanner.test.tsx +0 -58
  298. package/src/components/NotificationBanner/NotificationBanner.tsx +0 -45
  299. package/src/components/Paragraph/Paragraph.test.tsx +0 -10
  300. package/src/components/SlidingPanel/SlidingPanel.stories.tsx +0 -129
  301. package/src/components/SlidingPanel/SlidingPanel.test.tsx +0 -83
  302. package/src/components/SlidingPanel/SlidingPanel.tsx +0 -258
  303. package/src/components/accordion/Accordion.stories.tsx +0 -234
  304. package/src/components/accordion/Accordion.test.tsx +0 -192
  305. package/src/components/accordion/Accordion.tsx +0 -73
  306. package/src/components/backToTop/BackToTop.stories.tsx +0 -407
  307. package/src/components/backToTop/BackToTop.test.tsx +0 -57
  308. package/src/components/backToTop/BackToTop.tsx +0 -134
  309. package/src/components/chip/Chip.stories.tsx +0 -61
  310. package/src/components/chip/Chip.test.tsx +0 -31
  311. package/src/components/chip/Chip.tsx +0 -23
  312. package/src/components/container/Container.tsx +0 -42
  313. package/src/components/cookieBanner/CookieBanner.stories.tsx +0 -257
  314. package/src/components/cookieBanner/CookieBanner.test.tsx +0 -68
  315. package/src/components/cookieBanner/CookieBanner.tsx +0 -73
  316. package/src/components/divider/RuleDivider.stories.tsx +0 -254
  317. package/src/components/divider/RuleDivider.test.tsx +0 -164
  318. package/src/components/divider/RuleDivider.tsx +0 -23
  319. package/src/components/dropdown/DropdownMenu.test.tsx +0 -211
  320. package/src/components/dropdown/DropdownMenu.tsx +0 -108
  321. package/src/components/dropdown/useDropdownMenu.ts +0 -249
  322. package/src/components/form/Input.stories.tsx +0 -435
  323. package/src/components/form/Input.test.tsx +0 -206
  324. package/src/components/form/Input.tsx +0 -23
  325. package/src/components/form/TextArea.stories.tsx +0 -464
  326. package/src/components/form/TextArea.test.tsx +0 -232
  327. package/src/components/form/TextArea.tsx +0 -23
  328. package/src/components/layout/footer/Footer.tsx +0 -26
  329. package/src/components/layout/footer/Licence.tsx +0 -19
  330. package/src/components/layout/header/Header.test.tsx +0 -36
  331. package/src/components/layout/header/Header.tsx +0 -90
  332. package/src/components/layout/header/HeaderAuthClient.test.tsx +0 -45
  333. package/src/components/layout/header/HeaderAuthClient.tsx +0 -40
  334. package/src/components/layout/header/HeaderNavClient.test.tsx +0 -44
  335. package/src/components/layout/header/HeaderNavClient.tsx +0 -67
  336. package/src/components/link/ExternalLink.test.tsx +0 -102
  337. package/src/components/link/ExternalLink.tsx +0 -29
  338. package/src/components/link/Link.tsx +0 -26
  339. package/src/components/select/Select.stories.tsx +0 -336
  340. package/src/components/select/Select.test.tsx +0 -474
  341. package/src/components/select/Select.tsx +0 -125
  342. package/src/components/select/SelectSkeleton.stories.tsx +0 -194
  343. package/src/components/select/SelectSkeleton.test.tsx +0 -104
  344. package/src/components/select/SelectSkeleton.tsx +0 -23
  345. package/src/components/select/common.ts +0 -3
  346. package/src/components/select/index.ts +0 -18
  347. package/src/components/skipLink/SkipLink.stories.tsx +0 -346
  348. package/src/components/skipLink/SkipLink.test.tsx +0 -22
  349. package/src/components/skipLink/SkipLink.tsx +0 -49
  350. package/src/map/LegendPanel.tsx +0 -85
  351. /package/src/{components → assets}/images/DefraLogo.tsx +0 -0
  352. /package/src/{components → assets}/images/EaLogo.tsx +0 -0
  353. /package/src/{components → assets}/images/OglLogo.tsx +0 -0
  354. /package/src/components/{googleAnalytics → GoogleAnalytics}/GlobalVars.tsx +0 -0
  355. /package/src/components/{googleAnalytics → GoogleAnalytics}/GoogleAnalytics.tsx +0 -0
@@ -0,0 +1,291 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import {
4
+ Alert,
5
+ AlertAction,
6
+ AlertBody,
7
+ AlertDescription,
8
+ AlertList,
9
+ AlertListItem,
10
+ AlertTitle,
11
+ } from './Alert';
12
+ import { Link } from '../Link/Link';
13
+
14
+ const meta: Meta<typeof Alert> = {
15
+ title: 'Components/Alert',
16
+ component: Alert,
17
+ tags: ['autodocs'],
18
+ parameters: {
19
+ docs: {
20
+ description: {
21
+ component:
22
+ 'Unified alert component covering three GDS patterns. `banner` is a notification banner (coloured header + white content), `outlined` is an error summary (coloured border, white background), and `filled` is a confirmation panel (fully coloured, centred). Use `appearance` to set the colour and `variant` to set the layout pattern.',
23
+ },
24
+ },
25
+ },
26
+ argTypes: {
27
+ appearance: {
28
+ control: { type: 'radio' },
29
+ options: ['info', 'success', 'warning', 'error'],
30
+ },
31
+ variant: {
32
+ control: { type: 'radio' },
33
+ options: ['banner', 'outlined', 'filled'],
34
+ },
35
+ },
36
+ args: {
37
+ appearance: 'info',
38
+ variant: 'banner',
39
+ },
40
+ };
41
+
42
+ export default meta;
43
+
44
+ type Story = StoryObj<typeof Alert>;
45
+
46
+ export const Default: Story = {
47
+ render: (args) => (
48
+ <Alert {...args}>
49
+ <AlertTitle>Important</AlertTitle>
50
+
51
+ <AlertBody>
52
+ <AlertDescription>
53
+ <p>You have 7 days left to send your application.</p>
54
+
55
+ <p>
56
+ <Link href="#">View your application</Link>
57
+ </p>
58
+ </AlertDescription>
59
+ </AlertBody>
60
+ </Alert>
61
+ ),
62
+ };
63
+
64
+ export const Appearances: Story = {
65
+ parameters: {
66
+ docs: {
67
+ description: {
68
+ story: 'All four appearances using the `banner` variant (coloured header + white content).',
69
+ },
70
+ },
71
+ },
72
+ render: () => (
73
+ <div className="flex flex-col gap-gds-6">
74
+ <Alert appearance="info" variant="banner">
75
+ <AlertTitle>Important</AlertTitle>
76
+
77
+ <AlertBody>
78
+ <AlertDescription>
79
+ <p>You have 7 days left to send your application.</p>
80
+ </AlertDescription>
81
+ </AlertBody>
82
+ </Alert>
83
+
84
+ <Alert appearance="success" variant="banner">
85
+ <AlertTitle>Success</AlertTitle>
86
+
87
+ <AlertBody>
88
+ <AlertDescription>
89
+ <p>Your application has been submitted.</p>
90
+ </AlertDescription>
91
+ </AlertBody>
92
+ </Alert>
93
+
94
+ <Alert appearance="warning" variant="banner">
95
+ <AlertTitle>Warning</AlertTitle>
96
+
97
+ <AlertBody>
98
+ <AlertDescription>
99
+ <p>You must complete your profile before the deadline.</p>
100
+ </AlertDescription>
101
+ </AlertBody>
102
+ </Alert>
103
+
104
+ <Alert appearance="error" variant="banner">
105
+ <AlertTitle>There is a problem</AlertTitle>
106
+
107
+ <AlertBody>
108
+ <AlertDescription>
109
+ <p>
110
+ <Link href="#" appearance="error">
111
+ Enter your date of birth
112
+ </Link>
113
+ </p>
114
+ </AlertDescription>
115
+ </AlertBody>
116
+ </Alert>
117
+ </div>
118
+ ),
119
+ };
120
+
121
+ export const ErrorSummary: Story = {
122
+ parameters: {
123
+ docs: {
124
+ description: {
125
+ story:
126
+ 'Use `variant="outlined"` with `appearance="error"` to reproduce the GDS error summary. Place it at the top of a form, above the `<h1>`. `AlertList` links should scroll to and focus the relevant field.',
127
+ },
128
+ },
129
+ },
130
+ render: () => (
131
+ <Alert appearance="error" variant="outlined">
132
+ <AlertTitle>There is a problem</AlertTitle>
133
+
134
+ <AlertList>
135
+ <AlertListItem>
136
+ <Link href="#full-name" appearance="error">
137
+ Enter your full name
138
+ </Link>
139
+ </AlertListItem>
140
+
141
+ <AlertListItem>
142
+ <Link href="#dob" appearance="error">
143
+ Enter your date of birth
144
+ </Link>
145
+ </AlertListItem>
146
+
147
+ <AlertListItem>
148
+ <Link href="#email" appearance="error">
149
+ Enter an email address in the correct format, like name@example.com
150
+ </Link>
151
+ </AlertListItem>
152
+ </AlertList>
153
+ </Alert>
154
+ ),
155
+ };
156
+
157
+ export const OutlinedVariants: Story = {
158
+ parameters: {
159
+ docs: {
160
+ description: {
161
+ story:
162
+ 'All four appearances using the `outlined` variant (coloured border, white background).',
163
+ },
164
+ },
165
+ },
166
+ render: () => (
167
+ <div className="flex flex-col gap-gds-6">
168
+ <Alert appearance="info" variant="outlined">
169
+ <AlertTitle>Before you start</AlertTitle>
170
+
171
+ <AlertDescription>
172
+ <p>You will need your National Insurance number and passport.</p>
173
+ </AlertDescription>
174
+ </Alert>
175
+
176
+ <Alert appearance="success" variant="outlined">
177
+ <AlertTitle>Application saved</AlertTitle>
178
+
179
+ <AlertDescription>
180
+ <p>Your progress has been saved. You can return to complete your application later.</p>
181
+ </AlertDescription>
182
+ </Alert>
183
+
184
+ <Alert appearance="warning" variant="outlined">
185
+ <AlertTitle>Service disruption</AlertTitle>
186
+
187
+ <AlertDescription>
188
+ <p>Some features may be unavailable between 11pm and 1am on Sunday 30 June.</p>
189
+ </AlertDescription>
190
+ </Alert>
191
+
192
+ <Alert appearance="error" variant="outlined">
193
+ <AlertTitle>There is a problem</AlertTitle>
194
+
195
+ <AlertList>
196
+ <AlertListItem>
197
+ <Link href="#full-name" appearance="error">
198
+ Enter your full name
199
+ </Link>
200
+ </AlertListItem>
201
+
202
+ <AlertListItem>
203
+ <Link href="#email" appearance="error">
204
+ Enter an email address in the correct format
205
+ </Link>
206
+ </AlertListItem>
207
+ </AlertList>
208
+ </Alert>
209
+ </div>
210
+ ),
211
+ };
212
+
213
+ export const ConfirmationPanel: Story = {
214
+ parameters: {
215
+ docs: {
216
+ description: {
217
+ story:
218
+ 'Use `variant="filled"` for post-transaction confirmation pages (the GDS panel pattern). The title is very large, and the description is used for a reference number or short confirmation line.',
219
+ },
220
+ },
221
+ },
222
+ render: () => (
223
+ <Alert appearance="success" variant="filled">
224
+ <AlertTitle>Application complete</AlertTitle>
225
+
226
+ <AlertDescription>Your reference number is HDJ2123F</AlertDescription>
227
+ </Alert>
228
+ ),
229
+ };
230
+
231
+ export const FilledVariants: Story = {
232
+ parameters: {
233
+ docs: {
234
+ description: {
235
+ story: 'All four appearances using the `filled` variant.',
236
+ },
237
+ },
238
+ },
239
+ render: () => (
240
+ <div className="flex flex-col gap-gds-6">
241
+ <Alert appearance="info" variant="filled">
242
+ <AlertTitle>Service unavailable</AlertTitle>
243
+
244
+ <AlertDescription>Try again later</AlertDescription>
245
+ </Alert>
246
+
247
+ <Alert appearance="success" variant="filled">
248
+ <AlertTitle>Application complete</AlertTitle>
249
+
250
+ <AlertDescription>Your reference number is HDJ2123F</AlertDescription>
251
+ </Alert>
252
+
253
+ <Alert appearance="warning" variant="filled">
254
+ <AlertTitle>Check your answers</AlertTitle>
255
+
256
+ <AlertDescription>Some information may need to be updated</AlertDescription>
257
+ </Alert>
258
+
259
+ <Alert appearance="error" variant="filled">
260
+ <AlertTitle>There is a problem</AlertTitle>
261
+
262
+ <AlertDescription>Contact support if the issue persists</AlertDescription>
263
+ </Alert>
264
+ </div>
265
+ ),
266
+ };
267
+
268
+ export const WithAction: Story = {
269
+ parameters: {
270
+ docs: {
271
+ description: {
272
+ story: 'Use `AlertAction` for a call-to-action section below the description.',
273
+ },
274
+ },
275
+ },
276
+ render: () => (
277
+ <Alert appearance="info" variant="banner">
278
+ <AlertTitle>Important</AlertTitle>
279
+
280
+ <AlertBody>
281
+ <AlertDescription>
282
+ <p>Your session will expire in 10 minutes.</p>
283
+ </AlertDescription>
284
+
285
+ <AlertAction>
286
+ <Link href="#">Extend your session</Link>
287
+ </AlertAction>
288
+ </AlertBody>
289
+ </Alert>
290
+ ),
291
+ };
@@ -0,0 +1,76 @@
1
+ import type { ComponentProps } from 'react';
2
+
3
+ import { cn } from '../../utils/components';
4
+
5
+ const ALERT_APPEARANCES = {
6
+ info: 'cn-alert-appearance-info',
7
+ success: 'cn-alert-appearance-success',
8
+ warning: 'cn-alert-appearance-warning',
9
+ error: 'cn-alert-appearance-error',
10
+ } as const;
11
+
12
+ const ALERT_VARIANTS = {
13
+ banner: 'cn-alert-variant-banner',
14
+ outlined: 'cn-alert-variant-outlined',
15
+ filled: 'cn-alert-variant-filled',
16
+ } as const;
17
+
18
+ export type AlertAppearance = keyof typeof ALERT_APPEARANCES;
19
+ export type AlertVariant = keyof typeof ALERT_VARIANTS;
20
+
21
+ export type AlertProps = ComponentProps<'div'> & {
22
+ appearance?: AlertAppearance;
23
+ variant?: AlertVariant;
24
+ };
25
+
26
+ export const Alert = ({
27
+ className,
28
+ appearance = 'info',
29
+ variant = 'banner',
30
+ ...props
31
+ }: AlertProps) => (
32
+ <div
33
+ data-slot="alert"
34
+ data-appearance={appearance}
35
+ data-variant={variant}
36
+ role="alert"
37
+ className={cn('cn-alert', ALERT_APPEARANCES[appearance], ALERT_VARIANTS[variant], className)}
38
+ {...props}
39
+ />
40
+ );
41
+
42
+ export type AlertTitleProps = ComponentProps<'div'>;
43
+
44
+ export const AlertTitle = ({ className, ...props }: AlertTitleProps) => (
45
+ <div data-slot="alert-title" className={cn('cn-alert-title', className)} {...props} />
46
+ );
47
+
48
+ export type AlertDescriptionProps = ComponentProps<'div'>;
49
+
50
+ export const AlertDescription = ({ className, ...props }: AlertDescriptionProps) => (
51
+ <div data-slot="alert-description" className={cn('cn-alert-description', className)} {...props} />
52
+ );
53
+
54
+ export type AlertListProps = ComponentProps<'ul'>;
55
+
56
+ export const AlertList = ({ className, ...props }: AlertListProps) => (
57
+ <ul data-slot="alert-list" className={cn('cn-alert-list', className)} {...props} />
58
+ );
59
+
60
+ export type AlertBodyProps = ComponentProps<'div'>;
61
+
62
+ export const AlertBody = ({ className, ...props }: AlertBodyProps) => (
63
+ <div data-slot="alert-body" className={cn('cn-alert-body', className)} {...props} />
64
+ );
65
+
66
+ export type AlertListItemProps = ComponentProps<'li'>;
67
+
68
+ export const AlertListItem = ({ className, ...props }: AlertListItemProps) => (
69
+ <li data-slot="alert-list-item" className={cn('cn-alert-list-item', className)} {...props} />
70
+ );
71
+
72
+ export type AlertActionProps = ComponentProps<'div'>;
73
+
74
+ export const AlertAction = ({ className, ...props }: AlertActionProps) => (
75
+ <div data-slot="alert-action" className={cn('cn-alert-action', className)} {...props} />
76
+ );
@@ -0,0 +1,12 @@
1
+ @layer components {
2
+ /* MARK: BackLink
3
+ Matches GDS spacing (govuk-spacing(3) above and below). Reuses cn-link
4
+ for underline/hover/focus styling, this just adds the icon and layout. */
5
+ .cn-back-link {
6
+ @apply inline-flex items-center gap-1 my-gds-3;
7
+ }
8
+
9
+ .cn-back-link-icon {
10
+ @apply size-4 shrink-0;
11
+ }
12
+ }
@@ -0,0 +1,52 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { BackLink } from './BackLink';
4
+
5
+ const meta: Meta<typeof BackLink> = {
6
+ title: 'Components/BackLink',
7
+ component: BackLink,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component: `
13
+ Matches the GDS back link: a chevron and "Back" text, styled like a normal link.
14
+
15
+ - Pass \`href\` when you know the destination (preferred, works without JavaScript, supports right-click/open-in-new-tab). Behaves like a normal link.
16
+ - Omit \`href\` and it falls back to \`window.history.back()\`, a plain browser API rather than anything framework-specific, so it works the same in Next.js, a plain SPA, or anywhere else.
17
+ - Pass \`onClick\` to fully override the behaviour (e.g. a Next.js app that prefers \`router.back()\` for its loading-state integration).
18
+ `.trim(),
19
+ },
20
+ },
21
+ },
22
+ };
23
+
24
+ export default meta;
25
+
26
+ type Story = StoryObj<typeof BackLink>;
27
+
28
+ export const Default: Story = {
29
+ parameters: {
30
+ docs: {
31
+ description: {
32
+ story: 'No `href` or `onClick`, falls back to `window.history.back()`.',
33
+ },
34
+ },
35
+ },
36
+ render: () => <BackLink />,
37
+ };
38
+
39
+ export const WithHref: Story = {
40
+ parameters: {
41
+ docs: {
42
+ description: {
43
+ story: 'A real `href` is the preferred approach when the destination is known upfront.',
44
+ },
45
+ },
46
+ },
47
+ render: () => <BackLink href="/previous-page" />,
48
+ };
49
+
50
+ export const CustomText: Story = {
51
+ render: () => <BackLink href="/applications">Back to applications</BackLink>,
52
+ };
@@ -0,0 +1,44 @@
1
+ 'use client';
2
+
3
+ import { type ComponentProps, type MouseEvent } from 'react';
4
+
5
+ import { LuChevronLeft } from 'react-icons/lu';
6
+
7
+ import { cn } from '../../utils/components';
8
+ import { Link } from '../Link/Link';
9
+
10
+ export type BackLinkProps = ComponentProps<typeof Link>;
11
+
12
+ export const BackLink = ({ href, onClick, children, className, ...props }: BackLinkProps) => {
13
+ const handleClick = (event: MouseEvent<HTMLAnchorElement>) => {
14
+ // A real href was given, this is a genuine link, let it navigate normally.
15
+ if (href !== undefined) {
16
+ onClick?.(event);
17
+
18
+ return;
19
+ }
20
+
21
+ // No href to navigate to, so the href="#" fallback below isn't a real
22
+ // destination, don't let it jump to the top of the page.
23
+ event.preventDefault();
24
+
25
+ if (onClick) {
26
+ onClick(event);
27
+ } else {
28
+ window.history.back();
29
+ }
30
+ };
31
+
32
+ return (
33
+ <Link
34
+ href={href ?? '#'}
35
+ onClick={handleClick}
36
+ className={cn('cn-back-link', className)}
37
+ {...props}
38
+ >
39
+ <LuChevronLeft aria-hidden className="cn-back-link-icon" />
40
+
41
+ {children ?? 'Back'}
42
+ </Link>
43
+ );
44
+ };
@@ -0,0 +1,23 @@
1
+ @layer components {
2
+ /* MARK: Back to top
3
+ Fixed to the bottom-right corner. Hidden via inert + opacity when above
4
+ the scroll threshold, fades in once the user has scrolled down. The link
5
+ itself provides the scroll behaviour, so no JS scroll handler is needed. */
6
+ .cn-back-to-top {
7
+ @apply fixed bottom-gds-4 right-gds-4 z-40 whitespace-nowrap opacity-0 pointer-events-none
8
+ p-gds-1 panel;
9
+ transition: opacity 0.15s ease;
10
+
11
+ &[data-visible='true'] {
12
+ @apply opacity-100 pointer-events-auto;
13
+ }
14
+ }
15
+
16
+ .cn-back-to-top-link {
17
+ @apply flex items-center gap-1;
18
+
19
+ & svg {
20
+ @apply size-[1em];
21
+ }
22
+ }
23
+ }
@@ -0,0 +1,41 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+
3
+ import { BackToTop } from './BackToTop';
4
+
5
+ const meta: Meta<typeof BackToTop> = {
6
+ title: 'Components/BackToTop',
7
+ component: BackToTop,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ docs: {
11
+ description: {
12
+ component:
13
+ 'A floating "Back to Top" button that appears when the user scrolls down and allows quick navigation back to the top of the page.',
14
+ },
15
+ },
16
+ },
17
+ argTypes: {},
18
+ args: {},
19
+ };
20
+
21
+ export default meta;
22
+
23
+ type Story = StoryObj<typeof BackToTop>;
24
+
25
+ export const Default: Story = {
26
+ render: ({ ...args }) => {
27
+ const content = `
28
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean elementum sagittis velit eget cursus. In et justo sem. Donec posuere turpis nibh, id blandit tellus consectetur nec. Aliquam tincidunt elit eros, hendrerit fermentum erat rhoncus eu. Ut ultricies turpis vitae massa posuere suscipit. Aenean blandit nulla et orci ultrices tempor. Etiam eu metus diam. Sed porttitor lorem id ultrices tincidunt. Aenean vel orci purus. Cras eget faucibus nisl. Nam finibus, purus sed dignissim viverra, nibh enim blandit leo, vitae porttitor augue nunc non diam. Sed ac imperdiet lectus. In finibus mattis dapibus.
29
+ `.repeat(7);
30
+
31
+ return (
32
+ <div className="flex justify-center relative">
33
+ <div id="top" aria-hidden="true" />
34
+
35
+ <p className="max-w-96">{content}</p>
36
+
37
+ <BackToTop {...args} />
38
+ </div>
39
+ );
40
+ },
41
+ };
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+
3
+ import { useEffect, useState, type ComponentProps } from 'react';
4
+
5
+ import { LuArrowUp } from 'react-icons/lu';
6
+
7
+ import { cn } from '../../utils/components';
8
+ import { Link } from '../Link/Link';
9
+
10
+ export type BackToTopProps = Omit<
11
+ ComponentProps<typeof Link>,
12
+ 'href' | 'children' | 'target' | 'ref'
13
+ > & {
14
+ topId?: string;
15
+ threshold?: number;
16
+ };
17
+
18
+ export const BackToTop = ({
19
+ className,
20
+ topId = 'top',
21
+ threshold = 300,
22
+ ...props
23
+ }: BackToTopProps) => {
24
+ const [isVisible, setIsVisible] = useState(false);
25
+
26
+ useEffect(() => {
27
+ const handleScroll = () => setIsVisible(window.scrollY > threshold);
28
+
29
+ handleScroll();
30
+
31
+ window.addEventListener('scroll', handleScroll, { passive: true });
32
+
33
+ return () => window.removeEventListener('scroll', handleScroll);
34
+ }, [threshold]);
35
+
36
+ return (
37
+ <div
38
+ className={cn('cn-back-to-top', className)}
39
+ data-visible={isVisible}
40
+ inert={isVisible ? undefined : true}
41
+ >
42
+ <Link href={`#${topId}`} className="cn-back-to-top-link" {...props}>
43
+ <LuArrowUp aria-hidden />
44
+ Back to top
45
+ </Link>
46
+ </div>
47
+ );
48
+ };
@@ -0,0 +1,42 @@
1
+ @layer components {
2
+ /* MARK: Breadcrumb
3
+ No margin here on purpose: components in this library don't set their
4
+ own external spacing, that's the consuming layout's call (e.g. a Stack
5
+ gap), so Breadcrumb doesn't assume what surrounds it. text-body/white
6
+ here (not on cn-breadcrumb-page) so the current-page
7
+ text AND the separator icons (react-icons defaults to
8
+ fill/stroke: currentColor) both follow whichever appearance is picked,
9
+ from one place, via inheritance rather than two separate overrides. */
10
+ .cn-breadcrumb {
11
+ @apply text-base text-body;
12
+
13
+ &[data-appearance='inverse'] {
14
+ @apply text-white;
15
+ }
16
+ }
17
+
18
+ .cn-breadcrumb-list {
19
+ @apply m-0 p-0 list-none flex flex-wrap items-center gap-1;
20
+ }
21
+
22
+ /* MARK: Item
23
+ display comes entirely from the reveal/hide utility applied per item in
24
+ the TSX (or the constant "inline-flex" for the always-visible first and
25
+ last items), never set here, so there's only ever one utility deciding
26
+ display for a given item and nothing to override. */
27
+ .cn-breadcrumb-item {
28
+ @apply items-center gap-1;
29
+ }
30
+
31
+ /* items-center on cn-breadcrumb-item centers the icon against the text's
32
+ full line-height box, but text reads as visually centered around its
33
+ cap-height, which sits a little above the geometric centre of that box,
34
+ so a flex-centered icon looks slightly low next to it. Nudge up 1px. */
35
+ .cn-breadcrumb-separator {
36
+ @apply size-3 shrink-0 -mt-px;
37
+ }
38
+
39
+ .cn-breadcrumb-ellipsis-text {
40
+ @apply select-none;
41
+ }
42
+ }